<!-- INICIO - Djalma Augusto - 23/07/08 - Portal Beneficiario -->
function MM_findObjBenef(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function MM_validateFormBenef() { //v4.0
 var i,p,q,nm,test,num,min,max,errors='',args=MM_validateFormBenef.arguments;  
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObjBenef(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' deve conter apenas Números.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' é Obrigatório.\n'; }
  } 
  
  var m1 = document.beneficiario;
 
  if(m1.codigo.value == '') errors+= '- Código do Beneficiário é Obrigatório.\n';
  if(m1.associada.value == '') errors+= '- Associada é Obrigatório.\n';
  if(m1.matricula.value == '') errors+= '- Matrícula é Obrigatório.\n';
  /*if(m1.nascimento.value == '') errors+= '- Nascimento é Obrigatório.\n';*/
  if(m1.senha.value == '') errors+= '- Senha é Obrigatório.\n';
  if(m1.rsenha.value == '') errors+= '- Repetir a Senha é Obrigatório.\n';
  if(m1.senha.value != m1.rsenha.value) errors+= '- Senha e Repetir Senha Devem ser Iguais.\n';
  if (errors) alert('--- PORTAL BENEFICIÁRIO ---\n Os seguintes erros ocorreram:\n'+errors);
   if(errors == ''){
  	return true;
  } else {return false;}
}

function vis_rede(cod_rede){
	
	largura = 770;
	altura = 400;
	
	xmax=screen.width;
	ymax=screen.height;
	
	cima=(ymax-altura)/2;
	esq=(xmax-largura)/2;

	window.open('ass_rc_consulta_vis.php?cod_rec=' + cod_rede + '','REDECREDENCIADA' + cod_rede + '','width='+ largura +',height='+ altura +',resizable=yes,scrollbars=yes,top='+ cima +', left='+ esq +'');
	
}

function formataData(v){

	var int1 = 2;
	var int2 = 5;
	var barra = '/';
	
	if(v.value.length == int1){
		v.value = v.value + barra;
	} else if(v.value.length == int2){
		v.value = v.value + barra;
	}
	
}

function formataDataExtrato(v){
	
	var int1 = 2;
	var barra = '/';

	if(v.value.length == int1){
		v.value = v.value + barra;
	}
	
}

<!-- FIM - Djalma Augusto - 23/07/08 - Portal Beneficiario -->
