// JavaScript Document
var imageArray = ['worldwarcraft_gold_us.jpg','worldwarcraft_gold_eu.jpg','worldwarcraft_account_eu.jpg','wwg_war_pl_eu.jpg','wwg_war_pl_us.jpg','rift_gold_eu.jpg','rift_pl_eu.jpg','bwg_war2.jpg','wowus_pl.jpg','woweu_pl.jpg','bwg_war1.jpg','gold.jpg','account.jpg','pl.jpg','cdk.jpg','faq.jpg','news.jpg','register.jpg','login.jpg','bgpay_upnav.jpg','buy2.jpg','go_paying.jpg','wwg_pl_nav2.jpg','logout.jpg','my_center.jpg','check_account.jpg','submit.jpg','sign_img.png','home.jpg','buy_gold.jpg','item.jpg'];
$.each(imageArray,function(n,value) {  
	var strSearch = 'img[src$="/images/' + value + '"] , input:image[src$="/images/' + value + '"]';
	var img = $(strSearch);	
	if ( img.size() > 0)
	{
		var srcimg = img[0].src;
		if(srcimg.indexOf("jpg")>-1)
		{
		srcimg = value.replace(".jpg","");	
		(new Image()).src = "/images/" + srcimg + "_hover.jpg";
		img.bind("mouseover", function(){ this.src="/images/" + srcimg + "_hover.jpg"; });
		img.bind("mouseout", function(){ this.src="/images/" + srcimg + ".jpg"; });
		}
		else if(srcimg.indexOf("png")>-1)
		{
			srcimg = value.replace(".png","");	
		(new Image()).src = "/images/" + srcimg + "_hover.png";
		img.bind("mouseover", function(){ this.src="/images/" + srcimg + "_hover.png"; });
		img.bind("mouseout", function(){ this.src="/images/" + srcimg + ".png"; });
		}
		else
		{
		srcimg = value.replace(".gif","");	
		(new Image()).src = "/images/" + srcimg + "_hover.gif";
		img.bind("mouseover", function(){ this.src="/images/" + srcimg + "_hover.gif"; });
		img.bind("mouseout", function(){ this.src="/images/" + srcimg + ".gif"; });
		}
	}
});
	
$('.switcher').bind('click', function() {
	$(this).find('.coption').slideToggle('fast');
});
$('.switcher').bind('mouseleave', function() {
	$(this).find('.coption').slideUp('fast');
}); 
	


$("#selectGame").bind('change',function()
{
	ajaxAddOptions("/quickbuy/getGameServer/" + $("#selectGame").val() , $("#selectServer"), "id", "text");
	ajaxAddOptions("/quickbuy/getGameFirstBlock/" + $("#selectGame").val()  , $("#selectBlock"), "id", "text");
});

$("#selectServer").bind('change',function()
{
	ajaxAddOptions("/quickbuy/getGameBlock/" + $("#selectGame").val() + "/" + $("#selectServer").val()  , $("#selectBlock"), "id", "text");
});
