// Author: Peter A. Toukhanian// 2005-02-13// Copyright 2005, Peter A. Toukhanianfunction trimString(str) {  str = this != window ? this : str;  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');}function replaceBadChars(str) {  str = this != window ? this : str;  return str.replace(/\s+/g, '.');}// The dynamicContent function allows dynamic updating of the page without// a reload. This is the WC3 DOM replacement of innerHTML.// original source -> http://wsabstract.com/javatutors/dynamiccontent4.shtmlfunction dynamicContent(elementid,content) {  if (!document.getElementById)	  return;		  rng = document.createRange();  el = document.getElementById(elementid);  rng.setStartBefore(el);  htmlFrag = rng.createContextualFragment(content);		  while (el.hasChildNodes())    el.removeChild(el.lastChild);			  el.appendChild(htmlFrag);}function generateMemberName(firstName,lastName,dup) {  // Note that we convert everything to lower case so that we don't have to deal with  // lousy typing or trying to correctly capitalize complex names.  // Is this member's name unique?  if (dup == 0) {	  memberName = firstName+" "+lastName;	} else {	  memberName = firstName+" "+lastName+" "+dup;	}	  return memberName.toLowerCase();}function validateEmailAddress(emailAddress,displayAlert) {  emailAddress.value = trimString(emailAddress.value);    // re = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,6})+$/  // expression below is from http://www.regexlib.com/	// by Carlos R. L. Rodrigues	  re = /^\w+(\-|\.|_)?\w+\@[A-z\d]+\-?[A-z\d]+\.[A-z\d]{2,}$/  if (re.test(emailAddress.value)) {    return true;  }	  if (displayAlert)    alert("["+emailAddress.value+"] is not a valid email address.");		  return false;}// The difference between check and validate is that check will validate only if not blank.function checkEmailAddress(emailAddress,displayAlert){	if (emailAddress.value == "") {	  return true;	}		return validateEmailAddress(emailAddress,displayAlert)}function validateUrl(url,displayAlert) {  url.value = trimString(url.value);  re = /^(file:\/\/\/|http:\/\/|https:\/\/|www.)\w+(\/\w+|.\w{2,6})+$/	  if (re.test(url.value)) {    return true;  }	  if (displayAlert)    alert("["+url.value+"] is an invalid URL");		  return false;}// The difference between check and validate is that check will validate only if not blank.function checkUrl(url,displayAlert){	if (url.value == "") {	  return true;	}		return validateUrl(url,displayAlert)}function generateEmailAddress(firstName,lastName,dup) {  // Is this member's name unique?	  if (dup == 0) {    emailAddr = firstName.toLowerCase()+"."+lastName.toLowerCase()+"@manoogian.info";	} else {    emailAddr = firstName.toLowerCase()+"."+lastName.toLowerCase()+"."+dup+"@manoogian.info";	}  emailAddr = replaceBadChars(emailAddr);	return emailAddr;}function validateName(nameField,displayAlert) {  nameField.value = trimString(nameField.value);    // note that the first character must be upper case  // we accept hyphenated names and names with spaces.  // re = /^[A-Z][a-zA-Z]+(\-|\s)?([A-Z][a-zA-Z])*$/  // re = /^[A-Z][a-zA-Z]+(\-|\s)?[A-Z][a-zA-Z]*$/  // re = /^[A-Z][a-zA-Z]+([-]|[ ])?[A-Z][a-zA-Z]*$/  // re = /^[A-Z][a-zA-Z]+/  re = /^[A-Z][a-zA-Z]+([\-\ ][A-Z][a-zA-Z]+)*$/    if (re.test(nameField.value)) {    // alert("["+nameField.value+"] is a valid name")  // -td    return true  }  if (displayAlert) {    alert("["+nameField.value+"] is an invalid name");	  // nameField.focus()  // don't do as this is very buggy with different browsers.	}	  return false;}// The follow checkDate() function originally from -> http://www.csua.berkeley.edu/~jgwang/jsfunc02.htmfunction checkDate(smsg,iday,imonth,iyear) {  months = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");  var myDateStr = months[imonth-1] + ' ' + iday + ' ' + iyear;  var myDate = new Date(iyear,imonth-1,iday);  // Convert the date to a string so we can parse it.	  var myDate_string = myDate.toString();  // Split the string at every space and put the values into an array so, using the previous	// example, the first element in the array is "Wed", the second element is "Jan", the third	// element is "1", etc.	  var myDate_array = myDate_string.split( ' ' );  // If we entered "Feb 31, 1975" in the form, the "new Date()" function converts the value to	// "Mar 3, 1975". Therefore, we compare the month in the array with the month we entered into	// the form. If they match, then the date is valid, otherwise, the date is NOT valid.  if ( myDate_array[1] != months[imonth-1]) {    alert( 'I\'m sorry, but ' + smsg + ' [' + myDateStr + '] is NOT a valid date.' );		return false;  } else {    // alert( 'Congratulations! "' + myDateStr + '" IS a valid date.' );  }		return true;}// Have to resort to a global because Javascript is such: a F()*#$ing retarded, kludge.var g_FormSubmitCancelled = false;function validateStartEndDates(dateForm) {	// alert('validateStartEndDates()');  // -td		// checks beginning and end dates.	if (g_FormSubmitCancelled == true)   // don't bother to check	  return true;		var vstartDate = checkDate("the start date",dateForm.start_date_dd.value,dateForm.start_date_mm.value,dateForm.start_date_yyyy.value);		if (vstartDate == false)	  return vstartDate;		  return checkDate("the end date",dateForm.end_date_dd.value,dateForm.end_date_mm.value,dateForm.end_date_yyyy.value);}// 2005-05-28, Added - PAT// 2005-07-30, Added - PAT// Reference DHTML and CSS for the World Wide Web 3rd ed by Jason Cranford Teague pp. 333-334// I had to resort to JavaScript because IE 6.0's support for CSS is so horrible.              function setClass(object,newCSSclass) {  object.className = newCSSclass;}
