// JavaScript Document
var imageArray = ['home.jpg','gold.jpg','pl.jpg','delivery.jpg','articles.jpg','contact_us.jpg','swtor_gold_us.jpg','swtor_gold_eu.jpg','swtor_pl_us.jpg','swtor_pl_eu.jpg','swtor_gold_us_img.jpg','swtor_gold_eu_img.jpg','swtor_pl_us_img.jpg','swtor_pl_eu_img.jpg','buynow_2.jpg','buynow_3.jpg','article_tt.jpg','about_us_tt.jpg','faq_tt.jpg','wow_gold_us_bg.jpg','wow_gold_eu_bg.jpg','wow_pl_us_bg.jpg','wow_pl_eu_bg.jpg','gw2_gold.jpg','gw2_pl.jpg','rift_gold_us.jpg','rift_gold_eu.jpg','rift_pl_us.jpg','rift_pl_eu.jpg','gold2.jpg','inside_banner_img.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");
});

function showgamelist()
{
	if(!showlist)
	{
		$("#gamelist").slideDown('slow');
		showlist = true;
	}
	else
	{
		$("#gamelist").slideUp('slow');
		showlist = false;
	}
}

