addOnload(rotate);
addOnload(initBannerLink);


function addOnload(newFunction) {
	var oldOnload = window.onload;
	
	if (typeof oldOnload == "function") {
		
		window.onload = function() {
			if (oldOnload) {
				oldOnload();
			}
			newFunction();
		}
	}
	else {
		window.onload = newFunction;
	} 
}

var thisAd = 0;

function rotate() {
	var adImages = new Array("images/WANTED.png","images/WANTED2.png","images/WANTED3.png");

	thisAd++;
	if (thisAd == adImages.length) {
		thisAd = 0;
	}
	document.getElementById("adBanner").src = adImages[thisAd];

	setTimeout(rotate, 5 * 1000);
}



var thisAd2 = 0;

function initBannerLink() {
	if (document.getElementById("rotatingPhoto").parentNode.tagName == "A") {
		document.getElementById("rotatingPhoto").parentNode.onclick = newLocation;
	}
	
	rotate2();
}

function newLocation() {
	var adURL2 = new Array("activities/championship_golf.html",<!--"activities/rodeo.html"--> 
						   "activities/recreation.html","activities/championship_golf.html","activities/horseback_riding.html","activities/horseback_riding.html","activities/indoor_waterpark.html","activities/indoor_waterpark.html","activities/activities.html","lodging/logHomes.html","lodging/thoroughbred_suits.html","activities/indoor_waterpark.html");
	document.location.href = "" + adURL2[thisAd2];
	return false;
}

function rotate2() {
	var adImages2 = new Array("images/home_rotatingPhoto/arthur_hills_designed_golf_course.jpg",<!--"images/home_rotatingPhoto/rodeo.jpg"-->
							  ,"images/home_rotatingPhoto/rotatingPhoto_pic1.jpg","images/home_rotatingPhoto/championship_golf_naturally.jpg","images/home_rotatingPhoto/city_slickers_welcome.jpg","images/home_rotatingPhoto/guided_trail_rides.jpg","images/home_rotatingPhoto/heart_racing_action.jpg","images/home_rotatingPhoto/indoor_family_raft_ride.jpg","images/home_rotatingPhoto/michigan_sunsets.jpg","images/home_rotatingPhoto/rustic_stays_in_log_homes.jpg","images/home_rotatingPhoto/thoroughbred_accommodations.jpg","images/home_rotatingPhoto/thrill_slides_galore.jpg");

	thisAd2++;
	if (thisAd2 == adImages2.length) {
		thisAd2 = 0;
	}
	document.getElementById("rotatingPhoto").src = adImages2[thisAd2];

	setTimeout(rotate2, 3 * 1000);
}

