// Le navigateur reconna?t-il le DOM ?
var W3CDOM = document.getElementById && document.getElementsByTagName;

// ajout de trim
String.prototype.trim = function() {
    return this.replace(/(?:^\s+|\s+$)/g, "");
}

// fonction addEvent (http://www.scottandrew.com/weblog/jsjunk)
function addEvent(oElem, sEvType, fn, bCapture)
{
   return oElem.addEventListener?
      oElem.addEventListener(sEvType, fn, bCapture):
      oElem.attachEvent?
         oElem.attachEvent('on' + sEvType, fn):
         oElem['on' + sEvType] = fn;
}

// fonction écrire cookie
function EcrireCookie(nom,valeur) {
	var expDate = new Date();
	expDate.setTime(expDate.getTime() + (365 * 24 * 3600 * 1000)); // ici 1 an
	document.cookie = nom + "=" + escape(valeur) + ";expires=" + expDate.toGMTString() + ";path=/";
}


// fonction lire cookie
function LireCookie(sNom) {
	var listeCookies = new Array();
	listeCookies = document.cookie.split(";");
	for(iI = 0; iI < listeCookies.length; iI++) {
		nomCookie = (listeCookies[iI].split('=')[0]).trim();
		if (nomCookie == sNom) {
			return decodeURIComponent(listeCookies[iI].split('=')[1]);
		}
	}
	return ""
}

// fonction getWindowHeight ( http://pompage.net/pompe/pieds/ )
function getWindowHeight() {
	var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
	} else {
		if (document.documentElement&& document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		} else {
			if (document.body&&document.body.clientHeight) {
				windowHeight=document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}
