
$(document).ready(function() {
    $('#header-cycle').cycle({
		fx: 'fade',
		timeout:4000,
		speed:2000
	});
	$('#seasonal-cycle').cycle({
		fx: 'fade',
		timeout:4000,
		speed:2000
	});
	$('.cycle').cycle({
		fx: 'fade',
		timeout:4000,
		speed:2000
	});
});

if ($.browser.msie && $.browser.version<7) {
	$(document).ready(function() {
		/*Png fixes*/
		
		DD_belatedPNG.fix("#content");
		DD_belatedPNG.fix("#header");
		DD_belatedPNG.fix("#top-corner");
		
		DD_belatedPNG.fix("#title h1 a img");
		
		DD_belatedPNG.fix("#border");
		DD_belatedPNG.fix("#border2");
				
		/*
		* Executes Javascript on page load
		* From http://simonwillison.net/2004/May/26/addLoadEvent/
		* Credit goes to Simon Willison
		*/
		function addLoadEvent(func) {
			var oldonload = window.onload;
			
			if (typeof window.onload != 'function') {
				window.onload = func;
			} else {
				window.onload = function() {
					if (oldonload) {
						oldonload();
					}
					func();
				};
			}
		}

		addLoadEvent(RegisterMenuVisibility);

		/*
		* Function registers hover events for each menu item
		*/
		function RegisterMenuVisibility() {
			var menu = document.getElementById("navigation");
			var menu_items = menu.getElementsByTagName("li");
			
			//get all menu items and register their hovers
			for (var i=0; i < menu_items.length; i++) {
				//on hover
				menu_items[i].onmouseover = function() {
					var submenus = this.getElementsByTagName("ul");
					
					if (submenus.length>0) {
						submenus[0].style.display="block";
					}
				};
				
				//on lost hover
				menu_items[i].onmouseout = function() {
					var submenus = this.getElementsByTagName("ul");
					
					if (submenus.length>0) {
						submenus[0].style.display="none";
					}
				};
			}
		}
	});
}


