﻿function AJAXRequest() {
	var xmlPool=[],objPool=[],AJAX=this,ac=arguments.length,av=arguments;
	var xmlVersion=["MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
	var eF=emptyFun=function(){};
	var av=ac>0?typeof(av[0])=="object"?av[0]:{}:{};
	var encode=$GEC(av.charset+"");
	this.url=getp(av.url,"");
	this.oncomplete=getp(av.oncomplete,eF);
	this.content=getp(av.content,"");
	this.method=getp(av.method,"POST");
	this.async=getp(av.async,true);
	this.onexception=getp(av.onexception,eF);
	this.ontimeout=getp(av.ontimeout,eF);
	this.timeout=getp(av.timeout,3600000);
	this.onrequeststart=getp(av.onrequeststart,eF);
	this.onrequestend=getp(av.onrequestend,eF);
	if(!getObj()) return false;
	function getp(p,d) { return p!=undefined?p:d; }
	function getObj() {
		var i,j,tmpObj;
		for(i=0,j=xmlPool.length;i<j;i++) if(xmlPool[i].readyState==0||xmlPool[i].readyState==4) return xmlPool[i];
		try { tmpObj=new XMLHttpRequest; }
		catch(e) {
			for(i=0,j=xmlVersion.length;i<j;i++) {
				try { tmpObj=new ActiveXObject(xmlVersion[i]); } catch(e2) { continue; }
				break;
			}
		}
		if(!tmpObj) return false;
		else { xmlPool[xmlPool.length]=tmpObj; return xmlPool[xmlPool.length-1]; }
	}
	function $(id){return document.getElementById(id);}
	function $N(d){var n=d*1;return(isNaN(n)?0:n);}
	function $VO(v){return(typeof(v)=="string"?(v=$(v))?v:false:v);}
	function $GID(){return((new Date)*1);}
	function $SOP(id,ct){objPool[id+""]=ct;}
	function $LOP(id){return(objPool[id+""]);}
	function $SRP(f,r,p){return(function(s){s=f(s);for(var i=0;i<r.length;i++) s=s.replace(r[i],p[i]);return(s);});}
	function $GEC(cs){
		if(cs.toUpperCase()=="UTF-8") return(encodeURIComponent);
		else return($SRP(escape,[/\+/g],["%2B"]));
	}
	function $ST(obj,text) {
		var nn=obj.nodeName.toUpperCase();
		if("INPUT|TEXTAREA".indexOf(nn)>-1) obj.value=text;
		else try{obj.innerHTML=text;} catch(e){};
	}
	function $CB(cb) {
		if(typeof(cb)=="function") return cb;
		else {
			cb=$VO(cb);
			if(cb) return(function(obj){$ST(cb,obj.responseText);});
			else return emptyFun; }
	}
	function $GP(p,v,d,f) {
		var i=0;
		while(i<v.length){p[i]=v[i]?f[i]?f[i](v[i]):v[i]:d[i];i++;}
		while(i<d.length){p[i]=d[i];i++;}
	}
	function send(purl,pc,pcbf,pm,pa) {
		var purl,pc,pcbf,pm,pa,ct,ctf=false,xmlObj=getObj(),ac=arguments.length,av=arguments;
		if(!xmlObj) return false;
		var pmp=pm.toUpperCase()=="POST"?true:false;
		if(!pm||!purl) return false;
		var ev={url:purl, content:pc, method:pm};
		purl+=(purl.indexOf("?")>-1?"&":"?")+"timestamp="+$GID();
		xmlObj.open(pm,purl,pa);
		AJAX.onrequeststart(ev);
		if(pmp) xmlObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		ct=setTimeout(function(){ctf=true;xmlObj.abort();},AJAX.timeout);
		xmlObj.onreadystatechange=function() {
			if(ctf) { AJAX.ontimeout(ev); AJAX.onrequestend(ev); }
			else if(xmlObj.readyState==4) {
				ev.status=xmlObj.status;
				try{ clearTimeout(ct); } catch(e) {};
				try{ if(xmlObj.status==200) pcbf(xmlObj); else AJAX.onexception(ev); }
				catch(e) { AJAX.onexception(ev); }
				AJAX.onrequestend(ev);
			}
		}
		if(pmp) xmlObj.send(pc); else xmlObj.send("");
		return true;
	}
	this.setcharset=function(cs) { encode=$GEC(cs); }
	this.get=function() {
		var p=[],av=arguments;
		$GP(p,av,[this.url,this.oncomplete],[null,$CB]);
		if(!p[0]&&!p[1]) return false;
		return(send(p[0],"",p[1],"GET",this.async));
	}
	this.update=function() {
		var p=[],purl,puo,pinv,pcnt,av=arguments;
		$GP(p,av,[emptyFun,this.url,-1,-1],[$CB,null,$N,$N]);
		if(p[2]==-1) p[3]=1;
		var sf=function(){send(p[1],"",p[0],"GET",this.async);};
		var id=$GID();
		var cf=function(cc) {
			sf(); cc--; if(cc==0) return;
			$SOP(id,setTimeout(function(){cf(cc);},p[2]));
		}
		cf(p[3]);
		return id;
	}
	this.stopupdate=function(id) {
		clearTimeout($LOP(id));
	}
	this.post=function() {
		var p=[],av=arguments;
		$GP(p,av,[this.url,this.content,this.oncomplete],[null,null,$CB]);
		if(!p[0]&&!p[2]) return false;
		return(send(p[0],p[1],p[2],"POST",this.async));
	}
	this.postf=function() {
		var p=[],fo,vaf,pcbf,purl,pc,pm,ac=arguments.length,av=arguments;
		fo=ac>0?$VO(av[0]):false;
		if(!fo||(fo&&fo.nodeName!="FORM")) return false;
		vaf=fo.getAttribute("onvalidate");
		vaf=vaf?(typeof(vaf)=="string"?new Function(vaf):vaf):null;
		if(vaf&&!vaf()) return false;
		$GP(p,[av[1],fo.action,fo.method],[this.oncomplete,this.url,this.method],[$CB,null,null]);
		pcbf=p[0];purl=p[1];
		if(!pcbf&&!purl) return false;
		pc=this.formToStr(fo); if(!pc) return false;
		if(p[2].toUpperCase()=="POST")
			return(send(purl,pc,pcbf,"POST",true));
		else {
			purl+=(purl.indexOf("?")>-1?"&":"?")+pc;
			return(send(purl,"",pcbf,"GET",true));
		}
	}

	this.formToStr=function(fc) {
		var i,qs="",and="",ev="";
		for(i=0;i<fc.length;i++) {
			e=fc[i];
			if (e.name!='') {
				if (e.type=='select-one'&&e.selectedIndex>-1) ev=e.options[e.selectedIndex].value;
				else if (e.type=='checkbox' || e.type=='radio') {
					if (e.checked==false) continue;
					ev=e.value;
				}
				else ev=e.value;
				ev=encode(ev);
				qs+=and+e.name+'='+ev;
				and="&";
			}
		}
		return qs;
	}
}

//========================================================AJAX部分结束================================================

//函数:判断某元素是否存在于数组中
function in_array(needle, haystack) {
        if(typeof (needle) == 'string' || typeof (needle) == 'number') {
            for(var i in haystack) {
                if(haystack[i] == needle) {
                    return true;
                }
            }
        }
        return false;
    }

//函数:去除数组内的重复项，参数为数组对象，返回结果为经过过滤重复处理后的数组对象
function del_same(oldarray)
{
var new_array = new Array();
   if (typeof(oldarray)=='object')   //参数是否为数组
	{
	  if (oldarray.length==1) //单元素
	    { new_array=oldarray;}
	  else					  //多元素
	  	{
		  var k=0;
		  for( var j in oldarray)
		  {    
		  if(in_array(oldarray[j],new_array)==false)     {  new_array[k]=oldarray[j];k++;  }
		  }
		}		 
	}	
return new_array;
}

function chk_cok_spt()
{
var cookieEnabled=(navigator.cookieEnabled)? true : false
//判断cookie是否开启

//如果浏览器不是ie4+或ns6+

if (typeof navigator.cookieEnabled=="undefined" && !cookieEnabled){ 
document.cookie="testcookie"
cookieEnabled=(document.cookie=="testcookie")? true : false
document.cookie="" //erase dummy value
}

	if (cookieEnabled) 
	{ return true; }
	else
	{ alert('Sorry, your browser does not support COOKIES, can not use this feature!');return false;}
}

function addtobox(lb)
{
//lb:  sel_cok供应，pro_cok产品  oem_cokOEM   buy_cok求购  com_cok公司
var selobj=document.getElementsByName('compareBox');
var mysel="";
for ( j =0 ; j <selobj.length; j++ ) 
　　　　{ 
　　　　　if ( selobj[j].checked && selobj[j].value!="") 
　　　　　{ 
			mysel+=selobj[j].value+",";
　　　　　} 
　　　　}
if(mysel.substr(mysel.length-1,1)==",")
{ mysel=mysel.substr(0,mysel.length-1); } //去掉最后一个字符
if(mysel=="") {alert('Please select');return false;}
addCookie(lb,mysel,168);
//alert(getCookie(lb));

my_sel_cok=getCookie('sel_cok');
my_pro_cok=getCookie('pro_cok');
my_oem_cok=getCookie('oem_cok');
my_buy_cok=getCookie('buy_cok');
my_com_cok=getCookie('com_cok');

//供应
if(my_sel_cok=="undefined" || my_sel_cok=="" || typeof(my_sel_cok)=="undefined")
{ my_sel_cok_num=0; }
else
{
	if(my_sel_cok.substr(my_sel_cok.length-1,1)==",")    { my_sel_cok=my_sel_cok.substr(0,my_sel_cok.length-1); } 
my_sel_arr=my_sel_cok.split(",");
my_sel_len=my_sel_arr.length;
my_sel_cok_num=my_sel_len;
}

//产品
if(my_pro_cok=="undefined" || my_pro_cok=="" || typeof(my_pro_cok)=="undefined")
{ my_pro_cok_num=0; }
else
{
	if(my_pro_cok.substr(my_pro_cok.length-1,1)==",")    { my_pro_cok=my_pro_cok.substr(0,my_pro_cok.length-1); }
my_pro_arr=my_pro_cok.split(",");
my_pro_len=my_pro_arr.length;
my_pro_cok_num=my_pro_len;
}

//oem
if(my_oem_cok=="undefined" || my_oem_cok=="" || typeof(my_oem_cok)=="undefined")
{ my_oem_cok_num=0; }
else
{
	if(my_oem_cok.substr(my_oem_cok.length-1,1)==",")    { my_oem_cok=my_oem_cok.substr(0,my_oem_cok.length-1); } 
my_oem_arr=my_oem_cok.split(",");
my_oem_len=my_oem_arr.length;
my_oem_cok_num=my_oem_len;
}

//buy
if(my_buy_cok=="undefined" || my_buy_cok=="" || typeof(my_buy_cok)=="undefined")
{ my_buy_cok_num=0; }
else
{
	if(my_buy_cok.substr(my_buy_cok.length-1,1)==",")    { my_buy_cok=my_buy_cok.substr(0,my_buy_cok.length-1); } 
my_buy_arr=my_buy_cok.split(",");
my_buy_len=my_buy_arr.length;
my_buy_cok_num=my_buy_len;
}

//com
if(my_com_cok=="undefined" || my_com_cok=="" || typeof(my_com_cok)=="undefined")
{ my_com_cok_num=0; }
else
{
	if(my_com_cok.substr(my_com_cok.length-1,1)==",")    { my_com_cok=my_com_cok.substr(0,my_com_cok.length-1); } 
my_com_arr=my_com_cok.split(",");
my_com_len=my_com_arr.length;
my_com_cok_num=my_com_len;
}

//获得总和
var cok_total=parseInt(my_sel_cok_num) + parseInt(my_pro_cok_num) + parseInt(my_oem_cok_num)+ parseInt(my_buy_cok_num) + parseInt(my_com_cok_num);
document.getElementById('cok_num').innerHTML=cok_total;

alert('Successfully joined the Inquiry basket');
clear_sel('form8','compareBox');
}

//用于iframe页面的调用
function addtobox_p(lb)
{
//lb:	buy_cok求购，sel_cok供应，pro_cok产品，com_cok公司，oem_cokOEM
var selobj=document.getElementsByName('compareBox');
var mysel="";
for ( j =0 ; j <selobj.length; j++ ) 
　　　　{ 
　　　　　if ( selobj[j].checked && selobj[j].value!="") 
　　　　　{ 
			mysel+=selobj[j].value+",";
　　　　　} 
　　　　}
if(mysel.substr(mysel.length-1,1)==",")
{ mysel=mysel.substr(0,mysel.length-1); } //去掉最后一个字符
if(mysel=="") {alert('Please select');return false;}
addCookie(lb,mysel,168);
//alert(getCookie(lb));

my_sel_cok=getCookie('sel_cok');
my_pro_cok=getCookie('pro_cok');
my_oem_cok=getCookie('oem_cok');
my_buy_cok=getCookie('buy_cok');
my_com_cok=getCookie('com_cok');
//供应
if(my_sel_cok=="undefined" || my_sel_cok=="" || typeof(my_sel_cok)=="undefined")
{ my_sel_cok_num=0; }
else
{
my_sel_arr=my_sel_cok.split(",");
my_sel_len=my_sel_arr.length;
my_sel_cok_num=my_sel_len;
}

//产品
if(my_pro_cok=="undefined" || my_pro_cok=="" || typeof(my_pro_cok)=="undefined")
{ my_pro_cok_num=0; }
else
{
my_pro_arr=my_pro_cok.split(",");
my_pro_len=my_pro_arr.length;
my_pro_cok_num=my_pro_len;
}

//oem
if(my_oem_cok=="undefined" || my_oem_cok=="" || typeof(my_oem_cok)=="undefined")
{ my_oem_cok_num=0; }
else
{
my_oem_arr=my_oem_cok.split(",");
my_oem_len=my_oem_arr.length;
my_oem_cok_num=my_oem_len;
}

//buy
if(my_buy_cok=="undefined" || my_buy_cok=="" || typeof(my_buy_cok)=="undefined")
{ my_buy_cok_num=0; }
else
{
my_buy_arr=my_buy_cok.split(",");
my_buy_len=my_buy_arr.length;
my_buy_cok_num=my_buy_len;
}

//com
if(my_com_cok=="undefined" || my_com_cok=="" || typeof(my_com_cok)=="undefined")
{ my_com_cok_num=0; }
else
{
my_com_arr=my_com_cok.split(",");
my_com_len=my_com_arr.length;
my_com_cok_num=my_com_len;
}

//获得总和
var cok_total=parseInt(my_sel_cok_num) + parseInt(my_pro_cok_num) + parseInt(my_oem_cok_num)+ parseInt(my_buy_cok_num) + parseInt(my_com_cok_num);
parent.document.getElementById('cok_num').innerHTML=cok_total;

alert('Successfully joined the Inquiry basket');
clear_sel('form8','compareBox');
}

function array_unique()
{
var a={};
for(var i=0;i<this.length;i++)
{
if(typeof a[this[i]]=="undefined")
a[this[i]]=1;
}
this.length=0;
for(var i in a)
this[this.length]=i;
return this;	
}


function addCookie(objName,objValue,objHours){//添加cookie
		if(getCookie(objName)==null || getCookie(objName)=="undefined")
		{ var str = objName + "=" + escape(objValue); }
		else
		{ var str = objName + "=" + escape(objValue) + "," + getCookie(objName); }
		str=unescape(str);
		var tmp=str.split("=");
		var tmpp=tmp[0];
			//这里要过滤重复的数组元素
		var strArr = tmp[1].split(",");
		
//========================注明：删除重复功能影响到表单检测，故将此功能暂时屏蔽============================
//Array.prototype.unique = array_unique;    //加入
//str=strArr.unique();
str=del_same(strArr);
//========================注明：删除重复功能影响到表单检测，故将此功能暂时屏蔽============================
		str=tmpp+ "="+str;
		if(objHours > 0){   //为0时不设定过期时间，浏览器关闭时cookie自动消失
				var date = new Date();
				var ms = objHours*3600*1000;
				date.setTime(date.getTime() + ms);
				str += "; expires=" + date.toGMTString();
				str += "; Path=" + "/";
			}
			document.cookie = str;
			//alert(str);
		}
		
function setCookie(objName,objValue,objHours){ //添加cookie
		var str = objName + "=" + escape(objValue);
		if(objHours > 0){   //为0时不设定过期时间，浏览器关闭时cookie自动消失
				var date = new Date();
				var ms = objHours*3600*1000;
				date.setTime(date.getTime() + ms);
				str += "; expires=" + date.toGMTString();
				str += "; Path=" + "/";
			}
			document.cookie = str;
			//alert(str);
		}
		
		function getCookie(objName){//获取指定名称的cookie的值
			var arrStr = document.cookie.split("; ");
			for(var i = 0;i < arrStr.length;i ++){
				var temp = arrStr[i].split("=");
				if(temp[0] == objName) return unescape(temp[1]);
			} 
		}
		
		function delCookie(name){//为了删除指定名称的cookie，可以将其过期时间设定为一个过去的时间
			var date = new Date();
			date.setTime(date.getTime() - 10000);
			document.cookie = name + "=a; Path=/;expires=" + date.toGMTString();
		}
		
		function killCookie(){
			delCookie("sel_cok");
			delCookie("pro_cok");
			delCookie("oem_cok");
			delCookie("buy_cok");
			delCookie("com_cok");
			alert('Clear success');
	        location.reload();
		}
		function kill_sel(){
			delCookie("sel_cok");
			alert('Clear supply Inquiry basket success');
	        location.reload();
		}
		function kill_pro(){
			delCookie("pro_cok");
			alert('Clear basket successful products Inquiry');
	        location.reload();
		}
		function kill_oem(){
			delCookie("oem_cok");
			alert('Clear OEM Inquiry basket success');
	        location.reload();
		}
		function kill_buy(){
			delCookie("buy_cok");
			alert('Clear Lead Inquiry basket success');
	        location.reload();
		}
		function kill_com(){
			delCookie("com_cok");
			alert('Clear basket successful companies Inquiry');
	        location.reload();
		}
		
		
		function allCookie(){ //读取所有保存的cookie字符串
			var str = document.cookie;
			if(str == ""){
				str = "Does not keep any cookie";
			}
			alert(str);
		}
		
		function $2(m,n){
			return document.forms[m].elements[n].value;
		}
		
		function add_(){
			var cookie_name = $2("myform","cookie_name");
			var cookie_value = $2("myform","cookie_value");
			var cookie_expireHours = $2("myform","cookie_expiresHours");
			addCookie(cookie_name,cookie_value,cookie_expireHours);
		}
		
		function get_(){
			var cookie_name = $2("myform","cookie_name");
			var cookie_value = getCookie(cookie_name);
			alert(cookie_value);
		}
		
		function del_(){
			var cookie_name = $2("myform","cookie_name");
			delCookie(cookie_name);
			alert("Delete success");
		}
		
		function del_one(lb)
		{	
		//lb:	buy_cok求购，sel_cok供应，pro_cok产品，com_cok公司，oem_cokOEM
		var selobj=document.getElementsByName('compareBox');
		var mysel="";
		for ( j =0 ; j <selobj.length; j++ )
		　　　　{ 
		　　　　　if ( selobj[j].checked && selobj[j].value!="") 
		　　　　　{ 
					mysel+=selobj[j].value+",";
		　　　　　} 
		　　　　}
		if(mysel.substr(mysel.length-1,1)==",")
		{ mysel=mysel.substr(0,mysel.length-1); } //去掉最后一个字符
		if(mysel=="") {alert('Please select');return false;}
				
		}

function del_sel(lb)
{
//lb:	buy_cok求购，sel_cok供应，pro_cok产品，com_cok公司，oem_cokOEM
	str1=getCookie(lb); //提取
	if(str1=="undefined")
	{ str1=null;alert('Not to delete the item');return false;}
	//alert(str1);
	arr1=str1.split(","); //数组1
	var selobj=document.getElementsByName('compareBox'); //提取选中
	var mysel="";
	for ( j =0 ; j <selobj.length; j++ ) 
　　　　{ 
　　　　　if ( selobj[j].checked && selobj[j].value!="") 
　　　　　{ mysel+=selobj[j].value+",";} 
　　　　}
	if(mysel.substr(mysel.length-1,1)==",")
	{ mysel=mysel.substr(0,mysel.length-1); } //去掉最后一个字符
	//alert(str1);
	if(mysel=="") {alert('Please select');return false;}
	arr2=mysel.split(",");
	var c=arr1.concat(arr2);
//========================注明：删除重复功能影响到表单检测，故将此功能暂时屏蔽=================================
	//Array.prototype.delsame = array_delsame; 
	var d=del_same(c);
//========================注明：删除重复功能影响到表单检测，故将此功能暂时屏蔽=================================
	setCookie(lb,d,168);
	//alert(getCookie(lb));
	alert('delete success');
	location.reload();
}		
	
function array_delsame()
{
var a={};
for(var i=0;i<this.length;i++)
{
if(typeof a[this[i]]=="undefined"){
a[this[i]]=1;
}else{
a[this[i]]=0;
}

}
this.length=0;
	for(var i in a){
		if (a[i]==1)
		{this[this.length]=i;}
	}
return this;	
}


//==================搜索页的收藏信息ajax部分=========================
function get_sel()  //获取被选择的编号
{
	var selobj=document.getElementsByName('compareBox');
	var mysel="";
	for ( j =0 ; j <selobj.length; j++ ) 
	　　　　{ 
	　　　　　if ( selobj[j].checked && selobj[j].value!="") 
	　　　　　{ 
				mysel+=selobj[j].value+",";
	　　　　　} 
	　　　　}
	if(mysel.substr(mysel.length-1,1)==",")
	{ mysel=mysel.substr(0,mysel.length-1); } //去掉最后一个字符
return mysel;		
}



function qiugou_save_msg(id) //求购收藏信息
{
var tmp;
if(id!=null)
{ tmp=id;}
else
{ tmp=get_sel(); }
if(tmp=="") {alert('You do not choose to collection of objects'); return false;}

var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
ajax.post("/search/cmdall.asp?act=gqsave&compareBox="+ tmp,'',function(obj) { alert(obj.responseText);clear_sel('form8','compareBox');});
}

function dlhz_save_msg(id) //代理合作信息
{
var tmp;
if(id!=null)
{ tmp=id;}
else
{ tmp=get_sel(); }
if(tmp=="") {alert('You are not choose to be collectors items'); return false;}

var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
ajax.post("/search/cmdall.asp?submit=收藏信息&lx=dlhz&compareBox="+ tmp,'',function(obj) { alert(obj.responseText);clear_sel('form8','compareBox');});
}

function baojia_save_msg(id) //报价信息
{
var tmp;
if(id!=null)
{ tmp=id;}
else
{ tmp=get_sel(); }
if(tmp=="") {alert('You are not choose to be collectors items'); return false;}

var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
ajax.post("/search/cmdall.asp?submit=收藏信息&&lx=bj&compareBox="+ tmp,'',function(obj) { alert(obj.responseText);clear_sel('form8','compareBox');});
}

function gongying_save_msg(id) //供应收藏信息
{
var tmp;
if(id!=null)
{ tmp=id;}
else
{ tmp=get_sel(); }
if(tmp=="") {alert('You are not choose to be collectors items'); return false;}

var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
//alert(tmp);return false;
ajax.post("/manage/sendprice_sale.asp?submit=scxx&compareBox="+ tmp,'',function(obj) { alert(obj.responseText);clear_sel('form8','compareBox');});
}

function product_save_msg(id) //产品收藏信息
{
var tmp;
if(id!=null)
{ tmp=id;}
else
{ tmp=get_sel(); }
if(tmp=="") {alert('You are not choose to be collectors items'); return false;}

var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
ajax.post("/manage/sendprice.asp?mysubmit=sccp&compareBox="+ tmp,'',function(obj) { alert(obj.responseText);clear_sel('form8','compareBox');});
}

function company_save_msg(id) //收藏公司信息
{
var tmp;
if(id!=null)
{ tmp=id;}
else
{ tmp=get_sel(); }
if(tmp=="") {alert('You are not choose to be collectors items'); return false;}

var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
ajax.post("/search/cmdall.asp?submit=收藏公司&compareBox="+ tmp,'',function(obj) { alert(obj.responseText);clear_sel('form8','compareBox');});
}

function cgs_save_msg(id) //收藏采购商
{
var tmp;
if(id!=null)
{ tmp=id;}
else
{ tmp=get_sel(); }
if(tmp=="") {alert('You are not choose to be collectors items'); return false;}

var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
ajax.post("/search/cmdall.asp?submit=sccgs&compareBox="+ tmp,'',function(obj) { alert(obj.responseText);clear_sel('form8','compareBox');});
}


function cgs_save_msg2(id) //收藏采购商-详细页
{
var tmp;
if(id!=null)
{ tmp=id;}
else
{ tmp=get_sel(); }
if(tmp=="") {ShowAlert('You are not choose to be collectors items'); return false;}

var ajax=new AJAXRequest;
ajax.setcharset("GBK");
ajax.post("/search/cmdall.asp?submit=sccgs&compareBox="+ tmp,'',function(obj) { ShowAlert(obj.responseText);});
}

function oem_save_msg(id) //收藏oem信息
{
var tmp;
if(id!=null)
{ tmp=id;}
else
{ tmp=get_sel(); }
if(tmp=="") {alert('You are not choose to be collectors items'); return false;}

var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
ajax.post("/manage/sendprice_oem.asp?submit=收藏信息&compareBox="+ tmp,'',function(obj) { alert('success');clear_sel('form8','compareBox');});
}

function clear_sel(oform,osel)
{
var formObj=document.getElementById(oform);
    for(var i=0;i<formObj.elements.length;i++)
    {
        var e=formObj.elements[i];
        if(e.type.toUpperCase()=="CHECKBOX" && e.name.toUpperCase()==osel.toUpperCase())
             { e.checked=false;}           
    }
}


//添加为商业伙伴,根据页面id
function add_friend(id)
{
if(id=="") {alert('Parameters lost'); return false;}
var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
ajax.post("/manage/ajax_do.asp?act=add1&id="+ id,'',function(obj) { alert(obj.responseText);});	
}

//添加为商业伙伴,根据会员id
function add_friend2(id)
{
if(id=="") {alert('Parameters lost'); return false;}
var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
ajax.post("/manage/ajax_do.asp?act=add2&id="+ id,'',function(obj) { alert(obj.responseText);});	
}

//举报留言信息，信息id
function jubao(id)
{
if(id=="") {alert('参数丢失!'); return false;}
var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
ajax.post("/manage/ajax_do.asp?act=jubao&id="+ id,'',function(obj) { alert(obj.responseText);});	
}

//添加为商业伙伴,根据会员uid
function add_friend3(id)
{
if(id=="") {alert('Parameters lost'); return false;}
var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
ajax.post("/manage/ajax_do.asp?act=add3&id="+ id,'',function(obj) { alert(obj.responseText);});	
}

//添加为商业伙伴,通用版，包括黑名单等等
function add_friend4(id,relation)
{
if(id=="") {alert('参数丢失!'); return false;}
var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
ajax.post("/manage/ajax_do.asp?act=friend&relation="+ relation +"&id="+ id,'',function(obj) { alert(obj.responseText);});	
}

function loading_text(divid)
{
	if(document.getElementById(divid))
	{
		document.getElementById(divid).innerHTML="Loading...";
	}
}

function QueryString(qs)
{
    var s = location.href;
    s = s.replace("?","?&").split("&");
    var re = "";
    for(i=1;i<s.length;i++)
        if(s[i].indexOf(qs+"=")==0)
            re = s[i].replace(qs+"=","");
    return re;
}

//关键字广告的AJAX展示
function show_key_ad(bpage)
{
if(bpage=="") {alert('Parameters lost');return false; }
page_key=QueryString('keywords');
var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
ajax.onrequeststart=function() {loading_text("loadingDiv");}
ajax.onrequestend=function() { }
ajax.post("/ad/key_ad_show.asp?keywords="+ page_key +"&bpage="+ bpage,"",function(obj) { document.getElementById('loadingDiv').innerHTML=obj.responseText;});
}

//用于详细页的加入询盘篮
function addtobox_special(lb,cid)
{
//lb:  sel_cok供应，pro_cok产品  oem_cokOEM
if(cid=="") {alert('Parameters lost');return false;}
addCookie(lb,cid,168);
//alert(getCookie(lb));

my_sel_cok=getCookie('sel_cok');
my_pro_cok=getCookie('pro_cok');
my_oem_cok=getCookie('oem_cok');
my_buy_cok=getCookie('buy_cok');
my_com_cok=getCookie('com_cok');


	//供应
	if(my_sel_cok=="undefined" || my_sel_cok=="" || typeof(my_sel_cok)=="undefined")
	{ my_sel_cok_num=0; }
	else
		{	
		if(my_sel_cok.substr(my_sel_cok.length-1,1)==",")    { my_sel_cok=my_sel_cok.substr(0,my_sel_cok.length-1); } 
			my_sel_arr=my_sel_cok.split(",");
			my_sel_len=my_sel_arr.length;
			my_sel_cok_num=my_sel_len;
	}
	//alert(my_sel_cok.toString());


	//产品
	if(my_pro_cok=="undefined" || my_pro_cok=="" || typeof(my_pro_cok)=="undefined")
	{ my_pro_cok_num=0; }
	else
	{
		if(my_pro_cok.substr(my_pro_cok.length-1,1)==",")    { my_pro_cok=my_pro_cok.substr(0,my_pro_cok.length-1); } 
	my_pro_arr=my_pro_cok.split(",");
	my_pro_len=my_pro_arr.length;
	my_pro_cok_num=my_pro_len;
	}



	//oem
	if(my_oem_cok=="undefined" || my_oem_cok=="" || typeof(my_oem_cok)=="undefined")
	{ my_oem_cok_num=0; }
	else
	{
		if(my_oem_cok.substr(my_oem_cok.length-1,1)==",")    { my_oem_cok=my_oem_cok.substr(0,my_oem_cok.length-1); } 
	my_oem_arr=my_oem_cok.split(",");
	my_oem_len=my_oem_arr.length;
	my_oem_cok_num=my_oem_len;
	}



	//buy
	if(my_buy_cok=="undefined" || my_buy_cok=="" || typeof(my_buy_cok)=="undefined")
	{ my_buy_cok_num=0; }
	else
	{
		if(my_buy_cok.substr(my_buy_cok.length-1,1)==",")    { my_buy_cok=my_buy_cok.substr(0,my_buy_cok.length-1); } 
	my_buy_arr=my_buy_cok.split(",");
	my_buy_len=my_buy_arr.length;
	my_buy_cok_num=my_buy_len;
	}


	//com
	if(my_com_cok=="undefined" || my_com_cok=="" || typeof(my_com_cok)=="undefined")
	{ my_com_cok_num=0; }
	else
	{
		if(my_com_cok.substr(my_com_cok.length-1,1)==",")    { my_com_cok=my_com_cok.substr(0,my_com_cok.length-1); } 
	my_com_arr=my_com_cok.split(",");
	my_com_len=my_com_arr.length;
	my_com_cok_num=my_com_len;
	}


//获得总和
var cok_total=parseInt(my_sel_cok_num) + parseInt(my_pro_cok_num) + parseInt(my_oem_cok_num)+ parseInt(my_buy_cok_num) + parseInt(my_com_cok_num);
document.getElementById('cok_num').innerHTML=cok_total;
alert('Successfully joined the Inquiry basket');
}

//==========供应详细页的AJAX显示==============
//获取页面id值
function getidString()
{
    var s = location.href;
	begin=s.indexOf("offerdetail/")+12; end=s.indexOf(".html"); charlen=end-begin;
	re	= s.substr(begin,charlen);
    return re;
}

function trade_detail_info()
{
var info_id=parseInt(getidString());
var ajax4=new AJAXRequest;
//ajax4.setcharset("GBK");
ajax4.onrequeststart=function() {loading_text("motorola");}
ajax4.onrequestend=function() { }
ajax4.post("/makeclass/show_page_girld.asp?id="+ info_id,"",function(obj) {document.getElementById('motorola').innerHTML=obj.responseText;});
}

//求购详细页的联系方式的显示
function trade_detail_contact()
{
var info_id=parseInt(getidString());
var ajax=new AJAXRequest;
ajax.onrequeststart=function() {loading_text("trade_detail_contact");}
ajax.onrequestend=function() { }
ajax.post("/tradeinfo/detail_aa.asp?act=contact&id="+ info_id,"",function(obj) {document.getElementById('trade_detail_contact').innerHTML=obj.responseText;});
}

//求购详细页产品参数的显示
function gq_content_div()
{
var info_id=parseInt(getidString());
var ajax=new AJAXRequest;
ajax.onrequeststart=function() {loading_text("gq_content_div");}
ajax.onrequestend=function() { }
ajax.post("/tradeinfo/detail_aa.asp?act=data&id="+ info_id,"",function(obj) {document.getElementById('gq_content_div').innerHTML=obj.responseText;});
}

//求购页，该类别相关求购显示
function related_gq_div()
{
var info_id=parseInt(getidString());
var ajax=new AJAXRequest;
ajax.onrequeststart=function() {loading_text("related_gq_div");}
ajax.onrequestend=function() { }
ajax.post("/tradeinfo/detail_aa.asp?act=related&id="+ info_id,"",function(obj) {document.getElementById('related_gq_div').innerHTML=obj.responseText;});		
}
//求购页,认证文字的显示
function trade_renzhen_div()
{
var info_id=parseInt(getidString());
var ajax=new AJAXRequest;
ajax.onrequeststart=function() {loading_text("trade_renzhen_div");}
ajax.onrequestend=function() { }
ajax.post("/tradeinfo/detail_aa.asp?act=renzhen&id="+ info_id,"",function(obj) {document.getElementById('trade_renzhen_div').innerHTML=obj.responseText;});	
}

//求购页头部，该公司的其他求购信息
function trade_page_nav()
{
var info_id=parseInt(getidString());
var ajax=new AJAXRequest;
ajax.onrequeststart=function() {loading_text("trade_page_nav");}
ajax.onrequestend=function() { }
ajax.post("/tradeinfo/detail_aa.asp?act=pagenav&id="+ info_id,"",function(obj) {document.getElementById('trade_page_nav').innerHTML=obj.responseText;});		
}

function sell_detail_info()
{
var info_id=parseInt(getidString());
var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
ajax.onrequeststart=function() {loading_text("sell_about_div");}
ajax.onrequestend=function() { }
ajax.post("/makeclass/detail_ajax.asp?act=1&id="+ info_id,"",function(obj) { document.getElementById('sell_about_div').innerHTML=obj.responseText;});	

var ajax2=new AJAXRequest;
//ajax2.setcharset("GBK");
ajax2.onrequeststart=function() {loading_text("sell_contact_div");}
ajax2.onrequestend=function() { }
ajax2.post("/makeclass/detail_ajax.asp?act=2&id="+ info_id,"",function(obj) { document.getElementById('sell_contact_div').innerHTML=obj.responseText;});	

var ajax3=new AJAXRequest;
//ajax3.setcharset("GBK");
ajax3.onrequeststart=function() {loading_text("sell_online_div");}
ajax3.onrequestend=function() { }
ajax3.post("/makeclass/detail_ajax.asp?act=3&id="+ info_id,"",function(obj) { document.getElementById('sell_online_div').innerHTML=obj.responseText;});	

var ajax4=new AJAXRequest;
//ajax4.setcharset("GBK");
ajax4.onrequeststart=function() {loading_text("motorola");}
ajax4.onrequestend=function() { }
ajax4.post("/makeclass/show_page_girld.asp?id="+ info_id,"",function(obj) {document.getElementById('motorola').innerHTML=obj.responseText;});

}

function pro_detail_info()
{
var info_id=parseInt(getidString());
var ajax=new AJAXRequest;
//ajax.setcharset("GBK");
ajax.onrequeststart=function() {loading_text("sell_about_div");}
ajax.onrequestend=function() { }
ajax.post("/makeclass/detail_ajax.asp?act=4&id="+ info_id,"",function(obj) { document.getElementById('sell_about_div').innerHTML=obj.responseText;});	
var ajax2=new AJAXRequest;
//ajax2.setcharset("GBK");
ajax2.onrequeststart=function() {loading_text("sell_contact_div");}
ajax2.onrequestend=function() { }
ajax2.post("/makeclass/detail_ajax.asp?act=5&id="+ info_id,"",function(obj) { document.getElementById('sell_contact_div').innerHTML=obj.responseText;});	
var ajax3=new AJAXRequest;
//ajax3.setcharset("GBK");
ajax3.onrequeststart=function() {loading_text("sell_online_div");}
ajax3.onrequestend=function() { }
ajax3.post("/makeclass/detail_ajax.asp?act=6&id="+ info_id,"",function(obj) { document.getElementById('sell_online_div').innerHTML=obj.responseText;});	

var ajax4=new AJAXRequest;
//ajax4.setcharset("GBK");
ajax4.onrequeststart=function() {loading_text("motorola");}
ajax4.onrequestend=function() { }
ajax4.post("/makeclass/show_page_girld.asp?act=pro&id="+ info_id,"",function(obj) {document.getElementById('motorola').innerHTML=obj.responseText;});
}

function vipcom_logo(myuid)
{
var ajax=new AJAXRequest;
ajax.onrequeststart=function() {loading_text("web_level");}
ajax.post("/vipcom/ajax_show.asp?act=logo&id="+myuid,"",function(obj) { document.getElementById('web_level').innerHTML=obj.responseText;
returnLangue(getCookie('langue'));																							});
vipcom_menulan(myuid);
}

/*function vipcom_menulan(myuid)
{
var ajax=new AJAXRequest;
var web_top_bottom=document.getElementById('web_top_bottom').innerHTML;	
web_top_bottom = web_top_bottom.replace(/<\/UL>/ig,"");  //</ul>	
ajax.post("/vipcom/ajax_show.asp?act=language&id="+myuid,"",function(obj) { var new_str=web_top_bottom+obj.responseText+'</UL>';document.getElementById('web_top_bottom').innerHTML=new_str;
																																						
});	
}*/
function vipcom_menulan(myuid)
{
var ajax=new AJAXRequest;
var web_top_bottom=document.getElementById('web_top_bottom').innerHTML;	
web_top_bottom = web_top_bottom.replace(/<\/UL>/ig,"");  //</ul>	
ajax.post("/vipcom/ajax_show.asp?act=language&id="+myuid,"",function(obj) { var new_str=web_top_bottom+'<li>'+obj.responseText+'</li></UL>';document.getElementById('web_top_bottom').innerHTML=new_str;																																						
});

/*var ajax=new AJAXRequest;
var returnChinese=document.getElementById('returnChinese').innerHTML;	
returnChinese = returnChinese.replace(/<\/UL>/ig,"");  //</ul>	
ajax.post("/vipcom/ajax_show.asp?act=language&id="+myuid,"",function(obj) { var new_strs=returnChinese+obj.responseText+'&nbsp;';document.getElementById('returnChinese').innerHTML=new_strs;
});*/
}
function vipcom_mainpro(myuid)
{
var ajax=new AJAXRequest;
var en_company_name=document.getElementById('web_company_name_english').innerText;
ajax.onrequeststart=function() {loading_text("web_company_name_english");}
ajax.post("/vipcom/ajax_show.asp?act=mainpro&id="+myuid,"",function(obj) { document.getElementById('web_company_name_english').innerHTML=en_company_name+obj.responseText;returnLangue(getCookie('langue'));
});
}

function vipcom_cpfl(myuid)
{
var ajax=new AJAXRequest;
ajax.onrequeststart=function() {loading_text("cpfl");}
ajax.post("/vipcom/ajax_show.asp?act=cpfl&id="+myuid,"",function(obj) { document.getElementById('cpfl').innerHTML=obj.responseText;returnLangue(getCookie('langue'));});
}

function vipcom_honor(myuid)
{
var ajax=new AJAXRequest;
ajax.onrequeststart=function() {loading_text("honor");}
ajax.post("/vipcom/ajax_show.asp?act=honor&id="+myuid,"",function(obj) { document.getElementById('honor').innerHTML=obj.responseText;returnLangue(getCookie('langue'))});
}

function vipcom_contact(myuid)
{
var ajax=new AJAXRequest;
ajax.onrequeststart=function() {loading_text("honor");}
ajax.post("/vipcom/ajax_show.asp?act=contact&id="+myuid,"",function(obj) { document.getElementById('contact').innerHTML=obj.responseText;returnLangue(getCookie('langue'));});
}

function vipcom_cert(myuid)
{
var ajax=new AJAXRequest;
ajax.onrequeststart=function() {loading_text("cert");}
ajax.post("/vipcom/ajax_show.asp?act=cert&id="+myuid,"",function(obj) { document.getElementById('cert').innerHTML=obj.responseText;returnLangue(getCookie('langue'));});
}

//会员中心调用查看详细采购商联信息
function alert_contact(myuid)
{
	if (document.getElementById('alert_tr_'+myuid).style.display=='none'){
		var ajax=new AJAXRequest;
		ajax.onrequeststart=function() {}
		ajax.post("/cnmanage/modify_fenlei.asp?act=cgs_contact&id="+myuid,"",function(obj) {document.getElementById('cgs_k_'+myuid).src='/skins_en/image/-.gif';document.getElementById('alert_tr_'+myuid).style.display='block';document.getElementById('alert_mtr_'+myuid).style.background="#C9D8F3";document.getElementById('alert_'+myuid).innerHTML=obj.responseText;});
	}else{
		document.getElementById('cgs_k_'+myuid).src='/skins_en/image/+.gif';
		document.getElementById('alert_tr_'+myuid).style.display='none';
		document.getElementById('alert_mtr_'+myuid).style.background="FDFEFF";
	}
}

//用户删除联系采购商备注
function alert_contact_del(myuid)
{
var ajax=new AJAXRequest;
ajax.post("/cnmanage/modify_fenlei.asp?act=cgs_contact_del&id="+myuid,"",function(obj) {alert(obj.responseText);location.reload();});
}

//(英文)会员中心调用查看详细采购商联信息
function en_alert_contact(myuid)
{
	if (document.getElementById('alert_tr_'+myuid).style.display=='none'){
		var ajax=new AJAXRequest;
		ajax.onrequeststart=function() {}
		ajax.post("/manage/modify_fenlei.asp?act=cgs_contact&id="+myuid,"",function(obj) {document.getElementById('cgs_k_'+myuid).src='/skins_en/image/-.gif';document.getElementById('alert_tr_'+myuid).style.display='block';document.getElementById('alert_mtr_'+myuid).style.background="#C9D8F3";document.getElementById('alert_'+myuid).innerHTML=obj.responseText;});
	}else{
		document.getElementById('cgs_k_'+myuid).src='/skins_en/image/+.gif';
		document.getElementById('alert_tr_'+myuid).style.display='none';
		document.getElementById('alert_mtr_'+myuid).style.background="FDFEFF";
	}
}

//(英文)用户删除联系采购商备注
function en_alert_contact_del(myuid)
{
var ajax=new AJAXRequest;
ajax.post("/manage/modify_fenlei.asp?act=cgs_contact_del&id="+myuid,"",function(obj) {alert(obj.responseText);location.reload();});
}
//显示用户可查看的采购商分类
function user_cgs()
{
var ajax=new AJAXRequest;
ajax.post("/cginfo/user_cgs.asp","",function(obj) { document.getElementById('user_cgs').innerHTML=obj.responseText;});
}

//用于显示所有或部分分类
function view_more_fl(cn)
{
        if (document.getElementById(cn).style.display == "block") {
            document.getElementById(cn).style.display = "none";
			document.getElementById('flfont').innerHTML="View all";
			document.getElementById('openericon').src='/manage/image/jia.gif';
        } else {
            document.getElementById(cn).style.display = "block";
			document.getElementById('flfont').innerHTML="View less";
			document.getElementById('openericon').src='/manage/image/jian.gif';
        }
}


function view_use_jifen(info_id,zhifu_score)
{
var ajax=new AJAXRequest;	
ajax.post("/tradeinfo/view_use_jifen.asp?id="+info_id,"",function(obj) { alert('You have '+zhifu_score+' points support the success of the visit of the buyer contact information');parent.location.reload();});
}

function check_vip_msg()
{
	if(document.getElementById('cfaid').value=="")
	{alert('Login first');return false;}
	if(document.getElementById('cjieid').value=="")
	{alert('Wrong');return false;}
	if (document.getElementById('cjieid').value==document.getElementById('cfaid').value)
	{alert('Please send message to yourself.');return false;}
	if(document.getElementById('biaoti').value=="")
	{alert('Enter title please');return false;}
	if(document.getElementById('neirong').value=="")
	{alert('Enter content please.');return false;}
	return true;
}

function show_more_oem_gys(id)
{
	if(document.getElementById('fly_'+id).style.display=='none')	{
		document.getElementById('fly_'+id).style.display='inline';
		document.getElementById('a_'+id).innerHTML='View Less';	
		}
	else{
		document.getElementById('fly_'+id).style.display='none';
		document.getElementById('a_'+id).innerHTML='View More..';	
		}
}

function mulu_collect_save(id)
{
var tmp;
if(id!=null)
{ tmp=id;}
else
{ tmp=get_sel(); }
if(tmp=="") {alert('Select First'); return false;}
var ajax=new AJAXRequest;
ajax.setcharset("UTF-8");
var dourl="/manage/ajax_do.asp?act=save_ebook&id="+ tmp;
ajax.post(dourl,'',function(obj) { alert(obj.responseText);});		
	
}