
	// ------------------------------------------
	function array_search( needle, haystack ) {
	   
	    var key = '';
	 
	    for(key in haystack){
	        if(  haystack[key] == needle) {
	            return key;
	        }
	    }
	 
	    return false;
	}
	
	/*
	 *  Print_r
	 */
	function print_r(x, max, sep, l) { 
		 
	    l = l || 0; 
	    max = max || 10; 
	    sep = sep || ' '; 
	 
	    if (l > max) { 
	        return "[WARNING: Too much recursion]\n"; 
	    }	 
	    var i, 
	        r = '', 
	        t = typeof x, 
	        tab = ''; 
	 
	    if (x === null) { 
	        r += "(null)\n"; 
	    } else if (t == 'object') { 	 
	        l++; 	 
	        for (i = 0; i < l; i++) { 
	            tab += sep; 
	        } 	 
	        if (x && x.length) { 
	            t = 'array'; 
	        } 	 
	        r += '(' + t + ") :\n";	 
	        for (i in x) { 
	            try { 
	                r += tab + '[' + i + '] : ' + print_r(x[i], max, sep, (l + 1)); 
	            } catch(e) { 
	                return "[ERROR: " + e + "]\n"; 
	            } 
	        } 	 
	    } else {	 
	        if (t == 'string') { 
	            if (x == '') { 
	                x = '(empty)'; 
	            } 
	        } 	 
	        r += '(' + t + ') ' + x + "\n";	 
	    } 	 
	    return r;	 
	};
	 

	 

	function popup(page, attribut){
		win =  window.open(page,'_blank',attribut);
		win.focus();
		
	}
	
	var regExpBeginning = /^\s+/;

	var regExpEnd = /\s+$/;  

	// Supprime les espaces inutiles en début et fin de la chaîne passée en paramètre.

	function trim(aString) {

	    return aString.replace(regExpBeginning, "").replace(regExpEnd, "");
	}

	 

	// Supprime les espaces inutiles en début de la chaîne passée en paramètre.

	function ltrim(aString) {

	    return aString.replace(regExpBeginning, "");
	}

	 

	// Supprime les espaces inutiles en fin de la chaîne passée en paramètre.

	function rtrim(aString) {

	    return aString.replace(regExpEnd, "");
	}
	
	


