// JavaScript Document
var imageArray = ['login.jpg','register.jpg','quickbuy.jpg','home.jpg','gold.jpg','powerlevel.jpg','cdkey.jpg','item.jpg','contact.jpg','account.jpg','game_wow.jpg','game_ffxiv.jpg','game_war.jpg','game_eve.jpg','game_eq.jpg','game_eq2.jpg','game_sto.jpg','game_aoc.jpg','game_aion.jpg','game_anarchy.jpg','game_atlantica.jpg','game_moons.jpg','game_ffxi.jpg','game_guild.jpg','game_lotro.jpg','game_rose.jpg','game_silkroad.jpg','game_swtor.jpg','buynow.jpg','wow_gold_us.jpg','wow_pl_us.jpg','wow_account_us.jpg','wow_cdkey_us.jpg','wow_item_us.jpg','wow_gold_eu.jpg','wow_pl_eu.jpg','wow_account_eu.jpg','wow_cdkey_eu.jpg','wow_item_eu.jpg','buy.jpg','go.jpg','confirm.jpg','right_game_wow.jpg','right_game_ffxiv.jpg','right_game_war.jpg','right_game_eve.jpg','right_game_eq.jpg','right_game_eq2.jpg','right_game_sto.jpg','right_game_aoc.jpg','right_game_aion.jpg','right_game_anarchy.jpg','right_game_atlantica.jpg','right_game_moons.jpg','right_game_ffxi.jpg','right_game_guild.jpg','right_game_lotro.jpg','right_game_rose.jpg','right_game_silkroad.jpg','right_game_swtor.jpg','account_buygold.jpg','account_buypl.jpg','account_home_page.jpg','account_account.jpg','account_my_info.jpg','account_edit_profile.jpg','account_order_list.jpg','game_buy_now.jpg','rift_online.jpg','right_game_tera.jpg','swtor_gold_us.jpg','swtor_pl_us.jpg','swtor_gold_eu.jpg','swtor_pl_eu.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
		{
		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");
});



$(document).ready(function(){	
						   
	var nShowdivID = 1;
	var m_tAutodivShow;
	$(document).ready(function(){
	$.extend({
	   show1:function(){
			nShowdivID++;
			if ( nShowdivID > 2)
				nShowdivID = 1;
			divqiehuan(nShowdivID)
	   }
	});
	m_tAutodivShow = setInterval("$.show1()",6000);
});
});	

function divqiehuan(nShowdivID)
{
   if(nShowdivID==1)
   {
	  $("#divbanner1").css("display","");
	  $("#divbanner2").css("display","none");
   }
  else
   {
	  $("#divbanner1").css("display","none");
	  $("#divbanner2").css("display","");
	}
	
}





