﻿// JScript File

function margueeLR(div,div1,div2)
{
    var speed=30
    
    div2.innerHTML=div1.innerHTML
    
    function Marquee4()
    {
        if(div2.offsetWidth-div.scrollLeft<=0)
            div.scrollLeft-=div1.offsetWidth
        else
        {
              div.scrollLeft++
        }
        
    }
    
    var MyMar4=setInterval(Marquee4,speed)
    
    div.onmouseover=function() {clearInterval(MyMar4)}
    
    div.onmouseout=function() {MyMar4=setInterval(Marquee4,speed)}
}


function margueeDU(divdu,divdu1,divdu2)
{
    var speed=30
    
    divdu2.innerHTML=divdu1.innerHTML
    
    function Marquee1()
    {        
        if(divdu2.offsetHeight-divdu.scrollTop<=0)
            divdu.scrollTop-=divdu1.offsetHeight
        else
        {
            divdu.scrollTop++
        }             
    }
    
    var MyMar1=setInterval(Marquee1,speed)
    
    divdu.onmouseover=function() {clearInterval(MyMar1)}
    
    divdu.onmouseout=function() {MyMar1=setInterval(Marquee1,speed)}
}


/*the roll advert on the top */

var act;
function over(s,w)
{
  var objhidden=document.getElementById(w);
  objhidden.style.display="none";
  
  var obj=document.getElementById(s);  
  obj.style.display="block";
  
  if(obj.style.height=="0px")
    obj.style.height=document.getElementById("imgSmall").height;
    
  var nMax=document.getElementById("imgBig").height;
  
  var h = parseInt(obj.offsetHeight);
  if (h < nMax){
    obj.style.height = (h + 2)+"px";
    clearTimeout(act);
    act = setTimeout("over('"+s+"','"+w+"',"+nMax+")", 10);
  }
}

function out(s,w)
{  
  var obj=document.getElementById(s);
  var h = parseInt(obj.offsetHeight);
  
  var nMin=document.getElementById("imgSmall").height;
  
  if (h > nMin)
  {
    obj.style.height = (h - 2)+"px";
    clearTimeout(act);
    act = setTimeout("out('"+s+"','"+w+"',"+nMin+")", 10);
  }
  else  
  {
  var objhidden=document.getElementById(w);
  objhidden.style.display="block";
  obj.style.display="none";
  }
}


function MarqueeTD(obj)
{
var Mar = document.getElementById(obj);
var child_div=Mar.getElementsByTagName("div")
var picH = 52;//移动高度
var scrollstep=3;//移动步幅,越大越快
var scrolltime=20;//移动频度(毫秒)越大越慢
var stoptime=3000;//间断时间(毫秒)
var tmpH = 0;
Mar.innerHTML += Mar.innerHTML;

function start()
{
  if(tmpH < picH){
    tmpH += scrollstep;
    
    if(tmpH > picH )
      tmpH = picH ;

    Mar.scrollTop = tmpH;
    
    setTimeout(start,scrolltime);
  }
  else{
    tmpH = 0;
    
    Mar.appendChild(child_div[0]);
    
    Mar.scrollTop = 0;
    
    setTimeout(start,stoptime);
  }
}
setTimeout(start,stoptime);
}