// JavaScript Document

jQuery(function(){
	
	//SiteNav = jQuery("#sitenav ul").css("width", "960px");
	jQuery("#main .side h2").each(function(){
		$el = jQuery(this);
		text = $el.text();
		$el.html('<img src="/resources/image.php?text=' + text + '" alt="' + text + '" title="' + text + '" />');
	});
	
	SiteNav = jQuery("#sitenav > ul").css("width", "990px").parent().css("overflow","visible");
	jQuery("> ul > li > a", SiteNav).each(function(){
		$el = jQuery(this);
		if ($el.parent().hasClass('groups'))
		{
			$el.css({"padding":"16px 10px 0 14px","height":"26px"});
		}
		else
		{
			$el.css({"padding":"16px 13px 0 17px","height":"26px"});
		}
		text = $el.parent().css("margin-top", "1px").end().text();
		$el.html('<img src="/resources/image.php?text=' + text + '&font=HelveticaNeueLTStd-Md.otf&colour=9E540B&size=11&bgcolour=CBB079&transparency=0&transparentbg=true" alt="' + text + '" title="' + text + '" />');
	});
	
	jQuery("body:not(.index) .content h1").each(function(){
		$el = jQuery(this);
		text = $el.text();
		$el.html('<img src="/resources/image.php?text=' + text + '&size=17&colour=B29959&transparency=0&transparentbg=true&bgcolour=FFFFFF" alt="' + text + '" title="' + text + '" />');
	});
});

function ViewMap()
{
	var img = document.getElementById('map');
	bodyWidth = 0;
	bodyHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		bodyWidth = window.innerWidth;
		bodyHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		bodyWidth = document.documentElement.clientWidth;
		bodyHeight = document.documentElement.clientHeight;
	}

	img.style.position = "absolute";
	img.style.display = "block";
	img.style.left = (bodyWidth / 2) - (img.width/2) + "px";
	img.style.top = (bodyHeight / 2) - (img.height/2) + "px";
	img.style.zIndex = 3;
}
function HideMap()
{
	document.getElementById('map').style.display = "none";
}