// JavaScript Document



ddaccordion.init({
	headerclass: "expandable", //Shared CSS class name of headers group that are expandable
	contentclass: "categoryitems", //Shared CSS class name of contents group
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [0], //index of content(s) open by default [index1, index2, etc]. [] denotes no content
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", "openheader"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "normal" //speed of animation: "fast", "normal", or "slow"
})



function onMyMenuOpen(obj)
{		
	var dl = obj.dl;
	var dt = obj.dt;
	var dd = obj.dd;
	var d = document.createElement('div');
	d.className = 'debug';
	d.innerHTML =  dt.innerHTML + ' is opened' ;
	document.body.insertBefore( d , dl.nextSibling);
};

function onMyMenuClose(obj)
{
	var dl = obj.dl;
	var dt = obj.dt;
	var dd = obj.dd;
	var d = document.createElement('div');
	d.className = 'debug';
	d.innerHTML =  dt.innerHTML + ' is closed' ;
	document.body.insertBefore( d , dl.nextSibling);
};

var oOptions=
{	
	/*all options are optional*/
	/* [ bool ] if dependent is false, then each menu open/close independently*/
	dependent:false,
	
	/* [function] callback when a menu is opened*/
	onOpen:onMyMenuOpen,
	
	/* [function] ccallback when a menu is closed*/
	onClose:onMyMenuClose,
	
	/* [array] cdefault ids of opened menues' <dt>*/
	openedIds:['my-dt-1','my-dt-3'],
	
	/* [number ] seconds for animations*/
	seconds:0.2,
	
	/*[ bool ] set true if the animation is to be played slower and slower and vise versa*/
	easeOut:false,
	
	/*[ bool ] set true if the animation is to be played*/
	animation:true
}
var setting = new AccordionMenu.setting('my-dl',oOptions);