		function isEmail(str) {
		  // are regular expressions supported?
		  var supported = 0;
		  if (window.RegExp) {
		    var tempStr = "a";
		    var tempReg = new RegExp(tempStr);
		    if (tempReg.test(tempStr)) supported = 1;
		  }
		  if (!supported) 
		    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
		  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
		  return (!r1.test(str) && r2.test(str));
		}

		function isNumeric(sText)
		{
		   var ValidChars = "0123456789.";
		   var IsNumber=true;
		   var Char;
		
		 
		   for (i = 0; i < sText.length && IsNumber == true; i++) 
		      { 
		      Char = sText.charAt(i); 
		      if (ValidChars.indexOf(Char) == -1) 
		         {
		         IsNumber = false;
		         }
		      }
		   return IsNumber;
		   
		}


		function checkRequiredField(oField,sErrorText,oForm){
			if(oField.value==""){
				if(oForm.isNoError){
					if(sErrorText!="")
						alert(sErrorText);
					else
						alert(oField.name + " cannot be empty...");
					oField.focus();
				}
				oForm.isNoError=false;
			}
		}

		function checkEmailField(oField,sErrorText,oForm){
			if(!isEmail(oField.value)){
				if(oForm.isNoError){
					if(sErrorText!="")
						alert(sErrorText);
					else
						alert(oField.name + " must be a valid email address...");
					oField.focus();
				}
				oForm.isNoError=false;
			}
		}

		function checkDuplicateField(oField,oOriginalField,sErrorText,oForm){
			if(oField.value!=oOriginalField.value){
				if(oForm.isNoError){
					if(sErrorText!="")
						alert(sErrorText);
					else
						alert(oField.name + " is not identical to " + oOriginalField.name + "...");
					oField.focus();
				}
				oForm.isNoError=false;
			}
		}

		function checkPasswordField(oField,iLength,sErrorText,oForm){
			if((oField.value.length < iLength) || (oField.value.indexOf("'")>0)){
				if(oForm.isNoError){
					if(sErrorText!="")
						alert(sErrorText);
					else
						alert(oField.name + " must be a valid password\n\nIt must be at least " + iLength + " characters\nAnd it cannot contain single quotes ( = ' )");
					oField.focus();
				}
				oForm.isNoError=false;
			}
		}
		
		function checkExactLengthField(oField,iLength,sErrorText,oForm){
			if((oField.value.length != iLength)){
				if(oForm.isNoError){
					if(sErrorText!="")
						alert(sErrorText);
					else
						alert(oField.name + " must be exactly " + iLength + " characters");
					oField.focus();
				}
				oForm.isNoError=false;
			}
		}

		function checkAllNumbersField(oField,sErrorText,oForm){
			if(!isNumeric(oField.value)){
				if(oForm.isNoError){
					if(sErrorText!="")
						alert(sErrorText);
					else
						alert(oField.name + " can contain only numeric characters");
					oField.focus();
				}
				oForm.isNoError=false;
			}
		}
