/*
	Charger une feuille CSS
*/
function loadStyleSheet(file) {
	// Create script DOM(Document Object Model) element
	var script = document.createElement('link');
	script.rel = 'stylesheet';
	script.type = 'text/css';
	script.href = file;

	// Alert when the script is loaded
	if (typeof(script.onreadystatechange) == 'undefined') // W3C	
		script.onload = function(){ this.onload = null;  };
	else // IE
		script.onreadystatechange = function(){ if (this.readyState != 'loaded' && this.readyState != 'complete') return; this.onreadystatechange = null;  }; // Unset onreadystatechange, leaks mem in IE

	// Add script DOM(Document Object Model) element to document tree
	document.getElementsByTagName('head')[0].appendChild(script);
}

/******************************
	Afficher en popup une URL
*******************************/
function showPopup(url, height, width){
	var winStealth = window.open(url,'stealth','height='+height+',width='+width+',scrollbars=yes,toolbars=no,location=no,resizable=yes');
	if (winStealth != null) {
		winStealth.blur();
	}
	window.focus();
}

/******************************
	Cookies
*******************************/
function writeCookie(name, value, hours) {
	var expire = "";
	if(hours != null) {
		expire = new Date((new Date()).getTime() + hours * 3600000);
		expire = "; expires=" + expire.toGMTString();
	}
	document.cookie = name + "=" + escape(value) + expire;
}

