
function DFcheckFormAlert(f,plus){
  var scrTop=DFscrollTopPosition()
  if(f.type=='select-one'||f.type=='radio')S= tgPreencheCampo
  else if(plus)S=tgCampoInvalido
  else S= tgPreencheCampo
  label=(d.layers)?f.name:f.getAttribute('label')
  label=(label)?label:f.name
  S+=label
  if(plus=='password')S=label+ tgNaoPossuiMesmoValor
  if(plus=='minlength')S= tgMinimoCaracteres1 +label+ tgMinimoCaracteres2 +f.getAttribute('minlength')+ tgMinimoCaracteres3
  if(f.type!='hidden'){
    if(!d.layers){
      if(plus=='password'){for(var i=0;i<f.form.length;i++){if(f.form[i].getAttribute('xtype')=='password')f.form[i].className=f.classNameOld + '_DF-alert'}}
      else if(f.type=="radio"){for(var i=0;i<f.form[f.name].length;i++){f.form[f.name][i].className=f.classNameOld + '_DF-alert'}}
      else f.className=f.classNameOld + '_DF-alert'
    }
    f.focus()
  }
  else if(!d.layers){
    for(var i=0;i<f.form.length;i++){if(f.form[i].getAttribute('target')==f.name)f.form[i].className=f.classNameOld + '_DF-alert'}
    for(var i=0;i<f.form.length;i++){if(f.form[i].getAttribute('target')==f.name){f.form[i].focus();break}}
  }
  if(scrTop!=DFscrollTopPosition())scrollBy(null,scrTop>DFscrollTopPosition()?-20:80)
  alert(S)
}


function DFcheckForm2(f,onlyObligatory,submitonce){

  var cod1 = "";
  var cod2 = "";

  clearClass(f);
  if(f.length>0 && !f[0].getAttribute){
    return true;
  }
  for(var i=0;i<f.length;i++){
    v=true
    if(f[i].type=='text'||f[i].type=='textarea'||f[i].type=='password')v=f[i].value
    else if(f[i].type=='select-one')v=f[i][f[i].selectedIndex].value
    else if(f[i].type=='radio'){v=false;for(var j=0;j<f[f[i].name].length;j++){if(f[f[i].name][j].checked)v=f[f[i].name][j].value}}
    else if(f[i].type=='hidden'){v=true;for(var j=0;j<f.length;j++){if(f[i].name==f[j].getAttribute('target')){if(!f[j].value)v=false}}}
    if(!v){
      obligatory=(d.layers)?null:f[i].getAttribute('obligatory')
      if(f[i].type!='hidden'&&(((!onlyObligatory&&obligatory!='no')||(onlyObligatory&&obligatory=='yes'))||d.layers)){DFcheckFormAlert(f[i]);return false}
    }
    else{
      if(f[i].type=='text'||f[i].type=='textarea'||f[i].type=='password'){
        if(!DFcheckMinLength(f[i]))return false
        if(!DFcheckFormPlus(f[i]))return false
      }
      else if(f[i].type=='hidden'&&!d.layers){
        for(var j=0;j<f.length;j++){if(f[i].name==f[j].getAttribute('target')){f[i].value='';break}}
        for(var j=0;j<f.length;j++){if(f[i].name==f[j].getAttribute('target'))f[i].value+=f[j].value+((f[j].getAttribute('separator'))?f[j].getAttribute('separator'):'')}
        for(var j=0;j<f.length;j++){if(f[i].name==f[j].getAttribute('target')){if(!DFcheckFormPlus(f[i]))return false}}
      }
    }
  }

  for(i=0;i<document.worldtracerForm.cdProcesso.value.length;i++)
  {
  	if(i==3)
  	{
  		cod1 = document.worldtracerForm.cdProcesso.value.substr(i,1).toUpperCase();
  	}
  	else if(i==4)
  	{
		cod2 = document.worldtracerForm.cdProcesso.value.substr(i,1).toUpperCase();
  	}
  }

  if(!(cod1+cod2 == 'JJ' || cod1+cod2 == 'PZ'))
  {
  	alert(tgProcessoInvalido)
  	document.worldtracerForm.cdProcesso.focus();
  	return false;
  }

  if(submitonce)DFsubmitonce(f)
  return true
}