﻿var arrGood,arrServer,arrPrice;
var unit='USD';
kfmail='sellhelp@gmail.com';
skmail='ufsell@gmail.com';
livechat='<iframe width="140" height="60" src="#" scrolling="no" align="left" frameborder="0" ></iframe>';


arrGood = new Array(45);
arrGood[0] = new Array(14,'1.15M');
arrGood[1] = new Array(15,'2.30M');
arrGood[2] = new Array(16,'3.45M');
arrGood[3] = new Array(25,'4.6M');
arrGood[4] = new Array(26,'5.75M');
arrGood[5] = new Array(27,'11.5M');
arrGood[6] = new Array(28,'17.25M');
arrGood[7] = new Array(29,'22.05M');
arrGood[8] = new Array(30,'27M');
arrGood[9] = new Array(70,'1M');
arrGood[10] = new Array(71,'2M');
arrGood[11] = new Array(72,'3M');
arrGood[12] = new Array(73,'4M');
arrGood[13] = new Array(74,'5M');
arrGood[14] = new Array(75,'10M');
arrGood[15] = new Array(76,'15M');
arrGood[16] = new Array(77,'20M');
arrGood[17] = new Array(79,'2.5M');
arrGood[18] = new Array(80,'3.75M');
arrGood[19] = new Array(81,'6.25M');
arrGood[20] = new Array(82,'12.5M');
arrGood[21] = new Array(83,'18.75M');
arrGood[22] = new Array(84,'25M');
arrGood[23] = new Array(85,'31.25M');
arrGood[24] = new Array(86,'Yew logs 10K');
arrGood[25] = new Array(87,'Yew logs 20K');
arrGood[26] = new Array(110,'11M');
arrGood[27] = new Array(111,'6M');
arrGood[28] = new Array(112,'32M');
arrGood[29] = new Array(161,'1,150K');
arrGood[30] = new Array(130,'1.1M');
arrGood[31] = new Array(131,'2.2M');
arrGood[32] = new Array(132,'3.3M');
arrGood[33] = new Array(133,'4.4M');
arrGood[34] = new Array(134,'5.5M');
arrGood[35] = new Array(135,'11,000K');
arrGood[36] = new Array(136,'22M');
arrGood[37] = new Array(137,'27.5M');
arrGood[38] = new Array(148,'30M');
arrGood[39] = new Array(162,'2,300K');
arrGood[40] = new Array(163,'3,450K');
arrGood[41] = new Array(164,'5,750K');
arrGood[42] = new Array(165,'11,500K');
arrGood[43] = new Array(166,'22,050K');
arrGood[44] = new Array(167,'27,000K');


arrServer = new Array(1);
arrServer[0] = new Array(40,'All Servers');


arrPrice= new Array(19);
arrPrice[0] = new Array(70,40,'14.99');
arrPrice[1] = new Array(71,40,'29.98');
arrPrice[2] = new Array(72,40,'44.97');
arrPrice[3] = new Array(73,40,'59.96');
arrPrice[4] = new Array(74,40,'74.95');
arrPrice[5] = new Array(75,40,'149.9');
arrPrice[6] = new Array(76,40,'224.85');
arrPrice[7] = new Array(77,40,'299.8');
arrPrice[8] = new Array(86,40,'23.97');
arrPrice[9] = new Array(87,40,'39.95');
arrPrice[10] = new Array(130,40,'7.99');
arrPrice[11] = new Array(148,40,'159.80');
arrPrice[12] = new Array(161,40,'7.99');
arrPrice[13] = new Array(162,40,'15.98');
arrPrice[14] = new Array(163,40,'23.97');
arrPrice[15] = new Array(164,40,'31.96');
arrPrice[16] = new Array(165,40,'39.95');
arrPrice[17] = new Array(166,40,'119.85');
arrPrice[18] = new Array(167,40,'159.80');

function GetKfmail(){
	return kfmail;
}

function Getlivechat(){
	return livechat;
}

function Getskmail(){
	return skmail;
}


//根据商品名称获取商品编号，没有找到返回0
function GetGoodId(goodName){
    var goodId=0;
	if (goodName !="")
	{
	    for (var i=0; i<arrGood.length;i++ )
	    {
		    if (arrGood[i][1]== goodName)
		    {
			    goodId = arrGood[i][0];
				break;
		    }
		}
	}

	return goodId;
}

//根据服务器编号获取服务器名称
function GetServerName(serverId){
    var serverName="";
	if (serverId>0)
	{
	    for (var i=0; i<arrServer.length;i++ )
	    {
		    if (arrServer[i][0]== serverId)
		    {
			    serverName = arrServer[i][1];
				break;
		    }
		}
	}
	return serverName;
}


function ReSetPrice(){

}

//根据商品名称加载服务器列表
function LoadServer(goodName,serverObj){
    var goodId;
	goodId = GetGoodId(goodName);
	if (goodId>0 && typeof(serverObj)=="object")
	{
	    //删除原来的选项
	    for(var i=serverObj.length;i>0;i--){
		    serverObj.remove(i-1);
		}

		for (var i=0; i<arrServer.length;i++ )
	    {
		    serverObj.options.add(new Option(arrServer[i][1],arrServer[i][0]));
		}
	}
}

//根据商品名称、服务器列表绑定价格信息
function LoadPrice(goodName,serverObj,priceObj,disPriceObj){
    var goodId;
	var serverId;
	var price,defaultPrice;
	defaultPrice =10000;
	price =10000;
	goodId = GetGoodId(goodName);
	if (goodId>0 && typeof(serverObj)=="object")
	{
	    if (serverObj.selectedIndex>-1)
	    {
		    serverId = serverObj.options[serverObj.selectedIndex].value; 
	    }else{
		    serverId = serverObj.options[0].value; 
		}

		defaultPrice =10000;
		price =10000;

		for (var i=0; i<arrPrice.length;i++ ){
		    if (arrPrice[i][0]==goodId)
		    {
			    if (arrPrice[i][1]==0)
			    {
				    defaultPrice = arrPrice[i][2];
			    }

				if (arrPrice[i][1]==serverId)
			    {
				    price = arrPrice[i][2];
			    }
		    }

			if (arrPrice[i][0]>goodId && arrPrice[i][1]>serverId)
			{
			    break;
			}

		}

		if (price !=10000)
		{
		    priceObj.value = price;
			disPriceObj.value = unit +" "+ price;
		}else{
		    priceObj.value = defaultPrice;
			disPriceObj.value = unit +" "+ defaultPrice;
		}
	}
}