﻿Cufon.replace('#contentShell h1, #contentShell h2, .widgetCTAHeaders, #petFriendlyCottages h5, #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 .widgetCTAHeaders').insertBefore('#widgetCTA32894 .widgetCTAimg')
$('#widgetCTA32895 .widgetCTAHeaders').insertBefore('#widgetCTA32895 .widgetCTAimg')
$('#widgetCTA32902 .widgetCTAHeaders').insertBefore('#widgetCTA32902 .widgetCTAimg')


$(".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;
});


});


<!--
//check in date drop menus
var date = new Date();

var day = date.getDate();
var year = date.getFullYear();
var month = date.getMonth();

//BROWSER SNIFF
var isIE4 = (document.all && !document.getElementById) ? true : false;
var isIE5 = (document.all && document.getElementById) ? true : false;
var isNS6 = (!document.all && document.getElementById) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
var isDHTML = (isIE4 || isIE5 || isNS6);
var isPc = navigator.userAgent.indexOf("Windows") != -1;
var isMac = !isPc;



//FUNCTIONS
function swap(name,state) {
    if(document.images) {
        document[name].src = eval(name + state + ".src");
    }
}

function jumpSelect(selectlist) {
    var ind = selectlist.selectedIndex;
    var theURL = selectlist.options[selectlist.selectedIndex].value;
     if (theURL == "") return;
     document.location = theURL;
}

function getStyles() {
    if (isPc) {
     return "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\">";
    } else {
     return "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles_mac.css\">";
    }
}

function getMonthMenu() {
     var selected = '';
     var months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
     var nums = ["01","02","03","04","05","06","07","08","09","10","11","12"];
     for(i=0;i<months.length;i++) {
          if (i==month) {
               //alert(month);
               selected = " selected";
          } else {
               selected = "";
          }
          document.write('<option value=\"'+nums[i]+'\"'+selected+'>'+months[i]);
     }
}
function getDayMenu() {
     var selected = '';
     for(i=1;i<31;i++) {
          if (i==day) {
               //alert(day);
               selected = " selected";
          } else {
               selected = "";
          }
          document.write('<option value=\"'+i+'\"'+selected+'>'+i);
     }
}
function getYearMenu() {
     for(i=year;i<year+4;i++) {
          document.write('<option value=\"'+i+'\">'+i);
     }
}

function popitup(location) {
     var dx=400;
     var dy=380;

     var w = window.open(location, 'popup_folk', 'width=' + dx + ',height=' + dy + ',status=no,resizable=yes,menubar=yes,location=no,scrollbars=yes,toolbar=no');
     w.focus();
}

//validation

function isPositiveNumber(num) {
     if(num == "" || num == 0) return false;
     if(Math.abs(num*1.0) != num) return false;
     return true;
}

function isNumber(num) {
     if(num == "") return false;
     if(num*1.0 != num) return false;
     return true;
}

function strip(s,what) {
     var i;
     while ((i = s.indexOf(what)) != -1) {
          s = s.substring(0,i) + s.substring(i+what.length,s.length);
     }
     return s;
}

//-->
