// these scripts loaded in the template: inc_page_begin.cfm

function firstFocus()	// causes cursor focus on first field in a form
{
   if (document.forms.length > 0)
   {
      var TForm = document.forms[0];
      for (i=0;i<TForm.length;i++)
      {
         if ((TForm.elements[i].type=="text")||
		   (TForm.elements[i].type=="password")||
           (TForm.elements[i].type=="textarea")||
           (TForm.elements[i].type.toString().charAt(0)=="s"))
         {
            document.forms[0].elements[i].focus();
            break;
         }
      }
   }
}

function checkPasswordMatch()
// used by register.cfm
{	var modeFieldExists = eval(document.myForm["mode"]);
	var newPasswordExists = eval(document.myForm["newPassword"]);
	
	if(modeFieldExists) {
		if(document.myForm["mode"].value == 'addnew' && (document.myForm["newPassword"].value == ''  || document.myForm["verifyPassword"].value == "")) {
			alert("Please Enter and Verify Password");
			return false;
		}
	}
	if(newPasswordExists) {
	    if(document.myForm["newPassword"].value != document.myForm["verifyPassword"].value) {
			alert("New Password and Verify Password\ndo not match.");
			return false;
		}
	}
	return true;
}