function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}

//Function to reset form
function resetForm() {
document.getElementById('formText').value = "Name"
document.getElementById('formEmail').value = "Email"
document.getElementById('formMessage').value = "Message"
}

//Function to check form is filled in correctly before submitting
function CheckForm() {

	//Intialise variables
	var errorMsg = "";
	var errorMsgLong = "";
	var submitForm = 1

	//Check for a name
	if (document.getElementById('formText').value == "" || document.getElementById('formText').value == "Name" || document.getElementById('formText').value == "name"){
		errorMsg += "\nName \t\t- Enter your name";
		submitForm = 0;
	}
	
	//Check for comments
	if (document.getElementById('formEmail').value == "" || document.getElementById('formEmail').value == "Email" || document.getElementById('formEmail').value == "email"){
		errorMsg += "\nEmail \t\t- Enter your email address";
		submitForm = 0;
	}

	//If there is aproblem with the form then display an error
	if ((errorMsg != "") || (errorMsgLong != "")){
		msg = "There are problem(s) with the form.\n";
		msg += "The following field(s) need to be corrected: -\n";
		
		errorMsg += alert(msg + errorMsg + "\n" + errorMsgLong);
		return false
	}
	
	//Submit the form
	if (submitForm == 1){
	return true
	}
}

function openCenter(popURL,popName,popW,popH) {
	// Set the variable for screen resolution width and height
	var w = 480, h = 340; 

	if (document.all || document.layers || document.getElementById) { 
		// Get the screen resolution width and height
		w = screen.availWidth; 
		h = screen.availHeight; 
	}
	
	// Set the position of the window 
	// This is based on the screen width/height - popup width/height / 2
	var leftPos = (w-popW)/2, topPos = (h-popH)/2; 

	newWindow = window.open(popURL,popName,'width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos); 
	{
	//Make sure the popup window is in focus, but wait a bit for IE4
		setTimeout('newWindow.focus();',250);
	}
}

function targetBlank (URL){
	window.open(URL)
}


