
function verifyRequired() {  if (document.ptwsignup["FNAME"].value == "") {    document.ptwsignup["FNAME"].focus();    alert("Please enter your First Name.");    return false;  }  if (document.ptwsignup["LNAME"].value == "") {    document.ptwsignup["LNAME"].focus();    alert("Please enter your Last Name.");    return false;  }  if (document.ptwsignup["EMAIL"].value == "") {    document.ptwsignup["EMAIL"].focus();    alert("Please enter your Email address and check it for errors.  To finish registering, you will be required to click a confirmation link in a followup message sent to that address.");    return false;  }  if ((document.ptwsignup["HOMEPHONE"].value == "") && (document.ptwsignup["CELLPHONE"].value == "")) {    document.ptwsignup["HOMEPHONE"].focus();    alert("Please enter your Home Phone and/or your Mobile Phone #.");    return false;  } if (document.ptwsignup["TRAINING"].value.toUpperCase() == "SELECT COURSE") {    document.ptwsignup["TRAINING"].focus();    alert("Please enter the specific Course you'd like to attend.");    return false;  }     if (document.ptwsignup["REFERREDBY"].value == "") {    document.ptwsignup["REFERREDBY"].focus();    alert("Please enter who you were Referred By.");    return false;  }  return true;}// ==================== TRIM FUNCTIONS ====================
function trim( str )
{
    str = trimLeft( str );
    str = trimRight( str, " " );
   
    return str;
}


function trimLeft( str )
{
    var chIndex = 0;
    var ch;
   
    while ( chIndex < str.length )
    {
        ch = str.charAt( chIndex );
       
        if ( ch != " " )
        {
            break;
        }
       
        chIndex++;
    }
   
    return str.substring( chIndex, str.length );
}

      
function trimRight( str, charsToTrim )
{
    var chIndex = str.length - 1;
    var ch;
   
    while ( chIndex >= 0 )
    {
        ch = str.charAt( chIndex );
       
        if ( charsToTrim.indexOf( ch ) == -1 )
        {
            break;
        }
       
        chIndex--;
    }
   
    return str.substring( 0, chIndex + 1 );
}


function trimAround( str, ch )
{
    var strList = str.split( ch );
   
    if ( strList.length > 1 )
    {
        for ( var strListIndex = 0; strListIndex < strList.length; strListIndex++ )
        {
            strList[ strListIndex ] = trim( strList[ strListIndex ] );
        }

        return strList.join( ch );
    }
    else
    {
        return str;
    }
}

function isEmailAddr(email)
{
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0)
  {
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}