function oi() {
	// Teste
	alert('oi');
	return false;
}
function allRight2Left() {
  var listOri = document.getElementById("listOrigem")
  var listDest = document.getElementById("listDestino");
  for(var i = 0; i < listDest.length; i++) {
    var opcao = listDest.options[i];
    var novaOpcao = new Option(opcao.text, listOri.length);
    novaOpcao.value = opcao.value;
    listDest.remove(i);
    try {
      listOri.add(novaOpcao,null);
    } catch (e) {
      listOri.add(novaOpcao);
    }
    i--;
  }
}
function allLeft2Right() {
  var listOri = document.getElementById("listOrigem")
  var listDest = document.getElementById("listDestino");
  for(var i = 0; i < listOri.length; i++) {
    var opcao = listOri.options[i];
    var novaOpcao = new Option(opcao.text, listDest.length);
    novaOpcao.value = opcao.value;
    listOri.remove(i);
    try {
      listDest.add(novaOpcao,null);
    } catch (e) {
      listDest.add(novaOpcao);
    }
    i--;
  }
}
function left2Right() {
  var listOri = document.getElementById("select1")
  var listDest = document.getElementById("select2");
  for(var i = 0; i < listOri.length; i++) {
    var opcao = listOri.options[i];
    if(opcao.selected) {
      var novaOpcao = new Option(opcao.text, listDest.length);
      novaOpcao.value = opcao.value;
      listOri.remove(i);
      try {
        listDest.add(novaOpcao,null); //Firefox
      } catch(e) {
        listDest.add(novaOpcao); //IE
      }
      i--;
    }
  }
}

function right2Left() {
  var listOri = document.getElementById("select1")
  var listDest = document.getElementById("select2");
  for(var i = 0; i < listDest.length; i++) {
    var opcao = listDest.options[i];
    if(opcao.selected) {
      var novaOpcao = new Option(opcao.text, listOri.length);
      novaOpcao.value = opcao.value;
      listDest.remove(i);
      try {
        listOri.add(novaOpcao,null);
      } catch (e) {
        listOri.add(novaOpcao);
      }
      i--;
    }
  }
}

function verifica_senha_prof() {
	senha1 = document.getElementById("novasenha").value;
	senha2 = document.getElementById("confirmacao").value;
	if (senha1.length < 4) {
		alert('A senha não pode ser menor do que 04 caracteres!');
		return false;
	}
	if (senha1 != senha2) {
		alert('Por favor, digite sua senha novamente\n\nA senha e a confirmação não conferem!');
		return false;
	} else {
		return true;
	}
	
}

function verifica() {
	if(document.getElementById("nome").value.length < 8) {
		document.getElementById("nome").focus();
		alert('Por favor, informe seu nome completo!');
		return false;
	}
	if (!isCPFCNPJ(document.getElementById("cpf").value,1)) {
		document.getElementById("cpf").focus();
		alert('Você precisa informar um CPF válido para prosseguir...');
		return false;
	}
	if(document.getElementById("telefone").value.length < 8) {
		alert('Informe um telefone para contato!');
		document.getElementById("telefone").focus();
		return false;
	}
	if(document.getElementById("email").value.length < 10) {
		alert('Informe um e-mail válido para contato!');
		document.getElementById("email").focus();
		return false;
	}
	return true;
}

function verificanada() {
	alert('Em manutenção neste momento... Tente novamente mais tarde!');
	return false;
}

function verificacpf() {
	if (!isCPFCNPJ(document.getElementById("cpf").value,1)) {
		document.getElementById("cpf").focus();
		alert('Você precisa informar um CPF válido para prosseguir...');
		return false;
	}
	return true;
}

function isCPFCNPJ(campo,pType){
   // pType = 1 - CPF, 2 CNPJ
   
   var campo_filtrado = "", valor_1 = " ", valor_2 = " ", ch = "";
   var valido = false;
        
   for (i = 0; i < campo.length; i++){
      ch = campo.substring(i, i + 1);
      if (ch >= "0" && ch <= "9"){
         campo_filtrado = campo_filtrado.toString() + ch.toString()
         valor_1 = valor_2;
         valor_2 = ch;
      }
      if ((valor_1 != " ") && (!valido)) valido = !(valor_1 == valor_2);
   }
   if (!valido) campo_filtrado = "12345678912";

   if (campo_filtrado.length < 11){
      for (i = 1; i <= (11 - campo_filtrado.length); i++){campo_filtrado = "0" + campo_filtrado;}
   }

   if(pType <= 1){
      if ( ( campo_filtrado.substring(9,11) == checkCPF( campo_filtrado.substring(0,9) ) ) && ( campo_filtrado.substring(11,12)=="") ){return true;}
   }

   if((pType == 2) || (pType == 0)){
      if (campo_filtrado.length >= 14){
         if ( campo_filtrado.substring(12,14) == checkCNPJ( campo_filtrado.substring(0,12) ) ){ return true;}
      }
   }
   
   return false;
}

function checkCNPJ(vCNPJ){
   var mControle = "";
   var aTabCNPJ = new Array(5,4,3,2,9,8,7,6,5,4,3,2);
   for (i = 1 ; i <= 2 ; i++){
      mSoma = 0;
      for (j = 0 ; j < vCNPJ.length ; j++)
         mSoma = mSoma + (vCNPJ.substring(j,j+1) * aTabCNPJ[j]);
      if (i == 2 ) mSoma = mSoma + ( 2 * mDigito );
      mDigito = ( mSoma * 10 ) % 11;
      if (mDigito == 10 ) mDigito = 0;
      mControle1 = mControle ;
      mControle = mDigito;
      aTabCNPJ = new Array(6,5,4,3,2,9,8,7,6,5,4,3);
   }
   return( (mControle1 * 10) + mControle );
}

function checkCPF(vCPF){
   var mControle = ""
   var mContIni = 2, mContFim = 10, mDigito = 0;
   for (j = 1 ; j <= 2 ; j++){
      mSoma = 0;
      for (i = mContIni ; i <= mContFim ; i++)
         mSoma = mSoma + (vCPF.substring((i-j-1),(i-j)) * (mContFim + 1 + j - i));
      if (j == 2 ) mSoma = mSoma + ( 2 * mDigito );
      mDigito = ( mSoma * 10 ) % 11;
      if (mDigito == 10) mDigito = 0;
      mControle1 = mControle;
      mControle = mDigito;
      mContIni = 3;
      mContFim = 11;
   }
   return( (mControle1 * 10) + mControle );
}