/*
	Author: NetConstruct, Alastair Hodgson
*/

$('html').removeClass('no-js');

// Gallery image swapper that creates thumbnails and page numbers,
// check to see if gallery exists first otherwise we get an error from the cycle plugin
if ($('#gallery').length > 0) {
	$('#gallery .imgWrap').after('<ul class="noBullet" id="galleryNav">').cycle({
		fx:     'fade',
		speed:  'fast',
		timeout: 0,
		pager:  '#galleryNav',

		// callback fn that creates a thumbnail to use as pager anchor
		pagerAnchorBuilder: function(idx, slide) {
			return '<li><a href="#"><img src="' + slide.src + '"></a></li>';
		},
	    next:   '#galleryNext',
	    prev:   '#galleryPrev', 
	    after:  onAfter
	});
}

// callback function used by the above gallery script call
function onAfter(curr,next,opts) {
	var caption = (opts.currSlide + 1) + ' of ' + opts.slideCount;
	$('#gallery p.slideIndex').html(caption);
}

$(document).ready(function () {
var loadedMap = false;
// Call the tabs plugin
$('#tabs').tabs();


$('#LocationTab3').click(function () {
    if (!loadedMap) {
        loadMap();
        loadedMap = true;
    }
});
});

