
	 //Exernal links in new window
			 $(document).ready(function() {
   $("a[href^=http]").each(function(){
      if(this.href.indexOf(location.hostname) == -1) {
         $(this).attr({
            target: "_blank",
         });
      }
   })
});

// controls the  scrolling panel 
 	if (jQuery(".panel").length > 0){
		if (jQuery("#mygallery").length > 0){
			stepcarousel.setup({
				galleryid: 'mygallery', //id of carousel DIV
				beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
				panelclass: 'panel', //class of panel DIVs each holding content
				autostep: {enable:true, moveby:1, pause:6000},
				panelbehavior: {speed:1000, wraparound:true, persist:false},
				defaultbuttons: {enable: true, moveby: 1, leftnav: ['images/btn-left.png', -35, 130], rightnav: ['images/btn-right.png', 10, 130]},
				statusvars: ['statusA', 'statusB', 'statusC'], //register 3 variables that contain current panel (start), current panel (last), and total panels
				contenttype: ['inline'] //content setting ['inline'] or ['ajax', 'path_to_external_file']
			})
		}		
	}	
	// contriols the booking button
				$(document).ready(function(){
	
		// remove link background images since we're re-doing the hover interaction below 
		// (doing it this way retains the CSS default hover states for non-javascript-enabled browsers)
		// we also want to only remove the image on non-selected nav items, so this is a bit more complicated
		$(".book").children("li").each(function() {
			var current = "book current-" + ($(this).attr("class"));
			var parentClass = $(".book").attr("class");
			if (parentClass != current) {
				$(this).children("a").css({backgroundImage:"none"});
			}
		});	


		// create events for each nav item
		attachNavEvents(".book", "home");
		function attachNavEvents(parent, myClass) {
			$(parent + " ." + myClass).mouseover(function() {
				$(this).append('<div class="book-' + myClass + '"></div>');
				$("div.book-" + myClass).css({display:"none"}).fadeIn(200);
			}).mouseout(function() {
				$("div.book-" + myClass).fadeOut(200, function() {
					$(this).remove();
				});
			}).mousedown(function() {
				$("div.book-" + myClass).attr("class", "book-" + myClass + "-click");
			}).mouseup(function() {
				$("div.book-" + myClass + "-click").attr("class", "book-" + myClass);
			});
		}
	});
