/******************************************
 * clnt_password_check()
 *
 * This function checks the clnt_password.asp
 * file to make certain the information is 
 * filled out properly.
 *
 * Its requirements are that the new
 * password fields are the same, that they
 * are more than 6 characters long, and 
 * contain only numbers and letters.
 *
 * 2000-11-16 Matt Borland, B-Swing, Inc.
 *
 ******************************************/

function clnt_password_check() {
  var oldpassword = document.theform.oldpassword.value;
  var newpassword = document.theform.newpassword.value;
  var newpassword2 = document.theform.newpassword2.value;

  //var reg = /^[A-Za-z0-9]+$/;

  // hxluo 12/22/2009 changed according to new requirement
  var reg = /^(?=.{7,})(((?=.*[A-Za-z])(?=.*[0-9]))|((?=.*[A-Za-z])(?=.*\W))).*$/;

  if (
	newpassword.length > 6 
	&& newpassword == newpassword2 
	&& newpassword.match(reg)
	) {
	//alert ('good');
	document.theform.submit();
  } else {
    alert ('Please make sure that new password fields:\n    Are the same\n    Are at least 7 characters long or more\n    Contain letters and numbers or special characters');
  }

}






/******************************************
 * clnt_update_check()
 *
 * This function checks the clnt_update.asp
 * file to make certain the information is 
 * filled out properly.
 *
 * Its requirements are that the first and 
 * last name are filled out, and that the 
 * email field is formatted properly (or 
 * blank).
 *
 * 2000-11-16 Matt Borland, B-Swing, Inc.
 *
 ******************************************/

function clnt_update_check() {
  var firstname = document.theform.firstname.value;
  var lastname = document.theform.lastname.value;
  var emailaddress = document.theform.emailaddress.value;

  var reg = /^ +/;
  var reg2 = / +$/;
  var regEmail = /^[^@]+@[^@]+\.[^@]+$/;

  firstname = firstname.replace(reg,'').replace(reg2,'');
  lastname = lastname.replace(reg,'').replace(reg2,'');
  emailaddress = emailaddress.replace(reg,'').replace(reg2,'');

  if (
	
	firstname.length > 0 
	&& lastname.length > 0 
	&& ( emailaddress.match(regEmail) || emailaddress == '' )
	) {
	//alert ('good');
	document.theform.submit();
  } else {
    alert ('Please enter first name, last name, and a valid email address (\'joe@company.com\').');
  }

	

}


/******************************************
 * openEmailWindow (name, emailaddress) 
 *
 * This function simply opens up a new window
 * which locates to the standard 'contact person'
 * window, specifying the name and email of the
 * recipient.
 *
 * 2000-11-16 Matt Borland, B-Swing, Inc.
 *
 ******************************************/

function openEmailWindow (name, emailaddress) {
	name = name.replace(/ /, '+');
	window.open('../contact/cont_person.asp?name=' + name + '&emailaddress=' + emailaddress,'_blank','height=560,width=575,toolbar=0,scrollbars,resizable,menubar=1');
}



/******************************************
 * openExternalLink (url) 
 *
 * This function simply opens up a new window,
 * intended specfically for the 'Useful Links'
 * navigation item.
 *
 * 2000-11-16 Matt Borland, B-Swing, Inc.
 *
 ******************************************/

function openExternalLink (url) {
	window.open(url,'_blank','height=475,width=600,toolbar=0,scrollbars,resizable,menubar=1');
}