//pre-loaded images
var roomflash = new Image();
roomflash.src = 'Pictures/flash/room4.JPG';
var stairsflash = new Image();
stairsflash.src = 'Pictures/flash/stairs2.JPG';
var deckflash = new Image();
deckflash.src = 'Pictures/flash/deck13.JPG';
var livingflash = new Image();
livingflash.src = 'Pictures/flash/living1.JPG';
var roofflash = new Image();
roofflash.src = 'Pictures/flash/roof10.JPG';

function makeAd(c,l,f,i){
	this.copy = c;
	this.link = l;
	this.follow = f;
	this.img = i;
	this.write = writeAd;
}

function writeAd(){
	var str = '';
	str += '<a href="' + this.link + '">';
	str += '<img border="0" src="' + this.img.src + '"></a><br>';
	str += this.copy + '<br>';
        str +=  '<a href="' + this.link + '">' + this.follow + '</a>';
	return str;
}

var adArray = new Array();
adArray[0] = new makeAd("",'bedrooms.html','',roomflash).write();

adArray[1] = new makeAd("",'stairs.html','',stairsflash).write();

adArray[2] = new makeAd("",'livingrooms.html','',livingflash).write();

adArray[3] = new makeAd("",'decks.html','',deckflash).write();

adArray[4] = new makeAd("",'roofing.html','',roofflash).write();

var nIndex = 0;
var timerID = null;
function rotateAd(){
	var len = adArray.length;
	if(nIndex >= len)
		nIndex = 0;
	document.getElementById('stories').innerHTML = adArray[nIndex];
	nIndex++;
	timerID = setTimeout('rotateAd()',5000);
}
function pauseAd() {
	if (timerID != null) {
		clearTimeout(timerID);
		timerID = null;
	}
}

function playAd() {
	if (timerID == null) {
		timerID = setTimeout('rotateAd()', 1000);
	}
}
//End of banner ad scripts

//The goPage() fucntion determines which page is selected and goes to it.
function goPage(form) {
	var i = form.jumpMenu.selectedIndex;
	if (i != 0) {
		window.location = urls[i];
	}
}
