/* Auteur: patrick premartin */
/* Copyright: Olf Software */
/* Date de création: 12/10/03 */

/* Liste des modifications :
	05/08/2008, pprem : ajout d'une fonction permettant de supprimer le contenu par défaut des champs de saisie lorsqu'ils n'a pas été modifié par l'utilisateur
	17/08/2008, pprem : remplacement des deux champs nom/prénom des auteurs par un seul, avec recherche automatique dedans comme pour les photographes
*/

hs.Expander.prototype.printIframe = function () {
   var name = this.iframe.name;
   frames[name].focus();
   frames[name].print();
   return false;
}
function trier_liste (liste) {
  i = liste.length;
  while (i > 0) {
    petit_indice = 0;
    petit_texte = '';
    for (j = 0; j < i; j++) {
      if ((petit_texte > liste.options[j].text) || (petit_texte == '')) {
        petit_indice = j;
        petit_texte = liste.options[j].text;
      }
    }
    liste.options[liste.length]=new Option (liste.options[petit_indice].text, liste.options[petit_indice].value);
    liste.options[liste.length-1].selected=liste.options[petit_indice].selected;
    liste.options[petit_indice]=null;
    i--;
  }
}

function nettoyer_liste (liste) {
  i = 0;
  while (i < liste.length) {
    if (""==liste.options[i].text) {
      liste.options[i]=null;
    } else {
      i++;
    }
  }
}

function remplir_liste(liste, result) {
  result.value='';
  for (i=0; i<liste.length;i++) {
    result.value=result.value+','+liste.options[i].value+',';
  }
}

function retirer_liste(liste, result) {
  for (i=0; i<liste.length; i++) {
    if (liste.options[i].selected) {
      liste.options[i]=null;
      i--;
    }
  }
  remplir_liste (liste, result);
}

function init_champ_value (champ, valeur)
{
	if (champ.value == valeur)
	{
		champ.value = '';
	}
}

  function EcrireCookie(nom, valeur)
  { // (c) http://www.actulab.com/ecrire-les-cookies.php
    var argv=EcrireCookie.arguments;
    var argc=EcrireCookie.arguments.length;
    var expires=(argc > 2) ? argv[2] : null;
    var path=(argc > 3) ? argv[3] : null;
    var domain=(argc > 4) ? argv[4] : null;
    var secure=(argc > 5) ? argv[5] : false;
    document.cookie=nom+"="+escape(valeur)+
    ((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
    ((path==null) ? "" : ("; path="+path))+
    ((domain==null) ? "" : ("; domain="+domain))+
    ((secure==true) ? "; secure" : "");
  }
  
  function getCookieVal(offset)
  { // (c) http://www.actulab.com/lire-les-cookies.php
    var endstr=document.cookie.indexOf (";", offset);
    if (endstr==-1) endstr=document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
  }
  
  function LireCookie(nom)
  { // (c) http://www.actulab.com/lire-les-cookies.php
    var arg=nom+"=";
    var alen=arg.length;
    var clen=document.cookie.length;
    var i=0;
    while (i<clen)
    {
      var j=i+alen;
      if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
      i=document.cookie.indexOf(" ",i)+1;
      if (i==0) break;
    }
    return null;
  }
  
  function EffaceCookie(nom)
  { // (c) http://www.actulab.com/effacer-les-cookies.php
    date=new Date;
    date.setFullYear(date.getFullYear()-1);
    EcrireCookie(nom,null,date);
  }

  function menu_ouvrirfermer(id) {
    // (c) Patrick Prémartin / Olf Software
    // pour http://www.francebenevolat.org
    if (document.getElementById) {
      var style = document.getElementById(id).style;
      style.display = ('none' == style.display)?'block':'none';
      date=new Date;
      date.setFullYear(date.getFullYear()+10);
      EcrireCookie(id, ('none' == style.display)?'0':'1', date,'/');
      return false;
    } else {
      window.alert('Désolé, ce site ne peut pas fonctionner correctement avec votre navigateur. Veuillez nous contacter ou passer à une version plus récente.');
      date=new Date;
      date.setFullYear(date.getFullYear()+10);
      EcrireCookie(id, '1', date,'/');
      return true;
    }
  }
  
  function menu_afficher(id) {
    // (c) Patrick Prémartin / Olf Software
    // pour http://www.francebenevolat.org
    if (document.getElementById) {
      var style = document.getElementById(id).style;
      style.display = ('1' == LireCookie(id))?'block':'none';
    }
  }
    
  function bloc_afficher(id) {
    // (c) Patrick Prémartin / Olf Software
    if (document.getElementById) {
      var style = document.getElementById(id).style;
      style.display = 'block';
    }
  }

  function bloc_cacher(id) {
    // (c) Patrick Prémartin / Olf Software
    if (document.getElementById) {
      var style = document.getElementById(id).style;
      style.display = 'none';
    }
  }

  function reinit_champs()
  {
	init_champ_value(document.frmmaj.rech_nom,nom_par_defaut);
	init_champ_value(document.frmmaj.rech_prenom,prenom_par_defaut);
//	init_champ_value(document.frmmaj.rech_auteur,auteur_par_defaut);
	init_champ_value(document.frmmaj.rech_photographe,photographe_par_defaut);
	init_champ_value(document.frmmaj.pseudo,pseudo_par_defaut);
  }
  
  // ================================================
// script: Gerard Ferrandez - Ge-1-doot - MAY 2005
// http://www.dhteumeuleu.com
// ================================================
var object = new Array();

function Slide(N,oCont){
	this.N  = N;
	this.S  = 1.1;
	this.object = new Array();

	this.CObj = function (parent,N){

		this.parent = parent;
		this.N = N;
		this.obj = parent.frm[N];
		this.tit = this.obj.firstChild;
		this.div = this.obj.getElementsByTagName("div")[1];
		this.div.style.visibility = "hidden";
		this.y0 = N * 18;
		this.Y1 = this.y0;
		this.obj.style.top = Math.round(this.y0) + 'px';
		this.obj.style.height = Math.round(parent.H - (parent.NF-1) * 18 - 3) + 'px';
		this.obj.style.visibility = "visible";
		this.obj.parent = this;
		this.run = false;

		this.move = function(){
			with(this){
				dy = (y1-y0)/parent.S;
				if(Math.abs(dy)>.1){
					y0+=dy;
					obj.style.top = Math.round(y0) + 'px';;
					setTimeout("object["+parent.N+"].object["+N+"].move();", 16);
				} else {
					run = false;
					if(dy>0)div.style.visibility="hidden";
					else if(N>0)parent.object[N-1].div.style.visibility="hidden";
				}
			}
		}

		this.obj.onmouseover = function(){
			with(this.parent){
				if(!run){
					run = true;
					div.style.visibility="visible";
					for(i=0;i<parent.NF;i++)parent.object[i].tit.className = "title";
					tit.className = "title_o";
					for(i=0;i<=N;i++){
						parent.object[i].y1 = i*18;
						parent.object[i].move();
					}
					for(i=N+1;i<parent.NF;i++){
						parent.object[i].y1 = parent.H-(parent.NF-i)*18;
						parent.object[i].move();
					}
				}
			}
		}
	}

	this.frm = document.getElementById(oCont);
	this.H = this.frm.offsetHeight;
	this.frm = this.frm.getElementsByTagName("span");
	this.NF = this.frm.length;
	for(i=0; i < this.NF; i++) this.object[i] = new this.CObj(this, i);
	this.object[0].obj.onmouseover();
	this.S = 10;
}

onload = function() {
	object[0] = new Slide(0, "frames");
}
-->
