window.onload = rotateRandN;

var adImages = new Array("../images/ads/comanche.jpg", 
"../images/ads/larimer.jpg", 
"../images/ads/metrolist.jpg" , 
"../images/ads/1stHomeMtgBC.jpg" , 
"../images/ads/escrow.jpg" , 
"../images/ads/fnt.jpg" ,
"../images/ads/countrywide.gif" , 
"../images/ads/1stcity.jpg" );

var adHref = new Array("http://www.comanchestorage.com/", 
"http://www.co.larimer.co.us/assessor/", 
"http://onemymls.mymls.com/", 
"mailto:firsthomemtg@hotmail.com", 
"mailto:tammy@rmtnescrow.com",
"http://www.stgco.com/stgweb/",  
"http://my.countrywide.com/", 
"http://www.mtggroup.com/" );

var thisAd = 0;
var randomAd=Math.floor(Math.random()*8)  



function rotateSequ() {
	thisAd++;
	if (thisAd == adImages.length) {
		thisAd = 0;
	}

	document.getElementById("adHref").href = adHref[thisAd];
	document.getElementById("adBanner").src = adImages[thisAd];

	setTimeout("rotateSequ()", 4 * 1000);
}



function rotateRand() {
	thisAd = randomAd;

	document.getElementById('adHref').href = adHref[thisAd];
	document.getElementById("adBanner").src = adImages[thisAd];

	setTimeout("rotateRand()", 4 * 1000);

	randomAd=Math.floor(Math.random()*8)  
}




function rotateRandN() {

	if (thisAd == randomAd) { 

		randomAd=Math.floor(Math.random()*8);

	} else { 

		thisAd = randomAd;
	
		document.getElementById('adHref').href = adHref[thisAd];
		document.getElementById("adBanner").src = adImages[thisAd];
	
		randomAd=Math.floor(Math.random()*8);

	}


	setTimeout("rotateRandN()", 4 * 1000);
}
