function AbreBloqueto(opt)
{
	var Largura, Altura, Opcoes;
	Largura = window.screen.width - 20;
	Altura =  window.screen.height - 85;

	Opcoes = "screenX=5,screenY=5,top=5,left=5,height=" + Altura + ",width=" + Largura + ",status=yes,toolbar=no,menubar=no,location=no,resizable=yes";
	if(opt==1)
	{
		window.open("https://ww8.banrisul.com.br/brb/link/Brbw2Lhw_Bloqueto_Titulos_Internet.aspx?SegundaVia=1", "Bloqueto1", Opcoes, true);
	}
	
	if(opt==2)
	{
    	window.open("https://ww8.banrisul.com.br/brb/link/Brbw2Lhw_Bloqueto_Titulos_Internet.aspx?SegundaVia=0", "Bloqueto2", Opcoes, true);
	}
}

function DesviaDJ()
{
	if(navigator.userAgent.substring(8,9) >= "4")
	{
		var Largura, Altura, Opcoes;
		Largura = window.screen.width - 20
		Altura =  window.screen.height - 85
		Opcoes = "top=5,left=5,height=" + Altura + ",width=" + Largura + ",status=yes,toolbar=no,menubar=no,location=no,resizable=yes";
		if(navigator.userAgent.indexOf("MSIE") != -1)
			window.open("https://www.banrisul.com.br/bbz/link/djr/bbzp00ho.asp", "BBZ", Opcoes, true);
		else
			window.open("https://www.banrisul.com.br/bbz/link/djr/bbzp00ho.asp", "BBZ", Opcoes, true);
	}
	else
		alert('Para usar este serviço, por uma questão de segurança, é necessário versão 4.0 ou superior do "Microsoft Internet Explorer" ou "Netscape Communicator".');
}

function Produto(form) {
	var onde=form.escolha.selectedIndex

	if (form.escolha.options[onde].value == 'Home'){
		document.forms[0].Agencia.focus();
	}
	else if (form.escolha.options[onde].value == 'Novo Office'){
		Desvia('Office',null,null,"INTERNET");
		document.frmInternetBank.escolha.options[0].selected = true;
	}
}

function ExecOK(){
	if (document.frmInternetBank.escolha.selectedIndex == 0) {
	    if(document.frmInternetBank.escolha.options[0].value == 'Home')
	    {
		    Desvia('Home','4E', document.getElementById('Agencia').value+document.getElementById('Conta').value,'INTERNET');
		}
		else if(document.frmInternetBank.escolha.options[0].value == 'Home Banco SIM')
		{
		    Desvia('BANCOSIM','4H', document.getElementById('Agencia').value+document.getElementById('Conta').value,'INTERNET');
		}
		document.frmInternetBank.escolha.options[0].selected = true;
		document.getElementById('Agencia').value='';
		document.getElementById('Conta').value='';
	}
	else{
		alert('Escolha um serviço para realizar o acesso.')
	}
}

function ExecBanking(tipo){
	if (tipo == 'home') {
	    Desvia('Home',null, null,'INTERNET');
	}	
	else if (tipo == 'office') {
	    Desvia('Office',null,null,"INTERNET");
	}
	else if (tipo == 'antigo_office') {
	    Desvia('Antigo_Office',null,null,"INTERNET");
	}
	else{
		alert('Escolha um serviço para realizar o acesso.')
	}
}

function Completa(Campo,Tamanho)
{
    var Zeros = "00000000000000000000", Conteudo = Campo.value;
    var Digitos = Conteudo.length;
    if(Tamanho == null) Tamanho = Campo.maxLength;
    if(Digitos < Tamanho) Campo.value = Zeros.substring(0, Tamanho-Digitos) + Conteudo;
}

function MudaCampo(Seguinte,event,Campo)
{
	if(event.keyCode==13){
		return true;
	}
	   				
	if(Campo.value.length == Campo.maxLength){
		Seguinte.focus();
	}
		event.cancelBubble = true;
		return true;
}
function Numerico(e)
{
	var tecla;
	
	tecla  = e.keyCode;
	if (tecla == 0) //é mozilla
		tecla = e.charCode; // é para o Mozilla

	if (tecla < 30 || (tecla > 47 && tecla < 58)) 
		return;

	e.returnValue = false;				
	
	try{
		e.preventDefault();  // é para o Mozilla
		}
	catch(e){}							
}
/*		
function Desvia(Sistema,Servico,Dados,Servidor)
{
	var Largura, Altura, Opcoes, Url;
	Largura = window.screen.width - 20
	Altura =  window.screen.height - 85
	var MSIE=false,Gecko=false,Opera=false,Konqueror=false;
	var Navegador = navigator.userAgent,Versao,Posicao;
	if((Posicao = Navegador.indexOf("Opera")) != -1)
	{
		Opera = true;
	}
	else if(Navegador.indexOf("Safari") != -1)
	{
		Posicao = Navegador.indexOf("Safari");
		Versao = Navegador.substr(Posicao+7,2);
		if(Versao < "12")
		{
			alert("Versão não suportada !\n\nÉ necessário usar a versão 1.2 ou superior.");
			return;
		}
		Gecko = true;
	}
	else if((Posicao = Navegador.indexOf("Konqueror")) != -1)
	{
		Versao = Navegador.substr(Posicao+10,1);
		if(Versao >= "3") Konqueror = true;
	}
	else if((Posicao = Navegador.indexOf("MSIE")) != -1)
	{
		Versao = Navegador.substr(Posicao+5,1);
		if(Versao >= "5") MSIE = true;
	}
	else if(Navegador.indexOf("Gecko") != -1)
	{
		Posicao = Navegador.indexOf("rv:");
		Versao = Navegador.substr(Posicao+3,3);
		if(Versao >= "1.0") Gecko = true;
	}
	if(Servidor != null)
	{
		if(Servidor.toUpperCase() == "INTERNET")
		{
			if((Sistema.toUpperCase() == "HOME") || (Sistema.toUpperCase() == "BANCOSIM") || (Sistema.toUpperCase() == "ANTIGO_HOME"))
			{
				Servidor = "https://ww8.banrisul.com.br/";				
			}
			else
			{			
				Servidor = 'https://ww7.banrisul.com.br/';
		    }
		}
		else if(Servidor.toUpperCase() == "INTRANET")
		{
			Servidor = 'https://intraws.banrisul/';
		}
		else if(Servidor.toUpperCase() == "N00A")
		{
			Servidor = 'http://n00a.banrisul/';
		}
		else
		{
			Servidor = 'http://n042/';
		}
	}
	else
	{
		Servidor = '';
	}	
	if(MSIE || Gecko || Konqueror || Opera)
	{
		Opcoes = "top=5,left=5,height=" + Altura + ",width=" + Largura + ",status=yes,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no";
		if(Servico) Servico = "&Servico=" + Servico; else Servico = "";
		if(Dados) Dados = "&Dados=" + Dados; else Dados = "";
		if (Sistema.toUpperCase() == "ANTIGO_HOME")
		    Url = Servidor + "brb/link/brbwe0hw.aspx?Largura="+window.screen.width+"&Altura="+Altura+"&Sistema=Home"+Servico+Dados;
		else
		    Url = Servidor + "brb/link/brbwe4hw.aspx?Largura="+window.screen.width+"&Altura="+Altura+"&Sistema="+Sistema+Servico+Dados;
		window.open(Url, "Banrisul", Opcoes, true);
		
	}
	else
	{
		alert('Seu navegador não é suportado !\n\nPor favor utilize o Internet Explorer 6.0 ou superior\n ou um navegador baseado no Mozilla 1.3 ou superior, ex.: Firefox 1.0.');
	}
}
*/
var Lista_janela = new Array(8);
var Lista_area = new Array(8);
var Lista_link = new Array(8);
var Lista_tamanho = new Array(8);
function abreswf(ID) {
	ID = ID.toLowerCase();
		for (i = 1; i <= 8; i++)
		{
  				if (Lista_area[i] == ID)
     	 		{
					if (Lista_janela[i]=="Atual")
					{	
						window.location=Lista_link[i];
					}
					else if(Lista_janela[i]=="Popup")
					{
						window.open(Lista_link[i],'Banrisul','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no,fullscreen=no,'+Lista_tamanho[i]);
					}
					else
					{   
						window.open (Lista_link[i],"novajanela");
					} 
				}
			
		}
	}
function banner_popup(banner,altura,largura) {
	window.open(banner,'Banrisul','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no,fullscreen=no,width='+largura+',height='+altura);
}

