function trim(jstr) { 
	var p1 = /^\s+/gi; 
	var p2 = /\s+$/gi 
	
	jstr = jstr.replace(p1,''); 
	jstr = jstr.replace(p2,''); 
	return jstr; 
}

function is_email(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 new_window(mypage, myname, w, h, scroll) {

	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;

	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',noresize'
	win = window.open(mypage, myname, winprops);

	if (parseInt(navigator.appVersion) >= 4) {
		win.focus();
	}
}
