$(document).ready(
	function(){
		
		// Mettre en forme le menu du site
		setMenuNodes();
		
		// Fixer les png (Internet Explorer < v.7)
		if( $.browser.msie && $.browser.version < 7 ) {
			$(document).pngFix();
		}
		
		if( window.rubriqueConstruct ){ rubriqueConstruct(); }
		if( window.syslogConstruct ){ syslogConstruct(); }
		
	}
);

/* Affiche/Masque une liste d'objets */
function showobj(numliste){
	// cas ns6
	if (document.getElementById)
	{
		if( $("#nodeobj"+numliste).css("display")=='none' )
		{
			$("#nodeobj"+numliste).css("display","");
		}
		else
		{
			$("#nodeobj"+numliste).css("display","none");
		}
	}
	// cas ie 5.5
	else if (document.all)
	{
		if (document.all["nodeobj"+numliste].style.display=='none')
		{
			document.all["nodeobj"+numliste].style.display='';
		}
		else
		{
			document.all["nodeobj"+numliste].style.display='none';
		}
	}
}

/* fonctions de popup de fenêtre */
function openCenteredPopup(url,nom,w,h){
	var wLeft = (window.screen.width - w)/2;
	var wTop = (window.screen.height - h)/2;
	
	var wConfig = "'toolbar=no, menubar=no, location=no, directories=no, status=no, resizeable=no, width=" + w + ", height=" + h + ", left=" + wLeft + ", top=" + wTop;
	var wWindow = window.open(url, nom, wConfig);
	wWindow.focus();
}

/* Valider un formulaire */
function postForm(id_form){	$("#"+id_form).submit(); }

function addslashes(str){
    return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\u0000/g, "\\0");
}

/**
 * Concatenates the values of a variable into an easily readable string
 * by Matt Hackett [scriptnode.com]
 * @param {Object} x The variable to debug
 * @param {Number} max The maximum number of recursions allowed (keep low, around 5 for HTML elements to prevent errors) [default: 10]
 * @param {String} sep The separator to use between [default: a single space ' ']
 * @param {Number} l The current level deep (amount of recursion). Do not use this parameter: it's for the function's own use
 */
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;

};
var_dump = print_r;
