//It's NetWork 			
 function InsereVoto(){
 	
 	OBselect_voto = GetObject('select_voto');
 	
 	OBdiv_voto1 = GetObject('div_voto1');
 	OBinput_voto1 = GetObject('input_voto1');
 	
 	OBdiv_voto2 = GetObject('div_voto2');
 	OBinput_voto2 = GetObject('input_voto2');
 	
 	OBdiv_voto3 = GetObject('div_voto3');
 	OBinput_voto3 = GetObject('input_voto3');

  OBdiv_voto4 = GetObject('div_voto4');
 	OBinput_voto4 = GetObject('input_voto4'); 
 	
 	OBdiv_voto5 = GetObject('div_voto5');
 	OBinput_voto5 = GetObject('input_voto5');	

 	
 	remover = OBselect_voto.options.selectedIndex;
 	textoOp = OBselect_voto.options[remover].text;
  valorOp = OBselect_voto.value;
  i = OBselect_voto.selectedIndex;
  if (i == 0) { return; } 

  if (OBinput_voto1.value=="") {

    OBdiv_voto1.innerHTML = textoOp;
    remover = OBselect_voto.options.selectedIndex;
    OBselect_voto.remove(remover);
    OBinput_voto1.value = valorOp;

  } else if (OBinput_voto2.value=="") {

    OBdiv_voto2.innerHTML=textoOp; 
    remover = OBselect_voto.options.selectedIndex;
    OBselect_voto.remove(remover);
    OBinput_voto2.value = valorOp;

  } else if (OBinput_voto3.value=="") {

    OBdiv_voto3.innerHTML=textoOp; 
    remover = OBselect_voto.options.selectedIndex;
    OBselect_voto.remove(remover);
    OBinput_voto3.value = valorOp;
  
  } else if (OBinput_voto4.value=="") {

    OBdiv_voto4.innerHTML=textoOp; 
    remover = OBselect_voto.options.selectedIndex;
    OBselect_voto.remove(remover);
    OBinput_voto4.value = valorOp;
     
  } else if (OBinput_voto5.value=="") {
  	
    OBdiv_voto5.innerHTML=textoOp; 
    remover = OBselect_voto.options.selectedIndex;
    OBselect_voto.remove(remover);
    OBinput_voto5.value = valorOp;
    
  }else {
  	
    alert("Todos os votos foram preenchidos.");
    
  }
 
 OBselect_voto.options.selectedIndex = 0;
 
}

function MudaPos(primeiro,segundo) {
 valor0 = eval('OBinput_voto' + primeiro).value;
 valor1 = eval('OBinput_voto' + segundo).value;
 eval('OBinput_voto' + primeiro).value = valor1;
 eval('OBinput_voto' + segundo).value = valor0;
 
 valor0 = eval('OBdiv_voto' + primeiro).innerHTML;
 valor1 = eval('OBdiv_voto' + segundo).innerHTML;
 eval('OBdiv_voto' + primeiro).innerHTML = valor1;
 eval('OBdiv_voto' + segundo).innerHTML = valor0;
   }

function Apaga(campo) {

  div_apagar = eval('OBdiv_voto' + campo);
  input_apagar = eval('OBinput_voto' + campo);

  if(input_apagar.value==""){
  	
 	  alert("O campo está vazio.");
 	  
  } else {  
    i = OBselect_voto.selectedIndex;
    op = new Option(div_apagar.innerHTML,input_apagar.value,false,false);
    OBselect_voto.options.add(op);
    
    input_apagar.value = "";
    div_apagar.innerHTML = "";
    
  }
}
 
 function insereEmail(){
	    indicaAmigo = GetObject('indique_amigo');
	    enviaAmigo = GetObject('input_amigo');		
	     if((indicaAmigo.value.indexOf("@") == -1)||(indicaAmigo.value.length < 6)) {
	      alert('Por favor, insira um e-mail válido.');
	      indicaAmigo.focus();
	      
	    }  else {
	       form_Am = GetObject('id_Amigo');
	       form_Am.submit();
	       }
	     }
	     
 function envia()
  {
 	fieldVoto1 = GetObject('input_voto1')
 	fieldVoto2 = GetObject('input_voto2')
 	fieldVoto3 = GetObject('input_voto3')
 	fieldVoto4 = GetObject('input_voto4')
 	fieldVoto5 = GetObject('input_voto5')       	
  //f = GetObject('principal');
  //f.submit();
  
  //window.open("","myNewWin","width=500,height=300,toolbar=0")
  //var a = window.setTimeout("document.enviaVotos.submit();",500);

  if (fieldVoto1.value == "" || fieldVoto2.value == "" || fieldVoto3.value == "" || fieldVoto4.value == "" || fieldVoto5.value == "")
    {
    alert("Por favor faça a indicação dos 5 nomes")
    }
  else
    {
    //botaVotacao.style.display = "none";
    window.open('','captchaValidator','width=500,height=300,toolbar=0');
    document.enviaVotos.target='captchaValidator';
    document.enviaVotos.submit();
    }
  }
	    
	    function zerar() {
	OBdiv_voto1 = GetObject('div_voto1');
 	OBinput_voto1 = GetObject('input_voto1');
 	
 	OBdiv_voto2 = GetObject('div_voto2');
 	OBinput_voto2 = GetObject('input_voto2');
 	
 	OBdiv_voto3 = GetObject('div_voto3');
 	OBinput_voto3 = GetObject('input_voto3');

  OBdiv_voto4 = GetObject('div_voto4');
 	OBinput_voto4 = GetObject('input_voto4'); 
 	
 	OBdiv_voto5 = GetObject('div_voto5');
 	OBinput_voto5 = GetObject('input_voto5');	
 	
 	 OBdiv_voto1.value ="";
 	 OBinput_voto1.value ="";
 	 
 	 OBdiv_voto2.value ="";
 	 OBinput_voto2.value ="";
 	 
 	 OBdiv_voto3.value ="";
 	 OBinput_voto3.value ="";
 	 
 	 OBdiv_voto4.value ="";
 	 OBinput_voto4.value ="";
 	 
 	 OBdiv_voto5.value ="";
 	 OBinput_voto5.value ="";
 	}
