// Validates cEmail Id and returns false on success, true on Error
/*function trim(strText)
{
	var regExp1 = new RegExp("^(\s*)([\W\w]*)(\b\s*$)")
  strText = strText.replace(regExp1, "$2");
	return strText;
}*/
/*function trim(strText)
{
	strText = new String(strText)
	strText = strText.replace(/^\s*(.*)/, "$1");
	strText = strText.replace(/(.*?)\s*$/, "$1");
	return strText;
}*/

function trim(strText)
{
	strText = new String(strText)
	strText = strText.replace(/^\s*(.*)/, "$1");
	strText = strText.replace(/(.*\?)\s*$/, "$1");
	return strText;
}

function doIsEmail(strEmail,strForm)
{
	strEmail = trim(strEmail);
	// The code below will cause DREAMWEAVER source code colouring to display as error 
	// There is NO ERROR in the following code. PLEASE DO NOT CHANGE
  var strFilter= /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
	if (strFilter.test(strEmail))
	{
		boolResult = true
	}
	else
	{
		alert("Invalid Email Id");
		eval("document." + strForm).EmailID.focus();
		boolResult = false
	}
	return boolResult
}

/*function doIsEmail(strEmail,strForm)
{
var emailPat=/^(.+)@(.+)$/
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]'"
var validChars="\[^\\s" + specialChars + "\]"
var quotedUser="(\"[^\"]*\")"
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
var atom=validChars + '+'
var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=strEmail.match(emailPat)
	if (matchArray==null) {
		alert("Invalid Email Id");
		eval("document." + strForm).EmailID.focus();
		return false;
	}
var user=matchArray[1]
var domain=matchArray[2]
if (user.match(userPat)==null) {
    alert("Invalid Email Id");
	eval("document." + strForm).EmailID.focus();
    return false;
}
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		// this is an IP address
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				alert("Invalid Email Id");
				eval("document." + strForm).EmailID.focus();
			return false;
			}
		}
		return true;
	}
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("Invalid Email Id");
	eval("document." + strForm).EmailID.focus();
    return false;
}
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	if (domArr[domArr.length-1].length<2 || 
		domArr[domArr.length-1].length>4) {
	alert("Invalid Email Id");
	eval("document." + strForm).EmailID.focus();
	return false;
	}
var len=domArr.length	
if (len<2) {
   alert("Invalid Email Id");
   eval("document." + strForm).EmailID.focus();
   return false;
}
return true;
}*/