﻿<!--
<!--
var janelapop = null;
var janelapop_sub = null;
var janelapop_sub2 = null;

function abrejanela(entrada,largura,altura)
{

   if ( (janelapop != null) && (!janelapop.closed) )
   {
      janelapop.focus();
      janelapop.href = (entrada);
   }

   if(largura=='' || altura=='') {
   largura='890';
   altura='610';
   }
var res_ver = screen.height;
var res_hor = screen.width;
var pos_ver_x = (res_ver - altura)/2;
var pos_hor_x = (res_hor - largura)/2;

   janelapop =
window.open(entrada,'popup','resizable=no,toolbar=no,status=yes,menubar=no,scrollbars=yes,width='+largura+',height='+altura+',top='+pos_ver_x+',left='+pos_hor_x);
}


function banner(){
	var banner;
	banner = "<img src='images/banner_genbenicio.gif' />";
	document.write(banner);
}
function texto(id){
	var texto;
	if(id == 1){
		texto = "<b style='word-spacing:0px;letter-spacing:1px'>MINISTÉRIO DA DEFESA</b><br/>";
		texto += "<span style='word-spacing:4px;letter-spacing:2px'>EXÉRCITO BRASILEIRO</span>";
	}
	if(id == 2){
		texto = "BIBLIEX - Biblioteca do Exército Editora<br/>";
		texto += "Todos os direitos reservados";
	}
	if(id == 3){
	texto = "<a href='http://www.exercito.gov.br' target='_blank'><img src='images/link_ico_exercito.gif' border='0' align='right'> </a>";
	texto += "<a href='http://www.mecenas.ensino.eb.br' target='_blank'><img src='images/mecenas.jpg' alt='Programa Mecenas' border='0' ></a>";
	texto += "<a href='http://www1.transparencia.gov.br/TransparenciaCliente/index.jsp?CodigoOrgao=160287&TipoOrgao=3' target='_blank'><img src='images/banner1_trans_pub.gif' alt='Transpar&ecirc;ncia p&uacute;blica' border='0' align='right' style='padding-right:10px;' /></a><span style='text-align:left; font-size: 11px;'>Aprovado pelo BI Nr 064 de 28 Ago 2008<br />";
	texto += "<b>Visitas desde agosto/2008:</b> </span>";
	}
	document.write(texto);
}
function menu(id){
	var menu;
	if(id == 1){
		menu = "<form method='post' action='?id=1&acao=buscar'>";
		menu += "Buscar por:<br/>";
		menu += "<select name='por' style='width:150px'>";
		menu += "<option value='l_titulo'>Título</option>";
		menu += "<option value='l_autor'>Autor</option>";
		menu += "<option value='l_isbn'>ISBN</option>";
		menu += "<option value='l_editora'>Editora</option>";
		menu += "</select><br/>";
		menu += "Palavra chave:<br/>";
		menu += "<input type='text' name='busca' style='width:122px'/> ";
		menu += "<input type='submit' value='ok' style='width:20px;cursor:pointer;border:1px #CCCCCC solid'/>";
		menu += "</form>";
	}
	document.write(menu);
}

function flash(id){
	 var flash;
	 if(id == 10){
	 	flash = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="250" height="350">';
	 	flash += '<param name="movie" value="images/natal.swf" />';
	 	flash += '<param name="quality" value="best" />';
	 	flash += '<embed src="images/natal.swf" quality="best" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="250" height="350"></embed>';
	 	flash += '</object>';
	}
	document.write(flash);
}
/*-----CHECA COMPRAR-----*/
function validaAssin(){
	if(document.form.pgto.value == ""){
		alert('Escolha uma forma de pagamento!');
		document.form.pgto.focus();return(false);
		}
	//if(document.form.col_id.value == ""){alert('Senha obrigatória');document.col_id.focus();return(false);}
}
/*-----FIM COMPRAR-----*/
/*-----INI OBRIGATORIO-----*/
function validacad(){
	if(document.cad.login.value == ""){alert('E-mail obrigatório');document.cad.login.focus();return(false);}
	if(document.cad.senha.value == ""){alert('Senha obrigatória');document.cad.senha.focus();return(false);}
	if(document.cad.nome.value == ""){alert('Nome obrigatório');document.cad.nome.focus();return(false);}
	if(document.cad.ddd.value == ""){alert('DDD obrigatório');document.cad.ddd.focus();return(false);}
	if(document.cad.tel.value == ""){alert('Telefone obrigatório');document.cad.tel.focus();return(false);}
	if(document.cad.rua.value == ""){alert('Endereço obrigatório');document.cad.rua.focus();return(false);}
	if(document.cad.num.value == ""){alert('Complemento obrigatório');document.cad.num.focus();return(false);}
	if(document.cad.bairro.value == ""){alert('Bairro obrigatório');document.cad.bairro.focus();return(false);}
	if(document.cad.cidade.value == ""){alert('Cidade obrigatória');document.cad.cidade.focus();return(false);}
	if(document.cad.uf.value == ""){alert('Estado obrigatório');document.cad.uf.focus();return(false);}
	if(document.cad.cep.value == ""){alert('CEP obrigatório');document.cad.cep.focus();return(false);}
}
/*-----FIM OBRIGATORIO-----*/

/*-----INI LOGIN-----*/
function checaLogin(){
	if(document.cad.login.value.indexOf("@")<1 || document.cad.login.value == ""){
		alert('E-mail inválido');
		document.cad.login.focus();
		return(false);
	}
}
/*-----FIM LOGIN-----*/


/*-----INI CPF-----*/
function check_cpf(cpf){
	x = 0;
	soma = 0;
	dig1 = 0;
	dig2 = 0;
	texto = "";
	cpf1="";
	len = cpf.length; x = len -1;
	// var cpf = "12345678909";
	for (var i=0; i <= len - 3; i++) {
		y = cpf.substring(i,i+1);
		soma = soma + ( y * x);
		x = x - 1;
		texto = texto + y;
	}
	dig1 = 11 - (soma % 11);
	if (dig1 == 10) dig1=0 ;
	if (dig1 == 11) dig1=0 ;
	cpf1 = cpf.substring(0,len - 2) + dig1 ;
	x = 11; soma=0;
	for (var i=0; i <= len - 2; i++) {
		soma = soma + (cpf1.substring(i,i+1) * x);
		x = x - 1;
	}
	dig2= 11 - (soma % 11);
	if (dig2 == 10) dig2=0;
	if (dig2 == 11) dig2=0;
	//alert ("Digito Verificador : " + dig1 + "" + dig2);
	if ((dig1 + "" + dig2) == cpf.substring(len,len-2)) {
		return true;
	}
	alert("Nmero de CPF invalido.");
	return false;
}
/*-----FIM CPF-----*/

/*-----INI CAMPO NUMERICO-----*/
function cmpnum(){
	var carCode = event.keyCode;
	if((carCode < 48) || (carCode > 57)){
		alert('Digite apenas os nmeros do CPF.');
		event.cancelBubble = true;
		event.returnValue = false;
	}
}
/*-----FIM CAMPO NUMERICO-----*/

/*-----INI OBRIGATORIO-----*/
function validafolha(){
	if(document.pgto.tipomil.value == ""){alert('Situação do militar é um campo obrigatório.');document.pgto.tipomil.focus();return(false);}
	if(document.pgto.doc.value == ""){alert('Documento militar é um campo obrigatório.');document.pgto.doc.focus();return(false);}
	if(document.pgto.qtdparc.value == ""){alert('Quantidade de parcelas é um campo obrigatório.');document.pgto.qtdparc.focus();return(false);}
	if(document.pgto.postograd.value == ""){alert('Posto ou Graduação é um campo obrigatório.');document.pgto.postograd.focus();return(false);}
	if(document.pgto.ident.value == ""){alert('Identidade militar é um campo obrigatório.');document.pgto.ident.focus();return(false);}
	if(document.pgto.om.value == ""){alert('OM do militar é um campo obrigatório.');document.pgto.om.focus();return(false);}
}
/*-----FIM OBRIGATORIO-----*/

/*-----INI OBRIGATORIO-----*/
function validaAssin(){
	if(document.form.pgto.value == ""){alert('Selecione a forma de pagamento.');document.form.pgto.focus();return(false);}
	if(document.form.pgto.value == "1"){
		if(document.form.forca.value == ""){alert('Força Armada é um campo obrigatório.');document.form.forca.focus();return(false);}
		if(document.form.forca.value == "mb"){
			if(document.form.nip.value == ""){alert('NIP é um campo obrigatório.');document.form.nip.focus();return(false);}
		}
		if(document.form.forca.value == "eb"){
			if(document.form.prec.value == ""){alert('PREC-CP é um campo obrigatório.');document.form.prec.focus();return(false);}
		}
		if(document.form.tipomil.value == ""){alert('Situação do militar é um campo obrigatório.');document.form.tipomil.focus();return(false);}
		if(document.form.postograd.value == ""){alert('Posto ou Graduação é um campo obrigatório.');document.form.postograd.focus();return(false);}
		if(document.form.ident.value == ""){alert('Identidade militar é um campo obrigatório.');document.form.ident.focus();return(false);}
		if(document.form.om.value == ""){alert('OM do militar é um campo obrigatório.');document.form.om.focus();return(false);}
		if(document.form.qtdparc.value == "0"){alert('Quantidade de parcelas é um campo obrigatório.');document.form.qtdparc.focus();return(false);}
	}

}
/*-----FIM OBRIGATORIO-----*/

function pg(id){
	var id;
	if(id == 1){
		document.getElementById('desc').style.display='block';
	}
	if(id == 2 || id == ""){
		document.getElementById('desc').style.display='none';
	}
}	

function fa(id){
	var id;
	if(id == ""){
		document.getElementById('tnip').style.display='none';
		document.getElementById('nip').style.display='none';
		document.getElementById('tprec').style.display='none';
		document.getElementById('prec').style.display='none';
		document.getElementById('tsaram').style.display='none';
		document.getElementById('saram').style.display='none';
	}
	if(id == "eb"){
		document.getElementById('tnip').style.display='none';
		document.getElementById('nip').style.display='none';
		document.getElementById('tprec').style.display='block';
		document.getElementById('prec').style.display='block';
		document.getElementById('tsaram').style.display='none';
		document.getElementById('saram').style.display='none';
	}
	if(id == "mb"){
		document.getElementById('tnip').style.display='block';
		document.getElementById('nip').style.display='block';
		document.getElementById('tprec').style.display='none';
		document.getElementById('prec').style.display='none';
		document.getElementById('tsaram').style.display='none';
		document.getElementById('saram').style.display='none';
	}
	if(id == "mar"){
		document.getElementById('tnip').style.display='none';
		document.getElementById('nip').style.display='none';
		document.getElementById('tprec').style.display='none';
		document.getElementById('prec').style.display='none';
		document.getElementById('tsaram').style.display='block';
		document.getElementById('saram').style.display='block';
	}
}

function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") { 
document.getElementById(d).style.display = "block"; }
else { document.getElementById(d).style.display = "none"; }
}


function mascara(o,f){
    v_obj=o
    v_fun=f
    setTimeout("execmascara()",1)
}

function execmascara(){
    v_obj.value=v_fun(v_obj.value)
}

function leech(v){
    v=v.replace(/o/gi,"0")
    v=v.replace(/i/gi,"1")
    v=v.replace(/z/gi,"2")
    v=v.replace(/e/gi,"3")
    v=v.replace(/a/gi,"4")
    v=v.replace(/s/gi,"5")
    v=v.replace(/t/gi,"7")
    return v
}

function soNumeros(v){
    return v.replace(/\D/g,"")
}

// *************** INICIO VERIFICADOR DE E-MAIL ******************//
function Email_Valido(Campo)
{
//var Valor = Campo.value;
/*
var el = document.forms[0].elements;
for(var i=0;i<el.length;i++){
el[i].setAttribute('disabled',true)
}
}*/
//var varbairros=vbairros.split("|");
//àâêôûãõáéíóúçüÀÂÊÔÛÃÕÁÉÍÓÚÇÜ
  var Valor = Campo.value;
  var erro=0;
  if (Campo.value=="")
    return true;
  else
  var acentos = new Array("à","â","ê","ô","û","ã","õ","á","é","í","ó","ú","ç","ü","À","Â","Ê","Ô","Û","Ã","Õ","Á","É","Í","Ó","Ú","Ç","Ü"," ","/","\\","#","*","[","]","{","}",">","<",":",";","?","!","(",")","$","%","=","|","@@","..",",","´","`","'","\"","+",".@","@.","@-","@_");
//  var acentos = new Array("à","â","á");
  var erro="";
  var pos=Valor.length-1;
for(var i=0;i<acentos.length;i++){
//if(Valor.indexOf(acentos[i]) >= 0) {
if((Valor.indexOf(acentos[i]) >= 0) || (Valor.indexOf(".",pos) == pos) || (Valor.indexOf(".") == 0)) {
erro++;
} 
} 
	if(erro) {
	//alert("Tamanho campo: "+pos +Valor.length+Valor.indexOf(".",pos));
	alert("Este e-mail não está correto, não digite acentuação, acentos ou símbolos especiais (só é permitido os simbolos '@' e '.' (arroba e ponto!)!" +erro);
    Campo.focus();
    return false; 
	}


  if ( (Valor.indexOf("@") == -1) || (Valor.indexOf(".") == -1) || (Valor.length < 5) )
  {  alert("Este e-mail não é válido.  Por favor, digite novamente.");
     Campo.focus();
	 //alert("CAmpo: "+Campo);
     return false;  
  }
    else
  if ( (Valor.indexOf("@@") !== -1) || (Valor.indexOf("..") !== -1) || (Valor.indexOf(",") !== -1) )
  {  alert("Este e-mail não está correto!");
     Campo.focus();
	 //alert("CAmpo: "+Campo);
     return false;  
  }
    else
  if (Valor.indexOf("www@") !== -1)
  {  alert("Este e-mail não está correto!");
     Campo.focus();
	 //alert("CAmpo: "+Campo);
     return false;  
  }
  //else
  
     return true;
}
// *************** FIM VERIFICADOR DE E-MAIL ******************//
-->