/* FILE: 	criticalmetrics.js			*/
/* WEBSITE: 	Critical Metrics 			*/
/* DATE:	04/01/2009				*/
/* CODED BY:	Reece Runnells @ Analog Method		*/

var emailFieldValue = "Enter Your Email";
	
function clearEmailField(o) { 
	if(o.value == emailFieldValue) {
			o.value = "";
			o.style.color = "#000000";
	}
}
	
function putItBack(o) {
	if (o.value == "") {
		o.value = emailFieldValue;
		o.style.color = "";
	}
}
	
function intialize() {
	document.getElementById("box").value = emailFieldValue;
}

function validate_email(field,alerttxt)
{
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {alert(alerttxt);return false;}
  else {return true;}
  }
}

function validate_form(thisform)
{
with (thisform)
  {
  if (validate_email(email,"Not a valid e-mail address!")==false)
    {email.focus();return false;}
  }
}