$.ajaxSetup( {
type : 'POST',	   
 url  : 'http://www.gogoer.com/ajax.php'
} ); 

function selgamefun()
{
  $("#load_ajax_quickgoldgamelist2").attr('style','display:block');
 var $cpath=(document.getElementById('gamesel').value).toString();
 var $sort=document.getElementById('sort').value;
 var $str_cpath = $cpath.replace("cPath=","");
 var $serverNums = $str_cpath.split("_");
 var $gamename=document.getElementById('gamename').value;
 var $game_name2 = $gamename.replace(" ","-");
 var $game_name3 = $game_name2.replace(" - ","-");
 var $game_name4 = $game_name3.replace(" ","-");
 var $game_name4 = $game_name4.toLowerCase();
 var $server_name = document.getElementById('gamesel').options[document.getElementById('gamesel').selectedIndex].text;
 var $server_name2 = $server_name.replace(" - ","-");
 var $server_name3 = $server_name2.replace(" ","-");
 var $server_name4 = $server_name3.toLowerCase();
 var $currency=document.getElementById('curreys').options[document.getElementById('curreys').selectedIndex].text;
 var $currcury_code="";
	 switch($currency){
		  case 'USD':
			$currcury_code = '$';
			break;
		  case 'EUR':
			$currcury_code = '&euro;';
			break;
		  case 'GBP':
			$currcury_code = '&pound;';
			break;
	 }
 var $currcury_code_ss = document.getElementById('curreys').options[document.getElementById('curreys').selectedIndex].value;

  $.ajax({
 data : 'game_id='+$serverNums[0]+'&server_id='+$serverNums[1]+'&type=products',

 success : function(data){	 

             eval('var productArray='+data);
			 var str_productList='<table>';
			for(var key in productArray){
				 if(key=='add'){continue;}
					 if($serverNums[0]=="1166" || $serverNums[0]=="1146"){
						str_productList+='<tr><td width="360" style=" padding-left:15px; text-align:left; padding:10px;">'+$.trim(productArray[key][2])+'</td><td width="60" style="color:red"><strike>'+$currcury_code+(((parseFloat(productArray[key][0].replace("\t","")*$currcury_code_ss)))*1.2).toFixed(2)+'</strike></td><td width="60">'+$currcury_code+(parseFloat(productArray[key][0].replace("\t","")*$currcury_code_ss)).toFixed(2)+'</td><td width="140" style="text-align:center"><a href="'+$game_name4+'-'+$server_name4+'-gold-'+$str_cpath+'.html?products_id='+$.trim(productArray[key][3])+'&action=buy_now&currency='+$currency+'&sort='+$sort+'"><img class="listingBuyNowButton" height="17" width="81" title=" Buy Now " alt="Buy Now" src="includes/templates/template_default/buttons/english/button_buy_now.gif"/></a></td></tr>';
					 }else{
				 		str_productList+='<tr><td width="360" style=" padding-left:15px; text-align:left; padding:10px;">'+$.trim(productArray[key][2])+'</td><td width="100">'+$currcury_code+(parseFloat(productArray[key][0].replace("\t","")*$currcury_code_ss)).toFixed(2)+'</td><td width="140" style="text-align:center"><a href="'+$game_name4+'-'+$server_name4+'-gold-'+$str_cpath+'.html?products_id='+$.trim(productArray[key][3])+'&action=buy_now&currency='+$currency+'&sort='+$sort+'"><img class="listingBuyNowButton" height="17" width="81" title=" Buy Now " alt="Buy Now" src="includes/templates/template_default/buttons/english/button_buy_now.gif"/></a></td></tr>';
					 }
			   }
		   str_productList+='</table>';
		 $('#proclist').html(str_productList);
		 $("#load_ajax_quickgoldgamelist2").attr('style','display:none');				
				}
	   	 })		

}

