var $j = jQuery.noConflict();

$j(function() {

  $j(".main-image .desc").show(); //Show Banner
  $j(".main-image .block").animate({opacity: 0.85}, 1 ); //Set Opacity

  $j(".image-thumb ul li:first").addClass('active'); //Add the active class (highlights the very first list item by default)
  $j(".image-thumb ul li").click(function(){
      //Set Variables
      var imgAlt = $j(this).find('img').attr("alt"); //Get Alt Tag of Image
      var imgTitle = $j(this).find('a').attr("href"); //Get Main Image URL
      var imgDesc = $j(this).find('.block').html();  //Get HTML of the "block" container
      var imgDescHeight = $j(".main-image").find('.block').height(); //Find the height of the "block"

      if ($j(this).is(".active")) {  //If the list item is active/selected, then...
          return false; // Don't click through - Prevents repetitive animations on active/selected list-item
      } else { //If not active then...
          //Animate the Description
          $j(".main-image .block").animate({opacity: 0, marginBottom: -imgDescHeight}, 250 , function() { //Pull the block down (negative bottom margin of its own height)
              $j(".main-image .block").html(imgDesc).animate({opacity: 0.85,  marginBottom: "0"}, 250 ); //swap the html of the block, then pull the block container back up and set opacity
              $j(".main-image img").attr({src: imgTitle , alt: imgAlt}); //Switch the main image (URL + alt tag)
          });
      }
      //Show active list-item
      $j(".image-thumb ul li").removeClass('active'); //Remove class of 'active' on all list-items
      $j(this).addClass('active');  //Add class of 'active' on the selected list
      return false;

  }) .hover(function(){ //Hover effects on list-item
      $j(this).addClass('hover'); //Add class "hover" on hover
      }, function() {
      $j(this).removeClass('hover'); //Remove class "hover" on hover out
  });

  $j("a.collapse").click(function(){
      $j(".main-image .block").slideToggle(); //Toggle the description (slide up and down)
      $j("a.collapse").toggleClass("show"); //Toggle the class name of "show" (the hide/show tab)
  });

//  var staticMap;
//  staticMap = $j("#static_map");
//  if ( staticMap.attr('id') == undefined ) {
//    $j("#map-panel").removeClass('hide');
//  }
  
  // For jQuery LightBox setup
  $j('a[rel*=lightbox]').lightBox();
});


$j(function() {staticMap = $j("#static_map"); if ( staticMap.attr('id') == undefined ) {    $j("#map-panel").removeClass('hide');  }});

