function check_mailadress(this_amailadress)
{
	 if(this_amailadress != "")
	 {
	 	var email = this_amailadress;
		var blanks = " "*100;
		var naughty = new Array("arse","bastard","cunt","fuck","shit","wanker","piss","twat");
		var sneaky = email.toLowerCase();
		var illegal = "You have entered illegal characters.\nOnly characters listed here allowed.\n\nLetters of Alphabet [lower and upper case]\nNumbers\nOne @ symbol only\nFull stops\nHyphens [Minus sign]\nUnderscores\n\n";
		if (email <= blanks)
		{
		  alert("Please enter your e-mail address.");
		  return false;
		}
		else if (email.length > 62)
		{
		   alert('Max character length for any e-mail address is 63.');
		   return false;
		}
		else if (email.charAt(0) == " ")
		{
		   alert('You have typed a space at the - START - of your e-mail address');
		   return false;
		}
		else if (email.charAt(email.length-1) == " ")
		{
		   alert('You have typed a space at the - END - of your e-mail address');
		   return false;
		}
		else if (email.indexOf(" ") !=-1)
		{
		   alert('You have typed a space - IN - your e-mail address');
		   return false;
		}
		//CHECK FOR ILLEGAL CHARACTERS 1
		for (i=0; i < email.length; i++)
		{
			var caps = "a".toUpperCase();
			var E = email.substring(i, i + 1);
			if ((E < "0" || "9" < E ) && E != "@"  && E !="." && E !="-"  && E !="_"  &&  E < caps || "z" < E)
			{
				 alert(illegal);
				 return false;
			}
		}
		//CHECK FOR ILLEGAL CHARACTERS 2
		if ((email.indexOf('`',0) != -1) || (email.indexOf(String.fromCharCode(94)) != -1) || (email.indexOf(String.fromCharCode(92)) != -1) || (email.indexOf('[',0) != -1) || (email.indexOf(']',0) != -1))
		{
			 alert(illegal);
			 return false;
		}
		//CHECK FOR SWEARING
		for (i=0; i < email.length; i)
		{
			 if (sneaky.indexOf(naughty[i]) != -1)
			 {
				 alert('Please remove the swear word - '+naughty[i].toUpperCase());
				 return false;
			 }
			i++;
		}
		if (email.charAt(0) ==".")
		{
			alert('An e-mail address cannot start with a full stop');
			return false;
	   }
	   else if (email.split('@').length > 2)
	   {
			alert('Only 1 @ allowed in e-mail address.');
			return false;
	   }
	   else if (email.indexOf ('@',0) == -1)
	   {
			alert("The @ symbol is missing");
			return false;
	   }
	   else if (email.indexOf("@") < 2)
	   {
			alert("There must be at least 2 characters before @ symbol.");
			return false;
	   }
	   else if (email.charAt(email.length-1) == "@")
	   {
			alert('An e-mail address cannot finnish with @');
			return false;
	   }
	   else if (email.indexOf ('.') == -1)
	   {
			alert("An e-mail address must contain at least 1 full stop");
			return false;
	   }
	   else if (email.indexOf('.',email.indexOf('@')) == -1)
	   {
			alert('The full stop after the @ is missing');
			return false;
	   }
	   else if (email.substring(email.indexOf('@'),email.length).indexOf(".") < 4)
	   {
			alert('There must be at least 3 characters between @ and following full stop');
			return false;
	   }
	   else if (email.lastIndexOf(".")+2 == email.length)
	   {
			alert('There must be at least 2 characters after last full stop');
			return false;
	   }
	   else if (email.substring(email.lastIndexOf("."),email.length).length > 4)
	   {
			alert('Only 3 characters allowed after last full stop');
			return false;
	   }
	   else if (email.charAt(email.length-1) ==".")
	   {
			alert('An e-mail address cannot finnish with a full stop');
			return false;
	   }
	   return true;
	}
	else
	{
		alert('Please enter a e-mail address');
		return false;		
	}		
}
function chkblk(_temp)
{
	if(_temp*100 == "")
		return false;
	else
		return true;	
}	
function checkValidate()
{
	if(!chkblk(document.frm.ac_no.value))
	{
		alert("Please enter account number");
		document.frm.ac_no.focus();
		return false;
	}
	if(isNaN(document.frm.ac_no.value))
	{
		alert("Please enter correct account number");
		document.frm.ac_no.focus();
		return false;
	}
	if(!chkblk(document.frm.email.value))
	{
		alert("Please enter e-mail address");
		document.frm.email.focus();
		return false;
	}
	if(check_mailadress(document.frm.email.value)==false)
		{
			document.frm.email.focus();
			return false;
		}	
	if(!chkblk(document.frm.passwd.value))
	{
		alert("Please enter password");
		document.frm.passwd.focus();
		return false;
	}
 }


