// ------------------- Browser Version Detection --------------
// convert all characters to lowercase to simplify testing
var agt=navigator.userAgent.toLowerCase();
var appVer = navigator.appVersion.toLowerCase();

// *** BROWSER VERSION ***

var is_minor = parseFloat(appVer);
var is_major = parseInt(is_minor);

var is_opera = (agt.indexOf("opera") != -1);
var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
var is_opera6 = (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1); // new 020128- abk
var is_opera7 = (agt.indexOf("opera 7") != -1 || agt.indexOf("opera/7") != -1); // new 021205- dmr
var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);
var is_opera6up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4 && !is_opera5); // new020128
var is_opera7up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4 && !is_opera5 && !is_opera6); // new021205 -- dmr

// Note: On IE, start of appVersion return 3 or 4
// which supposedly is the version of Netscape it is compatible with.
// So we look for the real version further on in the string
// And on Mac IE5+, we look for is_minor in the ua; since 
// it appears to be more accurate than appVersion - 06/17/2004

var is_mac = (agt.indexOf("mac")!=-1);
var iePos  = appVer.indexOf('msie');
if (iePos !=-1) {
    if(is_mac) {
        var iePos = agt.indexOf('msie');
        is_minor = parseFloat(agt.substring(iePos+5,agt.indexOf(';',iePos)));
    }
    else is_minor = parseFloat(appVer.substring(iePos+5,appVer.indexOf(';',iePos)));
    is_major = parseInt(is_minor);
}

// ditto Konqueror
                                    
var is_konq = false;
var kqPos   = agt.indexOf('konqueror');
if (kqPos !=-1) {                 
    is_konq  = true;
    is_minor = parseFloat(agt.substring(kqPos+10,agt.indexOf(';',kqPos)));
    is_major = parseInt(is_minor);
}                                 

var is_getElementById   = (document.getElementById) ? "true" : "false"; // 001121-abk
var is_getElementsByTagName = (document.getElementsByTagName) ? "true" : "false"; // 001127-abk
var is_documentElement = (document.documentElement) ? "true" : "false"; // 001121-abk

var is_safari = ((agt.indexOf('safari')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;
var is_khtml  = (is_safari || is_konq);

var is_gecko = ((!is_khtml)&&(navigator.product)&&(navigator.product.toLowerCase()=="gecko"))?true:false;
var is_gver  = 0;
if (is_gecko) is_gver=navigator.productSub;

var is_moz   = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
                (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1)  &&
                (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)     &&
                (is_gecko) && 
                ((navigator.vendor=="")||(navigator.vendor=="Mozilla")||(navigator.vendor=="Debian")));
var is_fb = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
                (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1)  &&
                (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)     &&
                (is_gecko) && (navigator.vendor=="Firebird"));
var is_fx = ((agt.indexOf('mozilla/5')!=-1) && (agt.indexOf('spoofer')==-1) &&
                (agt.indexOf('compatible')==-1) && (agt.indexOf('opera')==-1)  &&
                (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)     &&
                (is_gecko) && (navigator.vendor=="Firefox"));
if ((is_moz)||(is_fb)||(is_fx)) {  // 032504 - dmr
    var is_moz_ver = (navigator.vendorSub)?navigator.vendorSub:0;
    if(!(is_moz_ver)) {
        is_moz_ver = agt.indexOf('rv:');
        is_moz_ver = agt.substring(is_moz_ver+3);
        is_paren   = is_moz_ver.indexOf(')');
        is_moz_ver = is_moz_ver.substring(0,is_paren);
    }
    is_minor = is_moz_ver;
    is_major = parseInt(is_moz_ver);
}
var is_fb_ver = is_moz_ver;
var is_fx_ver = is_moz_ver;

var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
            && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1)
            && (!is_khtml) && (!(is_moz)) && (!is_fb) && (!is_fx));

// Netscape6 is mozilla/5 + Netscape6/6.0!!!
// Mozilla/5.0 (Windows; U; Win98; en-US; m18) Gecko/20001108 Netscape6/6.0
// Changed this to use navigator.vendor/vendorSub - dmr 060502   
// var nav6Pos = agt.indexOf('netscape6');
// if (nav6Pos !=-1) {
if ((navigator.vendor)&&
    ((navigator.vendor=="Netscape6")||(navigator.vendor=="Netscape"))&&
    (is_nav)) {
    is_major = parseInt(navigator.vendorSub);
    // here we need is_minor as a valid float for testing. We'll
    // revert to the actual content before printing the result. 
    is_minor = parseFloat(navigator.vendorSub);
}

var is_nav2 = (is_nav && (is_major == 2));
var is_nav3 = (is_nav && (is_major == 3));
var is_nav4 = (is_nav && (is_major == 4));
var is_nav4up = (is_nav && is_minor >= 4);  // changed to is_minor for
                                            // consistency - dmr, 011001
var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                        (agt.indexOf("; nav") != -1)) );

var is_nav6   = (is_nav && is_major==6);    // new 010118 mhp
var is_nav6up = (is_nav && is_minor >= 6); // new 010118 mhp

var is_nav5   = (is_nav && is_major == 5 && !is_nav6); // checked for ns6
var is_nav5up = (is_nav && is_minor >= 5);

var is_nav7   = (is_nav && is_major == 7);
var is_nav7up = (is_nav && is_minor >= 7);

var is_ie   = ((iePos!=-1) && (!is_opera) && (!is_khtml));
var is_ie3  = (is_ie && (is_major < 4));

var is_ie4   = (is_ie && is_major == 4);
var is_ie4up = (is_ie && is_minor >= 4);
var is_ie5   = (is_ie && is_major == 5);
var is_ie5up = (is_ie && is_minor >= 5);

var is_ie5_5  = (is_ie && (agt.indexOf("msie 5.5") !=-1)); // 020128 new - abk
var is_ie5_5up =(is_ie && is_minor >= 5.5);                // 020128 new - abk

var is_ie6   = (is_ie && is_major == 6);
var is_ie6up = (is_ie && is_minor >= 6);

// KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
// or if this is the first browser window opened.  Thus the
// variables is_aol, is_aol3, and is_aol4 aren't 100% reliable.

var is_aol   = (agt.indexOf("aol") != -1);
var is_aol3  = (is_aol && is_ie3);
var is_aol4  = (is_aol && is_ie4);
var is_aol5  = (agt.indexOf("aol 5") != -1);
var is_aol6  = (agt.indexOf("aol 6") != -1);
var is_aol7  = ((agt.indexOf("aol 7")!=-1) || (agt.indexOf("aol7")!=-1));
var is_aol8  = ((agt.indexOf("aol 8")!=-1) || (agt.indexOf("aol8")!=-1));

var is_webtv = (agt.indexOf("webtv") != -1);

// new 020128 - abk

var is_TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1)); 
var is_AOLTV = is_TVNavigator;

var is_hotjava = (agt.indexOf("hotjava") != -1);
var is_hotjava3 = (is_hotjava && (is_major == 3));
var is_hotjava3up = (is_hotjava && (is_major >= 3));

// end new

// *** JAVASCRIPT VERSION CHECK ***
// Useful to workaround Nav3 bug in which Nav3
// loads <SCRIPT LANGUAGE="JavaScript1.2">.
// updated 020131 by dragle
var is_js;
if (is_nav2 || is_ie3) is_js = 1.0;
else if (is_nav3) is_js = 1.1;
else if ((is_opera5)||(is_opera6)) is_js = 1.3; // 020214 - dmr
else if (is_opera7up) is_js = 1.5; // 031010 - dmr
else if (is_khtml) is_js = 1.5;   // 030110 - dmr
else if (is_opera) is_js = 1.1;
else if ((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2;
else if ((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3;
else if (is_nav5 && !(is_nav6)) is_js = 1.4;
else if (is_hotjava3up) is_js = 1.4; // new 020128 - abk
else if (is_nav6up) is_js = 1.5;

// NOTE: In the future, update this code when newer versions of JS
// are released. For now, we try to provide some upward compatibility
// so that future versions of Nav and IE will show they are at
// *least* JS 1.x capable. Always check for JS version compatibility
// with > or >=.

else if (is_nav && (is_major > 5)) is_js = 1.4;
else if (is_ie && (is_major > 5)) is_js = 1.3;
else if (is_moz) is_js = 1.5;
else if (is_fb||is_fx) is_js = 1.5; // 032504 - dmr

// what about ie6 and ie6up for js version? abk

// HACK: no idea for other browsers; always check for JS version 
// with > or >=
else is_js = 0.0;
// HACK FOR IE5 MAC = js vers = 1.4 (if put inside if/else jumps out at 1.3)
if ((agt.indexOf("mac")!=-1) && is_ie5up) is_js = 1.4; // 020128 - abk
    
// Done with is_minor testing; revert to real for N6/7
if (is_nav6up) {
    is_minor = navigator.vendorSub;
}

// *** PLATFORM ***
var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );

var is_mac    = (agt.indexOf("mac")!=-1);
if (is_mac) { is_win = !is_mac; } // dmr - 06/20/2002

// additional checks, abk
var is_anchors = (document.anchors) ? "true":"false";
var is_regexp = (window.RegExp) ? "true":"false";
var is_option = (window.Option) ? "true":"false";
var is_all = (document.all) ? "true":"false";

// java
var is_java = (navigator.javaEnabled());

// Flash checking code adapted from Doc JavaScript information; 
// see http://webref.com/js/column84/2.html

var is_Flash        = false;
var is_FlashVersion = 0;

if ((is_nav||is_opera||is_moz||is_fb||is_fx)||
    (is_mac&&is_ie5up)) {
    var plugin = (navigator.mimeTypes && 
                navigator.mimeTypes["application/x-shockwave-flash"] &&
                navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) ?
                navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
//      if (plugin) {
    if (plugin&&plugin.description) {
        is_Flash = true;
        is_FlashVersion = parseInt(plugin.description.substring(plugin.description.indexOf(".")-1));
    }
}

if (is_win&&is_ie4up)
{
    document.write(
        '<scr' + 'ipt language=VBScript>' + '\n' +
        'Dim hasPlayer, playerversion' + '\n' +
        'hasPlayer = false' + '\n' +
        'playerversion = 10' + '\n' +
        'Do While playerversion > 0' + '\n' +
        'On Error Resume Next' + '\n' +
        'hasPlayer = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & playerversion)))' + '\n' +
        'If hasPlayer = true Then Exit Do' + '\n' +
        'playerversion = playerversion - 1' + '\n' +
        'Loop' + '\n' +
        'is_FlashVersion = playerversion' + '\n' +
        'is_Flash = hasPlayer' + '\n' +
        '<\/sc' + 'ript>'
    );
}

//------------------------------------ DHTML MiniAPI -------
function findPosX(obj)
{
	var status='';
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			status+=' element:' + obj.nodeName + ' (id:' + obj.id + ') Xpos=' + obj.offsetLeft;
			obj = obj.offsetParent;
		}
	} else if (obj.x) {
		curleft += obj.x;
	}
	//alert (status);
	return curleft;
}

function findPosY(obj)
{
	var status='';
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			status+=' element:' + obj.nodeName + ' (id:' + obj.id + ') Ypos=' + obj.offsetTop;
			obj = obj.offsetParent;
		}
	} else if (obj.y) {
		curtop += obj.y;
	}
	//alert (status);
	return curtop;
}

function getObjByID(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	if (this.obj) {
		this.style = document.getElementById(name).style;
		//alert('In getObjByID with name='+name);
	}
	return (this);
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	if (this.obj) {
		this.style = document.all[name].style;
	}
	return (this);
  }
  else if (document.layers)
  {
	this.obj = getObjNN4(document,name);
	if (this.obj) {
		this.style = this.obj;
	}
	return (this);
  }
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}

// ----------------------------- BaseName finds the file name of the current pg ---
function BaseName(ThisURI) {
	var y=ThisURI.toString();
	var x=y.length-1;
	var z=x+1;		// track where an on-page link starts
	while (x>=0) {
		if (y.substring(x,x+1) == '#') {
			z=x;
		}
		if ((y.substring(x,x+1) == '/') || (y.substring(x,x+1) == '\\')) {
			return y.substring(x+1,z);
		}
		x--;
	}
	return y;
}

// -----------------Own page building functions --------------
// Next line is for links.htm
if (is_ie6) {
	document.writeln('<style>td.LinksGroupText {writing-mode: tb-rl; filter: flipv fliph; width: 40px;}</style>');
}

function AdverCycle (NumberOfPages) {
	var PadCount=1;
	var DateTimeNow=new Date();
	if (NumberOfPages < 10) {
		PadCount=1;
	} else if (NumberOfPages < 100) {
		PadCount=2;
	} else if (NumberOfPages < 1000) {
		PadCount=3;
	} else if (NumberOfPages < 10000) {
		PadCount=4;
	}
	var MinutesValue=new String((DateTimeNow.getMinutes() % NumberOfPages) + 1);

	for (var ThisPad=PadCount-MinutesValue.length; ThisPad > 0; ThisPad--) {
		MinutesValue = "0" + MinutesValue;
	}
	return MinutesValue;
}

function DisplayEmailLink (emn1,emn2,emd1,emd2,AClass,AID) {
	document.write ('<a ');
	if (AID.length > 0) {
		document.write ('id="'+AID+'" ');
	}
	if (AClass.length > 0) {
		document.write ('class="'+AClass+'" ');
	}
	document.write ('href="mai');
	document.write ('lto:' + emn1 + emn2);
	document.write ('&#64;')
	document.write ((emd1 != "") ? emd1 : 'penninesoaringclub.o')
	document.write ((emd2 != "") ? emd2 : 'rg.uk')
	document.write ('">' + emn1 + emn2)
	document.write ('&#64;')
	document.write ((emd1 != "") ? emd1 : 'penninesoaringclub.o')
	document.write ((emd2 != "") ? emd2 : 'rg.uk')
	document.write ('</a>')
}

function ObjectShow(What) {
	var TheObject = document.getElementById(What);
	if (TheObject) {
		TheObject.style.visibility = '';
	}
}

function ObjectHide(What) {
	var TheObject = document.getElementById(What);
	if (TheObject) {
		TheObject.style.visibility = 'hidden';
	}
}

var SGWindow;

var SGDirs = new Array ( 'N', 'NNE', 'NE', 'ENE', 'E', 'ESE', 'SE', 'SSE', 'S', 'SSW', 'SW', 'WSW', 'W', 'WNW', 'NW', 'NNW');
//							 1,   1,  0,   0, 0,   0,  0,   0, 0,   0,  0,   0, 0,   0,  0,   1,	//Hameldon - REMOVED 2004/11/25

// 16x Array 0 no, 1 yes     N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW
var SGSiteDirs = new Array ( 0,   0,  0,   0, 0,   0,  0,   0, 0,   0,  0,   1, 1,   1,  1,   0,	//balladen
							 0,   0,  0,   0, 0,   0,  0,   1, 1,   1,  1,   0, 0,   0,  0,   0,	//Edenfield
							 0,   0,  0,   1, 1,   1,  1,   0, 0,   0,  0,   0, 0,   0,  0,   0,	//lark hill
							 1,   1,  0,   0, 0,   0,  0,   0, 0,   0,  0,   0, 0,   0,  1,   1,	//longridge
							 0,   0,  0,   0, 0,   0,  0,   0, 0,   1,  1,   1, 0,   0,  0,   0,	//Millstone
							 0,   0,  0,   0, 0,   0,  1,   1, 1,   1,  1,   0, 0,   0,  0,   0,	//Nonts
							 0,   0,  0,   1, 1,   1,  1,   1, 1,   1,  1,   1, 1,   1,  0,   0,	//Parlick
							 0,   0,  0,   0, 0,   0,  0,   0, 0,   0,  0,   0, 0,   1,  1,   1,	//Pendle
							 0,   0,  0,   0, 0,   0,  0,   0, 0,   0,  0,   1, 1,   1,  0,   0,	//Pule
							 1,   1,  1,   0, 0,   0,  0,   0, 0,   0,  0,   0, 0,   0,  0,   1);	//winter hill


var SGSiteNames = new Array('Balladen',
							'Edenfield',
							'Lark Hill',
							'Longridge',
							'Millstone Edge',
							'Nont Sarahs',
							'Parlick',
							'Pendle',
							'Pule',
							'Winter Hill');
var SGSiteShortnames = new Array('balladen',
								 'edenfield',
								 'larkhill',
								 'longridge',
								 'millstone',
								 'nonts',
								 'parlick',
								 'pendle',
								 'pule',
								 'winterhill');

function CompassUpdateCommon(Un,ThisDirection) {
	var ThisDir=ThisDirection;
	if (ThisDirection.substr(0,7) != 'compass') {
		ThisDir='compass'+ThisDirection;
	}
	var thisSeg = document.getElementById(ThisDir);
	
	if (thisSeg) {
		if (Un == 1) {
			thisSeg.style.visibility = 'hidden';
		} else {
			thisSeg.style.visibility = '';
		}
	}
}

function CompassHover(ThisDirection) {
	return SGCompassHoverCommon(0,ThisDirection);
}

function CompassUnHover(ThisDirection) {
	return SGCompassHoverCommon(1,ThisDirection);
}

function SGClick(ThisSiteName) {
	//if (SGWindow) {
	//	window.close();
	//}
	SGWindow = window.open(ThisSiteName+'.htm');
}

function SGClick2(ThisSiteName) {
	//if (SGWindow) {
	//	window.close();
	//}
	SGWindow = window.open(ThisSiteName);
}

function SGCompassHoverCommon(Un, ThisDirection) {
	CompassUpdateCommon(Un,ThisDirection);
	var ThisDirIndex = -1;
	for (var DirIndex=0; DirIndex < SGDirs.length; DirIndex++) {
		if ((SGDirs[DirIndex]) == ThisDirection) {
			ThisDirIndex = DirIndex;
		}
	}
	if (ThisDirIndex >= 0) {
		for (var TestSite=0; TestSite < SGSiteShortnames.length; TestSite++) {
			if (SGSiteDirs[16*TestSite + ThisDirIndex] == 1) {
				SGListUpdateCommon(Un, SGSiteShortnames[TestSite]);
				SGMapUpdateCommon(Un, SGSiteShortnames[TestSite]);
			}
		}
	}
}

function SGListUpdateCommon(Un,ThisSiteName) {
	var thisSite = document.getElementById('SGList'+ThisSiteName);
	if (thisSite) {
		if (Un == 1) {
			thisSite.style.color = '';
			thisSite.style.backgroundColor = '';
		} else {
			thisSite.style.color = 'white';
			thisSite.style.backgroundColor = 'black';
		}
	}
}

function SGListPlusMapHoverCommon(Un,ThisSiteName) {
	SGListUpdateCommon(Un,ThisSiteName);
	SGMapUpdateCommon(Un,ThisSiteName);
	var ThisSiteIndex = -1;
	for (var SiteIndex=0; SiteIndex < SGSiteShortnames.length; SiteIndex++) {
		if ((SGSiteShortnames[SiteIndex]) == ThisSiteName) {
			ThisSiteIndex = SiteIndex;
		}
	}
	if (ThisSiteIndex >= 0) {
		for (var ThisDir=0; ThisDir < 16; ThisDir++) {
			if (SGSiteDirs[16*ThisSiteIndex + ThisDir] == 1) {
				CompassUpdateCommon(Un,SGDirs[ThisDir]);
			}
		}
	}
}

function SGListHover(ThisSiteName) {
	return SGListPlusMapHoverCommon(0,ThisSiteName);
}

function SGListUnHover(ThisSiteName) {
	return SGListPlusMapHoverCommon(1,ThisSiteName);
}

function SGMapUpdateCommon(Un,ThisSiteName) {
	var thisSite = document.getElementById('SGSitesMap'+ThisSiteName+'Span');
	if (thisSite) {
		if (Un == 1) {
			thisSite.style.visibility = 'hidden';
		} else {
			thisSite.style.visibility = '';
		}
	}
}

function SGMapHover(ThisSiteName) {
	return SGListPlusMapHoverCommon(0,ThisSiteName);
}

function SGMapUnHover(ThisSiteName) {
	return SGListPlusMapHoverCommon(1,ThisSiteName);
}

function showFooter(FormatDateEntry, ContentDateEntry) {
	var BaseNameURI = BaseName(document.URL);
	document.write ('<table class="footer" ID="Table2">\n');
	document.write ('	<tr>\n');
	document.write ('		<td class="footer_r1c1">\n');
	document.write ('			This page updated: (format) ' + FormatDateEntry + ' (content) ' + ContentDateEntry + '\n');
	document.write ('		</td>\n');

	document.write ('		<td class="footer_r1c2">');
	if (BaseNameURI.toLowerCase() != 'problems.htm') {
		document.write ('<a href="/problems.htm">Problems?</a>');
	} else {
		document.write ('Problems?');
	}
	document.write ('</td>\n');

	document.write ('		<td class="footer_r1c3">');
	if (BaseNameURI.toLowerCase() != 'websitemap.htm') {
		document.write ('<a href="/websitemap.htm">Site map</a>');
	} else {
		document.write ('Site map');
	}
	document.write ('</td>\n');

	document.write ('		<td class="footer_r1c4">');
	if (BaseNameURI.toLowerCase() != 'disclaimer.htm') {
		document.write ('<a href="/disclaimer.htm">Disclaimer</a>');
	} else {
		document.write ('Disclaimer');
	}
	document.write ('</td>\n');

	document.write ('	</tr>\n');
	document.write ('</table>\n');
}

function showHeader() {
	if (is_Flash) {
		document.writeln ('<table class="general" ID="Table1">');
		document.writeln ('<tr><td width="1" height="100"></td><td class="head_r1c1">');
		document.writeln ('<OBJECT codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" height="100" width="174" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" VIEWASTEXT>');
		document.writeln ('<PARAM NAME="_cx" VALUE="4604">');
		document.writeln ('<PARAM NAME="_cy" VALUE="2646">');
		document.writeln ('<PARAM NAME="FlashVars" VALUE="4604">');
		document.writeln ('<PARAM NAME="Movie" VALUE="/graphics/topleft.swf">');
		document.writeln ('<PARAM NAME="Src" VALUE="/graphics/topleft.swf">');
		document.writeln ('<PARAM NAME="WMode" VALUE="Window">');
		document.writeln ('<PARAM NAME="Play" VALUE="-1">');
		document.writeln ('<PARAM NAME="Loop" VALUE="0">');
		document.writeln ('<PARAM NAME="Quality" VALUE="High">');
		document.writeln ('<PARAM NAME="SAlign" VALUE="">');
		document.writeln ('<PARAM NAME="Menu" VALUE="-1">');
		document.writeln ('<PARAM NAME="Base" VALUE="">');
		document.writeln ('<PARAM NAME="AllowScriptAccess" VALUE="always">');
		document.writeln ('<PARAM NAME="Scale" VALUE="ShowAll">');
		document.writeln ('<PARAM NAME="DeviceFont" VALUE="0">');
		document.writeln ('<PARAM NAME="EmbedMovie" VALUE="0">');
		document.writeln ('<PARAM NAME="BGColor" VALUE="">');
		document.writeln ('<PARAM NAME="SWRemote" VALUE="">');
		document.writeln ('<embed src="/graphics/topleft.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="174" height="100" loop="false">');
		document.writeln ('</embed>');
		document.writeln ('</OBJECT>');
		document.writeln ('</td><td class="head_r1c2">');
		document.writeln ('<OBJECT codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" height="100" width="600" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" VIEWASTEXT>');
		document.writeln ('<PARAM NAME="_cx" VALUE="15875">');
		document.writeln ('<PARAM NAME="_cy" VALUE="2646">');
		document.writeln ('<PARAM NAME="FlashVars" VALUE="15875">');
		document.writeln ('<PARAM NAME="Movie" VALUE="/graphics/logo.swf">');
		document.writeln ('<PARAM NAME="Src" VALUE="/graphics/logo.swf">');
		document.writeln ('<PARAM NAME="WMode" VALUE="Window">');
		document.writeln ('<PARAM NAME="Play" VALUE="-1">');
		document.writeln ('<PARAM NAME="Loop" VALUE="0">');
		document.writeln ('<PARAM NAME="Quality" VALUE="High">');
		document.writeln ('<PARAM NAME="SAlign" VALUE="">');
		document.writeln ('<PARAM NAME="Menu" VALUE="-1">');
		document.writeln ('<PARAM NAME="Base" VALUE="">');
		document.writeln ('<PARAM NAME="AllowScriptAccess" VALUE="always">');
		document.writeln ('<PARAM NAME="Scale" VALUE="ShowAll">');
		document.writeln ('<PARAM NAME="DeviceFont" VALUE="0">');
		document.writeln ('<PARAM NAME="EmbedMovie" VALUE="0">');
		document.writeln ('<PARAM NAME="BGColor" VALUE="">');
		document.writeln ('<PARAM NAME="SWRemote" VALUE="">');
		document.writeln ('<embed src="/graphics/logo.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="600" height="100" loop="false">');
		document.writeln ('</embed>');
		document.writeln ('</OBJECT>');
		document.writeln ('</td><td width="1"></td></tr>');
		//document.writeln ('<tr><td colspan="3" class="title_bar"></td><td></td></tr>');
		document.writeln ('</table>');
	} else {
		document.writeln ('<table class="general" ID="Table1">');
		document.writeln ('<tr><td width="1" height="100">');
		document.writeln ('<img src="/graphics/header-psc-officialwebsite.png" alt="The Official PSC Website">');
		document.writeln ('</td><td class="head_r1c1">');
		document.writeln ('<img src="/graphics/header-psc-strip.png" alt="The Pennine Soaring Club">');
		document.writeln ('</td><td width="1"></td></tr>');
		//document.writeln ('<tr><td colspan="3" class="title_bar"></td><td></td></tr>');
		document.writeln ('</table>');
	}
}

var currentSet=0;	// pig of a hack to make menus work with mouse over when the menu doesn't include the current page
function showMenu() {
/*window.onload = function() {
//initialiseMenu("menuHome", "menuHomeStarter");
//initialiseMenu("menuGallery", "menuGalleryStarter");
//initialiseMenu("menuSiteGuide", "menuSiteGuideStarter");
//initialiseMenu("menuWeather", "menuWeatherStarter");
//initialiseMenu("menuDownloads", "menuDownloadsStarter");
//initialiseMenu("menuContacts", "menuContactsStarter");
}*/
	document.writeln ('<table class="general" ID="Table1"><tr><td>');
	document.writeln ('<div id="MenuBar">');
	document.writeln ('<div id="MenuOuterWrap">');
	document.writeln ('<div id="MenuInnerWrap">');
	document.writeln ('<div id="Menu">');
	document.writeln ('<ul>');
	showMenuEntry ("menuHomeStarter",      "Home",      "/",                         "Home");
	showMenuEntry ("menuGalleryStarter",   "Gallery",   "/cgi-bin/Gallery.cgi",      "Gallery");
	showMenuEntry ("menuSiteGuideStarter", "SiteGuide", "/penninesites/sitemap.htm", "Site Guide");
	showMenuEntry ("menuWeatherStarter",   "Weather",   "/weather.htm",              "Weather");
	showMenuEntry ("menuDownloadsStarter", "Downloads", "/downloads/downloads.htm",  "Downloads");
	showMenuEntry ("menuLinksStarter",     "Links",     "/links.htm",                "Links");
if (currentSet==0) {currentSet=1};
	showMenuEntry ("menuContactsStarter",  "Contacts",  "/contacts.htm",             "Contacts");
	document.writeln ('</ul></div></div></div></div></td></tr></table>');
}

function showMenuEntry(idString, accessKeyString, URLString, displayString) {
	var BaseNameURI = BaseName(document.URL);
	var BaseNameEntry = BaseName(URLString);	// not 100% bulletproof
	if (BaseNameURI.toLowerCase() == BaseNameEntry.toLowerCase()) {
		document.writeln ('<li id="current">');
		currentSet=2;
	} else if (currentSet == 1) {
		document.writeln ('<li id="current2">');
	} else {
		document.writeln ('<li>');
	}
	document.writeln ('<span id="ltab">&nbsp;</span><a id="' + idString + '" accesskey="' + accessKeyString + '" href="' + URLString + '">' + displayString + '</a></li>');
}

// ---------------------------- Menu games if we want multiple levels of menu ------
function FormOff()
{
	var selNodes = document.getElementsByTagName('select')
	var i=0;
	if (!selNodes.item(0)) {
		return false;
	} else {
		do{selNodes.item(i).style.visibility = 'hidden';}
		while(++i < selNodes.length);
	}
}

function FormOn()
{
	var selNodes = document.getElementsByTagName('select')
	var i=0;
	if (!selNodes.item(0)) {
		return false;
	} else {
		do{selNodes.item(i).style.visibility = 'visible';}
		while(++i < selNodes.length);
	}

}

var currentMenu = null;
var mytimer = null;
var timerOn = false;
var opera = window.opera ? true : false;

if (!document.getElementById)
	document.getElementById = function() { return null; }

function initialiseMenu(menuId, starterId) {
	var menu = document.getElementById(menuId);
	var starter = document.getElementById(starterId);

	if (menu == null) {
		return;
	}

	if(starter == null) {
		return;
	}

		currentMenu = menu;

	starter.onmouseover = function() {
		if (currentMenu) {
			currentMenu.style.visibility = "hidden";
			currentMenu = null;
			this.showMenu();
			stopTime();
        }
	}

	menu.onmouseover = function() {
		if (currentMenu) {
			currentMenu.style.visibility = "hidden";
			currentMenu = null;
			this.showMenu();
        }
	}

	starter.showMenu = function() {
		FormOff();
		if (!opera) {
			menu.style.left = this.offsetLeft + "px";
			menu.style.top = this.offsetTop + this.offsetHeight + "px";
		} else {
			menu.style.left = this.offsetLeft + "px";
			menu.style.top = this.offsetHeight + "px";
		}
		menu.style.visibility = "visible";
		currentMenu = menu;
	}

	starter.onfocus	 = function() {
		this.onmouseover();
	}

	starter.onblur	 = function() {
		this.onmouseout();
	}

	menu.showMenu = function() {
		FormOff();
		menu.style.visibility = "visible";
		currentMenu = menu;
		stopTime();
	}

	menu.hideMenu = function()  {
		if (!timerOn) {
			mytimer = setTimeout("killMenu('" + menuId + "');", 250);
			timerOn = true;
			timer2On = true;
		}
	}

	menu.onmouseout = function(event) {
		this.hideMenu();
	}

	starter.onmouseout = function() {
		menu.hideMenu();
	}
}

function killMenu(amenu) {
	FormOn();
	var menu = document.getElementById(amenu);
	menu.style.visibility = "hidden";
	stopTime();

}

function stopTime() {
	if (mytimer) {
		clearTimeout(mytimer);
		mytimer = null;
		timerOn = false;
	}
}
