function Loader () {
   this.loaders = new Array();
   window.onload = this.load;
}
Loader.prototype.addOnLoad = function (f) {
   this.loaders.push(f);
}
Loader.prototype.load = function () {
   for (var i = 0; i < loader.loaders.length; i++) {
      loader.loaders[i]();
   }
}

var loader = new Loader();

function ajouterFavoris() {
   var urlSite = "http://www.ariegepyrenees.net";
   var nomSite = "Ariegepyrenees.net - Portail des entreprises ariégeoises";

   // internet explorer windows
   if (window.external) {
      // netscape 6.x
      if (window.sidebar) {
         window.sidebar.addPanel(nomSite, urlSite, "");
      }
      else {
         window.external.AddFavorite(urlSite, nomSite);
      }
   }
   // internet explorer mac
   if (   document.all
       && navigator.userAgent.indexOf('Win') < 0) {
      alert ("COMMAND + B pour ajouter  " + nomSite + " à vos favoris!");
   }
   // netscape 4.x
   if (document.layers) {
      alert ("CTRL + D pour ajouter " + nomSite + " à vos favoris!");
   }
   // opéra
   if (navigator.userAgent.indexOf('Opera') != -1) {
      alert ("CTRL + T pour ajouter " + nomSite + " à vos favoris!");
   }
}

function popup(adresse) {
   var width = 645;
   var height = 600;
   var top = (screen.height - height) / 2;
   var left = (screen.width - width) / 2;
   var popup = window.open(adresse, "popup", "directories=no, menubar=yes, status=yes, resizable=yes, scrollbars=yes, location=no, height=" + height + ", width=" + width + ", top=" + top + ", left=" + left);
   popup.focus();
}

function verifFormSondage(f) {
   var radios = f.getElementsByTagName('input');
   var coche = false;
   for (var i = 0; i < radios.length; i++) {
      if (radios[i].type == 'radio' && radios[i].name == 'reponse' && radios[i].checked == true) {
         coche = true;
      }
      else if (radios[i].type == 'checkbox' && radios[i].name == 'reponse[]' && radios[i].checked == true) {
         coche = true;
      }
   }
   if (coche == false) {
      alert('Vous n\'avez pas choisi de réponse dans le formulaire');
      return false;
   }
   return true;
}

function DefilementNews(conteneur, defilement, pas, tempo) {
   this.pas = pas;
   this.tempo = tempo;
   this.conteneur = conteneur;
   with (this.conteneur.style) {
      position = "relative";
      overflow = "hidden";
   }
   this.defilement = defilement;
   with (this.defilement.style) {
      position = "absolute";
      top = (this.conteneur.offsetHeight / 2) + "px";
   }
   this.start();
   var objet = this;
   this.conteneur.onmouseover = function () { objet.stop(); };
   this.conteneur.onmouseout = function () { objet.start(); };
   window.onunload = this.stop;
}
DefilementNews.prototype.defiler = function () {
   if (parseInt(this.defilement.style.top) + this.defilement.offsetHeight < 0) {
      this.defilement.style.top = this.conteneur.offsetHeight + "px";
   }
   else {
      this.defilement.style.top = parseInt(this.defilement.style.top) - this.pas + "px";
   }
}
DefilementNews.prototype.start = function () {
   var objet = this;
   this.timer = setInterval(function () { objet.defiler(); }, this.tempo);
}
DefilementNews.prototype.stop = function () {
   clearInterval(this.timer);
   this.timer = null;
}
loader.addOnLoad(function () {
      var img = document.getElementById('okBouton');
      img.onmouseover = function () {
         img.src = 'images/okOver.gif';
      }
      img.onmouseout = function () {
         img.src = 'images/ok.gif';
      }
   }
);