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 formClose	if ((formClose = document.getElementById('formClose'))) {		formClose.onclick = closeForm		}		})function closeForm() {	var noBubbles	var myTempDiv = new mapInfo()	if ((myTempDiv.myDiv)) { myTempDiv.myDiv.style.display = 'none' }	if ((noBubbles = document.getElementById('noBubbles'))) {		noBubbles.style.width = '340px'		noBubbles.style.height = '620px'		}	}function mapInfo() {	var tempDiv	if ((tempDiv = document.getElementById('sessionForm'))) {		this.myDiv = tempDiv		}	if ((tempDiv = document.getElementById('bramptonMap'))) {		this.myLat = '54.944129'		this.myLong = '-2.735682'		this.descr = '<div>Brampton Community Centre, <br>The Irthing Centre, <br>Union Lane, <br>Brampton CA8 1BX</div>'		this.myDiv = tempDiv		}	if ((tempDiv = document.getElementById('houghtonMap'))) {		this.myLat = '54.92581'		this.myLong = '-2.925239'		this.descr = '<div>The Village Hall, <br>Houghton, <br>Carlisle CA3 0LD</div>'		this.myDiv = tempDiv		}	if ((tempDiv = document.getElementById('mortonMap'))) {		this.myLat = '54.89178'		this.myLong = '-2.952576'		this.descr = '<div>Wigton Road Methodist Church, <br>Wigton Road, <br>Carlisle CA2 7ES</div>'		this.myDiv = tempDiv		}	if ((tempDiv = document.getElementById('stanwixMap'))) {		this.myLat = '54.904683'		this.myLong = '-2.935109'		this.descr = '<div>St Michael\'s Parish Centre, <br>St Michael\'s Church, Stanwix, <br>Carlisle CA3 9DJ</div>'		this.myDiv = tempDiv		}	}addLoadEvent(function() {		var myMapInfo = new mapInfo()		if (document.getElementById("map_canvas")) {		var map = new GMap2(		document.getElementById("map_canvas"));		map.setCenter(		new GLatLng(myMapInfo.myLat,myMapInfo.myLong), 15);		map.addControl(new GLargeMapControl());		map.addControl(new GMapTypeControl());		var lsc = new google.maps.LocalSearch();		map.addControl(new google.maps.LocalSearch());		function createMarker(point, text, title) {			var marker =			new GMarker(point,{title:title});			GEvent.addListener(				marker, "click", function() {					marker.openInfoWindowHtml(text);					});			return marker;			}        		var marker = createMarker(			new GLatLng(myMapInfo.myLat,myMapInfo.myLong),        	myMapInfo.descr,        	'Venue'        	);		map.addOverlay(marker);		}		})addLoadEvent(function() {		var movieName, elementName, mwidth, mheight		if ((document.getElementById('teaching'))) {		movieName = 'helen.swf'		elementName = 'bubbles'		mwidth = '340'		mheight = '620'		}	else if ((document.getElementById('comments'))) {		movieName = 'comments.swf'		elementName = 'bubbles'		mwidth = '670'		mheight = '620'		}	else if ((noBubbles = document.getElementById('noBubbles'))) {		movieName = 'bubbles.swf'		elementName = 'noBubbles'		mwidth = '340'		mheight = '620'		}	else {		movieName = 'bubbles.swf'		elementName = 'bubbles'		mwidth = '340'		mheight = '620'		}	var flashvars = {};	var params = {};	params.wmode = "transparent";	var attributes = {};	swfobject.embedSWF(movieName,elementName,mwidth,mheight,'5.0.0',false,flashvars,params,attributes);		})addLoadEvent(function() {        var myParent    var MyPara = {}    var MyContacts = myContacts()	var MyDomain = myDomain()        if ((myParent = document.getElementById('e-contact'))) {    	var myImages = myParent.getElementsByTagName('img')    	for (i in MyContacts) {    		MyPara[i] = document.createElement('p');    		MyPara[i].appendChild(document.createTextNode(MyContacts[i][0]));    		if (MyContacts[i][1] == 1) MyPara[i].appendChild(document.createElement('br'));    		var myLink = document.createElement('a');    		var myEmailAddress = MyContacts[i][2] + '@' + MyDomain[i];    		var myCompleteEmail = 'mailto:' + myEmailAddress;    		myLink.setAttribute('href',myCompleteEmail);    		myLink.appendChild(document.createTextNode(myEmailAddress));    		MyPara[i].appendChild(myLink);    		MyPara[i].appendChild(document.createTextNode(MyContacts[i][3]));    		myParent.appendChild(MyPara[i]);    		myImages[i].style.display = 'none';    		}    	}			})	addLoadEvent(function() {	var myLinks	if ((myLinks = document.getElementsByTagName('a'))) {		var myWinLink;		var 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;					}				}			}		}		})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 myLinks = {}	myLinks['iWindow'] = new myWindow(myURL,340,620,'no','child')	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) {	opener.document.location = newURL	}addLoadEvent(function() {	var myParent	var i	if ((myParent = document.getElementById('page_select'))) {		var mySelects = myParent.getElementsByTagName('select')		for (i in mySelects) {			var myOption = mySelects[i]			myOption.onchange = getPage			} 		}	})function submitform() {	this.myForm.submit();	}addLoadEvent(function() {	var formObject	if ((formObject = document.getElementById('loginform'))) {		var conField = document.getElementById('confirm')		var conDiv = conField.parentNode.parentNode		conDiv.style.display = 'none'		var emailField = document.getElementById('email')		var emailDiv = emailField.parentNode.parentNode		emailDiv.style.display = 'none'				var myLogin = document.getElementById('login')		var myRegister = document.getElementById('register')				myLogin.showCon = conDiv		myLogin.showEmail = emailDiv				myRegister.showCon = conDiv		myRegister.showEmail = emailDiv				myLogin.onfocus = loginSwitch		myRegister.onfocus = registerSwitch				formObject.username = document.getElementById('username')		formObject.password = document.getElementById('password')		formObject.confirm = conField		formObject.email = emailField		formObject.register = myRegister		formObject.onsubmit = validate 		}	})	addLoadEvent(function() {	if ((deleteRecord = document.getElementById('deleteRecord'))) {		deleteRecord.onfocus = deleteAlert		}	})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'	}function registerSwitch() {	this.showCon.style.display = 'block'	this.showEmail.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 getPage() {	var getString = this.options[this.selectedIndex].value	if (getString != '') {		var getArray = getString.split(',')		var getUrl = 'edit.php?page=' + getArray[0] + '&dir=' + getArray[1]		window.location.href = getUrl		}	}function isInteger(s) {	return (s.toString().search(/^-?[0-9]+$/) == 0);	}
