function  backcolorout(me)
{
	me.style.backgroundColor="#7db0c6";
}
function  backcolorover(me)
{
	me.style.backgroundColor="#AAE9EE";
}
function emailcheck(txtbox) 
	{
		var emailStr=txtbox.value;

		var FormData=document.frm
		var dot=0
		var at2=0
		var at
		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=emailStr.match(emailPat)
		if (matchArray==null) 
		{
			alert("Email address seems incorrect (check @ and .'s)")
			txtbox.focus();
			error=0;
			return false
		}
		var user=matchArray[1]
		var domain=matchArray[2]
		if (user.match(userPat)==null) 
		{
			alert("The username doesn't seem to be valid.")
			txtbox.focus();
			error=0;
			return false
		}

		var IPArray=domain.match(ipDomainPat)

		if (IPArray!=null) 
		{
			for (var i=1;i<=4;i++) 
			{
				if (IPArray[i]>255) 
				{
					alert("Destination IP address is invalid!")
					txtbox.focus();
					error=0;
					return false
				}
			}
			return true
		}

		var domainArray=domain.match(domainPat)

		if (domainArray==null) 
		{
			alert("The domain name doesn't seem to be valid.")
			txtbox.focus();
			error=0;
			//document.frmsubscribe.txtemail.focus();
			return false;
		}

		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("The address must end in a three-letter domain, or two letter country.")
			txtbox.focus();
			error=0;
			return false;
		}

		if (len<2) 
		{
			var errStr="This address is missing a hostname!"
			alert(errStr)
			txtbox.focus();
		return false;
		}
	return true;	
	}
	
	function Checktxtbox(txtB)
	{
		var str,lnth,chrCode,nStr

		str = txtB.value
		lnth = str.length
		nstr=""

		for(i=0;i<lnth;i++)
		{
			chrCode=str.charCodeAt(i)
		
			if((chrCode==34) ||(chrCode==39))
			{
				alert("\' and \"  charcter are not allowed.")
				txtB.focus();
			    return false;
			}
		}
     return true;
	}
	function Trim (ns)
	{
		s=ns.value;
		//trim lefthand spaces
		var i=0;
		while(s.charAt(i)==' ')
		i++;
		s=s.substring(i,s.length);
		//trim righthand spaces
		if (s.length > 0) 
		{
			while(''+s.charAt(s.length-1)==' ') 
			s = s.substring(0,s.length-1);
			ns.value=s;
		}
		else
		{	ns.value=s; }
	return ns;	
	
	}
	
	function validateemail(frm)
	{
	 if (Trim(frm.name).value=="" )
	     {
		   frm.name.focus();
		   alert("Enter your Name.")
		   return false;
		 }
		 if (Trim(frm.address).value=="" )
	     {
		   frm.address.focus();
		   alert("Enter your Address.")
		   return false;
		 }

	 if (Trim(frm.phone).value=="" )
	     {
		   frm.phone.focus();
		   alert("Enter your Phone No.")
		   return false;
		 }
	 if (Trim(frm.comments).value=="" )
	     {
		   frm.comments.focus();
		   alert("Enter your Comments.")
		   return false;
		 }

		 
	}

