jQuery(document).ready(function() {
jQuery(".main_image .desc").show(); //Show Banner
jQuery(".main_image .block").animate({ opacity: 0.85 }, 1 ); jQuery(".image_thumb ul li:first").addClass('active'); //runs function on click
jQuery(".image_thumb ul li").click(function () {
var imgAlt = jQuery(this).find('img').attr("alt");
var imgTitle = jQuery(this).find('a').attr("href");
var imgDesc = jQuery(this).find('.block').html();
var imgDescHeight = jQuery(".main_image").find('.block').height();

if (jQuery(this).is(".active")) {
return false;
} else {
jQuery(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
jQuery(".main_image .block").html(imgDesc).animate({ opacity: 0.85, marginBottom: "0" }, 250 );
jQuery(".main_image img").attr({ src: imgTitle , alt: imgAlt});
});
}

jQuery(".image_thumb ul li").removeClass('active');
jQuery(this).addClass('active');
return false;$active = jQuery(this);
slideSwitchClick();
})
.hover(function(){

jQuery(this).addClass('hover');
clearInterval(playSlideshow);
playSlideshow = setInterval('slideSwitchTimed()', 6500 );
}, function() {
jQuery(this).removeClass('hover');
});

//runs function, set timer here
jQuery(function() {
playSlideshow = setInterval('slideSwitchTimed()', 6500 );
});
});

function slideSwitchTimed() {
$active = jQuery('.image_thumb ul li.active').next();
if ( $active.length == 0 ) $active = jQuery('.image_thumb ul li:first');
slideSwitch();
}

function slideSwitchClick() {
slideSwitch();
}

function slideSwitch() {
var $prev = jQuery('.image_thumb ul li.active');

//Show active list-item
$prev.removeClass('active');
$active.addClass('active');

//Set Variables
var imgAlt = $active.find('img').attr("alt");
var imgTitle = $active.find('a').attr("href");
var imgDesc = $active.find('.block').html();
var imgDescHeight = jQuery(".main_image").find('.block').height();

if (jQuery(this).is(".active")) {
return false;
} else {

jQuery(".main_image img").animate({ opacity: 0}, 250 );
jQuery(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
jQuery(".main_image .block").html(imgDesc).animate({ opacity: 0.85, marginBottom: "0" }, 250 );
jQuery(".main_image img").attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250 );
});
}
return false;
}

