﻿Cufon.replace('#contentShell h1, #contentShell h2,  #nav>ul>li>a, #cottageFinder h1',  { hover: true, fontFamily: 'Goudy Old Style' });
$(function(){

//fix Cufon hover issue
$("#nav>ul>li").hover(
     function(){  },
     function(){ Cufon.refresh("#nav>ul>li>a"); }
);

//IE sucks. 
if ( $.browser.msie ) {
      /* do IE stuff */
}
else {
   // fade the logo on hover

$("#logo a img").hover(function(){
  $(this).animate({  
    opacity: "0.5"
      }, 400 );
  },
  function(){
        $(this).animate({ 
    opacity: "1"
      }, 400 ); 
      
  }
);

} 



// add hover class to cottage finder
$('#cottageFinder>ul>li').hover(function() {
  $(this).addClass('hover');
     }, function() {
  $(this).removeClass('hover');
});
     


// move the cta h1s around 

$('.widgetCTADescription').remove();
$('#widgetCTA32894 h1').insertBefore('#widgetCTA32894 span')
$('#widgetCTA32895 h1').insertBefore('#widgetCTA32895 span')
$('#widgetCTA32902 h1').insertBefore('#widgetCTA32902 span')


$(".widgetCTA").hover(function(){
// move left

  $(this).animate({  
    paddingRight: "20px",
    left: "-=20px"
      }, 200 );
  },
  function(){
        $(this).animate({ 
    paddingRight: "0",
    left: "0"
      }, 200 ); 
      
  }
);




$(".widgetCTA").hover(function(){
// expand images

  $(this).find(".widgetCTAimg").animate({  
    width: "186px"
      }, 200 );
  },
  function(){
        $(this).find(".widgetCTAimg").animate({ 
         width: "166px"
      }, 200 ); 
      
  }
);



// distribute those lists

 $("#content ul:not(.sitemapWidget):not(.noFloat)").each(function(){
          var liCount = $(this).children().size();
          if (liCount >= 6) {
               var firstList = this;
               $(firstList).wrap("<div class='colContainer'><div class='twoCols'></div></div>");
               var colContainer = $(firstList).parent().parent();
               $(colContainer).append("<div class='twoCols next'><ul></ul></div>");
               var secondList = $(".twoCols:last ul", colContainer);
               var secondListLIs = $(firstList).children().slice(Math.ceil(liCount/2));
               $(secondList).append(secondListLIs);
               $("div.colContainer").next().addClass("clear");
               if ($(".colContainer .twoCols ul.noStyle").length ) {
                    $(this).parent().parent().find(".twoCols.next ul").addClass("noStyle");
               }  
          };//close if nonsense

     }); //closing the each-thingy

// cottage finder  expand
$('#cottageFinder ul li').hover(function(){
// expand images

  $(this).find("ul").css({  
    "display":"block"});
  },
  function(){
        $(this).find("ul").css({
         "display":"none"}); 
      
  }
);

 //change out calendar icon.
     $("#checkoutCalendarIcon, #checkinCalendarIcon").attr("src", "files/templates/214/cal.gif");
     
     
//cottage finder images
 
$('a#oneBed').hover(function() {
  $('#cottageFinder #thumb').addClass('oneBed');
     }, function() {
  $('#cottageFinder #thumb').removeClass('oneBed');
     });
     
$('a#twoBed').hover(function() {
  $('#cottageFinder #thumb').addClass('twoBed');
     }, function() {
  $('#cottageFinder #thumb').removeClass('twoBed');
     });
     
$('a#threeBed').hover(function() {
  $('#cottageFinder #thumb').addClass('threeBed');
     }, function() {
  $('#cottageFinder #thumb').removeClass('threeBed');
     });
     
$('a#fourBed').hover(function() {
  $('#cottageFinder #thumb').addClass('fourBed');
     }, function() {
  $('#cottageFinder #thumb').removeClass('fourBed');
     });
     
$('a.bTT').click(function(){
     $('html, body').animate({scrollTop: '400px'}, 300);
     return false;
});


});