	//Strips the leading and trailing spaces off the string
	function trim(str) {
		var n=str;

		while(n.length>0 && n.charAt(0)==' ') {
			n=n.substring(1,n.length);
		}
		while(n.length>0 && n.charAt(n.length-1)==' ') {		
			n=n.substring(0,n.length-1);
		}
		return n;
	}
	
	//email validation 
	function ValidateEmail(email)
	{
		var splitted = email.match("^(.+)@(.+)$");
		if(splitted == null) return false;
		if(splitted[1] != null )
		{
		  var regexp_user=/^\"?[\w-_\.]*\"?$/;
		  if(splitted[1].match(regexp_user) == null) return false;
		}
		if(splitted[2] != null)
		{
		  var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
		  if(splitted[2].match(regexp_domain) == null) 
		  {
			var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
			if(splitted[2].match(regexp_ip) == null) return false;
		  }// if
		  return true;
		}
	return false;
	}
		
	//function to check if number or not (float Invalid)
	function IsNumber(field) {
		return (/^[0-9]*$/.test(field));
	}
		
	// function to check if numeric or not (float valid)
	function IsNumeric(num) {
		return (/^[0-9.]*$/.test(num));
	}
	
	//functino to alert n' focus
	function AlertFocus(MSG,OBJECT)	{
		alert(MSG);
		OBJECT.focus();
	}//end of function

