var objImages = new Array();
var PreLoadedImages = new Array()
var CurrentAd=0;
var FadeDuration = 2
function ObjImage(){

}
function BannerInitialize(){
  var i=13;
  var BannersCount=13; //Modify this count
  var BannerDisplayMilliseconds = 1000;
  
  for (i=0; i < BannersCount; ++i ){
  	objImages[i]= new ObjImage;  	
  }
  //Modify this part alone.
  //FileName -> Actual gif/jpeg to be displayed
  //Number -> ex 5 (number of seconds the banner should be displayed)
  //target -> where the actual site is loaded _self=loads in the same window/location
  // _new -> opens a new window and the location is set to the appropriate website
  //href: website url.

  objImages[0].filename='images/banners/rut_1.gif';
  objImages[0].timeshow=10 * BannerDisplayMilliseconds;
  objImages[0].target="_self";
  objImages[0].href="www.wrcr.com";

  objImages[1].filename='images/banners/news.gif';
  objImages[1].timeshow=15 * BannerDisplayMilliseconds;
  objImages[1].target="_self";
  objImages[1].href="www.wrcr.com";

  objImages[2].filename='images/banners/online.gif';
  objImages[2].timeshow=10 * BannerDisplayMilliseconds;
  objImages[2].target="_self";
  objImages[2].href="www.wrcr.com";

  objImages[3].filename='images/banners/comm.gif';
  objImages[3].timeshow=10 * BannerDisplayMilliseconds;
  objImages[3].target="_self";
  objImages[3].href="www.wrcr.com";

  objImages[4].filename='images/banners/garden.gif'
  objImages[4].timeshow=5 * BannerDisplayMilliseconds;
  objImages[4].target="_self";
  objImages[4].href="www.wrcr.com";


  objImages[5].filename='images/banners/vol.gif'
  objImages[5].timeshow=7 * BannerDisplayMilliseconds;
  objImages[5].target="_self";
  objImages[5].href="www.wrcr.com";  


  objImages[6].filename='images/banners/irish.gif'
  objImages[6].timeshow=7 * BannerDisplayMilliseconds;
  objImages[6].target="_self";
  objImages[6].href="www.wrcr.com/survey.asp";


  objImages[7].filename='images/banners/weather.gif'
  objImages[7].timeshow=7 * BannerDisplayMilliseconds;
  objImages[7].target="_self";
  objImages[7].href="www.wrcr.com";

  objImages[8].filename='images/banners/morning.gif'
  objImages[8].timeshow=7 * BannerDisplayMilliseconds;
  objImages[8].target="_self";
  objImages[8].href="www.wrcr.com";
  
  objImages[9].filename='images/banners/online.gif'
  objImages[9].timeshow=7 * BannerDisplayMilliseconds;
  objImages[9].target="_self";
  objImages[9].href="www.wrcr.com";
  
  objImages[10].filename='images/banners/news.gif';
  objImages[10].timeshow=15 * BannerDisplayMilliseconds;
  objImages[10].target="_self";
  objImages[10].href="www.wrcr.com";

  objImages[11].filename='images/banners/rbd.gif';
  objImages[11].timeshow=15 * BannerDisplayMilliseconds;
  objImages[11].target="_blank";
  objImages[11].href="http://www.rbdigest.com";
  
  objImages[12].filename='images/banners/c8.gif';
  objImages[12].timeshow=15 * BannerDisplayMilliseconds;
  objImages[12].target="_blank";
  objImages[12].href="http://www.c8group.com";

  PreLoadImages();
       
}
function PreLoadImages(){
  var j = 0
  var p = objImages.length;
  var nextAd=0; 
  for (i = 0; i < p; i++){
   PreLoadedImages[i] = new Image()
   PreLoadedImages[i].src = objImages[i].filename;
   PreLoadedImages[i].alt="No Picture";
  }  
  NextRandomAd();  
  return true;
}
function NextRandomAd(){  
  do { n = Math.floor(Math.random() * (PreLoadedImages.length)); } 
  while(n == this.CurrentAd);
  this.CurrentAd = n;
  ShowBanner(n);
  t = setTimeout('NextRandomAd()', objImages[n].timeshow)   
}
function ShowBanner(BannerId){
   //alert('In show banner' + BannerId);
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=3)"
      document.images.SlideShow.style.filter="blendTrans(duration=FadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()            
   }
   document.images.SlideShow.src = PreLoadedImages[BannerId].src
   //alert(PreLoadedImages[BannerId].src);
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }   
}
function LoadSite(){
  
  var o = objImages[CurrentAd];
  
  if (o.target == '_self'){    
    location.href = "http://" + o.href;	
  }
  else {
    var w = open("http://" + o.href, "Banner" + CurrentAd);
  }
  
}