if (lg=="en/") {
    t1="The ";
    t2="field is required";
    t3="field is too short";
    t4="field contains invalid characters";    
    t5="field is invalid";    
}
if (lg=="ro/") {
    t1="Câmpul ";
    t2="este necesar";
    t3="este prea scurt";
    t4="conține caractere invalide"; 
    t5="este invalid";        
}

function chknm(s,n)
{
  ero="`@-=[];\',/\\~!#$%^&*()_+{}:\"<>?|1234567890"
  if (s=='') eroare+=t1+"\""+n+"\" "+t2+".<br>\n";
  else if (s.length<5) eroare+=t1+"\""+n+"\" "+t3+".<br>\n"
  else {
    z=0;
    for (j=0; j<=ero.length-1; j++) if (s.indexOf(ero.substring(j,j+1))!=-1) z=1
    if (z==1) eroare+=t1+"\""+n+"\" "+t2+".<br>\n"
  }
}

function chkel(s,n,l)
{
  if (s=='') eroare+=t1+"\""+n+"\" "+t2+".<br>\n"; 
  else if (s.length<l) eroare+=t1+"\""+n+"\" "+t3+".<br>\n"; 
}

function chkph(s, n)
{
  ero="1234567890+()-,. "
  if (s=='') eroare+=t1+"\""+n+"\" "+t2+".<br>\n"
  else if (s.length<5) eroare+=t1+"\""+n+"\" "+t3+".<br>\n"
       else {
        z=0;
        for (j=0; j<=s.length-1; j++) if (ero.indexOf(s.substring(j,j+1))==-1) z=1
        if (z==1) eroare+=t1+"\""+n+"\" "+t2+".<br>\n"
      }
}

function chkem(a, n)
{
    ero="`=[];\',/\\#$%^&*()+{}:\"<>?| ";
    ned="@.";
    er=0;
    if (a.length==0) eroare+=t1+"\""+n+"\" "+t2+".<br>\n"
      else if (a.length<5) eroare+=t1+"\""+n+"\" "+t3+".<br>\n"
        else {
          for (j=0; j<=ero.length-1; j++) if (a.indexOf(ero.substring(j,j+1))!=-1) er=1;
          for (j=0; j<=ned.length-1; j++) {
            aos = a.split(ned.substring(j,j+1));
            for (var i=0; i < aos.length-1; i++) if (aos[i]<1) er=1;
            if (a.indexOf(ned.substring(j,j+1))==-1) er=1;
         }
         if (er==1) eroare+=t1+"\""+n+"\" "+t5+".<br>\n"
       }
}

function alerter(eroare)
{
  windowW=250;  
  windowH=100;
  windowX = screen.width/2-windowW/2;  
  windowY = screen.height/2-windowH/2;
  s = "width="+windowW+",height="+windowH; 
  
  var EB = window.open("","lp","fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0, "+s, true)
  docomentu='<html><title>ERROR</title><frameset border=0 framespacing=0 frameborder=0 rows="20, 100%"><frame name=left src="about:blank" scrolling=no noresize><frame name=right src="about:blank" scrolling=no noresize></frameset></html>';
  var wd = EB.document;
  wd.open();
  wd.write(docomentu);
  wd.close();    
  eroru="<html><base href="+zepath+"><body bgcolor=#F5F5F5 topmargin=3 leftmargin=3 marginwidth=3 marginheight=3><link rel=\"StyleSheet\" href=\"data/style.css\" type=\"text/css\"><span class=J>"+eroare+"</span></body></html>";
  var wdd = EB.right.document;
  wdd.open();
  wdd.write(eroru);
  wdd.close();    
  var wdd1 = EB.left.document;
  wdd1.open();
  wdd1.write("<html><base href="+zepath+"><body bgcolor=#DEDCDC topmargin=3 leftmargin=0 marginwidth=0 marginheight=3><link rel=\"StyleSheet\" href=\"data/style.css\" type=\"text/css\"><table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td><span class=I><b><font color=#000000>&nbsp;&nbsp;ERROR</b></font></span></td><td align=right><a class=K href=javascript:parent.window.close() onmouseover=\"c.src='i/or.gif'\" onmouseout=\"c.src='i/orc.gif'\">close</a><img border=0 src=i/orc.gif align=bottom hspace=3 vspace=1 width=12 height=7 name=c></td></tr></table></body></html>");
  wdd1.close();
  
  EB.resizeTo(windowW, windowH);    
  EB.moveTo(windowX,windowY)
  EB.focus()  
}

