$("document").ready(function(){
  initSlideShow();
});

var curSlide = 0;
var timer = 1000;

function initSlideShow() {
  //turn all text-list to inactive
  $(".text-list h2").removeClass("active");
  $(".text-list ul li").removeClass("active");
  $(".text-list ul li").addClass("in-active");
  
  //add action to strong
  $(".text-list li").bind("mouseenter",function(e){
    curSlide = 8;
    $(".text-list h2").removeClass("active");
    $(this).children("h2").addClass("active");
    $(".text-list ul li").removeClass("active");
    $(".text-list ul li").addClass("in-active");
    $(this).addClass("active");
    $(this).removeClass("in-active");
    
    var index = $(".text-list li").index(this);
    
    $(".img_list img").hide();
    $(".img_list img:eq("+index+")").show();
  });
  
  //turn on first text-list strong item
  $(".text-list h2:first").addClass("active");
  $(".text-list ul li:first").removeClass("in-active");
  $(".text-list ul li:first").addClass("active");
  
  //hide all images
  $(".img_list img").hide();
  $(".img_list img:first").show();
  
  curSlide = 0;
  
  //start slide show
  setTimeout("slideShow();",timer);
  //slideShow();
}

function slideShow() {
  
  if(curSlide < 7) {
  $(".text-list h2").removeClass("active");
  $(".text-list h2:eq("+curSlide+")").addClass("active");
  $(".text-list ul li").removeClass("active");
  $(".text-list ul li").addClass("in-active");
  $(".text-list ul li:eq("+curSlide+")").removeClass("in-active");
  $(".text-list ul li:eq("+curSlide+")").addClass("active");
  
  //$(".img_list img").hide();
  
  $(".img_list img:eq("+curSlide+")").fadeIn('slow',function(){
    last = curSlide-2;
    if(curSlide > 1)
      $(".img_list img:eq("+last+")").fadeOut();
    else if(curSlide == 1)
      $(".img_list img:first").fadeOut();
  });
  
  
  ++curSlide;
  if(curSlide < 6)
    setTimeout("slideShow();",timer);
  }
  if(timer == 1000)
    timer = 6000;
}