// 1 º *****************************************************************************
//    *****************************************************************************************************************
  function Marcar_Desmarcar_Checkbox(pCheck,pLista)
  {
    //alert('Entrou em Marcar_Desmarcar_Checkbox ' + pCheck + ' # ' + pLista);
    
		//importante:   esta funçao lê todos os checkbox do formulario
	
		//Caso tenha algum item que não esteja marcado na pLista
		// sai fora do loop e desmarca o xcheckbox_todos
		//alert(document.getElementById(pLista+"_0").checked)
						
	    var xCheck_Todos = document.getElementById(pCheck);
		var i=0;
				
		xCheck_Todos.checked = true;
				
		//Caso tenha algum item que não esteja marcado na pLista
		// sai fora do loop e desmarca o xcheckbox_todos
		for (i=0; i < Form1.elements.length ; i++) 
			if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf(pLista) != -1) 
				if(Form1.elements[i].checked == false)
				{
				    xCheck_Todos.checked = false;
				    return ;
				}   
				
   } // fim function
   

  function Marcar_Desmarcar_Checkbox_New(pCheck,pLista,pNumElementos)
  {
      
		var xCheck_Todos = document.getElementById(pCheck);
		var i=0;		
		xCheck_Todos.checked = true;
				
		//Caso tenha algum item que não esteja marcado na pLista
		// sai fora do loop e desmarca o xcheckbox_todos
		//alert(document.getElementById(pLista+"_0").checked)
		
		for (i=0; i < pNumElementos ; i++) 				
				
		if(document.getElementById(pLista+"_"+i).checked == false)				
		{
			//alert('todos');
			xCheck_Todos.checked = false;				    
			return;
		}   
   
   } // fim function


		

// 2º *****************************************************************************************************************
//    *****************************************************************************************************************
   function Marcar_Desmarcar_Lista(pCheck,pLista)
   {
		//alert('Entrou em Marcar_Desmarcar_Lista ' + pCheck + ' # ' + pLista);
		
		var xCheck_Todos = document.getElementById(pCheck);
		var i=0;

		if(xCheck_Todos.checked) // check_todos está marcado
		{   //Marca todos os items da pLista 
			for (i=0; i < Form1.elements.length ; i++) 
				if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf(pLista) != -1) 
						Form1.elements[i].checked = true;
		}
		else	
		{   //Desmarca todos os items da pLista
			for (i=0; i < Form1.elements.length ; i++) 
			if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf(pLista) != -1) 
					Form1.elements[i].checked = false;
		}        
		        
   } // fim function
	
   function Marcar_Desmarcar_Lista_Checkbox(pCheck,pLista,pBox)
   {
		var xCheck_Todos = document.getElementById(pCheck);
		var xCkeck_Box   = document.getElementById(pBox);
		var xCkeck_Lista = document.getElementById(pLista);
		var i=0;
		if(xCheck_Todos.checked) // check_todos está marcado
		{   //Marca todos os items da pLista 
			for (i=0; i < Form1.elements.length ; i++) 
				if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf(pLista) != -1) 
						Form1.elements[i].checked = true;

			for (i=0; i < Form1.elements.length ; i++) 
				if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf(pBox) != -1) 
						Form1.elements[i].checked = true;
            
            xCkeck_Lista.disabled=true;						
            xCkeck_Box.disabled=true;
		}
		else	
		{   //Desmarca todos os items da pLista
			for (i=0; i < Form1.elements.length ; i++) 
			if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf(pLista) != -1) 
					Form1.elements[i].checked = false;

			for (i=0; i < Form1.elements.length ; i++) 
				if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf(pBox) != -1) 
						Form1.elements[i].checked = false;

            xCkeck_Lista.disabled=false;						
            xCkeck_Box.disabled=false;
   		}        
		        
   } // fim function

   function Marcar_Desmarcar_Lista_New(pCheck,pLista, pNumElementos)
   {
		var xCheck_Todos = document.getElementById(pCheck);
		var i=0;
		// alert(pNumElementos); // mostra o numero de elementos selecionados		
		if(xCheck_Todos.checked) // check_todos está marcado
		{   //Marca todos os items da pLista 
			for (i=0; i < pNumElementos ; i++){ 											
				//alert('todos');
				document.getElementById(pLista+"_"+i).checked = true;						
            }
		}
		else	
		{   //Desmarca todos os items da pLista
			for (i=0; i < pNumElementos ; i++){ 											
				//alert('todos');
				document.getElementById(pLista+"_"+i).checked = false;						
            }
		}

   } // fim function


function Marcar_Desmarcar_Lista_Totais(pCheck,pLista, pNumElementos,pChkTodos)
   {
		var xCheck_Totais= document.getElementById(pCheck);
		var xCheck_Todos = document.getElementById(pChkTodos);
		
		var i=0;
		// alert(pNumElementos); // mostra o numero de elementos selecionados		
		if(xCheck_Totais.checked) // check_todos está marcado
		{   //Marca todos os items da pLista 
			for (i=0; i < pNumElementos ; i++)
			{ 											
				//alert('todos');
				document.getElementById(pLista+"_"+i).checked = true;				
				document.getElementById(pLista+"_"+i).disabled = true;				
            }
			xCheck_Todos.checked = true;
			xCheck_Todos.disabled = true;
		}
		else	
		{   //Desmarca todos os items da pLista
			for (i=0; i < pNumElementos ; i++){ 											
				//alert('todos');
				document.getElementById(pLista+"_"+i).checked = false;						
				document.getElementById(pLista+"_"+i).disabled = false;						
            }
            xCheck_Todos.checked = false;
            xCheck_Todos.disabled = false;
		}

   } // fim function




      
// 3º *****************************************************************************

function Verificar_Precor()
{
		var xCheck_Todos = document.getElementById('chkTodas_Regiao');
		var xLabel;
		
		var i=0;
		var xconta = 0;
				     
		//1º verifica se algum item não foi marcado na list_regiao
		if(xCheck_Todos.checked == false)
		{
				for (i=0; i < Form1.elements.length ; i++) 
					if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf("chkRegiao") != -1) 
						if(Form1.elements[i].checked == true)
						xconta = xconta + 1;
					
				if(xconta==0)	 
				{
					alert('Faltou selecionar a opcao:\nRegiao');
					return false; 
				}
		}	
				
		//2º verifica se algum item não foi marcado na list_perg
		xconta=0;
		for (i=0; i < Form1.elements.length ; i++) 
			if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf("chkPerg") != -1) 
				if(Form1.elements[i].checked == true)
				    xconta = xconta + 1;
		
		if(xconta==0)	 
		{	
			xLabel = document.getElementById('lblProduto').innerText;
			alert('Faltou selecionar a opcao:\nOpções');
			return false; 
		}	
			
		
		//3º verifica se algum item não foi marcado no chkMes_Lev(lista de meses)
		xconta=0;
		for (i=0; i < Form1.elements.length ; i++) 
			if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf("chkMes_Lev") != -1) 
				if(Form1.elements[i].checked == true)
				    xconta = xconta + 1;
		
		if(xconta==0)	 
		{	alert('Faltou selecionar a opcao:\n Mês');
			return false; 
		}	
			
	    return true;	
					
   } // fim function

   function Verificar_Precor_Ingles() {
       var xCheck_Todos = document.getElementById('chkTodas_Regiao');
       var xLabel;

       var i = 0;
       var xconta = 0;

       //1º verifica se algum item não foi marcado na list_regiao
       if (xCheck_Todos.checked == false) {
           for (i = 0; i < Form1.elements.length; i++)
               if (Form1.elements[i].type == "checkbox" && Form1.elements[i].name.indexOf("chkRegiao") != -1)
               if (Form1.elements[i].checked == true)
               xconta = xconta + 1;

           if (xconta == 0) {
               alert('Missed select the:\nRegion');
               return false;
           }
       }


       //2º verifica se algum item não foi marcado na list_perg
       xconta = 0;

       for (i = 0; i < Form1.elements.length; i++)
           if (Form1.elements[i].type == "checkbox" && Form1.elements[i].name.indexOf("chkPerg") != -1)
           if (Form1.elements[i].checked == true)
           xconta = xconta + 1;

       if (xconta == 0) {
           //xLabel = document.getElementById('lblProduto').innerText;
           xLabel = document.getElementById('Label1').innerText;
           alert('Missed select the:\nOptions');
           return false;
       }

       
       //3º verifica se algum item não foi marcado no chkMes_Lev(lista de meses)
       xconta = 0;
       for (i = 0; i < Form1.elements.length; i++)
           if (Form1.elements[i].type == "checkbox" && Form1.elements[i].name.indexOf("chkMes_Lev") != -1)
           if (Form1.elements[i].checked == true)
           xconta = xconta + 1;

       if (xconta == 0) 
       {
           alert('Missed select the:\n Month');
           return false;
       }

       return true;

   } // fim function


function Verificar_Subjetiva_Mun()
{
	alert('Pesquisa muito grande, selecione um ano por vez!');
}

function Verificar_Subjetiva_Mun_Ingles()
{
    alert('Pesquisa muito grande, selecione um ano por vez!');
}

function Verificar_Subjetiva(pNumElementosRegiao, pNumElementosProduto)
{
//   	   if(xCheck_Todos.checked) // check_todos está marcado
//		{   //Marca todos os items da pLista 
//			for (i=0; i < pNumElementos ; i++){ 											
//				//alert('todos');
//				document.getElementById(pLista+"_"+i).checked = true;						
//            }
//		}
	
		var xCheck_Todos = document.getElementById('chkTodas_Perg');
		var xLabel;
		var xPreenchido = false;
		
		var i=0;		
				     
		//1º verifica se algum item não foi marcado na list_perg
		
		if(xCheck_Todos.checked == false)
		{
				//alert(pNumElementosProduto);
				for (i=0; i < pNumElementosProduto ; i++) 
					if(document.getElementById("chkPerg_"+i).checked == true)
					{						
						xPreenchido = true;
					}
				
				
				if(xPreenchido == false){
					alert('Faltou selecionar a opção:\n' + 'Produto');
					return false; 
				}
				
		}	

        xCheck_Todos = document.getElementById('chkTodas_Regiao');

        xPreenchido = false;
		//2º verifica se algum item não foi marcado na list_regiao
		if(xCheck_Todos.checked == false)
		{
				//alert(pNumElementosRegiao);
				for (i=0; i < pNumElementosRegiao ; i++) 
					if(document.getElementById("chkRegiao_"+i).checked == true)
					{						
						return true;
					}
				
				if(xPreenchido == false){
					alert('Faltou selecionar a opção:\n' + 'Região');
					return false; 
				}
				
		}						    
		
} // fim function


function Verificar_Subjetiva_Ingles(pNumElementosRegiao, pNumElementosProduto) {

    var xCheck_Todos = document.getElementById('chkTodas_Perg');
    var xLabel;
    var xPreenchido = false;
    var xchkPerg = document.getElementById('chkPerg');

    var i = 0;

    //1º verifica se algum item não foi marcado na list_perg

    if (xCheck_Todos.checked == false) {
        //alert(pNumElementosProduto);
        for (i = 0; i < pNumElementosProduto; i++)
            if (document.getElementById("chkPerg_" + i).checked == true) {
            xPreenchido = true;
        }


        if (xPreenchido == false) {
            alert('Missed select the:\n' + 'Product');
            return false;
        }

    }

    xCheck_Todos = document.getElementById('chkTodas_Regiao');

    xPreenchido = false;
    //2º verifica se algum item não foi marcado na list_regiao
    if (xCheck_Todos.checked == false) {
        //alert(pNumElementosRegiao);
        for (i = 0; i < pNumElementosRegiao; i++)
            if (document.getElementById("chkRegiao_" + i).checked == true) {
            return true;
        }

        if (xPreenchido == false) {
            alert('Missed select the:\n' + 'Region');
            return false;
        }

    }

} // fim function






function Verificar_Subjetiva_Ingles44(pNumElementosRegiao, pNumElementosProduto) {

    var xCheck_Todos = document.getElementById('chkTodas_Perg');
    var xPreenchido = false;
    var i = 0;

        alert(pNumElementosProduto);
        for (i = 0; i < pNumElementosProduto; i++)
            if (document.getElementById("chkPerg_" + i).checked == true) {
            xPreenchido = true;
        }


        if (xPreenchido == false) {
            alert('Faltou selecionar a opção:\n' + 'Product');
            return false;
        }

} // fim function

function Verificar_Subjetiva_Ingles33(pNumElementosRegiao, pNumElementosProduto) {

    var xPreenchido = false;
    var xPreenchido2 = false;
    var i = 0;
    var xCheck_Todos = document.getElementById('chkTodas_Perg');



        alert(pNumElementosProduto);
        for (i = 0; i < pNumElementosProduto; i++)
            if (document.getElementById("chkPerg_" + i).checked == true) {
            xPreenchido = true;
        }


        if (xPreenchido == false) {
            alert('Faltou selecionar a opção:\n' + 'Product');
            return false;
        }


    xPreenchido2 = false;
    //2º verifica se algum item não foi marcado na list_regiao
    if (xCheck_Todos.checked == false) {
        //alert(pNumElementosRegiao);
        for (i = 0; i < pNumElementosRegiao; i++)
            if (document.getElementById("chkRegiao_" + i).checked == true) {
            return true;
        }

        if (xPreenchido2 == false) {
            alert('Faltou selecionar a opção:\n' + 'Region');
            return false;
        }

    }






} // fim function



function Verificar_Subjetiva_Bio(pNumElementosProduto)
{
		var xCheck_Todos = document.getElementById('chkTodas_Perg');
		var xLabel;
		var xPreenchido = false;
		
		var i=0;		
				     
		//1º verifica se algum item não foi marcado na list_perg
		
		if(xCheck_Todos.checked == false)
		{
				//alert(pNumElementosProduto);
				for (i=0; i < pNumElementosProduto ; i++) 
					if(document.getElementById("chkPerg_"+i).checked == true)
					{						
						xPreenchido = true;
					}
				
				
				if(xPreenchido == false){
					alert('Faltou selecionar a opcao:\n' + 'Produto');
					return false; 
				}
				
		}	
				
} // fim function


function Verificar_Vp(pNumElementosRegiao, pNumElementosProduto)
{
	
		var xCheck_Todos = document.getElementById('chkTodas_Perg2');
		var xLabel;
		var xPreenchido = false;
		
		var i=0;		
				     
		//1º verifica se algum item não foi marcado na list_perg
		
		if(xCheck_Todos.checked == false)
		{
				//alert(pNumElementosProduto);
				for (i=0; i < pNumElementosProduto ; i++) 
					if(document.getElementById("chkPerg2_"+i).checked == true)
					{						
						xPreenchido = true;
					}
				
				
				if(xPreenchido == false){
					alert('Faltou selecionar a opcao:\n' + 'Produto');
					return false; 
				}
				
		}	

        xCheck_Todos = document.getElementById('chkTodas_Regiao2');

        xPreenchido = false;
		//2º verifica se algum item não foi marcado na list_regiao
		if(xCheck_Todos.checked == false)
		{
				//alert(pNumElementosRegiao);
				for (i=0; i < pNumElementosRegiao ; i++) 
					if(document.getElementById("chkRegiao2_"+i).checked == true)
					{						
						return true;
					}
				
				if(xPreenchido == false){
					alert('Faltou selecionar a opcao:\n' + 'Regiao');
					return false; 
				}
				
		}						    
		
   } // fim function Verificar_Vp

   function Verificar_Vp_Ingles(pNumElementosRegiao, pNumElementosProduto) {

       var xCheck_Todos = document.getElementById('chkTodas_Perg2');
       var xLabel;
       var xPreenchido = false;

       var i = 0;

       //1º verifica se algum item não foi marcado na list_perg

       if (xCheck_Todos.checked == false) {
           //alert(pNumElementosProduto);
           for (i = 0; i < pNumElementosProduto; i++)
               if (document.getElementById("chkPerg2_" + i).checked == true) {
               xPreenchido = true;
           }


           if (xPreenchido == false) {
               alert('Missed select the:\n' + 'Product');
               return false;
           }

       }

       xCheck_Todos = document.getElementById('chkTodas_Regiao2');

       xPreenchido = false;
       //2º verifica se algum item não foi marcado na list_regiao
       if (xCheck_Todos.checked == false) {
           //alert(pNumElementosRegiao);
           for (i = 0; i < pNumElementosRegiao; i++)
               if (document.getElementById("chkRegiao2_" + i).checked == true) {
               return true;
           }

           if (xPreenchido == false) {
               alert('Missed select the:\n' + 'Region');
               return false;
           }

       }

   } // fim function Verificar_Vp

  function Verificar_Atacado()
  {
		var xCheck_Todos_Produtos = document.getElementById('ChkTodos_Produtos');
		var xCheck_Todos_Anos = document.getElementById('ChkTodos_Anos');
		var xCheck_Todos_Mes = document.getElementById('ChkTodos_Mes');
		var xLabel;
		
		var i=0;
		var xconta = 0;
				
				     
				//1º verifica se algum item não foi marcado na list_produtos
				if(xCheck_Todos_Produtos.checked == false)
				{
					xLabel = document.getElementById('lblProduto').innerText;
					
					for (i=0; i < Form1.elements.length ; i++) 
						if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf("ChkProduto") != -1) 
							if(Form1.elements[i].checked == true)
							xconta = xconta + 1;
						
					if(xconta==0)	 
					{
						alert('Faltou selecionar a opcao: Produto');
						return false; 
					}
				}	
			
				//2º verifica se algum item não foi marcado na list_ano
				xconta=0;
				//xLabel = document.getElementById('lblAno').innerText;
				if(xCheck_Todos_Anos.checked == false)
				{				
				for (i=0; i < Form1.elements.length ; i++) 
					if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf("ChkAno") != -1) 
						if(Form1.elements[i].checked == true)
				           xconta = xconta + 1;
				
				if(xconta==0)	 
				{	alert('Faltou selecionar a opcao: Ano');
					return false; 
				}	
					
				}
				
				//3º verifica se algum item não foi marcado no chkMes(lista de meses)
				xconta=0;
				if(xCheck_Todos_Mes.checked == false)
				{				
				for (i=0; i < Form1.elements.length ; i++) 
					if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf("ChkMes") != -1) 
						if(Form1.elements[i].checked == true)
				           xconta = xconta + 1;
				
				if(xconta==0)	 
				{	alert('Faltou selecionar a opcao: \n Mês');
					return false; 
				}	
				}
			    return true;	
					
  } // fim function

  function Verificar_Pmr()
  {
		var xCheck_Todos_Produtos = document.getElementById('ChkTodos_Produtos');
		var xCheck_Todos_Anos = document.getElementById('ChkTodos_Anos');
		var xCheck_Todos_Mes = document.getElementById('ChkTodos_Mes');
		var xLabel;
		
		var i=0;
		var xconta = 0;
				
				     
				//1º verifica se algum item não foi marcado na list_produtos
				if(xCheck_Todos_Produtos.checked == false)
				{
					xLabel = document.getElementById('lblProduto').innerText;
					
					for (i=0; i < Form1.elements.length ; i++) 
						if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf("ChkProduto") != -1) 
							if(Form1.elements[i].checked == true)
							xconta = xconta + 1;
						
					if(xconta==0)	 
					{
						alert('Faltou selecionar a opcao: Produto');
						return false; 
					}
				}	
			
				//2º verifica se algum item não foi marcado na list_ano
				xconta=0;
				//xLabel = document.getElementById('lblAno').innerText;
				if(xCheck_Todos_Anos.checked == false)
				{				
				for (i=0; i < Form1.elements.length ; i++) 
					if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf("ChkAno") != -1) 
						if(Form1.elements[i].checked == true)
				           xconta = xconta + 1;
				
				if(xconta==0)	 
				{	
					alert('Faltou selecionar a opcao: Ano');
					return false; 
				}	
					
				}
				
				//3º verifica se algum item não foi marcado no chkMes(lista de meses)
				xconta=0;
				if(xCheck_Todos_Mes.checked == false)
				{				
				for (i=0; i < Form1.elements.length ; i++) 
					if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf("ChkMes") != -1) 
						if(Form1.elements[i].checked == true)
				           xconta = xconta + 1;
				
				if(xconta==0)	 
				{	//alert('Faltou selecionar a opção: \n Mês');
				    alert('Faltou selecionar a opcao: Mes');
					return false; 
				}	
				}
			    return true;	
					
  } // fim function

  
  function Verificar_Indices()
  {
		var xCheck_Todos_Anos = document.getElementById('ChkTodos_Anos');
		var xCheck_Todos_Mes = document.getElementById('ChkTodos_Mes');
		var xLabel;
		
		var i=0;
		var xconta = 0;
				
				     
			
				//2º verifica se algum item não foi marcado na list_ano
				xconta=0;
				//xLabel = document.getElementById('lblAno').innerText;
				if(xCheck_Todos_Anos.checked == false)
				{				
				for (i=0; i < Form1.elements.length ; i++) 
					if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf("ChkAno") != -1) 
						if(Form1.elements[i].checked == true)
				           xconta = xconta + 1;
				
				if(xconta==0)	 
				{	alert('Faltou selecionar a opcao: Ano');
					return false; 
				}	
					
				}
				
				//3º verifica se algum item não foi marcado no chkMes(lista de meses)
				xconta=0;
				if(xCheck_Todos_Mes.checked == false)
				{				
				for (i=0; i < Form1.elements.length ; i++) 
					if (Form1.elements[i].type=="checkbox" && Form1.elements[i].name.indexOf("ChkMes") != -1) 
						if(Form1.elements[i].checked == true)
				           xconta = xconta + 1;
				
				if(xconta==0)	 
				{	alert('Faltou selecionar a opcao: \n Mês');
					return false; 
				}	
				}
			    return true;	
					
  } // fim function
  
  
  function Carregar_Combo_Indices()
  {			
	var i;
	var xPos_Inicial;
	var xCombo_Inicial = document.getElementById('cmbAno_Inicial');
	var xCombo_Final = document.getElementById('cmbAno_Final');
	
	//1º remover os items do combo final
	var x = xCombo_Final.length;
	for(i=0; i < x; i++)
	 	 xCombo_Final.remove(0);
	
	//2º pegar a posição atual do xCombo_Inicial  ;		
			xPos_Inicial = xCombo_Inicial.selectedIndex;
    
	//3º Carrego o xCombo_Final a partir do xCombo_Inicial
			for(i=xPos_Inicial ;i < xCombo_Inicial.length; i++)
			{
				xCombo_Inicial.selectedIndex = i;
					xCombo_Final.options.add(new Option
						(
						  xCombo_Inicial.options[i].text ,
						  xCombo_Inicial.options[i].value
						));						
			}
	
	//4º Volto o xCombo_Inicial para posição atual		
	 	 xCombo_Inicial.selectedIndex = xPos_Inicial;
   				
  }//FIM Carregar_Combo_Indices
  
  
  function Carregar_Combo_Conjuntura()
  {			
	var i;
	var xPos_Inicial;
	var xCombo_Inicial = document.getElementById('cmbAno_Inicial');
	var xCombo_Final = document.getElementById('cmbAno_Final');
	
	//1º remover os items do combo final
	var x = xCombo_Final.length;
	for(i=0; i < x; i++)
	 	 xCombo_Final.remove(0);
	
	//2º pegar a posição atual do xCombo_Inicial  ;		
			xPos_Inicial = xCombo_Inicial.selectedIndex;
    
	//3º Carrego o xCombo_Final a partir do xCombo_Inicial
			for(i=xPos_Inicial ;i < xCombo_Inicial.length; i++)
			{
				xCombo_Inicial.selectedIndex = i;
					xCombo_Final.options.add(new Option
						(
						  xCombo_Inicial.options[i].text ,
						  xCombo_Inicial.options[i].value
						));						
			}
	
	//4º Volto o xCombo_Inicial para posição atual		
	 	 xCombo_Inicial.selectedIndex = xPos_Inicial;
   				
  }//FIM Carregar_Combo_Conjuntura
  
  
  function Carregar_Combo_Precos_Medios()
  {			
	var i;
	var xPos_Inicial;
	var xCombo_Inicial = document.getElementById('cmbPeriodo_Inicial');
	var xCombo_Final = document.getElementById('cmbPeriodo_Final');
	
	
	//1º remover os items do combo final
	var x = xCombo_Final.length;
	for(i=0; i < x; i++)
	 	 xCombo_Final.remove(0);
	 
	
	//2º pegar a posição atual do xCombo_Inicial  ;		
			xPos_Inicial = xCombo_Inicial.selectedIndex;
      
	
	//3º Carrego o xCombo_Final a partir do xCombo_Inicial
			for(i=xPos_Inicial ;i < xCombo_Inicial.length; i++)
			{
				xCombo_Inicial.selectedIndex = i;
					xCombo_Final.options.add(new Option
						(
						  xCombo_Inicial.options[i].text ,
						  xCombo_Inicial.options[i].value
						));
						
			}
	
	
	//4º Volto o xCombo_Inicial para posição atual		
	 	 xCombo_Inicial.selectedIndex = xPos_Inicial;
  
   				
  }//FIM FUNCTION
  
  
  function Carregar_Combo_Indicadores_Conjuntura()
  {			
	var i;
	var xPos_Inicial;
	var xCombo_Inicial = document.getElementById('cmbAno_Inicial');
	var xCombo_Final = document.getElementById('cmbAno_Final');
	
	
	//1º remover os items do combo final
	var x = xCombo_Final.length;
	for(i=0; i < x; i++)
	 	 xCombo_Final.remove(0);
	 
	
	//2º pegar a posição atual do xCombo_Inicial  ;		
			xPos_Inicial = xCombo_Inicial.selectedIndex;
      
	
	//3º Carrego o xCombo_Final a partir do xCombo_Inicial
			for(i=xPos_Inicial ;i < xCombo_Inicial.length; i++)
			{
				xCombo_Inicial.selectedIndex = i;
					xCombo_Final.options.add(new Option
						(
						  xCombo_Inicial.options[i].text ,
						  xCombo_Inicial.options[i].value
						));
						
			}
	
	
	//4º Volto o xCombo_Inicial para posição atual		
	 	 xCombo_Inicial.selectedIndex = xPos_Inicial;
  
   				
  }//FIM FUNCTION



  function Carregar_Combo_Defensivos()
  {			
	var i;
	var xPos_Inicial;
	var xCombo_Inicial = document.getElementById('cmbPeriodo_Inicial');
	var xCombo_Final = document.getElementById('cmbPeriodo_Final');
	
	
	//1º remover os items do combo final
	var x = xCombo_Final.length;
	for(i=0; i < x; i++)
	 	 xCombo_Final.remove(0);
	 
	
	//2º pegar a posição atual do xCombo_Inicial  ;		
			xPos_Inicial = xCombo_Inicial.selectedIndex;
      
	
	//3º Carrego o xCombo_Final a partir do xCombo_Inicial
			for(i=xPos_Inicial ;i < xCombo_Inicial.length; i++)
			{
				xCombo_Inicial.selectedIndex = i;
					xCombo_Final.options.add(new Option
						(
						  xCombo_Inicial.options[i].text ,
						  xCombo_Inicial.options[i].value
						));
						
			}
	
	
	//4º Volto o xCombo_Inicial para posição atual		
	 	 xCombo_Inicial.selectedIndex = xPos_Inicial;
  
   				
  }//FIM FUNCTION
  

  function Carregar_Combo_RelaTrocaPrecos()
  {			
	var i;
	var xPos_Inicial;
	var xCombo_Inicial = document.getElementById('cmbPeriodo_Inicial');
	var xCombo_Final = document.getElementById('cmbPeriodo_Final');
	
	
	//1º remover os items do combo final
	var x = xCombo_Final.length;
	for(i=0; i < x; i++)
	 	 xCombo_Final.remove(0);
	 
	
	//2º pegar a posição atual do xCombo_Inicial  ;		
			xPos_Inicial = xCombo_Inicial.selectedIndex;
      
	
	//3º Carrego o xCombo_Final a partir do xCombo_Inicial
			for(i=xPos_Inicial ;i < xCombo_Inicial.length; i++)
			{
				xCombo_Inicial.selectedIndex = i;
					xCombo_Final.options.add(new Option
						(
						  xCombo_Inicial.options[i].text ,
						  xCombo_Inicial.options[i].value
						));
						
			}
	
	
	//4º Volto o xCombo_Inicial para posição atual		
	 	 xCombo_Inicial.selectedIndex = xPos_Inicial;
  
   				
  }//FIM FUNCTION

  
  function CarregaComboRelacaoTroca()
  {			
	var i;
	var xPos_Inicial;
	var xCombo_Inicial = document.getElementById('cmbPeriodoInicial');
	var xCombo_Final = document.getElementById('cmbPeriodoFinal');
	
	//1º remover os items do combo final
	var x = xCombo_Final.length;
	for(i=0; i < x; i++)
	 	 xCombo_Final.remove(0);
	 
	
	//2º pegar a posição atual do xCombo_Inicial  ;		
			xPos_Inicial = xCombo_Inicial.selectedIndex;
      
	
	//3º Carrego o xCombo_Final a partir do xCombo_Inicial
			for(i=xPos_Inicial ;i < xCombo_Inicial.length; i++)
			{
				xCombo_Inicial.selectedIndex = i;
					xCombo_Final.options.add(new Option
						(
						  xCombo_Inicial.options[i].text ,
						  xCombo_Inicial.options[i].value
						));
						
			}
	
	
	//4º Volto o xCombo_Inicial para posição atual		
	 	 xCombo_Inicial.selectedIndex = xPos_Inicial;
  
   				
  }//FIM FUNCTION
  
  
  function CarregaComboCesta()
  {			
	var i;
	var xPos_Inicial;
	var xCombo_Inicial = document.getElementById('cmbPeriodoInicial');
	var xCombo_Final = document.getElementById('cmbPeriodoFinal');
	
	
	//1º remover os items do combo final
	var x = xCombo_Final.length;
	for(i=0; i < x; i++)
	 	 xCombo_Final.remove(0);
	 
	
	//2º pegar a posição atual do xCombo_Inicial  ;		
			xPos_Inicial = xCombo_Inicial.selectedIndex;
      
	
	//3º Carrego o xCombo_Final a partir do xCombo_Inicial
			for(i=xPos_Inicial ;i < xCombo_Inicial.length; i++)
			{
				xCombo_Inicial.selectedIndex = i;
					xCombo_Final.options.add(new Option
						(
						  xCombo_Inicial.options[i].text ,
						  xCombo_Inicial.options[i].value
						));
						
			}
	
	
	//4º Volto o xCombo_Inicial para posição atual		
	 	 xCombo_Inicial.selectedIndex = xPos_Inicial;
  
   				
  }//FIM FUNCTION


  
  function Carregar_Combo()
  {
		

	var i;
	var xPos_Inicial;
	var xCombo_Inicial = document.getElementById('cmbAno_inicial');
	var xCombo_Final = document.getElementById('cmbAno_Final');
	
	
	//1º remover os items do combo final
	var x = xCombo_Final.length;
	for(i=0; i < x; i++)
	 	 xCombo_Final.remove(0);
	 
	
	//2º pegar a posição atual do xCombo_Inicial  ;		
			xPos_Inicial = xCombo_Inicial.selectedIndex;
      
	
	//3º Carrego o xCombo_Final a partir do xCombo_Inicial
			for(i=xPos_Inicial ;i < xCombo_Inicial.length; i++)
			{
				xCombo_Inicial.selectedIndex = i;
					xCombo_Final.options.add(new Option
						(
						  xCombo_Inicial.options[i].text ,
						  xCombo_Inicial.options[i].value
						));
						
			}
	
	
	//4º Volto o xCombo_Inicial para posição atual		
	 	 xCombo_Inicial.selectedIndex = xPos_Inicial;
      
      
    /******* rotina comentada
    
      Deixei que este posicionamento fosse feito no lado do servido
      a rotina se chama Posiciona_CmbFinal()
      
      
     //5º Agora pego o valor que está no txtCombo(tipo hidden)
     //Percorre o xCombo_Final é posiciona o combo no valor que foi solicitado
     // Pq toda vez que é feito uma requisição o combo final volta para 1º posicão  
        var xvalor = document.getElementById('txtCombo').value.replace(",","");
		if(xvalor != "")
		     for(i=0; i < xCombo_Final.length; i++)
		     {
				xCombo_Final.selectedIndex = i;
				if(xCombo_Final.value == xvalor)
				 return ;
		     
		     }   
		     
		     //xCombo_Final.selectedIndex = xvalor;
			
	*********/		
				
  }//FIM FUNCTION
  

  function CarregaComboSubjetiva()
  {			
	var i;
	var xPos_Inicial;
	var xCombo_Inicial = document.getElementById('cmbAno_Inicial');
	var xCombo_Final = document.getElementById('cmbAno_Final');
	
	
	//1º remover os items do combo final
	var x = xCombo_Final.length;
	for(i=0; i < x; i++)
	 	 xCombo_Final.remove(0);
	 
	
	//2º pegar a posição atual do xCombo_Inicial  ;		
			xPos_Inicial = xCombo_Inicial.selectedIndex;
      
	
	//3º Carrego o xCombo_Final a partir do xCombo_Inicial
			for(i=xPos_Inicial ;i < xCombo_Inicial.length; i++)
			{
				xCombo_Inicial.selectedIndex = i;
					xCombo_Final.options.add(new Option
						(
						  xCombo_Inicial.options[i].text ,
						  xCombo_Inicial.options[i].value
						));
						
			}
	
	
	//4º Volto o xCombo_Inicial para posição atual		
	 	 xCombo_Inicial.selectedIndex = xPos_Inicial;
  
   				
  }//FIM FUNCTION


  
  
  function CarregaComboPrecor()
  {			
	var i;
	var xPos_Inicial;
	var xCombo_Inicial = document.getElementById('cmbAno_Inicial');
	var xCombo_Final = document.getElementById('cmbAno_Final');
	
	
	//1º remover os items do combo final
	var x = xCombo_Final.length;
	for(i=0; i < x; i++)
	 	 xCombo_Final.remove(0);
	 
	
	//2º pegar a posição atual do xCombo_Inicial  ;		
			xPos_Inicial = xCombo_Inicial.selectedIndex;
      
	
	//3º Carrego o xCombo_Final a partir do xCombo_Inicial
			for(i=xPos_Inicial ;i < xCombo_Inicial.length; i++)
			{
				xCombo_Inicial.selectedIndex = i;
					xCombo_Final.options.add(new Option
						(
						  xCombo_Inicial.options[i].text ,
						  xCombo_Inicial.options[i].value
						));
						
			}
	
	
	//4º Volto o xCombo_Inicial para posição atual		
	 	 xCombo_Inicial.selectedIndex = xPos_Inicial;
  
   				
  }//FIM FUNCTION
 
  
  
// 
/*   		

    document.getElementById("textBox").value = document.getElementById("dropDown").options[document.getElementById("dropDown").selectedIndex].text;
    document.getElementById("dropDownSpan").style.display = 'none';







*/
