		var actionURL="/Main/client/cart/content.jsp?nId=url_/3c1&nType=url_/3c1/3c2&nLoc=url_/3bf";
		var tmAddrKey=-1;
		var remarkNameStr="";
		
		function showQuantityLayout(coidNo,id,vals){
			$("#btn"+vals).click(function(e){
				$("#quantityLayout").css("z-index",3);
				$("#quantityLayout").css("top",e.pageY+10);
				$("#quantityLayout").css("left",e.pageX+10);
				$("#quantityLayout").css("display","block");
				$("#quantityLayout").css("background-color","#b3c8da");
				$("#idNum").val(id);
				$("#coidNo").val(coidNo);
				$("#quantity").val(document.getElementById("up"+id).innerHTML);
				$("#LCD").html(document.getElementById("up"+id).innerHTML);
				btnEnabled();
				checkDel();
				$("#quantityLayout").draggable().css("cursor","move");
			});
		}

		function addDigital(n){
			var num=document.getElementById("up"+document.getElementById("idNum").value).innerHTML+n;
			var lcd=$("#LCD").html();
			if(num.length<=9 && lcd.length>0){
				$("#quantity").val(num);
				$("#LCD").html(num);
				modifySession($("#coidNo").val(),$("#idNum").val(),num);
			}else if(num.length>9 && lcd.length>9){
				alert('不能再输入了');
			}else if(lcd==""){
				$("#quantity").val(n);
				$("#LCD").html(n);
				modifySession($("#coidNo").val(),$("#idNum").val(),n);
				btnEnabled();
			} 
			checkDel();
		}

		function removeDigital(){
			var num=document.getElementById("up"+document.getElementById("idNum").value).innerHTML;
			if(num.length>1){
				num=num.substring(0,num.length-1);
				$("#quantity").val(num);
				$("#LCD").html(num);
				modifySession($("#coidNo").val(),$("#idNum").val(),num);
				checkDel();
			}
		}

		function checkDel(){
			var lcd=$("#LCD").html();
			if(lcd.length>1){
				document.getElementById('del').disabled="";
			}else{
				document.getElementById('del').disabled="disabled";
			}
		}

		function clsDigital(){
			var num="";
			$("#LCD").html(num);
			document.getElementById('zero').disabled="disabled";
			document.getElementById('min').disabled="disabled";
			document.getElementById('add').disabled="disabled";
			document.getElementById('del').disabled="disabled";
		}

		function btnEnabled(){
			document.getElementById('zero').disabled="";
			document.getElementById('min').disabled="";
			document.getElementById('add').disabled="";
			document.getElementById('del').disabled="";
		}

		function modifyQuantity(clr){
			switch(clr){
				case '0' : 
					if(parseInt($("#quantity").val())>1){
						var q = parseInt($("#quantity").val());
						q-=1;
						$("#quantity").val(q);
						$("#LCD").html(q);
						modifySession($("#coidNo").val(),$("#idNum").val(),q);
					}
					break;

				case '1': 
					var q = parseInt($("#quantity").val());
					q+=1;
					$("#quantity").val(q);
					$("#LCD").html(q);
					modifySession($("#coidNo").val(),$("#idNum").val(),q);
					break;
					
				default: break;
			}
		}

		function modifySession(coidNo,id,quantity){
			$.post(actionURL,{ctrl:"url_/3d9",coidNo:coidNo,productId:id,quantity:quantity},function(data){
				var obj=eval("("+data+")");
				if(obj.flag){
					document.getElementById("price"+obj.id).innerHTML=obj.price;
					document.getElementById("pro"+id).innerHTML=obj.pTotal;
					document.getElementById("ct"+coidNo).innerHTML=obj.cTotal;
					document.getElementById("up"+id).innerHTML=obj.quantity;
					document.getElementById("Total").innerHTML=obj.total;
					checkDel();
				}else{
					alert(obj.msg);
					$("#LCD").html(obj.quantity);
					$("#quantity").val(obj.quantity);
					document.getElementById("price"+obj.id).innerHTML=obj.price;
					document.getElementById("pro"+id).innerHTML=obj.pTotal;
					document.getElementById("ct"+coidNo).innerHTML=obj.cTotal;
					document.getElementById("up"+id).innerHTML=obj.quantity;
					document.getElementById("Total").innerHTML=obj.total;
					checkDel();
				}
			});
			
		}
		
		function addP2C(){
			alert(unitPrice);
			
		}
		
    	function goBuyURL(productId,coidNo,quantity){
    		var sizes = $(document).find(".pro_size");
    		var colors = $(document).find(".pro_color");
    		if( sizes.length > 0 && sizebln == false){
    			alert("请选择码数!");
    		}else if(colors.length > 0 && colorbln == false){
    			alert("请选择颜色!");
    		}else{
    			$("#inCart").unbind("click").bind("click",function(e){
    				if(parseInt(quantity) > parseInt($("#stocks").text())){
    					sCartMsg("库存不足!",e);
    				}else{
            			$.post(actionURL,{ctrl:"url_/3d0",productId:productId,coidNo:coidNo,quantity:quantity,attribute:size+color},function(data){
        					var _data = eval(data);
    			            if(_data[0].msg=='O' || _data[0].msg=='N'){
    							switch(_data[0].msg){
    							 case 'O' : sCartMsg("购物车已满!",e);break;
    							 case 'N' : sCartMsg("购物车没有该商品,不能修改数量!",e);break;
    							 default : sCartMsg('error!',e);break;
    							}
    			            }else{
    			            	showBaGrd();
    			            	sCartTalMsg(_data[0].size,_data[0].total,e);
    			            }
    				 });
    				}
    			});
    		}
        }
    	
    	function buyBtn(productId,coidNo,quantity,is){
    		$(is).click(function(e){
    			$.post(actionURL,{ctrl:"url_/3d0",productId:productId,coidNo:coidNo,quantity:quantity},function(data){
    				var obj=eval(data);
					var o=obj[0];
			            if(o.msg=='O' || o.msg=='N'){
							switch(o.msg){
							 case 'O' : sCartMsg("购物车已满!",e);break;
							 case 'N' : sCartMsg("购物车没有该商品,不能修改数量!",e);break;
							 default : sCartMsg('error!',e);break;
							}
			            }else{
			            	showBaGrd();
			            	sCartTalMsg(o.size,o.total,e);
			            }
				 });
			});
    	}
    	
    	function oBuyBtn(productId,coidNo,quantity,is){
    		$(is).unbind("click").bind("click",function(e){
    			$.post(actionURL,{ctrl:"url_/3d0",productId:productId,coidNo:coidNo,quantity:quantity},function(data){
    				var obj=eval(data);
					var o=obj[0];
			            if(o.msg=='O' || o.msg=='N'){
							switch(o.msg){
							 case 'O' : oCartMsg("购物车已满!",e);break;
							 case 'N' : oCartMsg("购物车没该商品,不能修改数量!",e);break;
							 default : oCartMsg('error!',e);break;
							}
			            }else{
			            	showBaGrd();
			            	oCartTalMsg(o.size,o.total,e);
			            }
				 });
			});
    	}
        
        function rCartPro(url,productName){
        	if(window.confirm("是否要删除　"+productName+"?")){
        		window.location.href=url;
        	}
        }

        function  rm2CPro(url,cname){
        	if(window.confirm("是否要删除有关　"+cname+"公司的商品?")){
        		window.location.href=url;
        	}
        }
        
        function sCartMsg(msg,e){
        	createDIV();
			$("#CartMsg")
			.css("position","absolute")
			.css("z-index","5")
			.css("top",e.pageY-50)
			.css("left",e.pageX-165);
			var html="<div style='width:100%;height:20px;padding: 3 0 0 10; background-color:#FCE39E; color:#FF5500;'>购物车信息</div>"
					+"<div style='width:100%;height:20px;padding: 10 0 10 0; text-align:center; '>"+msg+"</div>"
					+"<div style='width:100%;height:10px;text-align:center; '><input type='button' onclick='showCart();' value='查看购物车'/>　　　<input value='　关　闭　' type='button' onclick='colseDialog();'/></div>";
			$("#CartMsg").html(html);
        }
        
        function oCartMsg(msg,e){
        	createDIV();
			$("#CartMsg")
			.css("position","absolute")
			.css("z-index","5")
			.css("top",e.pageY-50)
			.css("left",e.pageX-165);
			var html="<div style='width:100%;height:20px;padding: 3 0 0 10; background-color:#FCE39E; color:#FF5500;'>购物车信息</div>"
					+"<div style='width:100%;height:20px;padding: 10 0 10 0; text-align:center; '>"+msg+"</div>"
					+"<div style='width:100%;height:10px;text-align:center; '><input type='button' onclick='openCart();colseDialog();' value='查看购物车'/>　　　<input value='　关　闭　' type='button' onclick='colseDialog();'/></div>";
			$("#CartMsg").html(html);
        }
        
        function createDIV(){
        	showBaGrd();
			var msgDialog=document.createElement("div");
			msgDialog.style.width="320px";
			msgDialog.style.height="100px";
			msgDialog.style.backgroundColor="white";
			msgDialog.style.border="1px #FBCC4F solid";
			msgDialog.id="CartMsg";
			$("body").append(msgDialog);
        }
        
        function sCartTalMsg(oCls,oTal,e){
        	createDIV();
        	var left = $(window.document.body).width()/2-160;
        	var top;
        	if(document.documentElement.clientHeight != 0)
        		top  = document.documentElement.clientHeight/2-50+document.documentElement.scrollTop;
        	else
        		top  = $(window.document.body).height()/2-50+document.documentElement.scrollTop;
			$("#CartMsg")
			.css("position","absolute")
			.css("z-index","5")
			.css("top",top)
			.css("left",left);
			setPanelLoyout("#CartMsg");
			var html="<div id='msghead' style='width:310px;height:20px;padding: 3 0 0 10; background-color:#FCE39E;'>商品已成功添加到购物车！</div><br>"
				+"<center><div style='font-size:14px;'>购物车中共有<span style='color:#FF5500; font-weight: 800;'>"+oCls+"</span>种商品，合计：<span style='color:#FF5500; font-weight: 800;'>"+ oTal +"</span></center></div><br>"
				+"<center><input type='button' onclick='showCart();' value='查看购物车'/>　　　<input value='继续购物' type='button' onclick='colseDialog();'/></center>";
			$("#CartMsg").html(html);
			
			if(document.documentElement.clientHeight == 0)
				$("#msghead").css("width","320px");
			//alert(document.documentElement.scrollTop);
			//alert(document.documentElement.clientHeight);
        }
        
        function oCartTalMsg(oCls,oTal,e){
        	createDIV();
        	var left = $(window.document.body).width()/2-160;
        	var top;
        	if(document.documentElement.clientHeight != 0)
        		top  = document.documentElement.clientHeight/2-50+document.documentElement.scrollTop;
        	else
        		top  = $(window.document.body).height()/2-50+document.documentElement.scrollTop;
			$("#CartMsg")
			.css("position","absolute")
			.css("z-index","5")
			.css("top",top)
			.css("left",left);
			setPanelLoyout("#CartMsg");
			var html="<div id=\"oCateMsg\" style='width:100%;height:20px;padding: 3 0 0 10; background-color:#FCE39E;'>商品已成功添加到购物车！</div><br>"
				+"<center><div style='font-size:14px;'>购物车中共有<span style='color:#FF5500; font-weight: 800;'>"+oCls+"</span>种商品，合计：<span style='color:#FF5500; font-weight: 800;'>"+ oTal +"</span></center></div><br>"
				+"<center><input id=\"obtn\" type='button' onclick='openCart();colseDialog();' value='查看购物车'/>　　　<input value='继续购物' type='button' onclick='colseDialog();'/></center>";
			$("#CartMsg").html(html);
        }
        
        function setPanelLoyout(key){
        	$(window).unbind("scroll").bind("scroll",function(){
        		document.documentElement.scrollTop = -1;
        	});
        	
        	$(window).resize(function(){
        		var left = $(window.document.body).width()/2-160;
            	var top;
            	if(document.documentElement.clientHeight != 0)
            		top = document.documentElement.clientHeight/2-50+document.documentElement.scrollTop;
            	else
            		top = $(window.document.body).height()/2-50+document.documentElement.scrollTop;
        		$(key).css("top",top).css("left",left);
        	});
        }

        function colseDialog(){
        	$("#CartMsg").remove();
        	$("#CartMsg_background").remove();
        	$(window).unbind("scroll");
        }
        
        function showCart(){
        	window.location.href=actionURL;
        }
        
        function openCart(){
        	window.open(actionURL);
        }
        
        function showBaGrd(){
			var msgDialog_background=document.createElement("div");
			msgDialog_background.style.backgroundColor="black";
			msgDialog_background.id="CartMsg_background";
			$("body").append(msgDialog_background);
			$("#CartMsg_background")
			.css("position","absolute")
			.css("top","0").css("left","0")
			.css("filter","alpha(opacity=50)")
			.css("z-index","3")
			.css("width",$(window.document.body).width()+"px")
			.css("height",$(window.document.body).height()+"px");
			$(window).unbind("resize").bind("resize",function(){
				$("#CartMsg_background").css("width",document.documentElement.clientWidth+"px");
			});
			//alert(document.documentElement.scrollTop);
        }
        
        function showAddrForm(FG){
        	$("#addrContext").html("");
			$.post(actionURL,{ctrl:"url_/3d3"},function(data){
				var radioHTML="";
				var fKey=eval(data)[0].key;
				for(var i=0; i<eval(data).length;i++){
					radioHTML+="<div id='address"+eval(data)[i].key+"' style='text-align:left; padding-left:20px; width:1000px; height:20px; margin-top:5px;  margin-bottom:5px;'><input type=\"radio\" id='oRadio' name=\"address\" value=\""+eval(data)[i].key+"\" onclick=\"getAddrKey();\" />"+eval(data)[i].addr+"</div>";
				}
				sb(radioHTML,fKey,FG);
			});
        }
        
        function sb(radioHTML,fKey,flag){
        	if(flag=="true"){
        		aRObject(radioHTML,fKey);
        	}else{
        		aObject(flag);
        	}
        }
        
        function aRObject(radioHTML,fKey){
        	if(fKey>0){
        		$("#addrContent").append(radioHTML);
        		$("input[name='address'][value='"+fKey+"']").attr("checked",true);
        		$("#address"+fKey).css("background-color","#b2d4fb");
        		tmAddrKey=fKey;
        	}else{
        		aObject(false);
        	}
        }
        
        
        function getAddrKey(){
        	$(".addForm").remove();
        	var $chkRadio=$("input[name='address'][checked='true']");
        	if($chkRadio.val()!=tmAddrKey){
            	$("#address"+$chkRadio.val()).css("background-color","#b2d4fb");
            	$("#address"+tmAddrKey).css("background-color","white");
            	tmAddrKey=$chkRadio.val();
        	}
        	if($chkRadio.val()>0){
        		aObject(true);
        	}else{
        		aObject(false);
        	}
        }
        
        
        function aObject(flag){
        	var addrhtml="<div class=\"addForm\" id=\"addForm\"  style=\"width: 1003px; text-align: left; border: 1px #A4C4DE solid; padding-top: 10px;\">"
				+"<table width=\"811\" height=\"152\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"font-size: 12px; font-weight: 500;\">"
				+"  <tr>"
				+"   <td width=\"178\" align=\"right\">地址<b style=\"color: red; font-weight: 800;\">*</b>：</td>"
				+"    <td width=\"632\"><input type=\"text\"  name=\"addressF\" style=\"width: 100%;\"/></td>"
				+"  </tr>"
				+"  <tr>"
				+"   <td align=\"right\">邮政编码<b style=\"color: red; font-weight: 800;\">*</b>：</td>"
				+"    <td><input type=\"text\" name=\"postcodeF\" /></td>"
				+"  </tr>"
				+"  <tr>"
				+"   <td align=\"right\">收货人姓名<b style=\"color: red; font-weight: 800;\">*</b>：</td>"
				+"    <td><input type=\"text\" name=\"addresseeF\" /></td>"
				+"  </tr>"
				+"  <tr>"
				+"   <td align=\"right\">性别：</td>"
				+"    <td><label>"
				+"     <input type=\"radio\"   name=\"sexF\" value=\"0\" checked=\"checked\" />Mr."
				+"      <input type=\"radio\"  name=\"sexF\" value=\"1\" />Miss."
				+"    </label></td>"
				+"  </tr>"
				+"  <tr>"
				+"    <td align=\"right\">手机：</td>"
				+"    <td><input type=\"text\"  name=\"mobileF\" /></td>"
				+"  </tr>"
				+"  <tr>"
				+"   <td align=\"right\">电话：</td>"
				+"    <td><input type=\"text\" name=\"areaF\" style=\"width: 60px;\" />"
				+"      -"
				+"      <input type=\"text\" name=\"phoneF\" style=\"width: 100px;\"  />"
				+"      -"
				+"      <input type=\"text\" name=\"extensionF\" style=\"width: 60px;\"/>"
				+"    </td>"
				+"  </tr>"
				+"  <tr>"
				+" 	<td></td>"
				+"  	<td><div style=\"color: silver; height: 25px;\">手机和电话至少填写一个,电话的格式：区号-电话号码-分机</div></td>"
				+"  </tr>"
				+"</table>"
				+"</div>";
        	if(flag==true){
        		$(".addForm").remove();
        	}else{
        		$(".addForm").remove();
        		$("#addrContent").append(addrhtml);
        	}
        }
        

        
        function backToCart(){
        	showCart();
        }
        
        function checkForm(){
                	var addrForm=document.getElementById("addForm");
                	var address  =  $.trim($("input[name='addressF']").val());
                	var postcode =  $.trim($("input[name='postcodeF']").val());
                	var addressee =  $.trim($("input[name='addresseeF']").val());
                	var sex 	 =  $.trim($("input[name='sexF'][checked=true]").val());
                	var mobile   =  $.trim($("input[name='mobileF']").val());
                	var phone    =  $.trim($("input[name='areaF']").val()+$("input[name='phoneF']").val()+$("input[name='extensionF']").val());
                	if(tmAddrKey==-1 || tmAddrKey==0){
                    	if(addrForm!=null){
                       		var patrn1 =/^[0-9]{1,20}$/; 
                    		var patrn2 = /^[0-9*#-]{1,24}$/; 
                    		if( address==""  || address.length==0 ){
                    			alert("地址不能为空!");
                    			return false;
                    		}
                    		if(!patrn1.exec(postcode)){
                    			alert("邮政编码不能为空和只能包含数字!");
                    			return false;
                    		}
                    		if( addressee==""  || addressee.length==0 ){
                    			alert("收件人名称不能为空!");
                    			return false;
                    		}
                    		if( mobile.length>0 && phone.length>2){
                    			if( !patrn1.exec(mobile) ){
                        			alert('手机只能包含数字!');
//                        			alert(1);
                        			return false;
                    			}
                       			if(!patrn2.exec(phone)){
                           			alert('电话只能包含数字和#*');
                        			return false;
                       			}
                    		}else if( mobile.length>0){
                    			if( !patrn1.exec(mobile) ){
                        			alert('手机只能包含数字!');
                        			return false;
                    			}
                			}else if( phone.length>2){
                       			if(!patrn2.exec(phone)){
                           			alert('电话只能包含数字和#*');
                        			return false;
                       			}
                    		}else{
                    			alert("请填写完整订单信息");
                    			return false;
                    		}
                    	}
                	}
                	removeAddrElement();
                	appendAddrElement(tmAddrKey,address,postcode,addressee,sex,mobile,phone);
                	return true;
        }
        
        function appendAddrElement(addressId,address,postcode,addressee,sex,mobile,phone){
        	remark=remarkNameStr.substring(0, remarkNameStr.length-1)
        	var cremark="";
        	for(var i=0; i<remark.split("-").length;i++){
        			var rk=$("input[name="+remark.split("-")[i]+"]").val();
        			var cid=remark.split("-")[i].split("_")[1];
        			if(rk!=""){
        				cremark+=cid+"_"+rk+"-";
        			}
        	}
        	$("form[name=cart]")
        	.append("<input type=\"hidden\" name=\"addressId\" value=\""+addressId+"\"/>")
        	.append("<input type=\"hidden\" name=\"address\" value=\""+address+"\"/>")
        	.append("<input type=\"hidden\" name=\"postcode\" value=\""+postcode+"\"/>")
        	.append("<input type=\"hidden\" name=\"addressee\" value=\""+addressee+"\"/>")
        	.append("<input type=\"hidden\" name=\"sex\" value=\""+sex+"\"/>")
        	.append("<input type=\"hidden\" name=\"mobile\" value=\""+mobile+"\"/>")
        	.append("<input type=\"hidden\" name=\"phone\" value=\""+phone+"\"/>")
        	.append("<input type=\"hidden\" name=\"remark\" value=\""+$.trim(cremark.substring(0, cremark.length-1))+"\"/>");
        }
        
        function removeAddrElement(){
        	$("input[name=addressId]").remove();
        	$("input[name=address]").remove();
        	$("input[name=postcode]").remove();
        	$("input[name=addressee]").remove();
        	$("input[name=sex]").remove();
        	$("input[name=mobile]").remove();
        	$("input[name=phone]").remove();
        	$("input[name=remark]").remove();
        }
        
        function backFill(){
        	document.fill.submit();
        }
        
        function viewoder(orderNum){
			var msgDialog=document.createElement("div");
			msgDialog.style.width="400px";
			msgDialog.style.height="300px";
			msgDialog.style.backgroundColor="white";
			msgDialog.style.border="1px #b6b7b7 solid";
			msgDialog.style.position="absolute";
			msgDialog.style.display="none";
			msgDialog.id = "orderview";
			$("body").append(msgDialog);
        	$.post(actionURL,{ctrl:"url_/3e6",orderNum:orderNum},function(xml){
        			var itemNode=$(xml).find("items").children("item");
        			var tbHTML="<div style=\"width:400px; text-align:right; padding-right:10px; color:silver; font-size:12px;\"><div style='float:left; width:60px; color:black; padding-top:3px; font-size:12px;'>订单编号：</div><div style='float:left; text-align:left; width:200px; color:#5fb21b;font-size: 12px; font-weight: 800;'>"+orderNum+"</div>双击关闭</div><table>";
        			tbHTML+="<tr heigth='30'  style='text-align:center; height:30px; '><td width='200'>商品名称</td><td width='100'>单价</td><td width='100'>数量</td></tr>";
        			for(var i=0; i<$(itemNode).length; i++){
        				tbHTML+="<tr  style='height:10px;'><td width='400'colspan=\"3\"></td></tr>";
        				tbHTML+="<tr  style='text-align:center;background-color:#E2F2FF;padding-top:10px; height:30px;'><td width='200' style='border:1px #a9d1e0 solid; border-right:none;'>"+$(itemNode[i]).find("name").text()+"</td><td width='100' style='border:1px #a9d1e0 solid; border-left:none; border-right:none;'>"+$(itemNode[i]).find("price").text()+"</td><td width='100' style='border:1px #a9d1e0 solid; border-left:none;'>"+$(itemNode[i]).find("amount").text()+"</td></tr>";
        			}
        			tbHTML+="</table>";
        			viewBgDv(30,"#d0d0d0");
        			$("#orderview").append(tbHTML);
        			$("#orderview")
        			.css("display","block")
        			.css("z-index","5")
        			.css("padding","10px")
        			.css("top",document.body.clientHeight/2-150)
        			.css("left",document.body.clientWidth/2-200);
        			
        			$("#orderview").unbind("dblclick").bind("dblclick",function(){
        				$("#orderview").remove();
        				$("#CartMsg_background").remove();
        			});
        			
        			$("#CartMsg_background").unbind("dblclick").bind("dblclick",function(){
        				$("#orderview").remove();
        				$("#CartMsg_background").remove();
        			});
        			
        	});
        }
        
        function viewBgDv(opacity,backgroundColor){
			var msgDialog_background=document.createElement("div");
			msgDialog_background.style.backgroundColor=backgroundColor;
			msgDialog_background.id="CartMsg_background";
			$("body").append(msgDialog_background);
			$("#CartMsg_background")
			.css("position","absolute")
			.css("top","0").css("left","0")
			.css("filter","alpha(opacity=50)")
			.css("z-index","3")
			.css("width",$(document.body).width())
			.css("height",$(document.body).height());
        }
        
       
        function checksign(){
        	if( sign == 0){
        	   viewBgDv('50','black');
        	   var styleStr  = "style='width:420px; height:200px; z-index:7; position:absolute; background-color:white; border:1px silver solid; text-align:center;'"; 
        	   var loginHtml = "<div class='loginview'  "+styleStr+">"
        	   +"<div style='width:100%; height:25px;background-color:#d3d3d3; text-align:left; padding-left:10px; padding-top:5px;'><div style='float:left;  font-weight:bolder; width:100px; color:black; font-size:12px; height:15px;'>登陆</div><div style='float:right; width:70px; color:white; font-size:12px; height:25px;'>双击关闭</div></div>"
        	   +"<div id='msg' style='width:100%; margin-top:10; text-align:center; padding-left:10px; color:red; font-weight:bolder;'></div>"
        	   +"<div style='margin-top:20;'><span style='width:55px;text-align:right;'>用户名：</span><input type='text' id='meb_name' style='width:200px;'/></div>"
        	   +"<div style='margin-top:10;'><span style='width:55px;text-align:right;'>密&nbsp;&nbsp;&nbsp;&nbsp;码：</span><input type='password' id='meb_pw' style='width:200px;'/></div>"
        	   +"<div style='margin-top:10;'><input id='submit' type='button' value='登陆' style='width:76px;' />&nbsp;&nbsp;&nbsp;&nbsp;<input type='button' value='注册' onclick=\"window.open('/Main/client/memberregister.jsp?selLang=0');\" style='width:76px;'  /></div>"
        	   +"</div>";
        	   $("body").append(loginHtml);
        	   $("#submit").unbind("click").bind("click",function(){
        		   if($.trim($("#meb_name").val()) == ""){
        			   $("#msg").html("会员帐号不能为空");
        			   return false;
        		   }
        		   if($.trim($("#meb_pw").val()) == ""){
        			   $("#msg").html("会员密码不能为空");
        			   return false;
        		   }
        			$.post("/servlet/ModuleMebLoginAjaxProcesor",{meb_name:$.trim($("#meb_name").val()),meb_pw:$.trim($("#meb_pw").val())},function(data){
        				var obj = eval(data);
        				switch(obj[0].flag){
        					case '0': $("#msg").html(obj[0].msg);break;
        					case '1': $("#msg").html(obj[0].msg).css("color","green");$("form[name='cart']").submit();break;
        					default: break;
        				}
        			});
        	   });
        	   $(".loginview")
        	   .css("top",document.body.clientHeight/2-100)
        	   .css("left",document.body.clientWidth/2-210)
        	   .unbind("dblclick").bind("dblclick",function(){
        	   		$(this).remove();
        	   		$("#CartMsg_background").remove();
        	   });
        	   
        	   $("#CartMsg_background").unbind("dblclick").bind("dblclick",function(){
        	   		$(this).remove();
        	   		$(".loginview").remove();
        	   });
        	   return false;
        	}
        	return true;
        }
        
        //立即购买
        function buyNow(productId,coidNo,quantity){
    		var sizes = $(document).find(".pro_size");
    		var colors = $(document).find(".pro_color");
    		if( sizes.length > 0 && sizebln == false){
    			alert("请选择码数!");
    		}else if(colors.length > 0 && colorbln == false){
    			alert("请选择颜色!");
    		}else{
    			$("#buyNow").unbind("click").bind("click",function(e){
        			$.post("/servlet/cartProcess",{ctrl:'N',productId:productId,coidNo:coidNo,quantity:quantity,attribute:size+color},function(data){
        					var _data = eval("("+data+")");
    			            if(_data.msg == "true"){
    			            	window.location.href="/Main/client/cart/content.jsp?ctrl=url_/3d5&nId=url_/3c1&nType=url_/3c1/3c2&nLoc=url_/3bf&selLang=0";
    			            }else{
    			               viewBgDv('50','black');
    			          	   var styleStr  = "style='width:420px; height:200px; z-index:7; position:absolute; background-color:white; border:1px silver solid; text-align:center;'"; 
    			          	   var loginHtml = "<div class='loginview'  "+styleStr+">"
    			          	   +"<div style='width:410px; height:25px;background-color:#d3d3d3; text-align:left; padding-left:10px; padding-top:5px;'><div style='float:left;  font-weight:bolder; width:100px; color:black; font-size:12px; height:15px;'>登陆</div><div style='float:right; width:70px; color:white; font-size:12px; height:25px;'>双击关闭</div></div>"
    			          	   +"<div id='msg' style='width:100%; margin-top:10; text-align:center; padding-left:10px; color:red; font-weight:bolder;'></div>"
    			          	   +"<div style='margin-top:20;'><span style='width:55px;text-align:right;'>用户名：</span><input type='text' id='meb_name' style='width:200px;'/></div>"
    			          	   +"<div style='margin-top:10;'><span style='width:55px;text-align:right;'>密&nbsp;&nbsp;&nbsp;&nbsp;码：</span><input type='password' id='meb_pw' style='width:200px;'/></div>"
    			          	   +"<div style='margin-top:10;'><input id='submit' type='button' value='登陆' style='width:76px;' />&nbsp;&nbsp;&nbsp;&nbsp;<input type='button' value='注册' onclick=\"window.open('/Main/client/memberregister.jsp?selLang=0');\" style='width:76px;'  /></div>"
    			          	   +"</div>";
    			          	   $("body").append(loginHtml);
    			          	   $("#submit").unbind("click").bind("click",function(){
    			          		   if($.trim($("#meb_name").val()) == ""){
    			          			   $("#msg").html("会员帐号不能为空");
    			          			   return false;
    			          		   }
    			          		   if($.trim($("#meb_pw").val()) == ""){
    			          			   $("#msg").html("会员密码不能为空");
    			          			   return false;
    			          		   }
    			          			$.post("/servlet/ModuleMebLoginAjaxProcesor",{meb_name:$.trim($("#meb_name").val()),meb_pw:$.trim($("#meb_pw").val())},function(data){
    			          				var obj = eval(data);
    			          				switch(obj[0].flag){
    			          					case '0': $("#msg").html(obj[0].msg);break;
    			          					case '1': window.location.href="/Main/client/cart/content.jsp?ctrl=url_/3d5&nId=url_/3c1&nType=url_/3c1/3c2&nLoc=url_/3bf&selLang=0";
    			          					default: break;
    			          				}
    			          			});
    			          	   });
    			          	   $(".loginview")
    			          	   .css("top",document.body.clientHeight/2-100)
    			          	   .css("left",document.body.clientWidth/2-210)
    			          	   .unbind("dblclick").bind("dblclick",function(){
    			          	   		$(this).remove();
    			          	   		$("#CartMsg_background").remove();
    			          	   });
    			          	   $("#CartMsg_background").unbind("dblclick").bind("dblclick",function(){
    			          	   		$(this).remove();
    			          	   		$(".loginview").remove();
    			          	   });
    			            }
    				 });
    			});
    		}
        }
        
        var size="";
        var sizebln=false;
        function selSize(is){
        	var sizes = $(document).find(".pro_size");
        	for(var i=0; i<sizes.length; i++){
        		$(sizes[i]).css("border","1px silver solid");
        	}
        	size =" 码数："+$(is).html();
        	$(is).css("border","2px red solid");
        	sizebln = true;
        }
        
        var color="";
        var colorbln=false;
        function selColor(is){
        	var colors = $(document).find(".pro_color");
        	for(var i=0; i<colors.length; i++){
        		$(colors[i]).css("border","1px silver solid");
        	}
        	color =" 颜色："+$(is).html();
        	$(is).css("border","2px red solid");
        	colorbln=true;
        }
        
