var ie = ( (navigator.appName.substr(0,27) == "Microsoft Internet Explorer") );
var ns = ( !ie );
document.write('<sc'+'ript language="JavaScript" type="text/javascript" src="http://www.mirvan.com.br/sitemeter/sitemeter.php?id=editorasol&origem='+location.href+'"></scr'+'ipt> ');

// verifica se o site completo foi carregado
// if (location.href.indexOf("www.aumbandan.ig.hpg.com.br") == -1) {
//   top.location="http://www.aumbandan.ig.hpg.com.br";
// }

function formatCurrency(num) {
  num = num.toString().replace(/\$|\,/g,'');
  if(isNaN(num)) num = "0";
  sign = (num == (num = Math.abs(num)));
  num = Math.floor(num*100+0.50000000001);
  cents = num%100;
  num = Math.floor(num/100).toString();
  if(cents<10) cents = "0" + cents;
  for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
    num = num.substring(0,num.length-(4*i+3))+','+ num.substring(num.length-(4*i+3));
  return (((sign)?'':'-') + 'R$ ' + num + '.' + cents);
}

function vhr(obj, alt, larg) {

  if (obj ==null) return false;
  if (larg==null) larg=100;
  if (alt ==null) alt =100;

  if (ie) {
    layerheight = obj.style.height;
    layerwidth  = obj.style.width;
  } else {
    layerheight = alt;
    layerwidth  = larg;
  }

  layerheight = parseInt(layerheight);
  layerheight = unescape(layerheight);
  layerwidth  = parseInt(layerwidth);
  layerwidth  = unescape(layerwidth);

  // Altura
//  if (ie) { 
//    obj.style.top = ((document.body.scrollTop + document.body.clientHeight)-layerheight)-42;
//  } else { 
//    obj.top = ((pageYOffset+innerHeight) - larg);
//  }

  // Largura
  if (ie) { 
    obj.style.left = ((document.body.scrollLeft + document.body.clientWidth)-layerwidth);
  } else { 
    obj.left = ((pageXOffset + innerWidth) - alt);
  }

}

function vhrb(obj, alt, larg) {

  if (obj ==null) return false;
  if (larg==null) larg=100;
  if (alt ==null) alt =100;

  if (ie) {
    layerheight = obj.style.height;
    layerwidth  = obj.style.width;
  } else {
    layerheight = alt;
    layerwidth  = larg;
  }

  layerheight = parseInt(layerheight);
  layerheight = unescape(layerheight);
  layerwidth  = parseInt(layerwidth);
  layerwidth  = unescape(layerwidth);

  // Altura
  if (ie) { 
    obj.style.top = ((document.body.scrollTop + document.body.clientHeight)-layerheight)-42;
  } else { 
    obj.top = ((pageYOffset+innerHeight) - larg);
  }

  // Largura
  if (ie) { 
    obj.style.left = ((document.body.scrollLeft + document.body.clientWidth)-layerwidth);
  } else { 
    obj.left = ((pageXOffset + innerWidth) - alt);
  }

}

// Verifica a validade de data (com ano bissexto)
// Uso: 
//   if (!dataok(document.forms[0].nascimento) ) {
//       return false;
//   }
function dataok(dataObj) {

  temp = new String(dataObj.value);

  dia = temp.substring(0,2);
  if ((dia>31) || (dia<1)) {
    alert("Dia inválido !");
    return false;
  }

  if (temp.indexOf("/") == -1) {
    var mes = temp.substring(2,4);
    var ano = temp.substring(4,8);
  } else {
    var mes = temp.substring(3,5);
    var ano = temp.substring(6,10);
  }

  if ((mes>12) || (mes<1)) {
    alert("Mês inválido !");
    return false;
  }

  if ( (mes==4) || (mes==6) || (mes==9) || (mes==11) ) {
    if (dia>30) {
      alert("Dia inválido para este mês !");
      return false;
    }
  }

  if (mes==2) {
    // extrai módulo
    ano = parseInt(ano);
    ano = unescape(ano);
    divinteiro = Math.floor(ano/4);
    divisao    = (ano/4);
    resto = (divisao-divinteiro);

    if (resto>0) { // Não é ano bissexto
      if (dia>28) {
        alert("Neste ano fevereiro tem 28 dias !");
        return false;
      } else {
        if (dia>29) {
          alert("Fevereiro não pode ter mais que 29 dias !");
          return false;
        }
      }
    }
  }
  return true;
}


// Verifica a validade de hora
// Uso: 
//   if (!horaok(document.forms[0].horario) ) {
//       return false;
//   }

function horaok(horaObj) {

  temp = new String(horaObj.value);

  hora = temp.substring(0,2);
  if ((hora>23) || (hora<0)) {
    alert("Hora inválida !");
    return false;
  }

  if (temp.indexOf(":") == -1) {
    var minuto  = temp.substring(2,4);
    var segundo = temp.substring(4,6);
  } else {
    var minuto  = temp.substring(3,5);
    var segundo = temp.substring(6,8);
  }

  if ((minuto>59) || (minuto<0)) {
    alert("Minuto inválido !");
    return false;
  }

  if ((segundo>59) || (segundo<0)) {
    alert("Segundo inválido !");
    return false;
  }

  return true;
}

function escrevedata() {
   var now = new Date();
   var yr = now.getYear();
   var mName = now.getMonth() + 1;
   var dName = now.getDay() + 1;
   var dayNr = ((now.getDate()<10) ? "0" : "")+ now.getDate();
   var ampm = (now.getHours() >= 12) ? " pm" : " am"
   var hours = now.getHours();

   hours = ((hours > 12) ? hours - 12 : hours);

   var minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes();
   var seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds();

   if(dName==1) Day = "Domingo";
   if(dName==2) Day = "Segunda-feira";
   if(dName==3) Day = "Terça-feira";
   if(dName==4) Day = "Quarta-feira";
   if(dName==5) Day = "Quinta-feira";
   if(dName==6) Day = "Sexta-feira";
   if(dName==7) Day = "Sábado";

   if(mName==1) Month="janeiro";
   if(mName==2) Month="fevereiro";
   if(mName==3) Month="março";
   if(mName==4) Month="abril";
   if(mName==5) Month="maio";
   if(mName==6) Month="junho";
   if(mName==7) Month="julho";
   if(mName==8) Month="agosto";
   if(mName==9) Month="setembro";
   if(mName==10) Month="outubro";
   if(mName==11) Month="novembro";
   if(mName==12) Month="dezembro";

   var DayDateTime=( Day
       + ", "
       + dayNr
       + " de "
       + Month
       + " de "
       + ""
       + yr
       + "." );
  document.writeln( DayDateTime );
  return true;
}


// Bloqueia a visualização do código fonte
function right(e) {
 var msg = "   Fabio Fittipaldi studio\n";
     msg+= "   Rua Carlos Cesarini, 56\n";
     msg+= " Curitiba - Paraná - Brasil\n\n";
     msg+= "(41) 3015-4889 - 9906-0056\n";
//     msg+= "        www.acentralbs.com.br\n";
     msg+= "   fhfittipaldi@gmail.com";
//     msg+= "  Design                  : André L. Fittipaldi\n";
//     msg+= "  Desenvolvimento : Fabio H. Fittipaldi";

 if ( (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) ||
      (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) ) {
   alert(msg);
   return false;
 }
 return true;
}
document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;


function cursortogether(e) {

  if (document.all)  obj = document.all.cursormoving;
  else               obj = document.layers.cursormoving;

  var mouseX = (ns)?objNS.pageX : event.clientX + document.body.scrollLeft;
  var mouseY = (ns)?objNS.pageY : event.clientY + document.body.scrollTop;
  obj.style.top  = mouseY+18;
  obj.style.left = mouseX+3;
}


window.onerror=null;


function direitos() {
  endereco = location.hostname;  // vai informar www.endereco.com.br
  if ( endereco != "" ) endereco = "http://" + endereco + "/";

  document.write( "<hr size=1>" );
  document.write( "<table align=center cellpading=0 cellspacing=3>" );
//  document.write( "</td><td>" );
//  document.write("<tr><td rowspan='2'><img src='http://umbanda.amovoce.net/images/mundo.gif'></td><td><p class='center'><font face='verdana,arial,helvetica' size='-2' color='Gray'><a href='" + endereco + "' onmouseover='javascript:window.status=" + '"Visite nosso site"' + "; return true' onmouseout ='javascript:window.status=" + '""' + "; return true'>©2002 - <b>A Umbanda.com.amor</b> - Todos os direitos reservados</a></font></p></td></tr>" );
  document.write("<tr><td rowspan='2'><img src='http://www.aumbandan.hpg.ig.com.br/images/mundo.gif'></td><td><p class='center'><font face='verdana,arial,helvetica' size='-2' color='Gray'><a href='" + endereco + "' onmouseover='javascript:window.status=" + '"Visite nosso site"' + "; return true' onmouseout ='javascript:window.status=" + '""' + "; return true'>©2002 - <b>A Umbanda.com.amor</b> - Todos os direitos reservados</a></font></p></td></tr>" );
//  document.write( "<p>&nbsp;</p>" );
//  document.write( "<p class='center'><font face='verdana,arial,helvetica' size='-2' color='Gray'><a href='" + endereco + "' onmouseover='javascript:window.status=" + '"Visite nosso site"' + "; return true' onmouseout ='javascript:window.status=" + '""' + "; return true'>©2002 - <b>A Umbanda.com.amor</b> - Todos os direitos reservados</a></font></p>" );
  document.write( "<tr><td><p class='center'><font face='verdana,arial,helvetica' size='-2' color='Gray'><a href='mailto:umbandan@bol.com.br'  onmouseover='javascript:window.status=" + '"Converse conosco"' + "; return true'  onmouseout ='javascript:window.status=" + '""' + "; return true'>Converse conosco.</a></font></p></td></tr>" );
//  document.write( "<p>&nbsp;</p>" );
//  document.write( "</td></tr>" );
  document.write( "</table>" );

// Conta Clicks
// document.write("<center><a href='http://itools.criandosite.com.br/contaClick.php?codUsuario=9325&url=http%3A%2F%2Fumbanda.amovoce.net'></a></center>");
}
















/*** <config> ***/ 
startColor = "#000000"; // MouseOut link color 
endColor = "#ffffff";   // MouseOver link color 

stepIn = 20;  // delay when fading in 
stepOut = 20; // delay when fading out 

/* 
** set to true or false; true will 
** cause all links to fade automatically 
***/ 
autoFade = true; 
/* 
** set to true or false; true will cause all CSS 
** classes with "fade" in them to fade onmouseover 
***/ 
sloppyClass = true; 
/*** </config>  ***/ 

hexa = new makearray(16); 
for(var i = 0; i < 10; i++) 
hexa[i] = i; 
hexa[10]="a"; hexa[11]="b"; hexa[12]="c"; 
hexa[13]="d"; hexa[14]="e"; hexa[15]="f"; 

document.onmouseover = domouseover; 
document.onmouseout = domouseout; 

startColor = dehexize(startColor.toLowerCase()); 
endColor = dehexize(endColor.toLowerCase()); 

var fadeId = new Array(); 

function dehexize(Color){ 
var colorArr = new makearray(3); 
for (i=1; i<7; i++){ 
for (j=0; j<16; j++){ 
if (Color.charAt(i) == hexa[j]){ 
if (i%2 !=0) 
colorArr[Math.floor((i-1)/2)]=eval(j)*16; 
else 
colorArr[Math.floor((i-1)/2)]+=eval(j); 
} 
} 
} 
return colorArr; 
} 

function domouseover() { 
if(document.all){ 
  var srcElement = event.srcElement; 
  if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1)) 
    fade(startColor,endColor,srcElement.uniqueID,stepIn); 
  } 
} 

function domouseout() { 
if (document.all){ 
var srcElement = event.srcElement; 
if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1)) 
fade(endColor,startColor,srcElement.uniqueID,stepOut); 
} 
} 

function makearray(n) { 
this.length = n; 
for(var i = 1; i <= n; i++) 
this[i] = 0; 
return this; 
} 

function hex(i) { 
if (i < 0) 
return "00"; 
else if (i > 255) 
return "ff"; 
else 
return "" + hexa[Math.floor(i/16)] + hexa[i%16];} 

function setColor(r, g, b, element) { 
var hr = hex(r); var hg = hex(g); var hb = hex(b); 
element.style.color = "#"+hr+hg+hb; 
} 

function fade(s,e, element,step){ 
var sr = s[0]; var sg = s[1]; var sb = s[2]; 
var er = e[0]; var eg = e[1]; var eb = e[2]; 

if (fadeId[0] != null && fade[0] != element){ 
setColor(sr,sg,sb,eval(fadeId[0])); 
var i = 1; 
while(i < fadeId.length){ 
clearTimeout(fadeId[i]); 
i++; 
} 
} 

for(var i = 0; i <= step; i++) { 
fadeId[i+1] = setTimeout("setColor(Math.floor(" +sr+ " *(( " +step+ " - " +i+ " )/ " +step+ " ) + " +er+ " * (" +i+ "/" + 
step+ ")),Math.floor(" +sg+ " * (( " +step+ " - " +i+ " )/ " +step+ " ) + " +eg+ " * (" +i+ "/" +step+ 
")),Math.floor(" +sb+ " * ((" +step+ "-" +i+ ")/" +step+ ") + " +eb+ " * (" +i+ "/" +step+ ")),"+element+");",i*step); 
} 
fadeId[0] = element; 
}
