function addLoadEvent(func) {    var oldonload = window.onload;    if (typeof window.onload != 'function') { window.onload = func; }    else {    	window.onload = function() {			if (oldonload) {				oldonload();            	}			func();        	}    	}	}addLoadEvent(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);	})addLoadEvent(function() {	if ((document.getElementById('twitter'))) {		jQuery("#twitter").getTwitter({			userName: window.t_username,			numTweets: window.t_tweets,			loaderText: "Loading tweets...",			slideIn: true,			slideDuration: 750,			showHeading: true,			headingText: "Latest Tweet",			showProfileLink: true,			showTimestamp: true			})		}	})addLoadEvent(function() {	if (jQuery('dt.theme') != null) {		jQuery('dt.theme').click(function() {			jQuery('dd.title').slideUp('normal');				jQuery(this).next().slideDown('normal');			});		jQuery("dd.title").hide();		jQuery("dt.open").trigger('click');				jQuery("dd.btitle").hide();		jQuery("dt.bopen").trigger('click');		}	})addLoadEvent(function() {	if (document.getElementById("navigation")) {		if (window.attachEvent) {			var sfEls = document.getElementById("navigation").getElementsByTagName("li");			for (var i=0; i<sfEls.length; i++) {				sfEls[i].onmouseover=function() {					this.className+=" sfhover";					}				sfEls[i].onmouseout=function() {					this.className=this.className.replace(new RegExp(" sfhover\\b"), "");					}				}			}		}	})addLoadEvent(function() {	var mySearch	if ((mySearch = document.getElementById('q_search'))) {		if (window.q_search != 'clicked') mySearch.setAttribute('value','search')		mySearch.onclick = unSearch		}	})addLoadEvent(function() {	var slideshow = new BarackSlideshow('menu', 'pictures', 'loading', {transition: window.g_transition, auto: window.g_auto})	})addLoadEvent(function() {		if (document.getElementById("map_canvas")) {		var map = new GMap2(			document.getElementById("map_canvas"));			map.setCenter( new GLatLng(window.lat,window.lng),window.mapScale);			map.addControl(new GLargeMapControl());			map.addControl(new GMapTypeControl());			var lsc = new google.maps.LocalSearch();			map.addControl(new google.maps.LocalSearch()			);		function createMarker(point,html,title) {			var marker = new GMarker(point,{title:title});						GEvent.addListener(				marker, "click", function() {					marker.openInfoWindowHtml(html);					});			return marker;			}        		var point = new GLatLng(window.lat,window.lng)		var html = window.mapHTML + '<br /><form action="javascript:getDirections()">' +		'From (post code): <input type="text" size=8 maxlength=8 name="saddr" id="saddr" value="" /><br /><br />' +		'Walk <input type="checkbox" name="walk" id="walk" /> &nbsp; Avoid main roads <input type="checkbox" name="highways" id="highways" />' +		' <input value="Get Directions" type="submit"><br />' +		'<input type="hidden" id="daddr" value="'+ window.mapTitle +'@'+ window.lat + ',' + window.lng + '"/></form></div>'        		var marker = createMarker(point,html,window.mapTitle);		map.addOverlay(marker);				// === create a GDirections Object ===		window.gdir = new GDirections(map, document.getElementById("directions"));		// === Array for decoding the failure codes ===		var reasons=[];		reasons[G_GEO_SUCCESS]            = "Success";		reasons[G_GEO_MISSING_ADDRESS]    = "Missing Address: The address was either missing or had no value.";		reasons[G_GEO_UNKNOWN_ADDRESS]    = "Unknown Address:  No corresponding geographic location could be found for the specified address.";		reasons[G_GEO_UNAVAILABLE_ADDRESS]= "Unavailable Address:  The geocode for the given address cannot be returned due to legal or contractual reasons.";		reasons[G_GEO_BAD_KEY]            = "Bad Key: The API key is either invalid or does not match the domain for which it was given";		reasons[G_GEO_TOO_MANY_QUERIES]   = "Too Many Queries: The daily geocoding quota for this site has been exceeded.";		reasons[G_GEO_SERVER_ERROR]       = "Server error: The geocoding request could not be successfully processed.";		reasons[G_GEO_BAD_REQUEST]        = "A directions request could not be successfully parsed.";		reasons[G_GEO_MISSING_QUERY]      = "No query was specified in the input.";		reasons[G_GEO_UNKNOWN_DIRECTIONS] = "The GDirections object could not compute directions between the points.";				// === catch Directions errors ===		GEvent.addListener(gdir, "error", function() {			var code = gdir.getStatus().code;			var reason="Code "+code;			if (reasons[code]) {				reason = reasons[code]				} 			alert("Failed to obtain directions, "+reason);			});				}		})addLoadEvent(function() {		var flashvars = {		affcode: window.affcode		}	var params = {}	var attributes = {}	var i	var MyBanner = window.bannerArray		params.wmode = 'transparent';		if ((window.swfobject)) {		for (i in MyBanner) {			var banner = MyBanner[i][0]			if ((document.getElementById(banner))) {				var movieName = MyBanner[i][1]				var mwidth = MyBanner[i][2]				var mheight = MyBanner[i][3]				var mVer = MyBanner[i][4]				swfobject.embedSWF(movieName,banner,mwidth,mheight,mVer,false,flashvars,params,attributes)				}			}		}	})addLoadEvent(function() {	var selectObject = {}	var archive = window.archive	for (var i=0; i<archive.length; i++) {		if ((selectObject = document.getElementById(archive[i][0]))) {			var selectGo = document.getElementById(archive[i][3])			selectGo.style.display = 'none'			selectObject.archiveURL = archive[i][1] + '.php?' + archive[i][2] + '='			selectObject.onchange = getPage			}		}	})addLoadEvent(function() {	var i,j	if ((document.getElementById('edit'))) {		var myForms = document.getElementsByTagName('form')		for (var i=0; i < myForms.length; i++) {			var formClassObject = myForms[i].getAttributeNode('class')			if (formClassObject != null) {				if (formClassObject.value == 'page_select') {					var mySelects = myForms[i].getElementsByTagName('select')					for (j in mySelects) {						var myOption = mySelects[j]						myOption.page_id = 'edit'						myOption.element_id = 'rCustom'						myOption.onchange = getEdit						}					}				}			}		}	})addLoadEvent(function() {	window.field = new Array()	var myFields = document.getElementsByTagName('fieldset')	for (var i=0; i < myFields.length; i++) {		if (myFields[i].className == 'expanData') doToggle(myFields[i],i)		}	})addLoadEvent(function() {	var formObject	if ((formObject = document.getElementById('loginform'))) {		var conField = document.getElementById('confirm')		var conDiv = conField.parentNode		conDiv.style.display = 'none'		var emailField = document.getElementById('email')		var emailDiv = emailField.parentNode		emailDiv.style.display = 'none'		var codeField = document.getElementById('code')		var codeDiv = codeField.parentNode		codeDiv.style.display = 'none'		var noteField = document.getElementById('name')		var noteDiv = noteField.parentNode		noteDiv.style.display = 'none'				var myLogin = document.getElementById('login')		var myRegister = document.getElementById('register')				myLogin.showCon = conDiv		myLogin.showEmail = emailDiv		myLogin.showCode = codeDiv		myLogin.showNote = noteDiv				myRegister.showCon = conDiv		myRegister.showEmail = emailDiv		myRegister.showCode = codeDiv		myRegister.showNote = noteDiv				myLogin.onfocus = loginSwitch		myRegister.onfocus = registerSwitch				formObject.username = document.getElementById('username')		formObject.password = document.getElementById('password')		formObject.confirm = conField		formObject.email = emailField		formObject.code = codeField		formObject.register = myRegister		formObject.onsubmit = validate 		}	})addLoadEvent(function() {	if ((deleteRecord = document.getElementById('deleteRecord'))) {		deleteRecord.onfocus = deleteAlert		}	})		addLoadEvent(function() {	if ((document.getElementById('quote'))) {		document.getElementById('quote').innerHTML = text;		}	})	addLoadEvent(function() {	var myLinks,linkClassObject	if ((myLinks = document.getElementsByTagName('a'))) {		var myWinLink, myWinURL, MyLink;		for (i in myLinks) {			if (isInteger(i)) {				MyLink = myLinks[i]				var linkClassObject = myLinks[i].getAttributeNode('class')				if (linkClassObject != null) {					myWinLink = linkClassObject.value;					var urlClassObject = myLinks[i].getAttributeNode('href');					if (urlClassObject != null) myWinURL = urlClassObject.value;					MyLink.item = winLinks(myWinLink,myWinURL);					MyLink.onclick = newWindow;					}				}			}		}		})	addLoadEvent(function() {	var paneSpan	if ((paneSpan = document.getElementById('paneSpan'))) {		paneSpan.paFrame = document.getElementById('paFrame')		paneSpan.onclick = expandFrame		}	})	addLoadEvent(function() {	var getThumbs	if ((getThumbs = document.getElementById('selectThumbs'))) {		getThumbs.side = document.getElementById('side')		getThumbs.onclick = showThumbs		}	})/* FUNCTIONS */function unSearch() {	window.q_search = 'clicked'	this.setAttribute('value','')	}function getDirections() {	var opts = {};	if (document.getElementById("walk").checked) {		opts.travelMode = G_TRAVEL_MODE_WALKING;		}	if (document.getElementById("highways").checked) {		opts.avoidHighways = true;		}	var saddr = document.getElementById("saddr").value	var daddr = document.getElementById("daddr").value	window.gdir.load("from: "+saddr+" to: "+daddr, opts);	}function doToggle(myFieldset,i) {	var j	var myDivs = myFieldset.getElementsByTagName('div')	var myFImage = myFieldset.firstChild.getElementsByTagName('img')[0]	window.field[i] = 0	myFImage.incr = i	myFImage.myDivs = myDivs	myFImage.onmouseover = LegendImageOver	myFImage.onmouseout = LegendImageOut	myFImage.onclick = accessFields	for (j in myDivs) {		if ((isInteger(j))) {			var myDiv = myDivs[j]			myDiv.style.display = 'none'			}		}	}function LegendImageOver() {	var incr = this.incr	if (window.field[incr] == 0) { this.src = 'images/openFieldOver.gif' }	else { this.src = 'images/closeFieldOver.gif' }	}function LegendImageOut() {	var incr = this.incr	if (window.field[incr] == 0) { this.src = 'images/openField.gif' }	else { this.src = 'images/closeField.gif' }	}function accessFields() {	var j	var incr = this.incr	if (window.field[incr] == 1) { window.field[incr] = 0 }	else { window.field[incr] = 1 }	var myDivs = this.myDivs	for (j in myDivs) {		if ((isInteger(j))) {			var myDiv = myDivs[j]			if (window.field[incr] == 0) {				myDiv.style.display = 'none'				this.src = 'images/openField.gif'				this.setAttribute('alt','open field')				this.setAttribute('title','open field')				}			else {				myDiv.style.display = 'block'				this.src = 'images/closeField.gif'				this.setAttribute('alt','hide field')				this.setAttribute('title','hide field')				}			}		}	}function submitform() {	this.myForm.submit();	}function deleteAlert() {	alert('Important: this action cannot be undone; uncheck delete if you wish to maintain this record')	}function loginSwitch() {	this.showCon.style.display = 'none'	this.showEmail.style.display = 'none'	this.showCode.style.display = 'none'	this.showNote.style.display = 'none'	}function registerSwitch() {	this.showCon.style.display = 'block'	this.showEmail.style.display = 'block'	this.showCode.style.display = 'block'	this.showNote.style.display = 'block'	}function validate() {	if (this.register.checked == true) {		if (this.password.value != this.confirm.value) {			alert('Register: You have not confirmed your password correctly')			return false			}		else if (this.username.value == "" || this.password.value == "" || this.email.value == "") {			alert('Register: You have missed a field')			return false			}		else return true		}	else if (this.username.value == "" || this.password.value == "") {			alert('Login: You have missed a field')			return false			}	else return true	}function expandFrame() {	clearData(this)	if (window.myFrame == 'expand') { window.myFrame = 'retract' }	else { window.myFrame = 'expand' }	if (window.myFrame == 'expand') {		this.paFrame.style.display = 'block'		this.paFrame.style.position = 'absolute'		this.paFrame.style.width = '600px'		this.paFrame.style.height = '600px'		this.paFrame.style.borderColor = '#333'		this.paFrame.style.borderStyle = 'solid'		this.paFrame.style.borderWidth = '2px'		this.paFrame.style.left = '-300px'		this.appendChild(document.createTextNode('(Close)'))		}	if (window.myFrame == 'retract') {		this.paFrame.style.display = 'none'		this.appendChild(document.createTextNode('(Open)'))		}	}function getPage() {	var getNo = this.options[this.selectedIndex].value	var archive = this.archiveURL	if (getNo != '') {		var getUrl = archive + getNo		window.location.href = getUrl		}	}function getEdit() {	var getString = this.options[this.selectedIndex].value	if (getString != '') {		var myObject = document.getElementById(this.element_id)		if ((myObject)) {			if (myObject.checked == true) { var plusString = '&option=' + this.element_id }			else { var plusString = '' }			}		else { var plusString = '' }		var getUrl = 'index.php?pageid=' + this.page_id + '&page=' + getString + plusString		window.location.href = getUrl		}	}function showThumbs() {	while (this.childNodes[0]) {    	this.removeChild(this.childNodes[0]);    	}	if ((!window.thumb) || window.thumb == 'hide') { window.thumb = 'show' }	else { window.thumb = 'hide' }	if (window.thumb == 'show') {		this.side.style.display = 'block'		this.appendChild(document.createTextNode('Hide thumbnails'))		}	if (window.thumb == 'hide') {		this.side.style.display = 'none'		this.appendChild(document.createTextNode('View thumbnails of all styles'))		}	}function myWindow(myURL,myWidth,myHeight,myNav,myRelative) {	this.myURL = myURL;	this.myWidth = myWidth;	this.myHeight = myHeight;	this.myNav = myNav;	this.myRelative = myRelative;	}function winLinks(myClass,myURL) {	var mc,mw,mh,mn,mr	var linksArray = window.windowLinks	var myLinks = {}	for (var i=0;i<linksArray.length;i++) {		mc = linksArray[i][0]		mw = linksArray[i][1]		mh = linksArray[i][2]		mn = linksArray[i][3]		mr = linksArray[i][4]		myLinks[mc] = new myWindow(myURL,mw,mh,mn,mr)		}	var myNewWindow = myLinks[myClass];	return  myNewWindow;	}	function newWindow() {	var thisWin;	var myWin = this.item;	if (myWin) {		if (myWin.myRelative == 'parent') {			updateParent(myWin.myURL);			window.close();			}		else {			thisWin = window.open(myWin.myURL,'popup','toolbar=' + myWin.myNav + ',location=' +  myWin.myNav + ',scrollbars=yes,resizable=yes,width=' + myWin.myWidth + ',height=' + myWin.myHeight);			thisWin.focus();			return false;			}		}	}function updateParent(newURL) {	myParent = window.opener	if (myParent != null && newURL !='') myParent.document.location = newURL	}function clearData(myLabel) {	while (myLabel.childNodes[0]) {    		myLabel.removeChild(myLabel.childNodes[0]);    		}	}function isInteger(s) {	return (s.toString().search(/^-?[0-9]+$/) == 0);	}
