// JavaScript Document version 1.05
function centerPopUp (file,w,h,scrollbar,name){
var cx = Math.round ((screen.availWidth / 2) - (w / 2));
var cy = Math.round ((screen.availHeight / 2) - (h / 2));
scrollbar=(scrollbar == "undefined")?'yes':scrollbar;
name=(name == "undefined")?'popUp':name;
window.open(file, name, 'height='+ h +', width='+ w +', top='+ cy +', left='+ cx +', toolbar=no, menubar=no, location=no, toolbar = no,resizable=yes, scrollbars='+scrollbar+', status=no');
}
function openPop (file,w,h,scrollbar,name){
scrollbar=(scrollbar == "undefined")?'yes':scrollbar;
name=(name == "undefined")?'popUp':name;
window.open(file, name, 'height='+ h +', width='+ w +', top=0, left=0, toolbar=no, menubar=no location=no, toolbar = no,resizable=yes, scrollbars='+scrollbar+', status=no');
}
////////////////////////////// messages d'alertes simple
function simpleAlert(msg){
	var al = new Alert_window();
	//al.setCloseButton("X","Fermer");
	al.create(msg);
}

function pop_redim(nx,ny) {
	xall = (screen.availWidth / 2);
	yall = (screen.availHeight / 2);
	if(nx<screen.availWidth & ny<screen.availHeight){
		window.resizeTo(nx,ny);
		self.moveTo(xall - (nx / 2), yall - (ny / 2));
	}
	else{
		if(nx<screen.availWidth & ny>screen.availHeight) {
			window.resizeTo(nx,screen.availHeight);
			self.moveTo(xall - (nx / 2), 0);	
		}
		if(nx>screen.availWidth & ny<screen.availHeight) {
			window.resizeTo(screen.availWidth,ny);
			self.moveTo(0, yall - (ny / 2));	
		}
		if(nx>screen.availWidth & ny>screen.availHeight) {
			window.resizeTo(screen.availWidth,screen.availHeight);
			self.moveTo(0, 0);	
		}
		//alert('nx:'+nx+' ny:'+ny+' l-ec:'+screen.availWidth+' h-ec:'+screen.availHeight);
	}
	
	self.focus();
}


function ouvre_ferme_inline(id) {
	var d = document.getElementById(id);
	if(d){
		if (d.style.display=='inline') d.style.display='none'; 			
		else d.style.display='inline';
	}
}

function ouvre_ferme_block(id) {
	var d = document.getElementById(id);
	if(d){
		if (d.style.display=='block') d.style.display='none'; 			
		else d.style.display='block';
	}	
}

function ouvre_ferme_visibility(id) {
	var d = document.getElementById(id);
	
	if(d){
		if (d.style.visibility=='visible') d.style.visibility='hidden'; 			
		else d.style.visibility='visible';
	}
}

function setStyle(identifiant, style, value){
var id=identifiant;
var styl=style;
var val=value;
if (document.all) { /// si IE
	document.getElementById(id).style.setAttribute(styl,val,"false");
}
else document.getElementById(id).setAttribute("style",style+":"+value+";");
}

function addslashes(texte) {
texte = texte.replace(/\\("|'|\\)/g, "$1");
}

function stripslashes(texte){
texte = texte.replace(/("|'|\\)/g, "\\$1");
}

function Tableau(n) { 
	this.length=n; 
	return this;
} 
function DateMAJ() { 
	NomMois=new Tableau(12) 
	NomMois[1]="01" 
	NomMois[2]="02" 
	NomMois[3]="03" 
	NomMois[4]="04" 
	NomMois[5]="05" 
	NomMois[6]="06" 
	NomMois[7]="07" 
	NomMois[8]="08"
	NomMois[9]="09" 
	NomMois[10]="10" 
	NomMois[11]="11" 
	NomMois[12]="12"
	Date=new Date(document.lastModified) 
	var Mois=NomMois[Date.getMonth()+1] 
	var Annee=Date.getYear()
	return Date.getDate()+"/"+Mois+"/"+Annee 
}
