
var Obj = "";
document.onmouseup = MUp;
document.onmousemove = MMove;
//john & horse
function MDown(Object) {
	Obj = Object.id;
	document.all(Obj).setCapture();
	pX = event.x - document.all(Obj).style.pixelLeft;
	pY = event.y - document.all(Obj).style.pixelTop;
}
function MMove() {
	if (Obj != "") {
		document.all(Obj).style.left = event.x - pX;
		document.all(Obj).style.top = event.y - pY;
	}
}
function MUp() {
	if (Obj != "") {
		document.all(Obj).releaseCapture();
		Obj = "";
	}
}
function d_x() {
	mask.style.visibility = "visible";
	massage_box.style.visibility = "visible";
}
function d_y() {
	massage_box.style.visibility = "hidden";
	mask.style.visibility = "hidden";
}
var detailID = "";
var operateText = "";
function deleteDetailsCallbackFun(data) {
	var detailUL = document.getElementById(detailID);
	if (data.ajaxResult == "success") {
		var detailParent = detailUL.parentNode;
		detailParent.removeChild(detailUL);
	} else {
		if (data.ajaxResult == "result") {
			var tempForm = document.getElementById("shoppingForm");
			tempForm.action = "shoppingPageAction_showShoppingCar.action?operate=" + operateText;
			tempForm.submit();
		} else {
			window.alert("\u5220\u9664\u51fa\u9519!");
		}
	}
	shoppingProcessSellPrice();
	shoppingProcessHappyPrice();
}
function deleteDetails(orderDetailsID, priceTypeName, operate) {
	if (!confirm("\u786e\u5b9e\u8981\u5220\u9664\"" + priceTypeName + "\"\u5417")) {
		return false;
	}
	detailID = orderDetailsID;
	operateText = operate;
	var url = "shoppingPageAjaxAction_removeOrderDetails.action";
	var jsonArray = {"orderDetail.id":orderDetailsID};
	jQuery.post(url, jsonArray, deleteDetailsCallbackFun, "json");
	return false;
}
<!--展示购物车-->
function showShopping() {
	shoppingCarIframe.shoppingForm.action = "../../shoppingPageAction_showShoppingCar.action";
	shoppingCarIframe.shoppingForm.submit();
	d_x();
}
<!--修改购物车-->
function updateShoppingCar(method,priceTypeName,index,size)
        {
            var qtyTemp = 0 ;
			var sellAll = 0 ;
			var memAll = 0 ;
			var sellAll = 0;
		    var mem = 0;
        if(method=='delete')
        {
	    if (!confirm("\u786e\u5b9e\u8981\u5220\u9664\"" + priceTypeName + "\"\u5417"))
	     {
		   return false ;
		 }
		 else 
		 {
			qtyTemp = document.getElementById("qty"+index).value * 1;
			sellAll = document.getElementById("sell"+index).innerText * qtyTemp ;
			memAll = document.getElementById("mem"+index).innerText * qtyTemp ;			
			document.getElementById("sellPrice").innerText = document.getElementById("sellPrice").innerText - sellAll;
			document.getElementById("happyTotal").innerText = document.getElementById("happyTotal").innerText - memAll;
			document.getElementById("qty"+index).innerText = 0 ;
			document.getElementById("tr"+index).style.display='none';
			return true ;		
	     }
	  }
	  else if(method=='modify')
	    {
	      for (i = 0; i < size; i++) 
	      {
			qtyTemp = document.getElementById("qty" + i).value * 1;
			sellAll += document.getElementById("sell" + i).innerText * qtyTemp;
			mem = document.getElementById("mem" + i).innerText * qtyTemp;
			memAll += mem;
			document.getElementById("total" + i).innerText = mem + ".0";
		  }
		document.getElementById("sellPrice").innerText = sellAll + ".0";
		document.getElementById("happyTotal").innerText = memAll + ".0";
	    }
	}
	function saveModify(url){
	   	var form=document.forms['shoppingForm'];		
		form.action="shoppingPage_modifyShoppingCar.action";
		form.submit();	
		parent.document.getElementById('massage_box').style.display="none";
		parent.document.getElementById('mask').style.display="none";
		window.parent.location.href=url ;
	}
function resetShoppingCar() {
	document.getElementById("shoppingForm").reset();
	shoppingProcessSellPrice();
	shoppingProcessHappyPrice();
	return false;
}
function validateNum(obj) {
	if (!checkIsInteger(obj.value)) {
		window.alert("\u8bf7\u8f93\u5165\u6574\u6570\u7684\u6570\u91cf!");
		return;
	}
	shoppingProcessSellPrice();
	shoppingProcessHappyPrice();
}
function shoppingProcessSellPrice() {
	var result = 0;
	var orderDiv = document.getElementById("orderDetailsDiv");
	var orderUL = orderDiv.getElementsByTagName("ul");
	for (var i = 0; i < orderUL.length; i++) {
		var orderLI = orderUL[i].getElementsByTagName("li");
		var sellPrice = orderLI[2].innerHTML;
		var qty = orderLI[4].getElementsByTagName("input");
		result += sellPrice * qty[0].value;
	}
	document.getElementById("sellPriceTotal").innerHTML = result.toFixed(1);
}
function shoppingProcessHappyPrice() {
	var result = 0;
	var orderDiv = document.getElementById("orderDetailsDiv");
	var orderUL = orderDiv.getElementsByTagName("ul");
	for (var i = 0; i < orderUL.length; i++) {
		var orderLI = orderUL[i].getElementsByTagName("li");
		var sellPrice = orderLI[3].innerHTML;
		var qty = orderLI[4].getElementsByTagName("input");
		result += sellPrice * qty[0].value;
	}
	document.getElementById("happyTotal").innerHTML = result.toFixed(1);
}
function modifyQty(flag, obj) {
	var qty = obj.parentNode.getElementsByTagName("input");
	if (flag) {
		qty[0].value++;
	} else {
		if (qty[0].value > 1) {
			qty[0].value--;
		} else {
			window.alert("\u8bf7\u9009\u62e9\u5220\u9664!");
			return;
		}
	}
	shoppingProcessSellPrice();
	shoppingProcessHappyPrice();
}
function closeShop() {
	d_y();
	var frame = document.getElementById("shoppingCarIframe");
	frame.src = "jsp/shoppingPage/shopping.jsp";
	return false;
}
function openAppraise() {
	mask.style.visibility = "visible";
	var appraiseDiv = document.getElementById("appraiseDetails");
	appraiseDiv.style.visibility = "visible";
}
function closeAppraise() {
	var appraiseDiv = document.getElementById("appraiseDetails");
	appraiseDiv.style.visibility = "hidden";
	var mask = document.getElementById("mask");
	mask.style.visibility = "hidden";
	return false;
}


