function processForm(obj, objAct, objVar) {
	if (objAct == 'clear') {
		// obj.select();
		if (obj.value == objVar) {
			obj.value = "";
			obj.className = "";
		}
	}
	if (objAct == "fill") {
		if (obj.value == "") {
			obj.value = objVar;
			obj.className = "template";
		}
	}
}

var tmpl;
var tmpt;
function imgEnlarge(uri, width, height, title) {
	if (document.getElementById("imgpopup")) {
		document.getElementById("imgpopup").getElementsByTagName("img")[0].src = uri;
		document.getElementById("imgpopup").getElementsByTagName("img")[0].width = width;
		document.getElementById("imgpopup").getElementsByTagName("img")[0].height = height;
		document.getElementById("imgpopup").style.display = "block";
	} else {
		oCont = document.createElement("div");
		oCont.setAttribute("id", "imgpopup");
		oLink = document.createElement("a");
		oLink.setAttribute("href", "javascript:imgClose();");
		oImg = document.createElement("img");
		oImg.setAttribute("src", uri);
		oImg.setAttribute("alt", title);
		oImg.setAttribute("title", "Click to close");
		oImg.setAttribute("width", width);
		oImg.setAttribute("height", height);
		oCont.appendChild(oLink);
		oLink.appendChild(oImg);
		document.getElementsByTagName("body")[0].appendChild(oCont);
	}
	origimg = document.getElementById("feature").getElementsByTagName("img")[0];  // The medium-sized image on the page
	tmpt = findPos(origimg)[1] + (origimg.offsetHeight / 2) - (document.getElementById("imgpopup").offsetHeight / 2);  // Vertically centre the image popup with the image on the page
	tmpt = Math.max(10, tmpt);  // But don't let it go off the top of the page
	document.getElementById("imgpopup").style.top = tmpt + "px";
	cont = document.getElementById("container");
	tmpl = findPos(cont)[0] + (cont.offsetWidth / 2) - (document.getElementById("imgpopup").offsetWidth / 2);  // Horizontally centre the image popup with the page container
	tmpl = Math.max(-15, tmpl); // But don't let it go off the left of the page exclusing the border
	document.getElementById("imgpopup").style.left = tmpl + "px";
}

function imgClose() {
		document.getElementById("imgpopup").style.display = "none";
}

function findPos(obj) {
/* Find Position script by Peter-Paul Koch
   http://www.quirksmode.org/js/findpos.html */
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft, curtop];
}

function findViewport() {
/* Get viewport size script by Andy Langton
   http://andylangton.co.uk/articles/javascript/get-viewport-size-javascript/ */
	var viewportwidth;
	var viewportheight;
	if (typeof window.innerWidth != 'undefined') {
		// the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
		viewportwidth = window.innerWidth;
		viewportheight = window.innerHeight;
	} else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) {
		// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)
		viewportwidth = document.documentElement.clientWidth;
		viewportheight = document.documentElement.clientHeight;
	} else {
	// older versions of IE
		viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
		viewportheight = document.getElementsByTagName('body')[0].clientHeight;
	}
	return [viewportwidth, viewportheight];
}

// IE 6 Menu Compatibility

startList = function() {
	if (document.all && document.getElementById) {
		if (document.getElementById("menu")) {
			navRoot = document.getElementById("menu");
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+=" over";
					}
					node.onmouseout=function() {
						this.className=this.className.replace(" over", "");
					}
				}
			}
		}
	}
}
window.onload=startList;