// JavaScript Document
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function Trim(strInput) {
    /* Check to see if the length of the input string is zero. */
    if(strInput.length == 0) {
        /* If the length is zero, return a zero length sting. */
        return "";
    }
    else {
        /* If the length is greater than zero, find out what the
           last character in the string is */
        strTemp = strInput.substring(strInput.length - 1)
    }

    /* If the last character is a space, trim it from the string */
    while (strTemp == " ") {
        /* Set the input string equal to the input sting, minus the last charater */
        strInput = strInput.substring(0, strInput.length - 1)

        /* Check to see if the string has a zero length again. */
        if (strInput.length == 0) {
            /* If the length is zero, return a zero length sting. */
            strTemp = "";
        }
        else {
            /* If the length is greater than zero, find out what the
               last character in the string is */
            strTemp = strInput.substring(strInput.length - 1)
        }
    }
	
    /* Do the same thing, but for the beginning of the string */
    if (strInput.length == 0) {
        strTemp = "";
    }
    else {
        strTemp = strInput.substring(0, 1)
    }
		
    while (strTemp == " ") {
        strInput = strInput.substring(1)
			
        if (strInput.length == 0) {
            strTemp = "";
        }
        else {
            strTemp = strInput.substring(0, 1)
        }
    }
    return strInput;
}


<!-- Original:  Sandeep V. Tamhankar (stamhankar@hotmail.com) -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function emailCheck(addr) {

var man,db;
man = 1;
db = 1;
addr = Trim(addr);

if (addr == '' && man) 
{

			if (db) alert('email address is mandatory');
			return false;
			}

			var invalidChars = '\/\'\\ ";:?!()[]\{\}^|';

			for (i=0; i<invalidChars.length; i++) {
			if (addr.indexOf(invalidChars.charAt(i),0) > -1) {
				if (db) alert('email address contains invalid characters');
				return false;
			}
			}
			for (i=0; i<addr.length; i++) {
			if (addr.charCodeAt(i)>127) {
				if (db) alert("email address contains non ascii characters.");
				return false;
			}
			}

			var atPos = addr.indexOf('@',0);
			if (atPos == -1) {
			if (db) alert('email address must contain an @');
			return false;
			}
			if (atPos == 0) {
			if (db) alert('email address must not start with @');
			return false;
			}
			if (addr.indexOf('@', atPos + 1) > - 1) {
			if (db) alert('email address must contain only one @');
			return false;
			}
			if (addr.indexOf('.', atPos) == -1) {
			if (db) alert('email address must contain a period in the domain name');
			return false;
			}
			if (addr.indexOf('@.',0) != -1) {
			if (db) alert('period must not immediately follow @ in email address');
			return false;
			}
			if (addr.indexOf('.@',0) != -1){
			if (db) alert('period must not immediately precede @ in email address');
			return false;
			}
			if (addr.indexOf('..',0) != -1) {
			if (db) alert('two periods must not be adjacent in email address');
			return false;
			}
			var suffix = addr.substring(addr.lastIndexOf('.')+1);
			if (suffix.length != 2 && suffix != 'com' && suffix != 'net' && suffix != 'org' && suffix != 'edu' && suffix != 'int' && suffix != 'mil' && suffix != 'gov' & suffix != 'arpa' && suffix != 'biz' && suffix != 'aero' && suffix != 'name' && suffix != 'coop' && suffix != 'info' && suffix != 'pro' && suffix != 'museum') {
			if (db) alert('invalid primary domain in email address');
			return false;
			}
			return true;
}

