if (defaultEmptyOk == undefined) var defaultEmptyOk = true;

function isEmpty(strSource)
{ return ((strSource == null) || (strSource.length == 0));}

function isUSPhone(strSource)
{ if (isEmpty(strSource))
return ((isUSPhone.arguments.length == 1) ? defaultEmptyOk : (isUSPhone.arguments[1] == true)); return (strSource.search(/^(1[\-\.\s]?)?(\(\d{3}\)[\s\-\.]?|\d{3}[\s\-\.]?)?\d{3}[\-\.\s]?\d{4}(\s?x\d+)?$/) != -1);}

function isEmail(strSource)
{ if (isEmpty(strSource))
return ((isEmail.arguments.length == 1) ? defaultEmptyOk : (isEmail.arguments[1] == true)); return (strSource.search(/^[a-z\d][\w\-\.]*\@([a-z\d][\w\-]*\.)+[a-z]{2,4}$/i) != -1);}

function validateform(objForm)
		{
			var bValid = true;
			var strError = "The following fields require entries:\n";

			if (isEmpty(objForm.firstName.value))
			{
				strError += "- First Name\n";
				bValid = false;
			}

			if (isEmpty(objForm.lastName.value))
			{
				strError += "- Last Name\n";
				bValid = false;
			}

			if (isEmpty(objForm.state.value))
			{
				strError += "- State\n";
				bValid = false;
			}

			if (isEmpty(objForm.telephone.value))
			{
				strError += "- Telephone Number\n";
				bValid = false;
			}
				
			if (isEmpty(objForm.email.value))
			{
				strError += "- Email\n";
				bValid = false;
			}

			if (!isUSPhone(objForm.telephone.value))
			{
				strError += "- Telephone number must be a valid phone number in the format \'(ddd) ddd-dddd\'\n";
				bValid = false;
			}


			if (!isEmail(objForm.email.value))
			{
				strError += "- Email Address must be a valid email address in the format \'name@domain.com\'\n";
				bValid = false;
			}
			

			if (!bValid)
				alert(strError);

			return bValid;
		}
		
function validateform2(objForm)
		{
			var bValid = true;
			var strError = "Please correct the following items and submit again:\n";

			if (isEmpty(objForm.fullNameDiagnosed.value))
			{
				strError += "Enter the name of the person who may be diagnosed with mesothelioma.\n";
				bValid = false;
			}
			

			if (!bValid)
				alert(strError);

			return bValid;
		}
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=600');");
}
