var total=0;
var i=0;
var speed=4000;
var stop_slide=0;
var color;
var path="js";
 function changeSlide(id){
	 $("#rotator").stopTime('controlled');
		$("#slideshow_"+i).fadeOut();
		$("img#dot_"+i).attr("src",path+"/dot_black.gif");
		i=id;
		if(i==total)
			{
				i=0;
			}
		$("#slideshow_"+i).fadeIn("slow");
		$("img#dot_"+i).attr("src",path+"/dot_"+color+".gif");
		if(stop_slide==0)
			{
				$("#rotator").everyTime(speed,'controlled',function() {
					startSlideshow();
		});
			}
		 }

function startSlideshow()
	{
		$("#slideshow_"+i).fadeOut("slow");
		$("img#dot_"+i).attr("src",path+"/dot_black.gif");
		i++;
		if(i==total)
			{
				i=0;
			}
		$("#slideshow_"+i).fadeIn("slow");
		$("img#dot_"+i).attr("src",path+"/dot_"+color+".gif");
	}
	
$(document).ready(function(){
    if($('#rotator').attr("path")!='undefined')
      {
      path=$('#rotator').attr("path");
      }

		color=$("div#rotator").attr("value");
		if(color!='green'&&color!='blue')
			{
				color='blue';
			}
		 $("#image_play").attr("src",path+"/play_"+color+".gif");
		 $("#image_stop").attr("src",path+"/stop_"+color+".gif");
		 $("#image_play").hide();
     $("#image_stop").hide();
		 $("#image_stop").css("cursor", "pointer").click(function() {
						$("#rotator").stopTime('controlled');
						 $("#image_stop").hide();
						 $("#image_play").show();
						 stop_slide=1;
				});
	
	 $("#image_play").css("cursor", "pointer").click(function() {
						$("#rotator").everyTime(speed,'controlled',function() {
									startSlideshow();
								});
						 $("#image_play").hide();
						 $("#image_stop").show();
						 stop_slide=0;
				});

  
	});
  
$(window).load(function(){
  $("#rotator img").each(function()
      {
             var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
  var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

  if (jQuery.browser.msie && (ie55 || ie6)) 
    {
    var bgIMG = jQuery(this).attr('src');
    jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');';
    jQuery(this).attr('src', 'img/blank.gif')
    }
      $(this).attr("id","slideshow_"+total).attr("border","0px").css({position:"absolute",left:"0px",top:"0px"});
      $("span#slideshow_dot").append('<img class="dot_slideshow" onclick="changeSlide('+total+');" src="'+path+'/dot_black.gif" id="dot_'+total+'" alt="dot" /> ').css("cursor", "pointer");
      total++;
     });
  $("#image_stop").show();
  $("#slideshow_0").show();
  $("img#dot_0").attr("src",path+"/dot_"+color+".gif");
  $("#rotator").everyTime(speed,'controlled',function() {
        startSlideshow();
  });
});