 
function addShoppingCar(id,name,price,path) {
	 
	var url = path + 'ajaxcar.aspx?gettype=addshoppingcar&id='+ id + "&name="+ encodeURIComponent(name) + "&price="+ price + "&temp=" + new Date().getTime();		  
	var response = httpRequest("get",null,url);
	if(response) {			
		var resultArray = response.split(",");
		if(resultArray[0].toString() == "false")
			DisplayMessageCenter(false,resultArray[1].toString());
		else			
			DisplayMessageCenter(true,resultArray[1].toString());
	}
	else {
		DisplayMessageCenter(false,"放入购物车失败!");
	}	
}
 
function updateProductNum(shoppingcarid,productnum,path) {
	
	if(!IsNumber(productnum)) {
		DisplayMessageCenter(false,"数量更新失败!请输入数字!");
		return;
	} 
	var url = path + "ajaxcar.aspx?gettype=updateproductnum&shoppingcarid="+ shoppingcarid + "&productnum=" + productnum + "&temp=" + new Date().getTime();		  
	var response = httpRequest("get",null,url);	
	if(response) {			
		var resultArray = response.split(",");
		if(resultArray[0].toString() == "false")
			DisplayMessageCenter(false,resultArray[1].toString());
		else {			
			window.location.reload();
			DisplayMessageCenter(true,resultArray[1].toString());
		}
	}
	else {
		DisplayMessageCenter(false,"数量更新失败!");
	}	
} 
function deleteProduct(shoppingcarid,path) {	
	
	if(!confirm('此操作将删除所选内容，确定吗？')) 
		return; 
	var url = path + "ajaxcar.aspx?gettype=deleteproduct&shoppingcarid="+ shoppingcarid + "&temp=" + new Date().getTime();		  
	var response = httpRequest("get",null,url);	
	if(response) {			
		var resultArray = response.split(",");
		if(resultArray[0].toString() == "false")
			DisplayMessageCenter(false,resultArray[1].toString());
		else {			
			window.location.reload();
			DisplayMessageCenter(true,resultArray[1].toString());
		}
	}
	else {
		DisplayMessageCenter(false,"删除失败!");
	}	
} 
function clearCart(path) {	
	
	if(!confirm('此操作将清空购物车中所有产品，确定吗？')) 
		return; 
	var url = path + "ajaxcar.aspx?gettype=clearcart&temp=" + new Date().getTime();		  
	var response = httpRequest("get",null,url);	
	if(response) {			
		var resultArray = response.split(",");
		if(resultArray[0].toString() == "false")
			DisplayMessageCenter(false,resultArray[1].toString());
		else {			
			window.location.reload();
			DisplayMessageCenter(true,resultArray[1].toString());
		}
	}
	else {
		DisplayMessageCenter(false,"清空购物车失败!");
	}	
} 
function validateOrderCfm(path) {		
	 
	var url = path + "ajaxcar.aspx?gettype=cartproductnum&temp=" + new Date().getTime();		  
	var response = httpRequest("get",null,url);	
	if(response) {			
		var resultArray = response.split(","); 
		if(resultArray[0].toString() == "false")
			DisplayMessageCenter(false,resultArray[1].toString());		
		else {			
			window.location.href=locationDelParam(locationAddParam('','page','order'),'forceurl');
		}
	}
	else {
		DisplayMessageCenter(false,"出现意外!");
	}	
}
 
function updateSendMode(path,sendmodeID) {
				
	showx = 300;
	showy = 300;
	var url = path + "selsendmode.aspx?sendmodeID="+sendmodeID+"&temp=" + new Date().getTime();
	dialogWidth = 600;	
	dialogHeight = 300;	
	var returnValue = window.showModalDialog(url,"newwin","dialogLeft:"+showx+"px;dialogTop:"+showy+"px;dialogHeight:"+dialogHeight+"px;dialogWidth:"+dialogWidth+"px; status:no; directories:yes;scroll:yes;resizable=yes;help:no;menubar:yes;");
	if(!isNull(returnValue)) {	
		var resultArray = returnValue.split(",");					
		if(resultArray[0].toString() == "true") {			
			var lblSendMode = getElementByServerID("lblSendMode");
			var lblSRcount = getElementByServerID("lblSRcount");
			var lblTotalAmount = getElementByServerID("lblTotalAmount");
			var hdSRcount = getElementByServerID("hdSRcount");
			var hdSendModeID = getElementByServerID("hdSendModeID");
			lblSendMode.innerHTML = resultArray[1].toString();
			lblSRcount.innerHTML = resultArray[2].toString();
			hdSRcount.value = resultArray[2].toString();
			lblTotalAmount.innerHTML = resultArray[3].toString();
			hdSendModeID.value = resultArray[4].toString();			
		}
		else if(resultArray.length >1)
			DisplayMessageCenter(false,resultArray[1].toString());
	}			
}
 
function updateSendAddress(path) {
				
	showx = 300;
	showy = 300;
	var url = path + "selspaddr.aspx?temp=" + new Date().getTime();
	dialogWidth = 600;	
	dialogHeight = 500;	
	var returnValue = window.showModalDialog(url,"newwin","dialogLeft:"+showx+"px;dialogTop:"+showy+"px;dialogHeight:"+dialogHeight+"px;dialogWidth:"+dialogWidth+"px; status:no; directories:yes;scroll:yes;resizable=yes;help:no;menubar:yes;");
	if(!isNull(returnValue)) {
		var txtUserName = getElementByServerID("txtUserName");
		var txtAddress = getElementByServerID("txtAddress");	
		var txtZipCode = getElementByServerID("txtZipCode");
		var txtTel = getElementByServerID("txtTel");
		var cbSaveThis = getElementByServerID("cbSaveThis");
		var hdAddressID = getElementByServerID("hdAddressID");
		var resultArray = returnValue.split(",");					
		if(resultArray.length == 6) {
			hdAddressID.value = resultArray[0].toString();
			txtUserName.value = resultArray[1].toString();
			txtAddress.value = resultArray[2].toString();
			txtZipCode.value = resultArray[3].toString();
			txtTel.value = resultArray[4].toString();	
			if(resultArray[5].toString() == "true")
				cbSaveThis.disabled = true; // no use
			else
				cbSaveThis.disabled = false;
		}
	}			
}	
 
function updatePaymentMode(path,paymentmodeID) {
				
	showx = 300;
	showy = 300;
	var url = path + "selpaymode.aspx?paymentmodeID="+paymentmodeID+"&temp=" + new Date().getTime();
	dialogWidth = 600;	
	dialogHeight = 400;	
	var returnValue = window.showModalDialog(url,"newwin","dialogLeft:"+showx+"px;dialogTop:"+showy+"px;dialogHeight:"+dialogHeight+"px;dialogWidth:"+dialogWidth+"px; status:no; directories:yes;scroll:yes;resizable=yes;help:no;menubar:yes;");
	if(!isNull(returnValue)) {				
		var resultArray = returnValue.split(",");					
		if(resultArray[0].toString() == "true") {			 	
			var lblPaymentMode = getElementByServerID("lblPaymentMode");
			var hdPaymentModeID = getElementByServerID("hdPaymentModeID");
			hdPaymentModeID.value = resultArray[1].toString();
			lblPaymentMode.innerHTML = resultArray[2].toString();
		}
		else if(resultArray.length > 1){
			DisplayMessageCenter(false,resultArray[1].toString());
		}
	}			
}
 
function cancelItems() {
				
	window.location.href=locationAddParam('','forceurl','car.ascx');	
}	



