var ImgIdx = 1;
var t;
var timer_is_on=0;

function PreloadImg(){
	var img = new Image();
	img.src="images/banner2.jpg";
	img.src="images/banner3.jpg";
	img.src="images/banner4.jpg";
	img.src="images/banner5.jpg";
}

function randDisplay()
{
 
    $(".Slash").ImageSwitch({Type:$(this).attr("rel"), 
	NewImage:"images/banner"+ImgIdx+".jpg", 
	Direction:"RightLeft", 
	EffectOriginal: false
	});
	
	
	$('.SlashEffLinks a').each(function(index)
	{
	$(this).removeClass();
	$(this).addClass('SlashEffLinksInactive');
	//alert(ImgIdx);
	    if(index==(ImgIdx-1))
		{
	    $(this).removeClass();
		$(this).addClass('SlashEffLinksActive');	
		}
	   
	});
	
	 
	
	
	ImgIdx++;
	if(ImgIdx>5) ImgIdx = 1;
 t=setTimeout("randDisplay()",5000);
}

 function doRandDisplay()
  {
	  if (!timer_is_on)
	  {
	  timer_is_on=1;
	  randDisplay();
	  }
  }
  
  doRandDisplay();




$(document).ready(function(){
	PreloadImg();
	$(".SlashEff ul li").click(function(){
		$(".Slash").ImageSwitch({Type:$(this).attr("rel"), 
									NewImage:"images/banner"+ImgIdx+".jpg", 
									Direction:"RightLeft", 
									EffectOriginal: false
									});
		ImgIdx++;
		if(ImgIdx>5) ImgIdx = 1;
	});	
	
	
	$(".SlashEffLinks a").click(function(){
		$('.SlashEffLinks a').each(function(index)
		{
			$(this).removeClass();
			$(this).addClass('SlashEffLinksInactive');
		});									
							   
	     var CurrImgIdx=$(this).attr("rel");
		 
		 $(this).removeClass();
		 $(this).addClass('SlashEffLinksActive');
		 
		$(".Slash").ImageSwitch({Type:"FadeIn", 
									NewImage:"images/banner"+CurrImgIdx+".jpg", 
									Direction:"RightLeft", 
									EffectOriginal: false
									});
	 });	
	
	
	
	
	
	
	
	
	
	
	
	
	
});



