function mOver(src, classe) {
  if (!src.contains(event.fromElement)) {
    src.className = classe;
  }
}
function mOut(src, classe) {
  if (!src.contains(event.toElement)) {
    src.className = classe;
  }
}

function AbreEvento(codigo) {
  var desktopname = window.open('/midia/galeria.php?codigo='+codigo,'Evento'+codigo,'width=728,height=570,toolbar=no,copyhistory=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,top=20,left=20');
  desktopname.focus();
}

function cnumero(vr) {
   vr  = Number(vr);
   vr  = vr.toFixed(2);
   vr  = vr.toString();
   vr  = vr.replace( ",", "" );
   vr  = vr.replace( ".", "" );
   tam = vr.length;

   if ( (tam >= 3) && (tam <= 5) ){
         num = vr.substr(0, tam - 2 ) + ',' + vr.substr( tam - 2, tam ) ; }
   if ( (tam >= 6) && (tam <= 9) ){
         num = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
   if ( (tam >= 10) && (tam <= 12) ){
         num = vr.substr( 0, tam - 8 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
   if ( (tam >= 13) && (tam <= 15) ){
         num = vr.substr( 0, tam - 11 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
   if ( (tam >= 16) && (tam <= 18) ){
         num = vr.substr( 0, tam - 14 ) + '.' + vr.substr( tam - 14, 3 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ;}
   return num;
}

function ucnumero(valor) {
  aux1 = /\./gi;
  aux2 = valor.replace(aux1, '');
  aux2 = aux2.replace(',', '.');
  return aux2;
}

function RemoveFormatacao(obj) {
  aux1 = /\./gi;
  aux2 = /\,/gi;
  aux3 = /\-/gi;
  aux4 = /\//gi;
  aux5 = /\)/gi;
  aux6 = /\(/gi;
  aux7 = /\ /gi;
  valor = obj.value.replace(aux1, '');
  valor = valor.replace(aux2, '');
  valor = valor.replace(aux3, '');
  valor = valor.replace(aux4, '');
  valor = valor.replace(aux5, '');
  valor = valor.replace(aux6, '');
  valor = valor.replace(aux7, '');
  obj.value = valor;
}
