// JavaScript Document

jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++)
	{
		jQuery("<img>").attr("src", arguments[i]);
	}
} 

$.preloadImages("../images/xhome_over_blog.jpg", "../images/xleague_over.jpg", "../images/xabout_over.jpg", "../images/xnews_over.jpg", "../images/xstore_over.jpg", "../images/xfaq_over.jpg", "../images/xcontact_over.jpg", "../images/xblog_over.jpg", "../images/xonline_over.jpg" );
$(
	function()
	{
		// do something when page is ready
		$("#home img").hover(
			function()
			{
				this.src = "../images/xhome_over_blog.jpg";
			}
			,
			function()
			{	
			if (activepage == 'home'){
				this.src = "../images/xhome_over_blog.jpg";
			}else{
				this.src = "../images/xhome_up_blog.jpg";
			}
			}
		)

		$("#league img").hover(
		function()
		{
			this.src = "../images/xleague_over.jpg";
		}
		,
		function()
		{
			if (activepage == 'league') {
			this.src = "../images/xleague_over.jpg";
			}else{
			this.src = "../images/xleague_up.jpg";
			}
		}
		)
		
		$("#about img").hover(
		function()
		{
			this.src = "../images/xabout_over.jpg";
		}
		,
		function()
		{
			if (activepage == 'about'){
				this.src = "../images/xabout_over.jpg";
			}else{
			this.src = "../images/xabout_up.jpg";
			}
		}
		)
		
		
		$("#news img").hover(
		function()
		{
			this.src = "../images/xnews_over.jpg";
		}
		,
		function()
		{
			if (activepage == 'news') {
			this.src = "../images/xnews_over.jpg";
			}else{
			this.src = "../images/xnews_over.jpg";	
			}
			
		}
		)

		$("#store img").hover(
		function()
		{
			this.src = "../images/xstore_over.jpg";
		}
		,
		function()
		{
			if (activepage == 'store'){
			this.src = "../images/xstore_over.jpg";	
			}else{
			this.src = "../images/xstore_up.jpg";
			}
			
		}
		)
		
		$("#faq img").hover(
		function()
		{
			this.src = "../images/xfaq_over.jpg";
		}
		,
		function()
		{
			if (activepage == 'faq'){
			this.src = "../images/xfaq_over.jpg";	
			}else{
				
			}this.src = "../images/xfaq_up.jpg";
			
		}
		)
		
		$("#contact img").hover(
		function()
		{
			this.src = "../images/xcontact_over.jpg";
		}
		,
		function()
		{
			if (activepage == 'contact'){
			this.src = "../images/xcontact_over.jpg";
			}else{
			this.src = "../images/xcontact_up.jpg";
			}
		}
		)
		$("#online img").hover(
		function()
		{
			this.src = "../images/xonline_over.jpg";
		}
		,
		function()
		{
			if (activepage == 'online'){
			this.src = "../images/xonline_over.jpg";
			}else{
			this.src = "../images/xonline_up.jpg";
			}
		}
		)
		$("#blog img").hover(
		function()
		{
			this.src = "../images/xblog_over.jpg";
		}
		,
		function()
		{
			if (activepage == 'blog'){
			this.src = "../images/xblog_over.jpg";
			}else{
			this.src = "../images/xblog_up.jpg";
			}
		}
		)		
		
	}
)
