/* -----------------------------------------------
sIFR Styles
----------------------------------------------- */
var shelley = {
  src: '/flash/shelley.swf'
};

sIFR.prefetch(shelley);

sIFR.activate();

sIFR.replace(shelley, {
  selector: '.right_module h2',
    css: [
      '.sIFR-root {background-color: #170c00; color: #b4ab8d; tuneHeight: -10;}',
	  'a {text-decoration: none; color: #b4ab8d;}',
	  'a:hover {color: #ffae00;}'
    ],

	tuneHeight: '-10',
    offsetTop: '-2'
});

sIFR.replace(shelley, {
  selector: '.half_module h2',
    css: [
      '.sIFR-root {background-color: #170c00; color: #b4ab8d; tuneHeight: -10;}',
	  'a {text-decoration: none; color: #b4ab8d;}',
	  'a:hover {color: #ffae00;}'
    ],

	tuneHeight: '-10',
    offsetTop: '-2'
});


sIFR.replace(shelley, {
  selector: '.wide_module h2',
    css: [
      '.sIFR-root {background-color: #170c00; color: #b4ab8d; tuneHeight: -10;}',
	  'a {text-decoration: none; color: #b4ab8d;}',
	  'a:hover {color: #ffae00;}'
    ],

	tuneHeight: '-10',
    offsetTop: '-2'
});


/* -----------------------------------------------
About Map
----------------------------------------------- */
function initialize() {
	if (GBrowserIsCompatible()) {
			var map = new GMap2(document.getElementById("about_map"));
			map.setCenter(new GLatLng(50.845290048651464, -0.9351575374603271), 16);
			
			// Sets Map Type
			map.setMapType(G_SATELLITE_MAP);
			
			// Created Point on Map
			var point = (new GLatLng(50.84589296320216, -0.9357261657714844));

			// Creates Overlayed point
			map.addOverlay(createMarker(point, "<p><strong>Emsworth</strong></p>")); 

			// Adds Map Controls
			map.addControl(new GSmallMapControl());			
	
			// Allows switching between map types (vector/satellite/hybrid)
			map.addControl(new GMapTypeControl());
			
		  }
		}
/* --------- Adds HTML Info Window --------- */
function createMarker(point,InfoWindowHtml) {
		var marker = new GMarker(point);
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml(InfoWindowHtml);
		});
	  return marker;
	}


/* -----------------------------------------------
Contact Form Encoding
----------------------------------------------- */
function contact_form()
	{var kode=
"kode=\";)\\\"n\\\\r\\\\>mrof/<t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\n\\\\r\\"+
"\\>ld/<t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\n\\\\r\\\\>td/<>/ \\\"\\\\6"+
"\\\"\\\\=xednibat \\\"\\\\timbuS\\\"\\\\=eulav \\\"\\\\timbus\\\"\\\\=di "+
"\\\"\\\\timbus\\\"\\\\=epyt tupni<>td<t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t"+
"\\\\t\\\\n\\\\r\\\\t\\\\t\\\\t\\\\n\\\\r\\\\>dd/<>aeratxet/<>\\\"\\\\1\\\""+
"\\\\=sloc \\\"\\\\1\\\"\\\\=swor \\\"\\\\5\\\"\\\\=xednibat \\\"\\\\egasse"+
"m\\\"\\\\=eman \\\"\\\\egassem\\\"\\\\=di aeratxet<>dd<t\\\\t\\\\t\\\\t\\"+
"\\t\\\\t\\\\t\\\\t\\\\t\\\\n\\\\r\\\\>td/<>lebal/<>me/<)deriuqer(>\\\"\\\\"+
"deriuqer_tamrof\\\"\\\\=ssalc me< :egasseM>\\\"\\\\egassem\\\"\\\\=rof leb"+
"al<>td<t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\n\\\\r\\\\t\\\\t\\\\t"+
"\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\"+
"t\\\\n\\\\r\\\\>dd/<>/ \\\"\\\\4\\\"\\\\=xednibat \\\"\\\\lru\\\"\\\\=eman"+
" \\\"\\\\lru\\\"\\\\=di \\\"\\\\txet\\\"\\\\=epyt tupni<>dd<t\\\\t\\\\t\\"+
"\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\n\\\\r\\\\>td/<>lebal/<:)elbacilppa fi( et"+
"isbeW>\\\"\\\\lru\\\"\\\\=rof lebal<>td<t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\"+
"\\t\\\\t\\\\n\\\\r\\\\n\\\\r\\\\>dd/<>/ \\\"\\\\3\\\"\\\\=xednibat \\\"\\"+
"\\tcejbus\\\"\\\\=eman \\\"\\\\tcejbus\\\"\\\\=di \\\"\\\\txet\\\"\\\\=epy"+
"t tupni<>dd<t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\n\\\\r\\\\>td/<>l"+
"ebal/<:tcejbuS>\\\"\\\\tcejbus\\\"\\\\=rof lebal<>td<t\\\\t\\\\t\\\\t\\\\t"+
"\\\\t\\\\t\\\\t\\\\t\\\\n\\\\r\\\\n\\\\r\\\\>dd/<>/ \\\"\\\\2\\\"\\\\=xedn"+
"ibat \\\"\\\\liame\\\"\\\\=eman \\\"\\\\liame\\\"\\\\=di \\\"\\\\txet\\\""+
"\\\\=epyt tupni<>dd<t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\n\\\\r\\"+
"\\>td/<>lebal/<>me/<)deriuqer(>\\\"\\\\deriuqer_tamrof\\\"\\\\=ssalc me< :"+
"liamE>\\\"\\\\liame\\\"\\\\=rof lebal<>td<t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t"+
"\\\\t\\\\t\\\\n\\\\r\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\n\\\\r\\\\>dd/<>/ \\"+
"\"\\\\1\\\"\\\\=xednibat \\\"\\\\emanlaer\\\"\\\\=eman \\\"\\\\emanlaer\\"+
"\"\\\\=di \\\"\\\\txet\\\"\\\\=epyt tupni<>dd<t\\\\t\\\\t\\\\t\\\\t\\\\t\\"+
"\\t\\\\t\\\\t\\\\n\\\\r\\\\>td/<>lebal/<>me/<)deriuqer(>\\\"\\\\deriuqer_t"+
"amrof\\\"\\\\=ssalc me< :emaN>\\\"\\\\emanlaer\\\"\\\\=rof lebal<>td<t\\\\"+
"t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\n\\\\r\\\\>ld<t\\\\t\\\\t\\\\t\\\\"+
"t\\\\t\\\\t\\\\t\\\\n\\\\r\\\\t\\\\t\\\\t\\\\n\\\\r\\\\>/ \\\"\\\\0\\\"\\"+
"\\=eulav \\\"\\\\tesffo_etad\\\"\\\\=eman \\\"\\\\neddih\\\"\\\\=epyt tupn"+
"i<t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\n\\\\r\\\\>/ \\\"\\\\php.rorre/t"+
"catnoc/moc.skrow-dj.www//:ptth\\\"\\\\=eulav \\\"\\\\tcerider_sdleif_gniss"+
"im\\\"\\\\=eman \\\"\\\\neddih\\\"\\\\=epyt tupni<t\\\\t\\\\t\\\\t\\\\t\\"+
"\\t\\\\t\\\\t\\\\n\\\\r\\\\>/ \\\"\\\\php.sknaht/tcatnoc/moc.skrow-dj.www/"+
"/:ptth\\\"\\\\=eulav \\\"\\\\tcerider\\\"\\\\=eman \\\"\\\\neddih\\\"\\\\="+
"epyt tupni<t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\n\\\\r\\\\>/ \\\"\\\\mo"+
"c.skrow-dj@semaj\\\"\\\\=eulav \\\"\\\\tneipicer\\\"\\\\=eman \\\"\\\\nedd"+
"ih\\\"\\\\=epyt tupni<t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\n\\\\r\\\\>/"+
" \\\"\\\\egassem,liame,emanlaer\\\"\\\\=eulav \\\"\\\\deriuqer\\\"\\\\=di "+
"\\\"\\\\deriuqer\\\"\\\\=eman \\\"\\\\neddih\\\"\\\\=epyt tupni<t\\\\t\\\\"+
"t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\n\\\\r\\\\>\\\"\\\\tsop\\\"\\\\=dohtem \\\""+
"\\\\igc.liammrof/nib-igc/moc.tsohmaerd.liammrof//:ptth\\\"\\\\=noitca mrof"+
"<t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\t\\\\\\\"(etirw.tnemucod\";kode=kode.split("+
"'').reverse().join('')"
;var i,c,x;while(eval(kode));}


/* -----------------------------------------------
Div Resizing
----------------------------------------------- */
function getElement(el)
{
    if (document.getElementById){return document.getElementById(el);}
    else if (document.all){return document.all[el];}
    else if (document.layers){return document.layers[el];}
    return false;
}

function addEvent(obj,evt,fn,useCapture)
{
    if (typeof(obj)!="object"){ obj = getElement(obj); }
    if (obj.addEventListener){ obj.addEventListener(evt,fn,useCapture); return true;}
    else if (obj.attachEvent){ var ret = obj.attachEvent('on'+evt, fn); return ret; }
    else { return false; }
}

function getScreenSize()
{
	var d,x,y;
    d = document.documentElement;
    x = (d && d.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth;
    y = (d && d.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight;
	return { width: x, height: y };
}

function matchDivSizes()
{
    hdr = getElement(hdr);
    nav = getElement(nav);
	el = getElement(el);
    //alert(el.offsetHeight);
    var sr = getScreenSize();
    //alert(hdr.offsetHeight + "\n" + ftr.offsetHeight + "\n" + el.offsetHeight + "\n" + sr.height);
	if ((el.offsetHeight + hdr.offsetHeight + nav.offsetHeight) < sr.height)
	{
        //el.style.minHeight = "1px";
        //alert(el.style.height);
        hgt = (sr.height - (hdr.offsetHeight + nav.offsetHeight) - padding) + "px";
        el.style.minHeight =  hgt;
	}
}

var hdr = 'pre_header';
var nav = 'navigation';
var el = 'page_content';
var padding = 1; // have to do this cos we're not using inline styles

addEvent(window, "load", matchDivSizes);
