﻿// change this to where you store the blank.gif image

topedge = 145;  // location of news box from top of page
leftedge = 0;  // location of news box from left edge
boxheight = 138;  // height of news box
boxwidth = 0;  // width of news box
scrollheight = 310; // total height of all data to be scrolled
cscroll1 = false;
cscroll2 = false;
cscroll3 = false;
cliptopblock1 = 0;
cliptopblock2 = 0;
cliptopblock3 = 0;
timer1on = 1;
timer2on = 1;
timer3on = 1;
read = false;
tri = 0;

scrollPosition = 0;

function scrollnews(cliptop, divName) {
    var x = document.getElementById("ctl00_imgBlock1");

    if (x == null) {
        if (document.layers) {
            newsDiv = document.getElementById(divName);
            newsDiv.clip.top = cliptop;
            newsDiv.clip.bottom = cliptop + boxheight;
            newsDiv.clip.left = 0;
            newsDiv.clip.right = boxwidth + leftedge;
            newsDiv.left = leftedge;
            newsDiv.top = topedge - cliptop;
        }
        else {
            newsDiv = document.getElementById(divName).style;
            newsDiv.pixelLeft = leftedge;
            newsDiv.pixelTop = topedge - cliptop;

        }

        newsDiv.visibility = 'visible';
    }
}




var speed = 50;
function scrollnewsBlock1() {
    timer1on--;
    if (cscroll1) {
        if (timer1on == 0) {
            scrollnews(cliptopblock1, "Block1")
            cliptopblock1 = (cliptopblock1 + 1) % (scrollheight + boxheight);
            //sp1.innerHTML = cliptopblock1;
            setTimeout("scrollnewsBlock1();", speed);
            timer1on++;
            //Span1.innerHTML = "scrolling";
        }
//        else
//            //Span1.innerHTML = "passsrcoll";
    }
//    else
//        Span1.innerHTML = timer1on + " " + cscroll1;
}
function scrollnewsBlock2() {
    timer2on--;
    if (cscroll2) {

        if (timer2on == 0) {
            scrollnews(cliptopblock2, "Block2")
            cliptopblock2 = (cliptopblock2 + 1) % (scrollheight + boxheight);
            setTimeout("scrollnewsBlock2();", speed);
            timer2on++;
        }
    }
}
function scrollnewsBlock3() {
    timer3on--;
    if (cscroll3) {

        if (timer3on == 0) {
            scrollnews(cliptopblock3, "Block3")
            cliptopblock3 = (cliptopblock3 + 1) % (scrollheight + boxheight);
            setTimeout("scrollnewsBlock3();", speed);
            timer3on++;
        }
    }
}




function contmove(divName) {
    if (cscroll1 == false) {
        if (divName == "Block1") {
            cscroll1 = true;
            if (timer1on < 1) {
                timer1on = 1;
                scrollnewsBlock1();
                Span1.innerHTML = "scroll";
            }
            else {
                Span1.innerHtml = "waiting";
                setTimeout("contmove('" + divName + "');", speed);
            }
        }
    }
    if (cscroll2 == false) {
        if (divName == "Block2") {
            cscroll2 = true;
            if (timer2on < 1) {
                timer2on = 1;
                scrollnewsBlock2();
            }
            else
                setTimeout("contmove('" + divName + "');", speed);
        }
    }
    
    if (cscroll3 == false) {
        if (divName == "Block3") {
            cscroll3 = true;
            if (timer3on < 1) {
                timer3on = 1;
                scrollnewsBlock3();
            }
//            else
//                setTimeout("contmove('" + divName + "');", speed);
        }
    }
}

function stopBlock(divName) {
    
    if (divName == "Block1") 
        cscroll1 = false;
    if (divName == "Block2")
        cscroll2 = false;
    if (divName == "Block3")
        cscroll3 = false;
}


function ShowModal(frameUrl) {
    var frame = document.getElementById("iframeNews");

    frame.src = frameUrl;
    var popup = $find('ModalPopUpBehavior');
    popup.show();

}

function startscrollnews() {
    cscroll1 = true;
    cscroll2 = true;
    cscroll3 = true;
    cliptopblock1 = 0;
    cliptopblock2 = 0;
    cliptopblock3 = 0;
    timer1on = 1;
    timer2on = 1;
    timer3on = 1;
    
    scrollnewsBlock1();
    scrollnewsBlock2();
    scrollnewsBlock3();

}

function startNews() {
    setTimeout('startscrollnews();', 15000);
}


