// JavaScript Document
var imageArray = ['home.jpg','gold.jpg','powerlevel.jpg','account.jpg','pl.jpg','cdk.jpg','faq.jpg','news.jpg','articles.jpg','register.jpg','login.jpg','item.jpg','quickbuy_buy_now.jpg','my_center.jpg','logout.jpg','hotgame_img1.jpg','hotgame_img2.jpg','hotgame_img3.jpg','hotgame_img4.jpg','a.jpg','b.jpg','c.jpg','d.jpg','e.jpg','f.jpg','g.jpg','h.jpg','i.jpg','g.jpg','k.jpg','l.jpg','m.jpg','n.jpg','o.jpg','p.jpg','q.jpg','r.jpg','s.jpg','t.jpg','u.jpg','v.jpg','w.jpg','s.jpg','y.jpg','z.jpg','buy.png','confirm_paying.jpg','update_method.jpg','check_account.jpg','sign_up.jpg','hot_wow_us_gold.jpg','hot_wow_eu_gold.jpg','hot_wow_us_pl.jpg','hot_wow_eu_pl.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");
});
