window.onload = initBannerLink;

var adImages = new Array("http://www.siliconvalleypower.com/img/home_promo_balloons.jpg",
//"http://www.siliconvalleypower.com/img/hp_scou_020410.jpg",//
"http://www.siliconvalleypower.com/img/home_promo_rap4.jpg",
"http://www.siliconvalleypower.com/img/home_promo_eia.jpg",
"http://www.siliconvalleypower.com/img/home_promo_scholarship08.jpg",
"http://www.siliconvalleypower.com/img/hp_energyaudit_purp.jpg",
"http://www.siliconvalleypower.com/img/hp_saveyourmoney.jpg",
"http://www.siliconvalleypower.com/img/home_promo_fridge.jpg",
"http://www.siliconvalleypower.com/img/home_promo_tools.jpg",
"http://www.siliconvalleypower.com/img/hp_solaraffordable.jpg",
"http://www.siliconvalleypower.com/img/hp_obp_laptopgra.jpg");
var adURL = new Array("HD35&URL=http://www.siliconvalleypower.com/alerts/?sub=safetytips",
//"HD88&URL=https://www.siliconvalleypower.com/SCUO/Login.aspx",//
"HD32&URL=http://www.siliconvalleypower.com/res/?sub=assist",
"HD29&URL=http://www.siliconvalleypower.com/bus/?doc=eia",
"HD30&URL=http://www.siliconvalleypower.com/scholarship",
"HD107&URL=http://www.siliconvalleypower.com/res/?sub=resaudit",
"HD108&URL=http://www.siliconvalleypower.com/res/?doc=resrebates",
"HD70&URL=http://www.siliconvalleypower.com/res/?sub=rebatesfridge",
"HD34&URL=http://www.siliconvalleypower.com/res/?sub=toollibrary",
"HD109&URL=http://www.siliconvalleypower.com/res/?sub=rebatessolar",
"HD56&URL=https://www.siliconvalleypower.com/SCUO/SignUp_Step1.aspx");
var thisAd = 0;

function rotate() {
	thisAd++;
	if (thisAd == adImages.length) {
		thisAd = 0;
	}
	document.getElementById("adBanner").src = adImages[thisAd];

	setTimeout("rotate()", 5 * 2000);
}

function newLocation() {
	document.location.href = "http://www.siliconvalleypower.com/promoredirect.asp?promoad=" + adURL[thisAd];
	return false;
}

function initBannerLink() {
	if (document.getElementById("adBanner").parentNode.tagName == "A") {
		document.getElementById("adBanner").parentNode.onclick = newLocation;
	}
	
	rotate();
}

						