
// All page-specific strings and data reside in this function
function setVariables() {
      /**********************************************************/
      /***** List of ads *************************************/
      /**********************************************************/
    //Two elements in these arrays: ad image, ad URL
      //(With more time, to  be replaced by ASP.Net ad rotator/AJAX
    ads[0] = new Array("/resources/neutral/ad1.jpg", "/en/demos/DynamicWebTemplates.aspx", "Dynamic Web Templates training");
    ads[1] = new Array("/resources/neutral/ad2.jpg", "/en/demos/AdobeCaptivate3.aspx", "Adobe Captivate 3 training");
    //ads[2] = new Array("/resources/neutral/ad3.jpg", "http://www.granitepillar.com", "Granite Pillar web site");
    adIndex = 0;
    adsLength = ads.length;
}

/************************************************************************/
/*** No changes needed below this point *********************************/
/************************************************************************/
var ads;
var adsLength;
var adIndex;

function OnLoad()
{
       initializeData();
       instantiateData();

       updateAd(); 
       //start the timer
	   timerInit();
	   
//	   document.mediaPlayer.ClosedCaption.captioningID = 'captions';
}

function initializeData()
{
       ads = new Array();       
}

function instantiateData()
{
       setVariables();
}


function timerInit() 
{
   //Sets the timer to rotate the ad every 10 seconds
   window.setInterval("updateAd()", 10000);
}

function updateAd() {
    var inner = "<a href=\"" + ads[adIndex][1] + "\"><img border=\"0\" alt=\"" + ads[adIndex][2] + "\" src=\"" + GetAdImage(adIndex) + "\"></a>";
    //alert(inner);     
    document.getElementById('Sidebar').innerHTML = inner;  
    //document.getElementById('Sidebar').style.backgroundImage = GetAdImage(adIndex);
    updateAddIndex();
}

function GetAdImage(i) {
    return ads[i][0];
}
function updateAddIndex() {
    adIndex++;
    if (adIndex == adsLength) {
        adIndex = 0;
    }
}



