// STATUS BAR CLOAK AND BOUNCE MESSAGE

var msg = "Every Business Needs IT!"
var delay = 50
var startPos = 100

// Don't touch these variables:
var timerID = null
var timerRunning = false
var pos = 0
var dir = 1
var msgLength = msg.length

// Crank it up!
StartScrolling()

function StartScrolling(){
    // Make sure the clock is stopped
    StopTheClock()

    // Pad the message with spaces to get the "start" position
    for (var i = 0; i < startPos; i++) msg = " " + msg

    // Off we go...
    DoTheScroll()
}

function StopTheClock(){
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function DoTheScroll(){
    if (dir == 1){
        if (pos <= startPos)
            self.status = msg.substring(pos, msg.length);
        else
            dir = -1;
    }
    else{
        if (pos >= msgLength)
            self.status = msg.substring(pos, msg.length);
        else
            dir = 1;
    }
    pos = pos + dir
    timerRunning = true
    timerID = self.setTimeout("DoTheScroll()", delay)
}
