function emailwnd(name, section)
{
	return openwnd('http://www.srps.org.uk/email.php?n='+name+'&s='+section+'&p=1', 600, 400);
}

function maillistwnd()
{
	return openwnd('http://www.srps.org.uk/railway/bkmailform.php?p=1', 600, 550);
}

function rtmaillistwnd()
{
	return openwnd('http://www.srps.org.uk/railtours/rtmailform.php?p=1', 600, 550);
}

function openwnd(url, width, height)
{
	winl = (screen.width - width) / 2;
	wint = (screen.height - height) / 2;
	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,dependent=1';
	win = window.open(url, 'srpswnd', winprops);
	if(parseInt(navigator.appVersion) >= 4) { win.window.focus(); }

	return true;
}

function email(address)
{
	document.location = address;

	return true;
}

function exit()
{
	window.close();

	return true;
}

var hideTimer = 0;

function setTimer(b)
{
	if(hideTimer != 0) {
		clearInterval(hideTimer);
		hideTimer = 0;
	}
	if(b) hideTimer = setInterval(hideAll, 2000);
}

function getPos(el)
{
	for(var lx=0,ly=0;el!=null;
		lx+=el.offsetLeft,ly+=el.offsetTop,el=el.offsetParent);
	return {x:lx,y:ly}
}

function show(boxname, visibility, posbox, xoff, yoff)
{
	var pos, box;

	if(visibility == undefined) visibility = "visible";
	if(posbox == undefined) posbox = boxname + "p";
	if(xoff == undefined) xoff = 0;
	if(yoff == undefined) yoff = 0;

	if(document.getElementById) {
		pos = getPos(document.getElementById(posbox));
		box = document.getElementById(boxname);
	} else {
		pos = getPos(document[posbox]);
		box = document[boxname];
	}
	hideAll();
	if(box.style) {
		box.style.left = pos.x + xoff;
		box.style.top = pos.y + yoff;
		box.style.visibility = visibility;
	} else {
		box.visibility = visibility;
	}
	setTimer(true);
}

function hideAll()
{
	setTimer(false);

	if(document.getElementById) {
	//if(navigator.appName != "Microsoft Internet Explorer" && document.all) {
		document.getElementById("box1").style.visibility = "hidden";
		document.getElementById("box2").style.visibility = "hidden";
		document.getElementById("box3").style.visibility = "hidden";
		document.getElementById("box4").style.visibility = "hidden";
	} else {
		if(document.all) {
	//if(navigator.appName == "Microsoft Internet Explorer") {
			document.all.box1.style.visibility = "hidden";
			document.all.box2.style.visibility = "hidden";
			document.all.box3.style.visibility = "hidden";
			document.all.box4.style.visibility = "hidden";
		} else {
	//if(!document.all) {
			document.box1.visibility = "hidden";
			document.box2.visibility = "hidden";
			document.box3.visibility = "hidden";
			document.box4.visibility = "hidden";
		}
	}
}

function footerToBottom(footer, footerbottom)
{
	if(footer == undefined) footer = "footertable";
	if(footerbottom == undefined) footerbottom = "footerpos";

	pgheight = pageHeight();
	if(document.getElementById) {
		table = document.getElementById(footer);
		pos = getPos(document.getElementById(footerbottom));
	} else {
		table = document[footer];
		pos = getPos(document[footerbottom]);
	}
	if(pos.y < pgheight) {
		table.style.position = 'absolute';
		table.style.bottom = 0;
		table.style.top = getPos(table).y;
	}
	body.onresize = footerToBottom(footer, footerbottom);
}

// Browser Window Size and Position
// copyright Stephen Chapman, 3rd Jan 2005, 8th Dec 2005
// you may copy these functions but please keep the copyright notice as well
function pageWidth()
{
	return window.innerWidth != null ? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;
}

function pageHeight()
{
	return window.innerHeight != null ? window.innerHeight : document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body != null ? document.body.clientHeight : null;
}

function posLeft()
{
	return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;
}

function posTop()
{
	return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;
}

function posRight()
{
	return posLeft() + pageWidth();
}

function posBottom()
{
	return posTop() + pageHeight();
}

// -------------------------------------------------------------------------