var i = 1;

var BlankImage = new Image();
BlankImage.src = "../../banimg/transparent.gif";

function getRandom(maxPic) {
     randNum = 0;
     while (randNum == i || randNum < 1) {
        randNum = (Math.round((Math.random() * maxPic)));
     } 
     return randNum;
}

function Initialize(){

        var time= new Date();
        hours= time.getHours();
        mins= time.getMinutes();
        secs= time.getSeconds();
        closeTime=hours*3600+mins*60+secs;
        Timer();
}

function startTime(){

        var time= new Date();
        hours= time.getHours();
        mins= time.getMinutes();
        secs= time.getSeconds();
        closeTime=hours*3600+mins*60+secs;
        closeTime+=3;    // How many seconds til the next rotation
        Timer();
}

function Timer(){
        var time= new Date();
        hours= time.getHours();
        mins= time.getMinutes();
        secs= time.getSeconds();
        curTime=hours*3600+mins*60+secs
        if (curTime>=closeTime){
        
        i = getRandom(TotalBan);
        
        var tmpW = imgWidth[i];  //eval("banner" + i).width;
        var tmpH = imgHeight[i];  //eval("banner" + i).height;
        if (tmpH > 70) {
            tmpW = ((70 / tmpH) * tmpW);
            tmpH = 70;
            
        }
        if (tmpW > 570) {
            tmpH = ((570 / tmpW) * tmpH);
            tmpW = 570;
        }
        document.SlideShow.src = eval("banner" + i + ".src");
        document.SlideShow.width = tmpW;
        document.SlideShow.height = tmpH;
        startTime();
    }
        else{
                window.setTimeout("Timer()",1000)}
}

function clickLink(){
    link = window.open(links[i])

}

