
// remap jQuery to $

$(function(){
    $(' a.scroll[href*=#]').click(function() {
    if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
        && location.hostname == this.hostname) {
            var $target = $(this.hash);
            $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
            if ($target.length) {
                var targetOffset = $target.offset().top;
                $('html,body').animate({scrollTop: targetOffset - 132}, 1000);
                return false;
            }
        }
    });
});

$(document).ready(function() {
	
	// Expand Panel
	$("#open").click(function(){
		$("div#panel").slideDown("slow");
	
	});	
	$("#open2").click(function(){
		$("div#panel").slideDown("slow");
	
	});	
	

	
	// Collapse Panel
	$("#close").click(function(){
		$("div#panel").slideUp("slow");	
	});	
	// Collapse Panel
	$("#close2").click(function(){
		$("div#panel").slideUp("slow");	
	});	
	




	
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#scrollbox a").click(function () {
		$("#scrollbox a").toggle();
	});
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$(".book-button a").click(function () {
		$(".book-button a").toggle();
	});			
		
});


$(document).ready(function() {
			/*
			*   Examples - images
			*/

		$("section#fleet li a,#contact-details,#contact-details2,#calendar-details").fancybox({
		'titlePosition'	: 'over',
		'overlayColor'		: '#194A7C'
		});
		
	
			
		});





    $(window).load(function()
    {
        var scroller = new StickyScroller("#scrollbox",
        {
            start:380,
            end: 2300,
            interval: 300,
            range: 100,
            margin: 100
        });
                

                
   
        

    });


// usage: log('inside coolFunc',this,arguments);
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/
window.log = function(){
  log.history = log.history || [];   // store logs to an array for reference
  log.history.push(arguments);
  if(this.console){
    console.log( Array.prototype.slice.call(arguments) );
  }
};



// catch all document.write() calls
(function(doc){
  var write = doc.write;
  doc.write = function(q){ 
    log('document.write(): ',arguments); 
    if (/docwriteregexwhitelist/.test(q)) write.apply(doc,arguments);  
  };
})(document);



