function fnVisualAid(obj,style) {
	if ((document.all)||(document.getElementById)) {
		if(style==-1)
			obj.style.backgroundColor = '#FFFF66'; //#99FFFF //#00D5D5
		else
			obj.style.backgroundColor = '#FFFFFF';
	}		
}

function fnEmailCheck (s) {
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var firstChars=validChars
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom="(" + firstChars + validChars + "*" + ")"
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")

	// Check character pieces
	var matchArray=s.match(emailPat)
	if (matchArray==null) {
		alert('Invalid Email Address\n\nYour Email address seems incorrect (check @ and .\'s)')
		return false
	}

	// Check user is valid
	var user=matchArray[1]
	var domain=matchArray[2]
	if (user.match(userPat)==null) {
        alert('Invalid Email Address\n\nYour Email username doesn\'t seem to be valid!')
    	return false
	}

	// If address is at an IP address make sure IP address is valid
	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
    	for (var i=1;i<=4;i++) {
	    	if (IPArray[i]>255) {
	    	    alert('Invalid Email Address\n\nYour Email destination IP address is invalid!')
			return false
		    }
	    }
    	return true
	}

	// Check domain name
	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
		alert('Invalid Email Address\n\nYour Email domain name doesn\'t seem to be valid.')
	    return false
	}

	// Make sure end of domain name ends in a three-letter word (like com, edu, gov)
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) {
		alert('Invalid Email Address\n\nYour Email address must end in a three-letter domain, or two letter country.')
	   return false
	}

	// If domain is a country, insure there are at least 2 atoms preceding it (i.e. com, gov, etc.)
	if (domArr[domArr.length-1].length==2 && len<3) {
	   alert('Invalid Email Address\n\nYour Email address ends in two characters, which is a country code.\nCountry codes must be preceded by a hostname and category (like com, co, org, uk, etc.)')
	   return false
	}

	// If domain is not a country, insure there a host name
	if (domArr[domArr.length-1].length==3 && len<2) {
	   alert('Invalid Email Address\n\nYour Email address is missing a hostname!')
	   return false
	}

	// Return valid address
	return true;
}