// Zero based array containing ad links										 
var adURL = new Array("#","#","#","#","#");
var ctime;

function ShowAd(int_AdID)
{
  DisplayAdNavConnector(int_AdID)
 
  // Change out innerhtml with appropriate ad and link
  document.getElementById("adSpace").innerHTML = '<a href="' + adURL[int_AdID - 1] + '">' + 
			'<img width="515px" height="130px" src="images/adbanner' + int_AdID + '.jpg" /></a>';
}

function DisplayAdNavConnector(int_AdID)
{
  // Hide all ad connectors except the one that matches the int_AdId
  for ( var i = 1; i <= 5; i++ )
  {
    if( i != int_AdID ) {
      document.getElementById("adConnector" + i).style.visibility = 'hidden';
    } else {
      document.getElementById("adConnector" + int_AdID).style.visibility = 'visible';
    }
  }
}

// Rotate the ads
function StartAdRotator(int_AdID)
{
  // If we've reached 5 (our max) reset int_AdID
  ShowAd(int_AdID);
  
  if (int_AdID == 5){ 
		int_AdID = 0;	// Zero because we are adding 1 below
	}
  
  ctime = setTimeout( "StartAdRotator(" + (int_AdID + 1) +")", 5000 );
}