// JavaScript Document
$(document).ready(function() {	

	//Show Banner
	$(".tab-show .desc").show(); //Show Banner
	$(".tab-show .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity

	//Click and Hover events for thumbnail list
	$(".tab ul .nav:first").addClass('active2'); 	
	$(".tab .active2 li:first").addClass('active'); 
	
	$(".tab ul .nav").hover(function(){	 
		//Set Variables
		var imgAlt = $(this).find('ul li img').attr("alt"); //Get Alt Tag of Image
		var imgTitle = $(this).find('ul li a').attr("href"); //Get Main Image URL
		var imgDesc = $(this).find('ul li .block').html(); 	//Get HTML of block
		var ulDesc = $(this).find('.tab .active2 .liul').html(); 	//Get HTML of block
		var imgDescHeight = $(".tab-show").find('.block').height();	//Calculate height of block	
			
		if ($(this).is(".active2")) {  //If it's already active, then...
			return false; // Don't click through
		} else {
			//Animate the Teaser				
			$(".tab-show .block").animate({ opacity: 0, marginBottom: "0" }, 250 , function() {
				$(".tab-show .block").html(imgDesc).animate({ opacity: 0.85,	marginBottom: "0" }, 250 );
				$(".tab-show img").attr({ src: imgTitle , alt: imgAlt});
			});
			
			//$(".tab .active2 .liul").animate({ opacity: 0 }, 250 , function() {
				//$(".tab .active2 .liul").html(ulDesc).animate({ opacity: 0.85 }, 250 );
			//});
		}
				
		$(".tab ul .nav").removeClass('active2'); //Remove class of 'active' on all lists
		$(".tab ul .nav li").removeClass('active');
		$(this).find('li:first').addClass('active');
		$(this).addClass('active2');  //add class of 'active' on this list only
		return false;		
	});	
	
	$(".tab ul li ul li").hover(function(){ 
		//Set Variables
		var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
		var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL
		var imgDesc = $(this).find('.block').html(); 	//Get HTML of block
		var imgDescHeight = $(".tab-show").find('.block').height();	//Calculate height of block	
		
		if ($(this).is(".active")) {  //If it's already active, then...
			return false; // Don't click through
		} else {
			//Animate the Teaser				
			$(".tab-show .block").animate({ opacity: 0, marginBottom: "0"}, 250 , function() {
				$(".tab-show .block").html(imgDesc).animate({ opacity: 0.85,	marginBottom: "0" }, 250 );
				$(".tab-show img").attr({ src: imgTitle , alt: imgAlt});
			});
		}
		
		$(".tab ul li ul li").removeClass('active'); //Remove class of 'active' on all lists
		
		$(this).addClass('active');  //add class of 'active' on this list only
		return false;
		
	}) .hover(function(){
		$(this).addClass('hover');
		}, function() {
		$(this).removeClass('hover');
	});
			
	//Toggle Teaser
	$("a.collapse").hover(function(){
		$(".tab-show .block").slideToggle();
		$("a.collapse").toggleClass("show");
	});
	
});//Close Function
