
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-24876265-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();


var cyclePager;
var cyclePage = new Array();
var startId = 0;
var moo;


$.fn.bgResize = function (options)
{
	var obj = $(this);

	function doResize()
	{
		windowWidth = $(window).width();

		if (windowWidth <= options.minWidth)
		{
			obj.css("width", options.minWidth + "px");
		}
		else if (windowWidth >= options.maxWidth)
		{
			obj.css("width", options.maxWidth + "px");
		}
		else
		{
			obj.css("width", windowWidth + "px");
		}
	}

	$(window).resize(function()
	{
		doResize()
	});

	doResize();
	return this;

};

$(document).ready(function()
{
	$("#bgImages").bgResize({
		minWidth:990,
		maxWidth:1440
	});
	$("#bgImages-standalone").bgResize({
		minWidth:990,
		maxWidth:1440
	});


	var theMatch = window.location.href.match(/#(.*)/);

	$("#inner-bg").cycle(
	{ 
		fx:     "scrollHorz",
		speed:  "medium",
		timeout: 0,
		next:   "#next",
		prev:   "#prev",
		pager:  cyclePager,
		pagerAnchorBuilder: function(idx, slide)
		{
			var slideName = $(slide).attr("id");

			if (slideName && theMatch)
			{
				if (slideName.replace("slideshow-", "") == theMatch[1])
				{
					$("#inner-bg").cycle(idx);
				}
			}
		},
	});




	if ( !$("#inner-bg").length || $("#inner-bg div.img").length == 1 )
	{
		$("a#next,a#prev").css("display", "none");
	}

	if ( $("#gmap").length )
	{
		makeMap();
	}


	if ( $("div#gallery-wrapper ul li a").length )
	{
		$("div#gallery-wrapper ul li a").lightBox();
	}

	$("div#logo a#reddotlogo").mouseover(function()
	{
		$("div#logo a#reddotlogo").css("background-position", "0 -87px");
	}
	).mouseleave(function()
	{
		$("div#logo a#reddotlogo").css("background-position", "0 0");
	}
	);


});



	var map;

	function makeMap()
	{

		if (GBrowserIsCompatible())
		{
			var m = document.getElementById("gmap");
			m.style.height = "270px";
			m.style.width = "360px";

			map = new GMap(document.getElementById("gmap"));
			map.addControl(new GLargeMapControl());

			map.centerAndZoom(new GLatLng(52.949711, -1.298214), 3);
			
			var point = new GLatLng(52.949711, -1.298214);
			
			var marker = createMarker(point);
			map.addOverlay(marker);
			//marker.openInfoWindowHtml(mhtml);
		}
	}

	function createMarker(point)
	{
		var marker = new GMarker(point);
		return marker;	  
	}
