


//添加购物车



/*function postdata(id){                             //提交数据函数 
$.ajax({                                                 //调用jquery的ajax方法 
    type: "GET",                                     //设置ajax方法提交数据的形式 
    url:"/eshop/CartBuy_js.php?id="+id,                                     //把数据提交到ok.php 
    success: function(msg){                 //提交成功后的回调，msg变量是ok.php输出的内容。 
      alert("数据提交成功");                     //如果有必要，可以把msg变量的值显示到某个DIV元素中 
    } 
}); 
}*/


function buybook(id)
{
  //
  $.ajax({
      beforeSend:function(){$("#buymsg").html("正在发送");},
      type: "GET",
      timeout:3000,
      url:"/eshop/CartBuy_js.php?id="+id,
      success: function(comm){
      $("#buymsg").html(comm);
      $("#buymsg").html("操作成功");
    },
    
  })
}

function buybookxl(msgid)
{
  

  $.ajax({
      type: "GET",
      timeout:3000,
      success: function(comm){
      $(msgid).html(comm);
      $(msgid).html("<a href='Order_build.asp?tag=xl' target='_blank'>Составить договор</a>");
    }
    
  })
  

}
function buybookyh(msgida)
{
  

  $.ajax({
      type: "GET",
      timeout:3000,
      success: function(comma){
      $(msgida).html(comma);
      $(msgida).html("<a href='Order_build.asp?tag=yh' target='_blank'>Составить договор</a>");
    }
    
  })
  

}
function buybookoo(id,ses)
{
  document.getElementById('light').style.display='block';
  document.getElementById('fade').style.display='block';

  $.ajax({
      
      type: "GET",
      timeout:3000,
      url:"/eshop/CartBuy_js.asp?id="+id
	  
      
  })
  document.getElementById("asssa").innerHTML=ses;

}
/*function addtocart(itemcode,viewtype){
	$.post("/eshop/CartBuy_js.asp",{i:viewtype},
		function (msg){
			var msgs=msg.split("|");
			if(msgs[0]=="0"){
				$("#addtocartmsg").html("");
			}else{
				$("#addtocartmsg").html("<p><strong style=\"color:red\">"+msgs[1]+"</strong></p>");
			}
			cartitems(viewtype);
		});	
}*/
function changefactory(factory){
	$("#isfactory").val(factory);
	setcontrolvalue( 0,'act','search');
	disableFiled();
	$("#isfactory").removeAttr("disabled");
	setformsubmit( 0 );
	return false;
}
function setSinfoAndStype(sinfo,stype){
	document.getElementById("sinfo").value = sinfo;
	document.getElementById("stype").value = stype;
}
function addlog(adpositionid,adid,positionname,typecode,adorder){
	var timestamp = Date.parse(new Date());
	var severURL = "http://adcenter.dhgate.com/log.do?act=clickLog&adpositionid="+adpositionid+"&adid="+adid+"&positionname="+positionname+"&typecode="+typecode+"&adorder="+adorder+"&time="+timestamp;
	var e = arguments.callee.caller.arguments[0];
	e = e?e:window.event;
	var obj = window.event?window.event.srcElement:e.target;
	if('A' != obj.tagName && obj.parentNode) {
		obj = obj.parentNode;
	}
	if('A' == obj.tagName && !obj.logged){
		e.preventDefault? e.preventDefault(): e.returnValue = false;
		var log  = new Image;
		var t = obj.target;
		var timer;
		function gooo(){
			window.clearTimeout(timer);
			t?window.open(obj.href,t):window.location.href = obj.href;
		}
		log.onload = gooo;
		log.src = severURL; 
		timer = window.setTimeout(gooo,500); 
		return ;
	}
}
function recommendclicklog(diaplaypositionid, itemcode, productid, logicid, productsetid, buyerid, cookieid, ip, rank){		
	var severURL = "http://reco.dhgate.com/service/clicklog?diaplaypositionid="+diaplaypositionid+"&itemcode="+itemcode+"&productid="+productid+"&logicid="+logicid+"&productsetid="+productsetid+"&buyerid="+buyerid+"&cookieid="+cookieid+"&ip="+ip+"&rank="+rank+"&t="+new Date().getTime();
	var e = arguments.callee.caller.arguments[0];
	e = e?e:window.event;
	var obj = window.event?window.event.srcElement:e.target;
	if('A' != obj.tagName && obj.parentNode) obj = obj.parentNode;
	if('A' != obj.tagName)return;
	if(!obj.logged){
		e.preventDefault? e.preventDefault(): e.returnValue = false;
		var log  = new Image;
		var t = obj.target;
		obj.logged = true;
		var timer;
		function gooo(){
			window.clearTimeout(timer);
			t?window.open(obj.href,t):window.location.href = obj.href;
		}
		log.onload = gooo;
		log.src = severURL; 
		timer = window.setTimeout(gooo,500); 
		return ;
	}
}
function dhRecoGetCookie(name){ 
	var pos=document.cookie.indexOf(name + "="); 
	if (pos!=-1){ 
		var start=pos+name.length+1; 
		var end=document.cookie.indexOf(";", start); 
		if (end==-1){ 
			end=document.cookie.length; 
		} 
		return unescape(document.cookie.substring(start,end)); 
	}
	return null; 
}
function clicktag(obj){
	if( obj.parentNode.parentNode.className){
		if( obj.parentNode.parentNode.className=="open" ){
			obj.parentNode.parentNode.className="close";
		}else{
			obj.parentNode.parentNode.className="open";
		}
	}
}
function dealviewtype(viewtype){
	setcontrolvalue( 0,'act','viewtype');
	setcontrolvalue( 0,'viewtype',viewtype);
	disableFiled();
  	if(judgeSearchInput()){
  	 	setformsubmit( 0 );
  	}
}
function dealpagesizenew(pagesize){
	setcontrolvalue( 0,'act','pagesize');
	setcontrolvalue( 0,'pagesize',pagesize);
	disableFiled();
	if(judgeSearchInput()){
		setformsubmit( 0 );
	}
}
function dealsortnew()
{
	var sDealSortStr = getcontrolvalue( 0,'sortbyword');
	var i = sDealSortStr.indexOf(",");
	var sinfo = sDealSortStr.substring(0,i);
	var stype = sDealSortStr.substring(i+1);
	setcontrolvalue( 0,'act','search');
	setcontrolvalue( 0,'stype',stype);
	setcontrolvalue( 0,'sinfo',sinfo);
	var keyword = getcontrolvalue( 0,'searchkey');
	var supplierid = getcontrolvalue( 0,'supplierid');
	var advancedno = getcontrolvalue( 0,'advancedno');
	if(keyword!='' || supplierid!=''|| advancedno!=''){
		disableFiled();
		setformsubmit( 0 );
	}	     		 
}
function dealsortdirnew()
{
	var sDealSortStr = getcontrolvalue( 0,'sortbyword');
	var i = sDealSortStr.indexOf(",");
	var sinfo = sDealSortStr.substring(0,i);
	var stype = sDealSortStr.substring(i+1);
	setcontrolvalue( 0,'act','search');
	setcontrolvalue( 0,'stype',stype);
	setcontrolvalue( 0,'sinfo',sinfo);
	disableFiled();
	setformsubmit( 0 );
}
function dhGetCookie(name){ 
 	var pos=document.cookie.indexOf(name + "="); 
 	if (pos!=-1){ 
 		var start=pos+name.length+1; 
 		var end=document.cookie.indexOf(";", start); 
 		if (end==-1){ 
 			end=document.cookie.length; 
 		} 
 		return unescape(document.cookie.substring(start,end)); 
 	} 
 	return null; 
 }
