﻿function checktocart(f){
	if(f.GameNameListID.value == 0)
	{alert('Please Select The Game!'); return false;}
	if(f.ServerNameListID.value == 0)
	{alert('Please Select The Server!'); return false;}
	if(f.ProductNameListID.value == 0)
	{alert('Please Select The Product!'); return false;}
}
function AjaxLoad(url,func,obj){
	 var temp	=	obj.options[0].text;
	 obj.options[0].text="--- Loading ---";	
	 var args	 =[];
	 args.push(obj);
	 args.push(temp);
	 var oReAjax = new  ReAjax();
	 var oAjaxHttp = oReAjax.GetHttpRequest() ;
     oAjaxHttp.open( "GET", url, true) ;
	 oAjaxHttp.onreadystatechange=function() {
		if(oAjaxHttp.readyState==4){
			var	data=oAjaxHttp.responseText;
			if(data==""||data.length<3){return false;}
			var arrays=data.split("|");
			args.push(arrays);
			func.apply(this,args);	
		}	 
	 }
	 oAjaxHttp.send( null ) ;
}
function changeOptions(){
	var parentobj	=arguments[0];
	var temptext	=arguments[1];
	var optionarray	=arguments[2];
	parentobj.options.length=1;
	parentobj.options[0].text=temptext;
	for(i=0;i<optionarray.length;i++){
	  if(optionarray[i]!=""){	
		var o  = optionarray[i].split("@");	
		var	opt= new Option(o[1],o[0]);	
		opt.title=o[1];
		parentobj.options.add(opt);
	  }
	}
}	
function GetServerLists(GID){
	if(GID=="0"||GID==""){
		return false;	
	}
	var ServerNameListID=document.getElementById("ServerNameListID");
	var ProductNameListID=document.getElementById("ProductNameListID");
	ProductNameListID.options.length=1;
	AjaxLoad("/ajax/getServerList.cfm?gameid="+GID,changeOptions,ServerNameListID);
}
function GetProductLists(GID,SID){
	if(GID=="0"||GID==""){
		return false;	
	}
	if(SID=="0"||SID==""){
		return false;	
	}
	var ProductNameListID=document.getElementById("ProductNameListID");
	AjaxLoad("/ajax/getProductList.cfm?gameid="+GID+"&serverid="+SID,changeOptions,ProductNameListID);
}
