﻿// JavaScript Document

$(document).ready(function(){
//////////////////////////////////////
var header_image_object = 
  { 
    index : 1, 
    header_images : ["1.jpg","2.jpg", "3.jpg", "4.jpg", "5.jpg","6.jpg", "7.jpg", "8.jpg", "9.jpg", "10.jpg", "11.jpg", "12.jpg", "13.jpg", "14.jpg", "15.jpg"], 
     
    inc_index : function() { 
      this.index++;  
       
      if (this.index == this.header_images.length) { 
        this.index = 0; 
      } 
    }, 
     
    get_index : function() { return this.index; }, 
     
    swap : function() { 
      $("#s1 img").fadeOut(500, function() { 
         
        $("#s1 img").attr("src", "slides/" +  
          header_image_object.header_images[header_image_object.index]); 
         
        $("#s1 img").fadeIn(1000); 
         
       header_image_object.inc_index(); 
      }); 
    } 
  }; 
 setInterval(header_image_object.swap, 5000); 
  
  
  $('.external_link').click( function() { 
           window.open(this.href, "map","location=0,status=0,scrollbars=1,width=750,height=650");
		   return false; 
        });
        
 //Slideshow
 var stotal = $("ul.thumbs li").length;
 var thdim = 70;
 var thumbh = (thdim*(stotal-6));
 
 
$(".thumbs li a").click(function () {
	var theURL = 'url('+this+')';
      $("#slide").css('background-image',theURL);
	  $(".thumbs li a").removeClass("hilight");
	  $(this).toggleClass("hilight");
	  return false;
	  
    });
    //Slideshow - Amenities
	$(".thumbs td a").hover(function () {
	var theURL = $(this).attr("href");
      $("#amenPhoto").attr("src",theURL);
	  return false;
    });
    

$("#sl_dn").click(function () {
var bu = $("#pthumbs");
var boffset = bu.offset();
boffset = boffset.top;
var u = $("ul.thumbs");
var offset = u.offset();

offset = offset.top - boffset;
var newu = offset - thdim;
if ((0-newu) < thumbh){
	$("#sl_up").css("cursor","pointer")
	$("#sl_dn").css("background-image","url(images/arrow_slide_down.gif)");
$("ul.thumbs").css("margin-top",newu);
$("#sl_up").css("background-image","url(images/arrow_slide_up.gif)");
}
else if ((0-newu) == thumbh){
	$("ul.thumbs").css("margin-top",newu);
	$("#sl_dn").css("background-image","none");
	$("#sl_dn").css("cursor","default");
}
 });
$("#sl_up").click(function () {
							
var bu = $("#pthumbs");
var boffset = bu.offset();
boffset = boffset.top;
var u = $("ul.thumbs");
var offset = u.offset();
offset = offset.top-boffset;
var newu = offset + thdim;
if ((newu) <= 0-thdim){
	$("#sl_up").css("cursor","pointer");
	$("#sl_dn").css("background-image","url(images/arrow_slide_up.gif)");
$("ul.thumbs").css("margin-top",newu);
$("#sl_dn").css("background-image","url(images/arrow_slide_down.gif)");

}
else if ((newu) == 0){
	$("ul.thumbs").css("margin-top",newu);
	$("#sl_up").css("background-image","none");
	$("#sl_up").css("cursor","default");
	
}

 });
  
////////////////////////////
});
  
