function BackFunction()
	{
		history.back();
	}
	
function validate_input()
{
	var validate = false;

	validate = CheckNull('txtfirst', 'First Name');

	if(!validate)
	{	
		return validate;
	}
	
	validate = CheckNull('txtlast', 'Last Name');
	
	if(!validate)
	{	
		return validate;
	}
	
	validate = CheckNumber('txtphone','Telephone');
	
	if(!validate)
	{	
		return validate;
	}
	
	validate = CheckNumber('txtphone2','Telephone');

	if(!validate)
	{	
		return validate;
	}
	
	validate = CheckNumber('txtphone3','Telephone');

	if(!validate)
	{	
		return validate;
	}
	
	validate = CheckEmail('txtemail');

	if(!validate)
	{	
		return validate;
	}
	
	validate = CheckNull('txtdetails', 'Additional details');

	if(!validate)
	{	
		return validate;
	}	
	
	function CheckNull(objID, msg){

	var obj=document.getElementById(objID);

	var text = obj.value;

	text = text.replace(/^\s*|\s*$/g,"");

	if ((text==null)||(text=="")){

		alert(msg + " cannot be empty.")

		obj.focus()

		return false

	}
	
	return true;

	}
	
	function CheckNumber(objID, msg){

	var obj=document.getElementById(objID);

	var text = obj.value;

	text = text.replace(/^\s*|\s*$/g,"");

	if(isNaN(text)){
		
		alert(msg + " should are numbers.")
		
		obj.value = "";
		
		obj.focus()

		return false

		}

	return true;

	}
	
	function echeck(str) {



	var at="@"

	var dot="."

	var lat=str.indexOf(at)

	var lstr=str.length

	var ldot=str.indexOf(dot)

	if (str.indexOf(at)==-1){

	   alert("Invalid Email address.");

	   return false

	}



	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

	   alert("Invalid Email address.");

	   return false

	}



	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

		alert("Invalid Email address.");

		return false

	}



	 if (str.indexOf(at,(lat+1))!=-1){

		alert("Invalid Email address.");

		return false

	 }



	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

		alert("Invalid Email address.");

		return false

	 }



	 if (str.indexOf(dot,(lat+2))==-1){

		alert("Invalid Email address.");

		return false

	 }

	

	 if (str.indexOf(" ")!=-1){

		alert("Invalid Email address.");

		return false

	 }



	 return true					

	}
	
	function CheckEmail(email){

	var emailID=document.getElementById(email);

	var text = emailID.value;

	text = text.replace(/^\s*|\s*$/g,"");

	

	if ((text==null)||(text=="")){

		alert("Email address cannot be empty.")

		emailID.focus()

		return false

	}

	if (echeck(text)==false){

		emailID.value=""

		emailID.focus()

		return false

	}

	return true

	}
}