// File: adblock.js
// Version: 1.2
// Update 9/1/04: fixed spelling errors in text
// Update 9/7/04: Added deny feature, allowing no access to users with AdBlock software.
// Distributed by: AdBlock.org
// This file is provided AS-IS and without warranty and is distributed under the GPL.
// This code may be freely used as long as it remains intact.

var chip = document.cookie;
var deny = 0;  //set this to 1 to deny access with no access.  
  // A denied user will go to page sorry.html.
  // if you enable this feature you must create a page called /sorry.html

  function getCookie(name) { 
    var index = chip.indexOf(name + "=");
    if (index == -1) return null;
    index = chip.indexOf("=", index) + 1; // first character
    var endstr = chip.indexOf(";", index);
    if (endstr == -1) endstr = chip.length; // last character
    return unescape(chip.substring(index, endstr));
  }

function hidediv() {
if (document.getElementById) { 
document.getElementById('warning').style.visibility = 'hidden';
document.cookie = "warned=true; PATH=/";
} 
}

function clear_cookie(){
document.cookie =  "warned=; PATH=/";
}


if (document.getElementById) {
if (!getCookie("warned")) {
document.write("<div id=\"warning\" style=\"visibility:hidden; position:absolute; background: #FF6; width:80%; left: 10%; top:50px; padding: 10px 10px 10px 10px; border: 1px solid black; \">");
document.write("<p>Important : <b>Il semblerait que vous utilisez un bloqueur de publicites (AdBlock).</b></p>");
document.write("<p>Les serveurs hebergant ce site sont finances par la publicite. Si vous naviguez sur ce site sans afficher la publicite, vous ne contribuez pas au financement de celui-ci. Il se peut, peut-etre sans que vous le sachiez, qu'un programme sur votre ordinateur bloque les publicites.");
document.write("<p>Si vous utilisez par exemple l'extention AbBlock de firefox, vous pouvez la desactiver sur notre site en cliquant sur son icone en haut a droite, puis \"desactiver sur erogaki.com\". Merci.</p>");
document.write("<p><div align=center><a href=\"javascript:hidediv()\">Cliquez ici pour fermer cet avertissement</a>.<br>");
document.write("</p></div></div>");
}
}

if (document.images) {
  var currImg;
  var ImgFound = 0;
  var LinkFound = 0;
  //alert("checking images..");
  for (var d=0; d < document.images.length; ++d) {
    currImg = document.images[d];
    if (currImg.src.indexOf("banner") > -1) {
     ImgFound = 1;
    }
  }

  if (!ImgFound || AdBlockTest) {
     if(deny) {	 
       location = "/sorry.html";
       window.location(location);		
     } else {
	document.getElementById('warning').style.visibility = 'visible';
     }
  }

}
