<!--
if(document.all && !document.getElementById) {
  document.getElementById = function(id) {
    return document.all[id];
  }
}

function getCookie(NameOfCookie){
  if (document.cookie.length > 0) {              
    begin = document.cookie.indexOf(NameOfCookie+"=");       
    if (begin != -1) {           
      begin += NameOfCookie.length+1;       
      end = document.cookie.indexOf(";", begin);
      if (end == -1) end = document.cookie.length;
      return unescape(document.cookie.substring(begin, end));
    } 
  }
  return null;
}

function setCookie(NameOfCookie, value, expiredays) {
  var ExpireDate = new Date ();
  ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
  document.cookie = NameOfCookie + "=" + escape(value) + 
  ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString()) + 
  "; path=/";
}


function delCookie (NameOfCookie) {
  if (getCookie(NameOfCookie)) {
    document.cookie = NameOfCookie + "=" +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function preloadImages() {
  document.preload = new Array();
	if (document.images) {
    document.preload[0] = new Image();
    document.preload[0].src = "/gfx/cart_on.gif";
  }
}
preloadImages();

function displayURL()	{
  var stat="w w w . l o j a d o s e x o . c o m";
  window.status=stat;
  setTimeout("displayURL()",150);
}
displayURL();


function textFocus(obj) {
  obj.style.borderColor='#ff0000';
  obj.style.backgroundColor='#ffffff';
  obj.style.color='#000000';
  obj.style.scrollbarTrackColor='#ffffff';
  obj.style.scrollbarHighlightColor='#ff0000';
  obj.style.scrollbarArrowColor='#ff0000';
  obj.style.scrollbarShadowColor='#ff0000';
}
function textBlur(obj) {
  obj.style.borderColor='#660066';
  obj.style.backgroundColor='#ffffff';
  obj.style.color='#ababab';
  obj.style.scrollbarTrackColor='#ffffff';
  obj.style.scrollbarHighlightColor='#00477F';
  obj.style.scrollbarArrowColor='#00477F';
  obj.style.scrollbarShadowColor='#00477F';
}
function textBlur2(obj) {
  obj.style.borderColor='#660066';
  obj.style.backgroundColor='#ffffff';
  obj.style.color='#858585';
  obj.style.scrollbarTrackColor='#ffffff';
  obj.style.scrollbarHighlightColor='#660066';
  obj.style.scrollbarArrowColor='#660066';
  obj.style.scrollbarShadowColor='#660066';
}


function openPopUp(id,width,height) {
  var url = '/foto_ver.php?id='+id;
  var features = 'width='+width+',height='+height;
  window.open(url, '_blank', features);
}
function popUp(url,width,height) {
  var features = 'width='+width+',height='+height;
  window.open(url, '_blank', features);
}


function mOvr(src,clrOver) {
    src.style.cursor = 'hand';
    src.style.cursor = 'pointer';
    src.style.backgroundColor = clrOver;
}
function mOut(src,clrIn) {
    src.style.cursor = 'default';
    src.style.backgroundColor = clrIn;
}
function mClk(src) {
    //alert(window.document.childNodes[0].valu);
    src.childNodes[0].click();
}


function cartActualizar(e) {
  if (e) {
    var key;
    if(window.event)
         key = window.event.keyCode; //IE
    else
         key = e.which;              //firefox
  
    if(key < 48 || key > 57) {
      return false;
    }
  }
  document.getElementById('actualizar1').style.visibility='visible';
  document.getElementById('actualizar2').style.visibility='visible'; 
  document.cartForm.changed.value = 'true'; 
  
  return true; 
}

function onlyNumbers(e) {
  if (e) {
    var key;
    if(window.event)
         key = window.event.keyCode; //IE
    else
         key = e.which;              //firefox

    if((key < 48 || key > 57) && key != 8 && key != 0 && key != 13 && key != 10) {
      return false;
    }
  }
  
  return true; 
}


function verifySeal() {
  var url = 'https://seal.godaddy.com/verifySeal?sealID=2072311021036ad5ba21271076bf93d2217f4408483995360937209234';
  window.open(url,'SealVerfication','location=yes,status=yes,resizable=yes,scrollbars=yes,width=650,height=550');
}

function showAdd (ad) {
  window.location = '/ads/show/'+ad+'/';
}

function addFavorites() {
  if (document.all) { 
    window.external.AddFavorite(location.href, document.title); 
  } else if (window.sidebar) { 
    window.sidebar.addPanel(document.title, location.href, '');
  } else {
    alert('Utilize CTRL+D para adicionar aos favoritos');
  }
}

function openPopUp2(id,width,height) {
  var url = '/ads_popup.php?id='+id;
  var features = 'width='+width+',height='+height;
  window.open(url, '_blank', features);
}

function UpdateClock() {
   if(clockID) {
      clearTimeout(clockID);
      clockID  = 0;
   }
   
   if(document.getElementById('clock_delimiter').style.visibility == 'hidden') {
     document.getElementById('clock_delimiter').style.visibility = 'visible';
   } else {
     document.getElementById('clock_delimiter').style.visibility = 'hidden';
   }
   
   segundo = segundo + 1;
   if (segundo == 60) {
     segundo = 0;
     minuto = parseInt(minuto, 10);
     minuto = minuto + 1;
     if (minuto == 60) {
       minuto = 0;
       hora = parseInt(hora, 10);
       hora = hora + 1;
       if (hora == 24) {
         hora = 0;
       }
     }
     hora = parseInt(hora, 10);
     if (minuto < 10 ) minuto = '0'+minuto;
     document.getElementById('clock_minutes').innerHTML = minuto;
     if (hora < 10 ) hora = '0'+hora;
     document.getElementById('clock_hours').innerHTML = hora;
   }

   clockID = setTimeout("UpdateClock()", 1000);
}

/***********************************************
* Cool DHTML tooltip script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
if (typeof thetext!="undefined" && thetext!="") tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.display="block"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.display="none"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

function showhide(element) {
  var img = element.parentNode.getElementsByTagName('img').item(0);
  var obj = element.parentNode.parentNode.childNodes[1];
  if (obj.style.display == 'block') {
    obj.style.display = 'none';
    img.src = '/gfx/arrow2.gif';
  } else {
    obj.style.display = 'block';
    img.src = '/gfx/arrow2v.gif';
  }
}

// Product switch Pictures (Scriptaculous)
function changePicture(pos) {
  if (pos == window.setposition) return false;

  var pics = $$('td#product_pics a[rel] img');
  var pic = pics[window.setposition];
  
  // Picture
  pic.fade({ duration: 1.0, from: 1, to: 0 });
  pics[pos].appear({ duration: 1.0, from: 0, to: 1 });
  
  // Control
  $$('td.foto_tdon').first().className = 'foto_tdoff';
  $('foto_td' + pos).className = 'foto_tdon';

  window.setposition = eval(pos);
  return false;
}


function adStats(f) {
  if (typeof (get_stats_data) == 'undefined') get_stats_data = false;
  if (get_stats_data == true)
    return false;
  get_stats_data = true;
  
  new Effect.Fade($('stats_img').down('img', 1), 
                  {afterFinish: function () {
                                  $('stats_img').down('img', 0).show();

                                  f = $(f);
                                  data = 'startdate=' + encodeURIComponent(f.startdate.value) +
                                         '&enddate=' + encodeURIComponent(f.enddate.value) + 
                                         '&ajax=true';
                                
                                  new Ajax.Request(location.pathname, {
                                                   method: 'get',
                                               parameters: data,
                                                onSuccess: function(t) {
                                                             if (t.responseText == 'login') {
                                                               var url = location.pathname;
                                                               url = url.replace(/manage/, "show");
                                                               location.pathname = url;
                                                             }
                                                             $('stats_img').down('img', 1).src = t.responseJSON;
                                                             $('stats_img').down('img', 1).onload = function() {
                                                               $('stats_img').down('img', 0).hide();
                                                               $('stats_img').down('img', 1).appear();
                                                             }
                                                             get_stats_data = false;
                                                           },
                                                onFailure: function(t) {
                                                             $('stats_img').down('img', 1).show();
                                                             $('stats_img').down('img', 0).hide();
                                                             get_stats_data = false;
                                                           }
                                  });

                                }
                 })

  return false;
}

function adDeleteFoto(c, id) {

  var data = new Hash();
  data.set('action', 'deletefoto');
  data.set('photo',  id);
  
  new Ajax.Request(location.pathname + '?ajax', {
                   method: 'post',
               parameters: data,
                onSuccess: function(t) {
                             if (t.responseText == 'login') {
                               var url = location.pathname;
                               url = url.replace(/manage/, "show");
                               location.pathname = url;
                             }
                             
                             if (typeof(t.responseJSON) == 'number') {
                               new Effect.Highlight(c, {startcolor: '#ffff00',
                                                               endcolor: '#ffffff',
                                                            afterFinish: function () {
                                                                           c.hide();
                                                                           if (t.responseJSON == 0) {
                                                                             $('fotos_table').hide();
                                                                             $('fotos_note').hide();
                                                                             $('fotos_session').show();
                                                                           }
                                                                         }
                                                    });
                             }
                           }
  });

  return false;
}

// Menu
startList = function() {
  if (document.all && document.getElementById) {
    try {
      navRoot = document.getElementById("menu_catalog");
      for (i=0; i<navRoot.childNodes.length; i++) {
        node = navRoot.childNodes[i];
        if (node.nodeName=="LI") {
          node.onmouseover=function() {
            this.className+=" over";
          }
          node.onmouseout=function() {
            this.className=this.className.replace(" over", "");
          }
        }
      }
    } catch (e) {
      return;
    }
  }
}
window.onload=startList;
//-->
