// JScript 文件


//选择产品类型,设置产品类型价格
function chooseBuyNum(id)
{
	

	var catrSum=0;
	var catrPrice=0;
	var catrNum=0
       
    var basePrice=document.check.strbasePrice.value;
    var strproprice19=document.check.proprice19.value;
    var strproprice20=document.check.proprice20.value;
    var strproprice21=document.check.proprice21.value;
    var strproprice34=document.check.proprice34.value;
    var strproprice35=document.check.proprice35.value;
    var strproprice36=document.check.proprice36.value;
    var strproprice37=document.check.proprice37.value; 
    var strstock=document.check.stock.value; 
    
         basePrice=getFloat(basePrice,2);
        strproprice19=getFloat(strproprice19,2);
        strproprice20=getFloat(strproprice20,2);
        strproprice21=getFloat(strproprice21,2);
        strproprice34=getFloat(strproprice34,2);
        strproprice35=getFloat(strproprice35,2);
        strproprice36=getFloat(strproprice36,2);
        strproprice37=getFloat(strproprice37,2);
       
       catrNum=document.check.BuyNum.value; //document.check.BuyNum.value;
        catrNum=parseInt(catrNum)
        if(catrNum<1){
          catrNum=1;
          document.check.BuyNum.value=1;
        }
             if(catrNum=="."){
          catrNum=1;
          document.check.BuyNum.value=1;
        }
          if(catrNum > strstock){
          document.check.BuyNum.value=strstock;
       
          alert("商品数量最多为"+strstock);
	
	$("BuyNum").focus();
        }
         catrBasePrice=document.getElementById('basePrice').value;

	//alert(BuySum);
	 
         if(basePrice==0){
        //callServerprice(id);              //  selectprice.asp?t=6&id="+p;
        // callServerpricetj(id,catrNum);   // selectprice.asp?t=7&id="+p+"&n="+num;

        }else{

        var  mybasePrice=catrBasePrice;

     
       

    



    var alltotalprice=getFloat(mybasePrice*catrNum,2);




      document.getElementById("pamount_"+id).value=catrNum;
        	

        strbuypeijianprice=  $("buypeijianprice").value;
          
       strtotalprice=parseFloat(getFloat(alltotalprice,2))+parseFloat(getFloat(strbuypeijianprice,2));

       
	$('SumMoney').style.display='';
	$('SumMoney').innerHTML=''+getFloat(alltotalprice,2)+'';
       $('buysummoney').value=getFloat(alltotalprice,2);
        $('buygouwuprice').value=getFloat(alltotalprice,2);  
         $('peijianprice').innerHTML=''+getFloat(strbuypeijianprice,2)+'';
        $('buypeijianprice').value=getFloat(strbuypeijianprice,2);
        $('gouwuprice').innerHTML=''+getFloat(alltotalprice,2)+'';       
         $('allprice').innerHTML=''+getFloat(alltotalprice,2)+'';
        $('buytotalprice').value=getFloat(alltotalprice,2);

        }
        

        
        
	
}

function baseprice(id)
{
  var id;
  callServerprice(id);
}




function basepricelist(id)
{
  var id;
  callServerprice(id);
   
}

function choosegg(pcolorid)
{	
        var  pcolorid,brandsid2

        //  alert(pcolorid);
        var  bd = document.getElementById("brandsid_"+pcolorid).value;
	var strpid=document.getElementById("pid_"+bd+"_strpid").value;
        var id
	var catrBasePrice=0;
        var pprice=0
         var xhpprice=0;
        var strpeijianprice=0;
        var pid=0;
        var catrNum=0;
        id=document.getElementById('id').value;
         pid=pcolorid
         catrNum=document.check.BuyNum.value;

        catrBasePrice=document.getElementById('basePrice').value;
	//设置当成点击为选中
	document.getElementById("gid_"+pcolorid).className='pcolorCurrent';
	//撤消除当前点击以外的选中状态


          strpid=strpid.split("|"); //字符分割 
     
  for (var i=0;i<strpid.length;i++ )   { 

	
		if(strpid[i]!=pcolorid){
			
                      document.getElementById("gid_"+strpid[i]).className='pcolor';
                       
		}
                else{
			document.getElementById("gid_"+strpid[i]).className='pcolorCurrent';
                     

                           // document.check.proprice19.value=strpid[i];

;                     document.getElementById("proprice"+bd).value=strpid[i];

                    
                       document.getElementById("pid_"+bd+"_"+id).value=pid;

                        if(bd==19){

                       callServercolorselect(pid); 
                        }
                       else if(bd==20){

                         callServersizeselect(pid); 

                       }
                       else if(bd==21){

                          callServerxhselect(pid); 
                       }
  

                       else if(bd==34){

                          callServertcselect(pid); 
                       }
  


                       else if(bd==35){

                            callServerpjselect(pid);
                       }
  
                       else if(bd==36){

                          callServerlongselect(pid);
                       }
  
                         else if(bd==37){

                         callServerwidthselect(pid);
                       }
  



                        
                }

               }
//callServerprice(id)
                    
var pricetypeid=bd;               

selectguige(pid,pricetypeid);
	
       }  	
function choosegg20(sizecolorid)
{	
         var  sizecolorid,brandsid3,t3i
        var id
	var catrBasePrice=0;
        id=document.getElementById('id').value;
        var pprice=0
         var xhpprice=0;
        var pid=0;
        var catrNum=0;
        var strpeijianprice=0;
        catrBasePrice=document.getElementById('basePrice').value;
       // callServerbasicprice(id,catrBasePrice);
         pprice=document.getElementById("proprice_3_"+sizecolorid).value;
           catrNum=document.check.BuyNum.value;
         t3i=document.getElementById('pid_3_t3').value;
	var strpid=document.getElementById('pid_3_strpid').value;
	//设置当成点击为选中
	document.getElementById("gid_"+sizecolorid).className='sizecolorCurrent';
	//撤消除当前点击以外的选中状态


	strpid=strpid.split("|"); //字符分割 
     
  for (var i=0;i<strpid.length;i++ )   { 
		if(strpid[i]!=sizecolorid){
			document.getElementById("gid_"+strpid[i]).className='sizecolor';
                       
		}
                else{
			document.getElementById("gid_"+strpid[i]).className='sizecolorCurrent';
                       document.getElementById("pid_3_"+strpid[i]).checked='true';
                      
                     pid=document.getElementById("pid_3_"+strpid[i]).value;
                     brandsid3=document.getElementById('pid_3_brandsID').value;
                       document.getElementById("pid_"+brandsid3+"_"+id).value=pid;

                     callServersizeselect(pid); 

                  
		
	      }

            }

       
                
var pricetypeid=20;               

selectguige(pid,pricetypeid);

	
                       
          }



	
function choosegg21(xinghaocolorid)
{	
         var  xinghaocolorid,brandsid4,t4i
        var id
	var catrBasePrice=0;
        var xhprice=0;
        var pprice=0;
        var strpeijianprice=0;
        var catrNum=0;
        var pid=0;
        id=document.getElementById('id').value;
        catrBasePrice=document.getElementById('strbasePrice').value;
        pprice=document.getElementById('pprice').value;
        //callServerbasicprice(id,catrBasePrice);
           catrNum=document.check.BuyNum.value;
        //  strpeijianprice=document.getElementById("buypeijianprice").value;

         t4i=document.getElementById('pid_4_t4').value;
	var strpid=document.getElementById('pid_4_strpid').value;
	//设置当成点击为选中
	document.getElementById("gid_"+xinghaocolorid).className='xinghaocolorCurrent';
            brandsid4=document.getElementById('pid_4_brandsID').value;
	//撤消除当前点击以外的选中状态
	strpid=strpid.split("|"); //字符分割 
     
  for (var i=0;i<strpid.length;i++ )   { 


		if(strpid[i]!=xinghaocolorid){
			document.getElementById("gid_"+strpid[i]).className='xinghaocolor';
                        
		}
                else{

                       document.getElementById("gid_"+strpid[i]).className='xinghaocolorCurrent';

                   
                      pid=document.getElementById("pid_4_"+strpid[i]).value;  
                      
                      

                        xhprice=document.getElementById("proprice_4_"+strpid[i]).value;
                       document.getElementById("pid_4_"+strpid[i]).checked='true';

                          brandsid4=document.getElementById('pid_4_brandsID').value;
                       document.getElementById("pid_"+brandsid4+"_"+id).value=pid;
                   callServerxhselect(pid); 

                  
                  
                     
            
		}
	}



      var pricetypeid=21;               

selectguige(pid,pricetypeid);            
             


       }  


function choosegg34(tccolorid)
{	
         var  tccolorid,brandsid5,t5i,pid
        var id=0;
	var catrBasePrice=0;
        var pprice=0;
        var xhpprice=0;
        var strpeijianprice=0;
        var catrNum=0;
        id=document.getElementById('id').value;
        var pid=0;
         pprice=document.getElementById("proprice_5_"+tccolorid).value;
         xhprice=document.getElementById('xhprice').value;
           catrNum=document.check.BuyNum.value;
         // strpeijianprice=document.getElementById("buypeijianprice").value;
	//alert(BuySum);
         t5i=document.getElementById('pid_5_t5').value;
         	var strpid=document.getElementById('pid_5_strpid').value;
       
	//设置当成点击为选中
	document.getElementById("gid_"+tccolorid).className='tccolorCurrent';

        brandsid5=document.getElementById('pid_5_brandsID').value;

                    

        
	//撤消除当前点击以外的选中状态
	strpid=strpid.split("|"); //字符分割 
     
  for (var i=0;i<strpid.length;i++ )   { 

		if(strpid[i]!=tccolorid){
			document.getElementById("gid_"+strpid[i]).className='tccolor';
                      
		}
                else{
			

                       document.getElementById("gid_"+strpid[i]).className='tccolorCurrent';
                        pid=document.getElementById("pid_5_"+strpid[i]).value;
                    document.getElementById("pid_5_"+strpid[i]).checked='true';
                       document.getElementById("pricename_5_"+strpid[i]).value='tccolorCurrent';
                          brandsid5=document.getElementById('pid_5_brandsID').value;
                       document.getElementById("pid_"+brandsid5+"_"+id).value=pid;
                    
                       
                      
                   }  

                      // callServerbasicprice(id);
                    // callServerpricetj(id,catrNum);   // selectprice.asp?t=7&id="+p+"&n="+num;
                      // callServerpricetjpjbp(id,pid,catrNum);   // 
                       

                      document.getElementById("pid_"+brandsid5+"_"+id).value=pid;


                       callServertcselect(pid); 
                         
  
                      }
                        
var pricetypeid=34;               

selectguige(pid,pricetypeid);
       }  



function choosegg35(pjcolorid)
{	
         var  pjcolorid,brandsid6
         var  price
         var  strprice
         var  t6i
        var id
         var pprice=0
         var xhpprice=0;
        var strpeijianprice=0;
	var catrBasePrice=0;
        var pid=0;
        id=document.getElementById('id').value;
        catrBasePrice=document.getElementById('basePrice').value;
        //callServerbasicprice(id,catrBasePrice);
      pprice=document.getElementById("proprice_6_"+pjcolorid).value;
       catrNum=document.check.BuyNum.value;
         t6i=document.getElementById('pid_6_t6').value;
        var strpid=document.getElementById('pid_6_strpid').value;
	strprice=document.getElementById('basePrice').value;
	//设置当成点击为选中
	document.getElementById("gid_"+pjcolorid).className='pjcolorCurrent';
	//撤消除当前点击以外的选中状态


	strpid=strpid.split("|"); //字符分割 
     
   for (var i=0;i<strpid.length;i++ )   { 
		if(strpid[i]!=pjcolorid){
			document.getElementById("gid_"+strpid[i]).className='pjcolor';
                       
		}
                else{
			document.getElementById("gid_"+strpid[i]).className='pjcolorCurrent';
                      document.getElementById("pid_6_"+strpid[i]).checked='true';
                      
                      pid=document.getElementById("pid_6_"+strpid[i]).value;
                      brandsid6=document.getElementById('pid_6_brandsID').value;
                       document.getElementById("pid_"+brandsid6+"_"+id).value=pid;

                   callServerpjselect(pid)
		
	      }
	}
       
      
      $('basePrice').value=strprice
     
var pricetypeid=35;               

selectguige(pid,pricetypeid);
       }  
function choosegg36(longcolorid)
{	
         var  longcolorid,brandsid7,t7i
        var id
        var pprice=0
         var xhpprice=0;
        var strpeijianprice=0;
	var catrBasePrice=0;
        id=document.getElementById('id').value;
        var pid=0;
        catrBasePrice=document.getElementById('basePrice').value;
       // callServerbasicprice(id,catrBasePrice);
       pprice=document.getElementById("proprice_7_"+longcolorid).value;
  catrNum=document.check.BuyNum.value;
         t7i=document.getElementById('pid_7_t7').value;
         var strpid=document.getElementById('pid_7_strpid').value;
	//设置当成点击为选中
	document.getElementById("gid_"+longcolorid).className='longcolorCurrent';
	//撤消除当前点击以外的选中状态

	strpid=strpid.split("|"); //字符分割 
     
  for (var i=0;i<strpid.length;i++ )   { 
		if(strpid[i]!=longcolorid){
			document.getElementById("gid_"+strpid[i]).className='longcolor';
                       
		}
                else{
			document.getElementById("gid_"+strpid[i]).className='longcolorCurrent';
                      document.getElementById("pid_7_"+strpid[i]).checked='true';
                      
                      pid=document.getElementById("pid_7_"+strpid[i]).value;
                      brandsid7=document.getElementById('pid_7_brandsID').value;
                       document.getElementById("pid_"+brandsid7+"_"+id).value=pid;

                   callServerlongselect(pid)
		
	      }

            }
       
             
var pricetypeid=36;               

selectguige(pid,pricetypeid);
                       
          }

function choosegg37(widthcolorid)
{	
         var  longcolorid,brandsid8,t8i
        var id
        var pprice=0
         var xhpprice=0;
        var strpeijianprice=0;
	var catrBasePrice=0;
        var pid=0;
        id=document.getElementById('id').value;
        catrBasePrice=document.getElementById('basePrice').value;
       // callServerbasicprice(id,catrBasePrice);
        pprice=document.getElementById("proprice_8_"+widthcolorid).value;
  catrNum=document.check.BuyNum.value;
         t8i=document.getElementById('pid_8_t8').value;
         var strpid=document.getElementById('pid_8_strpid').value;
	//设置当成点击为选中
	document.getElementById("gid_"+widthcolorid).className='widthcolorCurrent';
	//撤消除当前点击以外的选中状态

	strpid=strpid.split("|"); //字符分割 
     
  for (var i=0;i<strpid.length;i++ )   { 
		if(strpid[i]!=widthcolorid){
			document.getElementById("gid_"+strpid[i]).className='widthcolor';
                       
		}
                else{
			document.getElementById("gid_"+strpid[i]).className='widthcolorCurrent';
                       document.getElementById("pid_8_"+strpid[i]).checked='true';
                      
                      pid=document.getElementById("pid_8_"+strpid[i]).value;
                      brandsid8=document.getElementById('pid_8_brandsID').value;
                       document.getElementById("pid_"+brandsid8+"_"+id).value=pid;
                           
                   callServerwidthselect(pid)
		
	      }

            }
       
var pricetypeid=37;               

selectguige(pid,pricetypeid);
                       
          }

function choosekxpj(kxpjid)
{	
       
         var  pprice
         var  price
         var  strprice
         var  pok
         var id
	var catrBasePrice=0;
        var buygouwuprice=0;
        var buypeijianprice=0;
        var buytotalprice=0;
        var buysummoney=0;

       
       // catrBasePrice=$('basePrice').value;

        //callServerbasicprice(id,catrBasePrice);

            


	//设置当成点击为选中
	
	//撤消除当前点击以外的选中状态

                 pok=document.getElementById("pjid_"+kxpjid).checked;
                 //document.getElementById("downname").value;
                 

                if($(pok)!=true) {
                   
                   delpeijian(kxpjid);

                       alert('已经移除！');
                }
                else{


             

                  addpeijian(kxpjid);
                 

                 alert('已经选定！');
            }
                              
                        

	
 }  


function fastaddcart(id)
{	
       
         var  pprice
         var  price
         var  strprice
         var  pok
       
	var catrBasePrice=0;
        var buygouwuprice=0;
        var buypeijianprice=0;
        var buytotalprice=0;
        var buysummoney=0;

       
       // catrBasePrice=document.getElementById('basePrice').value;

        //callServerbasicprice(id,catrBasePrice);
         addtofastcart(id);
          
          alert('已经加入购物车！');        

 }  



function addmycart(id)
{	
         var  addid
         var  pprice
         var  price
         var  strprice
         var  pok
        var id
	var catrBasePrice=0;
        id=$('id').value;
        catrBasePrice=document.getElementById('basePrice').value;
       // callServerbasicprice(id,catrBasePrice);
	callServeraddmycart(id);
       // callServeraddbottomcart(id);
        //mycartlist();
        //  alert('已经加入购物车！');
           
 }  


function chooseown(mpid)
{	
  
        
	var vallprice=0; 
        var vprice=0; 
        var strtotalprice=0;
        var checkedid=0;
        var allpid;
        var chok='false'
       // var  document.getElementById('ownid_'+mpid).checked=true;
 
        //allpid=document.getElementById("pid").value;
            
        vprice=document.getElementById('pidprice_'+mpid).value;
        vallprice=document.getElementById("vallprice").value;
         //checkedid=document.getElementById("checkedpid").value;
         checkedid=mpid;

        
          chok= document.getElementById("ownid_"+mpid).checked;

         // var   pok=("ownid_"+mpid).checked;

          if ((chok)!=true) {

          strtotalprice=parseFloat(getFloat(vallprice,2))-parseFloat(getFloat(vprice,2));
          

          }
      else{
        strtotalprice=parseFloat(getFloat(vallprice,2))+parseFloat(getFloat(vprice,2));
          
          }

       
        
	 document.getElementById("allprice").innerHTML=''+getFloat(strtotalprice,2)+''; 
         document.getElementById("vallprice").value=getFloat(strtotalprice,2);
         document.getElementById("checkedpid").value=chok;
         
           
 }  



function choosediy(mpid,bid)
{	
  
        
	var vallprice=0; 
        var vprice=0; 
        var strtotalprice=0;
        var checkedid=0;
        var allpid;
        var chok='false';
        var cmpid=0;
        var t=0
       // var  document.getElementById('diyid_'+mpid).checked=true;
 
        //allpid=document.getElementById("spid").value;
            
        vprice=document.getElementById('pidprice_'+mpid).value;
        vallprice=document.getElementById("vallprice").value;
         //checkedid=document.getElementById("checkedpid").value;
         checkedid=mpid;

        
          chok= document.getElementById("diyid_"+mpid).checked;

         // var   pok=("diyid_"+mpid).checked;

       
        //strtotalprice=parseFloat(getFloat(vallprice,2))+parseFloat(getFloat(vprice,2));
          cmpid=mpid
          t=1;
         

       
        
	// document.getElementById("allprice").innerHTML=''+getFloat(strtotalprice,2)+''; 
        // document.getElementById("vallprice").value=''+getFloat(strtotalprice,2)+'';
         document.getElementById("spidprice_"+bid).value=getFloat(vprice,2);
         document.getElementById("spidprice_"+bid).innerHTML=''+getFloat(vprice,2)+'';
        document.getElementById("pid_"+bid).value=cmpid;
         document.getElementById("checkedpid").value=chok;
       ajaxdiy(mpid,bid,t);
    
         
           
 } 




function diydel(mpid,bid)
{	
  
        
	var vallprice=0; 
        var vprice=0; 
        var strtotalprice=0;
        var checkedid=0;
        var allpid;
        var chok='false';
        var cmpid=0;
        var t=0
       // var  document.getElementById('diyid_'+mpid).checked=true;
 
        //allpid=document.getElementById("spid").value;
            
        vprice=0;
        vallprice=0;
         //checkedid=document.getElementById("checkedpid").value;
         checkedid=mpid;

        
         // chok= document.getElementById("diyid_"+mpid).checked;

         // var   pok=("diyid_"+mpid).checked;

       
        //strtotalprice=parseFloat(getFloat(vallprice,2))+parseFloat(getFloat(vprice,2));
          cmpid=mpid
          t=0;
         

       
        
	// document.getElementById("allprice").innerHTML=''+getFloat(strtotalprice,2)+''; 
        // document.getElementById("vallprice").value=''+getFloat(strtotalprice,2)+'';
         document.getElementById("spidprice_"+bid).value=0;
         document.getElementById("spidprice_"+bid).innerHTML=0;
        document.getElementById("pid_"+bid).value="";
         document.getElementById("pamount_"+mpid).value=1;
       //  document.getElementById("checkedpid").value=chok;
       ajaxdiy(mpid,bid,t);
    
         
           
 }  

function diyNumberChange(pid)
{	
  pamount=document.getElementById('pamount_'+pid).value;
   nid=pamount;


   ajaxdiynum(pid,nid);
 } 


  var xmlHttp0 = false;
 try {
  xmlHttp0 = new ActiveXObject("Msxml2.XMLHTTP.3.0");
 } catch (e) {
  try {
    xmlHttp0 = new ActiveXObject("Microsoft.XMLHTTP");
 } catch (e2) {
   xmlHttp0 = false;
 }
}
if (!xmlHttp0 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp0 = new XMLHttpRequest();
}

//触发初始商品基本价更新
function callServertcprice(pid) {
  
 var url = "../../selectprice.asp?t=0&id="+pid;

 xmlHttp0.open("GET", url, true);

xmlHttp0.onreadystatechange = updatePagetcprice;
  xmlHttp0.send(null);  
  
}

function updatePagetcprice() {
 if (xmlHttp0.readyState < 4) {
	//document.check.basePrice.value="0";
       
 }
 if (xmlHttp0.readyState == 4) {


   var str = xmlHttp0.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var basePrice=strs[0];
    var strbasePrice=strs[1];

   var allprice=strbasePrice


   // document.check.basePrice.value==20;
   // document.check.strbasePrice.value=strbasePrice;
    SumMoney.innerHTML=allprice;
    allprice.innerHTML=allprice;
    gouwuprice.innerHTML=allprice;
     document.check.buysummoney.value=allprice;
      document.check.buytotalprice.value=allprice;
      document.check.buygouwuprice.value=allprice;
 }
}


//触发初始商品基本价更新
function callServerbasicprice(id) {
  
 var url = "../../selectprice.asp?t=0&id="+id;

 xmlHttp0.open("GET", url, true);

xmlHttp0.onreadystatechange = updatePagebasicprice;
  xmlHttp0.send(null);  
  
}

function updatePagebasicprice() {
 if (xmlHttp0.readyState < 4) {
	document.check.basePrice.value="0";
       
 }
 if (xmlHttp0.readyState == 4) {
   var str = xmlHttp0.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  
    
    var basePrice=strs[0];
    var strbasePrice=strs[1];
    var allprice=strbasePrice
    document.check.basePrice.value=basePrice;
    document.check.strbasePrice.value=strbasePrice;
    SumMoney.innerHTML=allprice;
    allprice.innerHTML=allprice;
    gouwuprice.innerHTML=allprice;
     document.check.buysummoney.value=allprice;
      document.check.buytotalprice.value=allprice;
      document.check.buygouwuprice.value=allprice;
 }
}




var xmlHttp5 = false;
try {
  xmlHttp5 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp5 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp5 = false;
  }
}
if (!xmlHttp5 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp5 = new XMLHttpRequest();
}


//更新套餐选定状态
function callServertcselect(p) {
  
  var url = "../../select.asp?t=4&id="+p;

  xmlHttp5.open("GET", url, true);
  xmlHttp5.onreadystatechange = updatePagetcselect;
  xmlHttp5.send(null);  
  
}

function updatePagetcselect() {
  if (xmlHttp5.readyState < 4) {
	document.getElementById("yixuantaocan").innerHTML="";
  }
  if (xmlHttp5.readyState == 4) {
    

   var str = xmlHttp5.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  

   var selectname=strs[0];
   var selectpic=strs[1];
   var sok=strs[2];
   var sok=parseInt(sok);

  var titleselectname=selectname.replace("+","");  

  var selectpic1="<img src="+selectpic+" border='0'     height='310' width='310'  onload='DrawImage(this,310, 310)'>";

if(selectname!==0){
   document.getElementById("yixuantaocan").innerHTML=selectname;
}
if(sok==1){
   document.getElementById("zhanshipic").innerHTML=selectpic1;
}

  }
}

var xmlHttp2 = false;
try {
  xmlHttp2 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp2 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp2 = false;
  }
}
if (!xmlHttp2 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp2 = new XMLHttpRequest();
}


//更新型号选定状态
function callServerxhselect(p) {
  
  var url = "../../select.asp?t=3&id="+p;

  xmlHttp2.open("GET", url, true);
  xmlHttp2.onreadystatechange = updatePagexhselect;
  xmlHttp2.send(null);  
  
}

function updatePagexhselect() {
  if (xmlHttp2.readyState < 4) {
	document.getElementById("yixuanxinghao").innerHTML="";
  }
  if (xmlHttp2.readyState == 4) {

 var str = xmlHttp2.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  

    var selectname=strs[0];
    var selectpic=strs[1];
    var sok=strs[2];
    var sok=parseInt(sok)

  var titleselectname=selectname.replace("+","");  

selectpic1="<img src="+selectpic+" border='0'     height='310' width='310'  onload='DrawImage(this,310, 310)'>";

if(selectname!==0){
   document.getElementById("yixuanxinghao").innerHTML=selectname;
}
if(sok==1){
 document.getElementById("zhanshipic").innerHTML=selectpic1;
}




  }
}


var xmlHttp3 = false;
try {
  xmlHttp3 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp3 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp3 = false;
  }
}
if (!xmlHttp3 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp3 = new XMLHttpRequest();
}



//价格初始化小计统计
function callServerpricetj(p,num) {
  
  var url = "../../selectprice.asp?t=9&id="+p+"&n="+num;

  xmlHttp3.open("GET", url, true);
  xmlHttp3.onreadystatechange = updatePagepricetj;
  xmlHttp3.send(null);  
  
}

function updatePagepricetj() {
  if (xmlHttp3.readyState < 4) {
	
         SumMoney.innerHTML="价格初始化小计统计";
  }
  if (xmlHttp3.readyState == 4) {
    var response = xmlHttp3.responseText;
    
     SumMoney.innerHTML=response;
    allprice.innerHTML=response;
    gouwuprice.innerHTML=response;
     document.check.buysummoney.value=response;
      document.check.buytotalprice.value=response;
      document.check.buygouwuprice.value=response;
  }
}

var xmlHttp4 = false;
try {
  xmlHttp4 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp4 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp4 = false;
  }
}
if (!xmlHttp4 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp4 = new XMLHttpRequest();
}



//选定官方标配价格综合统计
function  callServerpricetjpjbp(id,pid,num) {
  
  var url = "../../addcarttjpjbp.asp?pid="+pid+"&id="+id+"&n="+num;

  xmlHttp4.open("GET", url, true);
  xmlHttp4.onreadystatechange = updatePagepricetjpjbp;
  xmlHttp4.send(null);  
  
}

function updatePagepricetjpjbp() {
  if (xmlHttp4.readyState < 4) {
	
         allprice.innerHTML="选定官方标配价格综合统计";
  }
  if (xmlHttp4.readyState == 4) {
    var response = xmlHttp4.responseText;
    
    
    allprice.innerHTML=response;
    document.check.buytotalprice.value=response;
    
  }
}



var xmlHttp = false;
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}





function callServer(p) {
  
 var url = "../../loadpropic.asp?id="+p;

 xmlHttp.open("GET", url, true);
 xmlHttp.onreadystatechange = updatePage;
 xmlHttp.send(null);  
  
}

function updatePage() {
 if (xmlHttp.readyState < 4) {
	//zhanshipic.innerHTML="loading...";
 }
 if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
	zhanshipic.innerHTML=response;
 }
}

//价格初始化
function callServerprice(p) {
  
  var url = "../../selectprice.asp?t=6&id="+p;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePageprice;
  xmlHttp.send(null);  
  
}

function updatePageprice() {
  if (xmlHttp.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp.readyState == 4) {
   
  

   var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var strbasePrice=strs[0];
    var strproprice19=strs[1];
    var strproprice20=strs[2];
    var strproprice21=strs[3];
    var strproprice34=strs[4];
    var strproprice35=strs[5];
    var strproprice36=strs[6];
    var strproprice37=strs[7];  
    var strpamount=strs[8]; 
    var strid=strs[9];
    var strstock=strs[10]; 
    var strguigeid=strproprice19+"|"+strproprice20+"|"+strproprice21+"|"+strproprice34+"|"+strproprice35+"|"+strproprice36+"|"+strproprice37; 



    var alltotalprice=getFloat((strbasePrice*strpamount),2);
      
      document.check.basePrice.value=strbasePrice;
      document.check.strbasePrice.value=strbasePrice;
      document.check.pprice.value=strproprice34;
      document.check.xhprice.value=strproprice21;
      document.check.proprice19.value=strproprice19;
      document.check.proprice20.value=strproprice20;
      document.check.proprice21.value=strproprice21;
      document.check.proprice34.value=strproprice34;
      document.check.proprice35.value=strproprice35;
      document.check.proprice36.value=strproprice36;
     document.check.proprice37.value=strproprice37;
     document.check.strguigeid.value=strguigeid;


  if(strproprice19!=0){  
   document.getElementById("gid_"+strproprice19).className = "pcolorCurrent";
   document.getElementById("gid_"+strproprice19).style.cursor = "pointer";
}


  if(strproprice20!=0){  
   document.getElementById("gid_"+strproprice20).className = "pcolorCurrent";
   document.getElementById("gid_"+strproprice20).style.cursor = "pointer";

}


  if(strproprice21!=0){  
   document.getElementById("gid_"+strproprice21).className = "pcolorCurrent";
   document.getElementById("gid_"+strproprice21).style.cursor = "pointer";
}

    if(strproprice34!=0){  
   document.getElementById("gid_"+strproprice34).className = "pcolorCurrent";
   document.getElementById("gid_"+strproprice34).style.cursor = "pointer";

}
  if(strproprice35!=0){  

   document.getElementById("gid_"+strproprice35).className = "pcolorCurrent";
   document.getElementById("gid_"+strproprice35).style.cursor = "pointer";
}

  if(strproprice36!=0){  

   document.getElementById("gid_"+strproprice36).className = "pcolorCurrent";
   document.getElementById("gid_"+strproprice36).style.cursor = "pointer";
}

  if(strproprice37!=0){  
   document.getElementById("gid_"+strproprice37).className = "pcolorCurrent";
   document.getElementById("gid_"+strproprice37).style.cursor = "pointer";
 }


        
     var strprodiscount=1;
     var prodiscount=10;
      var strprice0=document.check.strprice0.value;
     if(strprice0==0){
         prodiscount=10;
         }
       else{
       strprodiscount  =strbasePrice/strprice0;
       strprodiscount=getFloat(strprodiscount,2);
       prodiscount=getFloat(strprodiscount*10,1);
      }


      document.check.buysummoney.value=alltotalprice;
      document.getElementById("pamount_"+strid).value=strpamount;
      document.getElementById("BuyNum").value=strpamount;
      document.getElementById("wholesale").value=strpamount;
      document.getElementById("stock").value=strstock;
      document.getElementById("cartstock").innerHTML='；库存：'+strstock+'件';
      document.getElementById("pstock").innerHTML=''+strstock+'';
      document.getElementById("SumMoney").innerHTML=''+getFloat(alltotalprice,2)+'';
      document.getElementById("gouwuprice").innerHTML=''+getFloat(alltotalprice,2)+'';
      document.getElementById("allprice").innerHTML=''+getFloat(alltotalprice,2)+'';

       document.getElementById("pricepro").innerHTML="<span style='color:#000000;font-weight:bold;font-size: 13pt;height:30px;'>价格：</span><span style='color:#c40000;font-weight:700;font-size: 13pt;height:30px;'>￥"+getFloat(strbasePrice,2)+"</span>";
       document.getElementById("prodiscount").innerHTML="<span style='color:#000000;font-weight:400;font-size: 10pt;height:30px;'>折扣率：</span><span style='color:#c40000;font-weight:400;font-size: 10pt;height:30px;'>"+prodiscount+"折</span>"; 

     //$('gouwuprice').innerHTML=''+getFloat(alltotalprice,2)+'';
    // $('allprice').innerHTML=''+getFloat(alltotalprice,2)+'';

      //document.getElementById("allprice").innerHTML=alltotalprice;
     // document.getElementById("gouwuprice").innerHTML=alltotalprice;
     // document.check.buysummoney.value=response;
     // document.check.buytotalprice.value=response;
     //document.check.buygouwuprice.value=response;


  }
}





var xmlHttp1 = false;
try {
  xmlHttp1 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp1 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp1 = false;
  }
}
if (!xmlHttp1 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp1 = new XMLHttpRequest();
}

//规格选择后价格变化
function selectguige(p,pyid) {

   if(pyid==19){
    var gid19=p;
    var gid20=document.check.proprice20.value;
    var gid21=document.check.proprice21.value;
    var gid34=document.check.proprice34.value;
    var gid35=document.check.proprice35.value;
    var gid36=document.check.proprice36.value;
    var gid37=document.check.proprice37.value; 
    document.check.proprice19.value=p; 

      }
      else if(pyid==20){
    var gid19=document.check.proprice19.value;
    var gid20=p;
    var gid21=document.check.proprice21.value;
    var gid34=document.check.proprice34.value;
    var gid35=document.check.proprice35.value;
    var gid36=document.check.proprice36.value;
    var gid37=document.check.proprice37.value; 
    document.check.proprice20.value=p; 
      }

      else if(pyid==21){

    var gid19=document.check.proprice19.value;
    var gid20=document.check.proprice20.value;
    var gid21=p;
    var gid34=document.check.proprice34.value;
    var gid35=document.check.proprice35.value;
    var gid36=document.check.proprice36.value;
    var gid37=document.check.proprice37.value; 
    document.check.proprice21.value=p; 
      }

      else if(pyid==34){

    var gid19=document.check.proprice19.value;
    var gid20=document.check.proprice20.value;
    var gid21=document.check.proprice21.value;
    var gid34=p;
    var gid35=document.check.proprice35.value;
    var gid36=document.check.proprice36.value;
    var gid37=document.check.proprice37.value; 
    document.check.proprice34.value=p; 
      }
      else if(pyid==35){

    var gid19=document.check.proprice19.value;
    var gid20=document.check.proprice20.value;
    var gid21=document.check.proprice21.value;
    var gid34=document.check.proprice34.value;
    var gid35=p;
    var gid36=document.check.proprice36.value;
    var gid37=document.check.proprice37.value; 
    document.check.proprice35.value=p; 
      }

      else if(pyid==36){

    var gid19=document.check.proprice19.value;
    var gid20=document.check.proprice20.value;
    var gid21=document.check.proprice21.value;
    var gid34=document.check.proprice34.value;
    var gid35=document.check.proprice35.value;
    var gid36=p;
    var gid37=document.check.proprice37.value; 
    document.check.proprice36.value=p; 
      }

      else if(pyid==37){

    var gid19=document.check.proprice19.value;
    var gid20=document.check.proprice20.value;
    var gid21=document.check.proprice21.value;
    var gid34=document.check.proprice34.value;
    var gid35=document.check.proprice35.value;
    var gid36=document.check.proprice36.value;
    var gid37=p; 
    document.check.proprice37.value=p; 

      }

  
  var url = "../../selectprice.asp?t=10&id="+p+"&g19="+gid19+"&g20="+gid20+"&g21="+gid21+"&g34="+gid34+"&g35="+gid35+"&g36="+gid36+"&g37="+gid37;

  xmlHttp1.open("GET", url, true);
  xmlHttp1.onreadystatechange = updateselect;

  xmlHttp1.send(null);  
  
}

function updateselect() {
  if (xmlHttp1.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp1.readyState == 4) {
   
  

   var str = xmlHttp1.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     var basePrice=strs[0];
    var strid=strs[1];
    var strnoid=strs[2];
    var stryesid=strs[3];
    var pid=strs[4];
    var strbpid=strs[5];
    var strstock=strs[6];
    var strwebdir=strs[7];
    var strgifts=strs[8];       
     var strskin=strs[9];   
  }  
    var allstrpid=strnoid+":"+stryesid
  
    var  bd=document.getElementById("brandsid_"+pid).value;

       document.check.strnoid.value=strnoid;
       document.check.stryesid.value=stryesid;
       document.check.strbpid.value=strbpid;
       document.check.allstrpid.value=allstrpid;
       document.check.stock.value=strstock;
       var gid19=document.check.proprice19.value;
       var gid20=document.check.proprice20.value;
       var gid21=document.check.proprice21.value;
       var gid34=document.check.proprice34.value;
       var gid35=document.check.proprice35.value;
       var gid36=document.check.proprice36.value;
       var gid37=document.check.proprice37.value;
  

//myallstrpid(allstrpid);

 //mystryesid(stryesid);
//mystrnoid(strnoid);
//mystrbpid(strbpid);
 
       





       var allstrpid=allstrpid.split(":"); //字符分割  
    


    for (i=0;i<allstrpid.length;i++ )    
  {                  
     document.getElementById("gid_"+allstrpid[i]).className = "pcolor";
     document.getElementById("gid_"+allstrpid[i]).style.cursor = "pointer";
     document.getElementById("gid_"+allstrpid[i]).style.display = "block";
 }






      strnoid =  document.check.strnoid.value;

     //alert(strnoid);

     strnoid=strnoid.split(":"); //字符分割  

 for (j=0;j<strnoid.length;j++ )    
    {    
     

    document.getElementById("gid_"+strnoid[j]).className = "noguige";
   document.getElementById("gid_"+strnoid[j]).style.cursor = "not-allowed";
   document.getElementById("gid_"+strnoid[j]).style.display = "none";

   
   }





 

 //alert(strbpid); 


    
 
       


   
     stryesid =  document.check.stryesid.value;
    
    stryesid=stryesid.split(":"); //字符分割  
    
 for (t=0;t<stryesid.length;t++ )    
  {    
        
    
   
  if(stryesid[t]==gid19){ 
  
   document.getElementById("gid_"+stryesid[t]).className = "pcolorCurrent";
    document.getElementById("gid_"+stryesid[t]).style.display = "block";
    }

 else if(stryesid[t]==gid20){  
  document.getElementById("gid_"+stryesid[t]).className = "pcolorCurrent";
    document.getElementById("gid_"+stryesid[t]).style.display = "block";
    }

  else  if(stryesid[t]==gid21){ 
    document.getElementById("gid_"+stryesid[t]).className = "pcolorCurrent";
    document.getElementById("gid_"+stryesid[t]).style.display = "block";
     }

  else if(stryesid[t]==gid34){  
   document.getElementById("gid_"+stryesid[t]).className = "pcolorCurrent";
    document.getElementById("gid_"+stryesid[t]).style.display = "block";
    }

 else if(stryesid[t]==gid35){  
   document.getElementById("gid_"+stryesid[t]).className = "pcolorCurrent";
    document.getElementById("gid_"+stryesid[t]).style.display = "block";
     }

 else if(stryesid[t]==gid36){  
   document.getElementById("gid_"+stryesid[t]).className = "pcolorCurrent";
    document.getElementById("gid_"+stryesid[t]).style.display = "block";
 
    }

 else if(stryesid[t]==gid37){  
   document.getElementById("gid_"+stryesid[t]).className = "pcolorCurrent";
    document.getElementById("gid_"+stryesid[t]).style.display = "block";
 }

 else{
  document.getElementById("gid_"+stryesid[t]).className = "pcolor";
   document.getElementById("gid_"+stryesid[t]).style.display = "block";
  }
 

  } 

  strbpid =  document.check.strbpid.value;
  

  strbpid=strbpid.split(":"); //字符分割  
 

  for (m=0;m<strbpid.length;m++ )    
  {   
    
       if(strbpid[m]!=pid){ 
     document.getElementById("gid_"+strbpid[m]).className = "pcolor";
       document.getElementById("gid_"+strbpid[m]).style.cursor = "pointer";
      document.getElementById("gid_"+strbpid[m]).style.display = "block";
      
      }
      else
      {
   
       document.getElementById("gid_"+strbpid[m]).className = "pcolorCurrent";
       document.getElementById("gid_"+strbpid[m]).style.cursor = "pointer";
      document.getElementById("gid_"+strbpid[m]).style.display = "block";
       
      }
     }




    document.getElementById("gid_"+pid).className = "pcolorCurrent";
    document.getElementById("gid_"+pid).style.cursor = "pointer";
    document.getElementById("gid_"+pid).style.display = "block";
 






    var strpamount=document.getElementById("pamount_"+strid).value;
    var  basePrice=getFloat(basePrice,2);
         

     var  mybasePrice=0;
     var strprodiscount=1;
     var prodiscount=10;
      var strprice0=document.check.strprice0.value;
     if(strprice0==0){
         prodiscount=10;
         }
       else{
       strprodiscount  =basePrice/strprice0;
       strprodiscount=getFloat(strprodiscount,2);
       prodiscount=getFloat(strprodiscount*10,1);
      }
    var alltotalprice=getFloat(basePrice*strpamount,2);
    //var alltotalprice=mybasePrice;   

      document.check.basePrice.value=basePrice;

      document.check.buysummoney.value=alltotalprice;

      document.getElementById("SumMoney").innerHTML=''+getFloat(alltotalprice,2)+'';
      document.getElementById("gouwuprice").innerHTML=''+getFloat(alltotalprice,2)+'';
      document.getElementById("allprice").innerHTML=''+getFloat(alltotalprice,2)+'';
      document.getElementById("allprice").innerHTML=''+getFloat(alltotalprice,2)+'';
      document.getElementById("gouwuprice").innerHTML=''+getFloat(alltotalprice,2)+'';
      document.getElementById("pricepro").innerHTML="<span style='color:#000000;font-weight:bold;font-size: 13pt;height:30px;'>价格：</span><span style='color:#c40000;font-weight:bold;font-size: 13pt;height:30px;'>￥"+getFloat(basePrice,2)+"</span>";
     document.getElementById("prodiscount").innerHTML="<span style='color:#000000;font-weight:400;font-size: 10pt;height:30px;'>折扣率：</span><span style='color:#c40000;font-weight:400;font-size: 10pt;height:30px;'>"+prodiscount+"折</span>"; 
      document.getElementById("pstock").innerHTML=''+strstock+'';
      document.getElementById("cartstock").innerHTML='；库存：'+strstock+'件';
      document.getElementById("pstock").innerHTML=''+strstock+''; 

     // document.check.buysummoney.value=response;
     // document.check.buytotalprice.value=response;
     //document.check.buygouwuprice.value=response;



  }
}

//------

function  myallstrpid(allstrpid) {

 //var allstrpid=document.check.allstrpid.value;

   for (i=0;i<allstrpid.length;i++ )   
 
    {
     f1(allstrpid[i])
                
     }
 
}



//------

function  mystrbpid(pid) {

    strbpid =  document.check.strbpid.value;
  
   // alert(strbpid);
   strbpid=strbpid.split(":"); //字符分割  
    
  for (m=0;m<strbpid.length;m++ )    
  {   
   
    if(strbpid[m]==pid){  

    document.getElementById("gid_"+strbpid[m]).onclick=function(){ choosegg(strbpid[m]);}
  document.getElementById("gid_"+strbpid[m]).innerHTML="choosegg("+strbpid[m]+"）;"
   document.getElementById("gid_"+strbpid[m]).className = "pcolorCurrent";
  document.getElementById("gid_"+strbpid[m]).style.cursor = "pointer";



    }
   else{
  document.getElementById("gid_"+strbpid[m]).onclick=function(){ choosegg(strbpid[m]);}
  document.getElementById("gid_"+strbpid[m]).innerHTML="choosegg("+strbpid[m]+"）;"
   document.getElementById("gid_"+strbpid[m]).className = "pcolor";
  document.getElementById("gid_"+strbpid[m]).style.cursor = "pointer";



  
   }

 }

}




//------

function  mystrnoid(strnoid) {
 
for (j=0;j<arguments.length;j++ )    
    {    
     
    document.getElementById("gid_"+arguments[j]).className = "noguige";
   document.getElementById("gid_"+arguments[j]).style.cursor = "not-allowed";
  
  document.getElementById("gid_"+arguments[j]).onclick=function(){}


   //alert(i);
}

}
//-----

function  mystryesid(pid) {

      var gid19=document.check.proprice19.value;
       var gid20=document.check.proprice20.value;
       var gid21=document.check.proprice21.value;
       var gid34=document.check.proprice34.value;
       var gid35=document.check.proprice35.value;
       var gid36=document.check.proprice36.value;
       var gid37=document.check.proprice37.value;
 
    tstryesid =  document.check.stryesid.value;
    
    
    stryesid=tstryesid.split(":"); //字符分割  
    
 for (t=0;t<stryesid.length;t++ )    
    {    
        
    
  
    
  


   if(stryesid[t]==gid19||stryesid[t]==gid20||stryesid[t]==gid21||stryesid[t]==gid34||stryesid[t]==gid35||stryesid[t]==gid36||stryesid[t]==gid37||stryesid[t]==pid){    
  
    document.getElementById("gid_"+stryesid[t]).className = "pcolorCurrent";
  document.getElementById("gid_"+stryesid[t]).style.cursor = "pointer";
 document.getElementById("gid_"+stryesid[t]).innerHTML="choosegg("+stryesid[t]+"）;"

  
   }

else{

  document.getElementById("gid_"+stryesid[t]).className = "pcolor";
   document.getElementById("gid_"+stryesid[t]).style.cursor = "pointer";
 document.getElementById("gid_"+stryesid[t]).innerHTML="choosegg("+stryesid[t]+"）;"

  }
 

     }


 //alert(tstryesid);
 //alert(j);


  
}

//---------
//加入购物车按钮后购物车商品数量
function cartnum() {
  
  var url = "../../selectprice.asp?t=13";

  xmlHttp1.open("GET", url, true);
  xmlHttp1.onreadystatechange = updatecartnum;
  xmlHttp1.send(null);  
  
}

function updatecartnum() {
  if (xmlHttp1.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp1.readyState == 4) {
   
  

  

  var str = xmlHttp1.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var cartnum=strs[0];
    var cartsum=strs[1];


  var cartnum=getFloat(cartnum,2);
  var cartsum=getFloat(cartsum,2);


  document.getElementById("mycarto").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartm").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartp").innerHTML=''+getFloat(cartsum,2)+'';
    
  }
}

//----

//配件选定价格变化
function addpeijian(p) {
  
  var url = "../../selectprice.asp?t=11&id="+p;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updateaddpeijian;
  xmlHttp.send(null);  
  
}

function updateaddpeijian() {
  if (xmlHttp.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp.readyState == 4) {
   
  

   var str = xmlHttp.responseText;

  var myprice=getFloat(str,2);
  var  strbuygouwuprice =  $("buygouwuprice").value;
  var  strbuypeijianprice=   $("buypeijianprice").value;
  var  strbuysummoney =   $("buysummoney").value;

  strbuypeijianprice=(parseFloat(getFloat(strbuypeijianprice,2))+parseFloat(getFloat(myprice,2))).toFixed(2)

  var alltotalprice=(parseFloat(getFloat(strbuysummoney,2))+parseFloat(getFloat(strbuypeijianprice,2))).toFixed(2)

 $("buypeijianprice").value=getFloat(strbuypeijianprice,2);


  document.getElementById("peijianprice").innerHTML=''+getFloat(strbuypeijianprice,2)+'';
  document.getElementById("allprice").innerHTML=''+getFloat(alltotalprice,2)+'';
     cartnum();
  }
}


//配件删除价格变化
function delpeijian(p) {
  
  var url = "../../selectprice.asp?t=12&id="+p;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatedelpeijian;
  xmlHttp.send(null);  
  
}

function updatedelpeijian() {
  if (xmlHttp.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp.readyState == 4) {
   

   var str = xmlHttp.responseText;
   var myprice=getFloat(str,2);
  var  strbuygouwuprice =  $("buygouwuprice").value;
  var  strbuypeijianprice=   $("buypeijianprice").value;
  var  strbuysummoney =   $("buysummoney").value;

  strbuypeijianprice=(parseFloat(getFloat(strbuypeijianprice,2))-parseFloat(getFloat(myprice,2))).toFixed(2)


  var alltotalprice=(parseFloat(getFloat(strbuysummoney,2))+parseFloat(getFloat(strbuypeijianprice,2))).toFixed(2)

  $("buypeijianprice").value=getFloat(strbuypeijianprice,2);

  document.getElementById("peijianprice").innerHTML=''+getFloat(strbuypeijianprice,2)+'';
  document.getElementById("allprice").innerHTML=''+getFloat(alltotalprice,2)+'';
     cartnum();
  }
}


//快速选购价格变化
function addtofastcart(p) {
  
  var url = "../../selectprice.asp?t=14&id="+p;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updateaddfastcart;
  xmlHttp.send(null);  
  
}

function updateaddfastcart() {
  if (xmlHttp.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp.readyState == 4) {

  

   
 cartnum();
    
  }
  
}



//颜色选择更新图片
function callServercolor(p) {
  
 var url = "../../loadpropic.asp?id="+p;

 xmlHttp0.open("GET", url, true);

  xmlHttp0.onreadystatechange = updatePagecolor;
 xmlHttp0.send(null);  
  
}

function updatePagecolor() {
if (xmlHttp0.readyState < 4) {
	
   document.getElementById("zhanshipic").innerHTML="";
       
 }
 if (xmlHttp0.readyState == 4) {
   var response = xmlHttp0.responseText;
   document.getElementById("zhanshipic").innerHTML=response;
     
 }
}

//颜色选择更新选定状态

function callServercolorselect(p) {
  
  var url = "../../select.asp?t=1&id="+p;

  xmlHttp0.open("GET", url, true);
  xmlHttp0.onreadystatechange = updatePagecolorselect;
  xmlHttp0.send(null);  
  
}

function updatePagecolorselect() {
  if (xmlHttp0.readyState < 4) {
	//document.getElementById("yixuancolor").innerHTML="";
  }
  if (xmlHttp0.readyState == 4) {
  var str = xmlHttp0.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  

   var selectname=strs[0];
    var selectpic=strs[1];
    var sok=strs[2];
   sok=parseInt(sok);
 var titleselectname=selectname.replace("+","");  
 var selectpic1="<img src='"+selectpic+"' border='0'    height='310' width='310'  onload='DrawImage(this,310, 310)'>";

if(selectname!==0){
   document.getElementById("yixuancolor").innerHTML=selectname;
}

if(sok==1){
 document.getElementById("zhanshipic").innerHTML=selectpic1;
}




   
  }
}




//更新尺寸选定状态
function callServersizeselect(p) {
  
  var url = "../../select.asp?t=2&id="+p;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePagesizeselect;
  xmlHttp.send(null);  
  
}

function updatePagesizeselect() {
  if (xmlHttp.readyState < 4) {
	//yixuansize.innerHTML="";
  }
  if (xmlHttp.readyState == 4) {

 var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  

   var selectname=strs[0];
    var selectpic=strs[1];
    var sok=strs[2];
    sok=parseInt(sok);

  var titleselectname=selectname.replace("+","");  

  var selectpic1="<img src="+selectpic+" border='0'     height='310' width='310'  onload='DrawImage(this,310, 310)'>";

if(selectname!==0){
   document.getElementById("yixuansize").innerHTML=selectname;
}
if(sok==1){
 document.getElementById("zhanshipic").innerHTML=selectpic1;
}


  
	
  }
}

//更新配件选定状态
function callServerpjselect(p) {
  
  var url = "../../select.asp?t=5&id="+p;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePagepjselect;
  xmlHttp.send(null);  
  
}

function updatePagepjselect() {
  if (xmlHttp.readyState < 4) {
	//yixuansize.innerHTML="";
  }
  if (xmlHttp.readyState == 4) {

 var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  

   var selectname=strs[0];
    var selectpic=strs[1];
    var sok=strs[2];
    sok=parseInt(sok);

  var titleselectname=selectname.replace("+","");  

  var selectpic1="<img src="+selectpic+" border='0'     height='310' width='310'  onload='DrawImage(this,310, 310)'>";

if(selectname!==0){
   document.getElementById("yixuanpeijian").innerHTML=selectname;
}
if(sok==1){
 document.getElementById("zhanshipic").innerHTML=selectpic1;
}


  
	
  }
}


//更新长度选定状态
var xmlHttp6 = false;
try {
  xmlHttp6 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp6 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp6 = false;
  }
}
if (!xmlHttp6 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp6 = new XMLHttpRequest();
}


function callServerlongselect(p) {
  
  var url = "../../select.asp?t=7&id="+p;

  xmlHttp6.open("GET", url, true);
  xmlHttp6.onreadystatechange = updatePagelongselect;
  xmlHttp6.send(null);  
  
}

function updatePagelongselect() {
  if (xmlHttp6.readyState < 4) {
	//yixuanlong.innerHTML="";
  }
  if (xmlHttp6.readyState == 4) {

var str = xmlHttp6.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  

   var selectname=strs[0];
    var selectpic=strs[1];
    var sok=strs[2];
    sok=parseInt(sok);

  var titleselectname=selectname.replace("+","");  

  var selectpic1="<img src="+selectpic+" border='0'     height='310' width='310'  onload='DrawImage(this,310, 310)'>";

if(selectname!==0){
   document.getElementById("yixuanlong").innerHTML=selectname;
}

if(sok==1){
document.getElementById("zhanshipic").innerHTML=selectpic1;
}



  
	
  }
}


//更新宽度选定状态
function callServerwidthselect(p) {
  
  var url = "../../select.asp?t=8&id="+p;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePagewidthselect;
  xmlHttp.send(null);  
  
}

function updatePagewidthselect() {
  if (xmlHttp.readyState < 4) {
	//yixuanwidth.innerHTML="";
  }
  if (xmlHttp.readyState == 4) {


 var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    	        
  }  

   var selectname=strs[0];
    var selectpic=strs[1];
    var sok=strs[2];
   sok=parseInt(sok);

  var titleselectname=selectname.replace("+","");  

selectpic1="<img src="+selectpic+" border='0'     height='310' width='310'  onload='DrawImage(this,310, 310)'>"

if(selectname!==0){
   document.getElementById("yixuanwidth").innerHTML=selectname;
}
if(sok==1){
 document.getElementById("zhanshipic").innerHTML=selectpic1;
}

  
	
  }
}

//配件选定更新购物车

function callServerkxpjon(kxpjid) {
  
  var url = "../../addcart.asp?id="+kxpjid;

  xmlHttp1.open("GET", url, true);
  //xmlHttp1.onreadystatechange = updatePagekxpjon;
  xmlHttp1.send(null);  
  
}

function updatePagekxpjon() {
  if (xmlHttp1.readyState < 4) {
	mycarto.innerHTML="";
  }
  if (xmlHttp1.readyState == 4) {
    var response = xmlHttp1.responseText;
	mycarto.innerHTML="";
  }
}
//配件删除更新购物车
function callServerkxpjdown(kxpjid) {
  
  var url = "../../delcart.asp?id="+kxpjid;

  xmlHttp1.open("GET", url, true);
  //xmlHttp1.onreadystatechange = updatePagekxpjdown;
  xmlHttp1.send(null);  
  
}

function updatePagekxpjdown() {
  if (xmlHttp1.readyState < 4) {
	mycarto.innerHTML="";
  }
  if (xmlHttp1.readyState == 4) {
    var response = xmlHttp1.responseText;
	mycarto.innerHTML=response;
  }
}


//配件选定统计价格总数





function callServerkxpjontj(kxpjid,g,id) {
  
  var url = "../../addcarttj.asp?pid="+kxpjid+"&g="+g+"&id="+id;

  xmlHttp1.open("GET", url, true);
  xmlHttp1.onreadystatechange = updatePagekxpjontj;
  xmlHttp1.send(null);  
  
}

function updatePagekxpjontj() {
  if (xmlHttp1.readyState < 4) {
	allprice.innerHTML="";
  }
  if (xmlHttp1.readyState == 4) {
    var response = xmlHttp1.responseText;
	allprice.innerHTML=response;
         document.check.buytotalprice.value=response;
  }
}

//配件选定配件统计价格总数


function callServerkxpjontjpj(kxpjid,g) {
  
  var url = "../../addcarttjpj.asp?pid="+kxpjid+"&g="+g;

  xmlHttp2.open("GET", url, true);
  xmlHttp2.onreadystatechange = updatePagekxpjontjpj;
  xmlHttp2.send(null);  
  
}

function updatePagekxpjontjpj() {
  if (xmlHttp2.readyState < 4) {
	peijianprice.innerHTML="";
  }
  if (xmlHttp2.readyState == 4) {
    var response = xmlHttp2.responseText;
	peijianprice.innerHTML=response;
         document.check.buypeijianprice.value=response;
  }
}

//配件删除统计价格总数

function callServerkxpjdowntj(kxpjid,g,id) {
  
  var url = "../../delcarttj.asp?pid="+kxpjid+"&g="+g+"&id="+id;

  xmlHttp1.open("GET", url, true);
  xmlHttp1.onreadystatechange = updatePagekxpjontj;
  xmlHttp1.send(null);  
  
}

function updatePagekxpjontj() {
  if (xmlHttp1.readyState < 4) {
	allprice.innerHTML="";
  }
  if (xmlHttp1.readyState == 4) {
    var response = xmlHttp1.responseText;
	allprice.innerHTML=response;
         document.check.buytotalprice.value=response;
  }
}


var xmlHttp2 = false;
try {
  xmlHttp2 = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp2 = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp2 = false;
  }
}
if (!xmlHttp2 && typeof XMLHttpRequest != 'undefined') {
  xmlHttp2 = new XMLHttpRequest();
}


//配件删除配件统计价格总数


function callServerkxpjdowntjpj(kxpjid,g) {
  
  var url = "../../delcarttjpj.asp?pid="+kxpjid+"&g="+g;

  xmlHttp2.open("GET", url, true);
  xmlHttp2.onreadystatechange = updatePagekxpjontjpj;
  xmlHttp2.send(null);  
  
}

function updatePagekxpjontjpj() {
  if (xmlHttp2.readyState < 4) {
	peijianprice.innerHTML="";
  }
  if (xmlHttp2.readyState == 4) {
    var response = xmlHttp2.responseText;
	peijianprice.innerHTML=response;
         document.check.buypeijianprice.value=response;
  }
}

var xmlHttp = false;
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
  xmlHttp = new XMLHttpRequest();
}


function callServeraddmycart(id) {
  
   var url = "../../addcartok.asp?pid="+id;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePageaddmycart;
  xmlHttp.send(null);  
  
}

function updatePageaddmycart() {
  if (xmlHttp.readyState < 4) {
	 //document.getElementById("topcart").innerHTML="loading...";

  }
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
        document.getElementById("topcart").innerHTML=response;
     
  }
}

function callServeraddbottomcart() {
  
   var url = "../../addcartbottomok.asp";

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePageaddbottomcart;
  xmlHttp.send(null);  
  
}

function updatePageaddbottomcart() {
  if (xmlHttp.readyState < 4) {
	// document.getElementById("bottomrightcart").innerHTML="loading...";

  }
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
       
     document.getElementById("bottomrightcart").innerHTML=response;
  }
}



//商品详细页面加入购物车

function addcart1(pid)
{	
         var  pid
        
    callServeraddcart(pid);
          alert('已经加入购物车！');
           
 }  



function callServeraddcart(pid) {
  
   var url = "../../protoaddcart.asp?pid="+pid;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePageaddtocart;
  xmlHttp.send(null);  
  
}

function updatePageaddtocart() {
  if (xmlHttp.readyState < 4) {
	mycarto.innerHTML="loading...";
  }
  if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;
	mycarto.innerHTML=response;
  }
}


function ajaxdiy(pid,bid,t) {
  
   var url = "../../diycookie.asp?pid="+pid+"&bid="+bid+"&t="+t;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = updatePagediy;
  xmlHttp.send(null);  
  
}

function updatePagediy() {
  if (xmlHttp.readyState < 4) {
	slpid.innerHTML="";
  }
  if (xmlHttp.readyState == 4) {
    var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length ;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var proname=strs[0];
    var proprice=strs[1];
    var bid=strs[2];
     bid=bid.replace(/[ ]/g,""); 
    bid=parseInt(bid)
       
    //var (proname_"+bid)="未选";
  //proname_1.innerHTML="ok";
  //("proname_"+bid)=strs[1];
   
  //proname_"+bid.innerHTML=proname;  
   document.getElementById("proname_"+bid).innerHTML=proname;
   document.getElementById("allprice").innerHTML=proprice;
  }
}


function ajaxdiynum(pid,nid) {
  
   var url = "../../diycookienum.asp?pid="+pid+"&nid="+nid;

  xmlHttp.open("GET", url, true);

  xmlHttp.send(null);  
  
}


function addcart_list(id) {
  
 var url = "../../loadguige.asp?id="+id;

 xmlHttp.open("GET", url, true);
 xmlHttp.onreadystatechange = updatePageaddcart_list;
 xmlHttp.send(null);  
  
}

function updatePageaddcart_list() {
 if (xmlHttp.readyState < 4) {
	//zhanshipic.innerHTML="loading...";
 }
 if (xmlHttp.readyState == 4) {
    var response = xmlHttp.responseText;	
   // document.getElementById("addcartguige"+id).innerHTML=response;
    document.getElementById("addcartguige200").innerHTML=response;
 }
}




//列表按钮直接加入购物车

function tominiaddcart(id) {  
theObj = document.getElementById('miniaddcart'+id).style;  
if (  theObj.display == "none" ) theObj.display = "block"; else theObj.display = "none";
tominiaddcartok(id)
}





function tominiaddcartok(p) {
  
 var url = "../../add_minicart.asp?pid="+p;

 xmlHttp.open("GET", url, true);

  xmlHttp.onreadystatechange = updatetominiaddcartok;
 xmlHttp.send(null);  
  
}

function updatetominiaddcartok() {
if (xmlHttp.readyState < 4) {
	
   
 }
 if (xmlHttp.readyState == 4) {
   var pid = xmlHttp.responseText;
 // pid="200";
   cartnummini(pid);
   document.getElementById('mycartminiok'+pid).innerHTML="加入成功！";
     
 }
}

//加入购物车按钮后购物车商品数量
function cartnummini(pid) {
  
  var url = "../../selectprice.asp?t=13&id="+pid;

  xmlHttp1.open("GET", url, true);
  xmlHttp1.onreadystatechange = updateminicartnum;
  xmlHttp1.send(null);  
  
}

function updateminicartnum() {
  if (xmlHttp1.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp1.readyState == 4) {
   
  

  

  var str = xmlHttp1.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var cartnum=strs[0];
    var cartsum=strs[1];
    var pid=strs[2];

  var cartnum=getFloat(cartnum,2);
  var cartsum=getFloat(cartsum,2);


  document.getElementById("mycarto").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartm").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartp").innerHTML=''+getFloat(cartsum,2)+'';
  document.getElementById("mycartmini"+pid).innerHTML=''+getFloat(cartsum,2)+'元';  
  }
}

function tominiaddcartcose(id) {  
theObj = document.getElementById('miniaddcart'+id).style;  
if (  theObj.display == "block" ) theObj.display = "none"; else theObj.display = "none";
//tominiaddcartok(id)
}
	
//===========================

//商品详细按钮直接加入购物车

function ptominiaddcart(id) {  
theObj = document.getElementById('miniaddcart'+id).style;  
if (  theObj.display == "none" ) theObj.display = "block"; else theObj.display = "none";
ptominiaddcartok(id)
}





function ptominiaddcartok(p) {
  
 var url = "../../add_pminicart.asp?pid="+p;

 xmlHttp.open("GET", url, true);

  xmlHttp.onreadystatechange = updateptominiaddcartok;
 xmlHttp.send(null);  
  
}

function updateptominiaddcartok() {
if (xmlHttp.readyState < 4) {
	
   
 }
 if (xmlHttp.readyState == 4) {
   var pid = xmlHttp.responseText;
 // pid="200";
   pcartnummini(pid);

       var strbasePrice=document.check.strbasePrice.value;
    var strproprice19=document.check.proprice19.value;
    var strproprice20=document.check.proprice20.value;
    var strproprice21=document.check.proprice21.value;
    var strproprice34=document.check.proprice34.value;
    var strproprice35=document.check.proprice35.value;
    var strproprice36=document.check.proprice36.value;
    var strproprice37=document.check.proprice37.value; 
    var strstock=document.check.stock.value; 
    var strpamount=document.getElementById("pamount_"+pid).value; 
 

  var alltotalprice=getFloat((strbasePrice*strpamount),2);







  if(strproprice19!=0){  
   document.getElementById("gid_"+strproprice19).className = "pcolorCurrent";
   document.getElementById("gid_"+strproprice19).style.cursor = "pointer";
}


  if(strproprice20!=0){  
   document.getElementById("gid_"+strproprice20).className = "pcolorCurrent";
   document.getElementById("gid_"+strproprice20).style.cursor = "pointer";

}


  if(strproprice21!=0){  
   document.getElementById("gid_"+strproprice21).className = "pcolorCurrent";
   document.getElementById("gid_"+strproprice21).style.cursor = "pointer";
}

    if(strproprice34!=0){  
   document.getElementById("gid_"+strproprice34).className = "pcolorCurrent";
   document.getElementById("gid_"+strproprice34).style.cursor = "pointer";

}
  if(strproprice35!=0){  

   document.getElementById("gid_"+strproprice35).className = "pcolorCurrent";
   document.getElementById("gid_"+strproprice35).style.cursor = "pointer";
}

  if(strproprice36!=0){  

   document.getElementById("gid_"+strproprice36).className = "pcolorCurrent";
   document.getElementById("gid_"+strproprice36).style.cursor = "pointer";
}

  if(strproprice37!=0){  
   document.getElementById("gid_"+strproprice37).className = "pcolorCurrent";
   document.getElementById("gid_"+strproprice37).style.cursor = "pointer";
 }


  
   if(strstock>0){ 
   document.getElementById('mycartminiok'+pid).innerHTML="加入成功！";
   }

   else{
   document.getElementById('mycartminiok'+pid).innerHTML="库存不足！";
   }


     
 }
}

//加入购物车按钮后购物车商品数量
function pcartnummini(pid) {
  
  var url = "../../selectprice.asp?t=13&id="+pid;

  xmlHttp1.open("GET", url, true);
  xmlHttp1.onreadystatechange = updatepminicartnum;
  xmlHttp1.send(null);  
  
}

function updatepminicartnum() {
  if (xmlHttp1.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp1.readyState == 4) {
   
  

  

  var str = xmlHttp1.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var cartnum=strs[0];
    var cartsum=strs[1];
    var pid=strs[2];

  var cartnum=getFloat(cartnum,2);
  var cartsum=getFloat(cartsum,2);


  document.getElementById("mycarto").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartm").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartp").innerHTML=''+getFloat(cartsum,2)+'';
  document.getElementById("mycartmini"+pid).innerHTML=''+getFloat(cartsum,2)+'元';  
  }
}

function ptominiaddcartcose(id) {  
theObj = document.getElementById('miniaddcart'+id).style;  
if (  theObj.display == "block" ) theObj.display = "none"; else theObj.display = "none";
//tominiaddcartok(id)
}
	
//===========================



//首页分类板块按钮直接加入购物车

function classaddcart(id,classid,f) {  
theObj = document.getElementById('miniaddcart_'+id+'_'+classid+'_'+f).style;  
if (  theObj.display == "none" ) theObj.display = "block"; else theObj.display = "none";
classaddcartok(id,classid,f)
}





function classaddcartok(id,classid,f) {
  
 var url = "../../add_classminicart.asp?pid="+id+"&cid="+classid+"&f="+f;

 xmlHttp.open("GET", url, true);

  xmlHttp.onreadystatechange = updateclassaddcartok;
 xmlHttp.send(null);  
  
}

function updateclassaddcartok() {
if (xmlHttp.readyState < 4) {
	
   
 }
 if (xmlHttp.readyState == 4) {
  // var pid = xmlHttp.responseText;
 // pid="200";
   var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
  }  
   var pid=strs[0];
    var cid=strs[1];
    var f=strs[2];



   classcartnummini(pid,cid,f);
   document.getElementById('mycartminiok_'+pid+'_'+cid+'_'+f).innerHTML="加入成功！";
     
 }
}

//加入购物车按钮后购物车商品数量
function classcartnummini(pid,cid,f) {
  
  var url = "../../selectprice.asp?t=15&id="+pid+"&cid="+cid+"&f="+f;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = classupdateminicartnum;
  xmlHttp.send(null);  
  
}

function classupdateminicartnum() {
  if (xmlHttp.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp.readyState == 4) {
   
  

  

  var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var cartnum=strs[0];
    var cartsum=strs[1];
    var pid=strs[2];
    var cid=strs[3];
    var f=strs[4];
  




   document.getElementById("mycarto").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartm").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartp").innerHTML=''+getFloat(cartsum,2)+'';
  document.getElementById("mycartmini_"+pid+"_"+cid+"_"+f).innerHTML=''+cartsum+'元';  

  }
}

function classaddcartcose(id,classid,f) {  
theObj = document.getElementById('miniaddcart_'+id+'_'+classid+'_'+f).style;  
if (  theObj.display == "block" ) theObj.display = "none"; else theObj.display = "none";
//tominiaddcartok(id)
}

//===========================

//首页属性板块按钮直接加入购物车

function shuxingaddcart(id,re,tp) {  
theObj = document.getElementById('shuxingaddcart_'+id+'_'+re+'_'+tp).style;  
if (  theObj.display == "none" ) theObj.display = "block"; else theObj.display = "none";
shuxingaddcartok(id,re,tp)
}





function shuxingaddcartok(id,re,tp) {
  
 var url = "../../add_shuxingminicart.asp?pid="+id+"&re="+re+"&tp="+tp;

 xmlHttp.open("GET", url, true);

  xmlHttp.onreadystatechange = updateshuxingaddcartok;
 xmlHttp.send(null);  
  
}

function updateshuxingaddcartok() {
if (xmlHttp.readyState < 4) {
	
   
 }
 if (xmlHttp.readyState == 4) {
  // var pid = xmlHttp.responseText;
 // pid="200";
   var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
  }  
   var pid=strs[0];
    var re=strs[1];
    var tp=strs[2];



   shuxingcartnummini(pid,re,tp);
   document.getElementById('shuxingcartminiok_'+pid+'_'+re+'_'+tp).innerHTML="加入成功！";
     
 }
}

//加入购物车按钮后购物车商品数量
function shuxingcartnummini(pid,re,tp) {
  
  var url = "../../selectprice.asp?t=16&id="+pid+"&re="+re+"&tp="+tp;

  xmlHttp.open("GET", url, true);
  xmlHttp.onreadystatechange = shuxingupdateminicartnum;
  xmlHttp.send(null);  
  
}

function shuxingupdateminicartnum() {
  if (xmlHttp.readyState < 4) {
   
  // document.getElementById("basePrice").value="0";
  }

    if (xmlHttp.readyState == 4) {
   
  

  

  var str = xmlHttp.responseText;
    var strs= new Array(); //定义一数组
    strs=str.split("|"); //字符分割      
  for (i=0;i<strs.length;i++ )    
  {    
     // document.write(strs[i]+"<br/>");    //分割后的字符输出
     // $("mm"+i)=strs[i];
    
	
        
  }  
    
    var cartnum=strs[0];
    var cartsum=strs[1];
    var pid=strs[2];
    var re=strs[3];
    var tp=strs[4];
  




   document.getElementById("mycarto").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartm").innerHTML=''+getFloat(cartnum,2)+'';
  document.getElementById("mycartp").innerHTML=''+getFloat(cartsum,2)+'';
  document.getElementById("shuxingcartmini_"+pid+"_"+re+"_"+tp).innerHTML=''+cartsum+'元';  

  }
}

function shuxingaddcartcose(id,re,tp) {  
theObj = document.getElementById('shuxingaddcart_'+id+'_'+re+'_'+tp).style;  
if (  theObj.display == "block" ) theObj.display = "none"; else theObj.display = "none";
//tominiaddcartok(id)
}


function tocomparecart(id) {
  displaycomparecart();
 var url = "../../add_compare.asp?pid="+id;

 xmlHttp.open("GET", url, true);

  xmlHttp.onreadystatechange = updatetocomparecartok;
 xmlHttp.send(null);  
  
}

function updatetocomparecartok() {
if (xmlHttp.readyState < 4) {
	
   
 }
if (xmlHttp.readyState == 4) {
 var strcomparenum = xmlHttp.responseText;
  
   if(strcomparenum!=3){
   
   document.getElementById('comparebody').innerHTML=xmlHttp.responseText;
  }
  else{

   document.getElementById('compareupto').innerHTML="对比内容已经超过4个了";

  }   


 }
}

function emptycomparecart() {
  
 var url = "../../empty_compare.asp";

 xmlHttp.open("GET", url, true);

  xmlHttp.onreadystatechange = updateemptycomparecartok;
 xmlHttp.send(null);  
  
}

function updateemptycomparecartok() {
if (xmlHttp.readyState < 4) {
	
   
 }
 if (xmlHttp.readyState == 4) {
   var pid = xmlHttp.responseText;
 // pid="200";
 
  document.getElementById('comparebody').innerHTML="已经清空！";
     
 }
}


//隐藏对比框

function displaycomparecart() {  
theObj = document.getElementById('comparecart').style;  
if (  theObj.display == "block" ) theObj.display = "block"; else theObj.display = "block";

}
//显示对比框
function hidecomparecart() {  
theObj = document.getElementById('comparecart').style;  
if (  theObj.display == "none" ) theObj.display = "block"; else theObj.display = "none";

}
//关闭网页顶部广告
function topadcose() {  
theObj = document.getElementById('top_ad_').style;  
if (  theObj.display == "block" ) theObj.display = "none"; else theObj.display = "none";

}
//购买商品数量添加减少

function addnum(id)
{
var min=document.check.wholesale.value;
var max=document.check.stock.value;
var pamount=1;
max=parseInt(max);
min=parseInt(min);
pamount=document.check.BuyNum.value;
pamount=parseInt(pamount)+1;
   if (pamount > max){
        alert("商品数量最多为"+max);
	document.check.BuyNum.value=max;
	$("BuyNum").focus();
	
         
	}else{

	document.check.BuyNum.value=pamount;
    }
   chooseBuyNum(id);

}

function reduce(id)
{
var min=document.check.wholesale.value;
var max=document.check.stock.value;
var pamount=1;
pamount=document.check.BuyNum.value;
pamount=parseInt(pamount)-1;


    if (pamount>=min){
	document.check.BuyNum.value=pamount;
	}else{
    alert("商品数量最少为"+min);
	document.check.BuyNum.value=min;
	$("BuyNum").focus();
   }
   chooseBuyNum(id);
}				

//商品详细页开启批量选定规格列表

function openBatchcartinlt(id) { 
 
var theObj = document.getElementById('Batchcartinlt'+id).style;  
if (  theObj.display == "none" ) theObj.display = "block"; else theObj.display = "none";

}
//商品详细页关闭批量选定规格列表
function closeBatchcartinlt(id) {  
var theObj = document.getElementById('Batchcartinlt'+id).style;  
if (  theObj.display == "block" ) theObj.display = "none"; else theObj.display = "block";

}


//商品详细页批量选定规格列表修改库存校验
function changeBatchcartstock(id,pid) {  

  var stock;
  var buy_sum;
  stock=document.getElementById("stock_"+id+"_"+pid).value;
  buy_sum=document.getElementById("buy_sum_"+id+"_"+pid).value;
 if (buy_sum==0){
   
  alert("购买数量不能为0");
   document.getElementById("buy_sum_"+id+"_"+pid).value=1;
   }
   else if (buy_sum>parseInt(stock)){

    alert("购买数量不能超过库存量");
   document.getElementById("buy_sum_"+id+"_"+pid).value=stock;
   
   }



}

//追加订单

function Addorder(goods) {  
theObj = document.getElementById('okorder_'+goods).style;  
if (  theObj.display == "none" ) theObj.display = "block"; else theObj.display = "none";
addorderok(goods)
}





function addorderok(goods) {
  
 var url = "../../../../selectprice.asp?t=17&goods="+goods;

 xmlHttp.open("GET", url, true);

  xmlHttp.onreadystatechange = updateorder;
 xmlHttp.send(null);  
  
}

function updateorder() {
if (xmlHttp.readyState < 4) {
	
   
 }
 if (xmlHttp.readyState == 4) {
   var goods= xmlHttp.responseText;

   
   //document.getElementById('okorder_'+goods).innerHTML="追加成功！";
     
 }
}

//隐藏追加订单成功提示

function Addorderhide(goods) {  
theObj = document.getElementById('okorder_'+goods).style;  
if (  theObj.display == "block" ) theObj.display = "none"; else theObj.display = "block";

}

	
//保留float型参数value小数点后len位
 function getFloat(value,len)
 {
  //如果value为数值型,需要先将value转换成字符串型
  //否则,使用indexOf和substr时会报错
  var str = value.toString();
  
  //若len不为int型,则小数部分将被忽略
  var i = parseInt( len );
  var index = str.indexOf( "." );
  
  var int_length = str.substr(0, index).length;
  
  //value值必须为数值
  if ( isNaN ( str ) )
  {
   alert("数值无效");
   return "";
  }
  
  //精度值必须为数值
  if ( isNaN ( i ) )
  {
   alert("精度值无效.");
   return "";
  }
  
  //精度值不能小于0,允许等于0,等于0返回value的整数部分
  if ( i < 0 )
  {
   alert("精度不应小于0.");
   return "";
  }
  
  //如果value为整数,直接返回;
  if ( index == -1 )
  {
   return str;
  }
  
  var temp_value = 0.0;
  
  //精度等于0返回value的整数部分
  if ( i == 0 )
  {
   return str.substr( 0, int_length);
  }
  //精度大于零返回value值小数点后i位数值,或i大于value小数后位数,则返回整个value
  else
  {
   temp_value = parseFloat( str.substr( 0, int_length + len + 2 ) );
  }
  
  //进行四舍五入动作
  
  //如果value中小数位数<=精度值,则直接返回,不需要做四舍五入处理
  if ( ( str.length - index - 1 ) <= len )
  {
   return temp_value.toString();
  }
  
  var decimal = 0.5;
  //计算
  for ( j = 0; j < i; j++ )
  {
   decimal = decimal / 10;
  }
  return ( temp_value + decimal ).toString().substr( 0, temp_value.toString().length - 1 );
 }







	
