 //================================================================================================
 // Estatisticas
 //================================================================================================
 function banner_click(url,id)
 {
    chama_banner_click(id); 
    window.location=url; 
 }
 
  
 //================================================================================================
 // Slideshow
 //================================================================================================
 var slideCache = new Array();

 function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
 }

 //change the opacity for different browsers
 function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 101);
    object.MozOpacity = (opacity / 101);
    object.KhtmlOpacity = (opacity / 101);
    object.filter = "alpha(opacity=" + opacity + ")";
 }

 function RunSlideShowWithLinks(pictureID,linkID,imageLinks,displaySecs)
 {
 var separator = imageLinks.indexOf(";");
 var nextImage = imageLinks.substring(0,separator);

 if (slideCache[nextImage] && slideCache[nextImage].loaded)
 {
  //aplica filtro no ie
  //====================================================
  /*if (document.all)
  {
    //document.getElementById(pictureID).style.visibility="hidden";
    document.getElementById(pictureID).style.filter="blendTrans(duration=1)";
    document.getElementById(pictureID).filters.blendTrans.Apply();
  }*/
  //====================================================

  document.getElementById(linkID).style.backgroundImage = "url(" + document.getElementById(pictureID).src + ")";
  changeOpac(0, pictureID);

  var futureImages = imageLinks.substring(separator +1,imageLinks.length) + ';' + nextImage;
  separator = futureImages.indexOf(";");
  var nextLink = futureImages.substring(0,separator);
  futureImages= futureImages.substring(separator +1,imageLinks.length) + ';' + nextLink;
  //==============================
  // Efeito de fade in nos outros browsers
  //==============================
  //opacity(pictureID, 100, 0, 500);
  //==============================
  //====================================================
  /*if (document.all)
  {
    document.getElementById(pictureID).style.visibility="visible";
    document.getElementById(pictureID).filters.blendTrans.Play();
  }*/
  //====================================================
  document.getElementById(pictureID).src = nextImage;
  document.getElementById(linkID).href = nextLink;

  opacity(pictureID, 0, 100, 1000);
  setTimeout("RunSlideShowWithLinks('"+pictureID+"','"+linkID+"','"+futureImages+"',"+displaySecs+")",
   displaySecs*2000);
  //==============================
  // Efeito de fade in nos outros browsers
  //==============================

  //==============================
  //corre filtro

  // Identify the next image to cache.
  separator = futureImages.indexOf(";");
  nextImage = futureImages.substring(0,separator);
 } else {
  setTimeout("RunSlideShowWithLinks('"+pictureID+"','"+linkID+"','"+imageLinks+"',"+displaySecs+")",250);
 }
 // Cache the next image to improve performance.
 if (slideCache[nextImage] == null) {
  slideCache[nextImage] = new Image;
  slideCache[nextImage].loaded = false;
  slideCache[nextImage].onload = function(){this.loaded=true};
  slideCache[nextImage].src = nextImage;
 }
}




