function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; 
  if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; 
	n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) 
	  x=d.all[n]; 
  for (i=0;!x&&i<d.forms.length;i++) 
	  x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) 
	  x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) 
	  x=document.getElementById(n); 
  return x;
}///////////////
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
	  if ((obj=MM_findObj(args[i]))!=null) { 
		v=args[i+2];
        if (obj.style) {
			obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
      obj.visibility=v; }
}/////////////////

function MM_Click(obj,id){
var lia = document.getElementById("cpflist").getElementsByTagName("li");
var lialen = lia.length;
for(i=0; i<lialen; i++){
   if(lia[i].getElementsByTagName("a")[0].className=="tab_on")
   lia[i].getElementsByTagName("a")[0].className ="";
}
obj.className = "tab_on";
for (var i =1,j; j=document.getElementById("mydiv_"+i); i++){
   j.style.display="none";
}
document.getElementById("mydiv_"+id).style.display="block";
}///////////////
function   changeselect1(sub1){   
    document.forma.s3.length=0;   
    document.forma.s3.options[0]=new   Option('二级分类','0');   
    for(i=0;i<subval.length;i++)   
    {   
      if(subval[i][0]==sub1)   
      {   
          document.forma.s3.options[document.forma.s3.length]=new   Option(subval[i][1],subval[i][2]);   
      }   
    }
	showadsearch_cs(sub1);
}////////////////////
function   changeselect2(sub1){   
    document.form2.s2.length=0;   
    document.form2.s2.options[0]=new   Option('二级分类','0');   
    for(i=0;i<subval.length;i++)   
    {   
      if(subval[i][0]==sub1)   
      {   
          document.form2.s2.options[document.form2.s2.length]=new   Option(subval[i][1],subval[i][2]);   
      }   
    } 
	//ajax
	showadsearch_cs(sub1);
}//////////////// 
function   changeselect3(sub1){   
    document.regform.s1.length=0;   
    document.regform.s1.options[0]=new   Option('二级分类','0');   
    for(i=0;i<subval.length;i++)   
    {   
      if(subval[i][0]==sub1)   
      {   
          document.regform.s1.options[document.regform.s1.length]=new   Option(subval[i][1],subval[i][2]);   
      }   
    }
}////////////////////

var xmlHttp

function showadsearch_cs(str){ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null){
  alert ("您的浏览器不支持AJAX！");
  return;
} 
var url="getadsearch_cs.asp";
url=url+"?q="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}/////////////////

function stateChanged(){ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("adsearch_cs").style.display="block";
document.getElementById("adsearch_cs").innerHTML=xmlHttp.responseText;
}
}////////////////
function GetXmlHttpObject(){
/*var xmlHttp=null;
try
  {
  // Internet Explorer
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
catch (e)
  {
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }*/
if (window.ActiveXObject) {
	xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}else if (window.XMLHttpRequest) {
	xmlHttp = new XMLHttpRequest();
 }
return xmlHttp;
}///////////////
function bb_view(index){
	var i,find;
	i=index;
	if (bbarray[i][2]>=0)
	{
		document.getElementById("kuchun").innerHTML=bbarray[i][2];
		document.getElementById("a_kucun").href="pr_get_branch_stock.asp?sn="+bbarray[i][6];
	}
	for (j=0;j<bbarray.length;j++ )
	{
		if (j==i)
		  document.getElementById(j).className="on";
		else
		  document.getElementById(j).className="";
	}
	hw_sn=bbarray[i][6].slice(0,9);
	/////显示图片
	for (n=1;n<13 ;n++ ){
		if (n<10){n="0"+n;}
		sn=hw_sn+n;
		obj=document.getElementById(sn);
		if (obj){
			if (bbarray[i][6]==sn){
				document.getElementById("noimg").style.display="none";
				obj.style.display="block";
				find="yes"
			}else{
				obj.style.display="none";
			 }
		}
		if (find!="yes"){
			document.getElementById("noimg").style.display="block";
		}
	}
	////显示版本参数
	for (n=1;n<13 ;n++ ){
		if (n<10){n="0"+n;}
		sn=hw_sn+n;
		tasn="ta"+hw_sn+n;
		obj=document.getElementById(tasn);
		if (obj){
			if (bbarray[i][6]==sn){
				obj.style.display="block";
			}else{
				obj.style.display="none";
			 }
		}
	}
	document.getElementById("bbsn").innerHTML=bbarray[i][6];
	//document.getElementById("bbcs1").innerHTML=bbarray[i][7];
	document.fm2.action="basket.asp?bb_id="+bbarray[i][5]+"";
	document.getElementById("bbid").value=bbarray[i][5];
	document.getElementById("jifen").innerHTML=bbarray[i][3];
	document.getElementById("p1").innerHTML=bbarray[i][0];
	document.getElementById("p2").innerHTML=bbarray[i][1];
	if (bbarray[i][1]==""){
		//document.getElementById("buy").src="Skin/taobao/buy_no.gif"
		//document.getElementById("buy").disabled=true;
		document.getElementById("buy1").style.display="none";
		document.getElementById("buy2").style.display="block";
		//在线支付document.getElementById("buy_zfb").style.display="none";
		//在线支付document.getElementById("buy_cft").style.display="none";
		//在线支付document.getElementById("buy_bb").style.display="none";
	}else{
		//document.getElementById("buy").disabled=false;
		//document.getElementById("buy").src="Skin/taobao/buy.gif"
		document.getElementById("buy1").style.display="block"
		document.getElementById("buy2").style.display="none";
		//在线支付document.getElementById("buy_zfb").style.display="block";
		//在线支付document.getElementById("buy_cft").style.display="block";
		//在线支付document.getElementById("buy_bb").style.display="block";
	}
	document.getElementById("jiesheng").innerHTML=bbarray[i][0]-bbarray[i][1];
	//在线支付document.getElementById("amount").value=Number(bbarray[i][1])+Number(bbarray[i][8]);
	//在线支付document.getElementById("prices").value=Number(bbarray[i][1])+Number(bbarray[i][8]);
	//在线支付document.getElementById("total_fee").value=(Number(bbarray[i][1])+Number(bbarray[i][8]))*100;
	///显示版本颜色
	var str,ss;
	ss="";
	str=bbarray[i][10].split('/');
	for (i=0;i<str.length ;i++ )
	{
		ss=ss+"<li id=aa"+i+" class='k4' onclick=selectaa(this.id);>"+str[i]+"</li>";
	}
	document.getElementById("tabsulaa").innerHTML=ss;
	$(".k4").hover(function(){$(this).addClass("lion");},function(){$(this).removeClass("lion");});
	document.getElementById('kxab').value=''
	
}///////////////////////
function selectaa(id){
	obj=document.getElementById(id);
	document.getElementById('kxab').value=obj.innerHTML;
	//alert(document.getElementById('kxab').value);
	for (i=0;i<6 ;i++ )
	{
		obj2=document.getElementById('aa'+i)
		if (obj2)
		{
			if (id=='aa'+i)
				obj2.className="on";
			else
				obj2.className="";
		}
	}
}/////////////////////////////////

function   check(){   
    if(document.form2.rad[0].checked==true){
		document.form2.product_id.disabled=false;   
		document.form2.product_id.focus();
    }else{
	    document.form2.product_id.disabled=true;   
     }   
    if(document.form2.rad[1].checked==true){
	    document.form2.tiaom.disabled=false;   
	    document.form2.tiaom.focus();
    }else{
	    document.form2.tiaom.disabled=true;
	 }
}////////////////////////////  

function xx_ka(obja,objb,num){
		for(var id = 0;id<2;id++)
		{
			if(id==num)
			{
				document.getElementById(objb+id).style.display="block";
				document.getElementById(obja+id).className="toc selected";
			}
			else
			{
				document.getElementById(objb+id).style.display="none";
				document.getElementById(obja+id).className="toc";
			}
		}
}///////////////////////
function ckNumber(){
	if ( !(((window.event.keyCode >= 48) && (window.event.keyCode <= 57))|| (window.event.keyCode == 13) || (window.event.keyCode == 46) || (window.event.keyCode == 45)))
	{
		window.event.keyCode = 0 ;
	}
}////////////////
var currentTag = 1;
function fivetag(obj,id){
currentTag=id;
selectMenu(obj);
for (var i =1,j; j=document.getElementById("product_content_"+i); i++){
   j.style.display="none";
}
document.getElementById("product_content_"+id).style.display="block";
currentTag++;
if (currentTag>3)
currentTag=1;
}
function selectMenu(obj){
document.getElementById("i1").className = "toc";
document.getElementById("i2").className = "toc";
document.getElementById("i3").className = "toc";
obj.className = "toc selected";
}
function product_init(){
var menulist = document.getElementById("menulist");
setInterval('fivetag(menulist.getElementsByTagName("li")[currentTag-1].getElementsByTagName("a")[0],currentTag)',10000);//这里设置时间的长短。
}/////////////////////

function getpinpai_search(allpinpai){
	document.getElementById("pinpai_search").innerHTML=allpinpai;
}///////////////////////////////////

function copyURL()
{
window.clipboardData.setData("Text",location.href);
alert("复制成功!您只要粘贴就OK了!");
}////////////////////////////
function showjjxh(){
document.getElementById("spxh").style.display="block";
document.getElementById("spxh_all").innerHTML="";
}//////////////////////////////
function showallxh(ppid,sort,id){
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("您的浏览器不支持AJAX！");
  return;
  } 
var url="ajax_getxh.asp";
url=url+"?ppid="+ppid+"&sort="+sort+"&id="+id;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged_allxh;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}/////////////////////////////////
function stateChanged_allxh(){ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("spxh").style.display="none";
document.getElementById("spxh_all").innerHTML=xmlHttp.responseText;
}
}////////////////

function buycart(bbid,count){
var kxab,kxb;
kxab=document.getElementById("kxab").value;
kxb=document.getElementById("kxb").value;
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("您的浏览器不支持AJAX！");
  return;
  } 
var url="ajax_basket.asp";
url=url+"?bb_id="+bbid+"&count="+count+"&kxab="+kxab+"&kxb="+kxb;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged_cart;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}/////////////////////////////////
function stateChanged_cart(){ 
if (xmlHttp.readyState==4)
{	
	if (xmlHttp.responseText=='noid'){
		alert('提交数据出错，请重新提交！');
	}else{
		document.getElementById("cart").innerHTML=xmlHttp.responseText;
		document.getElementById("cart").style.display="block";
	}
}
}////////////////




function showPCDL_1(){
	document.getElementById("moreItem").style.display = 'block';
	document.getElementById("showMore").style.display = 'none';
	document.getElementById("hiddenMore").style.display = 'block'
}
function hidePCDL_1(){
	document.getElementById("moreItem").style.display = 'none';
	document.getElementById("hiddenMore").style.display = 'none';
	document.getElementById("showMore").style.display = 'block';
}
function  showPCDL_2(){
	document.getElementById("moreBrand").style.display = 'block';
	document.getElementById("showMoreBrand").style.display = 'none';
	document.getElementById("hiddenMoreBrand").style.display = 'block'
}
function hidePCDL_2(){
	document.getElementById("moreBrand").style.display = 'none';
	document.getElementById("hiddenMoreBrand").style.display = 'none';
	document.getElementById("showMoreBrand").style.display = 'block';
}/////////////////////////////////
function changeproductcount(action,bbid,basket_id){
	var n;
	document.getElementById("bbnum").value=bbid;
	document.getElementById("basket_id").value=basket_id;
	n=document.getElementById(bbid).value;
	if (action=="jian")	{
		n=Number(n)-1;
		if (n<1){
			n=1;
		}
		document.getElementById(bbid).value=n;
	}
	if (action=="jia")	{
		document.getElementById(bbid).value=Number(n)+1;
	}
	if (action=="num")	{
		document.getElementById(bbid).value=Number(n);
		document.cart.submit();
	}
	document.cart.submit();

}/////////////////////
function cleardata(obj) {
            var ind = obj.childNodes.length;
            for (var i = ind - 1; i >= 0 ; i--) {
                obj.removeChild(obj.childNodes[i]);
            }
}/////////////////////////////////////

function addresschange(ssq,ssqid,ssqname){
	var quobj;
	if (ssq=='sheng'){
		document.getElementById("shengname").innerHTML=ssqname;
		document.getElementById("shiname").innerHTML='';
		document.getElementById("quname").innerHTML='';
		quobj=document.getElementById("qu");
		cleardata(quobj);

		//document.getElementById("qu").length=0;   
		document.getElementById("qu").options[0]=new Option('请选择','');  
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null){
			 alert ("您的浏览器不支持AJAX！");
			return;
		} 
		var url="ajax_ssq.asp";
		url=url+"?ssq="+ssq+"&ssqid="+ssqid;
		url=url+"&sid="+Math.random();
		xmlHttp.onreadystatechange=function(){stateChanged_ssq(ssq)};
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	} 
	if (ssq=='shi'){
		document.getElementById("shiname").innerHTML=ssqname;
		document.getElementById("quname").innerHTML='';
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null){
			 alert ("您的浏览器不支持AJAX！");
			return;
		} 
		var url="ajax_ssq.asp";
		url=url+"?ssq="+ssq+"&ssqid="+ssqid;
		url=url+"&sid="+Math.random();
		xmlHttp.onreadystatechange=function(){stateChanged_ssq(ssq)};
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);
	}
	if (ssq=='qu'){
		if (ssqname!='请选择'){
			document.getElementById("quname").innerHTML=ssqname;
		}
		else 
			document.getElementById("quname").innerHTML=''
		
	}
	
}///////////
function stateChanged_ssq(ssq){ 

if (xmlHttp.readyState==4){ 
	if (ssq=='shi'){
		document.getElementById("selectqu").innerHTML=xmlHttp.responseText;
	}
	if (ssq=='sheng'){
		document.getElementById("selectshi").innerHTML=xmlHttp.responseText;
	}
}
}////////////////
function addaddress(user_name,id,action){
  xmlHttp=GetXmlHttpObject();
  if (xmlHttp==null){
	alert ("您的浏览器不支持AJAX！");
	return;
  } 
  var url="ajax_addaddress.asp";
  var add_id,name,address,danwei,sheng,shi,qu,postcode,hometel,mobiltel,email;
  if (action=='add' || action=='useraddress' || action=='modify'){
	add_id=id;
	name=document.getElementById("sub_to").value;
	sheng=document.getElementById("sheng").options[document.getElementById("sheng").selectedIndex].text;
	shi=document.getElementById("shi").options[document.getElementById("shi").selectedIndex].text;
	qu=document.getElementById("qu").options[document.getElementById("qu").selectedIndex].text;
	if (qu=='请选择'){
		qu=''
	}
	address=document.getElementById("sub_adds").value;
	danwei=document.getElementById("danwei").value;
	postcode=document.getElementById("sub_post").value;
	hometel=document.getElementById("sub_hometel").value;
	mobiltel=document.getElementById("sub_mtel").value;
	email=document.getElementById("sub_mail").value;
	//alert(user_name+"-"+name+"-"+sheng+"-"+shi+"-"+qu+"-"+address+"-"+danwei+"-"+postcode+"-"+hometel+"-"+mobiltel+"-"+email);
	url=url+"?name="+name+"&sheng="+sheng+"&shi="+shi+"&qu="+qu;
	url=url+"&address="+address+"&danwei="+danwei+"&postcode="+postcode;
	url=url+"&hometel="+hometel+"&mobiltel="+mobiltel+"&email="+email;
	url=url+"&user_name="+user_name+"&action="+action+"&add_id="+add_id;;
	url=url+"&sid="+Math.random();
  }
  if (action=='del' || action=='userdel'){
	add_id=id;
	url=url+"?add_id="+add_id+"&action="+action+"&user_name="+user_name;
  }
  if (action=='change' || action=='userchange'){
	add_id=id;
	url=url+"?add_id="+add_id+"&action="+action;
  }
  if (action=='addnew'){
	url=url+"?action="+action+"&user_name="+user_name;
  }
	xmlHttp.onreadystatechange=function(){stateChanged_address(action)};
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}//////////////////////
function stateChanged_address(action){ 
	if (xmlHttp.readyState==4){ 
		if (action=="add" || action=='del'){
		   if (xmlHttp.responseText=='flase'){	
			  alert('此地址已经存在！');
		   }
		   else if(xmlHttp.responseText=='flase2') {
			  alert('只能设置5个常用地址！');
		   }
		   else{
			  document.getElementById("spareddress").innerHTML=xmlHttp.responseText;
		   }
		}
		if (action=='change' || action=='userchange' || action=='addnew'){
		   document.getElementById("raddress").innerHTML=xmlHttp.responseText;
		}
		if (action=='useraddress'){
		  if (xmlHttp.responseText=='flase'){
			  alert('此地址已经存在！');
		  }
		   else if(xmlHttp.responseText=='flase2') {
			  alert('只能设置5个常用地址！');
		   }
		   else {
		     document.getElementById("shdz").innerHTML=xmlHttp.responseText;
		     document.getElementById("cashb").style.display="none";
		   }
		}
		if (action=='userdel'){
		   document.getElementById("shdz").innerHTML=xmlHttp.responseText;
		}
		if (action=='modify' ){
		   document.getElementById("shdz").innerHTML=xmlHttp.responseText;
		   document.getElementById("cashb").style.display="none";
		}

	}
}////////////////
function check_shortnumber(){
	var tel;
	if (document.shornumberform.user_tel.value=="")
	{
	  alert("手机号码不能为空。");
	  document.shornumberform.user_tel.focus();
	  return false;
	 }
	 if (document.shornumberform.shortnumber.value=="")
	{
	  alert("短号码不能为空。");
	  document.shornumberform.shortnumber.focus();
	  return false;
	 }
	 if (document.shornumberform.user_name.value=="")
	{
	  alert("用户姓名不能为空。");
	  document.shornumberform.user_name.focus();
	  return false;
	 }
}//////////////////////////
function shortnumber2(s){
	var s, ss;											// 声明变量。
	if (s!='' && s.length!=11){
		alert("请输入11位的手机号码！");
	}
	else if(s.length==11){
		ss = s.substr(s.length-4, 4);			// 获取后四位手机号。
		document.shornumberform.shortnumber.value='66'+ss;
	}
}////////////
function changecss(){
	document.getElementById('t_title').style.display='none';
	document.getElementById('t_body').style.display='none';
	document.getElementById('off').style.display='block';
	document.getElementById('shortnumberpage').style.display='block';
	document.getElementById('more').style.display='none';
}//////////////////////////
function addsj(user,id){
	var pp,pinpai;
	document.getElementById("tjcg").innerHTML='';
	pp=document.getElementById("pp").value;
	if (pp=='qt'){
		pinpai=document.getElementById("sypp").value;
	}else{
		pinpai=pp;
	}
	xh=document.getElementById("syjx").value;
	if (xh!='' && pinpai!=''){
	
	  xmlHttp=GetXmlHttpObject();
	  if (xmlHttp==null){
		alert ("您的浏览器不支持AJAX！");
		return;
	  } 
	  var url="ajax_addsj.asp";
	  url=url+"?hw_id="+id+"&user="+user+"&pp="+pinpai+"&syxh="+xh;
	  url=url+"&sid="+Math.random();
	  xmlHttp.onreadystatechange=function(){stateChanged_addsj()};
	  xmlHttp.open("GET",url,true);
	  xmlHttp.send(null);
	}else{
		alert('提交的数据不完整!');
		document.getElementById("syjx").focus();
	}
}////////////////////////////
function stateChanged_addsj(){
	if (xmlHttp.readyState==4){ 
		document.getElementById("tjcg").innerHTML=xmlHttp.responseText;
	}
}/////////////////////
function subqx(subnumber){
  if (confirm("确定要取消订单吗？")){
	if (subnumber!=''){
	  xmlHttp=GetXmlHttpObject();
	  if (xmlHttp==null){
		alert ("您的浏览器不支持AJAX！");
		return;
	  }
	  var url="ajax_kddmanage.asp";
	  url=url+"?subnumber="+subnumber;
	  url=url+"&sid="+Math.random();
	  xmlHttp.onreadystatechange=function(){stateChanged_subqx(subnumber)};
	  xmlHttp.open("GET",url,true);
	  xmlHttp.send(null);
	}else{
		alert('提交的数据不完整!');
		document.getElementById("syjx").focus();
	}
  }
}////////////////////////
function stateChanged_subqx(subnumber){
	if (xmlHttp.responseText=='ok'){
		alert("取消成功");
		document.getElementById(subnumber).innerHTML='----';
	}
}///////////////////////////
function status_kucun(changku){
	xmlHttp=GetXmlHttpObject();
	  if (xmlHttp==null){
		alert ("您的浏览器不支持AJAX！");
		return;
	  }
	  var url="ajax_kcjk.asp";
	  url=url+"?ck="+changku;
	  xmlHttp.onreadystatechange=function(){stateChanged_status_kucun(changku)};
	  xmlHttp.open("GET",url,true);
	  xmlHttp.send(null);
	  //setTimeout(function(){status_kucun(changku);},5000); 
}////////////////////////////

function stateChanged_status_kucun(changku){
	if (xmlHttp.readyState==4){ 
		document.getElementById(changku).innerHTML=xmlHttp.responseText;
		$(".over").hover(function(){$(this).addClass("ulon");},function(){$(this).removeClass("ulon");});
	}
}///////////////////////////////
function liselected(id,obj,namestr){
	$("#"+id+" i").removeClass("j");
	$("#"+id+" li").removeClass("jj");
	obj.className="jj";
	$(".jj i").addClass("j");
	document.getElementById("p1").innerHTML="已选择：";
	if (id=="color-list"){
		document.getElementById("p2").innerHTML=namestr;
		document.getElementById("kxab").value=namestr;
	}
	if (id=="taocan-list"){
		document.getElementById("p3").innerHTML=namestr;
		document.getElementById("kxb").value=namestr;
	}
}/////////////////////////////
function article_commentadd(commenter,content,article_id){
	//alert(commenter+content+article_id);
	var re;
	re=/\n/g;
	content=content.replace(re,"<br>");
	xmlHttp=GetXmlHttpObject();
	  if (xmlHttp==null){
		alert ("您的浏览器不支持AJAX！");
		return;
	  }
	  var url="ajax_article_comment_add.asp";
	  url=url+"?adduser="+commenter+"&content="+content+"&id="+article_id;
	  xmlHttp.onreadystatechange=function(){stateChanged_article_commentadd()};
	  xmlHttp.open("GET",url,true);
	  xmlHttp.send(null);
}///////////////////////////////
function stateChanged_article_commentadd(){
	if (xmlHttp.readyState==4){ 
		if (xmlHttp.status == 200) {
			var li= document.createElement("li");
			var ul = document.getElementById("pl_list");
			ul.appendChild(li);
			document.getElementById("pl_cont").value='';
			$(function(){
				$("#pl_list li:last").hide();
				$("#pl_list li:last").html(xmlHttp.responseText);
				$("#pl_list li:last").css("border","1px solid red");
				$("#pl_list li:last").show("slow")
			});
		}
	}
}////////////////////////////////////////
function reg_check_username(name){
	xmlHttp=GetXmlHttpObject();
	var url="ajax_reg.asp";
	url=url+"?username="+name+"&timeStamp=" + new Date().getTime();
	xmlHttp.onreadystatechange=function(){stateChanged_reg()};
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}//////////////////////////////////////
function stateChanged_reg(){
	if (xmlHttp.readyState==4){
		if (xmlHttp.status==200){
			$(function(){
				if (xmlHttp.responseText=="pass"){
					$("#checkname").html("用户名有效,可以注册");
				}else{
					$("#checkname").html("用户名已被注册");
				}
			});			
		}
	}
}////////////////////////////////////
function hwpinpai(){
	xmlHttp=GetXmlHttpObject();
	var url="ajax_pinpai.asp";
	url=url+"?timeStamp=" + new Date().getTime();
	xmlHttp.onreadystatechange=function(){stateChanged_hwpinpai()};
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}//////////////////////////////////////
function stateChanged_hwpinpai(){
	if (xmlHttp.readyState==4){
		if (xmlHttp.status==200){
			$(function(){
				$("#select_pinpai").html(xmlHttp.responseText);
				$("#select_pinpai").css("display","block");
			});			
		}
	}
}/////////////////////////////////////
function hwcomp(action,hwid){
	$("#comp").css("display","block");
	xmlHttp=GetXmlHttpObject();
	var url="ajax_comp.asp";
	url=url+"?action="+action+"&hw_id="+hwid;
	url=url+"&timeStamp=" + new Date().getTime();
	xmlHttp.onreadystatechange=function(){stateChanged_hwcomp()};
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}//////////////////////////////////////
function stateChanged_hwcomp(){
	if (xmlHttp.readyState==4){
		if (xmlHttp.status==200){
			var str=xmlHttp.responseText;
			if (str=="e1"){
				alert("参数有误！");
			}else if (str=="e2"){
				alert("此产品已存在对比框中！");
			}else if (str=="e3"){
				alert("对比产品的分类必须相同！");
			}else{
				$(function(){
					$("#com2").html(str);
					//$("#select_pinpai").css("display","block");
				});
			}
		}
	}
}/////////////////////////////////////
function bb_select(id,obj,bbsn,namestr) {
	//alert(bbsn);
	xmlHttp=GetXmlHttpObject();
	var url="ajax_bbselect.asp";
	url=url+"?bbsn="+bbsn;
	url=url+"&timeStamp=" + new Date().getTime();
	xmlHttp.onreadystatechange=function(){stateChanged_bbselect(bbsn)};
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
	$("#"+id+" .i1 ul li i").removeClass("select");
	$("#"+id+" .i1 ul li").removeClass("over");
	obj.className="over";
	$(".over i").addClass("select");
	$("#sbn").html("\“"+namestr+"\”");
	//suitPic();//适应图片大小
	
}/////////////////////////////////
function stateChanged_bbselect(bbsn) {
	if (xmlHttp.readyState==4){
		if (xmlHttp.status==200){
			var str=xmlHttp.responseText;
			//alert(str);
			var picstr,parstr;
			str=str.split('*');
			picstr=str[0];
			picstr=picstr.split(',');
			parstr=str[1];
			parstr=parstr.split(',');
			//alert(str[0]);
			//$("#views1 .left img").eq(0).attr({
			//	src:picstr[0],
			//	jqimg:picstr[0]
			//});
			$("#views1 .left .jqzoom").empty();
			$("#views1 .left .jqzoom").append("<img id='ppic' src='"+picstr[0]+"' jqimg='"+picstr[0]+"' onerror='this.src=img/noimage.jpg' />");
			$("#views1 .imglist ul").empty();
			$("#views1 .imglist ul").css("width","610");
			for (n in picstr){
				$("#views1 .imglist ul").append("<li><img src='"+picstr[n]+"' /></li>");
			}
			$("#views1 .imglist ul li").css("float","left");
			$("#views1 .imglist ul li img").bind("mouseover",function(){
				var src=$(this).attr("src");
				$("#views1 .left .jqzoom").empty();
				$("#views1 .left .jqzoom").append("<img id='ppic' src='"+src+"' jqimg='"+src+"' onerror='this.src=img/noimage.jpg' />");
				suitPic();//适应图片大小
				//$("#views1 .left img").eq(0).attr({
				//	src:src,
				//	jqimg:src
				//});
				$(this).css("border","1px solid red");}).bind("mouseout",function(){
				$(this).css({"border":"1px solid #ccc"});
			});
			$("#price1").html(parstr[0]);
			$("#price2").html(parstr[1]);
			$("#price").attr({value:parstr[1]});
			$("#bbsn").html(parstr[2]);
			//$("#morpic a").attr({href:"moreimg.asp?bbsn="+parstr[2]});
			$("#prcs").html(parstr[3]);
			$("#kc").html(parstr[4]);
			$("#bbid").attr({value:parstr[5]});
			suitPic();//适应图片大小
		}
	}
}/////////////////////////////////
function redkucun(bbsn) {
	//alert(bbsn);
	xmlHttp=GetXmlHttpObject();
	var url="ajax_redkc.asp";
	url=url+"?bbsn="+bbsn;
	url=url+"&timeStamp=" + new Date().getTime();
	xmlHttp.onreadystatechange=function(){stateChanged_redkucun()};
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}/////////////////////////////////
function stateChanged_redkucun() {
	if (xmlHttp.readyState==4){
		if (xmlHttp.status==200){
			var str=xmlHttp.responseText;
			$("#kc").html(str);
		}
	}
}/////////////////////////////////
function suitPic() {
        var width   = 0;
        var height  = 0;
        var changed = 0;
        var setwidth = 350; //允许的最大宽度
        var setheight = 350; //允许的最大高度
        var img = document.getElementById('ppic');
		width = img.width;
        height = img.height;
        if (img.width > setwidth) {
			n = img.width / setwidth;
			img.width = setwidth;
			img.height = height / n;
			changed = 1;
		}
		if (img.height > setheight) {
			n = img.height / setheight
			img.width = img.width / n;
			img.height = setheight;
			changed = 1;
		}
		if (changed == 1) {
                        ///
		}
		
	/*	var img = $("#views1 .left .dpic img");
		for (i = 0; i < img.length; i++) {
                width = img[i].width;
                height = img[i].height;
                if (img[i].width > setwidth) {
                        n = img[i].width / setwidth;
                        img[i].width = setwidth;
                        img[i].height = height / n;
                        changed = 1;
                }
                if (img[i].height > setheight) {
                        n = img[i].height / setheight
                        img[i].width = img[i].width / n;
                        img[i].height = setheight;
                        changed = 1;
                }
                if (changed == 1) {
                        ///
                }
        }*/
}///////////////////////
