	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.txtSeminar.value))	
		{
			alert ('Select a Seminar');
			theForm.txtSeminar.focus();
			return false;
		}
		if ( isnull(theForm.txtFirstName.value))	
		{
			alert ('Enter a First name');
			theForm.txtFirstName.focus();
			return false;
		}
		if ( isnull(theForm.txtLastName.value))	
		{
			alert ('Enter a Last name');
			theForm.txtLastName.focus();
			return false;
		}
		
		if ( isnull(theForm.txtTitle.value))	
		{
			alert ('Enter Job title');
			theForm.txtTitle.focus();
			return false;
		}
		
		if ( isnull(theForm.txtCompanyName.value))	
		{
			alert ('Enter a Company name');
			theForm.txtCompanyName.focus();
			return false;
		}
		if ( isnull(theForm.txtAddress1.value))	
		{
			alert ('Enter a Company address');
			theForm.txtAddress1.focus();
			return false;
		}
		if ( isnull(theForm.txtCity.value))	
		{
			alert ('Enter a City');
			theForm.txtCity.focus();
			return false;
		}
		
		if ( isnull(theForm.txtState.value))	
		{
			alert ('Enter a State');
			theForm.txtState.focus();
			return false;
		}		
		if ( isnull(theForm.SelCountry.value))	
		{
			alert ('Select a Country');
			theForm.SelCountry.focus();
			return false;
		}
		if ( isnull(theForm.txtZipCode.value))	
		{
			alert ('Enter a Zip code');
			theForm.txtZipCode.focus();
			return false;
		}
		if ( isnull(theForm.txtPhone.value))	
		{
			alert ('Enter a Phone #');
			theForm.txtPhone.focus();
			return false;
		}
		if ( isnull(theForm.txtEmail.value))	
		{
			alert ('Enter a vaild Email address');
			theForm.txtEmail.focus();
			return false;
		}
		if (IsValidEmailSyntax(theForm.txtEmail.value)== false)
		{
			alert ('Enter a vaild Email address');
			theForm.txtEmail.focus();
			return false;
		}		
		return true;
	}