﻿// 用户访问商品记录
var Opg ={};
lastScrollY=0;
function heartBeat()
{ 
    var diffY;
    if (document.documentElement && document.documentElement.scrollTop)
    {
    diffY = document.documentElement.scrollTop+1;
    }
    else if (document.body)
    {
    diffY = document.body.scrollTop+1;
    }
    else
    {/*Netscape stuff*/}
    percent=.1*(diffY-lastScrollY); 
    if(percent>0)percent=Math.ceil(percent); 
    else percent=Math.floor(percent); 
    lastScrollY=lastScrollY+percent; 
}



lastScrollY2=0;
function heartBeat2()
{ 
    var diffY2;
    if (document.documentElement && document.documentElement.scrollTop)
    diffY2 = document.documentElement.scrollTop+1;
    else if (document.body)
    diffY2 = document.body.scrollTop+1;
    else
    {/*Netscape stuff*/}
    percent2=.1*(diffY2-lastScrollY2); 
    if(percent2>0)percent2=Math.ceil(percent2);
    else percent2=Math.floor(percent2); 
    document.getElementById("PC_Right").style.top=parseInt(document.getElementById("PC_Right").style.top)+percent2+"px";
    lastScrollY2=lastScrollY2+percent2; 
}

//alert(ClaProduct.GetProductShowPicByID(strProductID).value);
//var strProductShowPic=ClaProduct.GetProductShowPicByID(strProductID).value;
//alert(strProductShowPic);
ShowPicCookieResponse(strProductShowPic);

function ShowPicCookieResponse(response) 
{
	//var response = transport.responseText;
	
	strCookie=GetCookie("VisitHistory");
	
	var strProductID = getParamByUrlRewrite();
	var strImgUrl=null
	if(strCookie!=null)
	{
	   var strCookieHistory=GetCookie("VisitHistory");	   
	   var strSearch="../product-"+ strProductID + "-" + styleId  +"-1.html";
	   var dd=strCookieHistory.indexOf("../product-"+ strProductID + "-" + styleId +"-1.html");	   
	   if(strCookieHistory.indexOf(strSearch)!=-1)
	   {
	     //alert("商品重复");
	     strImgUrl=strCookieHistory;
	    }
	    else
	    {
	      //strImgUrl= '<TR><TD style="padding-top:5px;" valign="top"><A href="product-'+ strProductID + "-" + styleId + '-1.html" target=_blank><IMG src="'+ response +'" width="46" height="60" title="#"></A></TD></TR>'+ strCookieHistory;
	      strImgUrl= '<A href="../product-'+ strProductID + "-" + styleId + '-1.html" target=_blank><IMG src="'+ response +'" width="46" height="60" title="#"></A>'+ strCookieHistory;
	    
	    }
	 }
	 else
	 {	   
	    //strImgUrl= '<TR><TD style="padding-top:5px;" valign="top"><A href="product-'+ strProductID + "-" + styleId  +'-1.html" target=_blank><IMG src="'+ response +'" width="46" height="60" title="#"></A></TD></TR>';
	    strImgUrl= '<A href="../product-'+ strProductID + "-" + styleId  +'-1.html" target=_blank><IMG src="'+ response +'" width="46" height="60" title="#"></A>';
	    
	 }
	SetCookie("VisitHistory",strImgUrl)
	       
}//end function strProductShowPic()




var strCookieValue=GetCookie("VisitHistory");
if(strCookieValue==null)strCookieValue="";
var tmp=new Array();
tmp=strCookieValue.split("html");
var Height=10;
var ArrLength=tmp.length;
switch(ArrLength)
{
    
    case 1: Height=10; break;
    case 2: Height=70; break;
    case 3: Height=130; break;
    case 4: Height=190; break;
    default: Height=250; break;    
}



init1();
//setInterval("heartBeat2()",1);
function init1()
{
    var v = document.getElementById('upperfolderdiv');
    
    if(v==null)
    {
        //setTimeout("init1()", 300);
    }
    else
    {
    var upperfloatDiv= jQuery('#upperfolderdiv').html();
    jQuery('#upperfolderdiv').remove();
    var suspendcode1='<div style="right:5px;POSITION:absolute;TOP:180px;Z-INDEX:440;background:#f0f0f0;" id="PC_Right"><table height="'+Height+'" border="0"><tbody><tr><td style="background:#cccccc; height:5px;"></td></tr><tr><td style="height:3px;"></td></tr><tr><td>'+upperfloatDiv+'</td></tr><tr><td align="center">今日浏览</td></tr><tr><td align="center" style="color:#ff6600; padding-bottom:2px;">(' + (ArrLength-1) + ')</td></tr><tr><td align="center"><img onmouseover="ImgUpOver()" onmouseout="ImgUpOut()" id="ImgUp" src="Images/right_box_button_01.gif" width="46" height="8" /></td></tr><tr><td><DIV id="divMenu" style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-BOTTOM: 0px; OVERFLOW: hidden; WIDTH: 52px; PADDING-TOP: 2px; HEIGHT: '+Height+'px"><TABLE height="'+Height+'" border=0><TBODY><TR><TD id=rollleft1><TABLE height="'+Height+'" cellSpacing=0 cellPadding=2 width=130 border=0><TBODY>'+ strCookieValue+' </TBODY></TABLE></TD></TR><TR><TD id=rollright1></TD></TR></TBODY></TABLE></DIV></td></tr><tr><td align="center"><img id="ImgDown" onmouseover="ImgDownOver()" onmouseout="ImgDownOut()" src="Images/right_box_button_02.gif" width="46" height="8"/></td></tr><tr><td style="height:6px;"></td></tr></tbody></table></div>';
    document.write(suspendcode1); 

    }
}

// ********************* 图片上下滚动效果 **************************************//
var speed1=22//速度数值越大速度越慢
ReadyInitShow();
function ReadyInitShow()
{
  //alert("进入ReadyInitShow函数");  
  
  if(document.all.rollright1 && document.all.rollleft1)
  {   
    rollright1.innerHTML=rollleft1.innerHTML
    //alert("如果载入已经准备好了");
  }
  else
  {
    //alert("如果载入没有准备好那么每隔300毫秒就去执行ReadyInitShow函数");
    setTimeout("ReadyInitShow()", 300);
  }
};

function Marquee1(){
if(rollright1.offsetHeight-divMenu.scrollTop<=0)
{
	divMenu.scrollTop=divMenu.scrollTop-rollleft1.offsetHeight;
//offsetWidth　获取对象相对于版面或由父坐标　offsetParent　属性指定的父坐标的宽度。
}
else{
divMenu.scrollTop++
}
}

function Marquee2(){
if(rollright1.offsetHeight-divMenu.scrollTop<=0)
{
	divMenu.scrollTop=divMenu.scrollTop-rollleft1.offsetHeight;
//offsetWidth　获取对象相对于版面或由父坐标　offsetParent　属性指定的父坐标的宽度。
}
else{
divMenu.scrollTop--
}
}
var MyMar1=null;
var MyMar2=null;
function Marquee2(){
    if(rollright1.offsetHeight-divMenu.scrollTop<=0)
    {
	    divMenu.scrollTop=divMenu.scrollTop-rollleft1.offsetHeight;
    //offsetWidth　获取对象相对于版面或由父坐标　offsetParent　属性指定的父坐标的宽度。
    }
    else
    {
       divMenu.scrollTop--;
    }
}
var MyMar1=null;
var MyMar2=null;

function ImgUpOver()
{//alert("ImgUpOver");
  MyMar1=setInterval(Marquee1,speed1);
}
function ImgUpOut()
{
   clearInterval(MyMar1);
 }
 function ImgDownOver()
{
  MyMar2=setInterval(Marquee2,speed1);
}
function ImgDownOut()
{
   clearInterval(MyMar2);
 }