$(document).ready(function() {
  //Show Banner
  $(".rotate_image .desc").show(); //Show Banner
  $(".rotate_image .block").animate({ opacity: 0.8 }, 1 ); //Set Opacity
      
  startRotate();
});

function startRotate(){
  setInterval('rotateImage()', 15000);
}

function rotateImage(){
  var current = ($('.rotate_thumb ul li.show') ? $('.rotate_thumb ul li.show') : $('.rotate_thumb ul li:first'));
  var next = ((current.next().length != 0) ? current.next() : $('.rotate_thumb ul li:first'));
  var imgAlt = next.find('img').attr("alt"); //Get Alt Tag of Image  
  var imgTitle = next.find('a').attr("href"); //Get Main Image URL
  var imgDesc = next.find('.thumb_block').html();   //Get HTML of block
  var imgDescHeight = $(".rotate_image").find('.block').height();  //Calculate height of block  

  next.addClass('show');
  //Animate the Teaser    
  $(".rotate_image img").animate({ opacity: 0}, 250 );
  $(".rotate_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
    $(".rotate_image .block").html(imgDesc).animate({ opacity: 0.75, marginBottom: "0" }, 250 );
    $(".rotate_image img").attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250 );
  });
  current.removeClass('show');
  
  return false;
}

