// JavaScript Document
var imageArray = ['login.jpg','buy.gif','menu_01.jpg','menu_02.jpg','menu_03.jpg','menu_04.jpg','menu_05.jpg','menu_07.jpg','menu_08.jpg','menu_06.jpg','item2.jpg','modify_profile.jpg','buy_now.jpg','checkaccount.jpg','confirm_hover.jpg','payment.jpg','search.jpg','sign_up.jpg','quick_buy2.jpg','quick_buy3.jpg','login.jpg','register.jpg','feedback_tt.jpg','about_tt.jpg','home.jpg','gold.jpg','powerleveling.jpg','item.jpg','news.jpg','faq.jpg','left_gold.jpg','left_pl.jpg','left_item.jpg','complete.jpg','ad_num_2.jpg','index_bottom_gold.jpg','index_bottom_pl.jpg','buy2.png','logout.png','my_center.png','gold_buy_now.jpg','buy.jpg','ad_num_1.jpg','pl_buy_now.jpg','articles.jpg','account.jpg','center_gold.jpg','center_pl.jpg','center_home.jpg','center_account.jpg','login2.jpg','sign_up2.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");
});
