// JavaScript Document
var adNum = get_random();		//random 0-4
var bannerAD = new Array(5);
var bannerADlink = new Array(5);
	bannerAD[0] = "/images/ad/ad_dvd-ripper-platinum.jpg";
	bannerAD[1] = "/images/ad/ad_video-converter.jpg";
	bannerAD[2] = "/images/ad/ad_audio-converter.jpg";
	bannerAD[3] = "/images/ad/ad_dvd-creator.jpg";
	bannerAD[4] = "/images/ad/ad_3gp-video-converter.jpg";
	bannerADlink[0] = "http://www.xilisoft.com/dvd-ripper-platinum.html";
	bannerADlink[1] = "http://www.xilisoft.com/video-converter.html";
	bannerADlink[2] = "http://www.xilisoft.com/audio-converter.html";
	bannerADlink[3] = "http://www.xilisoft.com/dvd-creator.html";
	bannerADlink[4] = "http://www.xilisoft.com/3gp-video-converter.html";

//preload image
var preloadimages = new Array();
for (i=1;i<bannerAD.length;i++){
      preloadimages[i]=new Image();
      preloadimages[i].src=bannerAD[i];
}

function setTransition(){
   if (document.getElementById){
      bannerADrotator.filters.revealTrans.Transition=Math.floor(Math.random()*23);
      bannerADrotator.filters.revealTrans.apply();
   }
}

function playTransition(){
   if (document.getElementById)
      bannerADrotator.filters.revealTrans.play()
}

function nextAd(){
   if(adNum<bannerAD.length-1)adNum++ ;
      else adNum=0;
   setTransition();
   document.images.bannerADrotator.src=bannerAD[adNum];
   playTransition();
   theTimer=setTimeout("nextAd()", 8000);
}

function jump2url(){
   jumpUrl=bannerADlink[adNum];
   jumpTarget='_blank';
   if (jumpUrl != ''){
      if (jumpTarget != '')window.open(jumpUrl,jumpTarget);
      else location.href=jumpUrl;
   }
}

//get random from 0 to 4
function get_random()
{
    var ranNum = Math.floor(Math.random()*5);
    return ranNum;
}