function valida(formSicoobNet) {


if (document.forms[formSicoobNet].txtNumContaCorrente.value == '00000000-0'){
 alert('Favor informe sua conta corrente.');
 return (false);
}
else {


	with (document.formSicoobNet) {
	method= "post";
	
	action="https://ib.sicoobnet.com.br/inetbank/login.jsp";

   var width = screen.availWidth;
   var height = screen.availHeight;

   var left = 0;
   var top = 0;

	window.open('','janelaSicoobNet','top=0, left=0, width='+width+', height='+height+', status=YES, scrollbars=YES');	


	target='janelaSicoobNet';


	submit();
 return (true);
	
}
}


}


function FormataValorDefaultText(strNMCampo, formato, intOnFocus) {
	
	var strNull = '';
	
	if (intOnFocus == 1) {
		if (window.document.forms["formSicoobNet"].elements[strNMCampo].value + '' == formato) {
			window.document.forms["formSicoobNet"].elements[strNMCampo].value = '';
		}
	}
	
	if (intOnFocus == 0) {
		if (window.document.forms["formSicoobNet"].elements[strNMCampo].value + '' == '') {	
			window.document.forms["formSicoobNet"].elements[strNMCampo].value = formato;
		}
	}
		
}

//Campo numérico inteiro, funciona com qualquer navegador 
function SomenteNumeros2(strNMCampo, ev) {
	var IN_VNIx=0;
	var ST_VNIDigitos = "0123456789";

	var letra = 0;
	
	if (ev.keyCode) {
		if (   ev.keyCode < 20 
			|| ev.keyCode == 35 
			|| ev.keyCode == 36 
		    || ev.keyCode == 37 
		    || ev.keyCode == 39 
		    || ev.keyCode == 38 
		    || ev.keyCode == 40 
		    || ev.keyCode == 46 
		    || ev.keyCode == 27) {
			return true;
		}
		letra = ev.keyCode;
	} else if (ev.which) {
		if (   ev.which < 20 
			|| ev.which == 35 
			|| ev.which == 36 
		    || ev.which == 37 
		    || ev.which == 39 
		    || ev.which == 38 	
		    || ev.which == 40 
		    || ev.which == 46 
		    || ev.which == 27) {
			return true;
		}
		letra = ev.which;
	}

	letra = new String(letra);	
	letra = String.fromCharCode(letra);
	
	if( ST_VNIDigitos.indexOf(letra.substr(0, 1)) == -1 ) {
	
		for (var i = 0; i < window.document.forms["formSicoobNet"].elements[strNMCampo].value.length + 1; i++) {
		
			strTempChar = window.document.forms["formSicoobNet"].elements[strNMCampo].value.substring(i - 1, i);
		
			if (ST_VNIDigitos.indexOf(strTempChar,0)==-1) {
				window.document.forms["formSicoobNet"].elements[strNMCampo].value = window.document.forms["formSicoobNet"].elements[strNMCampo].value.substring(0,i - 1);
			}
			
		}		
	}
		
}


function FormataContaCorrente2(strNMCampo) {

	var vr = window.document.forms["formSicoobNet"].elements[strNMCampo].value;
	vr = vr.replace("-", "");	
	vr = Number(vr);
	vr = String(vr);

	//Coloca formatação
	var zeros = "";
	for (var x = vr.length; x < 9; x++) {
		zeros += "0";
	}
	
	window.document.forms["formSicoobNet"].elements[strNMCampo].value = zeros + vr.substr(0, vr.length - 1) + '-' + vr.substr(vr.length - 1, 1); 
	}
	
function verificaDV(formSicoobNet) {


               digitado = document.formSicoobNet.txtNumContaCorrente.value;
			   dig = digitado;

			   if (digitado.substr(8,1)=='-') {
			   		digitado = digitado.substr(0,8) + digitado.substr(9,1);
			   }

	   

	if (digitado > 100000000) {

			   var dv = 0;
			   var a = [];
			   var d = [];
               var b = 0;
               var c = 9;			   
               for (i=0; i<9; i++){
                       a[i] = digitado.charAt(i);
                       if (i < 7) b += (a[i] * c--);
               }
			   	
               b = 0;
               c = 9;
			   y = 7;
			   
			   do {
			   b = b+(a[y] * c--);
			   y = y-1;
			   }while (y>=0);
			  
			   dv = (b%11);
			   

               for (i=0; i<9; i++){
                       d[i] = a[i];
                       if (i < 7) b += (a[i] * c--);
               }

			   i=8;
			   a[i] = dv;
if (a[i]>9) {
	a[i]=0;
}


		if (d[8] == a[8]) {
				valida(formSicoobNet);
		return (true);
		}
		else {
		     var alerta = "";
			 alerta = alerta + 'Foi digitado: ';
			 alerta = alerta + dig;			   
	   


			  alerta = alerta + '\n' + 'Sua nova conta corrente: ';
			  for (i=0; i<9; i++){
			   if(i==8) {
			    alerta = alerta + '-';
			   }
			    alerta = alerta + a[i];
              }			   

			  alerta = alerta + '\n\nDigite novamente!';
			  alert(alerta);
			 
			document.formSicoobNet.txtNumContaCorrente.focus();
			
		return (false);	
		}

	}else{

	teste = valida(formSicoobNet);
	return teste;
}
	
}	


function SoNumeros()
{
var carCode = event.keyCode;
if ((carCode < 48) || (carCode > 57))
{
 alert('Por favor, digite apenas números.');
 event.cancelBubble = true
 event.returnValue = false;
}
}

function validaHB(formHB) {

if (document[formHB]._txtMatricula.value == ""){
 document[formHB]._txtMatricula.focus();
 alert('Por favor, informe sua matrícula.');
 return (false);
}
else {



	with (document.formHB) {
	method= "post";
	
	action="https://www.credicom.com.br/Homebanking/LoginSeguro.asp";



   var width = screen.availWidth;
   var height = screen.availHeight;

   var left = 0;
   var top = 0;

	window.open('','janela2','top=0, left=0, width='+width+', height='+height+', status=YES, scrollbars=YES');	


	target='janela2';




document[formHB].txtMatricula.value = document[formHB]._txtMatricula.value;
document[formHB].txtIdentificacao.value = document[formHB]._txtIdentificacao.value;	

	submit();

document[formHB]._txtMatricula.value = '';
document[formHB]._txtIdentificacao.value = '';	
	
}
}

return true;
}


function abrir(URL) {

   var width = 600;
   var height = 550;

   var left = 0;
   var top = 0;

   window.open(URL,'', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');

}