/* Liste de fonctions javascript */
var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0;
function doubleOnly(input){
	tmp = '';
	value = input.value;
	for(i=0; i < value.length; i++){
		if(value == ',' || value == '.') tmp='';
		else if(value.charAt(i) == ',' && value.indexOf('.') == -1) tmp+='.';
		else if(!isNaN(value.charAt(i)) && value.charAt(i) != ' ' || value.charAt(i) == '.' && value.substr(0, i).indexOf('.') == -1 || i == 0 && value.charAt(i) == '-') tmp+=value.charAt(i);
	}
	input.value = tmp;
}
function intOnly(input){
	tmp = '';
	value = input.value;
	for(i=0; i < value.length; i++){
		if(!isNaN(value.charAt(i)) && value.charAt(i) != ' ') tmp+=value.charAt(i);
	}
	input.value = tmp;
}
function DHTML_init() {
	if (window.opera) { 			OP = 1;	}
	if(document.getElementById) { 	DHTML = 1;	DOM = 1; }
	if(document.all && !OP) { 		DHTML = 1;	MS = 1; }
	if(document.layers && !OP) { 	DHTML = 1; 	NS = 1; }
}

function popupWin(pop, ySize, xSize){
	// affiche un popup
	/*	Liste des variables :
	 *	pop			: chaine			: URL de la page  afficher
	 *	ySize		: entier			: hauteur de la popup
	 *	xSize		: entier			: largeur de la popup
	 */

	var gauche = (screen.width - xSize)/2
	var haut =  (screen.height - ySize)/2
	var fenetre = window.open(pop,"","HEIGHT="+ySize+",WIDTH="+xSize+", left="+gauche+", top="+haut+",scrollbars=yes, status=no, toolbar=no, menubar=no, resizable=yes, title=Fichier, dependent=yes");
}
function getElem(p1,p2,p3) {
	var Elem;
	DHTML_init();
	if(DOM) {
		if(p1.toLowerCase()=="id") {
			if (typeof document.getElementById(p2) == "object")
				Elem = document.getElementById(p2);
			else Elem = void(0);
			return(Elem);
		} else if(p1.toLowerCase()=="name") {
			if (typeof document.getElementsByName(p2) == "object")
				Elem = document.getElementsByName(p2)[p3];
			else Elem = void(0);
			return(Elem);
		} else if(p1.toLowerCase()=="tagname") {
			if (typeof document.getElementsByTagName(p2) == "object" ||	(OP && typeof document.getElementsByTagName(p2) == "function"))
				Elem = document.getElementsByTagName(p2)[p3];
			else Elem = void(0);
			return(Elem);
		} else return void(0);
	}
	else if(MS) {
		if(p1.toLowerCase()=="id") {
			if (typeof document.all[p2] == "object")
				Elem = document.all[p2];
			else Elem = void(0);
			return(Elem);
		} else if(p1.toLowerCase()=="tagname") {
			if (typeof document.all.tags(p2) == "object")
				Elem = document.all.tags(p2)[p3];
			else Elem = void(0);
			return(Elem);
		} else if(p1.toLowerCase()=="name") {
			if (typeof document[p2] == "object")
				Elem = document[p2];
			else Elem = void(0);
			return(Elem);
		} else return void(0);
	}
	else if(NS) {
		if(p1.toLowerCase()=="id" || p1.toLowerCase()=="name") {
			if (typeof document[p2] == "object")
				Elem = document[p2];
			else Elem = void(0);
			return(Elem);
		} else if(p1.toLowerCase()=="index") {
			if (typeof document.layers[p2] == "object")
				Elem = document.layers[p2];
			else Elem = void(0);
			return(Elem);
		} else return void(0);
	}
}