var currentPage='home';

function changePage(pageName)
{
	if(Content.location)
	{
		var href=Content.location.href
		if(href.indexOf('?')!=-1)
		{
			href=href.substr(0,href.indexOf('?'));
		}
		if(href.indexOf('/')!=-1)
		{
			href=href.substr(0,href.lastIndexOf('/')+1);
		}

		document.getElementById(currentPage).className='button';
		document.getElementById(currentPage+'-a').className='button';
		document.getElementById(pageName).className='selected';
		document.getElementById(pageName+'-a').className='selected';
		currentPage=pageName;
		if(pageName!='contact' && pageName!='home' && pageName!='samples')pageName='construction';
		if(Content.location!=href + pageName + '.html')Content.location= href + pageName + '.html';
	}
	else
	{
		//Missing Content IFrame - may want to alert user? Hopefully won't occur...
	}

}


//scrolling status bar code below:

// Use the following three variables to set up the message:
var msg = ""//"Welcome to DecksPlus, your reliable, high-quality decking and garden maintenance company"
var delay = 100
var startPos = 100

// Don't touch these variables:
var timerID = null
var timerRunning = false
var pos = 0
var scrolls = 0

// 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 (pos <= startPos)
        self.status = msg.substring(pos, msg.length)
    else
    {
        StopTheClock()
        return
    }
    ++pos
    timerRunning = true
    timerID = self.setTimeout("DoTheScroll()", delay)
}

function validateMail()
{
	if(document.forms[0].email.value=='')
	{
		alert('Please enter an email address');
	}
	else
	{
		document.forms[0].submit();
	}
}

//scrolling status bar code above!
