var addBookmarkObj = {
  init:function() {
    if(!document.getElementById || !document.createTextNode) return;
    var numBookmark = 1;
    var cont = document.getElementById('lienFavori');
    while(cont)
    {
      cont.href = top.location.href;
      if(window.opera)
        cont.rel = 'sidebar'; // pour Opera 7+
      else
      {
        // pour les navigateurs non-Opera.
        cont.onclick = function() {
          addBookmarkObj.exec(this.href, this.title);
          return false;
        }
      }
      cont.title = document.title;
      ++numBookmark;
      cont = document.getElementById('lienFavori'+numBookmark);
    }
  },
  exec:function(url, title) {
    var isKonq = (isLikelyKonqueror3 && isLikelyKonqueror3());
    var isMac = (navigator.userAgent.toLowerCase().indexOf('mac') != -1);
    var buttonStr = isMac ? 'Command/Cmd' : 'CTRL';

    // IE4/Win fait une erreur avec "typeof(window.external.AddFavorite)"
    // Avec IE7, l'appel doit venir d'un serveur, pas d'un systeme local
    //   sinon ya une erreur de permission.
    if(window.external && (!document.createTextNode || (typeof(window.external.AddFavorite)=='unknown')))
        window.external.AddFavorite(url, title);
    else if(isKonq)
      alert('You need to press CTRL + B to add this site to your favorites.');
    else if((window.opera && opera.buildNumber && !isNaN(opera.buildNumber())))
      void(0);
    else if(window.opera)
      alert('You need to press '+buttonStr+' + T to add this site to your favorites.');
    else if(window.home)
      alert('You need to press '+buttonStr+' + D to add this site to your favorites.');
    else if(!window.print || isMac)
      alert('You need to press Command/Cmd + D to add this site to your favorites.');
    else
      alert('You need to add this site manualy to your favorite '+
        'because your browser do not support this command.');
  }
}

function isLikelyKonqueror3() {
  if(!document.getElementById) return false;
  if(document.defaultCharset || window.opera || !window.print) return false;
  if(window.home) return false;
  if(document.all) return true;
  var likely = 1;
  eval("try{var str=document.all[0].tagName;}catch(err){likely=0;}");
  return likely;
}

function dss_addEvent(el,etype,fn) {
  if(el.addEventListener && (!window.opera || opera.version) )
    el.addEventListener(etype,fn,false);
  else if(el.attachEvent)
    el.attachEvent('on'+etype,fn);
  else
  {
    if(typeof(fn) != "function") return;
    if(typeof(window.earlyNS4)=='undefined')
      window.earlyNS4=((navigator.appName.toLowerCase()=='netscape')&&
      (parseFloat(navigator.appVersion)<4.02)&&document.layers);
    if((typeof(el['on'+etype])=="function")&&!window.earlyNS4)
    {
      var tempFunc = el['on'+etype];
      el['on'+etype]=function(e) {
        var a=tempFunc(e),b=fn(e);
        a=(typeof(a)=='undefined')?true:a;
        b=(typeof(b)=='undefined')?true:b;
        return (a&&b);
      }
    }
    else
      el['on'+etype]=fn;
  }
}

dss_addEvent(window,'load',addBookmarkObj.init);

function OpenCenterPopUp(){     
    var Left=window.screen.width/2-175; 
    var Top=window.screen.height/2-175; 
    var Configuration="'toolbar=no, menubar=no, location=no, directories=no, status=no, resizeable=no, width=520, height=300, left=" + Left + ", top=" + Top; 
    window.open('envoyer-ami.html','Accès',Configuration); 
}
