// Function to open a new page in a browser source page from a pop-up
// and to close the popup.
	
function to_old_win(url) {
	window.opener.location.href = window.opener.location.href;
	if (window.opener.progressWindow)
	{
		window.opener.progressWindow.close()
	}
	window.close();
}

// Function to show and hide "personalise your bench"  line on the Benches page
function toggle(showHideDiv, switchTextDiv) {
	var ele = document.getElementById(showHideDiv);
	var text = document.getElementById(switchTextDiv);
	if(ele.style.display == "block") {
    		ele.style.display = "none";
		text.innerHTML = "+ PERSONALISE YOUR BENCH";
  	}
	else {
		ele.style.display = "block";
		text.innerHTML = "- PERSONALISE YOUR BENCH";
	}
}

function show_hide(show, hide) {
	if (document.getElementById(show)) {
		document.getElementById(show).style.display="block";
	}
	if (document.getElementById(hide)) {
		document.getElementById(hide).style.display="none";
	}
}

// Function to check for and only display PHP code if the page has a .PHP extension
function check_url_for_php(phpcode) {
	if(location.pathname.lastIndexOf('.php')==-1) {
		document.write(phpcode);
		return false;
	}
}