<!--
//-------------------------------------------------------------
// Passage par POST des variables de pagination
//-------------------------------------------------------------
function pageTo(page,directory,cursor) {
		document.form_link.page.value=page;
		document.form_link.dir.value=directory;
		document.form_link.cursor.value=cursor;
		document.form_link.submit();
}

//-------------------------------------------------------------
// Pop Up à la taille de l'image et centr&eacute;e sur la page
//-------------------------------------------------------------
function openPopup(mypage,myname,w,h,scroll,resize,pos){
var win=null;
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable='+resize+'';
win=window.open(mypage,myname,settings);
}

//-------------------------------------------------------------
// Interdire la soumission multiple des formulaires
//-------------------------------------------------------------
var submitcount=0;
function checkSubmit()	{  
  if (submitcount == 0){	  
    submitcount++;		
	return true;
 } else {	
    return false; 
  }
}  

function verify_formulaire(){	
  alert(document.formulaire.modifier.value);
  alert(document.formulaire.modifier.name);
  document.formulaire.onsubmit=true;
  alert(document.formulaire.onsubmit);
  alert(document.formulaire.checkbox[0]);
  /*if (confirm(label)) {
    return true;
  }
  else {
	alert ("coucou");
    return false;
	alert("coucou2");
	document.forms[0].checkbox[0
  }*/
}


//-------------------------------------------------------------
// Interdire la visibilité des liens URL sur la barre d'&eacute;tat
//-------------------------------------------------------------
function hidestatus(){
window.status='' // il est possible de laisser un message affich&eacute;
return true
}

if (document.layers)
document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT | Event.MOUSEDOWN)
document.onmouseover=hidestatus
document.onmouseout=hidestatus
document.onmousedown=hidestatus


//-------------------------------------------------------------
// Roll-Over à distance (sur un evènement onMouseOut)
// id  : attribut de l'&eacute;lement
// etat: visible/hidden
//-------------------------------------------------------------
function ChangeMessage(id,etat) {
	if (document.getElementById) {
		document.getElementById(id).style.visibility=etat;
	} else if (document.all) {
		  document.all[id].style.visibility=etat;
	} else if (document.layers) {
		  document.layers[id].visibility=etat;
	} 
} 

//-------------------------------------------------------------
// Afficher/cacher un bloc dynamiquement 
// les styles #divHidden et #divVisible doivent être int&eacute;gr&eacute;s CSS
//-------------------------------------------------------------
/*
.divVisible { 
visibility: hidden;
overflow: hidden;
height: 1px;
margin-top: -1px;
position: absolute;
}
*/	

function divStatus(div,numId) {
  var divId=div+numId;
  var i=1;
  if (document.getElementById && document.getElementById(divId)) {  
    while ( document.getElementById(div+i) ) {
	  if (numId != i) {
	     document.getElementById(div+i).className = 'divHidden';	 		
	  }
	  i++;
	}  
    divCur = document.getElementById(divId);
    isGood = true;   
  } 
  else if (document.all && document.all[divId]) {
    while ( document.all(div+i) ) {
	  if (numId != i) {
	     document.all(div+i).className = 'divHidden';	 		
	  }
	  i++;
	}
    divCur = document.all(divId);
    isGood = true;   
  }
  else if (document.layers && document.layers[divId]) {
    while ( document.layers(div+i) ) {
	  if (numId != i) {
	     document.layers(div+i).className = 'divHidden';	 		
	  }
	  i++;
	}
    divCur = document.layer(divId);
    isGood = true;   
  } 
  else {
    isGood = false;
  }
  if (isGood) {
    divCur.className = (divCur.className == 'divHidden')?'divVisible':'divHidden';	
  }  
} 

function displayAllNews(divId) {
  var i=1;
  if (document.getElementById && document.getElementById(divId)) {  
    divCur = document.getElementById(divId);
    isGood = true;   
  } 
  else if (document.all && document.all[divId]) {
    divCur = document.all(divId);
    isGood = true;   
  }
  else if (document.layers && document.layers[divId]) {
    divCur = document.layer(divId);
    isGood = true;   
  } 
  else {
    isGood = false;
  }
  if (isGood) {
    divCur.className = (divCur.className == 'divHidden')?'':'divHidden';	
  }  
} 

//-------------------------------------------------------------
// Pr&eacute;visualisation DHTML - galerie.php 
//-------------------------------------------------------------
// http://www.aliasdmc.fr/dom_javascript/javascript_node_childnodes.html
// http://www.alistapart.com/articles/imagegallery/
// http://css.alsacreations.com/Tutoriels-JavaScript/galerie-photo-javascript
// Attributs de childNodes: nodeName,length,nodeType,nodeValue...

function showPic(pic,id,w_img,h_img) {
if (document.getElementById) {
 document.getElementById('placeholder').src = pic.href;
 if (pic.title) {
   document.getElementById('preview').getElementsByTagName('dd')[0].innerHTML= "<i>"+pic.childNodes[0].childNodes[0].nodeValue+"</i>";
   //document.getElementById('preview').getElementsByTagName('dd')[1].innerHTML= pic.childNodes[1].childNodes[0].nodeValue;
   //document.getElementById('preview').getElementsByTagName('dd')[1].innerHTML+= "<b>"+pic.childNodes[1].childNodes[1].childNodes[0].nodeValue+"</b>";
   //document.getElementById('preview').getElementsByTagName('dd')[1].innerHTML+= pic.childNodes[1].childNodes[2].nodeValue;
   //document.getElementById('preview').getElementsByTagName('dd')[2].innerHTML= pic.title; 
   document.getElementById('preview').getElementsByTagName('dd')[1].innerHTML= pic.title; 
   
   //document.getElementById('placeholder').width= '370';
   document.getElementById('placeholder').title= ':..Cliquez pour agrandir..:';
      
   document.getElementById('preview').getElementsByTagName('a')[0].onclick = function() { 
     openPopup('image.php?id='+id,id,w_img,h_img,'no','no','center');
   }
 } else {
     document.getElementById('preview').getElementsByTagName('dd')[0].innerHTML= pic.childNodes[0].nodeValue;
	 //...
 }
 return false;
} else {
 return true;
}
}


//-------------------------------------------------------------
// Textarea avec compteur + limitation de caracteres
//-------------------------------------------------------------
var ns6=document.getElementById&&!document.all

function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ 
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}
function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}
function displaylimit(thename, theid, thelimit){
var theform=theid!=""? document.getElementById(theid) : thename
var limit_text='(<span id="'+theform.toString()+'">'+thelimit+'</span>)'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
}
}