
function adArray() {
	for (i=0; i*2<adArray.arguments.length; i++) {
		this[i] = new Object();
		this[i].src = adArray.arguments[i*2];
		this[i].href = adArray.arguments[i*2+1];
	}
	this.length = i;
}

function getAdNum() {
	dat = new Date();
	dat = (dat.getTime()+"").charAt(2);
	if (dat.length == 1)
	{
		//number below is one less than the number of images in the array
		ad_num =  Math.round(Math.random()*2);
	}
	else
	{
		ad_num = 0;
	}
		
	return ad_num;
}

// Moved to calling page for dynamic loading.
/*var ads = new adArray(
"images/photo_home.jpg","index.html",
"images/photo_home2.jpg","index.html",
"images/photo_home3.jpg","index.html");*/

var ad_num = getAdNum(); 

function setImage(ads)
{
    if (ad_num >= ads.length)
        ad_num = 0;

	document.write('<a href="'+ads[ad_num].href+'" id="bnrAnchor">');
	document.write('<img src="'+ads[ad_num].src+'" '+' border="0" name="banner">');
	document.write('</a>');
	link_num = document.links.length-1;
	setTimeout("rotateSponsor(ads)",8000);
}



function rotateSponsor(ads) {
	if (document.images) {
		//number below is one less than the number of images in the array
		ad_num += 1 // Math.round(Math.random()*2);
		if (ad_num >= ads.length)
			ad_num = 0;
		document.banner.src = ads[ad_num].src;
		document.getElementById('bnrAnchor').href = ads[ad_num].href;
		setTimeout("rotateSponsor(ads)",8000);
	}
}

// Moved to setImage Function
//setTimeout("rotateSponsor()",8000);
