	$(document).ready(function() {
	
			// remove the noscript class from the body tag if javascript is enabled (required to allow page validation and noscript styles)
			$('body').attr("id",'');
			
			// preload all css background images ready for hover overs
			
			$.cacheImage([
				'/wp-content/themes/fll/images/close-menu.gif',
				'/wp-content/themes/fll/images/info-close.gif',
				'/wp-content/themes/fll/images/icon-cal-prev-hover.gif',
				'/wp-content/themes/fll/images/icon-cal-next-hover.gif',
				'/wp-content/themes/fll/images/arrow-left-small-black.gif',
				'/wp-content/themes/fll/images/arrow-right-small-black.gif'
			
			  ])

			
			// fix for internet explorer cache expiry 'check every time' idiocy!
			if (jQuery.browser.msie) 
				{
					try { 
						document.execCommand("BackgroundImageCache", false, true); 
					} catch(err) {}
				}

						
			// add listener toggle for slide panel button clicks
			
			$('#slidepanel-button').toggle(function() {
			
				$('#slidepanel').stop().animate({
					left: '+=323'
					}, 458, 'swing', function() {

					// Animation complete. swap background image
					
					 $('#slidepanel-button').css('background-image', 'url("/wp-content/themes/fll/images/close-menu.gif")');


				});
			}, function() {
					$('#slidepanel').stop().animate({
						left: '-=323'
						}, 458, 'swing', function() {

						// Animation complete. swap background image
						
						 $('#slidepanel-button').css('background-image', 'url("/wp-content/themes/fll/images/open-menu.gif")');

					});
			});
			
			// add listener toggle for big-image-info button clicks in gallery
			
			$('#big-image-info-button').toggle(function() {
			
					// pop out the info panel by changing div css attributes
					
						
					 $('#big-image-info').css({
						'overflow' : 'visible',
						'width' : '160px',
						'height' : 'auto',
						'background-color' : '#202020',
						'padding' : '0px 10px 10px 10px',
						'background-image' : 'url("/wp-content/themes/fll/images/info-close.gif")'
						});

				
			}, function() {
					 $('#big-image-info').css({
						'overflow' : 'hidden',
						'width' : '79px',
						'height' : '26px',
						'background-color' : '#202020',
						'padding' : '0px',
						'background-image' : 'url("/wp-content/themes/fll/images/info-open.gif")'
						});
			});

			
			
			
			// on first page load, scroll left then right to alert users attention to a scrollable element
			
			$("#overview-scroller").scrollTo( '+=800px', 1000, {axis:'x',easing:'swing'} );
			$("#overview-scroller").scrollTo( '-=800px', 1000, {axis:'x',easing:'swing'} );
			
			
			/* 	listeners for scroll button clicks 
				set button divs to scroll in relation to window width to prevent overscrolling on small screens */
				
			$("#scroller-left-button").click(function(){	
				$("#overview-scroller").stop().scrollTo( '-='+($(window).width()/1.3)+'px', 500, {axis:'x',easing:'swing'} );
			});
			
			$("#scroller-right-button").click(function(){	
				$("#overview-scroller").stop().scrollTo( '+='+($(window).width()/1.3)+'px', 500, {axis:'x',easing:'swing'} );
			});
			
			// setup the scroller and trigger the setup again on browser resize
			setupScroller();
			$(window).resize(function() {setupScroller();});
		
			
			
			/*
			
			//this block of code an attempt to trigger the scroller based upon which marker is hovered over.
			//Needs more work
			
			
			$('#mtgt_unnamed_0').mouseover(function() {
				$("#overview-scroller").scrollTo( '#post_1', 1000, {axis:'x'} );
			});
			*/
		
	});
	
	
function setupScroller()
	{
		// setup scroller area for javascript enabled browsers
			$("#scroller-left-button").css('width','28px');
			$("#scroller-right-button").css('width','28px');
			$("#overview-scroller").css('width',($(window).width()-56)+'px');
			$("#overview-scroller").css('margin-left','28px');
			$("#overview-scroller").css('overflow-x','hidden'); // hide scroll bar
			scaleGalleryImage();
	}
	
function gallerySwapImage(new_image_url,image_date,image_title,image_description,image_link)
	{
				
		// replace the image with requested one
		$("#gallery-image-fullsize").attr('src',new_image_url);
		
		// replace the content in the big image info panel
		
		$("div#big-image-info h1").html(image_date);
		$("div#big-image-info h2").html(image_title);
		$("div#big-image-description").html(image_description);
	
		if (image_link)
			{		
				$("div#big-image-link").html('<a href="'+unescape(image_link)+'">see related post</a>');
			}
		else
			{
				$("div#big-image-link").html('');
			}
		
		// scale it to fit the window at top
		scaleGalleryImage();
		return false;
	}
	
function scaleGalleryImage()
	{
		// scale it to fit the window at top
		$("#gallery-image-fullsize").css('height',$(window).height()-160);
	}
	
	
/**
 * jQuery.ScrollTo - Easy element scrolling using jQuery.
 * Copyright (c) 2007-2009 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
 * Dual licensed under MIT and GPL.
 * Date: 5/25/2009
 * @author Ariel Flesler
 * @version 1.4.2
 *
 * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
 */
;(function(d){var k=d.scrollTo=function(a,i,e){d(window).scrollTo(a,i,e)};k.defaults={axis:'xy',duration:parseFloat(d.fn.jquery)>=1.3?0:1};k.window=function(a){return d(window)._scrollable()};d.fn._scrollable=function(){return this.map(function(){var a=this,i=!a.nodeName||d.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!i)return a;var e=(a.contentWindow||a).document||a.ownerDocument||a;return d.browser.safari||e.compatMode=='BackCompat'?e.body:e.documentElement})};d.fn.scrollTo=function(n,j,b){if(typeof j=='object'){b=j;j=0}if(typeof b=='function')b={onAfter:b};if(n=='max')n=9e9;b=d.extend({},k.defaults,b);j=j||b.speed||b.duration;b.queue=b.queue&&b.axis.length>1;if(b.queue)j/=2;b.offset=p(b.offset);b.over=p(b.over);return this._scrollable().each(function(){var q=this,r=d(q),f=n,s,g={},u=r.is('html,body');switch(typeof f){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(f)){f=p(f);break}f=d(f,this);case'object':if(f.is||f.style)s=(f=d(f)).offset()}d.each(b.axis.split(''),function(a,i){var e=i=='x'?'Left':'Top',h=e.toLowerCase(),c='scroll'+e,l=q[c],m=k.max(q,i);if(s){g[c]=s[h]+(u?0:l-r.offset()[h]);if(b.margin){g[c]-=parseInt(f.css('margin'+e))||0;g[c]-=parseInt(f.css('border'+e+'Width'))||0}g[c]+=b.offset[h]||0;if(b.over[h])g[c]+=f[i=='x'?'width':'height']()*b.over[h]}else{var o=f[h];g[c]=o.slice&&o.slice(-1)=='%'?parseFloat(o)/100*m:o}if(/^\d+$/.test(g[c]))g[c]=g[c]<=0?0:Math.min(g[c],m);if(!a&&b.queue){if(l!=g[c])t(b.onAfterFirst);delete g[c]}});t(b.onAfter);function t(a){r.animate(g,j,b.easing,a&&function(){a.call(this,n,b)})}}).end()};k.max=function(a,i){var e=i=='x'?'Width':'Height',h='scroll'+e;if(!d(a).is('html,body'))return a[h]-d(a)[e.toLowerCase()]();var c='client'+e,l=a.ownerDocument.documentElement,m=a.ownerDocument.body;return Math.max(l[h],m[h])-Math.min(l[c],m[c])};function p(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);

/*
 * cacheImage: a jQuery plugin
 *
 * cacheImage is a simple jQuery plugin for pre-caching images.  The
 * plugin can be used to eliminate flashes of unstyled content (FOUC) and
 * improve perceived page load time.  Callbacks for load, error and abort
 * events are provided.
 *
 * For usage and examples, visit:
 * http://github.com/alexrabarts/jquery-cacheimage
 *
 * Licensed under the MIT:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Copyright (c) 2008 Stateless Systems (http://statelesssystems.com)
 *
 * @author   Alex Rabarts (alexrabarts -at- gmail -dawt- com)
 * @requires jQuery v1.2 or later
 * @version  0.2.1
 */

(function ($) {
  $.extend($, {
    cacheImage: function (src, options) {
      if (typeof src === 'object') {
        $.each(src, function () {
          $.cacheImage(String(this), options);
        });

        return;
      }

      var image = new Image();

      options = options || {};

      $.each(['load', 'error', 'abort'], function () { // Callbacks
        var e = String(this);
        if (typeof options[e] === 'function') { $(image).bind(e, options[e]); }

        if (typeof options.complete === 'function') {
          $(image).bind(e, options.complete);
        }
      });

      image.src = src;

      return image;
    }
  });

  $.extend($.fn, {
    cacheImage: function (options) {
      return this.each(function () {
        $.cacheImage(this.src, options);
      });
    }
  });
})(jQuery);


