// fonctions de retour a la ligne
function retour_chariot(id){
	return id.replace(/\n/g,'<br />');
}
function limite(zone,max){
	if(zone.value.length>=max){zone.value=zone.value.substring(0,max);}
	document.getElementById("lbl_"+zone.id).innerHTML = (max-zone.value.length)+" caractères restants";
}

// ouverture d une popup
function MM_openBrWindow(theURL,winName,features) { //v2.0
	NavName = navigator.appName;
	NavVers = navigator.appVersion;
	Navigateur = NavName;
	if(NavName=="Microsof Internet Exploreur") {
	 window.open(theURL,winName,features);
	}else{
		window.open(theURL,winName,features);
	}
}

	

// message de confirmation pour une suppression
function suppri(lien) {
	retour = confirm('Etes vous sur de vouloir effectuer cette suppression');
	if(retour==true) {
		window.location.href = lien;
	}
}

function demande(lien){
	retour = confirm('Etes vous sur de vouloir effectuer cette action');
	if(retour==true) {
		window.location.href = lien;
	}
}

function askPage(lien, texte){
	retour = confirm(texte);
	if(retour==true) {
		window.location.href = lien;
	}
}



// fonction affichant une page en ajax
function load_ajax(id, page, param){
	new Effect.Appear('loading', { to:0.5 }) ;
	if(param=='' || param==undefined) {
		param='';
	}
	new Ajax.Updater(id, page, { 
		onLoading:function(request){ 
			
		}, 
		onComplete:function(request){ 
			new Effect.Fade('loading') ;
			DateAjax();
		}, 
		parameters: param ,
		evalScripts:true, asynchronous:true 
		} );
	if(document.getElementById(id)){
		document.getElementById(id).style.display='';
	}
}


function hideClass(classe){
	var tab = document.getElementsByClassName(classe);
	for(i=0;i<tab.length;i++){
		tab[i].style.display="none";
	}
}
function showClass(classe){
	var tab = document.getElementsByClassName(classe);
	for(i=0;i<tab.length;i++){
		tab[i].style.display="";
	}
}

