// Scrolling Message
var scrollingText = "                                                          " +
                    "Welcome to the Salisbury Adventist Church website" +
					"                                                          " +
					"We hope that you will enjoy the things we have to offer here"+
					"                                                          " +
					"Please, let us know if you have any trouble viewing material on our site"+
					"                                                          " +
					"May the Lord bless you and keep you"

function ScrollingMessage() 
{

   document.scrolling.txtScroller.value = scrollingText;
   scrollingText = scrollingText.substring(1) + scrollingText.substring(0,1);
   setTimeout('ScrollingMessage()',100);
}

var msg = ""

// Messages for different days of the week
var Sun = "1 Corinthians 2:9       But as it is written, Eye hath not seen, nor ear heard, neither have entered into the heart of man, the things which God hath prepared for them that love him."
var Mon = "Psalm 18:46         The LORD lives! Blessed be my Rock! Let the God of my salvation be exalted."
var Tues = "Psalm 44:8          In God we boast all day long, And praise Your name forever.  Selah"
var Wed = "2 Samuel 22:47         The LORD lives! Praise be to my Rock! Exalted be God, the Rock, my Savior!"
var Thur = "1 Chronicles 16:34        Give thanks to the LORD, for he is good; his love endures forever."
var Fri = "Hebrews 4:9       There remains, then, a Sabbath-rest for the people of God" 
var Sabbath = "   "

var delay = 40
var startPos = 175
var space = ""

// Date Information
var d=new Date()
var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Sabbath")
var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
var day = (weekday[d.getDay()])
var date = (d.getDate())
var month = (monthname[d.getMonth()])
var year = (d.getFullYear())
var FullDate = "Today is " + day + " " + month + " " + date + ", " + year

// Don't touch these variables:
var timerID = null
var timerRunning = false
var pos = 0


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++) 
    {
	space = " " + space
    }

    
    if (day == "Sunday")
    {
    msg = space + Sun
    }

    if (day == "Monday")
    {
    msg = space + Mon
    }


    if (day == "Tuesday")
    {
    msg = space + Tues
    }

    if (day == "Wednesday")
    {
    msg = space + Wed
    }

    if (day == "Thursday")
    {
    msg = space + Thur
    }

    if (day == "Friday")
    {
    msg = space + Fri
    }

    if (day == "Sabbath")
    {
    msg = space + Sabbath
    }

    // Off we go...
    DoTheScroll()
}

function StopTheClock(){
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function DoTheScroll(){
    if (pos < msg.length)
        self.status = msg.substring(pos, msg.length);
    else
        pos=-1;
    ++pos
    timerRunning = true
    timerID = self.setTimeout("DoTheScroll()", delay)
}

// End Scolling Message

// Timer
var timer = null

function stop()
{
clearTimeout(timer)
}

function start()
{
var time = new Date()
var hours = time.getHours()
var minutes = time.getMinutes()
minutes=((minutes < 10) ? "0" : "") + minutes
var seconds = time.getSeconds()
seconds=((seconds < 10) ? "0" : "") + seconds
var clock = hours + ":" + minutes + ":" + seconds
document.forms[0].display.value = clock
timer = setTimeout("start()",1000)
}

// End Timer

// Date and Day
function ShowDate()
{
document.forms[0].display.value = FullDate
document.forms[0].sermon.value = "" 
}

// End Date and Day