$(document).ready(function() {	

	//Show Banner
	$(".main_image").show(); //Show Banner
	$(".main_image").animate({ opacity: 0.85 }, 1 ); //Set Opacity

	//Click and Hover events for thumbnail list
	$(".image_thumb ul li:first").addClass('active'); 
	$(".image_thumb ul li").hoverIntent(showBanner,hideBanner) .hover(function(){
		$(this).addClass('hover');
		}, function() {
		$(this).removeClass('hover');
	});
			
	//Toggle Teaser
	$("a.collapse").click(function(){
		$(".main_image").slideToggle();
		$("a.collapse").toggleClass("show");
	});
	
	//for preloading of images in nav

  // Arguments are image paths relative to the current page.
   var cache = [];

  function preLoadImages(){
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
preLoadImages("weddings-nav-on.jpg", "images/weddings-nav-on.jpg");
preLoadImages("graduation-nav-on.jpg", "images/graduation-nav.jpg");
preLoadImages("baby-arrival-nav-on.jpg", "images/baby-arrival-nav-on.jpg");
preLoadImages("graduation.jpg", "images/graduation.jpg");
preLoadImages("wedding.jpg", "images/wedding.jpg");
preLoadImages("baby-arrival.jpg", "images/baby-arrival.jpg");
//preLoadImages("business-events-nav-on.jpg", "images/business-events-nav-on.jpg");
//preLoadImages("seasonal-parties-nav-on.jpg", "images/seasonal-parties-nav-on.jpg");



});//Close Function
 function showBanner(){
        // remove any highlighted items
		
        // highlight navigation button
		var navImg = $(this).find('img').attr("src");
		navImg = navImg.replace(".jpg","-on.jpg");		
        $(this).find('img').attr({src: navImg});
//		= $(this).find('.block img').attr("src").replace(".jpg","-on.jpg");

		//Set Variables
		var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
		var imgTitle = $(this).find('.display_image').attr("href"); //Get Main Image URL
	//	var imgDesc = $(this).find('.block').html(); 	//Get HTML of block
	    var imgDesc = "";
		var imgDescHeight = $(".main_image").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				
			$(".main_image").fadeOut(300,
			  function() {
			  $(".main_image img").attr({ src: imgTitle , alt: imgAlt});
			  
			  }
			);
			$(".main_image").fadeIn(300);  
			
		}
		
		$(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists
		$(this).addClass('active');  //add class of 'active' on this list only
		return false;
		
	}
	function hideBanner(){
	    var navImg = $(this).find('img').attr("src");
		navImg = navImg.replace("-on.jpg",".jpg");		
        $(this).find('img').attr({src: navImg});
	}
	

