function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=4) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		donate_over = newImage("images/donate-over.jpg");
		about_us_over = newImage("images/about-us-over.jpg");
		research_labs_over = newImage("images/research-labs-over.jpg");
		clinical_trials_over = newImage("images/clinical-trials-over.jpg");
		scientists_over = newImage("images/scientists-over.jpg");
		resources_over = newImage("images/resources-over.jpg");
		preloadFlag = true;
	}
}

function clearText(field)
{
    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
}


	var iPromoCount = 4;
	var iPromoTemp = 0;
	
	function LoadTopPromo(){
	
	
	imageSourceTop = new Array(10);
	textHrefTopPromo = new Array(10);		
	textImageTopPromo = new Array(10);			
	
	imageSourceTop[1] = new Image();
	imageSourceTop[1].src = "images-site/side-bar/2012-Race-Painting.jpg";
	textHrefTopPromo[1] = "<a href='http://www.retinafoundation.org/events-2012-race.html'>";
	textImageTopPromo[1] = "alt='Click here to Read More' title='2012 Racing for Sight'";

	if (iPromoCount >= 2 ){		
	imageSourceTop[2] = new Image();
	imageSourceTop[2].src = "images-site/side-bar/ExxonMobil-Logo.jpg";
	textHrefTopPromo[2] = "<a href='http://www.retinafoundation.org/resources-jobs.html'>";
	textImageTopPromo[2] = "alt='Click for Internship Application Info' title='Click for Internship Application Info'";	
	}		
	if (iPromoCount >= 3 ){
	imageSourceTop[3] = new Image();
	imageSourceTop[3].src = "images-site/side-bar/Nutrition.jpg";
	textHrefTopPromo[3] = "<a href='http://www.retinafoundation.org/nutrition1.html'>";
	textImageTopPromo[3] = "alt='Toddler Nutrition Study' title='Toddler Nutrition Study'";	
	}
	if (iPromoCount >= 4 ){		
	imageSourceTop[4] = new Image();
	imageSourceTop[4].src = "images/info_copy_block.jpg";
	textHrefTopPromo[4] = "<a href='http://www.retinafoundation.org/video-about-us.html'>";
	textImageTopPromo[4] = "alt='Click for Video About Us' title='Click for Video About Us'";	
	}
	if (iPromoCount >= 5 ){				
	imageSourceTop[5] = new Image();
	imageSourceTop[5].src = "images-site/side-bar/ExxonMobil-Logo.jpg";
	textHrefTopPromo[5] = "<a href='http://www.retinafoundation.org/resources-jobs.html'>";
	textImageTopPromo[5] = "alt='Click for Internship Application Info' title='Click for Internship Application Info'";	
	}
	if (iPromoCount >= 6 ){				
	imageSourceTop[6] = new Image();
	imageSourceTop[6].src = "images/image3.jpg";
	textHrefTopPromo[6] = "<a target='RSVP for 2010 Race for Sight' href='http://www.retinafoundation.org/events-2010-race-rsvp.html'>";
	textImageTopPromo[6] = "alt='RSVP for 2010 Race for Sight' title='RSVP for 2010 Race for Sight'";
	}
	if (iPromoCount >= 7 ){				
	imageSourceTop[7] = new Image();
	imageSourceTop[7].src = "images/image1.jpg";
	textHrefTopPromo[7] = "<a target='Race For Sight 2010' href='http://www.retinafoundation.org/events-2010-race-event-page.html'>";
	textImageTopPromo[7] = "alt='Race For Sight 2010' title='Race For Sight 2010'";
	}
	if (iPromoCount >= 8 ){				
	imageSourceTop[8] = new Image();
	imageSourceTop[8].src = "images/image2.jpg";
	textHrefTopPromo[8] = "<a target='2010 Race for Sight Auction Items' href='http://www.retinafoundation.org/events-2010-race-auction.html'>";
	textImageTopPromo[8] = "alt='2010 Race for Sight Auction Items' title='2010 Race for Sight Auction Items'";
	}
	if (iPromoCount >= 9 ){				
	imageSourceTop[9] = new Image();
	imageSourceTop[9].src = "images/image3.jpg";
	textHrefTopPromo[9] = "<a target='RSVP for 2010 Race for Sight' href='http://www.retinafoundation.org/events-2010-race-rsvp.html'>";
	textImageTopPromo[9] = "alt='RSVP for 2010 Race for Sight' title='RSVP for 2010 Race for Sight'";
	}
	if (iPromoCount >= 10 ){				
	imageSourceTop[10] = new Image();
	imageSourceTop[10].src = "images/image1.jpg";
	textHrefTopPromo[10] = "<a target='Race for Sight 2010' href='http://www.retinafoundation.org/events-2010-race-event-page.html'>";
	textImageTopPromo[10] = "alt='Race for Sight 2010' title='Race for Sight 2010'";
	}





	
	updateTopPromo();
	
	}

	function updateTopPromo()
	{	
		iPromoTemp = iPromoTemp + 1;
		if (iPromoTemp > iPromoCount)
		{
			iPromoTemp = 1;
		}	
		var eleTopPromoSpan = document.getElementById("TopPromoSpan");
		eleTopPromoSpan.innerHTML = textHrefTopPromo[iPromoTemp] + "<img src='" + imageSourceTop[iPromoTemp].src + "'" + textImageTopPromo[iPromoTemp] + " /></a>";
		var timerID = setTimeout("updateTopPromo()", 4500);
	}



