function FormatNumber(num,decimalNum,bolLeadingZero,bolParens,bolCommas) 
{
	if (isNaN(parseInt(num))) return "NaN";
	var tmpNum = num;
	var iSign = num < 0 ? -1 : 1; 
	tmpNum *= Math.pow(10,decimalNum);
	tmpNum = Math.round(Math.abs(tmpNum))
	tmpNum /= Math.pow(10,decimalNum);
	tmpNum *= iSign; 
	var tmpNumStr = new String(tmpNum);
	if (!bolLeadingZero && num < 1 && num > -1 && num != 0)
	if (num > 0)
	tmpNumStr = tmpNumStr.substring(1,tmpNumStr.length);
	else
	tmpNumStr = "-" + tmpNumStr.substring(2,tmpNumStr.length);
	if (bolCommas && (num >= 1000 || num <= -1000)) {
	var iStart = tmpNumStr.indexOf(".");
	if (iStart < 0)
	iStart = tmpNumStr.length;
	
	iStart -= 3;
	while (iStart >= 1) {
	tmpNumStr = tmpNumStr.substring(0,iStart) + "," + tmpNumStr.substring(iStart,tmpNumStr.length)
	iStart -= 3;
	}
	}
	if (bolParens && num < 0)
	tmpNumStr = "(" + tmpNumStr.substring(1,tmpNumStr.length) + ")";
	var spStr = tmpNumStr.split('.');
	if(spStr.length< 2)
		tmpNumStr = tmpNumStr + ".00";
	if(spStr.length > 1)
	{
		var spStrtwo = spStr[1];
		if(spStrtwo.length<2)
			tmpNumStr = tmpNumStr + "0";
	}
	return tmpNumStr; 
}
///手机充值 地区选择
 var quickSpecial =["内蒙古","黑龙江","吉林","青海","甘肃","新疆","西藏","宁夏","重庆","安徽","江西","云南","贵州","海南","湖南"];
var quickArea=["北京","上海","山东","江苏","辽宁","河北","河南","福建","天津","浙江","陕西","山西","四川","广东","内蒙古","黑龙江","吉林","陕西","青海","甘肃","新疆","西藏","宁夏","重庆","安徽","江西","湖北","湖南","云南","贵州","广西","海南"];
var quickLimitArea=["北京","上海","江苏","河南","广西","湖北"];
var slowArea=["北京","上海","浙江","江苏","广东","河南","广西","湖北","天津","四川"];
function areaChange(areaName)
{
	document.getElementById("mo_quick").style.display="none";
	document.getElementById("mo_slow").style.display="none";
	for(var i=0;i<quickArea.length;i++)
	{
		if(areaName==quickArea[i])
		{
			document.getElementById("mo_quick").style.display="";
		}
		continue;
	}
	for(var i=0;i<slowArea.length;i++)
	{
		if(areaName==slowArea[i])
		{
			document.getElementById("mo_slow").style.display="";
		}
		continue;
	}
	for(var i=0;i<quickSpecial.length;i++)
	{
		if(areaName == quickSpecial[i]){
			document.getElementById("mo_Money").options[0].title="PR200812112006391097";
			document.getElementById("mo_Money").options[1].title="PR200812122051670097";
			if(document.getElementById('mo_Money').options[document.getElementById('mo_Money').selectedIndex].id =="yibai"){
				document.getElementById("Default1_quickFill").innerText="98.50";
			}else{
				document.getElementById("Default1_quickFill").innerText="49.25";
			}
			return;
		}else{
			for(var j=0;j<quickLimitArea.length;j++){
				if(areaName ==quickLimitArea[j]){
					if(document.getElementById('mo_Money').options[document.getElementById('mo_Money').selectedIndex].id =="yibai"){
						document.getElementById("Default1_quickFill").innerText="98.00";
					}else{
						document.getElementById("Default1_quickFill").innerText="49.00";
					}
					return;
				}else{
					document.getElementById("mo_Money").options[0].title="PR200810311323661097";
					document.getElementById("mo_Money").options[1].title="PR200810311323718097";
					if(document.getElementById('mo_Money').options[document.getElementById('mo_Money').selectedIndex].id =="yibai"){
						document.getElementById("Default1_quickFill").innerText="98.20";
					}else{
						document.getElementById("Default1_quickFill").innerText="49.10";
					}
				}}
		}
	}
}
///手机充值 价格选择
function moChoosedef(rbName,areaName)
{
	document.getElementById("Default1_moMoney").innerText= document.getElementById(rbName).value;
	document.getElementById("Default1_slowFill").innerText =FormatNumber(document.getElementById(rbName).value * 0.960,2,false,false,true);
	for(var i=0;i<quickSpecial.length;i++)
	{
		if(areaName == quickSpecial[i]){
			document.getElementById("Default1_quickFill").innerText =FormatNumber(document.getElementById(rbName).value * 0.985,2,false,false,true);
			return;
		}else{
			for(var j=0;j<quickLimitArea.length;j++){
				if(areaName ==quickLimitArea[j]){
					document.getElementById("Default1_quickFill").innerText =FormatNumber(document.getElementById(rbName).value * 0.980,2,false,false,true);
					return;
				}else{
					document.getElementById("Default1_quickFill").innerText =FormatNumber(document.getElementById(rbName).value * 0.982,2,false,false,true);
				}
			}
		}
	}
	
	
}
///点卡充值 游戏选择
function selectChoose(gameName,type)
{
	document.getElementById("selectGamePrice").innerHTML="";
	var opts = new Array();
	if(type=="ZX"){
		var opt = new Option("100元","89.50");opt.title="PR200811101263712097";
		var opt1 = new Option("50元","44.90");opt1.title="PR200811101263504097";
		var opt2 = new Option("30元","26.94");opt2.title="PR200812293453009097";
		var opt3 = new Option("15元","13.47");opt3.title="PR200812293453181097";
		opts.push(opt);
		opts.push(opt1);
		opts.push(opt2);
		opts.push(opt3);
	}
	if(type=="WY"){
		var opt = new Option("150点","13.58");opt.title="PR200811041535434097";
		var opt1 = new Option("300点","27.15");opt1.title="PR200811041535475097";
		opts.push(opt);
		opts.push(opt1);
	}
	if(type=="SD"){
		var opt = new Option("45元","40.95");opt.title="PR200810301230675097";
		var opt1 = new Option("30元","27.30");opt1.title="PR200810301230607097";
		var opt2 = new Option("10元","9.10");opt2.title="PR200812293453687097";
		opts.push(opt);
		opts.push(opt1);
		opts.push(opt2);
	}
	if(type=="SH"){
		var opt = new Option("800点","36.40");opt.title="PR20081106946343097";
		var opt1 = new Option("600点","27.30");opt1.title="PR20081106946121097";
		var opt2 = new Option("300点","13.65");opt2.title="PR20081106945831097";
		opts.push(opt);
		opts.push(opt1);
		opts.push(opt2);
	}
	if(type=="WM"){
		var opt = new Option("100元","89.50");opt.title="PR200811101263712097";
		var opt1 = new Option("50元","44.90");opt1.title="PR200811101263504097";
		var opt2 = new Option("30元","26.94");opt2.title="PR200812293453009097";
		var opt3 = new Option("15元","13.47");opt3.title="PR200812293453181097";
		opts.push(opt);
		opts.push(opt1);
		opts.push(opt2);
		opts.push(opt3);
	}
	if(type=="JS"){
		var opt = new Option("5000点","45.25");opt.title="PR200811131490814097";
		var opt1 = new Option("1500点","13.58");opt1.title="PR200811131490664097";
		opts.push(opt);
		opts.push(opt1);
	}
	if(type=="GY"){
		var opt = new Option("30元","26.40");opt.title="PR200811071034889097";
		var opt1 = new Option("10元"," 8.80");opt1.title="PR200811071034303097";
		opts.push(opt);
		opts.push(opt1);
	}
	if(type=="WYU"){
		var opt = new Option("38元","32.70");opt.title="PR200811131491831097";
		var opt1 = new Option("30元","25.80");opt1.title="PR200811131491699097";
		var opt2 = new Option("10元"," 8.60");opt2.title="PR200811131491619097";
		opts.push(opt);
		opts.push(opt1);
		opts.push(opt2);
	}
	if(type=="JY"){
		var opt = new Option("3000点","26.40");opt.title="PR200811071033847097";
		var opt1 = new Option("1000点"," 8.80");opt1.title="PR200811071033395097";
		opts.push(opt);
		opts.push(opt1);
	}
	if(type=="ZH"){
		var opt = new Option("100元","89.00");opt.title="PR200811171829649097";
		var opt1 = new Option("30元","26.70");opt1.title="PR200811171829492097";
		var opt2 = new Option("10元"," 8.90");opt2.title="PR200811171829200097";
		opts.push(opt);
		opts.push(opt1);
		opts.push(opt2);
	}
	if(type=="SJ"){
		var opt = new Option("40元","35.80");opt.title="PR200811131490164097";
		var opt1 = new Option("10元"," 8.95");opt1.title="PR200811131490362097";
		opts.push(opt);
		opts.push(opt1);
	}
	if(type=="LQ"){
		var opt = new Option("3000点","26.10");opt.title="PR200811131488666097";
		var opt1 = new Option("1500点","13.05");opt1.title="PR200811131488526097";
		opts.push(opt);
		opts.push(opt1);
	}
	if(type=="HJD"){
		var opt = new Option("1000万","43.00");opt.title="PR200811101256619097";
		var opt1 = new Option("400万","17.20");opt1.title="PR200811101256449097";
		var opt2 = new Option("120万"," 5.16");opt2.title="PR200811101256324097";
		opts.push(opt);
		opts.push(opt1);
		opts.push(opt2);
	}
	if(type=="MS"){
		var opt = new Option("600点","27.50");opt.title="PR200811131506567097";
		opts.push(opt);
		
	}
	if(type=="ZT"){
		var opt = new Option("300元","271.5"); opt.title="PR200811141568475097";
		var opt1 = new Option("100元","90.50");opt1.title="PR200810301234489097";
		var opt2 = new Option("60元","54.30");opt2.title="PR200810301234333097";
		var opt3 = new Option("30元","27.15");opt3.title="PR200810301234212097";
		var opt4 = new Option("10元"," 9.05");opt4.title="PR200810301233912097";
		opts.push(opt);
		opts.push(opt1);
		opts.push(opt2);
		opts.push(opt3);
		opts.push(opt4);
	}
	if(type == "JC"){
		var opt = new Option("600点","27.50");opt.title="PR200811131487550097";
		opts.push(opt);
	}
	if(type == "DXC"){
		var opt = new Option("20元","18.00");opt.title="PR200810291167575097";
		opts.push(opt);
	}
	if(type == "JYK"){
		var opt = new Option("30元","24.80");opt.title="PR200811131491424097";
		var opt1 = new Option("10元"," 8.30");opt1.title="PR200811131491335097";
		opts.push(opt);
		opts.push(opt1);
	}
	if(type == "RXJH"){
		var opt = new Option("100元","88.00");opt.title="PR200901121145708097";
		var opt1 = new Option("30元","26.40");opt1.title="PR200901121145844097";
		var opt2 = new Option("10元"," 8.80");opt2.title="PR200901121145768097";
		opts.push(opt);
		opts.push(opt1);
		opts.push(opt2);
	}
	for(var i=0;i<opts.length;i++){
		document.getElementById("selectGamePrice").options[i]=opts[i];
	}
	
	if(gameName=="zhuxian")
	{
		document.getElementById("zhuxianQuick").style.display="";
		document.getElementById("zhuxianSlow").style.display="";
		document.getElementById("gameCardPrice").style.display="";
	}
	else
	{
		document.getElementById("zhuxianQuick").style.display="none";
		document.getElementById("zhuxianSlow").style.display="none";
		document.getElementById("gameCardPrice").style.display="";	
	}
	document.getElementById("show_gameCardPrice").innerText = document.getElementById("selectGamePrice").value
	
	if(document.getElementById("Select3").value=="zhuxian"){
		if(document.getElementById("selectGamePrice").value >50){
			document.getElementById("ZQ").innerText="89.00";
			document.getElementById("ZS").innerText="87.00";
			document.getElementById("ZQ").title="100";
			document.getElementById("ZS").title="100";
		}else{
			document.getElementById("ZQ").innerText="44.50";
			document.getElementById("ZS").innerText="43.50";
			document.getElementById("ZQ").title="50";
			document.getElementById("ZS").title="50";
		}
	}
}
function changeGamePrice(_cardPrice)
{
	if(_cardPrice==""){
		document.getElementById("gameCardPrice").style.display="none";
	}else{
		document.getElementById("gameCardPrice").style.display="";
	}
	if(document.getElementById("Select3").value=="zhuxian"){
		document.getElementById("zhuxianQuick").style.display="";
		document.getElementById("zhuxianSlow").style.display="";
		if(_cardPrice>50){
			document.getElementById("ZQ").innerText="89.00";
			document.getElementById("ZS").innerText="87.00";
			document.getElementById("ZQ").title="100";
			document.getElementById("ZS").title="100";
		}else if(_cardPrice>30 && _cardPrice<50){
			document.getElementById("ZQ").innerText="44.50";
			document.getElementById("ZS").innerText="43.50";
			document.getElementById("ZQ").title="50";
			document.getElementById("ZS").title="50";
		}else{
			document.getElementById("zhuxianQuick").style.display="none";
			document.getElementById("zhuxianSlow").style.display="none";
		}
	}
	document.getElementById("show_gameCardPrice").innerText =_cardPrice;
}
//手机充值按钮 处理
function moFillMoneydef(type,hr,areaName)
{
	var isKuaiqian = true;
	for(var i=0;i<quickLimitArea.length;i++){
		if(areaName ==quickLimitArea[i]){
			isKuaiqian = false;
		}
	}
	if(type == 'slow')
		document.getElementById("myFormType").value= '0';
	if(type == 'quickLimit')
		document.getElementById("myFormType").value= '1';
	if(type == 'quick' && isKuaiqian==false)
		document.getElementById("myFormType").value= '1';
		
	document.getElementById("myFormMoney").value =  document.getElementById("Default1_moMoney").innerText;
	document.getElementById("myFormArea").value = document.getElementById("mo_Area").value;
	
	if(type == 'quickLimit' || type=='slow')
		document.all.myFillPay.action =hr+ "/onlinecard/cardchongzhi1.aspx";
	if(type=='quick' && isKuaiqian==true)
		document.all.myFillPay.action="http://mall.5173.com/Sale/Order.aspx?ProductID="+hr;
	if(type=='quick' && isKuaiqian==false)
		document.all.myFillPay.action = "http://www.5173.com/onlinecard/cardchongzhi1.aspx";
	formFillMoney();
}
//function refHandle(_proId)
//{
//	//alert(_proId);
//	window.open("http://mall.5173.com/Sale/Order.aspx?ProductID="+_proId);
//}
// modify by adun 20090101 :新购买流程/将地下城流程独立出来
function refHandle(_proId)
{
	if(_proId=='PR200810291167575097')
	{
	window.open("http://mall.5173.com/Sale/order.aspx?ProductID="+_proId);
	}
	else
	{
	window.open("http://mall.5173.com/Sale/QuickPay.aspx?ProductID="+_proId);
	}
}

//skype
var skypeOpenUrl ="http://mall.5173.com/Sale/QuickPay.aspx?ProductID=PR080721162220181";
function CheckSkypeCategroy(str)
{   
	document.getElementById("gn").style.display="none";
	document.getElementById("by").style.display="none";
	document.getElementById("gw").style.display="none";
	if(str == "gn"){   
		document.getElementById("gn").style.display="";
		 document.getElementById("SkypePrice").innerHTML="5.00";
		 skypeOpenUrl = "http://mall.5173.com/Sale/QuickPay.aspx?ProductID=PR080721162220181";
	}else if(str == "by"){
		document.getElementById("by").style.display="";
		document.getElementById("SkypePrice").innerHTML="33.00";
		skypeOpenUrl = "http://mall.5173.com/Sale/QuickPay.aspx?ProductID=PR080814120340343";
	}else{
		 document.getElementById("gw").style.display="";
		 document.getElementById("SkypePrice").innerHTML="1.95";
		 skypeOpenUrl = "http://mall.5173.com/Sale/QuickPay.aspx?ProductID=PR080721160830041";
	}
}

function SkypeTypeChange(typeVal)
{
	var price = document.getElementById("SkypePrice");
	switch (typeVal)
	{
		case '国内卡30分钟':
			price.innerHTML = "<font color='red'>5.00</font>";
			skypeOpenUrl = "http://mall.5173.com/Sale/QuickPay.aspx?ProductID=PR080721162220181";
			break;
		case '国内卡150分钟':
			price.innerHTML = "<font color='red'>19.20</font>";
			skypeOpenUrl = "http://mall.5173.com/Sale/QuickPay.aspx?ProductID=PR080721162012978";
			break;
		case '国内卡400分钟':
			price.innerHTML = "<font color='red'>48.00</font>";
			skypeOpenUrl = "http://mall.5173.com/Sale/QuickPay.aspx?ProductID=PR080721161832869";
			break;
		case '国内卡900分钟':
			price.innerHTML = "<font color='red'>94.50</font>";
			skypeOpenUrl = "http://mall.5173.com/Sale/QuickPay.aspx?ProductID=PR080721161517791";
			break;
		case '大陆通400分钟包月':
			price.innerHTML = "<font color='red'>33.00</font>";
			skypeOpenUrl = "http://mall.5173.com/Sale/QuickPay.aspx?ProductID=PR080814120340343";
			break;
		case '大陆通400分钟包季':
			price.innerHTML = "<font color='red'>93.00</font>";
			skypeOpenUrl = "http://mall.5173.com/Sale/QuickPay.aspx?ProductID=PR080814120122156";
			break;
		case '大陆通400分钟包年':
			price.innerHTML = "<font color='red'>312.00</font>";
			skypeOpenUrl = "http://mall.5173.com/Sale/QuickPay.aspx?ProductID=PR080814120335031";
			break;
		case '国际卡0.2欧元':
			price.innerHTML = "<font color='red'>1.95</font>";
			skypeOpenUrl = "http://mall.5173.com/Sale/QuickPay.aspx?ProductID=PR080721160830041";
			break;
		case '国际卡2欧元':
			price.innerHTML = "<font color='red'>19.20</font>";
			skypeOpenUrl = "http://mall.5173.com/Sale/QuickPay.aspx?ProductID=PR080721160601619";
			break;
		case '国际卡5欧元':
			price.innerHTML = "<font color='red'>48.00</font>";
			skypeOpenUrl = "http://mall.5173.com/Sale/QuickPay.aspx?ProductID=PR080721160336775";
			break;
		case '国际卡10欧元':
			price.innerHTML = "<font color='red'>96.00</font>";
			skypeOpenUrl = "http://mall.5173.com/Sale/QuickPay.aspx?ProductID=PR080721160047509";
			break;
	}
}
function OpenSkypeOrderUrl()
{
  
   window.open(skypeOpenUrl,"_blank");;
}
function perFillMoneydef(type,hr,_money)
{
	if(type == 'quick')
		document.getElementById("myFormType").value= '1';
	if(type == 'slow')
		document.getElementById("myFormType").value= '0';
	document.getElementById("myFormMoney").value =_money;
	document.getElementById("myFormArea").value = document.getElementById("Select3").value;

	var area = document.getElementById("myFormArea").value;
	if( area == '赤壁' )
		document.all.myFillPay.action= hr + "/onlinewmcard/wmcardchongzhi2.aspx?game=cb";
	if( area == 'zhuxian' )
		document.all.myFillPay.action=hr + "/onlinewmcard/wmcardchongzhi2.aspx?game=zx";
	if( area == '完美国际' )
		document.all.myFillPay.action=hr + "/onlinewmcard/wmcardchongzhi2.aspx?game=wmgj";
	if( area == '完美世界' )
		document.all.myFillPay.action=hr + "/onlinewmcard/wmcardchongzhi2.aspx?game=xjqy";
	if( area == '武林外转' )
		document.all.myFillPay.action=hr + "/onlinewmcard/wmcardchongzhi2.aspx?game=wlwz";

	
	
	formFillMoney();
}