var winModalWindow;
var affiche = false;
var justeFermee = false;
var jour;
var mois;
var annee;

var champcourant;


function getObjet(x) {
	if (typeof x != 'string') {
		return x;
	}
	else if (Boolean(document.getElementById)) {
		return document.getElementById(x);
	}
	else if (Boolean(document.all)) {
		return eval('document.all.'+x);
	}
	else {
		return null;
	}
}

function refresh() {
	if (document.forms['refresh']) {
		document.forms['refresh'].submit();
	}	
}

function getX(largeur) {
	width = screen.availWidth;
	return (width - largeur)/2;
}

function getY(hauteur) {
	height = screen.availHeight;
	return (height - hauteur)/2;
}
 
function ignoreEvents(e) {
	return false;
}
 
function showWindow(url, titre, w, h) {
	if (window.showModalDialog) {
		// Internet Explorer
		winModalWindow = window.open(url,titre,'dependent=yes,left=' + getX(w) + ',top=' + getY(h) + ',width=' + w + ',height=' + h + ',status=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes');
	}	
	else {
		// Netscape
		winModalWindow = window.open(url,titre,'dependent=yes,screenX=' + getX(w) + ',screenY=' + getY(h) + ',width=' + w + ',height=' + h + ',status=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes');
	}	
	affiche = true;
}

function showImageWindow(url, titre, w, h) {
	if (window.showModalDialog) {
		// Internet Explorer
		winModalWindow = window.open(url,titre,'dependent=yes,left=' + getX(w) + ',top=' + getY(h) + ',width=' + w + ',height=' + h + ',status=no,menubar=no,toolbar=no,scrollbars=no,resizable=no');
	}	
	else {
		// Netscape
		winModalWindow = window.open(url,titre,'dependent=yes,screenX=' + getX(w) + ',screenY=' + getY(h) + ',width=' + w + ',height=' + h + ',status=no,menubar=no,toolbar=no,scrollbars=no,resizable=no');
	}	
	affiche = true;
}

function showImageWindowAscenseur(url, titre, w, h) {
	if (window.showModalDialog) {
		// Internet Explorer
		winModalWindow = window.open(url,titre,'dependent=yes,left=' + getX(w) + ',top=' + getY(h) + ',width=' + w + ',height=' + h + ',status=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes');
	}	
	else {
		// Netscape
		winModalWindow = window.open(url,titre,'dependent=yes,screenX=' + getX(w) + ',screenY=' + getY(h) + ',width=' + w + ',height=' + h + ',status=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes');
	}	
	affiche = true;
}

function activation() {
	if (affiche) {
		winModalWindow.focus();
	}
	else if (justeFermee) {
		refresh();
	}
}


function _trim(str) {
	str = str.replace(/^\s*|\s*$/g, "");
	return str ;
}

function contientEmail(champ) {
	if (window.RegExp) {
		e = new RegExp(/^.+@.+..+$/);
		return e.test(champ.value);
	}
	else {
		return true;
	}
}


