// JavaScript Document
var imageArray = ['login.jpg','banner_signup.jpg','quickbuy.jpg','home.jpg','gil.jpg','powerleveling.jpg','cdkey.jpg','item.jpg','article.jpg','faq.jpg','contact.jpg','gil2.jpg','cdkey2.jpg','item2.jpg','wu_gold.jpg','we_powerleveling.jpg','wu_account.jpg','wu_cdkey.jpg','wu_item.jpg','we_gold.jpg', 'we_powerleveling.jpg','we_account.jpg','we_cdkey.jpg','we_item.jpg','buy.jpg','four_img_1.jpg','four_img_2.jpg','four_img_3.jpg','wu_powerleveling.jpg','register.jpg','search.jpg','four_img_4.jpg','text_aboutus.jpg','text_article.jpg','text_faq.jpg','ad1.jpg','ad2.jpg','ad3.jpg','ad4.jpg','ffxiv_gil.jpg','ffxiv_account.jpg','ffxiv_cdkey.jpg','ffxiv_item.jpg','forgot_submit.jpg','wowaccount.jpg','wowitems.jpg','contactus.jpg','buy_wg_us.jpg','wpl_us.jpg','waccount_us.jpg','wcdk_us.jpg','buy_wg_eu.jpg','wpl_us.jpg','waccount_us.jpg','wcdk_eu.jpg','game_account.jpg','game_gold.jpg','game_items.jpg','powerleveling.jpg','wowgold.jpg','buy2.png','warhammer_gold_us.jpg','buy_powerleveling.jpg','warhammer_gold_eu.jpg','ffxi_gold.jpg','eq2_gold.jpg','ffxiv_gold.jpg','eq_gold.jpg','aoc_eu_gold.jpg','aoc_us_gold.jpg','eve_gold.jpg','aion_eu_gold.jpg','aion_us_gold.jpg','2moons_gold.jpg','anarchy_gold.jpg','sto_gold.jpg','atlantica_gold.jpg','guildwars_gold.jpg','lotro_eu_gold.jpg','lotro_us_gold.jpg','rose_gold.jpg','secondlife_gold.jpg','silkroad_gold.jpg','smallgame_1.gif','smallgame_2.gif','game_tera.jpg','rift.jpg','left_ffxiv_gold.jpg','game_faq','swtor_gold.jpg','swtor_pl.jpg','gw2_gold.jpg','gw2_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("gif")>-1)
		{
		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"; });
		}
		else
		{
			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"; });
			}
	}
});
	
$('.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");
});
