// JavaScript Document
var imageArray = ['tera_gold_us.jpg','tera_pl_us.jpg','tera_gold_eu.jpg','tera_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 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');
}); 
	


function ajaxAddOptions(url, target, id, text){  
     target.empty(); 
     $.getJSON(url, function(json){
         $(json).each(function(i){  
             var x = json[i]; 
             target.append("<option value='" + eval("x." + id) + "'>" + eval("x." + text) + "</option>" );  
         })  
     });  
}


$(document).ready(function(){
			
     
		ajaxAddOptions("/quickbuy/getGameBlock/33/1330"  , $("#selectBlock"), "id", "text");

	
	
 });

function quickbuy()
{
	
	window.location.href = "/fillorder/fillgoldorder/1330/"+$("#selectBlock").val()+"/33"; 

}

function showgamelist()
{
	if(!showlist)
	{
		$("#gamelist").slideDown('slow');
		showlist = true;
	}
	else
	{
		$("#gamelist").slideUp('slow');
		showlist = false;
	}
}

