﻿/* promoRotate.js */

promoImageList = new Array("images/promos/promo1title.gif",
						"images/promos/promo2title.gif",
						"images/promos/promo3title.gif");
					   
promoTextList = new Array("MessageHEALTH partners with a variety of unique health-related organizations, and in many cases, MessageHEALTH is the only gateway to these organizations, their sites and their users.",
						"These aren't your run-of-the-mill banners. They're multi-dimensional, attracting users through interactivity and the ability to tell a more complete story.",
						"MessageHEALTH advertisers are exclusively health-focused.  We know the space and we share a common interest with advertisers and content providers.");
					   
var promoCounter = 0;

function rotatePromos()
{
	
	setPromo(promoCounter);
	
	promoCounter = promoCounter + 1;
	
	if (promoCounter >= promoImageList.length)
	{
		promoCounter = 0;
	}
	
	setTimeout("rotatePromos()", 7000);
				
}

function setPromo(promoNum)
{
	promoImageElement = document.getElementById("promoImage");
	promoImageElement.src = promoImageList[promoNum];
	
	promoTextElement = document.getElementById("promoText");
	
	theText = document.createTextNode(promoTextList[promoNum]);
	
	if (promoTextElement.firstChild)
	{
		promoTextElement.replaceChild(theText, promoTextElement.firstChild);
	}
	
	else
	{
		promoTextElement.appendChild(theText);
	}
		
}