function openPop(psPath, pnWidth, pnHeight){
	var lsName, lnTop, lnLeft, pop;
	lnLeft = Math.round(screen.width / 2 - pnWidth / 2);
	lnTop = Math.round(screen.height / 2 - pnHeight / 2);
	lsArgs = arguments.length == 4 ? arguments[3] : "";
	pop = window.open(psPath, 'BRADESCO', 'width=' + pnWidth + ',height=' + pnHeight + ',top=' + lnTop + ',left=' + lnLeft + ',toolbar=0,menubar=0,directories=0,location=0,status=1,' + lsArgs);
}

function openPopPosition(psPath, pnWidth, pnHeight){pop = window.open(psPath, 'BRADESCO', 'width=' + pnWidth + ',height=' + pnHeight + ',top=0,left=0,toolbar=0,menubar=0,directories=0,location=0,status=1,scrollbars=1');}

function openExternalPop(url, type){
    switch(type)
    {
        case 1:
            window.open('http://institucional.bradesco.com.br/pop_site_externo/pop_externo.asp?'+url+'','A','width=581,height=477,scrollbars=0');
        break;
        case 2:
            window.open('http://institucional.bradesco.com.br/pop_site_externo/pop_pop_externo.asp?'+url+'','A','width=581,height=477,scrollbars=0');
        break;
    }
    void(0);
}

function goToPage(pageNumber){
	document.forms[0].pageNumber.value = pageNumber;
	document.forms[0].submit();
}

var nomesf = new Array();
nomesf[0] = "frm_top";
nomesf[1] = "mid";
var nframes = 2;
var endsite = "http://www.bradescocartoes.com.br/";

if (document.URL.indexOf('SimuladorPJ') == -1){
    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;
	      }
}
}

