//========================================================
//
// PROTOTYPES TO CREATE METHODS
//
//========================================================
// creates an rnd prototype in Array.
// returns integer from 0 to number - 1
Number.prototype.rnd = function (){
return parseInt(Math.random() * this,10);
}
//--------------------------------------------------------
// creates a shuffle prototype in Array.
Array.prototype.shuffle = function (){
	for (var rnd, tmp, i=this.length; i; rnd=parseInt(Math.random()*i), tmp=this[--i], this[i]=this[rnd], this[rnd]=tmp);
	}

//--------------------------------------------------------
// create a getUKdate prototype in String
String.prototype.getUKdate = function (){
var ndate = new Date();
var cdate = new Date(ndate.getFullYear(),ndate.getMonth(),ndate.getDate());
var n = this.split("/");
var d = parseInt(n[0],10);
var m = parseInt(n[1],10)-1;
var y = parseInt(n[2],10);

if (n[0]*1 == 0) d = ndate.getDate();
if (n[1]*1 == 0) m = ndate.getMonth();
if (n[2]*1 == 0) y = ndate.getFullYear();
var nd = new Date(y,m,d);
if (n[1]*1 == 0 && nd.getTime() < cdate.getTime()) {
	m++;
	if (m == 12) {
		m = 0;
		y++;
		}
	nd = new Date(y,m,d);
	}
if (n[2]*1 == 0 && nd.getTime() < cdate.getTime()) {
	y++;
	nd = new Date(y,m,d);
	}
return nd;
}
//--------------------------------------------------------
// create a rot13 prototype in String
String.prototype.rot13 = function (){
var s = this;
for (var x = 0; x < this.length; x++)	{
	var n = s.charCodeAt(x);
	if (((n>64) && (n<78)) || ((n>96 ) && (n<110))) {
		s=s.substring(0,x) + String.fromCharCode(n+13) + s.substring(x+1);
		}
	if (((n>77) && (n<91)) || ((n>109) && (n<123))) {
		s=s.substring(0,x) + String.fromCharCode(n-13) + s.substring(x+1);
		}
	}
return s;
}
//--------------------------------------------------------
// create a trim prototype in String
String.prototype.trim = function (){
var s = this;
while (s.charCodeAt(0) < 33)	s = s.substring(1);
while (s.charCodeAt(s.length-1) < 33)	s = s.substring(0,s.length-1);
return s;
}
//--------------------------------------------------------
// create an average prototype in Array (numeric - returns REAL)
Array.prototype.average = function (){
//this.sort();
return (eval(this.join("+")))/this.length;
}
//--------------------------------------------------------
window.onerror = myError;
document.onmouseover = tip;
document.onmousedown = sparky;
//document.oncontextmenu = showcontext;
//--------------------------------------------------------

var head     = document.getElementsByTagName('HEAD')[0];
var marqjs   = document.createElement('SCRIPT');
if (randomarq) marqty = (marqty+1).rnd();
marqjs.src = '../home/marquee/marque' + marqty + '.js';
head.appendChild(marqjs);
//========================================================
//
// ITEMS NEEDING FREQUENT UPDATING
//
// see data.js & xmem.js
//
//========================================================

var testmode=false;// set to true to cycle through all the pages







//========================================================
//
//  GLOBAL CONSTANTS USED FREQUENTLY 
//
//========================================================

//	D A T E S 

var day = 1000*60*60*24;
var tday = new Date();
var caldate = new Date(tday.getFullYear(),tday.getMonth(),tday.getDate());
var tnow = tday.getTime();
var yesterday = tnow - day;
var lastweek  = tnow - (7*day);
var lastmonth = tnow - (30*day);
var stime = 0; //will show time visible
var ttime = 0; //will show time complete

var dayName = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
var monName = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var numName = ["","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen","twenty",""];
var bigNums = ["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];


var modified = new Date(document.lastModified);// only available from server
var fullyear = modified.getFullYear();

//if (fullyear < 100) 	{fullyear = fullyear + 2000 };

//	F I L E S (changed 20/8/2009)

var passedURL = document.location.href;
var fulname = "path/sect_file_bit.htm?data=value#anchor";
var incquery = "path/sect_file_bit.htm?data=value";
var menubit = "path/sect_file_bit.htm";
var endname = "sect_file_bit.htm";
var uniname = "sect_file_bit";
var endid = "file_bit.htm";
var idonly = "file_bit";
var spath = "path";
var urlsrch = "data=value";
var urlanch = "anchor";

set_up_file_ids();


//alert("passedURL = " + passedURL + "\n\nendname = " + endname + "\nendid = " + endid + "\nidonly = " + idonly + "\nfullname = " + fulname + "\nincquery = " + incquery + "\nurlsrch = " + urlsrch + "\nurlanch = " + urlanch);

// IE version (for cursor)
var iev = "";

//	P A G E   D A T A   F R O M   M E N U	defined when menu written

var menu_author = "";
var menu_update = new Date();
var menu_locata = "";
var menu_stars  = "0";


var localflag=false;
if (document.location.protocol=="file:") localflag = true;

var altnames = [];
//var nameindex = 0;
var upto = 0; //used by star routines
var caller = "";
var backp = ""; //previous and next link in section sequence
var nextp = ""; //set by backlink and nextlink routines. Used with < & > keystrokes
var picturecount = 0; // counted when menu is created
var albumcount = 0;




























//========================================================
//
// ROUTINES TO RUN BEFORE LOADING. 
//
// NB DO NOT INCLUDE ITEMS THAT CHANGE HTML NOT WRITTEN UNTIL ONLOAD COMPLETE - use init()
//
//========================================================
if (self.location!=top.location && !localflag) top.location.href=self.location;

onresize = comment_position;
onscroll = comment_position;
onunload = save_notes;

//document.title += " . . . ";
//setInterval(scrolltitle,100);

//======================================================== 
// overrides default error routine. Development use gives reasonable report.
function myError(msg, URL, ln)	{
if (localflag) alert(msg + "\n\n" + URL + " line " + ln);
return true;
}
//======================================================== 
//
// COOKIE READING AND WRITING
//
//======================================================== 
var expire_date = new Date(tday.getFullYear()+4,tday.getMonth());
var aCookie = "A";
var bCookie = "B";
var cCookie = "C";
var lCookie = "";//local bookmarks
var nCookie = "";//notes

varCookie(); //puts ALL cookie values unto variable names including OLD Mem IF IT EXISTS

// Create NEW cookie
if (aCookie == "A") aCookie = "A" + tnow;

if (bCookie == "B") {
	if (cCookie == "C") {
		cCookie = "C" + tnow;
		bCookie = "B" + tnow;
		} else {
		bCookie = "B" + parseInt(cCookie.substring(1));
		}
	}
if (tnow - parseInt(cCookie.substring(1)) > day/2 || bCookie == "B") { //ie last visit more than 12 hours ago
	bCookie = "B" + parseInt(cCookie.substring(1));
	}
cCookie = "C" + tnow;

setCookie("aCookie",aCookie);
setCookie("bCookie",bCookie);
setCookie("cCookie",cCookie);

var prevvisit = parseInt(bCookie.substring(1));
//--------------------------------------------------------

function save_notes() { //when page closes - check it does not conflict with Gmap close.
var comment = document.commentform.txtarea.value;
comment = comment.trim();
if (comment =="") {
	deleteCookie("nCookie");
	} else {	
	var lastline = "\n\n[" + tday.getDate() + ' ' +  monName[tday.getMonth()] + ' ' + tday.getFullYear() + " - " + document.title.split(" - ")[0] + "]";
	if (comment.slice(-1) == "]") lastline = "";
	setCookie("nCookie",comment + lastline);
	}

var cmarks = [];
for (var x=0;x<document.commentform.elements.length;x++) {
	if (document.commentform.elements[x].name.substring(0,4) == "mark" && document.commentform.elements[x].checked) cmarks.push(document.commentform.elements[x].id);
	}
if (cmarks.length == 0) {
	deleteCookie("lCookie");
	} else {
	while (cmarks.length > 9) cmarks.shift();
	var cookmark = cmarks.join("|");
	setCookie("lCookie",cookmark);
	}

}
//======================================================== 
function set_up_file_ids() {
// run while starting as a function to control local variables
var endslash = passedURL.lastIndexOf("/");
var secslash = passedURL.lastIndexOf("/",endslash-1);

fulname = passedURL.substring(secslash+1);

endslash = fulname.indexOf("/");
var dot  = fulname.indexOf(".htm");
var hash = fulname.indexOf("#");
var uscore = fulname.indexOf("_"); // FIRST ... there may be more

incquery = (hash == -1) ? fulname:fulname.substring(0,hash);
menubit = fulname.substring(0,dot+4);
endname = menubit.substring(endslash+1);
uniname = menubit.substring(endslash+1,dot);
endid	= menubit.substring(uscore+1);
idonly	= menubit.substring(uscore+1,dot);
spath 	= menubit.substring(0,endslash);
urlsrch = document.location.search.substring(1);
urlanch = document.location.hash.substring(1);
}


// END OF THE BEFORE LOAD ROUTINES









































//========================================================
//
// ONLOAD EVENT USED BY ALL PAGES
// Make sure it does not fail if OBJECTS are missing!
// Use this for items that need the HTML writing first
//
// Not used on MAP or FOZ ANNUAL (pages take too long to work through!)
//
//========================================================
var contentLinks = []; //global, created in init
function init()	{

//checks how long the page takes to load. Shown in documentation.
var tnext = new Date();
var nnow = tnext.getTime();
stime = (nnow-tnow)/1000;

if (navigator.appVersion.indexOf("Chrome") > 0 ) {
	document.getElementById("frfi").style.right = 150;
	}
if (document.all) {
	document.getElementById("mjoker").style.top = "2px";
	} else {
	document.getElementById("IDcontent").style.paddingTop = "15px";
	}

comment_position();
var cmt = document.getElementById("IDcomment");
cmt.style.left = -394;


//writeReport();

showTimer();		//shows class=box items according to before, after or only

setTimeout(breadCrumb,100);		//adds link structure to page

if (spath !="post") insertNameTips();	//puts the ex-member 'tooltip' wherever a name occurs - POST pages take too long

setTimeout(primeNames,3000);		//finds ex-member names in text and AREA ALT tags and writes them under the left menu

setTimeout(overX,20000);		//class=X contents crossed out and replaced by title

contentLinks = document.getElementById("IDcontent").getElementsByTagName("A");
document.getElementById("IDcontent").onmouseover = shutAll;
if (endname.indexOf("rally_badge") == -1) wiseLinks();		//disables links to the current page - except badges
searchFinder(); // generic onload action for variables passed by query eg ?person=Jack%20Smith

// Cursor - added 12/7/2009 see "small functions" for sparky() and plug()
//document.body.onmousedown = sparky;
//document.body.onmousemove = plug;
if (document.all) {
	var v = navigator.appVersion;
	var p = v.indexOf("MSIE") + 5;
	iev = parseInt(v.substring(p),10);
	}
plug();

// free up memory by deleting data arrays
//members_db = [];
//newstuff_db = [];
//menu_db = [];
star_db = [];

localInit();		//calls on to local initial JavaScript in local standard.js

if (testmode) getnextdelay();		//enable this to check all the web pages in turn

//checks how long the page takes to load. Shown in documentation.
tnext = new Date();
nnow = tnext.getTime();
ttime = (nnow-tnow)/1000;

}

//========================================================

function ContextMenu() {
alert('Context menu');
return false;
}

//========================================================
// To put tooltips on members names


function insertNameTips()	{
imgarr = document.getElementById("IDcontent").getElementsByTagName('P');
addNames(imgarr);
imgarr = document.getElementById("IDcontent").getElementsByTagName('LI');
addNames(imgarr);
}

function addNames(imgarr) {

//window.status="addNames() running";
for (var x = 0; x < imgarr.length ; x++) {
	paragraph = imgarr[x].innerHTML;

//	if (paragraph.indexOf("</SPAN>")==-1) {

		hang = "0";
		for (var y=1;y<members_db.length;y++)	{
			nameonce = true;
			fieldsFromRecord(y);

			memname = firstname + " " + lastname;

			memmess = "<br><br>";
			if (contact == 1) memmess = "<br><br><img onClick=snd(\'" + escape(memname) + "\') alt=\'Send a message to " + memname + "\' src=../home/graphics/env.gif>";
			if (contact == 2) {
				memmess = "<br><br><img onClick=snd(\'" + escape(memname) + "\') alt=\'Send a message to " + memname + "\' src=../home/graphics/eml.gif>";
/*				for (var s = 1; s < Skype_db.length;s++) {
					Skype_rec = Skype_db[s].split("|");
					if (Skype_rec[4] == filename) memmess = "<br><br><a href=\'skype:" + Skype_rec[1] + "?call\'><img alt=\'Call " + memname + "\ FREE using Skype' src=../home/graphics/skp.gif></a>";
					}
*/				}
			memnick = "";
			if (nickname!="") memnick = "<br>aka " + nickname + "<br>";

			memlink = "&nbsp;&nbsp;<a href=../members/members_form.htm?" + filename + " title=\'current profile\'>Tell about</a>";
			if (profile==1) memlink = "&nbsp;&nbsp;<a href=../members/profile_" + filename + ".htm title=\'current profile\'>Read about</a>";

			posm = paragraph.indexOf(memname);
			if (posm>-1)	{
				altnames.push(firstname + " " + lastname);
				pichtml = "";
				if (qty>0) {
					wichpic = rnd(qty);
					picname = "../home/portrait/" + filename + wichpic + ".jpg";
					pichtml = "<img src=" + picname + " align=right>";
					}
				if (pichtml == "") pichtml = "<br>Please send photo<br>";
				newparagraph = paragraph.substring(0,posm) + "<a class=xmem id=x" + filename + " name=" + filename + " tooltip=\"" + pichtml + memnick + "<br>" + comments + memmess + memlink + "\">" + memname + "</a>" + paragraph.substring(posm + memname.length, paragraph.length);
				paragraph = newparagraph;
				hang = "1";
				nameonce=false;
				}
			if (nickname!="" && nameonce) { 
				memname = nickname;
				posm = paragraph.indexOf(memname);
				if (posm>-1)	{
					altnames.push(firstname + " " + lastname);
					pichtml = "";
					if (qty>0) {
						wichpic = (1*qty).rnd();
						picname = "../home/portrait/" + filename + wichpic + ".jpg";
						pichtml = "<img src=" + picname + " align=right>";
						}
					if (pichtml == "") pichtml = "<br>Please send photo<br>";
					newparagraph = paragraph.substring(0,posm) + "<a class=xmem id=x" + filename + " name=" + filename + " tooltip=\"" + pichtml + firstname + " " + lastname + "<br><br>" + comments + memmess + memlink + "\">" + memname + "</a>" + paragraph.substring(posm + memname.length, paragraph.length);
					paragraph = newparagraph;
					hang = "1";
					}
				}
			}// end of members
		if (hang == "1") imgarr[x].innerHTML = paragraph;

//		}// don't bother if there is already a tooltip
	}//   end of paragraph
//window.status="addNames() finished";

}

//========================================================

// to highlight and disable link to current page, add star rating asterisks in title, mark recent page links

var compareDate = lastweek; 
var comparePage = endname.substring(0,endname.length-4);

function wiseLinks() {
// work thru menu and content links


linkArray = document.getElementById("IDmenu").getElementsByTagName("A");

for (var x=1;x<linkArray.length;x++) {
	pageLink = linkArray[x];
	wiseUp(pageLink);
	}

for (var x=0;x<contentLinks.length;x++) {
	pageLink = contentLinks[x];
	wiseUp(pageLink);
	contentLinks[x].onmouseover = mon;
	contentLinks[x].onfocus = mon;
	contentLinks[x].onmouseout = mof;
	if (contentLinks[x].target == "newin") {
		if (document.all) {
			contentLinks[x].style.cursor = "url(../home/gifs/newin.ani)";
			} else {
			contentLinks[x].style.cursor = "url(../home/gifs/newin.gif), auto";
			}
		contentLinks[x].style.targetNew = "tab";
		}
	if (contentLinks[x].target == "flickr") {
		if (document.all) {
			contentLinks[x].style.cursor = "url(../home/gifs/flick.ani)";
			} else {
			contentLinks[x].style.cursor = "url(../home/gifs/flick.gif), auto";
			}
		}

	}
}	

//--------------------------------------------------------

function wiseUp(lnk) {
// subroutine for single link to highlight and disable link to current page, add star rating asterisks in title, mark recent page
// 24 Jan 2009 added check for password protected pages

if (lnk.title == undefined) lnk.title = "";
if (lnk.alt   == undefined) lnk.alt   = "";
var a = lnk.href.lastIndexOf("/")+1;
var q = lnk.href.lastIndexOf("?")+1;
var b = lnk.href.lastIndexOf(".htm");
if (b<a) b=a;
lnkName = lnk.href.substring(a,b);

// Check if this is the current page
if (lnkName == comparePage && q == 0) {
	currentPage(lnk);
	} else {

//Add the star rating
	upto = measure(lnkName);
	asterisks = "";
	if (upto>0) {
		asterisks = " \n";
		asterisks += astarise(upto);
		}
	lnk.title += asterisks;

//add 'new' to recent pages

	for (var z=0;z<newstuff_db.length;z++) {
		fieldsFromNewStuff(z);
		postdate = britdate.getUKdate();
		newName = newfile.substring(newfile.lastIndexOf("/")+1,newfile.lastIndexOf(".htm"));

		if (lnkName == newName && postdate > compareDate) {
			lilgif = "new";
			verbid = " created";

			if (showgif == "1") {
				lilgif = "new";
				verbid = " created";
				}
			if (showgif == "2") {
				lilgif = "more";
				verbid = " updated";
				}
			if (showgif == "3") {
				lilgif = "starsmall";
				verbid = " star rated";
				}
			if (showgif == "4") {
				lilgif = "purr";
				verbid = " fixed";
				}
			if (postdate.getTime() > caldate.getTime()) {
				lilgif = "soon";
				verbid = " coming";
				}
			if (postdate - caldate == 0) lilgif = "today";
			lnk.innerHTML += "<img src=../home/graphics/" + lilgif + ".gif>";
			lnk.title += " \n" + newwords + " \nUpdated " + britdate;
			//if tooltip add title and remove 
			if (lnk.getAttribute("tooltip")) {
				lnk.tooltip =  newwords + verbid + " on " + britdate + "<br><br>" + lnk.tooltip;
				lnk.title = "";
				}
			}
		}
	}

if (lnkName=="home_calendar") {
	evnt="";
	oldtool = "";
	if (lnk.getAttribute("tooltip")) oldtool = lnk.tooltip;
	for (var z=1;z<reunions_db.length;z++) {
		fieldsFromReunions(z);
		postdate = meetdate.getUKdate();
		if (postdate.getTime() >= caldate.getTime()) evnt =  meetdate + " \n" + mplace + " \n" + mcomment + " \n \n" + oldtool;
		}
	lnk.tooltip = "";
	lnk.title = HTML2JS(evnt);
	}
if (lnkName.substring(0,8)=="profile_") {
	lnk.title = "PASSWORD PROTECTED \n" + lnk.title;
	}
if (lnk.target == "newin") lnk.style.cursor = "url(../home/gifs/newin.ani)";
}

//--------------------------------------------------------

function currentPage(obj) {
// mark and delay this link

obj.style.backgroundColor = "#bcf";
obj.style.borderColor = "red";
obj.onclick = abortLink;
obj.title = "You are viewing this page";
obj.style.color = "red";
}

//--------------------------------------------------------

function abortLink() {
titlesplit = document.title.split("-");
if (! confirm("This will reload the " + titlesplit[0] + "page.\n\nDo you wish to do that?")) {
	return false;
	}
return true;
}

//========================================================
// Finds names from AREA ALT values, sorts them, removes duplicates. Omits short ALTS that are probably numbers.
// also adds mouseover and mouseout events to the area tags in IE
// adds a link to the name in the text and highlights it red if clicked to

function primeNames()	{

w = false;
arrayArea = document.getElementsByTagName("AREA");
for (var x=0;x<arrayArea.length;x++) {   
	althere = arrayArea[x].alt;
	if (althere.length>2) {
		altnames.push(althere);
		} else {
		w = true;
		}
	arrayArea[x].onmouseover = mon;
	arrayArea[x].onmouseout = mof;
	arrayArea[x].onfocus = mon;
	arrayArea[x].onblur = mof;
	}


altnames = uniqueArray(altnames);
while (altnames[0] == "") altnames.shift();
if (altnames.length>0)	peopleMenu();
if (contentLinks.length>0)	linksMenu();

}//end of primeNames()
//--------------------------------------------------------
function redden(idn) {
allas = document.getElementsByTagName("A");
for (var tn = 0; tn<allas.length;tn++) {
	if (allas[tn].id.charAt(0) == "x") {
		allas[tn].style.backgroundColor = "white";
		allas[tn].style.color = "navy";
		}
	}
obj = document.getElementById(idn);
obj.style.backgroundColor = "red";
obj.style.color = "white";
}

//========================================================

// if the class is "x" then the item is crossed out with red Xs

function overX() {
arraySpan = document.getElementsByTagName("SPAN");
for (var z=0;z<arraySpan.length;z++) {
	obj = arraySpan[z];
	if (arraySpan[z].className == "x") {
		s$ = arraySpan[z].innerHTML;
		x$ = "<span class=x2>";
		slen = s$.length * 3 / 4; //because of the proportional font!
		for (var y=0;y<slen;y++) {x$ += "X"};
		x$ += "</span>";
		arraySpan[z].innerHTML = s$ + " " + obj.title + x$;
		arraySpan[z].title="oops";
		}
	}
}

//========================================================
function centerContent() {
/* This is now achieved using a single cell table for the content
var cont = document.getElementById("IDcontent");
var IDcspL = cont.style.paddingLeft;
if (IDcspL == "") {
	IDcspL = 55;
	} else {
	IDcspL = parseInt(IDcspL);
	}
var efWid  = cont.style.width;
if (efWid == "") {
	efWid = 502;
	} else {
	efWid = parseInt(efWid) - IDcspL;
	}
var dbcW   = document.body.clientWidth;
var marg   = (dbcW - efWid - 140)/2;
var padleft = Math.max(55,marg);
cont.style.paddingLeft = padleft;
cont.style.width = efWid + padleft;
*/
}

//========================================================
function searchFinder() {
if (urlsrch && urlsrch.indexOf("=")) { // only if a query has been passed AND has "="
var v_equal = urlsrch.indexOf("=");
var v_name  = urlsrch.substring(0,v_equal);
var v_value = unescape(urlsrch.substring(v_equal+1));
//eval(v_name + "=\'" + v_value + "\'"); 
switch (v_name) {
	case "person":
		findperson(v_value);
		break;
	case "badge":
		var badge = document.getElementById("badgepic");
		var blink = document.getElementById("badgelink");
		if (badge && blink) {
			badge.src = "gifs/" + v_value.substring(1) + ".gif";
			blink.href = "rally_badges" + v_value.charAt(0) + ".htm#" + v_value.substring(1);
			}
		break;
	}

}}
function findperson(nam) {
idc = document.getElementById("IDcontent").getElementsByTagName("P");
for (var x=0; x< idc.length; x++) {
	M = idc[x].innerHTML;
	var pn = M.lastIndexOf(nam);
	if (pn > 1) {
		M = M.substring(0,pn) + "<span class=redlite id=finder>" + nam + "</span>" + M.substring(pn + nam.length);
		idc[x].innerHTML = M;
		x = idc.length;
		}
	}
if (document.getElementById('finder')) document.getElementById('finder').scrollIntoView(false);

}
//--------------------------------------------------------











































































































//========================================================
//
//    I N C L U D E S    T O    W R I T E     H T M L
//
//========================================================
//
//    C O N T E X T   M E N U     ie5menu
//    T O O L T I P  (+ members)  tootltip
//    A D M I N   M E N U         IDadmin
//    Q U I C K - K E Y S         IDkeys
//    B R E A D C R U M B         IDcrumb
//    R E P O R T   P A G E       IDreport
//    C O N T E N T  M E N U      subContent (generaliseded from Megaphone section)
//
//========================================================
//set the skin of the menu (0 or 1, with 1 rendering a default Windows menu like skin)
var menuskin=1;

//set this variable to 1 if you wish the URLs of the highlighted menu to be displayed in the status bar
var display_url=0;

//--------------------------------------------------------
// call this function straight after body to write the layers
function layersafterbody()	{

addContextMenu();
document.writeln('<div id=tooltip>Tooltips</div>');
addAdminTools();//	see the end of the section for changing content
addKeysTable();
document.writeln("<div id=IDcrumb class=noprint style=position:absolute;left:200px;top:58px;z-index:1;font-size:10px;>&nbsp;</div>");
reportPage();
addCommentForm();//	see lower down for this form

document.oncontextmenu = showContext;

}
//--------------------------------------------------------
function showContext(e) {
evnt = (document.all) ? event: e;
movetip(evnt,'IDcontext');
document.body.onclick=shutContext;
return false;
}
//--------------------------------------------------------
function shutContext() {
contextmen.style.visibility = "hidden";
}
//--------------------------------------------------------
contextmen = new Object();
function addContextMenu() {

document.writeln('<div class=noprint id=IDcontext>');
document.writeln('<a class=menuitems href=\"JavaScript:window.scroll(0,0)\">Top of page</a><br>');
document.writeln('<a class=menuitems href=\"javascript:comment_start()\">Contact Centre</a><br>');
document.writeln('<hr>');
document.writeln('<a class=menuitems href=../home/home_index.htm>Home Page</a><br>');
document.writeln('<a class=menuitems href=../news/news_index.htm>Latest News</a><br>');
document.writeln('<a class=menuitems href=../home/home_map.htm#' + uniname + '>Site Map</a><br>');
document.writeln('<a class=menuitems href=../home/home_tabs.htm#' + spath + '>Content List</a>');
document.writeln('<hr>');
document.writeln('<a class=menuitems href="mailto:ben@honsec.co.uk?subject=From LPMCC.net">Email Admin</a><br>');
document.writeln('<a class=menuitems href=\"JavaScript:window.scroll(0,100000)\">End &amp; Star Rating</a>');
document.writeln('</div>');
contextmen = document.getElementById("IDcontext");

}

//========================================================
//
//	TOOLTIPS
//	document.onmouseover=tip adds the function to the whole document
//	Depends on common.js writing the tooltip layer
//
//========================================================
// for longer and bigger notes than the default title tooltips. 

var trigger=false;
function tip(e){

var already = 0;

var obj = (document.all) ? event.toElement : e.target;

var tt  = document.getElementById("tooltip");
trigger=false;

if (obj == tt) trigger = true;// do NOT close tooltip when pointer is over it.
if (document.all) {
	trigger = tt.contains(obj);
	} else {
	if (obj.parentNode == tt) trigger = true;// do NOT close tooltip over parent. One level up only in Firefox!
	}
if (trigger) return true;

if (obj.getAttribute("tooltip")) {
        thead = (obj.src) ? "Note":obj.innerHTML;
	tt.innerHTML = "<span style='font-variant:small-caps' title=''>" + thead + " :</span><br>" + obj.getAttribute("tooltip");
	movetip(e,"tooltip");
	clearTimeout(already);
	trigger=true;
	} else {
	already = setTimeout(delayhide,3000);// hides the tooltip when there is no tooltip attribute.
	}
}

//--------------------------------------------------------
function delayhide()	{if (!trigger) document.getElementById("tooltip").style.visibility = "hidden";} 

//--------------------------------------------------------
// alternative tooltip for AREA maps. 'variable' contains the tooltip content. NOT USED
function areatip(variable,e){

if (document.all) { //IE only
document.getElementById("tooltip").innerHTML = variable;
movetip(e,"tooltip");
} //IE only
}
//--------------------------------------------------------
// positions the layer objID (21 Jan 2007)
function movetip(e,objID) {

ELtooltip = document.getElementById(objID);

ttw = ELtooltip.clientWidth;
tth = ELtooltip.clientHeight;

if (document.all) {

	if (document.documentElement && document.documentElement.scrollTop) {
		theBody = document.documentElement;
		} else {
		theBody = document.body;
		}
	xposition = event.clientX;
	if (xposition + ttw > theBody.clientWidth) xposition = theBody.clientWidth - ttw;
	if (xposition <5 ) xposition=5;

	yposition = theBody.scrollTop + event.clientY;

	if (yposition + tth > theBody.scrollTop + theBody.clientHeight) yposition = yposition - tth;
	if (yposition < 5) yposition=5;

	} else {

	xposition = e.pageX;
	if (xposition + ttw > document.width) xposition = document.width - ttw;
	if (xposition <5 ) xposition=5;

	yposition = e.pageY;

	if (yposition + tth > document.height) yposition = yposition - tth;
	if (yposition < 5) yposition=5;
	}
ELtooltip.style.left = xposition;
ELtooltip.style.top = yposition;
ELtooltip.style.visibility = "visible";
}
//--------------------------------------------------------
// needed to turn area tooltips off - NOT USED
function areaoff()	{
alert("Tell Ben that AreaOff has appeared");
document.getElementById("tooltip").style.display = "none";
}
//========================================================
// BREADCRUMB
//========================================================

function breadCrumb() {
breadcrumb = "";
level = 4;
breadswitch = false;

for (var x=menu_db.length-1;x>0;x--) {
	sub = menu_db[x].split("|");
	nme = sub[1].replace(/<\/?[^>]+>/gi,''); //reg exp to remove ALL other tags
	dub = sub[2].split("/");
	q = dub[1].indexOf("#");
	if (q>0) dub[1] = dub[1].substr(0,q);
	q = dub[1].indexOf("?");
	if (q>0) dub[1] = dub[1].substr(0,q);
//alert(dub[1] + "\n" + endname);
	if (dub[1] == endname) {
		breadcrumb = " &gt; <b>" + nme + "</b>";
		level = sub[0]-1;
		breadswitch = true;
		}
	if (breadswitch && level == sub[0]) {
		breadcrumb = " &gt; <a href=../" + sub[2] + " title=\'" + HTML2JS(sub[3]) + "\'>" + nme + "</a>" + breadcrumb; 
		level = sub[0]-1;
		}
	if (level == 0) x = 0;		
	}
if (breadcrumb != "") document.getElementById("IDcrumb").innerHTML = "You are in " + breadcrumb.substring(5);
}

//========================================================
function addAdminTools() {

document.writeln('<div id=IDadmin>');
document.writeln('<input type=button value=X onclick=shutDiv(admin) style=position:absolute;right:0px;top:0px;width:15px;height:15px;font-size:8px;font-weight:800; title=\"Close admin tools\">'); 
document.writeln('<a class=menuitems href="dummy" onclick="writeReport();shutDiv(admin);return false;" alt="Documentation about this page">Page Report</a><br>');
document.writeln('<a class=menuitems href="dummy" onclick="printPreview();clearTimeout(dum);shutDiv(admin);return false;" alt="What this page looks like when printed">Print Preview</a><br>');
document.writeln('<a class=menuitems href="dummy" onclick="varCookie();isitglobal();shutDiv(admin);return false;" alt="The current settings">Check Cookies</a><br>');
document.writeln('<a class=menuitems href="../admin/admin_index.htm" alt="Tools to write and check data">Administration</a><br>');
document.writeln('<hr>');
// the currentTest() function is near the END of this file - change it according to needs
document.writeln('<a class=menuitems href="dummy" onclick="currentTest();shutDiv(admin);return false;" alt="Debug and test function">Test</a><br>');
document.writeln('<hr>');
document.writeln('<a class=menuitems href="dummy" onclick="shutDiv(admin);return false;" alt="Close this dialog">Close</a>');
document.writeln('</div>');
admin = document.getElementById("IDadmin"); // globally defined
}
// -------------------------------------------------
function showAdmin() {
admin.style.display = "block";
admin.style.top = 150 + document.body.scrollTop;
}
//========================================================
//  REPORT PAGE
//========================================================
//  These functions write a digest of the page contents
//  and other background information in an alternative
//  display. Look for the transparent 'Report' button 
//  below the main menu when looking at a 'local' version 
//  of the website.
//
//===============================================

function reportPage() {
document.writeln('<div id=IDreport>');

document.writeln('<div class=Rsection style=top:010px;height:150px>');
document.writeln('<input type=button value=X class=noprint onclick=shutReport() style=position:absolute;right:0px;top:0px;width:15px;height:15px;font-size:8px;font-weight:800; title=\"return to webpage\">'); 

document.writeln('<span id=Ptitle >Page title      Ptitle  </span><br>');
document.writeln('<span id=Ctitle >Content title   Ctitle  </span><br>');
document.writeln('<span id=Reason >Page mission    Reason  </span><br>');
document.writeln('<span id=Fname  >File name       Fname   </span><br>');
document.writeln('<span id=Sname  >Section         Sname   </span><br>');
document.writeln('<span id=Pauthor>Author          Pauthor </span>');
document.writeln('<span id=Lupdate>Last update     Lupdate </span><br>');
document.writeln('<span id=Ttime  >Load Time       ttime   </span><br>');
document.writeln('</div>');


document.writeln('<div class=Rsection style=top:190px;height:160px;>');
document.writeln('<p><b>Content Summary</b></p>');
document.writeln('<span id=Npara >Paragraphs       Npara   </span><br>');
document.writeln('<span id=Nword >Words            Nword   </span><br>');
document.writeln('<span id=Npics >Pictures         Npics   </span><br>');
document.writeln('<span id=Nlink >Links            Nlink   </span><br>');
document.writeln('<span id=Xmems >People           Xmems   </span><br>');
document.writeln('</div>');

document.writeln('<div class=Rsection style=top:360px;height:170px;z-index:2;>');
document.writeln('<p><b>Meta Data</b></p>');
document.writeln('<span id=Msubject >Description   Msubject </span><br>');
document.writeln('<span id=Mkeywords>Keywords      Mkeywords</span><br>');
document.writeln('<span id=Ssheets  >Style sheets  Ssheets  </span><br>');
document.writeln('<span id=Sscripts >Script files  Sscripts </span><br>');
document.writeln('</div>');

document.writeln('<div class=Rsection style=top:540px;height:390px>');
document.writeln('<p><b>Action</b></p>');
document.writeln('<p class=small>Problems, errors, corrections, changes, additions, improvements</p>');
document.writeln('<form name=repform><textarea name=reptext style=width:555px;height:300px;></textarea></form>');
//document.writeln('<span id=Nnotes  >Notes          Nnotes  </span><br>');
document.writeln('</div>');

document.writeln('<div class=Rsection style=bottom:010px;height:050px>');
document.writeln('<span id=Rdate    >Report date   Rdate    </span>');
document.writeln('</div>');


document.writeln('</div>');
}
//-----------------------------------------------
function writeReport() 	{
var cont = document.getElementById("IDcontent");
cont.style.display = "none";
document.getElementById("IDmenu").style.display = "none";
document.getElementById("IDtitle").style.display = "none";
document.getElementById("IDcrumb").style.display = "none";
document.getElementById("IDreport").style.display = "block";
window.scroll(0,0);
}

function populate_report() {
var cont = document.getElementById("IDcontent");
var cpage = "";
document.getElementById("Ptitle").innerHTML = "Page title ........ " + document.title.split(" - ")[0];
cpage += "Page title ........ " + document.title.split(" - ")[0] + "\n";
var temp = cont.getElementsByTagName("H1");
var ent = "no title"; //GLOBAL used in Comment Form
for (var x = 0; x<temp.length;x++) {
	if (temp[x].className == "main") ent = temp[x].innerHTML;
	}
document.getElementById("Ctitle").innerHTML = "Content title ..... " + ent;
cpage += "Content title ..... " + ent + "\n";
var mission = "not found";
var people = 0;
for (var x = 0;x < menu_db.length;x++) {
	menu_field = menu_db[x].split("|");
	if (menu_field[2].split("/")[1] == endname) {
		mission = menu_field[1] + " - " + menu_field[3];
		people = uniqueArray((menu_field[4] + "," + menu_field[14]).split(",")).length;
		x = menu_db.length;
		}
	}
mission = HTML2JS(mission);
document.getElementById("Reason").innerHTML    = "Mission ........... " + mission;

document.getElementById("Fname").innerHTML     = "File name ......... " + endname;
document.getElementById("Sname").innerHTML     = "Section ........... " + spath.toUpperCase();
document.getElementById("Pauthor").innerHTML   = "Author ............ " + menu_author + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
document.getElementById("Lupdate").innerHTML   = "Last update         " + modified.getDate() + ' ' +  monName[modified.getMonth()] + ' ' + modified.getFullYear();
document.getElementById("Ttime").innerHTML     = "Load Time ......... " + stime + "s visible &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + ttime + "s complete";

mission = mission.split(" - ").join("\n  ");
cpage += "Mission ........... " + mission + "\n";
cpage += "File name ......... " + endname + "\n";
cpage += "Section ........... " + spath.toUpperCase() + "\n";
menu_author = menu_author.split("&nbsp;").join(" ");
menu_author = menu_author.split(",").join(", ");
cpage += "Author ............ " + menu_author + "\n";
cpage += "Last update         " + modified.getDate() + ' ' +  monName[modified.getMonth()] + ' ' + modified.getFullYear() + "\n";
cpage += "Load Time ......... " + stime + "s visible\n";
cpage += "                    " + ttime + "s complete\n\n";

temp = cont.getElementsByTagName("P");
var quot = cont.getElementsByTagName("BLOCKQUOTE");
var para = "Paragraphs ........ " + temp.length;
if (quot.length > 0) para += " and " + quot.length + " quotes.";
document.getElementById("Npara").innerHTML     = para;
cpage += "\nCONTENT SUMMARY\n" + para + "\n";
ent = 0;
for (var x = 0;x<temp.length;x++) {
	ent += temp[x].innerHTML.split(" ").length;
	}
document.getElementById("Nword").innerHTML     = "Words ............. " + ent;
cpage += "Words ............. " + ent + "\n";
temp = cont.getElementsByTagName("IMG");
var pics = "";
var alti = 0; //no alt or title
var dup = [];
for (var x = 0;x<temp.length;x++) {
	var dupflag = true;
	var dis = temp[x].src;
	for (var y=0;y<dup.length;y++) {if (dis == dup[y]) dupflag = false;}
	var suf = dis.split(".");
	dup.push(dis);
	if (suf[suf.length-1] == "jpg" && dupflag) {
		pics += "<img src=" + temp[x].src + " style=\'width:88px;border:1px solid #ffffe1;\' alt=\'ALT=" + temp[x].alt + " \nTITLE=" + temp[x].title + "\'>";
		if (temp[x].alt + temp[x].title =="") alti++;	
		}
	}
dup = [];
var numpics=pics.split("><").length;
if (pics == "") numpics = 0;
picline = "Pictures .......... " + numpics;
if (alti > 0) picline += " (" + alti + " without alt)";
document.getElementById("Npics").innerHTML     = picline;
cpage += picline + "\n";
document.getElementById("Npics").tooltip       = pics;

temp = cont.getElementsByTagName("A");
var lno = 0;
var lin = "";
for (var x = 0;x<temp.length;x++) { 
	//exclude bottom menu links
	if (temp[x].innerHTML == "[&lt;]") {x = temp.length;} else {
		dis = temp[x].href;
		if (dis.substr(0,7) == "http://") {
			dis = dis.substring(7,dis.indexOf("/",8));
			}
		if (dis.length != "" && dis.indexOf(".skydrive.") == -1 && dis.indexOf(".flickr.") == -1) {
			lin += dis + "<br>";
			lno++;
			}
		}
	}
document.getElementById("Nlink").innerHTML     = "Links ............. " + lno;
cpage += "Links ............. " + lno + "\n";
document.getElementById("Nlink").tooltip       = lin;

if (altnames.length>0) {
	document.getElementById("Xmems").innerHTML     = "People named ...... " + altnames.length;
	document.getElementById("Xmems").tooltip       = altnames.join("<br>");
	} else {
	document.getElementById("Xmems").innerHTML     = "People named ...... None";
	document.getElementById("Xmems").tooltip       = "No people detected";
	}

if (people >0) {
	cpage += "People named ...... " + people + "\n";
	} else {
	cpage += "People named ...... None\n";
	}

temp = document.getElementsByTagName("META");
var desc = "No description";
var keyw = "No keywords";
var note = "";
for (var x=0;x<temp.length;x++) {
	if (temp[x].name == "description") desc = temp[x].content;
	if (temp[x].name == "keywords")    keyw = temp[x].content;
	if (temp[x].name == "development") {
		var devline = temp[x].content;
		note += devline + "\n";
		}
	}
document.getElementById("Msubject").innerHTML  = "Description ....... " + desc;
cpage += "\n\nMETA DATA\nDescription ....... " + desc + "\n";
keyn = 0;
if (keyw != "") {
	keya = keyw.split(",");
	keyw = keya.join("<br>");
	keyn = keya.length;
	}
document.getElementById("Mkeywords").innerHTML = "Keywords .......... " + keyn;
cpage += "Keywords .......... " + keyn + "\n";
document.getElementById("Mkeywords").tooltip   = keyw;

temp = document.getElementsByTagName("LINK");
var css = 0;
for (var x=0;x<temp.length;x++) {
	if (temp[x].rel == "stylesheet") css++;
	}
document.getElementById("Ssheets").innerHTML   = "Style sheets ...... " + css;
cpage += "Style sheets ...... " + css + "\n";
temp = document.getElementsByTagName("SCRIPT");
scr = 0;
names = "";
for (var x=0;x<temp.length;x++) {
	if (temp[x].src != "") {
		names += temp[x].src + "<br>";
		scr++;
		}
	}
document.getElementById("Sscripts").innerHTML  = "Script files ...... " + scr;
cpage += "Script files ...... " + scr + "\n";
document.getElementById("Sscripts").tooltip    = names;


document.repform.reptext.value = note;
cpage += "\n\nHISTORY\nAdditions, changes, improvements, corrections\n" + note + "\n";

document.getElementById("Rdate").innerHTML     = "Report date ........" + tday.getDate() + ' ' +  monName[tday.getMonth()] + ' ' + tday.getFullYear();
cpage += "\nReport date ........" + tday.getDate() + ' ' +  monName[tday.getMonth()] + ' ' + tday.getFullYear() + "\n";

document.getElementById("IDpageinfo").value = cpage;
//window.print();
}

// ------------------------------------------------------------------
function shutReport() {
cont = document.getElementById("IDcontent");
cont.style.display = "block";
document.getElementById("IDmenu").style.display = "block";
document.getElementById("IDtitle").style.display = "block";
document.getElementById("IDcrumb").style.display = "block";
document.getElementById("IDreport").style.display = "none";
window.scroll(0,0);
}

//========================================================
// KEY TABLE is shown by Alt+K or Alt+?
//========================================================

function addKeysTable() {
document.writeln('<div id=IDkeys>');
document.writeln('<input type=button value=X onclick=shutDiv(keys) style=position:absolute;right:0px;top:0px;width:15px;height:15px;font-size:8px;font-weight:800; title=\"Close admin tools\">'); 
document.writeln('<center>');
document.writeln('<table width=90% border=0 cellspacing=0 cellpadding=0 class=small>');
document.writeln('<tr><td>Alt+A</td><td><u>A</u>ctivities</td></tr>');
document.writeln('<tr><td>Alt+B</td><td>Rally <u>B</u>adges</td></tr>');
document.writeln('<tr><td>Alt+C</td><td><u>C</u>lub Runs</td></tr>');
document.writeln('<tr><td>Alt+D</td><td><u>D</u>iary (Calen<u>d</u>ar)</td></tr>');
document.writeln('<tr><td>Alt+E</td><td><u>E</u>mail</td></tr>');
document.writeln('<tr><td>Alt+F</td><td><u>F</u>AQ</td></tr>');
document.writeln('<tr><td>Alt+G</td><td><u>G</u>allery</td></tr>');
document.writeln('<tr><td>Alt+H</td><td><u>H</u>ome</td></tr>');
document.writeln('<tr><td>Alt+I</td><td><u>I</u>nfo (Help)</td></tr>');
document.writeln('<tr><td>Alt+K</td><td><u>K</u>eys (This pop-up)</td></tr>');
document.writeln('<tr><td>Alt+M</td><td><u>M</u>egaphone</td></tr>');
document.writeln('<tr><td>Alt+N</td><td><u>N</u>ews Update</td></tr>');
document.writeln('<tr><td>Alt+P</td><td><u>P</u>ost</td></tr>');
document.writeln('<tr><td>Alt+Q</td><td><u>Q</u>uestions (Help)</td></tr>');
document.writeln('<tr><td>Alt+R</td><td><u>R</u>allies</td></tr>');
document.writeln('<tr><td>Alt+S</td><td><u>S</u>ite Map</td></tr>');
document.writeln('<tr><td>Alt+T</td><td><u>T</u>raining</td></tr>');
document.writeln('<tr><td>Alt+X</td><td>E<u>x</u>-Members</td></tr>');
document.writeln('<tr><td>Alt+?</td><td>This pop-up</td></tr>');
document.writeln('<tr><td>Alt+&lt;</td><td>Previous page in section</td></tr>');
document.writeln('<tr><td>Alt+&gt;</td><td>Next page in section</td></tr>');
document.writeln('</table>');
document.writeln('</center>');
document.writeln('</div>');
keys = document.getElementById("IDkeys"); // globally defined
}
// -------------------------------------------------
function showKeys() {
keys.style.display = "block";
keys.style.top = 100 + document.body.scrollTop;
}

// -------------------------------------------------
function shutDiv(obj) {
obj.style.display = "none";
}
//==================================================
// Create a sub section menu of contents within page
//==================================================
function subContent() {

document.writeln("<hr class=main>");
document.writeln("<h2>Contents</h2>");
document.writeln("<table width=100% border=0 cellspacing=0>");
var h = ["Level","Title","File","Description","Author"];
var indx = 2;
var pgno = 1;
var sh = "Author";
var co = 4;
var tp = 3;
if (arguments.length>0) {
	co = arguments[0];
	sh = h[co];
	}
if (co != 4) tp = 4;
while (menu_db[indx].split("|")[2].indexOf(endname) < 0) indx++;

document.writeln("<tr class=smaller title=\'Header\'><td>Page</td><td>Title</td><td>" + sh + "</td></tr>");

var menuField = menu_db[indx].split("|");
document.writeln("<tr class=smaller onmouseover=hilit(this) onmouseout=lolit(this) style=cursor:hand;cursor:pointer;\' title=\'" + menuField[tp] + "\'>");
document.writeln("<td>1</td>");
document.writeln("<td>This Page</td>");
document.writeln("<td>" + menuField[co] + "</td>");
document.writeln("</tr>");
//var menulevel = parseInt(menu_db[indx].split("|")[0]);
var menulevel = parseInt(menuField[0],10);

pgno++;
indx++;

while (menu_db[indx].split("|")[0] > menulevel) {
	var menuField = menu_db[indx].split("|");
	if (menuField[0] == menulevel+1) {
		document.writeln("<tr class=smaller onmouseover=hilit(this) onmouseout=lolit(this) onclick=\"document.location=\'../" + menuField[2] + "\'\" style=cursor:hand;cursor:pointer; title=\'" + menuField[tp] + "\'>");
		document.writeln("<td>" + pgno + "</td>");
		document.writeln("<td>" + menuField[1] + "</td>");
		document.writeln("<td>" + menuField[co] + "</td>");
		document.writeln("</tr>");
		if (menuField[4] !="") {
			var stringlist = altnames + "," + menuField[4];
			altnames = stringlist.split(",");
			}
		pgno++;
		}

	indx++;
	}
document.writeln("</table>");

}
//========================================================
//  COMMENT FORM
//========================================================

function addCommentForm() {

var doctitle = document.title.split(" - ")[0];
document.write("<div id=IDcomment>");
document.write("<div id=IDhotedge onclick=comment_start()><div id=IDmercury></div></div>");

document.write("<p class=bubt1 style=top:17px;width:400px;font-size:14px;>Notes about " + doctitle + "</p>");
document.write("<p class=bubt2 style=top:16px;width:400px;font-size:14px;>Notes about " + doctitle + "</p>");
document.write("<p class=bubc1 style=top:17px;right:10px;>&times;</p>");
document.write("<p class=bubc2 style=top:16px;right:12px; onClick=comment_start() onMouseover=\"this.style.color=\'#30359F\'\" onMouseout=\"this.style.color=\'#98A5DF\'\" title=close>&times;</p>");

document.write("<div id=IDctabs>");
document.write("<div class=ctab onclick=cshow(0) style=left:000px;top:1px;>Notes</div>");
document.write("<div class=ctab onclick=cshow(1) style=left:060px;>Mail</div>");
document.write("<div class=ctab onclick=cshow(2) style=left:120px;>Stars</div>");
document.write("<div class=ctab onclick=cshow(3) style=left:180px;>Marks</div>");
document.write("<div class=ctab onclick=cshow(4) style=left:240px;>Info</div>");
document.write("<div class=ctab onclick=cshow(5) style=left:300px;width:60px;>Help</div>");
document.write("</div>");
document.write("<form name=commentform method=POST action=http://homepages.plus.net/cgi-bin/form>");

document.write("<input type=hidden name=recipient value=phoenix@crossleys.plus.com>");
document.write("<input type=hidden name=mailuser value=phoenix>");
document.write("<input type=hidden name=redirect value=http://www.lpmcc.net/" + fulname + ">");
document.write("<input type=hidden name=subject value=\"Page comment\">");
document.write("<input type=hidden name=id value=\"\">");
document.write("<input type=hidden name=page value=\"\">");
document.write("<input type=hidden name=browser value=\"\">");
document.write("<input type=hidden name=textoutput value=yes>");

//........................... HELP
document.write("<div class=cpage id=IDc0>");
document.write("<p>&nbsp;</p>");
document.write("<p class=smaller><a href=dummy onclick=\'cshow(0);return false;\'>Contact</a> LPMCC.net</p>");
document.write("<p class=smaller><a href=../home/home_map.htm>Site Map</a> indicating structure</p>");
document.write("<p class=smaller><a href=../home/home_tabs.htm>Content</a> in a card index</p>");
document.write("<p class=smaller><a href=../home/home_biblio.htm>Bibliography</a> of contributors</p>");
document.write("<p class=smaller><a href=../home/home_who.htm>People</a> indexed by pages</p>");
document.write("<p class=smaller><a href=../home/home_recent.htm>New</a> and recent additions</p>");
document.write("</div>");

//........................... NOTES
document.write("<div class=cpage id=IDc1 style=display:block;><center>");

document.write("<textarea class=ctxt name=txtarea id=IDtxtarea onchange=mercury()>" + unescape(nCookie).trim() + "</textarea>");
document.write("<input type=text name=realname value=\"Your Name\" /> &nbsp; &nbsp; ");
document.write("<input type=text name=email value=\"Your Email Address\" /><br>");
var shrt = "<a class=level1 style=text-align:center;width:100px;display:inline; ";
var nbsp = " &nbsp; &nbsp; &nbsp; &nbsp; "; 
document.write(shrt + "onclick='comment_clear();return false;' href=dummy title=\"Reset all the boxes and lose what you wrote\">" + nbsp + "Clear" + nbsp + "</a>&nbsp;");
document.write(shrt + "onclick='formsend();return false;' href=dummy title=\"Send your notes to LPMCC.net without using email\">" + nbsp + "Send" + nbsp + "</a>&nbsp;");
document.write(shrt + "id=eml onclick='return post_email();' href=dummy title=\"Send using your email application \nUseful if you want to include photo files!\">" + nbsp + "Email" + nbsp + "</a>");
document.write("</center></div>");

//........................... MAIL
document.write("<div class=cpage id=IDc2>");
document.write("<p id=IDreply class=smaller></p>");
document.write("<hr>");
document.write("<p class=cp>Mail is our reply to your submitted notes when we do not have your email address<br><br>The grippy bar turns green when you receive Mail.</p>");
document.write("</div>");

//........................... STARS

document.write("<div class=cpage id=IDc3>");

document.write("<p class=cp>Give zero if this page made you angry and frustrated, five if the page has the WOW factor or made you laugh out loud. Others on the scale between.</p>");

var sb = ["Waste of time. Wrong. Not what I want. Page is a mess.",
"Poor content. Annoying page errors.",
"Weak content. Slow page delivery.",
"Pretty average. Boring format.",
"Interesting topic, well delivered.",
"Exciting content efficiently presented. WOW factor.",
"<tr><td>",
" <input type=radio name=crate value=",
" /></td><td class=cp style=vertical-align:middle;>",
"</td></tr>"];

document.write("<table width=100% border=0 cellspacing=0 cellpadding=4>");
document.write("<tr><td>Rating</td><td>Explanation</td></tr>");
for (var x=0;x<6;x++) document.write(sb[6] + x + sb[7] + x + sb[8] + sb[x] + sb[9]);
document.write("</table>");
document.write("<center>");
document.write(shrt + "onclick='submit();return false;' href=dummy title=\"Send your Star Rating LPMCC.net\">" + nbsp + "Send" + nbsp + "</a>");
document.write("</center></div>");

//........................... MARKS

document.write("<div class=cpage id=IDc4><center>");
document.write("<p>LPMCC.net Local Bookmarks</p></center>");

document.write("<table width=100% border=0 cellspacing=0><tr class=smaller><td width=220>Page</td><td width=100>Date Marked</td><td width=40>Keep</td></tr>");
var marks = unescape(lCookie).split("|");
var mflag=true;
for (var x=0;x<marks.length;x++) {
	var mdate = new Date(parseInt(marks[x].substring(0,13),10));
	var msave = mdate.getDate() + "/" + (1+mdate.getMonth()) + "/" + mdate.getFullYear();
	var mfile = marks[x].substring(13);
	if (mfile == menubit) mflag=false;
	for (var y=1;y<menu_db.length-3;y++) {
		var menu = menu_db[y].split("|");
		if (mfile == menu[2]) {
			document.write("<tr class=cp onmouseover=hilite(this) onmouseout=lolite(this)><td onclick=\"document.location.href=\'../" + mfile + "\'\">" + menu[1] + "</td><td onclick=\"document.location.href=\'../" + mfile + "\'\">" + msave + "</td><td style=text-align:center;><input type=checkbox name=mark" + x + " checked id=" + marks[x] + " /></td></tr>");
			y = menu_db.length;
			}
		}
	}
if (mflag) {
	var msave = tday.getDate() + "/" + (1+tday.getMonth()) + "/" + tday.getFullYear();
	document.write("<tr class=cp onmouseover=hilite(this) onmouseout=lolite(this)><td onclick=mcheck(this)>" + doctitle + "</td><td onclick=mcheck(this)>" + msave + "</td><td style=text-align:center;><input type=checkbox name=marklast id=" + tnow + menubit + " /></td></tr>");
	}
document.write("</table>");

document.write("</div>");

//........................... PAGE INFO

document.write("<div class=cpage id=IDc5><center>");
document.write("<p style=margin:5px;>Page Documentation</p>");
document.write("<textarea class=ctxt id=IDpageinfo style=font-size:11px;></textarea>");
document.write("</center></div>");


document.write("</form>");

document.write("</div>");

setTimeout(reply_message,4500);
setTimeout(populate_report,4800);
}
//-------------------------------------------------------
function mcheck(ob) { // toggles the last marks checkbox
document.commentform.marklast.checked = !document.commentform.marklast.checked;
}
//-------------------------------------------------------
function comment_position() { // call this onload, onscroll and onresize!
var cmt = document.getElementById("IDcomment");
cmt.style.top = document.body.scrollTop + 10;
}
//-------------------------------------------------------
var com_dir = 20;
function comment_start(tb) {
mercury();
document.commentform.txtarea.scrollTop = document.commentform.txtarea.scrollHeight;
var cmt = document.getElementById("IDcomment");
var lft = parseInt(cmt.style.left,10);
if (lft > 99)   com_dir = -20;
if (lft <-393)  com_dir = 20;
if (!tb) tb = 0; 
cshow(tb);
comment_move();
}
//-------------------------------------------------------
function comment_move() {
var cmt = document.getElementById("IDcomment");
var lft = parseInt(cmt.style.left,10);
    lft+= com_dir;
    cmt.style.left = lft;
if (lft > -394 && lft < 100) setTimeout(comment_move,20);
}
//-------------------------------------------------------
function check_submit()	{
if (document.commentform.txtarea.value=="")	{
	document.commentform.txtarea.focus();
	alert("Please type in a comment");
	return false;
	}
if (document.commentform.realname.value=="" ||document.commentform.realname.value=="Your Name"  )	{
	document.commentform.realname.focus();
	alert("Don't be shy about your name.");
	return false;
	}
if (document.commentform.email.value=="" ||document.commentform.email.value=="Your Email Address"  )	{
	document.commentform.email.value = "";
	}
return true;
}
//-------------------------------------------------------
function post_submit() {
document.commentform.page.value = menubit ;
if (document.commentform.email.value=="") document.commentform.email.value = "noaddress@lpmcc.net";
document.commentform.id.value = aCookie ;
document.commentform.subject.value += " "  + document.commentform.realname.value + " about " + document.title.split(" - ")[0]; 
document.commentform.browser.value = navigator.appName + " " + navigator.appVersion;
document.commentform.submit();
}
//-------------------------------------------------------
function post_email() {
var subject = "About " + document.title.split(" - ")[0] +  " (" + menubit + ")"; 
var address = "Znvygb:Ora<ora@ubafrp.pb.hx>?fhowrpg=";
var address = address.rot13() + subject + "&Body=" + document.commentform.txtarea.value + "%0d%0a%0d%0a" + document.commentform.realname.value;
document.getElementById("eml").href = address;
return true;
}
//-------------------------------------------------------
function formsend() {
if (check_submit()) post_submit();
}
//-------------------------------------------------------
function emailsend() {
if (check_submit()) {
	post_email();
	return true;
	} else {
	return false;
	}
}
//-------------------------------------------------------
function comment_clear() {
document.commentform.reset();
document.commentform.txtarea.value = "";
deleteCookie("nCookie");
}
//-------------------------------------------------------
function mercury() { //shows level of text in textbox
var n = document.commentform.txtarea.value.length;
var m = document.getElementById("IDmercury");
var w = document.commentform.txtarea.value.split(" ").length;
m.style.height = n/8;
m.style.backgroundColor = "#84a1bb";
m.style.display = "block";
if (n < 1) m.style.display = "none";
m.title = w + " words";
if (n > 3000) {
	m.style.backgroundColor = "red";
	m.title = w + " words \nPlease edit or send now.";
	}
}
//-------------------------------------------------------
function reply_message() {
var h = (tnow - parseInt(aCookie.substring(1),10))/1000000;
var he = document.getElementById("IDhotedge");
var rp = document.getElementById("IDreply");
for (var x=0;x<back_message.length;x++) {
	var bmsg = back_message[x].split("|");
	if ("A" + bmsg[0] == aCookie) {
		he.style.backgroundColor = "#0f0";
		he.title = "Personal reply for you";
		rp.innerHTML += "REPLY MESSAGE<br>" + bmsg[1].rot13() + "<br><br>";
		cshow(1);
		}
	if (bmsg[0] == "BROADCAST") {
		he.style.backgroundColor = "#ff0";
		he.title = "General message for you";
		rp.innerHTML += "BROADCAST MESSAGE<br>" + bmsg[1] + "<br><br>";
		cshow(1);
		}
	if (bmsg[0] == "NEW" && h < 605) {
		he.style.backgroundColor = "#ff0";
		he.title = "Welcome message for you";
		rp.innerHTML += "NEW TO LPMCC.net?<br>" + bmsg[1].rot13() + "<br><br>";
		cshow(1);
		}
	if (bmsg[0] == "OLD" && h > 10000) {
		he.style.backgroundColor = "#ff0";
		he.title = "Message to a loyal friend";
		rp.innerHTML += "SPECIAL MESSAGE<br>" + bmsg[1].rot13() + "<br><br>";
		cshow(1);
		}
	}
}
//-------------------------------------------------------
function cshow(n) {
var help_context = ["<p>Contact Centre Explained</p><p class=cp>The CONTACT CENTRE &copy; is on every page at the left edge.</p><p class=cp>CONTACT CENTRE &copy; follows when you scroll whether it is open or closed.</p><p class=cp>CONTACT CENTRE &copy; can be opened and closed using the right click menu, by clicking the [Contact] option at the bottom of the page, by clicking the grippy edge, and by using keys Alt+E. - Typical overkill!</p><p class=cp>The tabs bring up various useful functions, Notes for you to send to LPMCC.net, Mail received in reply, Stars to rate and guide our work, Marks to help you find your way back to a page you haven&#39;t finished with yet, Info about the current page and this Help tab.</p><p class=cp>Help is context sensitive, it is different depending which other tab you arrive from.</p><p class=cp>Here are a few conventional links to help you on your way.</p><table border=0 cellspacing=0 cellpadding=0 width=100%><tr class=cp><td><a href=dummy onclick=\'cshow(0);return false;\'>Contact</a> LPMCC.net</td><td><a href=../home/home_map.htm>Site Map</a> indicating structure</td></tr><tr class=cp><td><a href=../home/home_tabs.htm>Contents</a> in a card index</td><td><a href=../home/home_biblio.htm>Bibliography</a> of contributors</td></tr><tr class=cp><td><a href=../home/home_who.htm>People</a> slandered</td><td><a href=../home/home_recent.htm>New and Recent</a> additions</td></tr></table>",
"<p>Notes Explained</p><p class=cp>Notes are kept when you change pages and leave LPMCC.net. They are kept on this computer (as a Cookie). Don't depend on this as you may not have cookies enabled.</p><p class=cp>As you move between pages your Notes will marked with the relevant page and date stamped.</p><p class=cp>The space is filled up at about 500 words. The grippy edge doubles as a gauge and will turn red when Notes become too long.</p><p class=cp>Use the Send button to pass your notes for inclusion on LPMCC.net. If you do not include your email address you may receive a reply via this Contact Centre in Mail.</p><p class=cp>You can send your Notes using your own email client - such as Outlook Express - by clicking Email. The Notes are transferred to the email. Of course, you can attach photos to the email (hint).</p>",
"<p>Mail Explained</p><p class=cp>Mail is used as a method for us to contact you without using email. Especially if you have not told LPMCC.net your email address!</p><p class=cp>If you receive a personal reply to submitted Notes, the grippy edge will turn green and the Mail tab comes to the front.</p><p class=cp>Yellow grippy edge indicates a more general message. Broadcasts go to everyone. New users receive a welcome message. Regular users may be given special previews or benefits.</p><p class=cp>This sytem is computer based and relies on Cookies. If you delete cookies or turn them off you may not receive Mail (sob).</p>",
"<p>Stars Explained</p><p class=cp>Please add appropriate Star Rating based on your gut feeling about the page.</p><p class=cp>Don&#39;t try to solve technical issues, just yell &quot;Oi, Its Busted!&quot;. You can add the swear words in Notes.</p><p class=cp>Brickbats are every bit as helpful as bouquets. When I discover errors that no-one mentioned, I storm off in a cat-kicking, kitten-drowning tantrum.</p><p class=cp>Like all things on LPMCC.net, Stars are put onto pages by people, not computers. Stars will be added when we finish our drinks. Or the next one.</p><p class=cp>You can also click the stars at the bottom of every page. Remember to also click Send!</p>",
"<p>Marks Explained</p><p class=cp>In case you want to follow another train of thought but return soon to a page, you can add local bookmarks to bring you straight back.</p><p class=cp>The current page is shown at the end of your Mark list. If you want to keep it as a Mark, tick the box.</p><p class=cp>There is a maximum of nine Marks. After that the oldest is deleted.</p><p class=cp>Marks are computer specific as they are based on cookies.</p><p class=cp>That&#39;s c o o k i e s, not COCKIES, get your eyes fixed!</p>",
"<p>Info Explained</p><p class=cp>Info shows the self contained documentation for the current page. It is here so that LPMCC.net management can keep TABS on the website. Geddit? Oh, suit yerself.</p><p class=cp>It is much easier to have the page create its own record than to try to keep a separate database synchronised with frequent changes, additions and improvements.</p><p class=cp>For a better explanation of the workings of LPMCC.net take a look at the <a href=../help/help_doc1.htm title=Overview>Documentation Section</a>. Then you can use the Notes tab to ask what the heck it all means.</p><p class=cp>LPMCC.net is always receptive to new ideas for delivering our content. If you find something really wizz let us know the URL and we will paste a picture of it across your monitor.</p>",
"<h1>Ooops,<br>Summats Up!</h1>"];


var tbs = document.getElementById("IDctabs").getElementsByTagName("DIV");
var lasttab = n;
for (var x=0;x<tbs.length;x++) {
	if (parseInt(tbs[x].style.top,10) == 1) lasttab = (x+1)%tbs.length;
	tbs[x].style.top = "0px";
	document.getElementById("IDc" + x).style.display = "none";
	}
tbs[n].style.top = "1px";
document.getElementById("IDc0").innerHTML = help_context[lasttab];
n = (n+1)%tbs.length;
document.getElementById("IDc" + n).style.display = "block";
}
//-------------------------------------------------------



















































//========================================================
//       AJAX functions
//
// 	Source page must have <addr id=idname> and </addr> before and after required content
//
//	Destination page must have a <div id=idname>Ajax section goes here</div> and call onload or after div
//
//========================================================

function AjaxRequest(file,idname) {

if (localflag) { in_a_jiffy(file,idname) } else {

url=absURL(file);

var http_request = false;


if (window.XMLHttpRequest) { // Mozilla, Safari,...
	http_request = new XMLHttpRequest();
	if (http_request.overrideMimeType) {
		http_request.overrideMimeType('text/xml');
		}
} else if (window.ActiveXObject) { // IE
	try {
		http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
		try {
			http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {
			}
		}
	}

if (!http_request) {
	alert('Giving up :( Cannot create an XMLHTTP instance )');
	return false;
	}
http_request.onreadystatechange = function() { showContents(http_request,idname,file); };
http_request.open('GET', url, true);
http_request.send(null);
} // end of the server delivered Ajax 
}
//--------------------------------------------------------
function showContents(http_request,idname,file) {
sfile = file.substring(file.lastIndexOf("/")+1,file.length);
if (http_request.readyState == 4) {
	if (http_request.status == 200) {
		htmldoc = http_request.responseText;
		document.getElementById(idname).innerHTML = getHTMLbyId(htmldoc,idname);
		} else {
		document.getElementById(idname).innerHTML = '<p class=red>Ajax has failed to load content from <a href=' + file + '.htm#' + idname + ' title=\"read it here\">' + sfile + '</a> file.</p>';
		}
}

page_db = [];
htmldoc = "";
}
//--------------------------------------------------------
function getHTMLbyId(htmldoc,idname) {
p = htmldoc.indexOf("id=" + idname);
p = htmldoc.lastIndexOf("<",p);
q = htmldoc.indexOf(" ",p);
t = htmldoc.substring(p+1,q);
p = htmldoc.indexOf(">",q)+1;
q = htmldoc.indexOf("</"+t,p);
t = htmldoc.substring(p,q);
return t;
}
//--------------------------------------------------------
function absURL(file) {
if (localflag) file = "http://www.lpmcc.net" + file.substring(2,file.length);
return file + ".htm";
}


//========================================================
//
//    J I F F Y   F U N C T I O N S these work locally but not from a server
//
//========================================================

// quasi_AJAX routines
//--------------------------------------------------------

// NEW JIFFY
var global_content = [];
var global_page = [];
var jindex = 0;
var jif;
//--------------------------------------------------------
function in_a_jiffy(page_url,content_id) {
clearTimeout(jif);
global_page.push(page_url);
global_content.push(content_id);
jif = setTimeout(begin_jiffy,2000);
}
//--------------------------------------------------------
function begin_jiffy() {
window.frames[0].location = global_page[0] + ".htm";
setTimeout(read_jiffy,2000);
}

//--------------------------------------------------------
function read_jiffy() {
document.getElementById(global_content[jindex]).innerHTML = window.frames[0].document.getElementById(global_content[jindex]).innerHTML;
jindex++;
load_jiffy();
}
//--------------------------------------------------------
function load_jiffy() {
if (jindex < global_page.length) {
	window.frames[0].location = global_page[jindex] + ".htm";
	setTimeout(read_jiffy,2000);
	}
}
//--------------------------------------------------------



















































































//========================================================
//
//    M E N U   S Y S T E M
//
//========================================================

function mainmenu() {

var turl = "../home/home_index.htm";
var tpic = "../home/gifs/phoenix.gif";
var talt = "Link to home page";

if ((tday.getMonth() == 9 && tday.getDate() > 23) || (tday.getMonth() == 10 && tday.getDate() < 12)) { // poppy appeal period
	turl = "http://www.poppy.org.uk/support-us/give-money";
	tpic = "../home/gifs/poppy.gif";
	talt = "Link to poppy appeal";
	}

document.write("<a href=" + turl + ">");
document.write("<img class=noprint src=" + tpic + " width=80 height=80 style=margin:15px; alt=\'" + talt + "\'>");
document.write("</a>");

document.writeln("<center>");

contextMenu();// located approx line 4200

//document.write('<br>');

document.write("<a class=menutitle id=IDptitle href=../home/home_who.htm title=\'Index of everyone on LPMCC.net\' style=display:none;>People</a>");
document.write('<div class=menudiv id=people1div style=display:none;></div>');
document.write("<a class=menutitle id=IDltitle href=../home/home_links.htm title=\'More recommended websites\' style=display:none;>Links</a>");
document.write('<div class=menudiv id=links1div style=display:none;></div>');

//document.writeln('<br><span class=help tooltip=\"LPMCC.net/index.wml<br>for mobile news cards\" style=position:relative;bottom:-20px;font-size:9px;>Web on your Mobile</span><br>');


document.writeln("<p class=menutitle style=cursor:help; title=\'Click an international plate to see this page in that language\'>Translate</p>");
document.writeln("<div style=position:relative;width:80px;>");

document.writeln("<form name=trans action=http://www.google.com/translate>");
document.writeln("<input name=u value=http://www.lpmcc.net/" + fulname + " type=hidden>");
document.writeln("<input name=hl2 value=en type=hidden>");
document.writeln("<input name=ie2 value=UTF8 type=hidden>");
document.writeln("<input name=langpair value=\'\' type=hidden>");

/*
document.writeln("<div style=position:relative;height:20px;>");
document.writeln("<script src=\"http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/translatemypage.xml&up_source_language=en&w=134&h=60&title=&border=&output=js\"></script>");
document.writeln("</div>");
*/

var d1 = "<input type=image class=plate onclick=inClick(this); src=../home/gifs/plate_";

//document.writeln("<img class=plate src=../home/gifs/plate_gb.gif onclick=\"alert(\'This started in English, you plonker!\');\" style=top:090px;left:60px; title=English>");
document.writeln(d1 + "pl.gif  value=en|pl    style=top:60px;left:00px; title=Polski>");
document.writeln(d1 + "sa.gif  value=en|ar    style=top:60px;left:30px; title=Arabic>");
document.writeln(d1 + "n.gif   value=en|nl    style=top:60px;left:60px; title=Nederland>");
document.writeln(d1 + "p.gif   value=en|pt    style=top:40px;left:00px; title=Português>");
document.writeln(d1 + "rok.gif value=en|ko    style=top:40px;left:30px; title=Korean>");
document.writeln(d1 + "e.gif   value=en|es    style=top:40px;left:60px; title=Español>");
document.writeln(d1 + "rc.gif  value=en|zh-CN style=top:20px;left:00px; title=Chinese>");
document.writeln(d1 + "rus.gif value=en|ru    style=top:20px;left:30px; title=Ruski>");
document.writeln(d1 + "j.gif   value=en|ja    style=top:20px;left:60px; title=Japanese>");
document.writeln(d1 + "d.gif   value=en|de    style=top:00px;left:00px; title=Deutsch>");
document.writeln(d1 + "f.gif   value=en|fr    style=top:00px;left:30px; title=Français>");
document.writeln(d1 + "i.gif   value=en|it    style=top:00px;left:60px; title=Italiano>");
document.writeln("</form>");

document.writeln("</div>");


if (!localflag) {

	document.writeln("<div style=position:relative;top:100px;>");

	document.write("<a class=addthis_button href=http://www.addthis.com/bookmark.php?v=250&amp;pub=lpmccnet>");
	document.write("<img src=http://s7.addthis.com/static/btn/v2/lg-share-en.gif width=125 height=16 alt=\"Bookmark and Share\" style=border:0; />");
	document.write("</a>");

	var addthis  = document.createElement('SCRIPT');
	addthis.src = 'http://s7.addthis.com/js/250/addthis_widget.js#pub=lpmccnet';
	head.appendChild(addthis);

	document.writeln('<br><br>');
	document.writeln("<!--");
	document.writeln("Skype \'My Skype status\' button");
	document.writeln("http://www.skype.com/go/skypebuttons");
	document.writeln("-->");
	document.writeln("<script type=text/javascript src=http://download.skype.com/share/skypebuttons/js/skypeCheck.js></script>");
	document.writeln("<a href=skype:crossleys?sendfile><img src=http://mystatus.skype.com/smallicon/crossleys style=border:none; width=16 height=16 alt=\"My status\"></a>");
	document.writeln("</div>");

	}



document.writeln("</center>");
	
}
//========================================================
function inClick(obj) {
document.trans.langpair.value=obj.value;
}
//========================================================
// common top banner and search box

function topmenu() {

document.write('<p ID=IDname><span style=font-size:24px;font-weight:bold;>LPMCC.net</span> <span style=font-size:9px;font-weight:normal;>For friends of the Leicester Phoenix MCC</span></p>');
document.writeln('<div id=frfi style=position:absolute;top:0px;right:10px;>');
//document.writeln('<table align=right>');
//document.writeln('<tbody><tr><td>');

document.writeln('<FORM name=form0 ACTION=http://search.freefind.com/find.html METHOD=GET target=_self>');
document.writeln('<INPUT TYPE=HIDDEN NAME=id VALUE=76083762>');
document.writeln('<INPUT TYPE=HIDDEN NAME=pageid VALUE=r>');
document.writeln('<INPUT TYPE=HIDDEN NAME=mode VALUE=ALL>');
document.writeln('<INPUT TYPE=HIDDEN name=n value=0>');
document.writeln('<INPUT TYPE=TEXT NAME=query SIZE=15 class=ffsearch>');
document.writeln('<INPUT TYPE=SUBMIT VALUE=Search class=ffsearch>');
document.writeln('</FORM>');

//document.writeln('</td></tr></tbody></table>');
document.writeln('</div>');

}//end of top menu

//--------------------------------------------------------
function bottommenu() {

document.writeln('<div id=botmen class=noprint style=width:552px;clear:both;text-align:center;>');
document.writeln('<hr class=main>');
document.writeln('<img src=../home/graphics/blank.gif style=height:40px;width:100%;>');
//if (idonly!="form") backlink();
backlink();
document.writeln('<a class=botmen title=\"Back to last page\" href=javascript:history.back();>[Back]</a>');
document.writeln('<a class=botmen title=\"Start of this website\" href=../home/home_index.htm>[Home]</a>');
document.writeln('<a class=botmen title=\"Top of this page\" href=javascript:scroll(0,0);>[Top]</a>');
//if (idonly!="form") nextlink();
nextlink();
document.writeln('<br>');

document.writeln('<a class=botmen title=\"Frequently asked questions and general information\" href=../help/help_index.htm>[Help]</a>');
document.writeln('<a class=botmen title=\"Send in a message\" href=javascript:comment_start();>[Contact]</a>');
document.writeln('<a class=botmen title=\"Assuring your privacy and security\" href=../help/help_privacy.htm>[Privacy]</a>');
document.writeln('<a class=botmen title=\"Who owns the site content\" href=../gallery/photos_index.htm>[Copyright]</a>');
document.writeln('<br>');
document.writeln('<p style=width:552px;text-align:center;margin-top:60px;>' + menu_author + ' &copy;&nbsp;' + menu_update.getDate() + '&nbsp;' +  monName[menu_update.getMonth()] + '&nbsp;' + menu_update.getFullYear() + '</p>');

/* SOCIAL BOOKMARK SITES
document.writeln('<a class=botmen title=\"Post this story to Delicious\" href=\"http://del.icio.us/post?url=' + passedURL + '&amp;title=' + document.title + '\" target=newin><img src=../home/gifs/delicious.gif> Delicious</a>');
document.writeln('<a class=botmen title=\"Post this story to Facebook\" href=\"http://www.facebook.com/sharer.php?u=' + passedURL + '\" target=newin><img src=../home/gifs/facebook.gif> Facebook</a>');
document.writeln('<a class=botmen title=\"Post this story to StumbleUpon\" href=\"http://www.stumbleupon.com/submit?url=' + passedURL + '&amp;title=' + document.title + '\" target=newin><img src=../home/gifs/stumble.gif>StumbleUpon</a>');
document.writeln('<a class=botmen title=\"Post this story to reddit\" href=\"http://reddit.com/submit?url=' + passedURL + '&amp;title=' + document.title + '\" target=newin><img src=../home/gifs/redit.gif> reddit</a>');
document.writeln('<a class=botmen title=\"Post this story to Digg\" href=\"http://digg.com/submit?url=' + passedURL + '&amp;title=' + document.title + '\" target=newin><img src=../home/gifs/digg.gif> Digg</a>');
*/

document.writeln('<marquee id=mjoker height=16 width=555 loop=0 scrolldelay=1 scrollamount=2>' + marqutxt + '</marquee>');

document.writeln('</div>');

// last page process to detect error loading images

var contnt = document.getElementById("IDcontent");
var contPics = contnt.getElementsByTagName("IMG");
for (var x=0;x<contPics.length;x++) {
	contPics[x].onerror = noimage;
	}
// only write an iframe for local test purposes from Mon, 26 Jan 2009
if (localflag) document.writeln('<iframe id=jiffy src=../home/jiffy.htm style=width:0px;height:0px;overflow:hidden;visibility:hidden;></iframe>');

}//end of bottom menu

//--------------------------------------------------------
// changes missing image to blank

function noimage() {
pic = this.src.substring(this.src.lastIndexOf("/")+1);
this.src = "../home/graphics/blank.gif";
//this.height = "55";
this.style.backgroundImage = "url('../home/gifs/missing.gif')";
this.style.backgroundRepeat = "no-repeat";
this.style.backgroundPosition = "50% 50%";
this.alt = "Image " + pic + " not loaded\nPlease report it using the Comment Form.";

}

//=========================================================
//
//   Submenu popup system for use with Activity > Foreign Tours and Rally Reports
//
//========================================================
function submenu(e,htmlmenu){

obj = (document.all) ? event.toElement : e.target;

thead = obj.innerHTML;
document.getElementById("tooltip").innerHTML = "<span style='font-variant:small-caps' title=''>" + thead + " :</span><br>" + htmlmenu;
document.getElementById("tooltip").style.visibility = "visible";
movesub(e);
}

// -------------------------------------------------------
function movesub(evt) {

ELtooltip = document.getElementById("tooltip");

ttw = ELtooltip.clientWidth;
tth = ELtooltip.clientHeight;

xposition = 50;

if (document.all) {

yposition = document.body.scrollTop + event.clientY;

if (yposition + tth > document.body.scrollTop + document.body.clientHeight) yposition = yposition - tth;
if (yposition < 5) yposition=5;

} else {

yposition = evt.pageY;

if (yposition + tth > document.height) yposition = yposition - tth;
if (yposition < 5) yposition=5;
}

ELtooltip.style.left = xposition + "px";
ELtooltip.style.top = yposition + "px";
}
//===============================================
//
// P E O P L E   M E N U   S Y S T E M               uses home/people.js
//
//===============================================
var people2div = new Object;
people2div.style = "";
var menuPoff;

function peopleMenu() {

// this is a bit that creates the visible menu based on people gathered from the current page.

var name_set = "";

for (var x = 0;x < altnames.length; x++) {
	var pn = 0;
	for (var y = 0; y < people_db.length; y++) {
		var pf = people_db[y].split("|")[0];
		if (altnames[x] == pf) pn++;
		if (pn > 2) y = people_db.length;
		if (pf > altnames[x]) y = people_db.length;
		}
	if (pn > 1) {
		name_set += '<a class=level1 href=\"Javascript:findperson(\'' + altnames[x] + '\');\" title=\"Find ' + altnames[x] + ' on this page\" onMouseover=\"cancelPdelay();people2show(this);window.status=\'Find ' + altnames[x] + '\';return true;\" onMouseout=\"menuPdelay();window.status=\'\';return true;\">' + tri + altnames[x] + '</a>';
		} else {
		name_set += '<a class=level1 href=\"Javascript:findperson(\'' + altnames[x] + '\');\" title=\"Find ' + altnames[x] + ' on this page\" onMouseover=\"peopleHide();window.status=\'Find ' + altnames[x] + '\';return true;\" onMouseout=\"window.status=\'\';return true;\">' + altnames[x] + '</a>';
		}
	}
name_set += '<div class=menudiv id=people2div style=position:absolute;left:120px;display:none;background-color:white; title=\"On another page\" onMouseover=\"cancelPdelay();\" onMouseout=\"menuPdelay();\"></div>';

document.getElementById("people1div").innerHTML = name_set ;
document.getElementById("people1div").style.display = "block";
document.getElementById("IDptitle").style.display = "block";
}

// - - - - Content Links collection - - - - - - - -
var links2div = new Object;
links2div.style = "";
var menuLoff;

//===============================================
//
// L I N K S   M E N U   S Y S T E M
//
//===============================================
function linksMenu() {

var dup_link = [];
var name_set = "";

for (var l = 0; l < contentLinks.length; l++) {
	var useit = true;
	if (!contentLinks[l].href) {
		useit = false;
		} else {
		for (var dl = 0; dl < dup_link.length; dl++) {
			if (contentLinks[l].href == dup_link[dl])  useit = false;
			}
		dup_link.push(contentLinks[l].href);
		}
	if (contentLinks[l].innerHTML.indexOf("<")>-1) useit = false;
	if (contentLinks[l].innerHTML.indexOf("[")>-1) useit = false;
	if (contentLinks[l].innerHTML.length < 3)      useit = false;
	if (contentLinks[l].innerHTML == "Add your memories") useit = false;
	var lk = contentLinks[l].href.split("/");
	if (lk[0].toLowerCase().indexOf("javascript")>-1 ) useit = false;
	if (useit) {
		var tgt = "";
		if (contentLinks[l].target == "newin") tgt = " target=newin style=cursor:url(../home/gifs/newin.ani)";

		var innerhtml = contentLinks[l].innerHTML;
		innerhtml = innerhtml.charAt(0).toUpperCase() + innerhtml.substring(1);
		name_set += '<a class=level1 href=' + contentLinks[l].href + ' title=\"' + contentLinks[l].title + '\"' + tgt + '>' + innerhtml + '</a>';
		}
	}

// ------------------------------- OFF SITE PAGES

name_set += "<a class=level1 href=http://www.leicesterphoenixmcc.co.uk target=newin style=cursor:url(../home/gifs/newin.gif),auto;cursor:url(../home/gifs/newin.ani); title=\'Official Club website with Big End News\' onMouseover=\'shutAll();window.status=this.title;return true;\' onMouseout=\'window.status=\"\";return true;\'>Leicester Phoenix MCC</a>";
name_set += "<a class=level1 href=http://sites.google.com/site/ketteringdmcc target=newin style=cursor:url(../home/gifs/newin.gif),auto;cursor:url(../home/gifs/newin.ani); title=\'News and photos from old friends\' onMouseover=\'shutAll();window.status=this.title;return true;\' onMouseout=\'window.status=\"\";return true;\'>Kettering & District MCC</a>";
name_set += '<a class=level1 href=http://www.plus.net/myreferrals/new.html?w645oK3%2FCguHYxTpF%2BrJmecbgo4tzM2ChMukt3aMJTw%3D target=newin style=cursor:url(../home/gifs/newin.gif),auto;cursor:url(../home/gifs/newin.ani); title="LPMCC.net recommends PlusNet Broadband">Hosted by PlusNet</a>';


// ------------------------------- USEFUL BUTTONS
name_set += '<a class=level1 title="A five second preview of what you get if you print this page" href=JavaScript:printPreview();>Print Preview</a>';
name_set += '<a class=level1 href=http://www.lpmcc.net/rss.xml title=\"The latest all the time\"><img src=../home/gifs/feed.gif> RSS News Feed</a>';

// ------------------------------- RANDOM LINK
any_list = ["Random Page","Pot Luck","Lucky Dip","Hazard","Lottery","Surf&#39;s Up","Any Page","Free Choice","Your Guess"];

var m = any_list.length.rnd();
sub = randomPage();

name_set += "<a href=../" + sub[2] + " title=\'"+ HTML2JS(sub[1]) + " - "  + HTML2JS(sub[3]) + moreInfo(sub) + "\' class=level1 onMouseover=\'shutAll();window.status=this.title;return true;\' onMouseout=\'window.status=\"\";return true;\'><img src=../home/gifs/dice.gif align=left>" + any_list[m] + "</a>";

document.getElementById("links1div").innerHTML = name_set;
document.getElementById("links1div").style.display = "block";
document.getElementById("IDltitle").style.display = "block";
}


// ===============================
function cancelPdelay() {
clearTimeout(menuPoff);
cancelBubble = true;
}
// ===============================
function menuPdelay() {
menuPoff=setTimeout(peopleHide,500);
cancelBubble = true;
}
// ===============================
function peopleHide() {
oldMenuLine1.style.backgroundColor = '#cdf';
oldMenuLine1.style.color = 'navy';
document.getElementById("people2div").innerHTML = "";
document.getElementById("people2div").style.display = "none";
}
// ===============================
function people2show(obj) {
people2 = document.getElementById("people2div");
people2.style.width = "120px";
people2.style.height = "16px";
//people2.style.bottom = obj.offsetTop - 16; // shows menu upwards or at top of page
people2.style.top = obj.offsetTop;

window.status = HTML2JS(obj.title);
oldMenuLine1.style.backgroundColor = "#cdf";
oldMenuLine1.style.color = "navy";
oldMenuLine1 = obj;
shutAll();
var people2content = "";
var people_pages = 0;
var person = innerTEXT(obj);
var xp = 0;
var yp = 0;

obj.style.color = "white";

for (var x=0; x < people_db.length; x++) {
	sub = people_db[x].split("|");
	
	if (sub[0] > person) { //stop at next person
		x = people_db.length;
		}

	if (sub[0] == person && sub[1].indexOf(endname) < 0) people_pages++;
	}

var peoplecols = 1+Math.floor(people_pages/25);
var peoplerows = 1+Math.floor(people_pages/peoplecols);
		
for (var x=0; x < people_db.length; x++) {
	sub = people_db[x].split("|");
	
	if (sub[0] > person) { //stop at next person
		people2.innerHTML = people2content;
		people2.style.display = "block";
		x = people_db.length;
		}

	if (sub[0] == person && sub[1].indexOf(endname) < 0) { //find the name NOT on this page
		if (sub[1].substr(1,4) == "http") {
			people2content += "<a class=level1 style=position:absolute;top:" + yp + "px;left:" + xp + "px; href=" + sub[1].substring(1) + " title=\"" + person + "\'s Website\" onMouseover=\"window.status=this.title;return true;\" onMouseout=\"window.status=\'\';return true;\" target=newin>" + sub[2] + " </a>";
			} else {
			people2content += "<a class=level1 style=position:absolute;top:" + yp + "px;left:" + xp + "px; href=../" + sub[1] + "?person=" + escape(sub[0]) + " title=\"Find " + person + " on this page\" onMouseover=\"window.status=\'Go to ' + innerTEXT(this) + '\';return true;\" onMouseout=\"window.status=\'\';return true;\">" + sub[2] + " </a>";
			}
		yp -= 16;
		if (yp <= -16*peoplerows) {
			yp = 0;
			xp += 120;
			}
		}
	}

}
// ===============================































//========================================================
//
// CREATES A FLASHING BLUE MESSAGE LINE
//
//========================================================

todata = tday.getDate() + "/" + 1*(1+tday.getMonth());
todate = todata + "/" + tday.getFullYear();
dolimit = 0;

var colarray = ["#0CF","#09F","#06F","#03F","#00F","#00C","#009","#006","#003","#000","#003","#006","#009","#00C","#00F","#03F","#06F","#09F","#0CF","#0FF","#9FF"];

var bpointer = 0;

//--------------------------------------------------------
function daily() {

var newsflash = "";
switch (todata)	{
	case "1/1"  :newsflash="Happy New Year";break;
	case "25/12":newsflash="Merry Christmas";break;
	default:newsflash="";break;
	}
if (newsflash!="") document.writeln("<h2 class=red>" + newsflash + "</h2>");

newsflash = "";

for (var x=1;x<reunions_db.length;x++) {

	fieldsFromReunions(x);

	var realmeetdate = meetdate.getUKdate();

	var datedif = realmeetdate.getTime() - caldate.getTime();
//alert(realmeetdate.getTime() + " " + caldate.getTime());
	if (datedif >= 0) {
		var whenbit = getWhen(meetdate); //phrase such as 'next week'
		whenbit = whenbit.charAt(0).toUpperCase() + whenbit.substring(1,whenbit.length); //initial capital
		var newstitle = mcomment;
		var newsflash = whenbit + " " + mplace;
		}
	}

if (newsflash!="") rainbow(newsflash);
}

//--------------------------------------------------------
function rainbow(text)	{
//Only use once on a page.
var letters = text.length;
document.write("<a href=../home/home_calendar.htm title=\'Event List\' style=text-decoration:none;>");
for (var x=0;x<letters;x++)	{
	var chrt = text.charAt(x);
	if (chrt == " ") chrt = "&nbsp;";
	document.write("<span class=rbow ID=\'mrb" + x + "\'>" + chrt + "</span>");
	}
document.write("<\a>");
setTimeout(function(){tcycle(letters)},80);
}

//--------------------------------------------------------
function tcycle(numbr){
var inm = bpointer;
for (var x=0;x<numbr;x++)	{
	var obm = document.getElementById("mrb" + x);
	obm.style.color = colarray[inm];
	inm++;
	if (inm == colarray.length) inm=0;
	}
bpointer--;
if (bpointer < 0 ) bpointer=colarray.length-1;
setTimeout(function(){tcycle(numbr)},80);
}

//========================================================

// ADDS A SWAPABLE IMAGE

// In HTML insert <s cript>writeimageHTML("caption|height","jpeg1","jpeg2","jpeg3")</s cript>

//========================================================

// REWRITTEN Fri, 03 Aug 2007: Takes any height picture 25 May 2008

var imgID = 0;
var currentImg = new Object;
var nextImg = new Object;
var turnleftnum = 0;


function writeimageHTML(caption) {
al = arguments.length;
var capn = caption.split("|");
if (capn.length==1) capn.push(375);
if (capn[0] == "") {
	capn[0] = "Click the curly corner to see " + (al-2) + " more photos";
	if (al == 3) capn[0] = "Click the curly corner to see another photo";
	}
document.write("<div class=turn style=height:" + capn[1] + "px;><img class=swipe src=graphics/" + arguments[1]+ ".jpg alt=\'" + capn[0] + "\' style=width:500px;height:" + capn[1] + "px; usemap=#" + arguments[1] + ">");
for (var x = 2; x < al; x++) {
	document.write("<img class=swipe src=graphics/" + arguments[x]+ ".jpg alt=\'" + capn[0] + "\' style=width:0px; usemap=#" + arguments[x] + ">");
	}
document.write("<img src=../home/graphics/turn.gif class=curl onClick=picswap(this)></div>");
}
//--------------------------------------------------------


function picswap(curl){

var picdiv = curl.parentNode;
piccount = picdiv.childNodes.length-2;

currentImg = picdiv.childNodes[piccount];
nextImg    = picdiv.childNodes[0];

for (var x = 0; x < piccount; x++) {
	if (picdiv.childNodes[x].style.width == "500px") {
		currentImg = picdiv.childNodes[x];
		nextImg = picdiv.childNodes[x+1];
		x = piccount;
		}
	}

currentImg.style.zIndex = 2;
nextImg.style.zIndex = 1;
nextImg.style.left = 0;
nextImg.style.width = 500;
nextImg.style.height = picdiv.style.height;

turnleft();

}

function turnleft() {
currentImg.style.width = 500-turnleftnum;
turnleftnum+=10;
if (turnleftnum <= 500) {
	setTimeout(turnleft,10); 
	} else {
	currentImg.style.left = 500;
	turnleftnum = 0;
	}
}
//========================================================

// Replacement image swap functions - a softer wipe over and different curl
// introduced with Flickr images (defaults)

// use prime_curls() in pageInit
// create_image_turn("caption|height","3639/3459027239_34e651cf3a_o|3567/3459842304_b5edfc294a_o","root")
//                default is 375^       ^--"m" + these are map names--^  if omitted defaults to Flickr^
//========================================================

//GLOBALS
var set_id = [];
for (var x=0;x<12;x++) set_id.push(new Object());
var pangle = 0;
var turnflag = true;
//--------------------------------------------------------
function prime_curls() {
var ims = document.getElementsByTagName("IMG");
for (var x=0;x<ims.length;x++) {
	if (ims[x].className == "curl")	ims[x].onclick = start_image_turn;
	}
}
//--------------------------------------------------------
function start_image_turn() {if (turnflag) {
turnflag = false;
// set the objects to global variables
var topdiv = this.parentNode;
for (var x=0;x<topdiv.childNodes.length; x++) {
	var zi = 1*topdiv.childNodes[x].style.zIndex;
	set_id[zi] = topdiv.childNodes[x];
	if (zi < 4) set_id[(zi+8)] = topdiv.childNodes[x].firstChild;
	}
set_id[2].style.top = -5;
set_id[2].style.width = 25;
set_id[3].style.top = -5;
set_id[4].style.width = 25;
set_id[5].style.width = 0;
turn_image_right();
}}
//--------------------------------------------------------
function turn_image_right() {
set_id[1].style.width = 450 - pangle;;
set_id[2].style.left  = 425 - pangle;
set_id[3].style.width = pangle;
set_id[3].style.left  = 425 - (2*pangle);
set_id[4].style.left  = 450 - pangle;
set_id[10].style.left = -pangle/2;
pangle+=5;

if (pangle < 200) {
	setTimeout(turn_image_right,10);
	} else {
	pangle=25;
	turn_image_done();
	}

}
//--------------------------------------------------------
function turn_image_done() {
set_id[1].style.width = pangle;
set_id[2].style.width = pangle;
set_id[2].style.left = 250 - pangle;
set_id[2].style.top = -pangle/5;
set_id[3].style.top = -pangle/5;
set_id[3].style.width = 250 - (2*pangle);
set_id[3].style.left  = pangle;
set_id[4].style.width = pangle;
set_id[5].style.width = 54 - (pangle*2);
set_id[10].style.left = pangle - 125;
pangle--;
if (pangle > 0 ) {
	setTimeout(turn_image_done,10);
	} else {
	var root = set_id[5].getAttribute("path");
	var ims = set_id[5].getAttribute("images").split("|");
	var im = 0;
	for (var x=0;x<ims.length;x++) if (set_id[10].src.indexOf(ims[x]) > -1) im = (x+1)%ims.length;
	set_id[0].style.zIndex = 1;
	set_id[1].style.zIndex = 0;
	set_id[1].style.width = 500;
	set_id[2].style.left  = 425;
	set_id[2].style.width = 0;
	set_id[3].style.width = 0;
	set_id[4].style.left  = 450;
	set_id[4].style.width = 0;
	set_id[9].src = root + ims[im] + ".jpg";
	set_id[9].useMap = "#m" + ims[im].split("/")[0].substr(0,4);
//alert(set_id[9].useMap);
	set_id[10].src = root + ims[im] + ".jpg";
	set_id[11].src = root + ims[im] + ".jpg";
	turnflag = true;
	}
}
//--------------------------------------------------------
function create_image_turn(caphi,imagelist,path) {
var caption = caphi;
var hi = 375;
var c = caphi.split("|");
if (c.length >1) {
	caption = c[0];
	hi = c[1];
	}
var root = "http://farm4.static.flickr.com/";
if (arguments.length > 2) root = path;
	
var ims = imagelist.split("|");
document.write("<div class=turn style=height:" + hi + "px;overflow:visible;>");

if (arguments.length > 2) root = path;
if (root == "msn") {
	root = "http://ygv4na.bay.livefilestore.com/";
	document.write("<a href=\'http://cid-afd1d02f6dac766f.skydrive.live.com/browse.aspx/Public/\' style=\'z-index:7;\' target=\'newin\'><img class=\'flik\' src=\'../home/gifs/windows.gif\' style=\'z-index:7;\' alt=\'LPMCC.net photos on Windows Live\'></a>");
	}
if (root == "rally2") {
	root = "http://yhd31q.bay.livefilestore.com/";
	document.write("<a href=\'http://cid-afd1d02f6dac766f.skydrive.live.com/browse.aspx/Rallies/\' style=\'z-index:7;\' target=\'newin\'><img class=\'flik\' src=\'../home/gifs/windows.gif\' style=\'z-index:7;\' alt=\'LPMCC.net rally photos on Windows Live\'></a>");
	}
if (root == "rally") {
	root = "http://kokqvw.bay.livefilestore.com/";
	document.write("<a href=\'http://cid-afd1d02f6dac766f.skydrive.live.com/browse.aspx/Rallies/\' style=\'z-index:7;\' target=\'newin\'><img class=\'flik\' src=\'../home/gifs/windows.gif\' style=\'z-index:7;\' alt=\'LPMCC.net rally photos on Windows Live\'></a>");
	}

if (root == "flickr") {
	root = "http://farm4.static.flickr.com/";
	document.write("<a href=\'http://www.flickr.com/photos/lpmcc-net/\' style=\'z-index:7;\' target=\'flickr\'><img class=\'flik\' src=\'../home/gifs/flickr.gif\' style=\'z-index:7;\' alt=\'LPMCC.net photos on Flickr\'></a>");
	}

if (root.slice(0,2) == "//") {
	root = "http:" + root + ".bay.livefilestore.com/";
	document.write("<a href=\'http://cid-afd1d02f6dac766f.skydrive.live.com/browse.aspx/Rallies/\' style=\'z-index:7;\' target=\'newin\'><img class=\'flik\' src=\'../home/gifs/windows.gif\' style=\'z-index:7;\' alt=\'LPMCC.net rally photos on Windows Live\'></a>");
	}

if (caption != "") document.write("<p class=caption style=z-index:6;>" + caption + "</p>");

document.write("<img class=curl src=../home/gifs/turn.gif style=z-index:5; images=\'" + imagelist + "\' path=\'" + root + "\' alt=\'Click to turn page\'>");

document.write("<img class=page src=\'../home/gifs/black.gif\' style=left:600px;height:" + hi + "px;width:0px;z-index:4;filter:alpha(opacity=30);opacity:0.3;>");

document.write("<div class=page style=left:425px;z-index:3;height:" + hi + "px;width:0px;>");
document.write("<img class=page src=\'" + root + ims[1] + ".jpg\' style=left:0px;height:" + hi + "px;></div>");

document.write("<div class=page style=left:600px;z-index:2;height:" + hi + "px;width:0px;>");
document.write("<img class=page src=\'" + root + ims[1] + ".jpg\' style=left:0px;height:" + hi + "px;width:250px;></div>");

document.write("<div class=page style=left:0px;z-index:1;height:" + hi + "px;width:500px;>");
document.write("<img class=page src=\'" + root + ims[0] + ".jpg\' style=left:0px;height:" + hi + "px; usemap=#m" + ims[0].substring(0,4) + "></div>");

document.write("<div class=page style=left:0px;z-index:0;height:" + hi + "px;width:500px;>");
document.write("<img class=page src=\'" + root + ims[1] + ".jpg\' style=left:0px;width:500px;z-index:0;height:" + hi + "px; usemap=#m" + ims[0].substring(0,4) + "></div>");
document.write("</div>");
for (var x = 2; x< ims.length; x++) {
	document.write("<img class=meta src=\'" + root + ims[x] + ".jpg\'></div>");
	}
}
//--------------------------------------------------------


























//========================================================
//
// S M A L L   F U N C T I O N S    F O R   I N T E R A C T I V I T Y 
//
//========================================================
// puts combined AREA TITLE and AREA ALT into the status line. Call must include 'return true' 

function mon()	{
this.parentNode.parentNode.style.cursor = "help";
if (this.title == undefined) this.title = "";
if (this.alt == undefined) this.alt = "";
var statmsg =  this.title + " " + this.alt ;
if (statmsg.length < 4 && statmsg.length > 1) statmsg = "Can you identify " + statmsg + "?";
window.status = statmsg;
//areatip(statmsg); // not good enough to use - not FF compliant
if (!document.all && this.alt!="") {
	this.title += " " + this.alt;
	this.alt = "";
	}
}

function mof(e)	{
this.parentNode.parentNode.style.cursor = "default";
window.status= "" ;
}
//========================================================
// navigation by key press. To have Govt guidelines added.

document.onkeydown=keyNav; // sets the event for anywhere on ALL documents!

function keyNav(e) {
var page = "";

var evt = (e) ? e : window.event;

var n = (document.all) ? evt.keyCode : evt.which;

if (evt.altKey) {

// the first six moved to the ALT group Wed, 11 Oct 2006 now every page has a search form
	if (n==188)page=backp;//< actually ,
	if (n==190)page=nextp;//> actually .
	if (n==60) page=backp;//< 
	if (n==62) page=nextp;//>
//	if (n==90) alert("common.js called by Z key");//Z used to find which javascript file is active
	if (n==112)page="../help/help_index.htm";//?


//	if (n==75) bmark();//K
//	if (n==80) mainprint();//P
	if (n==79) popup("form");//O

	if (n==65) page="../activity/event_index.htm";	//A
	if (n==66) page="../rallies/rally_badges.htm";	//B
	if (n==67) page="../runs/runs_index.htm";	//C
	if (n==68) page="../home/home_calendar.htm";	//D
	if (n==69) comment_start();			//E
	if (n==70) page="../help/help_faq.htm";		//F
	if (n==71) page="../gallery/photos_index.htm";	//G
	if (n==72) page="../home/home_index.htm";	//H
	if (n==73) page="../help/help_index.htm";	//I
	if (n==75) showKeys();				//K
//	if (n==76) page="../runs/runs_index.htm";	//L
	if (n==77) page="../megaphone/megaphone_index.htm";//M
	if (n==78) page="../news/news_index.htm";	//N
	if (n==80) page="../post/post_index.htm";	//P
	if (n==81) page="../help/help_index.htm";	//Q
	if (n==82) page="../rallies/rally_index.htm";	//R
	if (n==83) page="../home/home_map.htm";		//S
	if (n==84) page="../training/training_index.htm";//T
	if (n==86) showAdmin();				//V
	if (n==87) writeReport();			//W
	if (n==88) page="../members/members_index.htm";	//X
	if (n==191)showKeys();				//?

	if (page!="") document.location.href=page;
/*
	if (document.all) {
		evt.returnValue = false;
		} else {
		evt.returnValue = n;
		}
*/
	}
}

//========================================================
// adds a phrase describing when something was based on the date passed to the function. 

function saywhen(textdate) { document.write("<b class=help title=" + textdate + ">" + getWhen(textdate) + "</b>");}

function getWhen(UKdate) {
thisdate = UKdate.getUKdate();

yeardiff = tday.getFullYear() - thisdate.getFullYear();
daydiff = Math.floor((tday.getTime() - thisdate.getTime())/day);
weekdiff = Math.floor(daydiff/7);

if (daydiff==0)  retphrase = "today";
if (daydiff==1)  retphrase = "yesterday";
if (daydiff>1)   retphrase = "last " + dayName[thisdate.getDay()] ;
if (daydiff>7)   retphrase = "the week before last";
if (weekdiff>2)  retphrase = textNum(weekdiff) + " weeks ago";
if (weekdiff>5)  retphrase = "last month";
if (weekdiff>7)  retphrase = "last " + monName[thisdate.getMonth()];
if (weekdiff>52) retphrase= "last year";
if (yeardiff>1)  retphrase = textNum(yeardiff) + " years ago";

if (daydiff==-1)  retphrase = "tomorrow";
if (daydiff<-1)   retphrase = "this " + dayName[thisdate.getDay()] ;
if (daydiff==-7)   retphrase = "a week today";
if (daydiff<-7)   retphrase = "Next week";
if (weekdiff<-2)  retphrase = "in " + textNum(-weekdiff) + " weeks time";
if (weekdiff<-5)  retphrase = "next month";
if (weekdiff<-7)  retphrase = "next " + monName[thisdate.getMonth()];
if (weekdiff<-52) retphrase= "next year";
if (yeardiff<-1)  retphrase = "in " + textNum(-yeardiff) + " years time";

return retphrase;
}
//========================================================
// Writes the number of years since a date. 
	
function pyears(UKdate) {

oldy = UKdate.getUKdate();
tdayYr = tday.getFullYear();
oldyYr = oldy.getFullYear();
datediff = tdayYr - oldyYr;
document.write(textNum(datediff));
}
//--------------------------------------------------------
// turns an integer number into a text string version OR adds commas to thousands

function textNum(n) {
var m = "";

if (n>999) {
	var p = 3;
	m = n.toString();
	while (p < m.length) {
		m = m.slice(0,-p) + "," + m.slice(-p);
		p += 4;
		}
	} else {
/*
	if (n > 999) 	{
		var thousands = Math.floor(n/1000);
		m = numName[thousands] + " thousand ";
		n = n % 1000;
		}
*/
	if (n > 99) 	{
		hundreds = Math.floor(n/100);
		m += numName[hundreds] + " hundred";
		n = n % 100;
		}
	if (m != "" && n > 0) m += " and ";
	if (n>0 && n<100) m += lowNums(n);
	}
return m;
}
//--------------------------------------------------------
function lowNums(m) {
if (m > 20) {
	b = bigNums[Math.floor(m/10)] + " " + numName[m%10];
	} else {
	b = numName[m];
	}

return b;
}
//========================================================
// shuffles the order of string items in an array.
function shuffle$(aray) {

var newaray = [];
var al = aray.length;

for (var x=0;x<al;x++) {
	var r = Math.floor(Math.random()*aray.length);
	newaray.push(aray[r]);
	aray.splice(r,1);
	}	
return newaray;
}

//========================================================
/*
    Written by Jonathan Snook, http://www.snook.ca/jonathan
    Add-ons by Robert Nyman, http://www.robertnyman.com
*/

function getElementsByClassName(oElm, strTagName, strClassName){
var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName);
var arrReturnElements = [];
strClassName = strClassName.replace(/\-/g, "\\-");
var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
var oElement;
for(var i=0; i<arrElements.length; i++){
	oElement = arrElements[i];      
	if(oRegExp.test(oElement.className)){
		arrReturnElements.push(oElement);
		}   
	}
return arrReturnElements;
}
//--------------------------------------------------------
function HowLong() {
var tnext = new Date();
var nnow = tnext.getTime();
var ttime = nnow-tnow;
alert("Time to load = " + ttime/1000 + " seconds");
}
//========================================================
// added 26 Feb 2007
// mouseover and mouseout highlighting (eg used for table rows)

function hilite(obj) {obj.style.backgroundColor = "#ccddff";}
function lolite(obj) {obj.style.backgroundColor = "white";}

var strt_color = "";
function hilit(obj) {
strt_color = obj.style.backgroundColor;
obj.style.backgroundColor = "#B2C1EF";
}
function lolit(obj) {obj.style.backgroundColor = strt_color;}
//========================================================
// Spark Plug Cursor functions

function sparky() {
if (document.all) {
	if (iev == 6 || iev == 7) document.body.style.cursor = "../home/gifs/sparky.ani"; 
	if (iev == 8) document.body.style.cursor = "url(../home/gifs/sparky.ani)"; 
	setTimeout(plug,400);
	} else {
	document.body.style.cursor = "url(../home/gifs/sparky.gif), auto";
	setTimeout(plug,250);
	}
}
//--------------------------------------------------------
function plug() {
if (document.all) {
	if (iev == 6 || iev == 7) document.body.style.cursor = "../home/gifs/plug.ani"; 
	if (iev == 8) document.body.style.cursor = "url(../home/gifs/plug.ani)"; 
	} else {
	document.body.style.cursor = "url(../home/gifs/plug.gif), auto";
	}
}































//========================================================
//
// I M A G E   U T I L I T I E S
//
//========================================================
// cycles through alternative pictures (onClick) for use when there are no AREAs to remap. 'obj' is passed as 'this' and followed by any number of picture names without the '.jpg'
// example
// <div class=turn>
// <img class=swipe name="group" src="graphics/t_dba010.jpg" width=500  height=350 alt="1 of 2" usemap="#Map")><a name=x1></a>
// <img class=curl src=../home/graphics/turn.gif onClick=swap(group) title="Click to change picture">
// </div>

function swap(obj)	{
y=-1;
obj.style.filter = "revealTrans(Duration=1, Transition=7)";
what = obj.src;
slash = what.lastIndexOf("/");
endbit = what.substring(slash+1,what.length-4);
startbit = what.substring(0,slash+1);
suffix = what.substring(what.length-4,what.length);
for (var x=1;x<arguments.length;x++) {if (endbit == arguments[x]) y=x+1 };
if (y == arguments.length) y=1;
if (y == -1) {alert("Please wait until the page has finished opening");return true};
if (document.all) obj.filters[0].Apply();
obj.src = startbit + arguments[y] + suffix;
if (document.all) obj.filters[0].Play();
obj.alt = y + " of " + (arguments.length - 1);
}
//--------------------------------------------------------
// Puts the page curl gif on the top right of the main picture. Depends on correct sourceIndex order!
//
// DO NOT USE loLeft() FUNCTION


function topRight(obj)	{
alert("Please tell Ben this page calls a defunct 'topRight' script.\r\rThank you");
//bigimage=obj.sourceIndex - 1;
//obj.style.left = document.all[bigimage].width - obj.width;
}

//========================================================
//
//    Z O O M A B L E   I M A G E S
//
//    set the HTML as follows
//
//	<div style="position:relative;width:500;height:220;overflow:hidden;cursor:crosshair;">
//	<img src="graphics/instructors.jpg" id=zpic onclick="zsize(this,4,event)" width="500" height="220" onMousemove="movezwin(this,4)" onMouseout="clearzwin()" usemap="#zoom" style="position:absolute">
//	<img src="../home/graphics/zoom.gif" onClick="zglass(this,4,event)" style="position:absolute;top:180px;left:460px;width:32px;height:32px;background:transparent;cursor:help;" title="Align crosshair where you want to zoom">
//	<script>makezwin()</script>
//	</div>
//
//	<area class=zoom onclick=areaclick(event) shape="rect" coords="151,92,172,206" nohref alt="John Parbery">
//
//    The MAPped AREAs should have the CLASS name the same as the map NAME. eg "zoom"
//    GLASS IMAGE MUST BE NEXT TAG AFTER ZOOMABLE IMAGE
//--------------------------------------------------------

var picnum = 0;

function zsize(pic,mag,evt)	{

e = (window.event) ? window.event : evt; //Firefox fix

xsize=pic.width;
ysize=pic.height;
if (xsize < 501)	{
	pic.width = xsize * mag;
	pic.height = ysize * mag;
	if (document.all) {
		pic.style.top = e.offsetY - e.offsetY * mag;
		pic.style.left = e.offsetX - e.offsetX * mag;
		} else {
		pic.style.top = e.layerY - (e.layerY * mag);
		pic.style.left = e.layerX - (e.layerX * mag);
		}
	clearzwin();
	pic.alt = "Click again to reduce to original size";
	areachange(pic,mag);
	} else {
	zreset(pic,mag);
	}
}
//--------------------------------------------------------
// This passes the event from the AREA tags so FireFox will work

function areaclick(mag,ev) {
if (window.event) {return true;} else {zsize(document.getElementById("zpic"),mag,ev);}
}
//--------------------------------------------------------

function zreset(pic,mag)	{

xsize=pic.width;
ysize=pic.height;

if (xsize > 500)	{
	pic.width = xsize / mag;
	pic.height = ysize / mag;
	pic.style.top = 0;
	pic.style.left = 0;
	pic.alt = "Click to magnify " + mag + "x";
	areachange(pic,1/mag);
	}
}
//--------------------------------------------------------

function areachange(pic,mag)	{

mapname = pic.getAttribute("usemap");//AREA class needs to be the same as the MAP name!
mapname = mapname.substring(1,mapname.length);//remove the leading #

arrayArea = document.getElementsByTagName("AREA");
for (var x=0;x<arrayArea.length;x++) {   
	if (arrayArea[x].className == mapname)	{
		coord$ = arrayArea[x].coords;
		coordArray = coord$.split(",");
		for (var y=0;y<coordArray.length;y++)	{coordArray[y] = mag * coordArray[y]};
		coord$ = coordArray.join(",");
		arrayArea[x].coords = coord$;
		}
	}
}
//--------------------------------------------------------

function zglass(obj,mag)	{ // taken out - it does not seem to work. Some pages still call this from a click on the mag glass
picnum = 0;
while (obj != document.all[picnum]) {picnum++}
picnum--;
zreset(document.all[picnum],mag);//
}//end of zglass NB GLASS IMAGE MUST BE NEXT TAG AFTER ZOOMABLE IMAGE.

//--------------------------------------------------------
//places a 'window' (actually four frame corners) where the cursor should be
var Xoff = 125;
var Yoff = 87;

//--------------------------------------------------------
function movezwin(ele,mag,evt) {

picnum = 0;
while (ele != document.images[picnum]) {picnum++}
picnum++;
document.images[picnum].style.display = "none";

e = (window.event) ? window.event : evt; //Firefox fix

if (ele.width < 505) {

	wi = ele.width/mag;
	hi = ele.height/mag;

	document.getElementById("zxtl").style.display="block";
	document.getElementById("zxbl").style.display="block";
	document.getElementById("zytl").style.display="block";
	document.getElementById("zytr").style.display="block";

	document.getElementById("zymg1x1").style.display="block";
	document.getElementById("zymg2x1").style.display="block";
	document.getElementById("zymg2x3").style.display="block";
	document.getElementById("zymg3x1").style.display="block";

	document.getElementById("zmag").style.display="block";
	document.getElementById("zmag").innerHTML= mag + '&times;<span class=zwin id=zmagb style=color:white;top:-1px;left:-1px;>' + mag +'&times;</span>';
	document.getElementById("zmagb").style.display="block";
	document.getElementById("zxtl").style.width  = wi;
	document.getElementById("zxtl").style.height = 2;
	document.getElementById("zytl").style.width  = 2;
	document.getElementById("zytl").style.height = hi;
	document.getElementById("zytr").style.width  = 2;
	document.getElementById("zytr").style.height = hi;
	document.getElementById("zxbl").style.width  = wi;
	document.getElementById("zxbl").style.height = 2;

	if (document.all) { //IE only
		Xset = e.offsetX;
		Yset = e.offsetY;
		} else {
		Xset = e.layerX;
		Yset = e.layerY;
		}

	Xref = Xset - (wi * Xset / ele.width);
	Yref = Yset - (hi * Yset / ele.height);

	document.getElementById("zxtl").style.left = Xset - (wi * Xset / ele.width);
	document.getElementById("zxtl").style.top  = Yset - (hi * Yset / ele.height);

	document.getElementById("zymg1x1").style.left = Xset - 10;
	document.getElementById("zymg1x1").style.top  = Yset - 11;
	document.getElementById("zymg2x1").style.left = Xset - 10;
	document.getElementById("zymg2x1").style.top  = Yset - 6;
	document.getElementById("zymg2x3").style.left = Xset + 7;
	document.getElementById("zymg2x3").style.top  = Yset - 6;
	document.getElementById("zymg3x1").style.left = Xset - 10;
	document.getElementById("zymg3x1").style.top  = Yset + 7;

	document.getElementById("zytl").style.left = Xref;
	document.getElementById("zytl").style.top  = Yref;
                                      
	document.getElementById("zytr").style.left = Xref + wi;
	document.getElementById("zytr").style.top  = Yref;
                                      
	document.getElementById("zxbl").style.left = Xref;
	document.getElementById("zxbl").style.top  = Yref + hi;
	document.getElementById("zmag").style.left = Xref + wi + 10;
	document.getElementById("zmag").style.top  = Yref;

	} else {
	clearzwin();
	}
}

//--------------------------------------------------------
function clearzwin() {
document.getElementById("zxtl").style.display="none";
document.getElementById("zxbl").style.display="none";
document.getElementById("zytl").style.display="none";
document.getElementById("zytr").style.display="none";
document.getElementById("zymg1x1").style.display="none";
//
document.getElementById("zymg2x1").style.display="none";
document.getElementById("zymg2x3").style.display="none";
document.getElementById("zymg3x1").style.display="none";
document.getElementById("zmag").style.display="none";
//
document.images[picnum].style.display = "block";

}
//--------------------------------------------------------
function makezwin() {
document.writeln('<img class="zwin" id="zxtl" src="../home/graphics/zx.gif">');
document.writeln('<img class="zwin" id="zxbl" src="../home/graphics/zx.gif">');
document.writeln('<img class="zwin" id="zytl" src="../home/graphics/zy.gif">');
document.writeln('<img class="zwin" id="zytr" src="../home/graphics/zy.gif">');
//
document.writeln('<img class="zwin" id="zymg1x1" src="../home/graphics/zoom_1x1.gif">');
document.writeln('<img class="zwin" id="zymg2x1" src="../home/graphics/zoom_2x1.gif">');
document.writeln('<img class="zwin" id="zymg2x3" src="../home/graphics/zoom_2x3.gif">');
document.writeln('<img class="zwin" id="zymg3x1" src="../home/graphics/zoom_3x1.gif">');
//
document.writeln('<div class=zwin id=zmag>2x<p class=zwin id=zmagb style=color:white;top:-1px;left:-1px;></div>');
//
document.writeln('<div class="zwin" id="zmag">zoom</div>');
}
//========================================================
//	August 2009
//
//	AUTOMATIC THUMBNAIL SYSTEM
//
//	thumbn_triple() takes various arguments
//	("[caption]|[thumbstub]|[375x500]|[20]", ... 2 more ... [,"http://www.cloud.com/"])
//	     non std dimensions-----^       ^--top offset                   root
//	no caption  = no caption
//	filestub    = b_filestub.jpg --- look up filestub in msnpics for photo name
//	no filestub = calculate thumbname as b_idonlyXX.jpg -- photo name is msn[xx]
//	no dimensions = default 500px x 375px
//	offset = minus distance to set thumbnail from top of frame to correct aspect ratio, default top zero
//	IMPORTANT portrait photos should be at the END of the series and NOT included in menu_db[10] thumbs count
//
//	(2);	number of ROWS ie 3N thumbnails with calculated filenames = b_idonlyXX.jpg
//	();	default single row of three calculated thumbnails	
//
//	()	default three thumbnails calculated names with lookup table
//
//	var msnindex = root; // if not last triple argument in PAGE
//	var msnpics = array of full size photo name stubs   in PAGE
//
//	run thumbn_init() in pageInit();
//	if thumb_init has an argument it is for the date/time offset in msnpics stubs AND ...
//	...	there must by a thumbn_days lookup array in the PAGE - see thumbnday() function
//--------------------------------------------------------
function thumbn_init() {
var offset = null;
if (arguments.length == 1) offset = arguments[0];
var ims = document.getElementsByTagName("IMG");
for (var x=0;x<ims.length;x++) {
	if (ims[x].className == "thumbn") {
		ims[x].onclick = thumbn_load;
		if (offset) {// global variable set in page to identify DATE CODE start position
			var index  = ims[x].src.slice(-6,-4)*1-1;
			var pointer= msnpics[index].lastIndexOf("/")+offset;
			var d = thumbnday(msnpics[index].substr(pointer,2));
			var h = msnpics[index].substr(pointer+2,2);
			var m = msnpics[index].substr(pointer+4,2);
			ims[x].title += " Photo taken at " + h + "." + m + " on " + d;
			}
		}
	if (ims[x].className == "mainpic") ims[x].onclick = thumbn_shut;
	}
}
//---------------------------------------------
var thumbnum = 0;

function thumbn_triple() {
if (msnindex.length >0) root = msnindex[0];
var picount = arguments.length;
if (picount < 3) {
	picount = 3; //default if no number passed
	if (arguments.length == 1) picount = arguments[0]*3;
	for (var x=0;x<picount;x++) arguments[x] = "||";
	} else {
	if (picount%3 == 0) {
		// no root passed - use default
		} else {
		picount--;
		root = arguments[picount];
		}
	}

document.write("<div class=framen style=height:" + picount/3*126 + "px;>");
var tp = 0;
for (var x=0;x<picount;x+=3) {
	for (var y=0;y<3;y++) {
		var locs = arguments[x+y].split("|");
		var ttps = 0;
		var thumbpre = "s_";
		if (locs[1] == "") {
			thumbnum++; // increment the global counter
			locs[1] = idonly + prezero(thumbnum,2);
			if (msnindex.length > 1) locs[1] = idonly + prezero(msnindex[thumbnum],2);
			thumbpre = "b_";
			}
		if (locs[2] != "") {
			var xy = locs[2].split("x");
			ttps = Math.round(62 - (164 * xy[1] / xy[0] / 2));
			}
		if (locs.length == 4) ttps = -locs[3];
		document.write("<div class=thumbn style=top:" + tp + "px;left:" + (y*167) + "px;>");
		document.write("<img class=thumbn src=thumbs/" + thumbpre + locs[1] + ".jpg title=\"" + locs[0] + "\" dims=\"" + locs[2] + "\" width=164 style=top:" + ttps + "px;>");
		document.write("</div>");
		}
	tp+=126;
	}
document.write("<div class=captn>Click on a small picture to open a larger photograph</div>");
document.write("<img class=shadon src=../home/gifs/black.gif>");
document.write("<img class=mainpic src=../home/gifs/black.gif root=\"" + root + "\" >");
document.write("</div>");
}
//---------------------------------------------
function delaythumb(){
var ims = document.getElementById("IDcontent").getElementsByTagName("IMG");
var p = ims.length
for (var x=0;x<ims.length;x++) {
	if (ims[x].src.indexOf("/thumbs/b_") > 0) {
		p = x;
		x = ims.length;
		}
	}
if (p < ims.length) {
	var tnum = ims[p].src;
	tnum = tnum.lastIndexOf(".");
	tnum = ims[p].src.substr(tnum-2,2)-1;
	ims[p].src = msnindex[0] + msnpics[tnum] + ".jpg";//get the correct names
	setTimeout(delaythumb,2000);
	}
}
//---------------------------------------------

var mainpc = new Object();
var shader = new Object();
var capn   = new Object();
var inc_left = 1;
var inc_top = 1;
var inc_width = 1;
var inc_height = 1;
var target_width = 500;
var shader_off = 0;

//---------------------------------------------
function thumbn_load() {
// may need to set the objects globally
var dims= this.getAttribute("dims");
var cell= this.parentNode;
mainpc  = cell.parentNode.lastChild;
shader  = mainpc.previousSibling;
capn    = shader.previousSibling;

mainpc.style.width = 0;
mainpc.style.height = 0;
mainpc.src = this.src;
shader.style.width = 0;
shader.style.height = 0;
capn.style.display = "none";
capn.innerHTML = unbreak(this.title);

// set the mainpic etc
var lst = this.src.lastIndexOf("/");
var fst = this.src.substring(0,lst).lastIndexOf("/")+1;
var bigpic = this.src.substring(fst,this.src.lastIndexOf("."));
var b = this.src.lastIndexOf("/s_");
if (b>0) {
	bigpic = this.src.substring(b+3).slice(0,-4);
	for (var x=0;x<msnpics.length;x++) {
		var msnbits = msnpics[x].split("/");
		if (msnbits[msnbits.length-1] == bigpic) bigpic = msnpics[x]; 
		}
	}
var b = this.src.lastIndexOf("/b_");
if (b>0) {
	bigpic = this.src.substring(b+3).slice(0,-4);
	var index = bigpic.slice(-2)*1; // GOT to be a 2 digit number!
	if (msnindex.length > 1) {
		for (var x = 1;x<msnindex.length;x++) if (msnindex[x] == index) bigpic = msnpics[msnindex[x]];
		} else {
		bigpic = msnpics[index-1];
		}
	}
var newfile = mainpc.getAttribute("root") + bigpic + ".jpg";
mainpc.src = newfile;
var start_width = 164;	//	always
var start_top = parseInt(cell.style.top,10) + parseInt(this.style.top,10);
var start_left = parseInt(cell.style.left,10);
var target_top = 0;	//	nominal value here
var target_left = -25;	//	always here - see local.css
if (dims != "") {
	var xy = dims.split("x");
	target_width = xy[0]*1;
	var target_height = xy[1]*1;
	var start_height = 164 * target_height / target_width;
	} else {
	target_width = 500;
	var target_height = 375;
	var start_height = 123; 
	}
if (start_top + target_height < parseInt(cell.parentNode.style.height,10)) target_top = start_top + 10;
if (start_top + target_height > parseInt(cell.parentNode.style.height,10)) target_top = parseInt(cell.parentNode.style.height) - target_height + 10;
if (target_top < 1) target_top = 10;
inc_top = (target_top - start_top)/20;
inc_left = (target_left - start_left)/20;
inc_width = (target_width - start_width)/20;
inc_height = (target_height - start_height)/20;
mainpc.style.left   = start_left;
mainpc.style.top    = start_top;
mainpc.style.width  = start_width;
mainpc.style.height = start_height;
mainpc.style.display= "block";
shader.style.left   = start_left;
shader.style.top    = start_top;
shader.style.width  = start_width;
shader.style.height = start_height;
shader.style.display= "block";
shader_off = 0;

thumbn_enlarge();
}
//---------------------------------------------
function thumbn_enlarge() {
var mp_left   = parseInt(mainpc.style.left,10);
var mp_top    = parseInt(mainpc.style.top,10);
var mp_width  = parseInt(mainpc.style.width,10);
var mp_height = parseInt(mainpc.style.height,10);
//alert("left = " + (mp_left + inc_left) + "\ntop = " + (mp_top + inc_top) + "\nwidth = " + (mp_width + inc_width) + "\nheight = " + (mp_height + inc_height));

mainpc.style.left   = mp_left + inc_left;
mainpc.style.top    = mp_top + inc_top;
mainpc.style.width  = mp_width + inc_width;
mainpc.style.height = mp_height + inc_height;
shader.style.left   = mp_left + inc_left + shader_off;
shader.style.top    = mp_top + inc_top + shader_off;
shader.style.width  = mp_width + inc_width;
shader.style.height = mp_height + inc_height;
shader_off++;
if (mp_width + inc_width < target_width) {
	setTimeout(thumbn_enlarge,20);
	} else {
	capn.style.top = parseInt(mainpc.style.top,10)+10;
	capn.style.left = parseInt(mainpc.style.left,10)+10;
	if (capn.innerHTML !="") capn.style.display = "block";
	}
}
//---------------------------------------------
function thumbn_shut() {
this.style.display = "none";
this.previousSibling.style.display = "none";
this.previousSibling.previousSibling.style.display = "none";
}
//---------------------------------------------
function unbreak(txt) {
var t = txt.split("\n").join("<br>");
return t;
}
//---------------------------------------------
function thumbnday(dayid) {
var r = "the day";
for (var x=0;x<thumbn_days.length;x+=2) {
	if (thumbn_days[x] == dayid) r = thumbn_days[x+1];
	}
return r;
}











//========================================================
// moves the pixum gif to the low left of the main picture. Depends on correct sourceIndex order! Call goes in the MAIN image
//
// Example HTML code (DO NOT USE topRight() FUNCTION)
//
// <div style="position:relative">
// <img src="graphics/t_crossley119.jpg" width=500 height=350 alt="Buy a print" onLoad="loLeft(this);" usemap="#Map"><a name=x1></a>
// <div class=pixum><a href=http://www.pixum.co.uk/viewalbum/?id=1014066 target=_blank title="Buy a print of this photo"><img src=../home/graphics/pixum.gif border=0></a></div>
// </div>
// 
function loLeft(obj)	{
abslayer=0;
while (obj != document.all[abslayer]) {abslayer++};
abslayer += 2;
dist =  obj.height - 50;
document.all[abslayer].style.top = dist;
}
//========================================================
// INCLUDE: places a random gallery picture on the page
//
// PAGE MUST CONTAIN <script language="JavaScript" type="text/javascript" src="../gallery/piclist.js"></script>
//
function addgallerypic()	{
numpics = slide_db.length;
xp = numpics.rnd();
pix = slide_db[xp].split("|");
document.writeln("<a href=../gallery/photos_index.htm><img src=../" + pix[0] + "/graphics/" + pix[1] + ".jpg alt=\'From the " + pix[0] + "s gallery\' title=\'random photograph\' width=500></a>");
}

//========================================================














//========================================================
//
// P O P U P   F U N C T I O N S
//
//========================================================
// General pop-up opener. 'page' is the full file name
function WindowOpen(page,wi,hi)	{

newWindow=window.open(page, 'privwin', 'width=' + wi + ',height=' + hi +',left=100,top=20,menubar=no,toolbar=no,location=No,directories=no,scrollbars=yes,status=no,resizable=no');
}
//========================================================
// pop-up to send message about member
function tel(nam1)	{
newWindow=window.open("../forms/formtell.htm?" + nam1 ,"message",'width=480,height=420,left=165,top=150');
}
//========================================================
// pop-up to send message to member
function snd(nam1)	{
newWindow=window.open("../forms/formmess.htm?" + nam1 ,"message",'width=480,height=420,left=165,top=150');
}
//========================================================
// special pop-up routine for several specific pages
function popup(n)    {

caller = document.location.href;
caller=caller.substring(caller.lastIndexOf("/")+1,caller.length);
caller = escape(document.location.title);
if (n=="form") newWindow=window.open('../forms/form.htm?' + caller , 'formwin','width=470,height=420,left=165,top=150');
if (n=="news") newWindow=window.open('../forms/formsubscribe.htm' , 'formwin','width=470,height=600,left=165,top=150');
if (n=="que0") newWindow=window.open('../forms/questionnaire.htm' , 'formwin','width=470,height=600,left=165,top=150,scrollbars=yes');
if (n=="club") newWindow=window.open('../home/club.htm', 'club', 'width=350,height=480,left=165,top=150');
if (n=="keys") newWindow=window.open('../home/keys.htm', 'keys', 'width=350,height=480,left=165,top=150');
}
//========================================================
function bigend() {

newpop = window.open('bigend.htm','','width=500,height=600,scrollbars=yes');
}
//========================================================
function controlBox() {
alert("Control not yet constructed");
}
//========================================================

//Functions from Skype.com

var activex = ((navigator.userAgent.indexOf('Win')  != -1) && (navigator.userAgent.indexOf('MSIE') != -1) && (parseInt(navigator.appVersion) >= 4 ));
var CantDetect = ((navigator.userAgent.indexOf('Safari')  != -1) || (navigator.userAgent.indexOf('Opera')  != -1));

//--------------------------------------------------------
function oopsPopup() {
	var windowName = "oops";
	var URLtoOpen = "http://download.skype.com/share/skypebuttons/oops/oops.html";
	var popW = 540, popH = 305;
	var scrollB = 'no';
	w = screen.availWidth;
	h = screen.availHeight;
	var leftPos = (w-popW)/2, topPos = (h-popH)/2;
	oopswindow = window.open(URLtoOpen, windowName,'width=' + popW + ',height=' + popH + ',scrollbars=' + scrollB + ',screenx=' +leftPos +',screeny=' +topPos +',top=' +topPos +',left=' +leftPos);
	return false;
}

//--------------------------------------------------------
if(typeof(detected) == "undefined" && activex) {
    document.write(
        ['<script language="VBscript">',
        'Function isSkypeInstalled()',
        'on error resume next',
        'Set oSkype = CreateObject("Skype.Detection")',
        'isSkypeInstalled = IsObject(oSkype)',
        'Set oSkype = nothing',
        'End Function',
        '</script>'].join("\n")
    );
}

//--------------------------------------------------------
function skypeCheck() {
    if(CantDetect) {
        return true;
    } else if(!activex) {
        var skypeMime = navigator.mimeTypes["application/x-skype"];
        detected = true;
        if(typeof(skypeMime) == "object") {
            return true;
        } else {
            return oopsPopup();
        }
    } else {
        if(isSkypeInstalled()) {
            detected = true;
            return true;
        }
    }
    
    detected = true;
    return oopsPopup();
}

//--------------------------------------------------------

// Writes a table of ex-members on Skype: Skype_db is an array in data.js

function Skype_table() {

document.writeln("<table width=100% cellpadding=5 cellspacing=0 border=1 bordercolor=#ddeeff>");

document.writeln("<tr><td>Ex-member</td>");
document.writeln("<td tooltip=\'click an entry to make a Skype call to the person\'>Skype ID</td>");
document.writeln("<td class=tiny style=width:30px; tooltip=\'click a button to add this person to your Skype Contacts\'>Add to<br>Skype</span></td>");
document.writeln("<td>Local time</td>");
document.writeln("<td>Location</td></tr>");

for (var x=1;x<Skype_db.length;x++) {

	Skype_rec = Skype_db[x].split("|");

	document.writeln("<tr><td>" + Skype_rec[0] + "</td>");
	document.writeln("<td><a href=\'skype://" + Skype_rec[1] + "?call\' title=\'Click to Call\' style=text-decoration:none;>" + Skype_rec[1] + "</a></td>");
	document.writeln("<td style=text-align:center><a href=\'skype:" + Skype_rec[1] + "?add\' onclick=\'return skypeCheck();\'><img src=\'../home/graphics/skype_but.gif\' alt=\'Add to Skype Contacts\' /></a></td>");
	document.writeln("<td>" + Skype_rec[2] + "</td>");
	document.writeln("<td>" + Skype_rec[3] + "</td></tr>");
	}

document.writeln("</table>");

}

//========================================================
// puts a short recent message in a bubble where called

function BenBubble(LocalMessage) {
TitleMessage = "Important Notice";
specialbubble = "";
if (arguments.length>1) TitleMessage = arguments[1];

var rltop = 0;
var mini = "-1000px";
var maxi = "0px";
if (arguments.length>2) {
	mini = "20px";
	maxi = "-1000px";
	}
if (document.all) rltop = 20;

LatestMessage = "<div style=width:270px;>" + LocalMessage + "</div>"; 
if (LatestMessage.length>30) {
	document.write("<div class=minirel style=top:" + rltop + "px;>");
	document.write("<img src=../home/gifs/minimax.gif title=\"Click to see " + TitleMessage + "\" style=position:absolute;left:" + mini + ";top:-35px; onclick=BlowBubble(this) />");
	document.write("<div class=minibub style=position:absolute;left:" + maxi + ">");
	document.writeln(LatestMessage);
	document.writeln("<img class=minitop src=../home/gifs/bubbletop.gif />");
	document.writeln("<img class=minibot src=../home/gifs/bubblebot.gif />");
	document.writeln("<p class=bubt1 style=top:-28px>" + TitleMessage + "</p>");
	document.writeln("<p class=bubt2 style=top:-29px>" + TitleMessage + "</p>");
	document.writeln("<p class=bubc1 style=top:-25px;left:285px;>&times;</p>");
	document.writeln("<p class=bubc2 style=top:-26px;left:284px; onClick=SuckBubble(this) onMouseover=\"this.style.color=\'#30359F\'\" onMouseout=\"this.style.color=\'#98A5DF\'\" title=close>&times;</p>");
	document.writeln("</div>");
	document.writeln("</div>");
	}
}

//--------------------------------------------------------
function BlowBubble(obj) {
var topele = obj.parentNode;
topele.childNodes[1].style.left = '0px';
topele.childNodes[0].style.left = '-1000px';
}
//--------------------------------------------------------
function SuckBubble(obj) {
var topele = obj.parentNode.parentNode;
topele.childNodes[1].style.left = '-1000px';
topele.childNodes[0].style.left = '20px';
}


























/*********************************************
*
*       S T A R   R A T I N G   S Y S T E M
*       puts a star rating box on pages
*       populates star rating box, phrases and title tool tips 
*       in hyperlinks to reted pages.
*       Star Rate Data taken from Contacts.xls 
*
*********************************************/
// arrays of remarks and random phrases used in the star rating box
var umph = ["Oh dear!","We must try harder","Try another page.","Thank you.","Many thanks.","Wow, you like us!"];
var tagl = ["Help us shine","Follow a star","Ad ardua per astra","Express starlight","Tell us the worst","Your opinion is valued","Click and tell","Click our backside","Merry Click Mouse","Startle us"];

//--------------------------------------------------------
// This writes the star rating box

function star() {

tagline = tagl[tagl.length.rnd()];
document.write('<div class=noprint style="align:center;">');
document.write('<img src=../home/graphics/blank.gif style="height:80px;width:100%;">');
document.write('<a name=starrate></a>');
document.write('<center>');
document.write('<span style="font-size:12px" title="Honesty">Please rate this page</span><br>');
document.write('<input type=button value="Clear" onclick=unstella(); style="width:40px;height:20px;font-size:10px;">');
document.write('<img id=star1 src=../home/graphics/staroff.gif onclick=stellate(this) width=16 height=16 title="Barely adequate. Must do better">');
document.write('<img id=star2 src=../home/graphics/staroff.gif onclick=stellate(this) width=16 height=16 title="Reasonable appearance or content">');
document.write('<img id=star3 src=../home/graphics/staroff.gif onclick=stellate(this) width=16 height=16 title="Amusing but only a bit above average">');
document.write('<img id=star4 src=../home/graphics/staroff.gif onclick=stellate(this) width=16 height=16 title="Interesting, entertaining, well presented">');
document.write('<img id=star5 src=../home/graphics/staroff.gif onclick=stellate(this) width=16 height=16 title="Brilliant. I shall tell my friends and return">');
document.write('<input type=button value="Send" onclick=popstar(); style="width:40px;height:20px;font-size:10px;">');
document.write('<br>');
document.write('<span id=startext style=font-size:10px;>' + tagline + '</span>');
document.write('</div>');
document.write('</center>');

// populates the newly written Star Rating Box with stars if the page is included in the measure(page) routine.
//upto = getstars();
//upto = menu_stars;

if (upto>0) {
	for (var x=1;x<=upto;x++)	{
		imag = eval("document.images.star" + x);
		imag.src = "../home/graphics/staron.gif";
		}
	document.getElementById("startext").innerHTML = imag.title;
	}
starLinks();

}//populated


//--------------------------------------------------------
function starLinks() {
// add asterisk stars to the title of any link to a rated page. Does not replace image alt. NB GOES HERE SO LINKS ARE ALREADY WRITTEN
// look for the quasi-attribute 'stars' and converts content to small graphic stars. No action if no stars.

linkarray = document.getElementsByTagName("A");
for (var x=0;x<linkarray.length;x++)	{
	starobj = linkarray[x];
	if (starobj.getAttribute("stars"))	{
		starpage = starobj.getAttribute("stars");
		starobj.innerHTML = juststars(starpage);
		}
	}
}//starred

// NB Asterisks are added to links as part of the ShowRecentPageGIFS routine in db functions
//--------------------------------------------------------
// returns the number of stars for the CURRENT FILE

function getstars() {

namea = document.location.href.lastIndexOf("/")+1;
nameb = document.location.href.lastIndexOf(".");
namec = document.location.href.substring(namea,nameb);
return measure(namec);
}
//--------------------------------------------------------
// put stars in the rating box in response to click on star.

function stellate(obj)	{

unstella();
upto=obj.id.substr(4,1);
for (var x=1;x<=upto;x++)	{
	imag = eval("document.images.star" + x);
	imag.src = "../home/graphics/staron.gif";
	}
document.getElementById("startext").innerHTML = imag.title;//adds appropriate tagline based on star title
}
//--------------------------------------------------------
// removes stars from the rating box

function unstella()	{

upto = 0;
document.images.star1.src = "../home/graphics/staroff.gif";
document.images.star2.src = "../home/graphics/staroff.gif";
document.images.star3.src = "../home/graphics/staroff.gif";
document.images.star4.src = "../home/graphics/staroff.gif";
document.images.star5.src = "../home/graphics/staroff.gif";
document.getElementById("startext").innerHTML = "What, no stars?";
}
//--------------------------------------------------------
// passes the star rating and page reference to the form. Called by the star rating send button

function popstar()    {

caller = upto + endname;
newWindow=window.open('../forms/formstar.htm?' + caller , 'formwin','width=470,height=420,left=165,top=150');
//write a message in the star box
comment = "Sending " + upto + " stars. " + umph[upto];
document.getElementById("startext").innerHTML = comment;
}
//--------------------------------------------------------
// Returns HTML code of the number of star images or default if no stars. 'name' is the file name excluding '.htm'

function juststars(name)	{

upto = measure(name);
codeline = "";
if (upto>0) {
	codeline = "<span class=help title=\'" + upto + " star rating for this page\'>";
	for (var y=0;y<upto;y++) codeline+="<img src=../home/graphics/starsmall.gif height=12 width=12>";
	codeline += "</span>";
	}
return codeline;
}
//--------------------------------------------------------
// Returns n " *" for use un title tooltips 

function astarise(n)	{
asterisks = "";
if (n>0) {
	for (var y=0;y<n;y++) asterisks+=" *";
	}
return asterisks;
}
//--------------------------------------------------------
// upto is a GLOBAL variable: This is measured from the filename

function measure(page) {
upto = 0;

for (var z = 1; z < menu_db.length-2; z++) {
	var menu = menu_db[z].split("|");
	if (menu[2].split("/")[1].split(".")[0] == page) {

		upto = 0;
		allstars = [];
		if (menu[5] != "") allstars = menu[5].split(",");

		z++;

		while (1*menu_db[z].split("|")[0] > menu[0]) {
			var m = menu_db[z].split("|");
			if (m[5] !="") allstars.push(m[5].split(",").average());
			z++;
			}
		if (allstars.length > 0 ) upto = Math.round(allstars.average());
		z = menu_db.length;
		}
	}
//if (page == uniname) alert(allstars);
return upto;
}

//--------------------------------------------------------
// upto is a GLOBAL variable: This is created from the menu line NUMBER

function Measure(menulinenum) {
upto = 0;
var menu = menu_db[menulinenum].split("|");
var allstars = "";
if (menu[5] != "") allstars = menu[5] + ",";
menulinenum++;

while (1*menu_db[menulinenum].split("|")[0] > menu[0]) {
	if (menu_db[menulinenum].split("|")[5] !="") allstars += menu_db[menulinenum].split("|")[5] + ",";
	menulinenum++;
	}
if (allstars != "") {
	var starry = allstars.split(",");
	starry.pop();
	upto = Math.round(starry.average());
	}
return upto;
}

//========================================================
function average(commalist) {	// added 18 Mar 2009
var n = 0;
if (commalist != undefined){
	var s = commalist.split(",");
	for (var w = 0; w < s.length; w++) n += 1*s[w];
	n = Math.round(n/s.length);
	}
return n;
}





































































































//========================================================
//
//    C O M M O N   S U B R O U T I N E S 
//
//========================================================
// returns the date from the UK convention date dd/mm/yyyy: 17 Apr 2008 zeros are wildcards: 7 May 2008 corrected: 8 May 2008 now a prototype getUKdate()
function UKdate$(UKdate)	{
alert("Please email Ben and say UKdate function is on this page");
var n = UKdate.split("/");
var d = n[0]*1;
var m = n[1]*1-1;
var y = n[2]*1;

if (n[0]*1 == 0) d = tday.getDate();
if (n[1]*1 == 0) m = tday.getMonth();
if (n[2]*1 == 0) y = tday.getFullYear();
var nd = new Date(y,m,d);
if (n[1]*1 == 0 && nd.getTime() < caldate.getTime()) {
	m++;
	if (m == 12) {
		m = 0;
		y++;
		}
	nd = new Date(y,m,d);
	}
if (n[2]*1 == 0 && nd.getTime() < caldate.getTime()) {
	y++;
	nd = new Date(y,m,d);
	}
return nd;
}
//========================================================
// precedes a digit with zs zeros
function prezero(dstring,zs) {
var wstring = "A000000" + dstring;
var nstring = wstring.slice(-zs);
return nstring;
}
//========================================================
// disguise you know what
function address(obj) {
obj.href = "znvygb:Ora<ora@ubafrp.pb.hx>?Fhowrpg=Sebz YCZPP.arg".rot13();
return true;
}
//========================================================
function setCookie(myname, myvalue) {

	var mycookie = myname + "=" + escape(myvalue);
	mycookie = mycookie + ";expires=" + expire_date.toGMTString() + ";path=/";
	document.cookie = mycookie;

} //End of setCookie function
//========================================================
function varCookie() {
// cookies are separated by semicolons
msg = "Cookies\n\n";
var bcookie = document.cookie;
if (bcookie) {
	var acookie = bcookie.split(";");
	for (var i=0; i < acookie.length; i++)  {
		// a name/value pair (a crumb) is separated by an equal sign
		var aCrumb = acookie[i].split("=");
		// by NOT including 'var ' in this evaluation the result is GLOBAL variables
		eval(aCrumb[0] + "='" + aCrumb[1] + "'");
		var cwrite = "";
		if (aCrumb[0].trim().substring(1) == "Cookie") {
			var cdate = new Date(parseInt(aCrumb[1].substring(1)));
			cwrite = cdate.getDate() + " " + monName[cdate.getMonth()] + " " + cdate.getFullYear();
			}
		msg += aCrumb[0].trim() + " = " + unescape(eval(aCrumb[0])) + " (" + cwrite + ")\n";
	 	}
	}
} //End of varCookie function

function isitglobal() {
alert(msg);
}

//========================================================
function getCookie(myname) {
var cc = "";
// cookies are separated by semicolons
var acookie = document.cookie.split(";");
for (var i=0; i < acookie.length; i++)  {
	// a name/value pair (a crumb) is separated by an equal sign
	var aCrumb = acookie[i].split("=");
	if (myname == aCrumb[0].trim()) cc = unescape(aCrumb[1]);
	}
return cc;
} //End of getCookie function

//========================================================
function deleteCookie(myname) {

if (getCookie(myname)) {
// Make sure it deletes Local and pan-section cookies.
	document.cookie = myname + "= ; expires=0;path=/";
	document.cookie = myname + "= ; expires=0";
	}

} //End of deleteCookie function
//========================================================
//  8 May 2008 now a prototype rot13()
function Rot13(pstring)	{
alert("Please contact Ben and say Rot13 is in this page");
for (var x = 0; x < pstring.length; x++)	{
	n = pstring.charCodeAt(x);
	if (((n>64) && (n<78)) || ((n>96 ) && (n<110))) {
		pstring=pstring.substring(0,x) + String.fromCharCode(n+13) + pstring.substring(x+1, pstring.length);
	}
	if (((n>77) && (n<91)) || ((n>109) && (n<123))) {
		pstring=pstring.substring(0,x) + String.fromCharCode(n-13) + pstring.substring(x+1, pstring.length);
	}
}
return pstring;
} //End of Rot13 function
//========================================================
// returns integer from 0 to num - 1
function rnd(num) {
return Math.floor(Math.random() * num);
}
//========================================================
function pause() {document.getElementById("fromHTML").innerHTML += " .";}
//========================================================
// Show items BEFORE or AFTER or ONLY on a date. Looks for title attribute with one word and UKdate. Call ONLOAD

function showTimer() {	//accepts zeros as wildcards
docDiv = getElementsByClassName(document,"*","box");
for (var x = 0;x<docDiv.length;x++) {
	doaction = docDiv[x].title.split(" "); 
	dateaction = doaction[1].getUKdate();
	if (doaction[0] == "before" || doaction[0] == "until" ) {
		if (caldate.getTime() < dateaction.getTime()) {
			docDiv[x].style.display = "block";
			} else {
			docDiv[x].style.display = "none";
			}
		}
	if (doaction[0] == "after") {
		if (caldate.getTime() > dateaction.getTime()) {
			docDiv[x].style.display = "block";
			} else {
			docDiv[x].style.display = "none";
			}
		}
	if (doaction[0] == "only") {
		if (caldate.getTime() - dateaction.getTime() == 0) {
			docDiv[x].style.display = "block";
			} else {
			docDiv[x].style.display = "none";
			}
		}
	}
}
//========================================================
function scrolltitle() {
document.title=document.title.substring(1,document.title.length) + document.title.charAt(0);
}
//========================================================
// remove duplicates from array

function uniqueArray(arrayName) {
arrayName.sort();
while(arrayName[0] == "") arrayName.shift();
yz = arrayName.length-1;
for (var x=yz;x>0;x--) if (arrayName[x-1]==arrayName[x]) arrayName.splice(x,1);

return arrayName;
}
//========================================================
// This funky function turns an array sort from string order to numeric order! 
// arrayname.sort(numeric); just like that!

function numeric(a,b) {
return a-b;
}
//========================================================

//========================================================
// This workround function turns the inner text of an object! 

function innerTEXT(obj) {
var st = "";
if (document.all) {
	st = obj.innerText;
	} else {
	st = obj.textContent;
	}
return st;
}
//========================================================








//========================================================
//
// D A T A B A S E   I N C L U D E S 
//
// Routines that use data arrays to insert HTML code and features into all pages
//
// show the latest files in a panel - newcontent()	uses newstuff_db[] array
// put gifs into links to new pages - ShowNewPageGIFs()	uses newstuff_db[] array
// put tooltips on all member names - insertNameTips()	uses members_db[] array
//
//========================================================
var firstname;
var lastname;
var nickname;
var filename;
var contact;
var start;
var end;
var qty;
var comments;
var britdate;
var newfile;
var showgif;
var newwords;
var meetdate;
var osrefe;
var osrefn;
var mplace;
var mcomment;
var starfile;
var starrate;

/*
function fieldsFromStar(rec) {
latestrecord = star_db[rec].split("|");
starfile = latestrecord[0];
starrate = latestrecord[1];
}
*/
function fieldsFromReunions(rec) {
latestrecord = reunions_db[rec].split("|");
meetdate = latestrecord[0];
osrefe   = latestrecord[1];// latitude!
osrefn   = latestrecord[2];//longitude!
mplace   = latestrecord[3];
mcomment = latestrecord[4];
mlink    = latestrecord[5];//new field Jun 2006
}

function fieldsFromNewStuff(rec) {
latestrecord = newstuff_db[rec].split("|");
britdate = latestrecord[0];
newfile  = latestrecord[1];
showgif  = latestrecord[2];
newwords = latestrecord[3];
}

function fieldsFromRecord(rec) {
onerec = members_db[rec].split("|");
firstname = onerec[0];
lastname = onerec[1];
nickname = onerec[2];
filename = onerec[3];
contact = onerec[4];
start = onerec[5];
end = onerec[6];
qty = onerec[7];
comments = onerec[8];
profile = onerec[9];
}

function NewsUpdate(){

NewsFeed(news_reunion,"Reunions");
NewsFeed(news_contact,"We have Heard From ...");
NewsFeed(news_newstuf,"New on the Site");
NewsFeed(news_service,"Public Service Announcement");
}

function NewsFeed(newsarray,newstitle) {
if (newsarray[1] != "") {
	document.writeln("<H3>" + newstitle + "</H3>");
	for (var x=1;x<newsarray.length-1;x++) {
		document.writeln("<p>" + newsarray[x] + "</p>");
		}
	document.writeln("<HR class=main>");
	}
}

function getnextdelay() { 
totalDocHeight = 1.8*(document.getElementById("startext").offsetTop + 1250);
setTimeout(scrollPause,2000);
setTimeout(getnextfile,totalDocHeight);
}

function scrollPause() {
setInterval("scrollBy(0,20)",5);
}

//============================== Fri, 08 Sep 2006 14:11:55 ====================

function getnextfile() {

for (var x=1;x<menu_db.length-1;x++) {
	n=1;
	sub = menu_db[x].split("|");
	fil = sub[2].split("/");
	if (endname.toLowerCase() == fil[1]) {
		sub = menu_db[x+1].split("|");
		fil = sub[2].split("/");
		if (fil[1] == "home_map.htm" || fil[1] == "news_foz05.htm" || fil[1] == "photos_slide.htm") {
			sub = menu_db[x+2].split("|");
			}
		if (fil[1] == "news_foz04.htm") {
			sub = menu_db[x+3].split("|");
			}
		fil = sub[2].split("/");
		window.status = fil[1];
		document.location.href = "../" + sub[2];
		x = menu_db.length;
		}
	}
}


//===============================================
//
// M A I N   M E N U   S Y S T E M               uses home/menu.js
//
//===============================================

var oldMenuLine1 = new Object();
oldMenuLine1.style = "";
oldMenuLine1.style.backgroundColor = "#cdf";
oldMenuLine1.style.color = "navy";
var oldMenuLine2 = new Object();
oldMenuLine2.style = "";
oldMenuLine2.style.backgroundColor = "#cdf";
oldMenuLine2.style.color = "navy";
var oldMenuLine3 = new Object();
oldMenuLine3.style = "";
oldMenuLine3.style.backgroundColor = "#cdf";
oldMenuLine3.style.color = "navy";
var tri = "<img src=../home/graphics/tri.gif style=float:right;margin-top:2px;>";

//===============================================
function contextMenu() {
document.writeln('<a href=../home/home_map.htm title=\'Site Map\' class=menutitle onmouseover=\"menudelay();\">Sections</a>');

document.writeln('<div class=menudiv id=menu1div style=z-index:1; title=\"main sections\">');

for (var x = 1;x < menu_db.length-2; x++) {
	var sub = menu_db[x].split("|");
	if (sub[0] == 1) {
		document.writeln('<a class=level1 href=../' + sub[2] + ' title=\"' + HTML2JS(sub[3]) + moreInfo(sub) + '\" onMouseover=\"menu2show(this);return true;\" onMouseout=\"window.status=\'\';return true;\">' + tri + sub[1] + '</a>');
		}
// also COUNT menu items during this function!
	if (sub[9] != "") {
		picturecount+=1*sub[9];
		albumcount++;
		}
// also get data for THIS page
	if (sub[2] == menubit) {
		getDataFromMenu(sub);
		upto = Measure(x); // gets the average stars for sub pages
		}
	}

document.writeln('<div class=menudiv id=menu2div style=position:absolute;left:90px;display:none; title=\"main pages\" onMouseover=\"canceldelay();\" onMouseout=\"menudelay();\">');
document.writeln('</div>');
document.writeln('<div class=menudiv id=menu3div style=position:absolute;left:180px;display:none; title=\"sub pages\" onMouseover=\"canceldelay();\" onMouseout=\"menudelay();\">');
document.writeln('</div>');
document.writeln('<div class=menudiv id=menu4div style=position:absolute;left:270px;display:none; title=\"sub pages\" onMouseover=\"canceldelay();\" onMouseout=\"menudelay();\">');
document.writeln('</div>');

menu2off=setTimeout("menuHide('2')",1);
menu3off=setTimeout("menuHide('3')",1);
menu4off=setTimeout("menuHide('4')",1);
document.writeln('</div>');

// ------------------------------- RECENT NEW PAGES

var recent = "New";
var lookback = prevvisit; // normal default

var earlynew = newstuff_db[newstuff_db.length-1].split("|")[0].getUKdate().getTime();

if (tnow - parseInt(aCookie.substring(1)) < day || tnow - prevvisit < day || prevvisit < earlynew) {
	lookback = lastweek;
	recent = "Recent";
	}
var ln = 0;
while (ln == 0) {
	for (var x=0; x< newstuff_db.length; x++) {
		sub = newstuff_db[x].split("|");
		if (sub[0].getUKdate().getTime() > lookback && sub[1].indexOf("_index.htm") == -1) {
			ln++;
			}
		}
	if (ln == 0) {
		lookback -= day*7;
		recent = "Recent";
		}
	}
var dat = new Date(lookback);

var wen = dayName[dat.getDay()] + " " + dat.getDate() + " " + monName[dat.getMonth()];

document.writeln("<br style=line-height:14px;><a class=menutitle href=../home/home_recent.htm tooltip=\'Click for a list of all pages new in the last 2 months<br><br>The menu below indicates new content since " + wen + ".\'>" + recent + "</a>");

document.writeln('<div class=menudiv id=menewdiv title=Latest>');

existingLinks = document.getElementById("menu1div").getElementsByTagName("A");

for (var x=0; x< newstuff_db.length; x++) {
	sub = newstuff_db[x].split("|");
	if (sub[0].getUKdate().getTime() > lookback) {
		duplicate = false;
		newLink = sub[1].substring(sub[1].lastIndexOf("/")+1);
		for (var y = 0; y < existingLinks.length; y++) {
			existingHREF = existingLinks[y].href;
			existingHREF = existingHREF.substring(existingHREF.lastIndexOf("/")+1);
			if (existingHREF == newLink) duplicate = true; 
			}
		if (!duplicate)	{
			if (sub[2] == "1") ins = "New page";
			if (sub[2] == "2") ins = "New content";
			if (sub[2] == "3") ins = "Star rated";
			if (sub[2] == "4") ins = "Problem fixed";
			document.writeln("<a href=../" + sub[1] + " class=level1 title=\'" + ins + "\' onMouseover=\'shutAll();window.status=\"" + sub[4] + "\";return true;\' onMouseout=\'window.status=\"\";return true;\'>" + sub[4] + "&nbsp;&nbsp;</a>");
			}
		}
	}
document.writeln('</div>');// close menewdiv
}

// ===============================
function mcite(who) {
cite = "";
if (who != "") cite = ". \nBy " + who;
return cite;
}
// ===============================
function canceldelay() {
clearTimeout(menu2off);
clearTimeout(menu3off);
clearTimeout(menu4off);
}
// ===============================
function menudelay() {
menu2off=setTimeout(function(){menuHide(2)},500);
}
// ===============================
function menuHide(num) {
eval ("oldMenuLine" + (num-1) + ".style.backgroundColor = '#cdf'");
eval ("oldMenuLine" + (num-1) + ".style.color = 'navy'");
for (var x=num;x<5;x++){
	var menu = document.getElementById("menu" + x + "div");
	menu.style.display = "none";
	while (menu.childNodes.length > 0) menu.removeChild(menu.lastChild);
	}
menu.style.display = "none";
}
// ===============================
function shutAll() {
for (var x = 2;x < 5; x++) menuHide(x);
}
// ===============================
function menu2show(ob) {
clearTimeout(menu2off);
menu2off = setTimeout(function(){pause2show(ob)},500);
}
function pause2show(obj){
menu2 = document.getElementById("menu2div");
window.status = HTML2JS(obj.title);
oldMenuLine1.style.backgroundColor = "#cdf";
oldMenuLine1.style.color = "navy";
oldMenuLine1 = obj;
switch2 = false;
shutAll();
menu2content = "";

for (var x=1; x < menu_db.length; x++) {
	sub = menu_db[x].split("|");
	
	if (switch2 && sub[0] < 2) { //stop at next section
		switch2 = false;
		menu2.style.display = "block";
		x = menu_db.length;
		}

	if (sub[0] == 1 && obj.href.indexOf(sub[2]) > 0) { //find the current link - start of the section
		switch2 = true;
		menu2.style.top = obj.offsetTop;
		obj.style.backgroundColor = "navy";
		obj.style.color = "white";
		}
	if (switch2 && sub[0] == 2) { //show all level 2 links until end of section

		var menu2a = document.createElement("A");
		menu2a.className = "level1";
		menu2a.href = "../" + sub[2];
		menu2a.title = HTML2JS(sub[3]) + moreInfo(sub);

		dub = menu_db[x+1].split("|")[0]; // to check for level 3 items
		if (dub > 2) {
			menu2a.onmouseover = menu3show;
			menu2a.innerHTML = tri + sub[1];
			} else {
			menu2a.onmouseover = function(){menuHide(3)};
			menu2a.innerHTML = sub[1];
			}
		menu2.appendChild(menu2a);
		}
	}
menu2.style.display = "block";
linkArray = menu2.getElementsByTagName("A");
for (var x=0;x<linkArray.length;x++) {
	pageLink = linkArray[x];
	wiseUp(pageLink);
	}
}
// ===============================
function menu3show() {

menu3 = document.getElementById("menu3div");
menuHide(3);
oldMenuLine2.style.backgroundColor = "#cdf";
oldMenuLine2.style.color = "navy";
oldMenuLine2 = this;
switch3 = false;

rly = [];
own = [];
for (var x=1; x < menu_db.length; x++) {
	sub = menu_db[x].split("|");
	
	if (switch3 && sub[0] < 3) { // stop at higher menu level
		switch3 = false;
		menu3.style.display = "block";
		mst = this.offsetTop + menu2.offsetTop + 16 - menu3.offsetHeight;
		if (mst < -72 ) mst = -72;
		menu3.style.top = mst; // shows menu upwards or at top of page
		x = menu_db.length;
		}

	if (sub[0] == 2 && this.href.indexOf(sub[2]) > 0) { // find the current link - start of the section
		switch3 = true;
		this.style.backgroundColor = "navy";
		this.style.color = "white";
		}
	if (switch3 && sub[0] == 3) {
// . . . . . . . . . 
		try {
			rly.length = 0;
			own.length = 0;
			bcount = 0;
			t = sub[2].indexOf("rally_badges");
			if (t > 0) {
				letr = sub[2].substr(t+12,1).toUpperCase();
				for (var b = 0;b<badge_db.length;b++) {
					if (badge_db[b].charAt(0) == letr) {
						baj = badge_db[b].split("|");
						own[bcount] = baj[6];
						rly[bcount] = baj[0];
						bcount++;
						}
					}
				rly = uniqueArray(rly);
				own = uniqueArray(own);
				sub[3] = rly[0] + " to " + rly[rly.length-1] + ", " + textNum(bcount) + " badges from " + textNum(rly.length) + " rallies provided by " + own.join(", ");
				}
			}
		catch (emsg){ window.status = "No badge data\n" + emsg; }
// . . . . . . . . . 
		var menu3a = document.createElement("A");
		menu3a.className = "level1";
		menu3a.href = "../" + sub[2];
		menu3a.title = HTML2JS(sub[3]) + moreInfo(sub);

		dub = menu_db[x+1].split("|")[0]; // to check for level 3 items
		if (dub > 3) {
			menu3a.onmouseover = menu4show;
			menu3a.innerHTML = tri + sub[1];
			} else {
			menu3a.onmouseover = function(){menuHide(4)};
			menu3a.innerHTML = sub[1];
			}
		menu3.appendChild(menu3a);
		}
	}
menu3.style.display = "block";
linkArray = menu3.getElementsByTagName("A");
for (var x=0;x<linkArray.length;x++) {
	pageLink = linkArray[x];
	wiseUp(pageLink);
	}
}
// ===============================
function menu4show() {
ob = this;
setTimeout(function(){pause4show(ob)},500);
}
function pause4show(obj){
var menu2 = document.getElementById("menu2div");
var menu3 = document.getElementById("menu3div");
var menu4 = document.getElementById("menu4div");
menuHide(4);
oldMenuLine3.style.backgroundColor = "#cdf";
oldMenuLine3.style.color = "navy";
oldMenuLine3 = obj;
switch4 = false;
menu4content = "";

for (var x=1; x < menu_db.length; x++) {
	sub = menu_db[x].split("|");
	
	if (switch4 && sub[0] < 4) { //stop at higher menu level
		switch4 = false;
		menu4.style.top = obj.offsetTop + menu3.offsetTop;
		menu4.style.display = "block";
		x = menu_db.length;
		}

	if (sub[0] < 4 && obj.href.indexOf(sub[2]) > 0) { // find the current link - start of the section
		switch4 = true;
		obj.style.backgroundColor = "navy";
		obj.style.color = "white";
		}
	if (switch4 && sub[0] == 4) {

		var menu4a = document.createElement("A");
		menu4a.className = "level1";
		menu4a.href = "../" + sub[2];
		menu4a.title = HTML2JS(sub[3]) + moreInfo(sub);
		menu4a.innerHTML = sub[1];
		menu4.appendChild(menu4a);
		}
	}
menu4.style.display = "block";
linkArray = menu4.getElementsByTagName("A");
for (var x=0;x<linkArray.length;x++) {
	pageLink = linkArray[x];
	wiseUp(pageLink);
	}
}
// ------------------------------- SUB ROUTINE
function togSubMenu() {
subMenu = document.getElementById("submenucontent");
if (subMenu.style.display == "none") {
	subMenu.style.display = "block";
	} else {
	subMenu.style.display = "none";
	}
}

// ------------------------------- SUB ROUTINE
function HTML2JS(htm) {
var temp = htm.split("<br>");htm = temp.join(" - ");
temp = htm.split("&nbsp;");htm = temp.join(" ");
temp = htm.split("&#39;");htm = temp.join("");
temp = htm.split("&quot;");htm = temp.join("");
temp = htm.split("&amp;");htm = temp.join("&");
htm = htm.replace(/<\/?[^>]+>/gi,''); //reg exp to remove ALL other tags
return htm;
}
//-------------------------------- SUB ROUTINE
function getDataFromMenu(marray) {
menu_update = marray[7].getUKdate();
menu_locata = marray[8];

var a = marray[14].split(",");
var s = marray[4].split(" ").join("&nbsp;");
var t = s.split(",");
altnames = (marray[4] + "," + marray[14]).split(",");	// THIS IS WHERE altnames first becomes an ARRAY
altnames.sort();
while(altnames[0] == "") altnames.shift();
if (t.length == 1) menu_author = t[0];
if (marray[4] == "") menu_author = "Ben&nbsp;Crossley";
if (t.length == 2) menu_author = t[0] + " and " + t[1];
if (t.length > 2) {
	menu_author = " and " + t.pop();
	menu_author = t.join(", ") + menu_author;
	}
}
//-------------------------------- SUB ROUTINE
function moreInfo(ary){
var extras = "";
if (ary[4] !="") extras += " \nby " + ary[4].split(",").join(", ");
if (ary[5] !="") extras += " \n" + average(ary[5]) + " Stars";
return extras;
}
//===============================================
function nextlink()	{
findFile = incquery;
sec = findFile.split("/");
soc = findFile.split("#");
if (sec[0] == "home") findFile = soc[0];
sic = findFile.split("?");
if (sec[0] == "rallies") findFile = sic[0];

nextnum = 0; 
for (var x=1;x<menu_db.length;x++)	{
	sub = menu_db[x].split("|");
	ths = sub[2].split("/");
	if (sub[2].indexOf(findFile)>-1) {nextnum = x + 1;x = menu_db.length};
	}
sub = menu_db[nextnum].split("|");
fil = sub[2].split("/");

if (fil[0] != ths[0]) {
	for (var x=1;x<menu_db.length;x++)	{
		sub = menu_db[x].split("|");
		fil = sub[2].split("/");
		if (fil[0] == ths[0]) {nextnum = x + 1;x = menu_db.length};
		}
	}
nextp = fil[1];
document.writeln('<a id=IDnext class=botmen title=\"next page is ' + HTML2JS(sub[1]) + ' &#10;(keyboard &quot;Alt+&gt;&quot;)\" href=' + fil[1] + '>[&gt;]</a>');
}
// ----------------------------------------------
function backlink()	{
nextnum = 0; 
findFile = incquery;
sec = findFile.split("/");
soc = findFile.split("#");
if (sec[0] == "home") findFile = soc[0];
sic = findFile.split("?");
if (sec[0] == "rallies") findFile = sic[0];

for (var x=menu_db.length-1;x>1;x--)	{
	sub = menu_db[x].split("|");
	ths = sub[2].split("/");
	if (sub[2].indexOf(findFile)>-1) {nextnum = x - 1;x = 0};
	}
sub = menu_db[nextnum].split("|");
fil = sub[2].split("/");

if (fil[0] != ths[0]) {
	for (var x=menu_db.length-1;x>1;x--)	{
		sub = menu_db[x].split("|");
		fil = sub[2].split("/");
		if (fil[0] == ths[0]) {nextnum = x - 1;x = 0};
		}
	}
backp = fil[1];
document.writeln('<a id=IDprev class=botmen title=\"previous page is ' + HTML2JS(sub[1]) + ' &#10;(keyboard &quot;Alt+&lt;&quot;)\" href=' + fil[1] + '>[&lt;]</a>');
}
// =================================================
// Print Preview by swapping CSS files
var savepad = 0;
function printPreview() {
var css = document.getElementsByTagName("LINK");
for (var x=0;x<css.length;x++) {
	if (css[x].media == "print") {
		css[x].media = "screen";
		cs = css[x];
		}
	}
savepad = document.getElementById("IDcontent").style.paddingLeft;
document.getElementById("IDcontent").style.paddingLeft = "0px";
dum = setTimeout('revert(cs)',5000);
}
//--------------------------------------------------
function revert(lnk) {
lnk.media = "print";
document.getElementById("IDcontent").style.paddingLeft = savepad;
}

// =================================================

//    currentTest()

// called using the pop up menu via Alt+V

function currentTest() {
//alert("Aha! So you ARE a geek!");
alert("document.referrer = " + document.referrer);
//document.location = "../home/section_inspection.htm";
}

// =================================================
function randomPage() {// avoid first 5 and last 14 pages
var n = (menu_db.length-20).rnd()+6;
var s = menu_db[n].split("|");
return s;
}

// =================================================
// added 17 Mar 2009
// counts are done when menu is created 

// thumbs_db = []; is defined globaly in local pages that need it
// Maybe these functions are more appropriate in individual pages

function make_thumbs_db(folder) {
if (!folder) folder = ".+"; // any non zero text!
var tRegExp = new RegExp(folder);
for (var x=1;x<menu_db.length-1;x++){
	var menu = menu_db[x].split("|");
	if (tRegExp.test(menu[2].split("/")[0]) && menu[10] != "") thumbs_db.push(menu_db[x]);
	}
}
// =================================================
// added from Rally standard.js 02 Jan 2010
function random_quote() {
//needs pullquote IDquote and several spans with class=pq

var qu = document.getElementsByTagName("SPAN");
var qv = [];
for (var x=0;x<qu.length;x++) {if (qu[x].className == "pq") {qv.push(qu[x])}};
var q = qv[qv.length.rnd()].innerHTML;
q = q.substr(0,1).toUpperCase() + q.substr(1);
document.getElementById("IDquote").innerHTML = q;
}