
    var isSelectionChange = false;

    function setSelectionChange() {

        var count = 0;
        isSelectionChange = true;
        isShowMessage = true;

        //count = document.all("numeroFundosSel").innerText = document.forms[0]['listFundosSel'].length;
		//count +=  document.all("numeroIndicesSel").innerText = document.forms[0]['listIndicesSel'].length;
		//count += document.all("numeroBenchSel").innerText = document.forms[0]['listBenchSel'].length;
		//count += document.all("numeroPortSel").innerText = document.forms[0]['listPortifolioSel'].length;

        if (count == 0)
            isShowMessage = false;
    }

    function copiarLista(from,to)
	{
        //if (document.forms[0][from].length==document.forms[0][to].length)  // se tudo ja esta copiado nao fazer nada
          //return;
        //count = copySelectedOptions(document.forms[0][from],document.forms[0][to]);
        count = copySelectedOptions(document.aspnetForm.ctl00$cphAdministrativoConteudo$lsbUfLista,document.aspnetForm.ctl00$cphAdministrativoConteudo$lsbUf);
        if (count > 0) {
            setSelectionChange();
        }
        //contabilizar();
	}

	function copiarTodaLista(from,to)
	{
        //if (document.forms[0][from].length==document.forms[0][to].length)  // se tudo ja esta copiado nao fazer nada
         // return;
        var count = 0;

        if (document.forms[0][from].length < 400)
        {
            count = copyAllOptions(document.forms[0][from],document.forms[0][to]);
            if (count > 0) {
                setSelectionChange();
            }
            //contabilizar();
        }
//        else
//        {

//           document.all.edtAddAllFundos.value = "all";
//           document.form.submit();
//        }
	}

	function removerDaLista (from)
	{
        var count = 0;
           count = removeSelectedOptions(document.forms[0][from]);
            if (count > 0) {
                setSelectionChange();
            }
           contabilizar();
	}

	function removerTudoLista (from)
	{
        var count = 0;
        if (document.forms[0][from].length < 400)
        {
	    count = removeAllOptions(document.forms[0][from]);
            if (count > 0) {
                setSelectionChange();
            }
            contabilizar();
        }
        else
        {
           document.all.edtDelAllFundos.value = "all";
           document.form.submit();
        }
	}


function RetirarSelecaoListBox(obj)
{
    for(i=0;i<obj.length;i++)
        obj[i].selected = false;
}
    function contabilizar()
	{
        var count = 0;
        //count = document.all("numeroFundosSel").innerText = document.forms[0]['listFundosSel'].length;
		//count +=  document.all("numeroIndicesSel").innerText = document.forms[0]['listIndicesSel'].length;
		//count += document.all("numeroBenchSel").innerText = document.forms[0]['listBenchSel'].length;
		//count += document.all("numeroPortSel").innerText = document.forms[0]['listPortifolioSel'].length;
        //redirection();
        return count;
    }

    function redirection()
    {
       var numOpcoes = 0;
       var from = document.forms[0]['listFundosSel'];
       var str = "";
       var str1 = "";
       //document.all.mudou.value = "true";

       if(hasOptions(from)){

             str = str +"edtListaFundos="+ from.options.length;
             if (from.options.length>0)
                numOpcoes = numOpcoes + from.options.length;
             str1 = "";
             for(var i=(from.options.length-1);i>=0;i--)
             {
                str1 = str1 + "|" + from.options[i].value
             }
             str = str + str1;
       }
       //document.all.edtListaFundos.value = from.options.length+str1;

       //from = document.forms[0]['listIndicesSel'];

       if(hasOptions(from)){
             if (from.options.length>0)
             {
                 if (str.indexOf("edtListaFundos") > -1)
                    str = str+"&";
                 str = str +"edtListaIndices="+ from.options.length;
             }
             numOpcoes = numOpcoes + from.options.length;
             str1 = "";
             for(var i=(from.options.length-1);i>=0;i--)
             {
                  str1 = str1 + "|" + from.options[i].text
             }
             str = str + str1;
       }
       //document.all.edtListaIndices.value = from.options.length+str1;

      //from = document.forms[0]['listBenchSel'];

       if(hasOptions(from)){
             if (from.options.length>0)
             {
                if (str.indexOf("edtListaFundos") > -1)
                    str = str+"&";
                str = str +"edtListaBench="+ from.options.length;
            }

            numOpcoes = numOpcoes + from.options.length;
            str1 = "";
            for(var i=(from.options.length-1);i>=0;i--)
            {
                 str1 = str1 + "|" + from.options[i].text
            }
            str = str + str1;
       }
       //document.all.edtListaBench.value = from.options.length+str1;

       //from = document.forms[0]['listPortifolioSel'];

       if(hasOptions(from)){
             if (from.options.length>0)
             {
                 if (str.indexOf("edtListaFundos") > -1)
                    str = str+"&";
                 str = str +"edtListaPort="+ from.options.length;
             }
             numOpcoes = numOpcoes + from.options.length;
             str1 = "";
             for(var i=(from.options.length-1);i>=0;i--)
             {
                  str1 = str1 + "|" + from.options[i].text
             }
             str = str + str1;
       }
       //document.all.edtListaPort.value = from.options.length+str1;
       //parent.uptop.processarLinksPost(str)

    }

//    function submitPost(gotopage)
//    {
//        document.all.edtRedirect.value = gotopage;
//        document.all.form.submit();
//    }


//    function submitXY(permiteNenhum)
//	{
//        parent.uptop.processarLinksOriginais();

//        if (document.all.edtRedirect.value == "wait.jsp?gotopage=showRelatorioFundo.jsp&tipo=2&msg0=Calculando...")
//        {

//            if ((document.all.listFundosSel.length + document.all.listPortifolioSel.length) > 10 || (document.all.listFundosSel.length + document.all.listPortifolioSel.length) < 1)
//            {
//                document.all.edtRedirect.value = "";
//                alerta("Selecione entre 1 e 10 fundos/portfolios para a lâmina comparativa.");
//                return;
//            }
//        }
//        else
//        {
//            if (document.all.edtRedirect.value == "wait.jsp?gotopage=showRelatorioFundo.jsp&tipo=1&msg0=Calculando...")
//            {
//                if (document.all.listFundosSel.length < 1)
//                {
//                    document.all.edtRedirect.value = "";
//                    alerta("Selecione pelo menos 1 fundo para a lâmina individual.");
//                    return;
//                }
//            }
//        }

//        if (!permiteNenhum){
//            if (document.all.listPortifolioSel.length == 0
//                && document.all.listBenchSel.length == 0
//                && document.all.listIndicesSel.length == 0
//                && document.all.listFundosSel.length == 0) {

//                getScrollXY(document.form.scroll);
////                alert(document.all.hdLimpar.value);
//                if(document.all.hdLimpar.value != "Limpar")
//                {
//                    alerta('Nenhum item foi selecionado!');
//                }
//                    document.all.hdSalvar.value = "";

//            } else {
//                getScrollXY(document.form.scroll);
//                document.form.submit();
//            }

//        } else {
//            getScrollXY(document.form.scroll);
//	    	document.form.submit();
//        }
//	}


    function autoTodos()
    {
        //if (((form.txtCNPJ.value.length>0)||(form.txtNomeFundo.value.length>0))&&(document.form.cmbGestao.selectedIndex==0))
          document.form.cmbGestao.selectedIndex = 1;
    }


//faz o submit do form quando o usuario clica 'Enter' dentro da txtNome
//	function submitEnterClickTxtNome (field, evt) {
//		var keyCode = evt.which ? evt.which : evt.keyCode;

//		if (keyCode == 13) {
//			//field.form.submit();

//            submitXY(true);
//			return false;
//		}
//		else
//        {
//			return true;
//        }
//	}





//function getDate()
//{

//	<!--   // Array ofmonth Names -->
//	var monthNames = new Array( "Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembr");
//	var now = new Date();
//	thisYear = now.getYear();
//	if(thisYear < 1900) {thisYear += 1900}; // corrections if Y2K display problem
//	document.write("Rio de Janeiro, " + now.getDate() + " de " + monthNames[now.getMonth()] + " de " + thisYear);
//}


//Browsercheck
//n=document.layers
//ie=document.all

