function val_mail(doc)
{
/*
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	 Name		: validate_mail()						 
	 Purpose	: To validate mail form
	 Inputs		: form obj
	 Outputs	: returns true for valid data , false otherwise
	 Calls		: None			 
	 Called By	: mail-ons.php			 
	 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
*/
	tmp_str_err ="";

	frmName  = isBlank(doc.frmName.value);
	if( frmName == "")
	{
		tmp_str_err  += "Please enter the naam.\n";
	}

	frmTele  = isBlank(doc.frmTele.value);
	if( frmTele == "")
	{
		tmp_str_err  += "Please enter the Telefoon.\n";
	}	
	

	frmEml  = isBlank(doc.frmEml.value);
	if( frmEml == "")
	{
		tmp_str_err  += "Please enter the e-mail.\n";
	}
	else
	{
		if( (frmEml.indexOf("@") == -1) || (frmEml.indexOf("\.") == -1) )
		{
			tmp_str_err  += "Please enter a valid e-mail address.\n";
		}
	}


	/* if str contains the error messages display it & return false
	   else return true
	*/
	if(tmp_str_err)
	{  
	    alert(tmp_str_err);
	    return false;
	}
	else
	{
	    return true;
	} 

	
}


function isBlank(tmp_str)
{
/*
   Name      : isBlank.
   Purpose   : keeping validation for blank field.
   Inputs    : tmp_str -> string for validation
   Outputs   : return the value of veriable newString.
               if newString = "" returns null
*/

var newString  = ''; //trim value of given string
var substring  = ''; // temporary string for checking white spaces in string.
beginningFound = false; // position of white space

 // copy characters over to a new string
 // retain whitespace characters if they are between other characters

 for (var i = 0; i < tmp_str.length; i++)
 {  		
	// copy non-whitespace characters
	// hold whitespace characters in a temporary string if they follow a non-whitespace character
	
	if (tmp_str.charAt(i) != ' ' && tmp_str.charCodeAt(i) != 9)
	{
		// if the temporary string contains some whitespace characters, copy them first
		if (substring != '')
		{
			newString += substring;
			substring = '';
		}
		newString += tmp_str.charAt(i);
		 if (beginningFound == false)
		 {
		   beginningFound = true;
		 } 
	}

	else if (beginningFound == true)
	{
	   substring += tmp_str.charAt(i);
	}
  }

  return newString;

}