google.load("jquery","1.4.2");

google.setOnLoadCallback(function(){
	
	$.ajaxSetup({async: false});
	$.getScript("inc/jquery.colorbox.js");
	$.ajaxSetup({async: true});
	
	$.ajaxSetup({async: false});
	$.getScript("inc/jquery.pikachoose.js");
	$.ajaxSetup({async: true});
	
	$.ajaxSetup({async: false});
	$.getScript("inc/jquery.jcarousel.min.js"); // part of PikaChoose
	$.ajaxSetup({async: true});
	
	$("#topNav ul a").hover(function(){
	
		$(this).stop().animate({ height: "100px" });	
								  
	},
	function(){
		
		$(this).stop().animate({ height: "33px" });
		
	});
	
	$("#topPhoto a.popup").colorbox();
	$(".popup").colorbox();
	
	$("#footer").append("<div id=\"resRanger\"><a href=\"concierge.html\"><img src=\"images/resranger.png\"></a></div>").append("<div class=\"blueFiller\"></div>");
	
	$(".currentPage").stop().animate({ height: "100px" });
	
	if($(".slideshow").length) {
		
		$(".slideshow").each(function(){
		
			slideshow=$(this);
			slideshowUL=slideshow.children("ul");
			
			scrollValue=slideshow.attr("rel");
			
			if(scrollValue!="false") {
			
				slideshowUL.PikaChoose();				
				slideshowUL.jcarousel({	scroll: scrollValue,				
					initCallback: function(carousel) {
								
						$(carousel.list).find('img').click(function() {
						        	//console.log($(this).parents('.jcarousel-item').attr('jcarouselindex'));
							carousel.scroll(parseInt($(this).parents('.jcarousel-item').attr('jcarouselindex')));
							
						});
							
					}
				});
				
			} else {
			
				slideshowUL.PikaChoose({ autoPlay: false });				
				slideshowUL.jcarousel();
	
			}
					
				slideshowOptions=slideshow.attr("id").split("-");
			
					for(ii=0;ii<slideshowOptions.length;ii++) {
				
						if(slideshowOptions[ii]=="width") {
	
							newWidth=slideshowOptions[(ii+1)]+"px";					
							newHeight=(parseFloat(slideshowOptions[(ii+1)])*.75)+"px";
							
							newTotalHeight=(parseFloat(slideshowOptions[(ii+1)]))+($(".jacoursel-skin-pika").height()-64)+"px";
							
							slideshow.find("img").width(newWidth).height(newHeight);
							slideshow.children(".pika-image").width(newWidth).height(newHeight);
							slideshow.width(newWidth).height(newHeight).height(newTotalHeight);
							ii=ii+1;
						
						}
			
					}
				
			
			slideshow.css("visibility","visible");			
		});
		
	}
	
});
