﻿
var Msg=new Array();  
  Msg[0]="<a href=\"http://bbs.pjcyh.com/viewthread.php?tid=77325\">·[公告] 辽河车友运动俱乐部（盘锦车友会）电台直频重新确定 </a>";
  Msg[1]="<a href=\"http://bbs.pjcyh.com/viewthread.php?tid=77220\">·参加车友会需要交纳会费吗? </a>";
  Msg[2]="<a href=\"http://bbs.pjcyh.com/viewthread.php?tid=78069\">·顺通卡商家名录(及时更新……)</a>";

var MsgInterval=new Array();  //定义一些常用而且要经常用到的变量
var MsgId=0;
var MsgDelay=5000;
var MsgHeight=18;

function initMarquee() {
var str=Msg[0];
var ss;
    ss = "<div id=\"marqueeBox\" onmouseover=\"clearInterval(MsgInterval[0]);\" "
    ss += "onmouseout=\"MsgInterval[0]=setInterval(\'startMarquee();\'";
    ss +=", MsgDelay); \"><div>" + str + "</div></div>"
    document.write(ss);
    MsgId ++;
    MsgInterval[0] = setInterval("startMarquee()", MsgDelay);
}
function startMarquee() {
var str=Msg[MsgId];
    MsgId++;
    if(MsgId>=Msg.length) MsgId=0;
    if(marqueeBox.childNodes.length==1) {
        var nextLine=document.createElement('DIV');
        nextLine.innerHTML=str;
         marqueeBox.appendChild(nextLine);
    } else {
        marqueeBox.childNodes[0].innerHTML=str;
        marqueeBox.appendChild(marqueeBox.childNodes[0]);
        marqueeBox.scrollTop=0;
    }
    clearInterval(MsgInterval[1]);
    MsgInterval[1]=setInterval("scrollMarquee()",50);
}
function scrollMarquee() {
    marqueeBox.scrollTop++;
    if(marqueeBox.scrollTop%MsgHeight==(MsgHeight-1)){
        clearInterval(MsgInterval[1]);
    }
}
initMarquee();
