// -----------------------------------------------------------------------------
var cartoSpeed  = 25;
var cartoFresh  = 10;
var cartoCSpeed = 0;

// -----------------------------------------------------------------------------
function cartoDoHide() {
  var cHeight = document.all ? document.body.clientHeight : window.innerHeight;
  var cTopX   = parseInt(document.getElementById('cartoPopup').style.top);
  if ( cTopX <= ((cHeight*-1)+(2.5*cartoSpeed)) ) cartoOff();
  else {
    document.getElementById('cartoPopup').style.top = (cTopX - cartoSpeed) + "px";
    cartoDraw("cartoDoHide()");
  }
}
// -----------------------------------------------------------------------------
function cartoDoShow() {
  var cHeight = document.all ? document.body.clientHeight : window.innerHeight;
  var cTopX   = parseInt(document.getElementById('cartoPopup').style.top);
  if (cTopX >= (-2.5*cartoSpeed)) cartoOn();
  else {
    document.getElementById('cartoPopup').style.top = (cTopX + cartoSpeed) + "px";
    cartoDraw("cartoDoShow()");
  }
}
// -----------------------------------------------------------------------------
function cartoHide() {
  cartoDoHide();
}
// -----------------------------------------------------------------------------
function cartoShow() {
  var sY = document.all ? document.body.clientHeight : window.innerHeight;
  document.getElementById('cartoPopup').style.top    = (sY*-1)+"px";
  document.getElementById('cartoPopup').style.visibility = "visible";
  document.getElementById('cartoPopup').style.display = "block";      
  cartoDoShow();
}
// -----------------------------------------------------------------------------
function cartoOn() {
  cartoCSpeed = 0;
  document.getElementById('cartoPopup').style.top = "0px";
}
// -----------------------------------------------------------------------------
function cartoOff() {
  cartoCSpeed = 0;
  var sY = document.all ? document.body.clientHeight : window.innerHeight;  
  document.getElementById('cartoPopup').style.top    = (sY*-1)+"px";
  document.getElementById('cartoPopup').style.visibility = "hidden";
  document.getElementById('cartoPopup').style.display = "none"; 
}
// -----------------------------------------------------------------------------
function cartoDraw(func) {
  setTimeout(func, cartoFresh);
}
// -----------------------------------------------------------------------------
function carto_Ciblage(id, Categ) {
  var url = "/index_full.php?module=geomapper&page=index&CIBLECAT="+Categ+"&FicheID="+id
  //alert(url);
  document.getElementById("cartoMap").src = url
  cartoShow();
}