// (c) 2007 MULLER Rémy

function SHL(nomdiv, etat) { 
    with (document) if (getElementById && ((obj=getElementById(nomdiv))!=null)) { v=etat;
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; 
	}
}

function formatchiffre(x) {
if (x==0) {return x;} else {
var str = x.toString(), n = str.length;

if (n <4) {return x;} else {

    return ((n % 3) ? str.substr(0, n % 3) + ' ' : '') + str.substr(n % 3).match(new RegExp('[0-9]{3}', 'g')).join(' ');
}}}

function Querystring(qs) { // optionally pass a querystring to parse
	this.params = {};
	
	if (qs == null) qs = location.search.substring(1, location.search.length);
	if (qs.length == 0) return;

// Turn <plus> back to <space>
// See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1
	qs = qs.replace(/\+/g, ' ');
	var args = qs.split('&'); // parse out name/value pairs separated via &
	
// split out each name=value pair
	for (var i = 0; i < args.length; i++) {
		var pair = args[i].split('=');
		var name = decodeURIComponent(pair[0]);
		
		var value = (pair.length==2)
			? decodeURIComponent(pair[1])
			: name;
		
		this.params[name] = value;
	}
}

Querystring.prototype.get = function(key, default_) {
	var value = this.params[key];
	return (value != null) ? value : default_;
}

Querystring.prototype.contains = function(key) {
	var value = this.params[key];
	return (value != null);
}



// Init	de DoCyb
var cyblive = null; 
if (window.XMLHttpRequest) {cyblive = new XMLHttpRequest();}

function DoCyb(script, divres, valeur) {
	if (cyblive && cyblive.readyState < 4) { 
			cyblive.abort();
			if (window.XMLHttpRequest) {
				cyblive = new XMLHttpRequest();
			}
	} 
	if (window.ActiveXObject) {cyblive = new ActiveXObject("Microsoft.XMLHTTP");}
	cyblive.onreadystatechange = function() { 
		if (cyblive.readyState == 4) {
			var res = document.getElementById(divres);
			//res.style.display = "block";
			res.innerHTML = cyblive.responseText;
			//alert(cyblive.responseText);
			for (var i=0; i < document.getElementById(divres).getElementsByTagName("script").length; i++)
        {
        eval(document.getElementById(divres).getElementsByTagName("script")[i].innerHTML);
        }
		}
	}
	var timestamp = new Date().getTime(); // Sert ŕ gruger le cache d'IE !!!
	//cyblive.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	cyblive.open("GET", script + "?v=" + valeur + "&serial=" + timestamp, true); 
	cyblive.send(null);
}

	     


 


