<!--
var sCtrlAddFindFunds="";

function valida() {
	var email = document.getElementById('loga').user.value;
	if(email.indexOf("@") == -1) {document.getElementById('loga').submit();}
	else if (email.match(/@uol\.com\.br/)) {document.getElementById('loga').submit();}
	else {
		document.getElementById('loga').action = "https://visitante.acesso.uol.com.br/login.html";
		document.getElementById('loga').submit();
	}
} 

function F_ListAdm(sCtrl,FieldAdm) {
	var url = 'listadm.aspx?pag=' + escape(sCtrl) + '&FieldAdm=' + escape(FieldAdm);
    
    window.open(url,"winlistadmcomp","alwaysRaised=yes,height=500,width=450,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no",true);
}

function F_NavPag(sIdFundo,sPag){
     document.getElementById('FundoConsultado').value=sIdFundo;
     document.getElementById('TC').value=sPag;
     if (document.getElementById('Flag'))
        document.getElementById('Flag').value="1";
     if (document.getElementById('FlagRkg'))
        document.getElementById('FlagRkg').value="false";
     if (document.getElementById('FlagComp'))
        document.getElementById('FlagComp').value="false";
    if (document.getElementById('FlagEdtPortfAttrb'))
        document.getElementById('FlagEdtPortfAttrb').value="false";
}

function F_NavRkg(sName,sCtrl){
     document.getElementById('FundoConsultado').value=sName;
     document.getElementById('TC').value=sCtrl;
     if (document.getElementById('FlagRkg'))
        document.getElementById('FlagRkg').value="true";
     if (document.getElementById('Flag'))
        document.getElementById('Flag').value="";
     if (document.getElementById('FlagComp'))
        document.getElementById('FlagComp').value="false";
     document.getElementById('FormPesq').submit();
}

function F_NavComp(sName,sCtrl){
     document.getElementById('FundoConsultado').value=sName;
     document.getElementById('TC').value=sCtrl;
     if (document.getElementById('FlagComp'))
        document.getElementById('FlagComp').value="true";
     if (document.getElementById('Flag'))
        document.getElementById('Flag').value="";
     if (document.getElementById('FlagRkg'))
        document.getElementById('FlagRkg').value="false";
}

function F_EditarPortf(ID,Name) {
    document.getElementById('IDPortf').value=ID;
    document.getElementById('NPortif').value=Name;
    document.getElementById('TC').value="edtportf";
    if (document.getElementById('FlagEdtPortfAttrb'))
        document.getElementById('FlagEdtPortfAttrb').value="true";
    document.getElementById('FormPesq').submit();

}

function F_EditarAtrib(ID,Name) {
    document.getElementById('IDPortf').value=ID;
    document.getElementById('NPortif').value=Name;
    document.getElementById('TC').value="edtattrb";
    if (document.getElementById('FlagEdtPortfAttrb'))
        document.getElementById('FlagEdtPortfAttrb').value="true";
    document.getElementById('FormPesq').submit();

}

function F_SearchFund(form, campo) 
{
	var sInputTxt = document.getElementById(campo).value;
	sInputTxt  = sInputTxt.replace(/%/gi,"");
	sInputTxt = sInputTxt.replace(/^ +| +$/gi,"");
	document.getElementById(campo).value = sInputTxt;
	sInputTxt = sInputTxt.replace(/ /g,"");
		
	if( sInputTxt.length >= 3 )
	{
		document.getElementById(form).submit();
	}
	else
		alert("Para efetuar uma busca coloque ao menos 3 caracteres.");

}

function F_CompareRanking() 
{
	var oDropDown1 = document.getElementById('MenuRkg_SelSuperTipo');
	var oDropDown2 = document.getElementById('MenuRkg_SelTipo');
	var oDropDown3 = document.getElementById('MenuRkg_SelGestor');	
	if( oDropDown1.selectedIndex != 0 || oDropDown2.selectedIndex != 0 || oDropDown3.selectedIndex != 0 )
		document.getElementById('FormPesq').submit();
	else
		alert("Selecione ao menos um parâmetro para a consulta.");
}

function F_OpenSearchFunds() {
	var url;
	var aux;
	var oInputTxt1 = document.getElementById('NomeFundo1');
	var oInputTxt2 = document.getElementById('NomeFundo2');
	var bCtrl = 1;
	url = 'findfunds2.aspx';
	
	var sInputTxt1 = oInputTxt1.value;
	sInputTxt1  = sInputTxt1.replace(/%/gi,"");
	sInputTxt1 = sInputTxt1.replace(/^ +| +$/gi,"");
	document.getElementById('NomeFundo1').value = sInputTxt1;
	sInputTxt1 = sInputTxt1.replace(/ /g,"");
    
    var sInputTxt2 = oInputTxt2.value;
	sInputTxt2  = sInputTxt2.replace(/%/gi,"");
	sInputTxt2 = sInputTxt2.replace(/^ +| +$/gi,"");
	document.getElementById('NomeFundo2').value = sInputTxt2;
	sInputTxt2 = sInputTxt2.replace(/ /g,"");
    
    if( oInputTxt1.value )
    {
        if (sInputTxt1.length > 2) 
        {
            aux = oInputTxt1.value;
            if (oInputTxt2.value)
             {
                if (sInputTxt2.length > 2) 
                {
                    aux = aux + '|' + oInputTxt2.value;
                }
                else 
                {
                    alert( "O número mínimo de caracteres para uma pesquisa é 3." );
                    oInputTxt2.focus();
                    bCtrl = 0;
                }
            }
            if (bCtrl == 1) 
            {
                url = url + '?nome=' + escape(aux);
                window.open(url,"winaddfundscomp","alwaysRaised=yes,height=220,width=450,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no",true);
            }
        }
        else 
        {
            alert( "O número mínimo de caracteres para uma pesquisa é 3." );
            oInputTxt1.focus();
        }
        
    }
    else
    {
        alert( "Digite um nome ou código para pesquisa." );
        oInputTxt1.focus();
    }
        
}

function F_AddFindFund(sNomeFundo,sIdCodAnbid,sCampoForm){
    var oCampoFormNome = eval('window.opener.document.getElementById("NomeFundo' +  sCampoForm + '")');
    var oCampoFormId = eval('window.opener.document.getElementById("sIdFundo' + sCampoForm + '")');
    
    oCampoFormNome.value = sNomeFundo;
    oCampoFormId.value = sIdCodAnbid;
    if (sCampoForm == '1'){
        sCtrlAddFindFunds = 1;
    }
}

function F_AddFindFundComp(oDrpDown,sCampoForm){
    var oCampoFormNome = eval('window.opener.document.getElementById("NomeFundo' +  sCampoForm + '")');
    var oCampoFormId = eval('window.opener.document.getElementById("sIdFundo' + sCampoForm + '")');
    var sIdCodAnbid = oDrpDown.options[oDrpDown.selectedIndex].value;
    var selectText = oDrpDown.options[oDrpDown.selectedIndex].text;
	var iIndex1 = selectText.indexOf(" (");
    var sNomeFundo = selectText.substring(0,iIndex1);

    oCampoFormNome.value = sNomeFundo;
    oCampoFormId.value = sIdCodAnbid;
    if (sCampoForm == '1'){
        sCtrlAddFindFunds = 1;
    }
}

function F_ExecAddFindFund() {
    var oCampoFormNome1 = window.opener.document.getElementById('NomeFundo1');
    var oCampoFormId1 = window.opener.document.getElementById('sIdFundo1');
    var oCampoFormFlag = window.opener.document.getElementById('Flag');

    if (sCtrlAddFindFunds){
        oCampoFormFlag.value='True';
	    window.opener.focus();
	    window.close();
	}
	else {
	    alert("Selecione o primeiro fundo para comparar.");
	} 
}

function F_ExecCompare(oForm,IdobjIndicador){
    var oIndicador = eval('document.getElementById("' + IdobjIndicador + '")');
    
    if (!oForm.NomeFundo1.value){
        alert("Selecione o primeiro fundo.");
        oForm.NomeFundo1.focus();
        return (false);
    }
    if (!oIndicador.value){
        alert("Selecione um indicador.");
        oIndicador.focus();
        return (false);
    }
    
    if ((oForm.sIdFundo1.value) && (oForm.Flag.value == 'True')){
        //oForm.action="compareresult.asp";
        oForm.submit();
    }
    else {
        alert("Falta ID Anbid. Por favor, utilize o botão procurar fundos para adicionar os fundos.");
    }    
}

function F_VerifItem(oSelect,NameCheckBox){
    var re=/^previdencia|^previdência/gi;
    var str=oSelect[oSelect.selectedIndex].value;
    var oCheckBox = eval('document.getElementById("' + NameCheckBox + '_0")');

    if (str.search(re)!=-1)
    {
        oCheckBox.checked=true;
    }
    else
    {
        oCheckBox.checked=false;
    }
}

function F_download(sId,sURL) {
    document.getElementById('sDocId').value=sId;
    document.FormEvol.action=sURL;
    document.FormEvol.submit();
}

function F_OpenAddFundo(sNomePortf,sIdPortf){
	var url;
	url = 'addfundportf.aspx?p=' + escape(sNomePortf) + '&id=' + escape(sIdPortf);
	if ((sNomePortf)&&(sIdPortf)) {
	    window.open(url,"winaddfunds","alwaysRaised=yes,height=500,width=600,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no",true);
	}
	else {
	    alert("Digite um nome para este portifólio");
	}
}

function F_SetNamePortf(sNamePortf,sctrl){
	document.getElementById('FlagPortf').value=sNamePortf;
	if (sctrl=='1')
	{
		document.getElementById('novoportifolio1').style.visibility='visible';
		document.getElementById('novoportifolio2').style.visibility='visible';
	}
	else 
	{
		document.getElementById('novoportifolio1').style.visibility='hidden';
		document.getElementById('novoportifolio2').style.visibility='hidden';
	}
}

//Exportação para Excel
function F_ExpExcel(sIdAtrib,sNomesAtrib,sIdSerie,sTipoPeriodo,sIntervaloDatas){
	var str = "./Fundos_BDS.asp?";
	var sDataTemp;
	var DataIni = "";
	var DataFin = "";
	var sTipoRelatorio = "";
	var sTipoVisual = "";
	var sTipoPeriodoTrat = sTipoPeriodo.toUpperCase();
	
	if (F_ExpExcel.arguments.length > 5) {
	    sTipoRelatorio = F_ExpExcel.arguments[5];
	    sTipoVisual = F_ExpExcel.arguments[6];
	}
	if ((sTipoPeriodoTrat != "PDU") && (sTipoPeriodoTrat != "UDU") && (sTipoPeriodoTrat != "ENTD")) {
		DataIni = "d-" + sTipoPeriodo;
		DataFin = "d-0";
	}
	else {
		sDataTemp = sIntervaloDatas.split(":");
		DataIni = sDataTemp[0];
		DataFin = sDataTemp[1];
	}
	str = str + "Serie=" + sIdSerie + "&DataI=" + escape(DataIni) + "&DataF=" + escape(DataFin) + "&Per=" + sTipoPeriodo + "&TpRel=" + sTipoRelatorio + "&TpOr=" + sTipoVisual
	window.open(str,"winexcel","alwaysRaised=yes,height=300,width=615,status=no,toolbar=no,menubar=yes,scrollbars=yes,resizable=yes,location=no",true);
}

function F_ExpExcel2(sIdAtrib,sNomesAtrib,sIdSerie,sTipoPeriodo,sIntervaloDatas){
	var str = "./Fundos_BDS.aspx?";
	var sDataTemp;
	var DataIni = "";
	var DataFin = "";
	var sTipoRelatorio = "";
	var sTipoVisual = "";
	var sTipoPeriodoTrat = sTipoPeriodo.toUpperCase();
	
	if (F_ExpExcel2.arguments.length > 5) {
	    sTipoRelatorio = F_ExpExcel2.arguments[5];
	    sTipoVisual = F_ExpExcel2.arguments[6];
	}
	if ((sTipoPeriodoTrat != "PDU") && (sTipoPeriodoTrat != "UDU") && (sTipoPeriodoTrat != "ENTD")) {
		DataIni = "d-" + sTipoPeriodo;
		DataFin = "d-0";
	}
	else {
		sDataTemp = sIntervaloDatas.split(":");
		DataIni = sDataTemp[0];
		DataFin = sDataTemp[1];
	}
	str = str + "Serie=" + sIdSerie + "&DataI=" + escape(DataIni) + "&DataF=" + escape(DataFin) + "&Per=" + sTipoPeriodo + "&TpRel=" + sTipoRelatorio + "&TpOr=" + sTipoVisual + "&IdAtrib=" + sIdAtrib + "&NomeAtrib=" + sNomesAtrib
	window.open(str,"winexcel","alwaysRaised=yes,height=300,width=615,status=no,toolbar=no,menubar=yes,scrollbars=yes,resizable=yes,location=no",true);
}

function F_ShowHelp(sPage)
{
	window.open(sPage,"Ajuda","alwaysRaised=yes,height=427,width=615,status=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,,location=no",true);
}
//-->