window.addEvent('domready', function() {
//scroll internal links
	var scrollWindow = new SmoothScroll({
		wait: false,
		duration: 1500,
		transition: Fx.Transitions.Expo.easeInOut
	});
//small CSS fix for Firefox
	if(window.gecko){
		$$('#nav li a').each(function(link, i){
			if(link.getParent().getParent().getProperty('id') == "nav"){link.setStyle('paddingBottom','9px');}
		})
	}
//IE6 fixes - so stupid
	if(window.ie6){
		window.addEvent('resize', function(){
			var headContents = $('headContents');
			var currentZ = headContents.getStyle('zIndex').toInt();
			headContents.setStyle('zIndex', currentZ+=5);
		});
	}
//menu animations
	$$("#nav li a").each(function(navLink,i){
		//only make animations for list items with a sub-menu
		if(navLink.getNext()){
			//create the effect for sub-navigation
			var subNavFX = new Fx.Styles(navLink.getNext(), {
				wait:false,
				duration: 500,
				transition: Fx.Transitions.Expo.easeOut
			});
			//remember individual heights
			var thisHeight = new Array();
			thisHeight[i] = navLink.getNext().getSize().size.y;
			//set initial styles to prevent flickering
			navLink.getNext().setStyles({
				opacity: 0,
				height:0,
				left: 'auto'
			});
			//mouse over event on the main nav link
			navLink.addEvent("mouseenter", function(ev){
				if(navLink.getNext()){
					//add hover class
					navLink.getParent().addClass("hover");
					//animate in
					subNavFX.start({
						opacity: 1,
						height: thisHeight[i]
					});
				}
				//change background color of link for pages we are not on
				if(navLink.getParent().getProperty('id') !="current"){
					navLink.setStyle('backgroundColor', '#d1c9b1');
				}
			});
			//mouse out on the main nav list item
			navLink.getParent().addEvent("mouseleave", function(ev){
				//change the link color back to transparent
				if(navLink.getParent().getProperty('id') !="current"){
					navLink.setStyle('backgroundColor', 'transparent');
				}
				//animate out and remove hover class
				subNavFX.start({
						opacity: 0,
						height: 0
					}).chain(function(){navLink.getParent().removeClass("hover");});
			});
		}
	});
});