
// Defines the Accordion
function AccordionInit() {

	var accTitle = $$('.menuTitle');
	var accContent = $$('.content');
	var pwAccordion = new Accordion(
		accTitle, accContent, {

			onActive: function(tog){
				tog.addClass('selected');
				tog.setStyle('background-image', 'url(images/arrow-down.gif)');
				var accTitleOnOff = new Fx.Styles(tog, {wait: false, duration: 0});
				accTitleOnOff.start({
				});
			},

			onBackground: function(tog){
				tog.removeClass('selected');
				tog.setStyle('background-image', 'url(images/arrow-left.gif)');
				var accTitleOnOff = new Fx.Styles(tog, {wait: false, duration: 0});
				accTitleOnOff.start({
				});
			},

			alwaysHide: true,
			duration: 500,
			show: 200
		}
	);

	// Mouse effects
	accTitle.each(function(div) {    
		var mouseFxs = new Fx.Styles(div, {duration: 0, wait: false});
		div.addEvents({
			'mouseover': function(){
				if (!div.hasClass('selected')) {
					mouseFxs.start({
					});
				}
			},
			'mouseout': function(){
				if (!div.hasClass('selected')) {
					mouseFxs.start({
					});
				}
			}
		});
	});
}

window.addEvent('domready', function(){
	AccordionInit();
});

startList = function() {
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.nodeName=="LI") {
				node.onmouseover=function() {
					this.className+=" over";
				}
				node.onmouseout=function() {
					this.className=this.className.replace(" over", "");
				}
			}
		}
	}
}
window.onload=startList;