﻿

var vd_index = 1; 
var newVar,newImg;
var vr_total = 5;
var vr_time = 4000;

var ads_index = 0; 
var ads_time = 5000;

function auto_play(total){
	if(total){	 	 
   vr_total = total;}
  if(vr_total>1){
   timer = setInterval('swapImage('+vr_total+')',vr_time);	}
}

function swapImage(total){		
	MM_swapImage("vr0" + vd_index,'',"images/vr-0"+vd_index+".gif");		
	if(vd_index<total){			
		vd_index = vd_index+1;	  
	}
	else{
		vd_index=1;
	}
	newVar = "vr0" + vd_index;	  
	newImg = "images/vr-0"+vd_index+"over.gif";	  	  
	table_var = "vr"+vd_index;
	showvr(MM_findObj(table_var));	
	MM_swapImage(newVar,'',newImg);	
}

function RenderVRIMG(img_blk)
  {
   if(nwr && (window.IE || window.MOZ) && (!window.MAC))
     {
	  
	  img_blk.onmouseover = function()
	                      {
							clearInterval(timer);
	                      }
	  img_blk.onmouseout = function()
	                      {	                      	
							auto_play();
	                      }
	  }
}

function play_ads(newIndex){
	var ad_div = "Ad" + ads_index;	
	gObj(ad_div).style.display="none";
	gTags(gObj("Ads_Inds"),"td")[ads_index+1].className="txt_advance_hover";
	if(newIndex!=null){
		ads_index = newIndex;
	}
	else{
	if(ads_index==gTags(gObj("Ads"),"DIV").length-1){
		ads_index = 0;
	}else{		
	    ads_index = ads_index+1;
	}}
	
	ad_div = "Ad" + ads_index;
	gObj(ad_div).style.display="block";
	gTags(gObj("Ads_Inds"),"td")[ads_index+1].className="txt_advance";			
}

function auto_play_ads(){
	ad_timer = setInterval('play_ads()',ads_time);
}

function createAdsImg(){	
	var adsImg_blk = gTags(gObj("Ads"),"DIV");	
	var html = "";
	html = "<table height=\"22\" border=\"1\" cellpadding=\"0\" cellspacing=\"0\" bordercolor=\"#FFFFFF\" style=\"border-collapse:collapse\">";
	html += "<tr><td width=\"8\" bgcolor=\"#DDDDDD\">&nbsp;</td>"
	for(i=1;i<=adsImg_blk.length;i++){
		if(i==1){
		   html += "<TD width=\"25\" class=\"txt_advance\" onMouseOver='play_ads("+(i-1)+");clearInterval(ad_timer);' omMouseOut='auto_play_ads();'>"+i+"</TD>";
		}		
		else{
		   html += "<TD width=\"25\" class=\"txt_advance_hover\" onMouseOver='play_ads("+(i-1)+");clearInterval(ad_timer);' omMouseOut='auto_play_ads();'>"+i+"</TD>";
		}		
	}
	
	html += "</tr></table></td>";		
	gObj("Ads_Inds").innerHTML = html;
}

function RenderADSIMG(img_blk)
  {
   if(nwr && (window.IE || window.MOZ) && (!window.MAC))
     {
	  
	  img_blk.onmouseover = function()
	                      {
							clearInterval(ad_timer);
	                      }
	  img_blk.onmouseout = function()
	                      {	                      	
							auto_play_ads();
	                      }
	  }
}