	function isnull(str)	
	{
		str = rtrim(ltrim(str))
		if ( (str.length = 0) || ( str == ""))
			return true;
		else			
			return false;
	}

	function ltrim(field_name)
	{
		pos = field_name.indexOf(" ")
		while (pos == 0) 
		{ 
			field_name = field_name.substring(1)
			pos = field_name.indexOf(" ")
		}
		return field_name
	}

	function  rtrim(field_name)
	{
	    len = field_name.length
	    blank = field_name.charAt(len-1)
	    while (blank == " " )
	    {
	      field_name = field_name.substring(0,len-1)
	      len=field_name.length
	      blank = field_name.charAt(len-1)
	    }
	    return field_name    
	}

	function IsValidEmailSyntax ( sEmail )
	{	 
		return ( sEmail.search( /\w+((-\w+)|(\.\w+)|(\_\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z]{2,5}/ ) != -1); 
	}
	
	function validation(theForm)
	{
		if ( isnull(theForm.nameofalu.value))	
		{
			alert ('Enter Alumnus Name');
			theForm.nameofalu.focus();
			return false;
		}
		if ( isnull(theForm.nameofcourse.value))	
		{
			alert ('Enter Name of Course');
			theForm.nameofcourse.focus();
			return false;
		}
		if ( isnull(theForm.year.value))	
		{
			alert ('Enter Year of graduating');
			theForm.year.focus();
			return false;
		}
		if ( isnull(theForm.homeadd1.value))	
		{
			alert ('Enter Address');
			theForm.homeadd1.focus();
			return false;
		}
		if ( isnull(theForm.email.value))	
		{
			alert ('Enter a vaild Email address');
			theForm.email.focus();
			return false;
		}		
		if ( isnull(theForm.email.value))	
		{
			alert ('Enter a vaild Email address');
			theForm.email.focus();
			return false;
		}
		if (IsValidEmailSyntax(theForm.email.value)== false)
		{
			alert ('Enter a vaild Email address');
			theForm.email.focus();
			return false;
		}				
		theForm.hidMail.value = "Y";
		return true;
	}