function validate()
{

	var oName = document.getElementById("e_name");
	var text=oName.value;
	if(text=='')
	{
		alert('Missing user name');
		oName.focus();
		oName.select();
		return false;
	}

	var oPwd = document.getElementById("e_pwd");
	text=oPwd.value;
	if(text=='')
	{
		alert('Missing password');
		oPwd.focus();
		oPwd.select();
		return false;
	}
	var oPwd2 = document.getElementById("e_pwd2");
	var text2=oPwd2.value;
	if(text2=='')
	{
		alert('Missing confirm password');
		oPwd2.focus();
		oPwd2.select();
		return false;
	}
	if(text!=text2)
	{
		alert('Password and Confirm password must be identical');
		oPwd.focus();
		oPwd.select();
		return false;
	}
	return emailCheck();
	


}


function emailCheck()
	{
  		var oEmailBox = document.getElementById("e_email");
		var text=oEmailBox.value;

		if (text.indexOf('@') == -1)
		{
			alert('Invalid email address');
			oEmailBox.focus();
			oEmailBox.select();
			return false;
		}
		if (text.indexOf('.') == -1)
		{
			alert('Invalid email address');
			oEmailBox.focus(); 
			oEmailBox.select(); 
			return false; 
		} 
		if ((text.length-text.lastIndexOf('.'))>4 || (text.length-text.lastIndexOf('.'))<2) 
		{ 
			alert('Invalid email address'); 
			oEmailBox.focus(); 
			oEmailBox.select(); 
			return false; 
		} 
		if (text.indexOf('.')==text.indexOf('@')+1) 
		{ 
			alert('Invalid email address'); 
		  	oEmailBox.focus(); 
			oEmailBox.select(); 
			return false; 
		} 
		return true; 
	}
