function MM_findObj(n, d) { //v4.01
	var p,i,x; 
	if(!d) d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
	    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); 
	return x;
}

function MM_setTextOfTextfield(objName,x,newText) { //v3.0
	var obj = MM_findObj(objName); if (obj) obj.value = newText;
}


function MM_validateField(val, test, nm) 
	{ //v4.0

	var p,q,num,min,max,errors=''
	if (val=="") errors = '- '+nm+' requires a value.\n'; 

	if (val!="") 
		{
		if (test.indexOf('isEmail')!=-1) 
			{ 
			p=val.indexOf('@');
			if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain a valid e-mail address.\n';
		} else if (test!='R') 
			{ 
			num = parseFloat(val);
			if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
			if (test.indexOf('inRange') != -1) { 
				p=test.indexOf(':');
				min=test.substring(8,p); 
				max=test.substring(p+1);
				if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
			}
		}
	} else if (
		test.charAt(0) == 'R') errors += '- '+nm+' requires a value.\n'; 
	
	return errors;

}	

function SubmitFormIndex(aform)
	{
					
		// Defaults
		if (aform.Contact.value == "")
			{
				alert("Please Supply your name");
				aform.Contact.focus();
				return false;
			}

		if (aform.Email.value == "")
			{
				alert("Please Supply your Email Address");
				aform.Email.focus();
				return false;
			}


		if (MM_validateField(aform.Email.value, "isEmail", "Email") !="")
			{
				alert("Email address entered is missing or invalid");
				aform.Email.focus();
				return false;
			}
}
function SubmitForm(aform)
	{
		// Build Full Name
		aform.Contact.value = aform.FirstName.value + " " + aform.LastName.value;
		// Defaults
		if (aform.FirstName.value == "")
			{
				alert("Please Supply your First name");
				aform.FirstName.focus();
				return false;
			}
			
		if (aform.LastName.value == "")
			{
				alert("Please Supply your Last name");
				aform.LastName.focus();
				return false;
			}
		if (aform.Email.value == "")
			{
				alert("Please Supply your Email Address");
				aform.Email.focus();
				return false;
			}


		if (MM_validateField(aform.Email.value, "isEmail", "Email") !="")
			{
				alert("Email address entered is missing or invalid");
				aform.Email.focus();
				return false;
			}
}

