function commentaire(id, etat) {
    if (etat == 1) {
        document.getElementById('commentaires_'+id).style.display = 'block';
        document.getElementById('voir_'+id).style.display = 'none';
        document.getElementById('cacher_'+id).style.display = 'block';
    }
    else {
        document.getElementById('commentaires_'+id).style.display = 'none';
        document.getElementById('voir_'+id).style.display = 'block';
        document.getElementById('cacher_'+id).style.display = 'none';
    }
}

function reload_captcha(cap_id) {
    document.getElementById('captcha').src = 'captcha-'+cap_id+'.jpg#'+Math.random();
}

function get_xhr() {
    xhr = null;
    if (window.XMLHttpRequest) {
        xhr = new XMLHttpRequest();
        if (xhr.overrideMimeType)
             xhr.overrideMimeType("text/xml");
    } else if (window.ActiveXObject) {
        try {
            xhr = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xhr = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                 window.alert("Votre navigateur ne prend pas en charge l'objet XMLHTTPRequest.");
            }
        }
    }
    return(xhr);
}

AfficherInfoBulle = function(e) {
  var text = $(this).next('.info-bulle-contenu');
  if (text.attr('class') != 'info-bulle-contenu')
    return false;

  text.fadeIn()
    .css('top', e.pageY)
    .css('left', e.pageX+10);

  return false;
}

CacherInfoBulle = function(e) {
  var text = $(this).next('.info-bulle-contenu');
  if (text.attr('class') != 'info-bulle-contenu')
    return false;

  text.fadeOut();
}

InstallationInfoBulle = function() {
  $('.info-bulle-css')
    .each(function(){
      $(this)
        .after($('<span/>')
          .attr('class', 'info-bulle-contenu')
          .html($(this).attr('title')))
        .attr('title', '');
    })
    .hover(AfficherInfoBulle, CacherInfoBulle);
}

function lien(site) {
    if (site.substr(0, 7) != 'http://')
        site = 'http://'+site;
    window.open(site, '_blank');
}

