﻿function GetQueryString(name) {
   var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i");
   var r = window.location.search.substr(1).match(reg);
   if (r!=null) return unescape(r[2]); return null;
}


function GetPageSize() 
{  var scrW, scrH;  
	if(window.innerHeight && window.scrollMaxY) 
	{   
		 // Mozilla   
		 scrW = window.innerWidth + window.scrollMaxX; 
		    scrH = window.innerHeight + window.scrollMaxY;  
		    }
		     else if(document.body.scrollHeight > document.body.offsetHeight)
		     	{    // all but IE Mac   
		     		 scrW = document.body.scrollWidth; 
		     		    scrH = document.body.scrollHeight;  
		     		    }
		     		     else if(document.body) 
		     		     	{ // IE Mac  
		     		     		  scrW = document.body.offsetWidth; 
		     		     		     scrH = document.body.offsetHeight; 
		     		     		      }
		     		     		          var winW, winH;  
		     		     		          if(window.innerHeight) 
		     		     		          {
		     		     		          	 // all except IE  
		     		     		          	   winW = window.innerWidth;
		     		     		          	       winH = window.innerHeight;  
		     		     		          	       }
		     		     		          	        else if (document.documentElement     && document.documentElement.clientHeight) 
		     		     		          	        	{ 
		     		     		          	        		   // IE 6 Strict Mode
		     		     		          	        		       winW = document.documentElement.clientWidth;
		     		     		          	        		            winH = document.documentElement.clientHeight; 
		     		     		          	        	 }
		     		     		          	        		              else if (document.body)
		     		     		          	        		              	 {
		     		     		          	        		              	 	 // other
		     		     		          	        		              	 	     winW = document.body.clientWidth; 
		     		     		          	        		              	 	        winH = document.body.clientHeight;  
		     		     		          	        		              	} 
		     		     		          	        		              	 	           // for small pages with total size less then the viewport
		     		     		          	        		              	 	             var pageW = (scrW<winW) ? winW : scrW; 
		     		     		          	        		              	 	              var pageH = (scrH<winH) ? winH : scrH;  
		     		     		          	        		              	 	                return {PageW:pageW, PageH:pageH, WinW:winW, WinH:winH};
		     		     		          	      }
function GetPageScroll() 
{ 
	 var x, y;  
	 if(window.pageYOffset) 
	 { 
	 	   // all except IE   
	 	    y = window.pageYOffset;
	 	     x = window.pageXOffset;  
	}
	 else if(document.documentElement&& document.documentElement.scrollTop)
	 	 {
	 	 	    // IE 6 Strict
	 	 	        y = document.documentElement.scrollTop;
	 	 	            x = document.documentElement.scrollLeft;  
	 	 } 
	 	 else if(document.body) 
	 	 	{ 
	 	 		   // all other IE 
	 	 		      y = document.body.scrollTop; 
	 	 		         x = document.body.scrollLeft; 
	 	 		           }
	 	 		             return {scrollX:x, scrollY:y};
	 	 		             }	


 function copyGoodsUrl(){
        var content='';
        var x=top.location;
      //  alert(x);
        window.clipboardData.setData("Text",self.location.href);
        alert("本商品访问地址已复制到剪切板,您可粘贴到QQ/MSN/SKYPE/E-MAIL上推荐给您的好友!");
}


function click(){
if (event.button==2){//改成button==2为禁止右键
//alert('对不起,禁止使用此功能.')
}
}
document.onmousedown=click


if(navigator.appName=="Netscape")
{
   var s="<DIV bgcolor=white id='enetMeng' style='BORDER-RIGHT: #455690 1px solid; BORDER-TOP: #a6b4cf 1px solid; Z-INDEX: 99999; RIGHT: 5px; display:none; BORDER-LEFT: #a6b4cf 1px solid; WIDTH: 307px; BORDER-BOTTOM: #455690 1px solid; POSITION: absolute; TOP: 400px; HEIGHT: 217px'>";
   s=s+"<TABLE bgcolor=white WIDTH=255 BORDER=0 CELLPADDING=0 CELLSPACING=0 >";
   s=s+"<TR><TD height='175' valign='top'><table width='100%' border='0' cellspacing='0' cellpadding='1'>";
   s=s+"<tr><td width=95% id='msg_content'></td></tr>";
   s=s+"</table> </TD></TR><TR><TD></TD></TR></TABLE>";
   s=s+"</div>";
  document.write(s); 
  var if_fx_open=0;
  var enetdivTop,enetdivLeft,enetdivWidth,enetdivHeight,enetdocHeight,enetdocWidth,enetobjTimer,i = 0;
}

function enetgetMsg()
{
try
{
var s1=GetPageScroll();
var s2=GetPageSize();
enetdivLeft = parseInt(document.getElementById("enetMeng").style.left,10)
enetdivWidth = parseInt(document.getElementById("enetMeng").offsetWidth,10)
enetdocWidth = document.body.clientWidth;
var max_h=s1.scrollY+s2.WinH-217;
document.getElementById("enetMeng").style.top =max_h+"px";//sl.scrollY+s2.WinH+'px';//document.documentElement.clientHeight;//document.body.scrollTop + enetdocHeight + 100;// enetdivHeight
document.getElementById("enetMeng").style.left = parseInt(document.body.scrollLeft,10) + enetdocWidth - enetdivWidth;
document.getElementById("enetMeng").style.display="block";
if_fx_open=1;
//enetobjTimer = window.setInterval("enetmoveDiv()",1000)
//enetobjTimer = window.setInterval("enetcloseDiv()",4000)
window.setTimeout("javascript:document.getElementById('enetMeng').style.display='none';	if_fx_open=0;",3000)
}
catch(e){}
}

function scrollFx()
{
	
	if(if_fx_open==1)
	  enetgetMsg();
}　



var oPopup = window.createPopup();
var popTop=50;
function popmsg(msgstr)
{
		popTop=0;
//var winstr="<table width=305 height=215 background='/includes/images/popimg2.gif'  style=\"border: 1 solid  #FFA6CA\"   border=\"0\" cellpadding=\"0\" cellspacing=\"0\"   >";
var winstr="<table width=305 height=215 background='/includes/pics/popimg3.gif'    border=\"0\" cellpadding=\"0\" cellspacing=\"0\"   >";

winstr+="<tr><td align=\"center\" style=\"padding-top:30px;border:1px solid;border-color:#E5E5E5;\">";

winstr+="<table  width=\"90%\" height=\"110\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
winstr+="<tr><td align=center valign=\"center\" style=\"padding-left:30px;font-size:12px; color: black; face: 宋体\"><b>系统消息:<br><br>"+msgstr+"</b></td></tr></table>";

winstr+="</td></tr>";
winstr+="</table>";

if(navigator.appName=="Netscape")
{
 
  document.getElementById("msg_content").innerHTML=winstr;
	enetgetMsg();

}
else
{
oPopup.document.body.innerHTML = winstr;
oPopup.show();
popshow();
return 1;
}


}



function popshow(){


window.status=popTop;
if(popTop>860)
{
clearTimeout(mytime);
oPopup.hide();
return;
}
else if(popTop>660&&popTop<860){
oPopup.show(screen.width-250,screen.height,308,860-popTop);
}else if(popTop>840&&popTop<860){
oPopup.show(screen.width-250,screen.height+(popTop-860),308,215); //241,172
}else if(popTop<180){
oPopup.show(screen.width-250,screen.height,308,popTop);
}else if(popTop<220){
oPopup.show(screen.width-250,screen.height-popTop,308,215);
}
/*if(popTop>860)
{
clearTimeout(mytime);
oPopup.hide();
return;
}
else if(popTop>660&&popTop<860){
oPopup.show(screen.width-250,screen.height,241,860-popTop);
}else if(popTop>840&&popTop<860){
oPopup.show(screen.width-250,screen.height+(popTop-860),241,172); //241,172
}else if(popTop<180){
oPopup.show(screen.width-250,screen.height,241,popTop);
}else if(popTop<220){
oPopup.show(screen.width-250,screen.height-popTop,241,172);
}
*/
popTop+=10;
var mytime=setTimeout("popshow();",50);
}


function open_win(swf_url){
var popup=window.open ("/modules/tip/v.php?swf_url="+swf_url+"",'newwindow','height=240,width=320,top=50,left=100,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no')
popup.focus();

}

function showdetaildiv(the_url,the_width,the_height)
{

{
	//var x_left=(screen.width-the_width)/2;
	//var x_top=(screen.height-the_height)/2;
  var x_left=100;
	var x_top=50;
	  var popup=window.open (the_url, 'div_win', 'height='+the_height+', width='+the_width+', top='+x_top+', left='+x_left+', toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no')

}

popup.focus();

      }



 function chgimgdiv_visit(x)
{
	 	if(navigator.appName=="Netscape")
	 {
    var xx=document.getElementsByName("visit_div[]");
	 	for(var i=0;i<xx.length;i++ )
    {

    if(xx[i].id!=x)
     xx[i].style.visibility="hidden";
    else
    	  xx[i].style.visibility="";
	  }


  }
  else
	{
	   	 var e_all = document.all;
  for(var i=0;i<e_all.length;i++ )
  {
     if(e_all[i].tagName=="DIV")
    {

      if(e_all[i].id.indexOf("visit_div_")>=0)
    {

    	if(e_all[i].id.indexOf(x)>=0&&e_all[i].id==x)
     {
      	e_all[i].style.visibility='';
     }
     else
     		e_all[i].style.visibility='hidden';
     }

   }
  }

	   }
}

function unicode2Chr(str) {
 if ('' != str) {
  var st, t, i
  st = '';
  for (i = 1; i <= str.length/4; i ++){
   t = str.slice(4*i-4, 4*i-2);
   t = str.slice(4*i-2, 4*i).concat(t);
   st = st.concat('%u').concat(t);
  }
  st = unescape(st);
  return(st);
 }
 else
  return('');
}

function GetCookie(name)
{
var result = null;

var myCookie = document.cookie + ";";
var searchName = name + "=";
//alert(searchName);
var startOfCookie = myCookie.indexOf(searchName);
//alert(document.cookie);
var endOfCookie;
if (startOfCookie != -1)
{
 startOfCookie += searchName.length;
 endOfCookie = myCookie.indexOf(";",startOfCookie);
// alert(startOfCookie);
// alert(endOfCookie);
 result=(myCookie.substring(startOfCookie, endOfCookie));
// result(unescape(myCookie.substring(startOfCookie, endOfCookie)));
 //result = unescape(myCookie.substring(startOfCookie, endOfCookie));

}
return result;
}

function addGoodsCookie(cookie_name,name,value,img_value,net_price,expireHours,member_price,shelf_id)
{

	  var s_list=GetCookie(cookie_name);
  //alert(s_list);
  //alert(name);
  //document.write(s_list);
  //alert(net_price);
    if(s_list==null)
  //    if(s_list=="")

     {
     	 //   document.write("xxx");
         s_list=name+":"+value+":"+img_value+":"+net_price+":"+member_price+":"+shelf_id;
     }
     else
     {	//  document.write("yyy");
         var list_array= s_list.split(",");
         var if_exist=0;
         for (loop=0; loop < list_array.length;loop++)
        {
           var x_array=list_array[loop].split(":");

           if(x_array[0]==name)
           {
             if_exist=1;
             break;
           }
        }
        if(if_exist<=0)
        {
           s_list=s_list+","+name+":"+value+":"+img_value+":"+net_price+":"+member_price+":"+shelf_id;
        }
     }
            var date=new Date();
            date.setTime(date.getTime+expireHours*3600*1000);
            s_list="visit="+s_list+"; expire="+date.toGMTString()+";path=/";
            document.cookie=s_list;


}


function ListGoodsCookie_Today(cookie_name,ec_img_url)
{

	    var s_list=GetCookie(cookie_name);
   
     document.write("<center>");  
     if(s_list==""||s_list==null)
     {
     	 
       {
       		  document.write("<table border=0 cellspacing=2 cellpadding=2><tr><td height=45 valign=center>没有浏览商品记录!</td></tr></table>");
       } 
     }
     else
     {
          
     	   var list_array= s_list.split(",");
         var if_exist=0;

         var x=0;
        var nn=0;
          var x_temp="";
         for (loop=0; loop < list_array.length;loop++)
        {
           var s="";
        	
        	 var x_array=list_array[loop].split(":");
       //  alert(x_array);
         	 
         	if(x_array[0]==""||x_array[0]=="<goods_no>")
            {
              continue;	
            }
         	 x=x+1;
        	
         	  if(x_array[0]!="")
           {
             
           	 // if(x_array[2]!=""&&x_array[2]!="<cookie_img>")
              { 
              	// if(x_array[5]==2)
              //	  s="<table><tr><td><a href='/modules/publish_data/goods/product.php?key="+x_array[0]+"' target='_blank'><img border=1 alt='"+x_array[1]+"' src='"+ec_img_url+"/uploads/phpZip/yf/3/"+x_array[0]+"_01.gif'  width=140 height=183  style='border-color:black' border=1></img></a></td></tr><tr><td>"+x_array[1]+"</td></tr><tr><td>"+x_array[0]+"</td></tr><tr><td>零售:"+x_array[3]+";批发:"+x_array[4]+"</td></tr></table>";
              		  s="<table  align=left><tr><td><a href='/modules/publish_data/goods/product.php?key="+x_array[0]+"' target='_blank'><img border=1 alt='"+x_array[1]+"' src='"+ec_img_url+"/uploads/phpZip/yf/3/"+x_array[0]+"_01.gif'  width=140 height=183  style='border-color:black' border=1></img></a></td></tr>";
              		  s=s+"<tr><td align=left>"+x_array[1]+"</td></tr>";
              		  s=s+"<tr><td align=left>货号:"+x_array[0]+"</td></tr>";
              		  s=s+"<tr><td align=left>售价:"+x_array[4]+"</td></tr>";
              		  s=s+"<tr><td align=left><a href=\"JavaScript:fit("+x_array[0]+");\">试一下</a>&nbsp;&nbsp;<a href=\"/modules/publish_data/goods/product.php?key="+x_array[0]+"\">购买</a></a></td></tr>";
              		  s=s+"</table>";
              	
              	// if(x_array[5]==3)
              	//  s="<table><tr><td><a href='/modules/publish_data/goods/"+x_array[0]+".php' target='_blank'><img border=1 alt='"+x_array[1]+"' src='"+ec_img_url+"/uploads/phpZip/shoe/3/"+x_array[2]+"'  width=152 height=152  style='border-color:black' border=1></img></a></td></tr><tr><td>"+x_array[1]+"</td></tr><tr><td>"+x_array[0]+"</td></tr><tr><td>零售:"+x_array[3]+";批发:"+x_array[4]+"</td></tr></table>";
              	// if(x_array[5]==4)
              	//  s="<table><tr><td><a href='/modules/publish_data/goods/"+x_array[0]+".php' target='_blank'><img border=1 alt='"+x_array[1]+"' src='"+ec_img_url+"/uploads/phpZip/bag/3/"+x_array[2]+"'  width=152 height=152  style='border-color:black' border=1></img></a></td></tr><tr><td>"+x_array[1]+"</td></tr><tr><td>"+x_array[0]+"</td></tr><tr><td>零售:"+x_array[3]+";批发:"+x_array[4]+"</td></tr></table>";
              
              }
             // else
              {
               //   	  s="<a href='/modules/publish_data/goods/product.php?key="+x_array[0]+"' target='_blank'><img border=0 style='cursor:hand' src='"+ec_img_url+"/includes/images/square.gif'  width=140 height=183  ></img></a></div><div class='rightlist'><a href='/templates/publish_data/goods/"+x_array[0]+".php'>"+x_array[1]+"</a>";
             //   continue;
              }
          }
         
           if(nn==0)
        	{
    		    x_temp=x_temp+"<tr><td>"+s+"</td>";
             nn=nn+1;
          }
           
          else if(nn==4)
          { 
          	
    		       x_temp=x_temp+"<td>"+s+"</td></tr>";
    		      
          	
          	nn=0;
          }
          else
          {
    		    x_temp=x_temp+"<td>"+s+"</td>";
             nn=nn+1;
          	
          }
         
        
      
       }
       if(x_temp!="")
       {
       	  document.write("<table cellspacing=2 cellpadding=2>");
       	  document.write(x_temp);
          
          document.write("</table>");
          document.write(" 您今日共浏览了 <font color=red>" +x+"</font> 件商品 ");
          
       }
       else
       {
       		  document.write("<table border=0 cellspacing=2 cellpadding=2><tr><td height=45 valign=center>没有浏览商品记录!</td></tr></table>");
       } 
    }
}
function getCookie(name)//取cookies函数        
{
    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
     if(arr != null) return unescape(arr[2]); return null;

}
function delCookie(name)
{
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval=getCookie(name);
    if(cval!=null) 
    document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}
function clearvisit(the_cookie_name)
{
	delCookie(the_cookie_name);
	
	self.location.href='/today.php';

}

/*
function ListGoodsCookie(cookie_name)
{

	    var s_list=GetCookie(cookie_name);
   
     document.write("<center>");  
     if(s_list=="")
     {
     }
     else
     {
          
     	   var list_array= s_list.split(",");
         var if_exist=0;

         var x=0;
         var y=0;
         var m =0;
         for (loop=0; loop < list_array.length;loop++)
        {
        	 var s="";
        	 var x_array=list_array[loop].split(":");
           if(x_array[0]!="")
           {
          // 	alert(x_array[2]);
           	if(navigator.appName=="Netscape")
           	{
           	 	  if(x_array[2]!="")
               // s="<ul><li><div style='float:left;'><div style='display:none; width:100px; height:100px; background:#FFFFFF; border:1px solid #CCCCCC; position:absolute;' id='text1'>"+x_array[1]+"</div><a href='/templates/publish_data/goods/"+x_array[0]+".php'><img border=0 style='cursor:hand;border-color:#CCCCCC;filter:alpha(opacity=50)' onMouseOver='makevisible(this,0)' onMouseOut='makevisible(this,1)'  src='/uploads/phpZip/goods/3/"+x_array[2]+"' height=64 width=64 ></img></a></div></li></ul>";
               s="<div style='float:left;position:relative'><div style='display:none; width:100px; height:100px; background:#FFFFFF; border:1px solid #CCCCCC; position:absolute;' id='text1'>"+x_array[1]+"</div><a href='/templates/publish_data/goods/"+x_array[0]+".php'><img border=1 style='cursor:hand;border-color:#CCCCCC;filter:alpha(opacity=50)' onMouseOver='makevisible(this,0)' onMouseOut='makevisible(this,1)'  src='/uploads/phpZip/goods/3/"+x_array[2]+"' height=120 width=120   style='border-color:black' border=1></img></a></div>";


              else
             //   s="<li><div class='rightpic'><a href='/templates/publish_data/goods/"+x_array[0]+".php'><img border=0 style='cursor:hand' src='/includes/images/square.gif' height=84 width=84 ></img></a></div></li>";
                 s="<div class='rightpic'><a href='/templates/publish_data/goods/"+x_array[0]+".php'><img border=0 style='cursor:hand' src='/includes/images/square.gif' height=84 width=84 ></img></a></div>";

           	}
           	else
           	{
           	  if(x_array[2]!="")
              //  s="<ul><a href='/templates/publish_data/goods/"+x_array[0]+".php'><img border=0 alt='"+x_array[1]+"' src='/uploads/phpZip/goods/3/"+x_array[2]+"' height=64 width=64></img></a></ul>";
           s="<div class='rightpic'><a href='/templates/publish_data/goods/"+x_array[0]+".php'><img border=1 alt='"+x_array[1]+"' src='/uploads/phpZip/goods/3/"+x_array[2]+"' height=120 width=120 style='border-color:black' border=1></img></a></div>";
              else
            //    s="<li><div class='rightpic'><a href='/templates/publish_data/goods/"+x_array[0]+".php'><img border=0 style='cursor:hand' src='/includes/images/square.gif' height=84 width=84 ></img></a></div><div class='rightlist'><a href='/templates/publish_data/goods/"+x_array[0]+".php'>"+x_array[1]+"</a></div></li>";
                s="<div class='rightpic'><a href='/templates/publish_data/goods/"+x_array[0]+".php'><img border=0 style='cursor:hand' src='/includes/images/square.gif' height=84 width=84 ></img></a></div><div class='rightlist'><a href='/templates/publish_data/goods/"+x_array[0]+".php'>"+x_array[1]+"</a></div>";
            
            }
          }
          if(s!="")
         {
           if(x==0)
           {
            if(navigator.appName=="Netscape")
           	{

               if(y<=0)
                document.write("<div   name='visit_div[]' id='visit_div_"+y+"' style='position:absolute;visibility:true'>");
              else
                document.write("<div   name='visit_div[]' id='visit_div_"+y+"' style='position:absolute;visibility:hidden'>");
            }
            else
            {

               if(y<=0)
                document.write("<div   name='visit_div[]' id='visit_div_"+y+"' style='position:absolute;visibility:true'>");
              else
                document.write("<div   name='visit_div[]' id='visit_div_"+y+"' style='position:absolute;visibility:hidden'>");

            }


        //   	document.write("<ul><li>");

                document.write(s);
                x=x+1;
           }
//           else if(x==9)
           else if(x==5)
           {

             	document.write(s);
           //   document.write("</li></ul>");

           	  if(y==0)
           	  {
//           	  	 if(list_array.length>10)
           	  	 if(list_array.length>6)
           	  	   document.write("<table width=162 border=0 cellspacing=0 cellpadding=0><tr><td align=center>  <a href=javascript:chgimgdiv_visit('visit_div_"+(y+1)+"')>下一页 >></a></td></tr></table>");
           	  }
           	  else
           	  {

           	  	  document.write("<table width=162 border=0 cellspacing=0 cellpadding=0><tr><td align=center>  <a href=javascript:chgimgdiv_visit('visit_div_"+(y-1)+"')><< 上一页</a>   <a href=javascript:chgimgdiv_visit('visit_div_"+(y+1)+"')>下一页 ></a></td></tr></table>");
           	  }
           	  document.write("</div>");

           	   x=0;
           	  y=y+1;
           }
           else
           {

           	    document.write(s);

               x=x+1;
           }
         }


        }

        if(x >0&&x<5)
        {

           	  if(y==0)
           	  {
           	  	 document.write("</div>");
           	   }
           	  else
           	  {

          // 	  	  document.write("</ol><table width=162 border=0 cellspacing=0 cellpadding=0><tr><td align=center>  <a href=javascript:chgimgdiv_visit('visit_div_"+(y-1)+"')><< 上一页</a></td></tr></table></ol></div>");
           	 	  	  document.write("<table width=162 border=0 cellspacing=0 cellpadding=0><tr><td align=center>  <a href=javascript:chgimgdiv_visit('visit_div_"+(y-1)+"')><< 上一页</a></td></tr></table></div>");
           	
           	  }
        }

     }

}
*/


function changeSize(id,the_value){
/*	var sel=$F('selectedSize');
	$('size-'+sel).className='';
	$('size-'+id).addClassName('select');
	$('selectedSize').value=id;
	*/
	//var sel=$F('selectedSize');
	
	var x=document.getElementById('selectedSize').value;
	 if(x==id)
	{
	 if(document.getElementById('size-'+id).className!="select")
   {
   	 document.getElementById('size-'+id).className='select';
     document.getElementById('selectedSize').value=id;
     document.getElementById('sel_size_id').value=the_value;
   }
   else
   {
   	 document.getElementById('size-'+id).className='';
   document.getElementById('sel_size_id').value='';
   }
	}
	else
	{ 	
		 if(x!="")
		 {
		  	 document.getElementById('size-'+x).className='';
	   }
	   document.getElementById('size-'+id).className='select';
	   document.getElementById('selectedSize').value=id;
	   document.getElementById('sel_size_id').value=the_value;
  }
  

	
}

function check_cart_info(purl)
{
  var x=document.getElementsByName("num[]");
  if(x.length<=0)
  {
	alert("您没有选购任何商品，无法进行下步操作!");
	return;
  }
  else
  {
	if(purl=='')purl="/modules/cart/cart_step1.php";
	self.location.href=purl;
  }
}

function huangou(if_exist_huangou,code,goods_no)
	{
    var a=document.getElementsByName("if_huangou[]");
    
    for(var x=0;x<a.length;x++)
    {
    	if(a[x].value==code)
    	{
    	  if(if_exist_huangou=="1")
    	  {
    	  	
    	  	if(confirm("你每单只允许购买一个超值换购商品，您确认要替换为您已选择的商品吗？"))
    	  	{
    	  	   tb_show(null,"/modules/db_operation/ajax_cart_list.php?act=huangou&code="+code+"&goods_no="+goods_no+"&placeValuesBeforeTB_=savedValues&TB_iframe=false&width=320&height=190&&modal=true",false);
 		
    	  	}
    	  	
    	 }
     	else
    	{	
    	
    	  if(a[x].checked)
    	  {
    	     tb_show(null,"/modules/db_operation/ajax_cart_list.php?act=huangou&code="+code+"&goods_no="+goods_no+"&placeValuesBeforeTB_=savedValues&TB_iframe=false&width=320&height=190&&modal=true",false);
 	
    	  }
    	  else
    	  {
    	    alert("请先选定参与该换购活动");
    	    return;
    	  }	
    	}  
    		
    	}
      	
    }		
		
	}

function check_goods2(action_type,goods_no,the_size_id,x_num)
{
        
        tb_show(null,"/modules/publish_data/goods/product.php?action_type="+action_type+"&type=info&key="+goods_no+"&size_id="+the_size_id+"&num="+x_num+"&placeValuesBeforeTB_=savedValues&TB_iframe=false&width=320&height=190&&modal=true",false);
      
      /*  $.ajax({ 
         type: "post", 
         url: "/modules/publish_data/goods/product.php", 
         data: "type=info&key="+goods_no+"&size_id="+the_size_id+"&num="+x_num,
         success: function(msg)
         {
         	 if(msg==0)
         	 {
         	 	
         	  alert("很抱歉，您选购的商品已经被抢购一空!");
         	  return;	
         	 }
         	
         	 else if(msg==2)
         	 {
         	 	   alert("很抱歉，您选购的商品库存不足，请修改数量!");
         	  return;	
         	 }
         	  else
         	 {
         	 	      if(action_type==0)
              check_goods_pay(action_type,msg,x_num);
              else
       	      check_goods(action_type,msg,x_num);
         	 	
         	    	return;
         	 }	 
            
      
         
        	 // $('#status_frame3').html(msg);
     	   }
       }); 
       
     */
    
}
function check_goods(action_type,the_size_id,x_num)
{
 
//放入购物车 
  if(x_num <= 0)
  {
    alert("商品数量不能小于0");
    return;	
  }
  else if(x_num > 20)
  {
  	alert("单个商品一次购买不能超过20件,请修改!");
  	return;
  }	
  else
  {
 
  arr=the_size_id.split("_");
  var id=arr[0];
  var size_id=arr[1];
  var size_name=arr[2];
  var color_id=arr[3];
  var color_name=arr[4];


 	   addtocart(action_type,the_size_id,x_num,0);
  }
 
}
function check_goods_pay(action_type,the_size_id,x_num)
{

//购买

 // if(the_size_id<=0)
 // {
 //   alert("请选择您要买单商品的尺码!");
 // }
 // else

  if(x_num <= 0)
  {
    alert("商品数量不能小于0");
    return;	
  }
  else if(x_num > 20)
  {
  
  	alert("单个商品一次购买不能超过20件,请修改!");
  	return;
  }	
  else
  {
  // arr=str.split(",");
  //for(i=0;i<arr.length;i++)alert(i+":"+arr[i])
  arr=the_size_id.split("_");
  var id=arr[0];
  var size_id=arr[1];
  var size_name=arr[2];
  var color_id=arr[3];
  var color_name=arr[4];

   addtocart(action_type,the_size_id,x_num,1);
 
 //  showcart();
 }
}

function delfromcart(id)
{

 var the_url="/modules/cart/cart_list.php?act=2&id="+id;

	document.getElementById("check_name").src=the_url;
	//alert(2);
	return;

}
function delfromcart2(goods_no,size_id)
{
// var the_url="/modules/cart/cart_action.php?act=2&id="+id;
 var the_url="/modules/cart/cart_list.php?act=2&goods_no="+goods_no+"&size_id="+size_id;

	self.location.href=the_url;
	return;

}

function addtocart(action,ProdID,num,if_open)
{
//alert(ProdID);
  /*   var zyz=ProdID;
     var xyz = zyz.split("#");
     var syz=xyz[0];
     var xxxx=syz.replace("{goods_name}",xyz[1]);
    */
    var xxxx=ProdID;
     
     //  alert(encodeURI(xxxx));
         $.ajax({ 
        type: "post", 
        url: "/modules/cart/cart_list.php", 
         data: "ifhidden=1&act=1&num="+num+"&prod_id="+encodeURI(xxxx),
       
         success: function(msg)
        {
        //	alert(msg);
        	
        	  $('#status_frame3').html("("+msg+")");
     	  
     	        if(if_open==0)
              {
               self.location.href="/templates/okc.tpl.html";
             // 	  tb_show(null,'/templates/okc.tpl.html?&placeValuesBeforeTB_=savedValues&TB_iframe=false&width=320&height=190&&modal=true',false);
              }
              else
              {
              	//购买
                self.location.href="/templates/okc.tpl.html?if_pay=1";
	            //  tb_show(null,'/templates/okc.tpl.html?if_pay=1&placeValuesBeforeTB_=savedValues&TB_iframe=false&width=320&height=190&&modal=true',false);
              }
     	  //	showcart();
       
     	  }
       }); 
       
     
    
     return;
}


function addtofav(ProdID,ProdName)
{
 
       $.ajax({ 
        type: "post", 
        url: "/modules/cart/addtofav.php", 
         data: "prod_id="+ProdID+"&prod_name="+encodeURI(ProdName),
         success: function(msg)
        {
        	//  $('#status_frame3').html(msg);
     	 }
       }); 
       
       
        tb_show(null,'/templates/okf.tpl.html?&placeValuesBeforeTB_=savedValues&TB_iframe=false&width=320&height=190&&modal=true',false);
    
       	return;
}

function showcart()
{

   // var popup = window.open(url,"shop_cart","");
    var popup = window.open("/modules/cart/cart_list.php","shop_cart");
   
    //     popup.focus();

	return;
}

function openpayer()
{

	  var url="/modules/cart/address_list.php?type=1";
  var popup = window.open(url,"address_form","");
         popup.focus();

	return;
}
function openacceptor()
{

	  var url="/modules/cart/address_list.php?type=2";
  var popup = window.open(url,"address_form","");
         popup.focus();

	return;
}



function seladdress(type,name,mobile,mail,province,city,address,zipcode,payer_district,payer_town,payer_landline1,payer_landline2)
{

	if(type==1)
	{
	  opener.document.getElementById("payer_name").value=name;
	  opener.document.getElementById("payer_mobile").value=mobile;
	  opener.document.getElementById("payer_email").value=mail;
	  opener.document.getElementById("c13").value=province;
	  opener.document.getElementById("c23").value=city;
	  opener.document.getElementById("payer_address").value=address;
	  opener.document.getElementById("payer_zipcode").value=zipcode;
	  opener.document.getElementById("payer_district").value=payer_district;
	  opener.document.getElementById("payer_town").value=payer_town;
	  opener.document.getElementById("payer_landline1").value=payer_landline1;
	  opener.document.getElementById("payer_landline2").value=payer_landline2;
	}
	if(type==2)
	{
	  opener.document.getElementById("acceptor_name").value=name;
	  opener.document.getElementById("acceptor_mobile").value=mobile;
	  opener.document.getElementById("acceptor_email").value=mail;
	  opener.document.getElementById("c133").value=province;
	  opener.document.getElementById("c233").value=city;
	  opener.document.getElementById("acceptor_address").value=address;
	  opener.document.getElementById("acceptor_zipcode").value=zipcode;
	  opener.document.getElementById("payer_district").value=payer_district;
	  opener.document.getElementById("payer_town").value=payer_town;
	  opener.document.getElementById("payer_landline1").value=payer_landline1;
	  opener.document.getElementById("payer_landline2").value=payer_landline2;
	}
window.close();
}

function checkevent()
{
	var total;
	var viptotal;

	total = 0;
	totalyj=0;  //原价
	totaljs=0;  //节省
	var a=document.getElementsByName("num[]");


	 for(i=0;i<a.length;i++) 
	 {
			if(a[i].value == "" ||parseFloat(a[i].value)>20|| parseFloat(a[i].value) <= 0||parseFloat(a[i].value) < 1 || isNaN(a[i].value))
			{
				a[i].value = 1;

			}
			if(a[i].value.indexOf('.')>0)
				a[i].value = 1;
	}
//	alert(123);
// alert(document.getElementById("act").value);
 //alert(document.getElementById("tt").action);
// document.getElementById("tt").target="_blank";
 document.getElementById("tt").submit();


}



function sel_deliver_type(m)
{
/*  var x=a.options[a.selectedIndex].className;
  var the_div=document.getElementById('A'+x);
	var e_all = document.all;
  for(var i=0;i<e_all.length;i++)
  {
    if(e_all[i].tagName=="RADIO")
    {

    	if(e_all[i].id.indexOf('A')>=0)
     {

    	//alert(e_all[i].className);
      if(e_all[i].id!='A'+x)

      	e_all[i].style.visibility='hidden';
      else
      	e_all[i].style.visibility='';
     }
   }
  }
 */
  var a=document.getElementsByName("sel_deliver_type[]");

	var the_url="";
	for(var i=0;i<a.length;i++)
	{
		if(a[i].checked==true)
		{
			 var x=a[i].value.split(",");

      var type_id=x[0];
      var weight_1=x[1];
      var weight_2=x[2];


	var e_all = document.all;
  for(var i=0;i<e_all.length;i++)
  {
    if(e_all[i].tagName=="DIV")
    {

    	if(e_all[i].id.indexOf('A')>=0)
     {

    	//alert(e_all[i].className);
      if(e_all[i].id!=type_id)

      	e_all[i].style.visibility='hidden';
      else
      	e_all[i].style.visibility='';
     }
   }
  }


		  break;
		}

	}
  

}


function confirmdelivertype()
{
/*	var a=document.getElementById("sel_deliver_id");
	if(a.value=="0")
	{
	  alert("请选定收货地区");
	  return;

	}
	else
{
	var the_url="";

	//the_url='/modules/cart/cart_confirm_end.php?act=4&deliver_type='+a.value;
	the_url='/modules/cart/cart_pay_info.php?action_type=4&deliver_type='+a.value;
	  top.location.href=the_url;
}	*/

	var a=document.getElementsByName("sel_deliver_type[]");

	var the_url="";
	for(var i=0;i<a.length;i++)
	{
		if(a[i].checked==true)
		{
			the_url='/modules/cart/cart_pay_info.php?action_type=4&deliver_type='+a[i].value;
		  break;
		}

	}


	if(the_url=="")
	{
	  alert("请选定送货地区");
	  return;

	}
	else
	{

      self.location.href=the_url;
   }




}

function checksame(a)
{

  if(a.checked==true&&a.value=="same")
  {
  	 document.getElementById("acceptor_name").value=document.getElementById("payer_name").value;
  	 document.getElementById("acceptor_mobile").value=document.getElementById("payer_mobile").value;
  	 document.getElementById("acceptor_email").value=document.getElementById("payer_email").value;
  	 document.getElementById("acceptor_address").value=document.getElementById("payer_address").value;
   	 document.getElementById("acceptor_zipcode").value=document.getElementById("payer_zipcode").value;
   	 document.getElementById("acceptor_memo").value=document.getElementById("payer_memo").value;

      for(var x=0;x<document.getElementById('c133').options.length;x++)
		  {
		      if(document.getElementById('c133').options[x].value==document.getElementById('c13').value)
			  document.getElementById('c133').options[x].selected=true;
		  }
      changeSubCat33(document.getElementById('c133'));

		   for(var x=0;x<document.getElementById('c233').options.length;x++)
		  {

		      if(document.getElementById('c233').options[x].value==document.getElementById('c23').value)
			    document.getElementById('c233').options[x].selected=true;
		  }

  }
  else if(a.checked==true&&a.value=="no")
  {
    document.getElementById("acceptor_name").value="";
    document.getElementById("acceptor_mobile").value="";
    document.getElementById("acceptor_email").value="";
    document.getElementById("acceptor_address").value="";
    document.getElementById("acceptor_zipcode").value="";
    document.getElementById("acceptor_memo").value="";

  }
}



function check_pa(type)
{
	if(type==1)
{
  if(document.getElementById("payer_name").value=="")
  {
  	alert("请填写付款人姓名!");
  	return;
  }

  if(document.getElementById("c13").value=="")
  {
    alert("请选择付款人所在地区");
    return;
  }
  if(document.getElementById("payer_address").value=="")
  {
  	alert("请填写付款人地址");
    return;
  }
  if(document.getElementById("payer_zipcode").value=="")
  {
   alert("请填写付款人所在地区邮编");
   return;
  }
   if(document.getElementById("payer_mobile").value=="")
  {
  	alert("请填写付款人手机号码!");
  	return;
  }
 /* if(document.getElementById("payer_landline1").value=="" || document.getElementById("payer_landline2").value=="")
  {
  	alert("付款人固定电话信息不完整!");
  	return;
  }*/

}
else
{

  if(document.getElementById("acceptor_name").value=="")
  {
  	alert("请填写收货人姓名!");
    return;
  }
  if(document.getElementById("c13").value=="")
  {
    alert("请选择收货人所在地区");
    return;
  }
  if(document.getElementById("acceptor_address").value=="")
  {
  	alert("请填写收货人地址");
    return;
  }
  if(document.getElementById("acceptor_zipcode").value=="")
  {
  	alert("请填写收货人所在地区邮编");
    return;
  }
  if(document.getElementById("acceptor_mobile").value=="")
  {
  	alert("请填写收货人手机!");
    return;
  }
 /* if(document.getElementById("acceptor_landline1").value=="" || document.getElementById("acceptor_landline2").value=="")
  {
  	alert("收货人固定电话信息不完整!");
  	return;
  }*/

}

  document.getElementById("mainform2").submit();

}


function sel_payment()
{

	var a=document.getElementsByName("sel_pay_type[]");

	var m=0;
	var payment_type="";
	for(var i=0;i<a.length;i++)
	{
		 if(a[i].checked==true)
		{
		  payment_type=a[i].value;
		 /* if(a[i].value=="1")
		  {

		  	  var b=document.getElementsByName("sel_net_pay_type[]");
		  	  var n=0;
		  	  for(var j=0;j<b.length;j++)
		  	  {
		  	    if(b[j].checked)
		  	    {
		  	    	n=1;
		  	    	payment_type=b[j].value;
		  	    	break;
		  	    }
		  	  }

		  	  if(n<=0)
		  	  {
		  	    alert("请选定网上支付您要选用的支付工具");
		  	    return;
		  	  }
		  }
		  */

		  if(a[i].value=="4")
		  {
		  	 var b=document.getElementById("sel_self_pay");
		  	 if(b.checked)
		  	 {
		  	 }
		  	 else
		  	 {
		  	 	  alert("您选择了货到付款服务，请确认您接受货到付款服务分险条款!");
		  	    return;
		  	 }
		  }
		  m=1;
		  break;
		}
	}

	if(m<=0)
	{
	  alert("请选择您要选用的支付方式");
	  return;
	}
 self.location.href='/modules/cart/cart_action.php?act=6&payment_type='+payment_type;

 // top.location.href='/modules/cart/cart_step4.php?act=7&payment_type='+payment_type;
}

function sel_join_payment()
{

	var a=document.getElementsByName("sel_pay_type[]");

	var m=0;
	var payment_type="";
	for(var i=0;i<a.length;i++)
	{
		 if(a[i].checked==true)
		{
		  payment_type=a[i].value;
		 /* if(a[i].value=="1")
		  {

		  	  var b=document.getElementsByName("sel_net_pay_type[]");
		  	  var n=0;
		  	  for(var j=0;j<b.length;j++)
		  	  {
		  	    if(b[j].checked)
		  	    {
		  	    	n=1;
		  	    	payment_type=b[j].value;
		  	    	break;
		  	    }
		  	  }

		  	  if(n<=0)
		  	  {
		  	    alert("请选定网上支付您要选用的支付工具");
		  	    return;
		  	  }
		  }
		  */

		  if(a[i].value=="4")
		  {
		  	 var b=document.getElementById("sel_self_pay");
		  	 if(b.checked)
		  	 {
		  	 }
		  	 else
		  	 {
		  	 	  alert("您选择了货到付款服务，请确认您接受货到付款服务风险条款!");
		  	    return;
		  	 }
		  }
		  m=1;
		  break;
		}
	}

	if(m<=0)
	{
	  alert("请选择您支付网络加盟商年费的方式");
	  return;
	}
 self.location.href='/modules/user/join_step3.php?dealtype=1&payment_type='+payment_type;

 // top.location.href='/modules/cart/cart_step4.php?act=7&payment_type='+payment_type;
}


function swfView(width, height, url){
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' ");
	document.write("		codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' ");
	document.write("		width='"+width+"' height='"+height+"' align='middle'>");
	document.write("	<param name='allowScriptAccess' value='sameDomain' /> ");
	document.write("	<param name='movie'				value='"+url+"' /> ");
	document.write("	<param name='quality'			value='high' /> ");
	document.write("	<param name='wmode'				value='transparent'> ");
	document.write("	<param name='bgcolor'				value='red'> ");

	document.write("	<embed src='"+url+"' quality='high' width='"+width+"' height='"+height+"' align='middle' ");
	document.write("		allowScriptAccess='sameDomain' type='application/x-shockwave-flash' ");
	document.write("		pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>");
}

 function showdetaildiv(the_url,the_width,the_height)
{
      // window.showModalDialog(the_url,null,"dialogHeight:450px;dialogWidth:700px;");
     //window.showModalDialog(the_url,'personal','location=no;scrollbars:no;resizable:no;alwaysRaised:yes;status:no;toolbar:no;menubar:no;titlebar:no;help:no;dialogHeight:500px;dialogWidth:650px');
      //   alert(parent.document.all.detaildiv_center.height);
{
	var x_left=(screen.width-the_width)/2;
	var x_top=(screen.height-the_height)/2;

	var popup=window.open (the_url, 'newwindow', 'height='+the_height+', width='+the_width+', top='+x_top+', left='+x_left+', toolbar=no, menubar=no, scrollbars=yes, resizable=yes,location=no, status=no')

}

popup.focus();


}


function shouqi(status)
{
	
    var date=new Date();
    date.setTime(date.getTime+1*3600*1000);
    var s_list="pifa_search_shouqi="+status+"; expire="+date.toGMTString()+";path=/";
    document.cookie=s_list;	

	  if(status=="1")
	  {
	  		document.getElementById('searchFrame').style.display="none";
        document.getElementById('searchLeftFrame').style.display="";
	 //    document.getElementById('searchLeftFrame2').style.display="none";
	  
	  
	  	
	  }
	  else
	  {

	 document.getElementById('searchFrame').style.display="";
	   document.getElementById('searchLeftFrame').style.display="none";
	// document.getElementById('searchLeftFrame2').style.display="";
	  		
	  }
	  	
}

function shouqidress(status)
{
var Toppx =  100;//82;//175-82; //上端位置 (82)
var AdDivW = 285; //宽度 
var AdDivH =  220;//353+82; //高度 
var PageWidth = 1000; //页面多少宽度象素下正好不出现左右滚动条 
var MinScreenW = 1000; //显示广告的最小屏幕宽度象素 
	
      
	  if(status=="1")
	  {
	  	AdDivW=157;
	  	AdDivH=178;
	  	//	document.getElementById('searchFrame').style.display="none";
       top.document.getElementById('searchLeftFrame').style.display="";
	     top.document.getElementById('searchLeftFrame2').style.display="none";
	  
	    top.document.getElementById("dressDiv").style.left=10+"px";
	    top.document.getElementById("dressDiv").style.width=AdDivW+"px";
	  	top.document.getElementById("dressDiv").style.height=AdDivH+"px";
	    Toppx=top.document.documentElement.clientHeight-AdDivH-30;
	    if(top.document.body.scrollTop>top.document.documentElement.scrollTop)
  	    top.document.getElementById("dressDiv").style.top=top.document.body.scrollTop+Toppx+"px";
  	  else
        top.document.getElementById("dressDiv").style.top=top.document.documentElement.scrollTop+Toppx+"px";

	  }
	  else if(status=="0"||status=="2")
	  {
    	AdDivW=272;
	  	AdDivH=472;
	//   document.getElementById('searchFrame').style.display="";
	   top.document.getElementById('searchLeftFrame').style.display="none";
	   top.document.getElementById('searchLeftFrame2').style.display="";
	   
	   if(status=="0")
	     top.document.getElementById("dressDiv").style.left=10+"px";
 	   
 	   top.document.getElementById("dressDiv").style.width=AdDivW+"px";
	   top.document.getElementById("dressDiv").style.height=AdDivH+"px";
     if(status=="0")
	   {
	   	   Toppx=top.document.documentElement.clientHeight-AdDivH-30;
	       if(top.document.body.scrollTop>top.document.documentElement.scrollTop)
  	        top.document.getElementById("dressDiv").style.top=top.document.body.scrollTop+Toppx+"px";
  	     else
            top.document.getElementById("dressDiv").style.top=top.document.documentElement.scrollTop+Toppx+"px";
	   }
	  
	  }
	  	
}
function opengoods(goods_no)
{
//	top.document.getElementById("fitFrame").cols="290,0,*";
//top.document.getElementById("mainFrame").src="/modules/publish_data/goods/product.php?key="+goods_no;
}

function fit(goods_no)
{
//	top.document.getElementById("dressDiv").style.display="none";
//top.document.getElementById("mainFrame").src="/modules/publish_data/goods/product.php?key="+goods_no;
  shouqidress(2);
}


function getcoupon(CouponID)
{
 	{
var f=document.createElement('iframe');
f.style.visibility="hidden";
f.height=0;
f.width=0;
f.src="/modules/coupon/getcoupon.php?coupon_id="+CouponID;
document.body.appendChild(f);

	//popmsg("您选购的商品已放入购物车<br><br>欢迎继续选购!");

}
	return;
}
