var nomesf = new Array();
nomesf[0] = "barra";
nomesf[1] = "conteudo";
var nframes = 2;
var endsite = "http://www.bradescoprivatebank.com.br/";

try
{	
	if (parent.frames.length > 0)
	{
		if (parent.frames.length != nframes)
			 {		 
			   //Quantidade de frames diferente do permitido.
			   top.location.href=endsite;
			 }	
		for(x=0;x<parent.frames.length;x++)
		 {
		  if (nomesf[x] != parent.frames[x].name)
		    {
			//Nome dos Frames
			top.location.href=endsite;
			}
	     }
	}
}catch(e)
{
	  var detect = navigator.userAgent.toLowerCase();
	  if (detect.indexOf('mac') < 1)
	  {
	   //Catch caso carrege de um iframe
	   top.location.href=endsite;
	  }
}

var InternetBanking
var URL = parent.self.location.href;

var c = new Array();
c[0]="www.bradesco.com.br";
c[1]="d4312s022";
c[2]="10.241.5.4";
c[3]="acelerador.bradesco.com.br";
c[4]="200.246.208.5";
c[5]="200.155.80.15";
c[6]="200.155.84.15";
c[7]="200.155.88.15";
c[8]="www.bradescoprivate.com.br";
c[9]="www.privatebradesco.com.br";
c[10]="bradescoprivate.com.br";
c[11]="www.bradescoprivatebank.com.br";

var localizado = 0;
for (f = 0; f <= 11; f++) { 
	if (URL.indexOf(c[f]) > 1) {
	 localizado = 1;
	}
}

if (localizado == 0) {
 top.self.location.href = 'http://www.bradescoprivatebank.com.br/';
}  

function IB2000Open(IB2000Form)
{
	window.document.IB2000.action = IB2000Form.action
	window.document.IB2000.AGN.value = IB2000Form.AGN.value
	window.document.IB2000.CTA.value = IB2000Form.CTA.value
	window.document.IB2000.DIGCTA.value = IB2000Form.DIGCTA.value
	window.document.IB2000.TPCONTA.value = IB2000Form.TPCONTA.value

	
if(navigator.appName.indexOf("Netscape") != -1)
   InternetBanking = window.open("", "InternetBanking","toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,screenX=0,screenY=0,left=0,top=0,width=765,height=528");   
else
   InternetBanking = window.open("", "InternetBanking","toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,screenX=0,screenY=0,left=0,top=0,width=765,height=528");
   

	if(IB2000Form.AGN.value != '' && IB2000Form.CTA.value != '' && IB2000Form.DIGCTA.value != '' && IB2000Form.TPCONTA.value != '')
	{
		InternetBanking = window.open("", "InternetBanking","toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,screenX=0,screenY=0,left=0,top=0,width=765,height=528");
		window.document.IB2000.submit()
		IB2000Form.reset()
	}
	return false;
}

function IB2000OpenCadSenha()
{
if(navigator.appName.indexOf("Netscape") != -1)
        IB2K1CADSENHA = window.open("https://wwwss.bradesco.com.br/scripts/ib2k1.dll/CADSENHA/CONDUSO", "IB2K1CADSENHA","toolbar=1,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,screenX=0,screenY=0,left=0,top=0,width=765,height=440");
else
        IB2K1CADSENHA = window.open("https://wwwss.bradesco.com.br/scripts/ib2k1.dll/CADSENHA/CONDUSO", "IB2K1CADSENHA","toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,screenX=0,screenY=0,left=0,top=0,width=765,height=440");
return false;
}
function CadAltSenha()
{
if(navigator.appName.indexOf("Netscape") != -1)
	IB2K1CADSENHA = window.open("https://wwwss.bradesco.com.br/scripts/ib2k1.dll/CADSENHA/CONDUSO", "IB2K1CADSENHA","toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=0,screenX=0,screenY=0,left=0,top=0,width=765,height=440");
else
	IB2K1CADSENHA = window.open("https://wwwss.bradesco.com.br/scripts/ib2k1.dll/CADSENHA/CONDUSO", "IB2K1CADSENHA","toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,screenX=0,screenY=0,left=0,top=0,width=765,height=440");
return false;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function Apenas_Numeros(e, campo)
{
	var msg = "Favor digitar somente caracteres numéricos";
	var monta = "";
	var NS = (navigator.appName == "Netscape")
	var Digit = parseInt(eval( ( (NS)?"e.which":"e.keyCode" ) ))

	if (!(Digit>47 && Digit<58 || Digit == 8 || Digit == 0 || Digit == 13))				
	{
		alert (msg);
		monta = "document.FormIB2001." + campo + ".focus();";
		eval(monta);
		return false;	
	}
	else
	{
		if (parseInt(Digit) == 13)
		{
			if(VerificaLogin() == true)
			{IB2000Open(window.document.FormIB2001);}
			else
			{ValidaLogin(campo);}
		}		
	}
}

function DVFoco(valor)
{
    switch (valor) {
    	case 1 : {parent.conteudo.ConteudoPrincipal.focus(); break;}
    	case 2 : {parent.conteudo.MenuDeServicos.focus(); break;}
    	case 3 : {parent.conteudo.MenuPrincipal.focus(); break;}
    }		
}

function VerificaLogin()
{
	var valor = true;
	var Agencia = parseInt(document.FormIB2001.AGN.value);
	var Conta = parseInt(document.FormIB2001.CTA.value);
	var Digito = parseInt(document.FormIB2001.DIGCTA.value);
	if ((isNaN(Agencia)== true)||(isNaN(Conta)== true)||(isNaN(Digito)== true)) 
	{valor = false;}
	else
	{
		if(ValidaDigito() == true)
		{valor = true;}
		else
		{valor = false;}
	}	
	return valor;
}

function ValidaLogin(campo)
{
	if (VerificaLogin() == true)
	{IB2000Open(window.document.FormIB2001);}
	else
	{
		var Agencia = parseInt(document.FormIB2001.AGN.value);
		var Conta = parseInt(document.FormIB2001.CTA.value);
		var Digito = parseInt(document.FormIB2001.DIGCTA.value);
		if (isNaN(Agencia)== true)
		{
			alert("Favor preencher o campo agência");
			document.FormIB2001.AGN.focus();
		}
		else
		{
			if (isNaN(Conta)== true)
			{
				if((campo == "CTA") && (document.FormIB2001.CTA.value == ""))
				{alert("Favor preencher o campo conta");}
				document.FormIB2001.CTA.focus();				
			}
			else
			{
				if (isNaN(Digito)== true)
				{
					if((campo == "DIGCTA") && (document.FormIB2001.DIGCTA.value == ""))
					{alert("Favor preencher o dígito de sua conta");}
					document.FormIB2001.DIGCTA.focus();
				}
				else
				{
					alert("Informações inválidas. Por favor, verifique agência, conta e dígito");
					document.FormIB2001.CTA.focus();
				}
			}
		}	
	}
}
	
function ValidaDigito()
{
	var lsoma = 0;
	var ipeso = 2;
	var dv_informado = document.FormIB2001.DIGCTA.value;
	var dv_conta = document.FormIB2001.CTA.value;
	var tam = document.FormIB2001.CTA.value.length;
	var conta = new Array(tam);
	for (i=0; i<=tam; i++) 
	{conta[i] = dv_conta.substr( i, 1);}
	 while (tam > 0)
	{
		digito = conta[--tam];
		if ((digito >= 0) && (digito <= 9)) 
		{ 
			lsoma = lsoma + (digito - 0) * ipeso; 
			ipeso = ipeso + 1; 
			if (ipeso > 7) 
			{ipeso = 2;}
		} 
	}
	lsoma %= 11; 
	lsoma = 11 - lsoma;
	if ((lsoma == 11) || (lsoma == 10))
	{lsoma = 0;}
	if (parseInt(dv_informado) == parseInt(lsoma))
	{RetDig = true;}
	else
	{RetDig = false;}
	return RetDig;	
}

function Verificar() 
{

var ctrl=window.event.ctrlKey;
var tecla=window.event.keyCode; 
if (ctrl && tecla==67) {event.keyCode=0; event.returnValue=false;}
if (ctrl && tecla==86) {event.keyCode=0; event.returnValue=false;}
}

function checa_agencia(campo)
{
	switch (campo)
	{
		case "AGN" : {
			if(document.FormIB2001.AGN.value.length == 4)
			{document.FormIB2001.CTA.focus();}	
			break;
		}
		case "CTA" : {
			if(document.FormIB2001.CTA.value.length == 7)
			{document.FormIB2001.DIGCTA.focus();}
			break;
		}
	}	
}

ns = document.layers ? 1 : 0;
ie = document.all ? 1 : 0;
oldId = "Layer1";

function ProcuraObjeto(n, d) 
{ 
	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=ProcuraObjeto(n,d.layers[i].document);
	
	if(!x && document.getElementById) x=parent.conteudo.document.getElementById(n); return x;
}

function controle() 
{
	var i,p,v,obj,args=controle.arguments;

	for (i=0; i<(args.length-2); i+=3) 
	if ((obj=ProcuraObjeto(args[i]))!=null) 
	{ 
		v=args[i+2];

		if (obj.style) 
		{ 
			obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; 
		}
		
		obj.visibility=v; 
	}
}
function lyrVisual(id,estado)
{
	try
	{
		if (navigator.appName == "Netscape") {		
			opcao = (estado) ? "show" : "hide";			
			controle(id,'',opcao);		
		}
		else{
			opcao = (estado) ? "visible" : "hidden";
			parent.conteudo.document.all[oldId].style.visibility = "hidden";
			parent.conteudo.document.all[id].style.pixelTop = parent.conteudo.document.body.scrollTop;
			parent.conteudo.document.all[id].style.visibility = opcao;
			oldId = id.toString()
		}
	}
	catch(e)
	{}
}

function mOut(src,clrIn)

{

	if (!src.contains(event.toElement)) {

	  src.style.cursor = 'default';

	  src.bgColor = clrIn;

	}

}



function onMouseOut()

{

	parent.lyrVisual('Layer1',0)

}

var tempo



function TeclaDigitada(tecla)

{

    if(typeof(tecla) == 'undefined')

    var tecla = window.event;

    var codigo = (tecla.which ? tecla.which : tecla.keyCode ? tecla.keyCode : tecla.charCode);

   

    return codigo; 

}



function TabAutomatico(sender, numCaracteres, proximoControle, tecla)

{

    var codigo = TeclaDigitada(tecla);



    //Permite navegação dentro do campo

    if ( codigo == 9 || codigo == 13 || codigo == 16 || codigo == 13 )

        return false;



    if (sender.value.length == numCaracteres) proximoControle.focus();

        return true;

}



function MarcaCheckBox(controleDDD, controleTelefone, controleMarcar)

{

    if (controleDDD.value.length == 2 && controleTelefone.value.length == 8)

    {

        controleMarcar.disabled = false;

        controleMarcar.checked = true;

    } 

        

        

}