// JavaScript Document
var browser = navigator.appVersion;
var ie = browser.indexOf('MSIE');


function mudar_fiquepordentro(tipo,numero) {
	if (tipo=='B') {
		var dir='boletins';
	} else if (tipo=='C') {
		var dir='comunicados';
	} else if (tipo=='R') {
		var dir='resolucoes';
	} else if (tipo=='E') {
		var dir='eventos';
	} else if (tipo=='G') {
		var dir='governanca';
	} 
	document.getElementById('iframe_boletim').src="arquivos/"+dir+"/"+ numero + ".pdf";
	
	document.getElementById('download').href="arquivos/"+dir+"/download_fiquepordentro.php?arquivo="+numero+".pdf";
}

function mudar_comunicado(comunicado_id) {
	document.getElementById('iframe_comunicado').src="includes/comunicado.php?comunicado=" + comunicado_id;
}

function mudar_resolucao(resolucao_id) {
	document.getElementById('iframe_resolucao').src="includes/resolucao.php?resolucao=" + resolucao_id;
}

function insere_caractere(numero) {
	var valor = document.getElementById('password').value+numero;
	document.getElementById('password').value =  valor; 
}
function clique_password() {
	alert('Utilize o teclado numérico.');
}
function limpar() {
	document.getElementById('password').value = '';
}
function cor_tabela(id){
  var cor1="#dae5e3";
  var cor2="#fff";
  var x=document.getElementById(id).getElementsByTagName('tr');
  for(i=0;i<x.length;i++)
  x[i].className=(i%2==0)?'linha_impar':'linha_par';
}
function seleciona_contrato(nmr_contrato) {
	var x=document.getElementById('table_contratos').getElementsByTagName('tr');
	if (nmr_contrato=='1') {
		for(i=0;i<x.length;i++) {
  			x[i].style.display='block';
		}
		document.getElementById('mostrar_contratos').style.display='none';
		document.getElementById('parcelas').style.display='none';
		document.getElementById('movimentacao').style.display='none';
	} else {
		for(i=0;i<x.length;i++) {
	  		x[i].style.display='none';
		}
		document.getElementById(nmr_contrato).style.display='block';
		document.getElementById('mostrar_contratos').style.display='block';
		document.getElementById('parcelas_contrato').style.display='block';
		document.getElementById('movimentacao').style.display='block';
		ajaxHTML('ajax/emprestimo_parcelas.php?contrato='+nmr_contrato, 'parcelas_ajax');
		ajaxHTMLnovo('ajax/emprestimo_movimentacao.php?contrato='+nmr_contrato, 'movimentacao_ajax');
	}
	document.getElementById('tr_header').style.display='block';
}

function mostra_devedor(contrato) {
		document.getElementById('aviso').style.display='block';
		document.getElementById('devedor').style.display='block';
		document.getElementById('saldo_devedor'+contrato).style.display='block';	
}

function imprime_pagina() {
	var conteudo1 = document.getElementById('banking_nome_print').innerHTML;
	var conteudo2 = document.getElementById('conteudo').innerHTML;
	$.post("impressao/salva_impressao.php", {banking_nome_print: conteudo1, content: conteudo2 }, function(data){
		window.location='http://www.cogem.com.br/banking/print.php';
		//window_print = window.open('http://www.cogem.com.br/banking/print.php','Print');
	});
	//setTimeout('window.open("http://www.cogem.com.br/banking/print.php","Print")',6000);
}
