function tiker(objName) {

    var m_objName = objName;
    var m_ClientID = objName.substring(6)
    var m_isFirstTime = true;
    var m_DoRoll = null;
    this.Init = Tck_Init;
    this.Tck_Roll = Tck_Roll;
    this.Start = Tck_startRoll;
    this.Stop = Tck_stopRoll;

    function Tck_Roll() {

        if (window.document.readyState != 'undefined' &&
                window.document.readyState == 'complete' &&
               m_isFirstTime) {
            m_isFirstTime = false;
            Tck_Init();
        }

        var elaps = 40;
        a = document.getElementById(m_ClientID + '_aTicker');
        if (a == null) a = document.getElementById('aTicker'); //irit
        b = document.getElementById(m_ClientID + '_bTicker');
        if (b == null) b = document.getElementById('bTicker'); //irit

        //window.status = (a.style.top + " " + b.style.top)
        a.style.top = parseInt(a.style.top) - 1 + "px";
        b.style.top = parseInt(b.style.top) - 1 + "px";

        var divRoll = document.getElementById('divRoll');

        //dvori 29/12/2008 for barilan
        if (parseInt(a.style.top) < -a.offsetHeight) {
            //   alert(a.offsetHeight);
            //   alert(divRoll.currentStyle.height);
            a.style.top = a.offsetHeight + parseInt(b.style.top) + "px"; //+ (parseInt(divRoll.currentStyle.height)/10);
            //	    alert(a.style.top);
            //        alert(b.style.top);	
        }
        if (parseInt(b.style.top) < -b.offsetHeight) {
            //    alert(b.offsetHeight);
            //   alert(divRoll.currentStyle.height);
            b.style.top = b.offsetHeight + parseInt(a.style.top) + "px"; //+ (parseInt(divRoll.currentStyle.height)/10);

            //       alert(a.style.top);
            //       alert(b.style.top);	
        }

    }
    function Tck_startRoll() {
        if (m_DoRoll)
            return;

        m_DoRoll = setInterval(m_objName + ".Tck_Roll()", 40);
    }
    function Tck_stopRoll() {
        clearInterval(m_DoRoll);
        m_DoRoll = null;
    }

    function Tck_Init() {
        a = document.getElementById(m_ClientID + '_aTicker');

        //	    if(a==null) a=document.getElementById('aTicker'); //irit
        b = document.getElementById(m_ClientID + '_bTicker');

        //    var divRoll=document.getElementById('divRoll');
        //	    if(b==null) b=document.getElementById('bTicker');

        b.innerHTML = a.innerHTML;

        a.style.top = 130 + "px";
        b.style.top = a.offsetHeight + parseInt(a.style.top) + "px"; // + (parseInt(divRoll.currentStyle.height)/10);

        if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
            a.style.position = "relative";
            b.style.position = "relative";
        }

        Tck_startRoll();
    }
}


function roller(objName) {
    var m_variableName = objName + "_jsObject";
    var m_objName = objName;

    var ie = document.all;
    var dom = document.getElementById;
    var scrollerdelay = '6000';  //delay between msg scrolls. 1000=1 second.
    var scrollerwidth = '170px';
    var scrollerheight = '90px';
    var scrollerbgcolor = 'white';
    var i = 0;

    var stringtest = document.getElementById(objName + "_span").innerHTML;
    var messages = stringtest.split("*");
    this.doScroll = scroll;
    this.doMove = move;
    this.doMove2 = move2;

    function scroll() {

        if (messages.length > 2)
            i = 2
        else
            i = 0


        if (ie || dom) {

            document.writeln('<div id="' + m_objName + 'main2" style="position:relative;width:' + scrollerwidth + ';height:' + scrollerheight + ';overflow:hidden;">')
            document.writeln('<div style="position:absolute;width:' + scrollerwidth + ';height:' + scrollerheight + ';clip:rect(0 ' + scrollerwidth + ' ' + scrollerheight + ' 0);left:0px;top:0px">')
            document.writeln('<div id="' + m_objName + '_first2" style="position:absolute;width:' + scrollerwidth + ';left:0px;top:1px;">')
            document.write(messages[0])
            document.writeln('</div>')
            document.writeln('<div id="' + m_objName + '_second2" style="position:absolute;width:' + scrollerwidth + ';left:0px;top:0px;visibility:hidden">')
            document.write(messages[dyndetermine = (messages.length == 1) ? 0 : 1])

            document.writeln('</div>')
            document.writeln('</div>')
            document.writeln('</div>')
        }

        if (window.addEventListener)
            window.addEventListener("load", startscroll, false)
        else if (window.attachEvent)
            window.attachEvent("onload", startscroll)
        else if (ie || dom)
            window.onload += startscroll



    }



    function move(whichdiv) {

        tdiv = eval(whichdiv)

        if (parseInt(tdiv.style.top) > 0 && parseInt(tdiv.style.top) <= 5) {

            tdiv.style.top = 0 + "px"

            setTimeout(m_variableName + ".doMove(tdiv)", scrollerdelay)
            setTimeout(m_variableName + ".doMove2(second2_obj)", scrollerdelay)
            return
        }


        if (parseInt(tdiv.style.top) >= tdiv.offsetHeight * -1) {

            tdiv.style.top = parseInt(tdiv.style.top) - 5 + "px"
            setTimeout(m_variableName + ".doMove(tdiv)", 50)
        }
        else {

            tdiv.style.top = parseInt(scrollerheight) + "px"
            tdiv.innerHTML = messages[i]
            if (i == messages.length - 1)
                i = 0
            else
                i++
        }
    }

    function move2(whichdiv) {

        tdiv2 = eval(whichdiv)
        if (parseInt(tdiv2.style.top) > 0 && parseInt(tdiv2.style.top) <= 5) {

            tdiv2.style.top = 0 + "px"
            setTimeout(m_variableName + ".doMove2(tdiv2)", scrollerdelay)
            setTimeout(m_variableName + ".doMove(first2_obj)", scrollerdelay)
            return
        }

        if (parseInt(tdiv2.style.top) >= tdiv2.offsetHeight * -1) {

            tdiv2.style.top = parseInt(tdiv2.style.top) - 5 + "px"
            setTimeout(m_variableName + ".doMove2(second2_obj)", 50)
        }
        else {

            tdiv2.style.top = parseInt(scrollerheight) + "px"
            tdiv2.innerHTML = messages[i]
            if (i == messages.length - 1)
                i = 0
            else
                i++
        }
    }

    function startscroll() {

        first2_obj = document.getElementById(m_objName + '_first2')

        second2_obj = document.getElementById(m_objName + '_second2')



        move(first2_obj)


        second2_obj.style.top = scrollerheight
        second2_obj.style.visibility = 'visible'
    }
}

