<!--
function line_mOvr(src,clrOver) {
		if (!src.contains(event.fromElement)) {
			src.style.cursor = 'hand';
			src.bgColor = clrOver;
		}
	}
function line_mOut(src,clrIn) {
		if (!src.contains(event.toElement)) {
			src.style.cursor = 'default';
			src.bgColor = clrIn;
		}
	}
function mClk(src) {
		if(event.srcElement.tagName=='TD'){
			src.children.tags('A')[0].click();
		}
	}


function valida_cpf(s)
{
  if (s == "00000000000" || s == "11111111111" || s == "22222222222" || s == "33333333333" || s == "44444444444" || s == "55555555555" || s == "66666666666" || s == "77777777777" || s == "88888888888" || s == "99999999999")
  {
     alert("Cpf inválido")
     return false;
  }
  var i;

  var c = s.substr(0,9);
  var dv = s.substr(9,2);
  var d1 = 0;
  for (i = 0; i < 9; i++)
  {
    d1 += c.charAt(i) * (10-i);
  }
  if (d1 == 0)
  {
     alert("Cpf inválido")
     return false;
  }
  d1 = 11 - (d1 % 11);
  if (d1 > 9) d1 = 0;
  if (dv.charAt(0) != d1)
  {
     alert("CPF inválido")
     return false;
  }
  d1 *= 2;
  for (i = 0; i < 9; i++)
  {
    d1 += c.charAt(i) * (11-i);
  }
  d1 = 11 - (d1 % 11);
  if (d1 > 9) d1 = 0;
  if (dv.charAt(1) !=d1)
  {
    alert("Cpf Inválido")
    return false;
  }
  return true;
}
// -->	



function valida_Horario_HHMM24H(hora)
{
        var reTime_exp = /^([0-1]\d|2[0-3]):[0-5]\d$/;
	eval("reTime = reTime_exp");
	if (reTime.test(hora))
        {
		 return true;
	} 
        else 
        {
		alert(hora + " NÃO é um horário/tempo válido.");
                return false;
	}
} // 
function IsCEP(strCEP, blnVazio)
        {
            // Caso o CEP não esteja nesse formato ele é inválido!
            var objER = /^[0-9]{2}\.[0-9]{3}-[0-9]{3}$/;
             

            strCEP = strCEP.replace(/^\s+|\s+$/g, '');
            if(strCEP.length > 0)
                {
                    if(objER.test(strCEP))
                        return true;
                    else
                        return false;
                }
            else
                return blnVazio;
        }
    //-->
function drlupareplaceAll(str, de, para){
    var pos = str.indexOf(de);
    while (pos > -1){
      str = str.replace(de, para);
      pos = str.indexOf(de);
   }
    return (str);
}

function dia_da_semana(dia,mes,ano)
{
  data_atual=new Date(ano, mes-1, dia);
  xxx=data_atual.getDay();
  return xxx;
}



function ordena_array(arg1,arg2)
{
 // esta funcao ordena as palavras em uma frase
 // arg1 = frase informada
 // arg2 = 0 - Normal.  arg2=1 - elimina palavras duplicadas.

 arg1=arg1.toLowerCase();
 arg1=SemAcento(arg1);

 // elimina brancos no inicio e no fim da frase
 arg1.replace(/^\s+|\s+$/g,"");
 // separa as palavras em uma array
 var palavras = arg1.split(" ");
 // ordena as palavras em ordem ascendente
 palavras.sort();
 var res = "";
 var ultima = "";

 // vamos percorrer os elementos do array
 for(var i = 0; i < palavras.length; i++)
 {
   palavra = palavras[i];
   if (arg2 = 1)
   {
     if(ultima != palavra)
     { 
       res += palavras[i] +' ';
     }
   }
   if (arg2 = 0)
   {
      res += palavras[i] +' ';
   }
  
  
  
   ultima= palavras[i];
  }

 // elimina brancos no inicio e no fim da frase
 res.replace(/^\s+|\s+$/g,"");

 return res;
}

function SemAcento(cTexto)
{
     cTexto = cTexto.replace(/á/g,"a");
     cTexto = cTexto.replace(/é/g,"e");
     cTexto = cTexto.replace(/í/g,"i");
     cTexto = cTexto.replace(/ó/g,"o");
     cTexto = cTexto.replace(/ú/g,"u");
     cTexto = cTexto.replace(/Á/g,"A");
     cTexto = cTexto.replace(/É/g,"E");
     cTexto = cTexto.replace(/Í/g,"I");
     cTexto = cTexto.replace(/Ó/g,"O");
     cTexto = cTexto.replace(/Ú/g,"U");

     cTexto = cTexto.replace(/â/g,"a");
     cTexto = cTexto.replace(/ê/g,"e");
     cTexto = cTexto.replace(/î/g,"i");
     cTexto = cTexto.replace(/ô/g,"o");
     cTexto = cTexto.replace(/û/g,"u");
     cTexto = cTexto.replace(/Â/g,"A");
     cTexto = cTexto.replace(/Ê/g,"E");
     cTexto = cTexto.replace(/Î/g,"I");
     cTexto = cTexto.replace(/Ô/g,"O");
     cTexto = cTexto.replace(/Û/g,"U");

     cTexto = cTexto.replace(/ã/g,"a");
     cTexto = cTexto.replace(/õ/g,"o");
     cTexto = cTexto.replace(/Ã/g,"A");
     cTexto = cTexto.replace(/Õ/g,"O");

     cTexto = cTexto.replace(/ç/g,"c");
     cTexto = cTexto.replace(/Ç/g,"C");
     
     cTexto = cTexto.replace(/ü/g,"u");
     cTexto = cTexto.replace(/Ü/g,"U");
     
     cTexto = cTexto.replace(/à/g,"a");
     cTexto = cTexto.replace(/è/g,"e");
     cTexto = cTexto.replace(/ì/g,"i");
     cTexto = cTexto.replace(/ò/g,"o");
     cTexto = cTexto.replace(/ù/g,"u");
     cTexto = cTexto.replace(/À/g,"A");
     cTexto = cTexto.replace(/È/g,"E");
     cTexto = cTexto.replace(/Ì/g,"I");
     cTexto = cTexto.replace(/Ò/g,"O");
     cTexto = cTexto.replace(/Ù/g,"U");

     return cTexto;

}

