
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 clickedImage = new Image();
		var overImage = new Image();
		
		clickedImage.src = "wp-content/themes/carpifc/images/clicked.gif";
		overImage.src = "wp-content/themes/carpifc/images/over.gif";

		togglers.each(function(tog){
			$(tog).addEvent('mouseover', function(){if($(tog).className !='menuclicked')$(tog).style.backgroundImage="url(wp-content/themes/carpifc/images/over.gif)"}.bind(this));

			$(tog).addEvent('mouseout', function(){if($(tog).className !='menuclicked')$(tog).style.backgroundImage="url(wp-content/themes/carpifc/images/normal.gif)"}.bind(this));
			
		}, this);

		var myAccordion = new Fx.Accordion(togglers, stretchers, { opacity: false, start: false, transition: Fx.Transitions.quadOut,
		
		onActive: function(toggler, i){
									toggler.style.backgroundImage="url(wp-content/themes/carpifc/images/clicked.gif)";
									toggler.className ='menuclicked';
		}
		
		,
		onBackground: function(toggler, i){
									toggler.style.backgroundImage="url(wp-content/themes/carpifc/images/normal.gif)";
									toggler.className ='menunormal';
		}

		});

	//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(document.getElementById('mnuheader').value!="")
		myAccordion.showThisHideOpen(document.getElementById('mnuheader').value);

};

try {
	Window.disableImageCache();
}catch(e){}