var slidShowIntervalId = 0;
var slidShowDelay = 8000;


function fun_slideshow() {
	
  var active = $("#slide-show").find("div.active");
  
  var active_next;
  if($(active).nextAll("div").length == 0) {
	  active_next = $("#slide-show div:first");
  }
  else {
	active_next = $(active).next("div");
  }
  
  $(active_next).fadeIn(slidShowDelay/4);
  $(active).fadeOut(slidShowDelay/4);
  $(active).removeClass("active");
  $(active_next).addClass("active");

  slidShowIntervalId = setTimeout("fun_slideshow()", slidShowDelay);

}

$(document).ready(function() {
	var active = $("#slide-show").find("div").css("display","none");					   
	var active = $("#slide-show").find("div.active").css("display","block");
	
	$(".left_icon").click(function(){
								   clearTimeout ( slidShowIntervalId );
								   
									var active = $("#slide-show").find("div.active");
									
									if($(active).prevAll("div").length != 0) {
										active_prev = $(active).prev("div");
										$(active_prev).fadeIn(slidShowDelay/8);
										$(active).fadeOut(slidShowDelay/8);
										$(active).removeClass("active");
										$(active_prev).addClass("active");
									}
									
									slidShowIntervalId = setTimeout("fun_slideshow()", slidShowDelay);
									
								   });

	$(".right_icon").click(function(){
								   clearTimeout ( slidShowIntervalId );
								   
									var active = $("#slide-show").find("div.active");
									if($(active).nextAll("div").length != 0) {
										active_next = $(active).next("div");
										$(active_next).fadeIn(slidShowDelay/8);
										$(active).fadeOut(slidShowDelay/8);
										$(active).removeClass("active");
										$(active_next).addClass("active");
									}
									
									slidShowIntervalId = setTimeout("fun_slideshow()", slidShowDelay);
									
								   });

	slidShowIntervalId = setTimeout("fun_slideshow()", slidShowDelay);
});

