var pos = new Array(1, 2, 3);
   
   function replaceImg(n, r) {
      document[n].src = "/images/webex2007_v2/" + r;
   }
   
   function overTopic(num) {
      tabName = "tab" + num;
      curTab = "/images/webex2007_v2/topics/topic_tab_mid_" + pos[num - 1] + ".gif";
      
      document[tabName].src = curTab;
   }

   function offTopic(num) {
      tabName = "tab" + num;
      curTab = "/images/webex2007_v2/topics/topic_tab_gray_" + pos[num - 1] + ".gif";
      
      document[tabName].src = curTab;
   }
   
   function selectTopic(num) {
      
      selectedPos = pos[num - 1];
      tabName = "tab" + num;
      photoName = "photo" + num;
      curText = "topic" + pos[0] + "_text";
      nextText = "topic" + pos[num - 1] + "_text";
   
      curTab = "/images/webex2007_v2/topics/topic_tab_green_" + selectedPos + ".gif";
      curPhoto = "/images/webex2007_v2/topics/topic_photo_l_" + selectedPos + ".jpg";
   
      replaceTab = "/images/webex2007_v2/topics/topic_tab_mid_" + pos[0] + ".gif";
      replacePhoto = "/images/webex2007_v2/topics/topic_photo_s_" + pos[0] + ".jpg";
      
      document[tabName].src = replaceTab;
      document[photoName].src = replacePhoto;
      
      
      document.getElementById('topic1').style.background = "url(" + curPhoto + ")";
      document.getElementById('tab1').style.background = "url(" + curTab + ")";
      
      new Effect.Opacity("topic_text_bg", {duration:1, from:0, to:.9});
      new Effect.Opacity(curText, {duration:0, from:0, to:0});
      new Effect.Opacity(nextText, {duration:0, from:0, to:1});
      
      
      document.getElementById(curText).className = 'text_off';
      document.getElementById(nextText).className = 'text_on';
      
      
      pos[num - 1] = pos[0];
      pos[0] = selectedPos;
      
     // topic1_text
      
   }


   function preload() {
      if (document.images)
      {
         var preload_image_object = new Image();
         // set image url
        var image_url = new Array();
         image_url[0] = "/images/webex2007_v2/topic_photo_l_2.jpg";
         image_url[1] = "/images/webex2007_v2/topic_photo_l_3.jpg";         
         image_url[2] = "/images/webex2007_v2/topic_photo_s_1.jpg";
         image_url[3] = "/images/webex2007_v2/topic_tab_gray_1.gif";
         image_url[4] = "/images/webex2007_v2/topic_tab_green_2.gif";
         image_url[5] = "/images/webex2007_v2/topic_tab_green_3.gif";
         image_url[6] = "/images/webex2007_v2/topic_tab_mid_1.gif";
         image_url[7] = "/images/webex2007_v2/topic_tab_mid_2.gif";
         image_url[8] = "/images/webex2007_v2/topic_tab_mid_3.gif";
         image_url[9] = "/images/webex2007_v2/home_call_btn2.jpg";
         image_url[10] = "/images/webex2007_v2/nav_confprog2.gif";
         image_url[11] = "/images/webex2007_v2/nav_confprog3.gif";
         image_url[12] = "/images/webex2007_v2/nav_connect2.gif";
         image_url[13] = "/images/webex2007_v2/nav_connect3.gif";
         image_url[14] = "/images/webex2007_v2/nav_expo2.gif";
         image_url[15] = "/images/webex2007_v2/nav_expo3.gif";
         image_url[16] = "/images/webex2007_v2/nav_media2.gif";
         image_url[17] = "/images/webex2007_v2/nav_media3.gif";
         image_url[18] = "/images/webex2007_v2/nav_registration2.gif";
         image_url[19] = "/images/webex2007_v2/nav_registration3.gif";
         image_url[20] = "/images/webex2007_v2/nav_speaker2.gif";
         image_url[21] = "/images/webex2007_v2/nav_speaker3.gif";
         image_url[22] = "/images/webex2007_v2/nav_sponsor2.gif";
         image_url[23] = "/images/webex2007_v2/nav_sponsor3.gif";
   
         var i = 0;
         for(i=0; i<=23; i++) {
            preload_image_object.src = image_url[i];
         }
      }
   }           

function randomImg(n, prefix) {
	//Generate a random number from 1 to n
	var ranNum = Math.floor(Math.random() * n) + 1;
	
	//Create the random id by concatenating the prefix and the random number
	var id = prefix + ranNum;
	
	if (document.getElementById(id)) {
		document.getElementById(id).style.display = 'inline';
	}
}
