	<!--
	// See which radio button is selected and return its value
	function findValue(obj)
	{
	  var i, theValue;
	  theValue = null;  // null is return if no radio button
	                    // was clicked.

	  /* Radio buttons with the same name form an array.  The button
	     which is pressed will have the checked variable set to true. */

	  for (i=0;i<obj.length;i++)
	  {
	   if (obj[i].checked == true)
	   {
	     theValue = obj[i].value;
	     break;
	   }
	  }

	  return theValue;
	}
	var errorFieldDefaultClass='';
	function validateForm(oForm)
	{
		// var ok2go=1;
		var errMsg='';
		var ok2go=1;

		// RESET ALL FORM FIELD CLASSES
		if(document.all || document.getElementById){
			for(var i=0; i<oForm.length; i++){
				if(oForm.elements[i].className){
					if(oForm.elements[i].className=='errorField'){
						oForm.elements[i].className=errorFieldDefaultClass; // RECALL THE DEFAULT CLASS OF THIS ERROR FIELD
					}
				}
			}
		}
		// VALIDATE REQUIRED FIELDS
		if(oForm.profilePrefix.value==''){
			throwError(oForm.profilePrefix,'A salutation is required.');
			return false;
		}
		if(oForm.profileFName.value.length==0){
			throwError(oForm.profileFName,'First Name is required.');
			return false;
		}
		if(oForm.profileLName.value.length==0){
			throwError(oForm.profileLName,'Last Name is required.');
			return false;
		}
		if(oForm.username.value.length==0){
			throwError(oForm.username,'User Name is required.');
			return false;
		}
		if(oForm.password.value.length==0){
			throwError(oForm.password,'Password is required.');
			return false;
		}
		if(oForm.confirmpassword.value.length==0){
			throwError(oForm.confirmpassword,'Please confirm Password.');
			return false;
		}
		if(oForm.confirmpassword.value!=oForm.password.value){
			throwError(oForm.confirmpassword,'Password and the confirmation password do not match.');
			return false;
		}
		var myType = findValue(oForm.role);
		if(myType== undefined){
			throwError(oForm.role[0],'The role selection is required');
			return false;
		}
		if(oForm.orgid.value.length==0){
			if(oForm.organization.value.length==0)
			{
				throwError(oForm.organization,'Please either choose the organization from the list or enter the your organization in the other.');
				return false;
			}

		}
		if(oForm.address1.value.length==0){
			throwError(oForm.address1,'Address is required.');
			return false;
		}
		if(oForm.city.value.length==0){
			throwError(oForm.city,'City is required.');
			return false;
		}
		if(oForm.countryid.value.length==0){
			throwError(oForm.countryid,'Country is required.');
			return false;
		}
		else if (oForm.countryid.value=='US'){
			if(oForm.stateid.value.length==0)
			{
				throwError(oForm.stateid,'State is required.');
				return false;
			}
			if(oForm.zip.value.length==0)
			{
				throwError(oForm.zip,'Zip code is required.');
				return false;
			}
		}
		if(oForm.phone.value.length==0){
			throwError(oForm.phone,'Phone is required.');
			return false;
		}
		if(oForm.email.value.length==0){
			throwError(oForm.email,'Email is required.');
			return false;
		}
		var myGender = findValue(oForm.profileGender);
		if(myGender== undefined){
			throwError(oForm.profileGender[0],'The gender selection is mandatory.');
			return false;
		}
		return true;
	}


	function throwError(thefield,errMsg){
		alert(errMsg);
		if(document.all || document.getElementById){
			if(thefield.className){
				errorFieldDefaultClass=thefield.className; //SAVE THE DEFAULT CLASS OF THIS FIELD IN A GLOBAL VARIABLE
				thefield.className='errorField';
			}
			else{
				errorFieldDefaultClass=''; //SAVE THE DEFAULT CLASS OF THIS FIELD IN A GLOBAL VARIABLE
				thefield.className='errorField';
			}
		}
		thefield.focus();
		return;
	}
	// -->
