﻿// JScript File

<!--
/////////////////////////////////////////////////////////////////////////////////////
// GetObject                                                                       //
/////////////////////////////////////////////////////////////////////////////////////
function funcGetObject( id )
    {   if ( typeof( window.innerWidth ) == 'number' ) 
            { return(document.getElementById(id)); }
        else
            { if (document.all) { return(document.all(id)); }
                if (document.getElementById) { return(document.getElementById(id)); } } }

/////////////////////////////////////////////////////////////////////////////////////
// Show Menu                                                                       //
/////////////////////////////////////////////////////////////////////////////////////
var strCurrentMenu                                        = '';
var strCurrentMenuClass                                   = '';

function funcShowMenu( id , tag )
    {   funcGetObject('aBlocker').style.display           = 'none';
        funcGetObject('divContas').style.display          = 'none';
        funcGetObject('divCartoes').style.display         = 'none';
        funcGetObject('divCredito').style.display         = 'none';
        funcGetObject('divSeguros').style.display         = 'none';
        funcGetObject('divAssessoria').style.display      = 'none';
        funcGetObject('divInvestimentos').style.display   = 'none';
        funcGetObject('divServicos').style.display        = 'none';

		var strCurrentClass                               = tag.className;
        strCurrentMenu.className                          = strCurrentMenuClass;

        if ( id != '' ) 
            {   strCurrentMenu                            = tag;
                strCurrentMenuClass                       = tag.className;
                funcGetObject('aBlocker').style.display   = 'block';
                funcGetObject( id ).style.display         = 'block';
                tag.className                             = strCurrentClass + ' aOn'; } }

/////////////////////////////////////////////////////////////////////////////////////
// Show Elements                                                                   //
/////////////////////////////////////////////////////////////////////////////////////
var UArrCurrent                                                   = [];
var UArrSelects                                                   = [];
var UstrBrowser                                                   = navigator.appVersion.search( 'MSIE 6.0' )   

// Link para a imagem transparente
var UstrImgSpacer                                                 = '../images/site/spacer.gif';                
// Class para o estado Activo
var UstrActiveTabClass                                            = 'aOn';
var UintCounter                                                   = 1;

function funcShowElement( strId , startPoint )
    {	if ( UstrBrowser > -1 )
			{	if ( strId == '' && startPoint == '' )
					{	UintCounter	= 1;
						if ( funcGetObject( 'HitZone' ) != undefined )
							{	for ( i = 1 ; i <= ( UArrSelects.length ); i++ )
									{   document.getElementsByTagName('select')[ i - 1 ].style.display = UArrSelects[ i - 1 ]; }
								funcGetObject( 'HitZone' ).parentNode.removeChild( funcGetObject( 'HitZone' ) );
								funcGetObject( 'HitZoneTemp' ).parentNode.removeChild( funcGetObject( 'HitZoneTemp' ) ); }
						UArrCurrent                               = [];
						UArrSelects                               = []; }

				if ( UintCounter == 1 && strId != '' && startPoint != '' ) 
					{	UintCounter++;
						UArrCurrent                               = [];
						UArrSelects                               = [];

						if ( startPoint.id == '' || startPoint.id == undefined )
							{	startPoint.id                     = 'ContentZoneTemp';
								UArrCurrent[0]                    = startPoint.id; }
						else
							{	UArrCurrent[0]                    = startPoint.id; }

						if ( startPoint.parentNode.id == '' || startPoint.parentNode.id == undefined )
							{	startPoint.parentNode.id          = strId + 'Parent';
								myRange                           = funcGetObject ( strId + 'Parent' ); }
						else
							{	myRange                           = funcGetObject ( startPoint.parentNode.id ); }

						myElement                                 = document.createElement( 'a' );
						myElement.id                              = 'HitZone';
						myElement.style.display                   = 'block';
						myElement.style.position                  = 'absolute';
						myElement.style.zIndex                    = '50';
						myElement.style.top                       = '0';
						myElement.style.left                      = '0';
						myElement.style.background                = 'transparent url( ' + UstrImgSpacer + ')';
						myElement.onmouseover                     = function() { funcShowElement( '', '' ); };
						myElement.innerHTML                       = '<img src="' + UstrImgSpacer + '" alt="" style="width:100%;height:100%;" />';
						myElement.style.width                     = document.documentElement.clientWidth + 'px';
						myElement.style.height                    = document.documentElement.clientHeight + 'px';

						var i                                     = 0;

						for ( i = 1 ; i <= ( document.getElementsByTagName('select').length ); i++ )
							{   UArrSelects[ i - 1 ] = document.getElementsByTagName('select')[ i - 1 ].style.display;
								document.getElementsByTagName('select')[ i - 1 ].style.display = 'none'; }

						var myInfoWindow                          = funcGetObject( strId );
							myInfoWindow.style.display            = 'block';
							myInfoWindow.style.zIndex             = '65';
							myInfoWindow.style.position           = 'absolute'; 
							
						var myActualWidth                         = ( ( document.documentElement.clientWidth - 956 ) / 2 ) ;

						var myTempElement                         = '';

						myTempElement                             = document.createElement( 'div' );
						myTempElement.id                          = 'HitZoneTemp';

						if ( myActualWidth < 0 )
							{	myTempElement.style.margin                = '0 0 0 5px'; }
						else
							{	myTempElement.style.margin                = '0 0 0 ' + myActualWidth.toFixed(0) + 'px'; }

						myTempElement.style.textAlign             = 'center';
						myTempElement.style.display               = 'block';
						myTempElement.style.width                 = '956px';
						myTempElement.style.position              = 'absolute';
						myTempElement.style.zIndex                = '55';
						myTempElement.style.top                   = '0';
						myTempElement.style.left                  = '0';
						myTempElement.innerHTML                   = '<div id="' + myRange.id + 'HitZoneTemp">' + myRange.innerHTML + '</div>';

						myRange.style.width                       = myRange.clientWidth;
						myRange.style.height                      = myRange.clientHeight;

						myInfoWindow.style.display                = 'none';
						myInfoWindow.style.zIndex             	  = '';
						myInfoWindow.style.position               = ''; 

						document.body.insertBefore( myElement );
						document.body.insertBefore( myTempElement ); } }
			else
				{	if ( strId == '' && startPoint == '' )
						{	UArrCurrent[2].style.display          = 'none';
							UArrCurrent[2].style.zIndex           = 0;
							UArrCurrent[2].style.position         = '';

							UArrCurrent[3].style.zIndex           = 60;
							UArrCurrent[3].style.position         = '';
							if ( funcGetObject( 'HitZone' ) != undefined )
								{	funcGetObject( 'HitZone' ).parentNode.removeChild( funcGetObject( 'HitZone' ) ); }
							UArrCurrent                           = [];
							UArrSelects                           = []; }

					if ( strId != '' && startPoint != '' ) 
						{	if ( UArrCurrent[0] != undefined )
								{	UArrCurrent[2].style.display  = 'none';
									UArrCurrent[2].style.zIndex   = 0;
									UArrCurrent[2].style.position = '';

									UArrCurrent[3].style.zIndex   = 60;
									UArrCurrent[3].style.position = ''; }

							UArrCurrent                           = [];
							UArrSelects                           = [];

							UArrCurrent[0]                        = startPoint;

							if ( startPoint.parentNode.id == '' || startPoint.parentNode.id == undefined )
								{	startPoint.parentNode.id      = strId + 'Parent';
									UArrCurrent[3]                = funcGetObject ( strId + 'Parent' ); }
							else
								{	UArrCurrent[3]                = funcGetObject ( startPoint.parentNode.id ); }
								
							UArrCurrent[2]                        = funcGetObject( strId );
							UArrCurrent[2].style.display          = 'block';
							UArrCurrent[2].style.zIndex           = '65';
							UArrCurrent[2].style.position         = 'absolute';
							UArrCurrent[3].style.zIndex           = '60';
							UArrCurrent[3].style.position         = 'relative';

							if ( funcGetObject( 'HitZone' ) == undefined )
								{	myElement                     = document.createElement( 'a' );
									myElement.id                  = 'HitZone';
									myElement.style.display       = 'block';
									myElement.style.position      = 'absolute';
									myElement.style.zIndex        = '50';
									myElement.style.top           = '0';
									myElement.style.left          = '0';
									myElement.style.background    = 'transparent url( ' + UstrImgSpacer + ')'; 
									myElement.onmouseover         = function() { funcShowElement( '', '' ); };
									myElement.style.width         = '100%';
									myElement.style.height        = '100%';

									UArrCurrent[3].parentNode.insertBefore( myElement , UArrCurrent[3] ); } } } }

/////////////////////////////////////////////////////////////////////////////////////
// On Start                                                                        //
/////////////////////////////////////////////////////////////////////////////////////
function funcFocus( id )
    {   if ( funcGetObject( id ) != null )
            {   funcGetObject( id ).focus() ; } }

/////////////////////////////////////////////////////////////////////////////////////
// Show Tabs                                                                       //
/////////////////////////////////////////////////////////////////////////////////////
function funcShowTabs( value )
    {   funcGetObject( 'tabIndices' ).className    = 'atabOff' ;
        funcGetObject( 'tabTitulos' ).className    = 'atabOff' ;
        funcGetObject( 'tabEuribor' ).className    = 'atabOff' ;

        funcGetObject( 'tableIndices' ).className  = 'stockTable Off' ;
        funcGetObject( 'tableTitulos' ).className  = 'stockTable Off' ;
        funcGetObject( 'tableEuribor' ).className  = 'stockTable Off' ;

        if ( value != '' ) 
            {   funcGetObject( 'tab' + value ).className      = 'atabOn' ;
                funcGetObject( 'table' + value ).className      = 'stockTable' ; } }

/////////////////////////////////////////////////////////////////////////////////////
// InterStitia                                                                     //
/////////////////////////////////////////////////////////////////////////////////////
function funcInterStitial( strUrl )
    {   strHtml      = '' ;
        objectWindow = funcGetObject( 'divInterStitial' ) ;
        objectWindow.style.display = 'none' ;
        objectWindow.innerHTML = strHtml;

        if( strUrl != null )
            {   strHtml += '<div class="wrapperSimul clearfix">\n' ;
                strHtml += '    <input type="image" class="alignRightExt" onClick="javascript:funcInterStitial();" src="../images/simulador/bot_fechar_simul.gif" />\n' ;
                strHtml += '    <div class="divClear"></div>\n' ;           	
                strHtml += '    <img src="../images/simulador/border_top.gif" alt="Border Top Layer" />\n' ;
                strHtml += '    <div class="frameSimul">\n' ;
                strHtml += '    <iframe id="iframeSimuladores" src="' + strUrl + '" frameborder="0"></iframe>\n' ;  			
                strHtml += '    </div>\n' ;
                strHtml += '    <img src="../images/simulador/border_bottom.gif" alt="Border Bottom Layer" />\n' ;
                strHtml += '</div>\n' ; 
                
                objectWindow.innerHTML = strHtml;
                objectWindow.style.display = 'block' ; } }

/////////////////////////////////////////////////////////////////////////////////////
// Show Tabs Parceiros                                                             //
/////////////////////////////////////////////////////////////////////////////////////
function funcShowPTabs( value )
    {     
        funcGetObject( 'ptabParceirosDestaque' ).className    = 'atabParceirOff' ;
        funcGetObject( 'ptabParceirosHotel' ).className    = 'atabParceirOff' ;
        funcGetObject( 'ptabParceirosCasa' ).className    = 'atabParceirOff' ;
        funcGetObject( 'ptabParceirosViagens' ).className    = 'atabParceirOff' ;
        funcGetObject( 'ptabParceirosInfor' ).className    = 'atabParceirOff' ;
        funcGetObject( 'ptabParceirosOutros' ).className    = 'atabParceirOff' ;
        
        funcGetObject( 'ptableParceirosDestaque' ).className  = 'parceirosList Off' ;
        funcGetObject( 'ptableParceirosHotel' ).className  = 'parceirosList Off' ;
        funcGetObject( 'ptableParceirosCasa' ).className  = 'parceirosList Off' ;
        funcGetObject( 'ptableParceirosViagens' ).className  = 'parceirosList Off' ;
        funcGetObject( 'ptableParceirosInfor' ).className  = 'parceirosList Off' ;
        funcGetObject( 'ptableParceirosOutros' ).className  = 'parceirosList Off' ;

        if ( value != '' ) 
            {   funcGetObject( 'ptab' + value ).className      = 'atabParceirOn' ;
                funcGetObject( 'ptable' + value ).className      = 'parceirosList' ; } }


/////////////////////////////////////////////////////////////////////////////////////
// Switch Tabs Associados                                                          //
/////////////////////////////////////////////////////////////////////////////////////

function funcSwitchTabs(tabId){

    switch (tabId){
        case 'tabAEmpresas':
            funcGetObject("tabAEmpresas").className = 'tabEmpresasOn';
            funcGetObject("tabAParticulares").className = 'tabParticularesOff';
            funcGetObject("LoginHomeBanking_imgLogin").src = '../images/Site/Login_Title_Empresas.png';
            
            funcGetObject("LoginHomeBanking_aPedido").href = funcGetObject("LoginHomeBanking_hf_Url_PedidoAdesaoEmpresas").value;
            funcGetObject("LoginHomeBanking_aSeguranca").href = funcGetObject("LoginHomeBanking_hf_Url_SegurancaEmpresas").value;            
                        
            funcGetObject("LoginHomeBanking_loginHB").onclick = function (){redirectToHB(2); return false;};
            break;
        case 'tabAParticulares':
            funcGetObject("tabAEmpresas").className = 'tabEmpresasOff';
            funcGetObject("tabAParticulares").className = 'tabParticularesOn';
            funcGetObject("LoginHomeBanking_imgLogin").src = '../images/Site/Login_Title_Particulares.png';
            
            funcGetObject("LoginHomeBanking_aPedido").href = funcGetObject("LoginHomeBanking_hf_Url_PedidoAdesaoParticulares").value;
            funcGetObject("LoginHomeBanking_aSeguranca").href = funcGetObject("LoginHomeBanking_hf_Url_SegurancaParticulares").value;
                        
            funcGetObject("LoginHomeBanking_loginHB").onclick = function (){redirectToHB(1); return false;};            
            break;
    }    
}

/////////////////////////////////////////////////////////////////////////////////////
// Show Tabs Conteúdo                                                             //
/////////////////////////////////////////////////////////////////////////////////////
function funcShowPTabsContentPage ( value )
    {   
        if (funcGetObject('ptabContentOpcaoUm')){
            funcGetObject( 'ptabContentOpcaoUm' ).className    = 'atabPaginaConteudOff' ;
        }
        if (funcGetObject('ptabContentOpcaoDois')){
            funcGetObject( 'ptabContentOpcaoDois' ).className    = 'atabPaginaConteudOff' ;
        }
        if (funcGetObject('ptabContentOpcaoTres')){
            funcGetObject( 'ptabContentOpcaoTres' ).className    = 'atabPaginaConteudOff' ;
        }
        if (funcGetObject('ptabContentOpcaoQuatro')){
            funcGetObject( 'ptabContentOpcaoQuatro' ).className    = 'atabPaginaConteudOff' ;
        }
        if (funcGetObject('ptabContentOpcaoCinco')){
            funcGetObject( 'ptabContentOpcaoCinco' ).className    = 'atabPaginaConteudOff' ;
        }
        if (funcGetObject('ptabContentOpcaoSeis')){
            funcGetObject( 'ptabContentOpcaoSeis' ).className    = 'atabPaginaConteudOff' ;
        }
        if (funcGetObject('ptabContentOpcaoSete')){
            funcGetObject( 'ptabContentOpcaoSete' ).className    = 'atabPaginaConteudOff' ;
        }
        if (funcGetObject('ptabContentOpcaoOito')){
            funcGetObject( 'ptabContentOpcaoOito' ).className    = 'atabPaginaConteudOff' ;
        }
        if (funcGetObject('ptabContentOpcaoNove')){
            funcGetObject( 'ptabContentOpcaoNove' ).className    = 'atabPaginaConteudOff' ;
        }
        if (funcGetObject('ptabContentOpcaoDez')){
            funcGetObject( 'ptabContentOpcaoDez' ).className    = 'atabPaginaConteudOff' ;
        }

        
        if (funcGetObject('ptableContentOpcaoUm')){
            funcGetObject( 'ptableContentOpcaoUm' ).className    = 'PaginaConteudoList Off' ;
        }
        if (funcGetObject('ptableContentOpcaoDois')){
            funcGetObject( 'ptableContentOpcaoDois' ).className    = 'PaginaConteudoList Off' ;
        }
        if (funcGetObject('ptableContentOpcaoTres')){
            funcGetObject( 'ptableContentOpcaoTres' ).className    = 'PaginaConteudoList Off' ;
        }
        if (funcGetObject('ptableContentOpcaoQuatro')){
            funcGetObject( 'ptableContentOpcaoQuatro' ).className    = 'PaginaConteudoList Off' ;
        }
        if (funcGetObject('ptableContentOpcaoCinco')){
            funcGetObject( 'ptableContentOpcaoCinco' ).className    = 'PaginaConteudoList Off' ;
        }
        if (funcGetObject('ptableContentOpcaoSeis')){
            funcGetObject( 'ptableContentOpcaoSeis' ).className    = 'PaginaConteudoList Off' ;
        }
        if (funcGetObject('ptableContentOpcaoSete')){
            funcGetObject( 'ptableContentOpcaoSete' ).className    = 'PaginaConteudoList Off' ;
        }
        if (funcGetObject('ptableContentOpcaoOito')){
            funcGetObject( 'ptableContentOpcaoOito' ).className    = 'PaginaConteudoList Off' ;
        }
        if (funcGetObject('ptableContentOpcaoNove')){
            funcGetObject( 'ptableContentOpcaoNove' ).className    = 'PaginaConteudoList Off' ;
        }
        if (funcGetObject('ptableContentOpcaoDez')){
            funcGetObject( 'ptableContentOpcaoDez' ).className    = 'PaginaConteudoList Off' ;
        }


        if ( value != '' ){   
            funcGetObject( 'ptab' + value ).className      = 'atabPaginaConteudOn' ;
            funcGetObject( 'ptable' + value ).className      = 'PaginaConteudoList' ; 
        } 
    }



//-->
