// JavaScript Document
function Form1_Validator(theForm)
{
  var alertsay = "";
		if (theForm.user_password) {
			if (theForm.user_password.value == '') {
				alert("Please enter a password");
				theForm.user_password2.focus();
				return (false);
			} else if (theForm.user_password.value != theForm.user_password2.value)
			{
				alert("The two passwords are not the same.");
				theForm.user_password2.focus();
				return (false);
			}
		}
		
		if (theForm.uploadfileswf) {
			if(theForm.uploadfileswf.value != "") {
				if(theForm.uploadfileswf.value.lastIndexOf(".swf")==-1) {
					alert("Please upload only .swf extention file");	 
					theForm.uploadfileswf.focus();
					return (false);
				}
			}
		}
		
		if (theForm.uploadfilepdf) {
			if(theForm.uploadfilepdf.value != "") {
				if(theForm.uploadfilepdf.value.lastIndexOf(".pdf")==-1) {
					alert("Please upload only .pdf extention file");	 
					theForm.uploadfilepdf.focus();
					return (false);
				}
			}
		}
		
		if (theForm.email) {
			if (theForm.email.value == '') {
				alert("Please enter a valid email");	 
				theForm.email.focus();
				return (false);
			}
			var sp = theForm.email.value.split('@');
			if (sp.length != 2) {
				alert("Please enter a valid email");	 
				theForm.email.focus();
				return (false);
			} else {
				var sp2 = sp[1].split('.');
				if (sp2.length < 2) {
					alert("Please enter a valid email");	 
					theForm.email.focus();
					return (false);
				}
			}
		}
		
		if (theForm.fname) {
			if (theForm.fname.value == '') {
				alert("Please enter a first name");	 
				theForm.fname.focus();
				return (false);
			}
		}
		
		if (theForm.lname) {
			if (theForm.lname.value == '') {
				alert("Please enter a last name");	 
				theForm.lname.focus();
				return (false);
			}
		}

  return (true);
}
