
function ckquickorder()
{
	var fn=document.quickorder;
	if(!fn.gid.value){alert('Please select a game.');return false;}
	if(!fn.sid.value){alert('Please select a server.');return false;}
    if(!fn.cid.value){alert('Please select a quantity.');return false;}
	if(!fn.charactername.value){alert('Please input your CharacterName.');fn.charactername.focus();return false;}
	if(!fn.price.value){alert('Price Error.');return false;}
	fn.title.value=fn.gid.options[fn.gid.selectedIndex].text+" - "+fn.sid.options[fn.sid.selectedIndex].text;

	fn.action='index.php?main_page=buygold-shoppingcart&action=add';
}
var   xmlHttp; 
function   createXMLHttpRequest()   {   
 
          if   (window.ActiveXObject)   {   
                  xmlHttp   =   new   ActiveXObject("Microsoft.XMLHTTP");   
          }     
          else   if   (window.XMLHttpRequest)   {   
                  xmlHttp   =   new   XMLHttpRequest();   
          }   
  }     
  
  function   handleStateChange()   {   
          if(xmlHttp.readyState   ==   4)   {  	
          if(xmlHttp.status   ==   200&&xmlHttp.responseText)   { 
				  
	 
var ajax_content=new Array(); 
ajax_content=xmlHttp.responseText.split('#'); 


var ser_content=new Array(); 
ser_content=ajax_content[1].split(','); 
var ser_id=new Array(); 
ser_id=ajax_content[2].split(','); 

var item_content=new Array(); 

item_content=ajax_content[0].split(',');
document.quickorder.sid.options.length = 0;
for(s=0;s<ser_content.length;s++)
{
document.quickorder.sid.options.add(new Option(ser_content[s],ser_id[s]));
}

document.quickorder.cid.options.length = 1;
for(v=0;v<item_content.length;v++)
{
document.quickorder.cid.options.add(new Option(item_content[v],v));
}


                  }
          }   
  }   



			
	  function   handleStateChange2()   {   
          if(xmlHttp.readyState   ==   4)   {   
                  if(xmlHttp.status   ==   200)   { 
				  document.quickorder.price.value=xmlHttp.responseText;
				  }
				  }
				  }		
            function changeserver(gameid){
document.quickorder.sid.options.length = 0;	
document.quickorder.price.value = '';
document.quickorder.sid.options.add(new Option('Loading...','Loading...'));				

		  createXMLHttpRequest();   
          xmlHttp.onreadystatechange   =   handleStateChange;   
          xmlHttp.open("GET",   "index.php?action=ajax&type=changeserver&id="+gameid,   true);   
          xmlHttp.send(null);   
			
			
			}
            
			function showprice(itemid,sid,currency){
    createXMLHttpRequest();   
    xmlHttp.onreadystatechange = handleStateChange2;   
    xmlHttp.open("GET",   "index.php?action=ajax&type=showprice&sid="+sid+"&style=1&itemid="+itemid+"&currency="+currency,   true);   
    xmlHttp.send(null);   
}
			

		
