// JavaScript Document

<!--

///////////////////////////////////////////////////////////////////////////
//NEW ROTATOR CODE 1/25/2007

/*
This script randomly starts the banner rotation. 
What happens is the first banner is loaded and is imediately changed once the page loads. 
To not have the first banner load all the time, you can create a transparent image the same 
size as the other banners and put it in the IMG tag. 
*/

//*******ALSO CHECK LINE 82 FOR NUMBER OF ADS**********
i = 4 // Number of banners that you have // 010108 ONLY FOUR ADS
banner1 = new Image();
banner1.src = "http://www.mbaonline.org/banners/banner1.gif";
banner2 = new Image();
banner2.src = "http://www.mbaonline.org/banners/banner2.gif";
banner3 = new Image();
banner3.src = "http://www.mbaonline.org/banners/banner3.gif";
banner4 = new Image();
banner4.src = "http://www.mbaonline.org/banners/banner5.gif";
//banner4 = new Image();
//banner4.src = "http://www.mbaonline.org/banners/banner4.gif";
//banner5 = new Image();
//banner5.src = "http://www.mbaonline.org/banners/banner5.gif";
//banner6 = new Image();
//banner6.src = "http://www.mbaonline.org/banners/banner6.gif";

links = new Array
links[1] = "http://www.josephdouglashomes.com"
links[2] = "http://www.jeffhorwath.com"
links[3] = "http://www.brookstonehomes.com/mba"
links[4] = "http://www.larosalandscape.com"
//links[5] = "http://www.larosalandscape.com"
//links[6] = "http://www.larosalandscape.com"

description = new Array
description[1] = "Joseph Douglas Fine Home Builders"
description[2] = "Jeff Horwath Family Builders"
description[3] = "Brookstone Homes"
description[4] = "La Rosa Landscape"
//description[5] = "La Rosa Landscape"
//description[6] = "La Rosa Landscape"

function randombanner()
{
	var randomnumber = Math.random();
	i = Math.round( (i - 1) * randomnumber) + 1;
	//FOR JS ERRORS ON PAGES WITH NO ADS//
	if (document.banner != null) {
		document.banner.src = eval("banner" + i + ".src");
	}
	//alert(document.banner);
}

function startTime()
{
	var time= new Date();
	hours= time.getHours();
	mins= time.getMinutes();
	secs= time.getSeconds();
	closeTime = hours * 3600 + mins * 60 + secs;
	closeTime += 5;
	//alert(closeTime);
	if (document.banner != null) { //ADD TO TEST NULL
		Timer(); //THIS WAS WITHOUT THE IF STATEMENT AROUND IT
	} //ADD TO TEST NULL
}

function Timer()
{
	var time = new Date();
	hours = time.getHours();
	mins = time.getMinutes();
	secs = time.getSeconds();
	curTime = hours * 3600 + mins * 60 + secs		
	//alert(curTime + ">=" + closeTime);		
	if (curTime >= closeTime)
	{
		if (i < 4) //number of banners? was 3
		{
			i++;
			document.banner.src = eval("banner" + i + ".src");
		}
		else
		{
			i = 1;
			document.banner.src = eval("banner" + i + ".src");
		}
		startTime();
	}
	else
	{
		window.setTimeout("Timer()",10000) //TEN SECONDS
	}
}

function clickLink()
{
	top.location = links[i]
}

function descript()
{
	window.status = description[i]
}

//NEW ROTATOR CODE 1/25/2007
///////////////////////////////////////////////////////////////////////////