// JavaScript Document
var win = 0;
function openWindow(strURL, w, h, strName){
	if ((strName=='')||(strName==null)){strName="myWindow";}
	str='directories=no, menubar=no, status=no, location=no, scrollbars=yes, resizable=yes, width=' + w + ', height=' + h;
	if (win == 1) {newWindow.close(); win=0;}
	if (win == 0) newWindow = open(strURL,strName,str);
	win = 1;
}

function checkFieldEmail( objEmail ){
	if (!objEmail) return true;
	if (objEmail.value == '') return true;
	var theString = objEmail.value;
    var splitted = theString.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;
      }// end  if
      return true;
    }
	return false;
}
function checkFieldImage( objImg ){
	if (!objImg) return true;
	if (objImg.value == '') return true;
	var theString = objImg.value;
    if(theString.indexOf("'")>-1) return false;
	//if(theString.indexOf("'")>-1) return false;
    return true;
}
function checkFieldIsNumber( objValue )
{ 
var isok = true;
if (!objValue) return true;
  var charpos = objValue.value.search("[^0-9]"); 
  if(objValue.value.length > 0 &&  charpos >= 0) 
  { 
	//alert(strError + "\n [Error character position " + eval(charpos+1)+"]"); 
	isok = false; 
  }// end if 
  return isok;
}// end function
