
var stretchers = $$('div.accordion');
stretchers.each(function(item){
	item.setStyles({'height': '0', 'overflow': 'hidden'});
});

window.onload = function(){ //safari cannot get style if window isnt fully loaded
	
	var togglers = $$('h3.toggler');
	
	var bgFx = [];
	
	togglers.each(function(toggler, i){
		toggler.defaultColor = toggler.getStyle('background-color');
		
		//fx creation
		bgFx[i] = new Fx.Color(toggler, 'background-color', {wait: false});
	});
	
 
	var myAccordion = new Fx.Accordion(togglers, stretchers, { 
	   opacity: false, 
	   start: true, 
	   display: 2, 
	   alwaysHide: true, 

	   //transition: Fx.Transitions.quadOut,
	   
	   onActive: function(toggler, element){
			toggler.setStyle('color', '#41464D');
			toggler.setStyle('background-image', 'url(../menu_v/back_acc_o.png)');
		},
		onBackground: function(toggler, element){
			toggler.setStyle('color', '#528CE0');
			toggler.setStyle('background-image', 'url(../menu_v/back_acc.png)');
		}
		
		//onActive: function(toggler, i){
			//bgFx[i].toColor('#85c893');
			//toggler.getFirst().setStyle('color', '#000');

			//toggler.getFirst().setStyle('text-decoration', 'none');
			//toggler.getFirst().parentNode.setStyle('background-image', 'url(../menu_v/back_acc_o.png)');
			//toggler.getFirst().parentNode.setStyle('padding-bottom', '11px');

			// fix top and bottom images accordingly
			//$('top_round').className = (i != 0) ? "top_dark" : "top_light";
			//$('bottom_round').className = (i != 4) ? "bottom_dark" : "bottom_light";
			
		//},
		
		//onBackground: function(toggler, i){
			//bgFx[i].clearTimer();

			//if(i != 0) {
			//	toggler.getFirst().parentNode.setStyle('padding-bottom', '8px'); 
             //   toggler.getFirst().parentNode.setStyle('background-image', 'url(../menu_v/back_acc.png)');
				// reset styles
			//	toggler.getFirst().parentNode.setStyle('border-bottom-color', '#fff');
		//	}
		///	else {
		//		toggler.getFirst().parentNode.setStyle('padding-bottom', '8px');
		//		toggler.getFirst().parentNode.setStyle('border-bottom-color', '#efefef');
        //        toggler.getFirst().parentNode.setStyle('background-image', 'url(../menu_v/back_acc.png)');
		//	}
			
		///	toggler.setStyle('background-color', toggler.defaultColor);
		//	toggler.getFirst().setStyle('text-decoration', 'none');

			
			//toggler.getFirst().setStyle('color', '#666');
		//}
		
	});
	
	//anchors
	function checkHash(){
		var found = false;
		$$('h3.toggler a').each(function(link, i){
			if (window.location.hash.test(link.hash)){
				myAccordion.showThisHideOpen(i);
				found = true;
			}
		});
		return found;
	}

	 //if (!checkHash()) myAccordion.showThisHideOpen(3);
	   if (!checkHash()) myAccordion.showThisHideOpen(10) ;
	    myAccordion.showThisHideOpen = function(toShow){this.clearAndToggle(toShow);};
                       toggles.each( function(h3,i) {
                       myAccordion.showThisHideOpen(stretchers[i]);
						
						
                });

};

try {
	Window.disableImageCache();
}catch(e){}