// JavaScript Document
function build_gl()
{
document.fastorder.s_gl.options.length=0;
for(var i=0;i < gamestr.length;i++)
{
document.fastorder.s_gl.options[document.fastorder.s_gl.options.length]=new Option(gamestr[i],gameid[i]);
}
document.fastorder.s_gl.disabled=false;
}
build_gl();
function changeusdcurrency()
{
var cc = document.superForm.changeusd.options[document.superForm.changeusd.selectedIndex].value;
cc1=cc.split('#_');
document.superForm.jsqcurryprice.value = cc1[1];
document.superForm.pjsqcurrency.value = cc1[2];
document.getElementById("pjsqcurry").innerHTML = cc1[0];
if(document.superForm.price.value!=''){
xx=document.superForm.nowprice.value*cc1[1];
document.superForm.price.value=xx.toFixed(2);
}
else
{
document.superForm.price.value='';
}
}
function gl_chg(){
	var url;
	document.fastorder.s_sl.options.length=0;
	document.fastorder.s_pl.options.length=0;
	document.fastorder.s_sl.options[document.fastorder.s_sl.options.length]=new Option('Please Select The Server',0);
	document.fastorder.s_pl.options[document.fastorder.s_pl.options.length]=new Option('Please Select The Product',0);
	document.fastorder.s_sl.disabled=true;
	document.fastorder.s_pl.disabled=true;
	document.fastorder.s_price.value='';
	if(document.fastorder.s_gl.options[document.fastorder.s_gl.selectedIndex].value!=0){
	document.fastorder.s_sl.options.length=0;
	document.fastorder.s_sl.options[document.fastorder.s_sl.options.length]=new Option("...Loading...",0);
	document.fastorder.gameserver.value=document.fastorder.s_gl.options[document.fastorder.s_gl.selectedIndex].value;
    try{
	xmlhttp=new XMLHttpRequest();
	}
	catch(e)
	{
	xmlhttp=new ActiveXObject("MIcrosoft.XMLHttp");
	}
	xmlhttp.onreadystatechange = do_gl_chg;
	url='/admin.asp?game_id='+document.fastorder.s_gl.options[document.fastorder.s_gl.selectedIndex].value;
	xmlhttp.open('GET',url, true); 
	xmlhttp.send(null);
	}
}
function do_gl_chg(){
var sstr;
var sid = new Array();
var str = new Array();
	if (xmlhttp.readyState == 4) {
		if (xmlhttp.status == 200){
		str=xmlhttp.responseText.split('||');
		document.fastorder.s_sl.options.length=0;
		for(var i=0;i < str.length-1;i++)
		{
		sstr=str[i];
		sid=sstr.split('|');
		document.fastorder.s_sl.options[document.fastorder.s_sl.options.length]=new Option(sid[0],sid[0]+'#'+sid[1]+'#'+sid[2]);
		}
		document.fastorder.count_str.value=str[str.length-1];
		document.fastorder.s_sl.disabled=false;
		}
		else alert('read data 1error:'+xmlhttp.status);
	}
}
function sl_chg(){
var ssc;
var ssa;
var ssb;
var slnum;
var sa = new Array();
var sb = new Array();
var sc = new Array();
var slis = new Array();
var dw;
var price;
if(document.fastorder.s_gl.options[document.fastorder.s_gl.selectedIndex].value=='Power leveling'){
	if(document.fastorder.s_sl.options[document.fastorder.s_sl.selectedIndex].value==0){
	document.fastorder.s_pl.options.length=0;
	document.fastorder.s_pl.options[document.fastorder.s_pl.options.length]=new Option('Please Select The Product',0);
	document.fastorder.s_pl.disabled=true;
	document.fastorder.s_price.value='';
	}
	else{
	document.fastorder.s_pl.options.length=0;
	document.fastorder.s_pl.options[document.fastorder.s_pl.options.length]=new Option('Please Select The Product',0);
	document.fastorder.s_pl.disabled=true;
	document.fastorder.s_price.value='';
	ssa=document.fastorder.count_str.value;
	sq=ssa.split("#_")
	ssc=document.fastorder.s_sl.options[document.fastorder.s_sl.selectedIndex].value;
	sc=ssc.split("#");
	document.fastorder.goldserver.value=sc[0];
	slnum=sc[1];
	slis=slnum.split(":");
	dw=sa[sa.length-1];
	var und=sc[2];
		sa=sq[und].split('|');
		for(var i=0;i < sa.length-1;i++)
		{
		ssb=sa[i];
		sb=ssb.split(':');
		price=sb[1]*1*1;
		price=price.toFixed(2);
		document.fastorder.s_pl.options[document.fastorder.s_pl.options.length]=new Option(sb[0],sb[0] + ':' + price);
		}
	document.fastorder.s_pl.disabled=false;
	}	
}else
{
	if(document.fastorder.s_sl.options[document.fastorder.s_sl.selectedIndex].value==0){
	document.fastorder.s_pl.options.length=0;
	document.fastorder.s_pl.options[document.fastorder.s_pl.options.length]=new Option('Please Select The Product',0);
	document.fastorder.s_pl.disabled=true;
	document.fastorder.s_price.value='';
	}
	else{
    document.fastorder.s_pl.options.length=0;
	document.fastorder.s_pl.options[document.fastorder.s_pl.options.length]=new Option('Please Select The Product',0);
	document.fastorder.s_pl.disabled=true;
	document.fastorder.s_price.value='';
	ssa=document.fastorder.count_str.value;
	sa=ssa.split('|');
	ssc=document.fastorder.s_sl.options[document.fastorder.s_sl.selectedIndex].value;
	sc=ssc.split("#");
	document.fastorder.goldserver.value=sc[0];
	slnum=sc[1];
	slis=slnum.split(":");
	dw=sa[sa.length-1];
		for(var i=0;i < sa.length-1;i++)
		{
		ssb=sa[i];
		sb=ssb.split(':');
		if(slis[1]=="1")
		{
		price=sb[0]*sb[1]*slis[0];
		price=price.toFixed(2);
		}
		else
		{
		price=sb[0]*slis[0];
		price=price.toFixed(2);
		}
		document.fastorder.s_pl.options[document.fastorder.s_pl.options.length]=new Option(sb[0] + ' ' + dw,sb[0] + ':' + price);
		}
	document.fastorder.s_pl.disabled=false;
	}
	}
}
function pl_chg(){
var ssa;
var ssb;
var sa = new Array();
var sb = new Array();
var dw;
var x1;
var x2;
var price;
    if(document.fastorder.s_gl.options[document.fastorder.s_gl.selectedIndex].value!='Power leveling'){
	if(document.fastorder.s_pl.options[document.fastorder.s_pl.selectedIndex].value==0){
	document.fastorder.s_price.value='';
	}
	else{
	  document.fastorder.s_price.value='';
	  ssa=document.fastorder.s_pl.options[document.fastorder.s_pl.selectedIndex].value;
	  sa=ssa.split(":");
	  document.fastorder.goldproduct.value=sa[0];
      x1=document.fastorder.curry_price.value;
	  document.getElementById("goldprice").value=sa[1];
      x2=sa[1];
	  x2=x2*x1;
      x2=x2.toFixed(2);
	  var dddd=sa[0];
      document.fastorder.s_price.value=x2;
    }
	}
	else
	{
	if(document.fastorder.s_pl.options[document.fastorder.s_pl.selectedIndex].value==0){
	document.fastorder.s_price.value='';
	}
	else{
	  document.fastorder.s_price.value='';
	  ssa=document.fastorder.s_pl.options[document.fastorder.s_pl.selectedIndex].value;
	  sa=ssa.split(":");
	  document.fastorder.goldproduct.value=sa[0];
	  document.getElementById("goldprice").value=sa[1];
	  x1=document.fastorder.curry_price.value;
      x2=sa[1];
	  x2=x2*x1;
      x2=x2.toFixed(2);
	  var dddd=sa[0];
      document.fastorder.s_price.value=x2;
    }
	}
}