// JavaScript Document

// EDIT THESE VALUES IF REQUIRED
var alertText = 'Are you sure you wish to perform this action' + "\n"; //DEFAULT TEXT DISPLAYED ON CONFIRM BUTTONS/LINKS WHEN NO ALT/TITLE
var newWindowLink = false; //OPEN EXTERNAL LINKS BY DEFAULT IN A NEW WINDOW (TRUE/FALSE)?


var woms = new Array(); //CREATE ARRAY OF FUNCTIONS TO LAUNCH ONLOAD

//ONLOAD MANAGER
function womOn(){
  window.onload = womGo;
}

function womGo(){
  for(var i = 0;i < woms.length;i++)
    eval(woms[i]);
}

function womAdd(func){
  woms[woms.length] = func;
}

function CreateBookmarkLink() {

	title = document.title;
	url = window.location.href;
	
	if (window.sidebar) { 
		window.sidebar.addPanel(title, url,"");
	} else if(window.external) {
		window.external.AddFavorite( url, title); 
	} else if(window.opera && window.print) {
		return true;
	}
	
}

function objToggle(obj) { 

	var obj = document.getElementById(obj);

	if(obj.style.display == "block") { 
		obj.style.display = "none";
	} else { 
		obj.style.display = "block";
	}

}

function tabbedTabs()
{

	$(".tabbedinfo .tabbedinfoinner, .projectinfo .projectinfoinner").each(
		function (i)
		{
			if(i !== 0) $(this).hide();
		});
	$(".tabbedinfo ul li .chebs:first, .projectinfo ul li .chebs:first").addClass("selected");
	$(".tabbedinfo ul li .chebs, .projectinfo ul li .chebs").click(
		function ()
		{
			var currentTab = $(".tabbedinfo ul li a.selected, .projectinfo ul li a.selected");
			var currentTabIndex = $(".tabbedinfo ul li a, .projectinfo ul li .chebs").index(currentTab);

			var indexPos = $(".tabbedinfo ul li a, .projectinfo ul li .chebs").index(this);
			
			if(currentTabIndex !== indexPos) {
				$(".tabbedinfo .tabbedinfoinner, .projectinfo .projectinfoinner").hide();
				$(".tabbedinfo .tabbedinfoinner:eq(" + indexPos + "), .projectinfo .projectinfoinner:eq(" + indexPos + ")").fadeIn(900);
				$(".tabbedinfo ul li .chebs, .projectinfo ul li .chebs").removeClass("selected");
				$(this).addClass("selected");
			}
			
			$(this).blur();
			
			return false;
		});
	
}



$(document).ready(
	function () 
	{
		tabbedTabs();
		expandMenu('nav');
	});





//<![CDATA[

	function createMarker(point,html) {
		var marker = new GMarker(point);
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml(html);
		});
		return marker;
     }

    function load() {
      if (GBrowserIsCompatible()) {

	      var map = new GMap2(document.getElementById("map"));

		  // Display the map, with some controls and set the initial location 
		  var map = new GMap2(document.getElementById("map"));
		  map.addControl(new GSmallMapControl());
		  map.addControl(new GMapTypeControl());
		  map.addMapType(G_PHYSICAL_MAP);

		  http://maps.google.co.uk/maps?f=q&source=s_q&hl=en&geocode=&q=HG5+8LF&sll=53.972635,-1.096148&sspn=0.008696,0.019312&ie=UTF8&ll=54.003897,-1.448393&spn=0.008689,0.019312&t=h&z=16

		  var point = new GLatLng(54.004011, -1.448959);
		  var start = new GLatLng(54.004011, -1.448959);
		  
		  map.setCenter(start,15);
		
		  // Set up three markers with info windows 
		
		  
		  var marker = createMarker(point,'<strong>EScon House</strong><br />Lingerfield<br />Scotton<br />Knaresborough<br />North Yorkshire<br />HG5 9JN<br />United Kingdom</p>')
		  map.addOverlay(marker);

      }
    }