// JScript 文件

function evals(s){
	return eval('('+s+')');
}

function $(e){
	return document.getElementById(e);
}

function getTxt(url){	
	var xmlHttp = null;
	if (window.ActiveXObject){
		xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');   
	}else if(window.XMLHttpRequest){
		xmlHttp = new XMLHttpRequest();
	}else{
		alert('Your browser does not support XMLHTTP.11');
		return false;
	}
	xmlHttp.open('GET',url,false);
	xmlHttp.send(null);
	return(xmlHttp.responseText);
}

var d_value = '';
function changeDistric(e){
	d_value = e.value;
	var par = d_value.split('|');
	var url = 'Ajax/Method.aspx?action=method'
	url += '&prov='+par[0]+'&city='+par[1];
	url += '&random='+Math.random();
	var txt = getTxt(url);
	var arr = evals(txt);
	var xfrm = document.getElementById("HuiboCartTwo_delivery");
	xfrm.innerHTML = '';
	//document.getElementById("delivery").innerHTML = "";
	//xfrm.province.value = par[0];
	//xfrm.city.value = par[1];
	for(var i in arr){
		if(arr[i]){
			var idx = arr[i].idx;
			var txt = unescape(arr[i].txt);
			var op = new Option(txt, idx);
			xfrm.options.add(op);
		}
	}
};

function changeMethod(e){
    //alert(document.getElementById("HuiboCartTwo_weight").innerHTML);
	var par = d_value.split('|');
	//alert(par[1]);
	var url = 'Ajax/Method.aspx?action=money'
	url += '&deli='+e.value+'&weight='+document.getElementById("HuiboCartTwo_weight").innerHTML;
	url += '&prov='+par[0]+'&city='+par[1];
	url += '&random='+Math.random();
	var txt = getTxt(url);
	//alert(txt);
	var arr = evals(txt);
	if(arr[0]){
		//document.xfrm.express.value = arr[0];
		$('Money').value = arr[0];
		$('HuiboCartTwo_weightmoney').innerText = arr[0];
	}
};

function OnSubmit()
{
    if($('Money').value == "")
    {
        alert("请选择送货方式！");
        return false;
    }
    else
    {
        document.getElementById("form1").action = "CartOK.aspx";
        document.getElementById("form1").submit();
    }
}