function showHide(linkid, elementid) {

	var e = document.getElementById(elementid);
	var l = document.getElementById(linkid);
	
	if (e.style.display == "" || e.style.display == "none") {
		e.style.display = "block";
		l.src = "/media/images/extra-hide.gif";
	} else {
		e.style.display = "none";
		l.src = "/media/images/extra-show.gif";
	};

}

function showNews(newsid) {

	var l = document.getElementById("link"+newsid);
	var p = document.getElementById("news"+newsid);
	
	if (p.style.display == "" || p.style.display == "none") {
		p.style.display = "block";
		l.innerHTML = "Hide Article";
	} else {
		p.style.display = "none";
		l.innerHTML = "Read Article";
	};

}

function matchHeights() {

	if (!document.getElementById("main")) {
		return false;
	};
	if (!document.getElementById("mainleftmenu")) {
		return false;
	};
	
	//alert("function called");
	var main = document.getElementById("main").offsetHeight;
	var mainleftmenu = document.getElementById("mainleftmenu").offsetHeight;

	if (main < mainleftmenu) {
	
		document.getElementById("main").style.minHeight = mainleftmenu+"px";
		
		var version = 0
		if (navigator.appVersion.indexOf("MSIE")!=-1){
			temp=navigator.appVersion.split("MSIE");
			version=parseFloat(temp[1]);		

			if (version<7) {

				document.getElementById("main").style.height = mainleftmenu+"px";
	
			};
		};
		
	};
		
	
}

//validates postcode submission in footer
function postcodeFooterSubmit()
{
	if (postcodeFooter.frmPostCode.value == "")
		{
			window.alert("Please enter your postcode");
			postcodeFooter.frmPostCode.focus();
			return false;
		}
}

//validates postcode submission in page
function postcodePageSubmit()
{
	if (postcodePage.frmPostCode.value == "")
		{
			window.alert("Please enter your postcode");
			postcodePage.frmPostCode.focus();
			return false;
		}
}

//validates search submission in page
function searchPageSubmit()
{
	if (frmPageSearch.frmSearch.value == "")
		{
			window.alert("Please enter a keyword");
			frmPageSearch.frmSearch.focus();
			return false;
		}
}

//validates search submission in header
function searchHeaderSubmit()
{
	if (frmHeaderSearch.frmSearch.value == "")
		{
			window.alert("Please enter a keyword");
			frmHeaderSearch.frmSearch.focus();
			return false;
		}
}

//deletes text from form element
function delText(element) {
     if (element.value == element.defaultValue) {
       element.value = '';
     }
   }

window.onload = matchHeights;
