// *****************************************************************************
// ECEDI - Webuilder
//
// File: GENERALfunctions.js
// Rôle: Fonctions générales javascript
// Creation: Mars 2004
// *****************************************************************************


// *****************************************************************************
// cm_bwcheck() : Browsercheck object [ ALL VERSIONS ]
// *****************************************************************************
function cm_bwcheck(){
   this.ver=navigator.appVersion
   this.agent=navigator.userAgent.toLowerCase()
   this.dom=document.getElementById?1:0
   this.op5=(this.agent.indexOf("opera 5")>-1 || this.agent.indexOf("opera/5")>-1) && window.opera
   this.op6=(this.agent.indexOf("opera 6")>-1 || this.agent.indexOf("opera/6")>-1) && window.opera
   this.ie5 = (this.agent.indexOf("msie 5")>-1 && !this.op5 && !this.op6)
   this.ie55 = (this.ie5 && this.agent.indexOf("msie 5.5")>-1)
   this.ie6 = (this.agent.indexOf("msie 6")>-1 && !this.op5 && !this.op6)
   this.ie4=(this.agent.indexOf("msie")>-1 && document.all &&!this.op5 &&!this.op6 &&!this.ie5&&!this.ie6)
   this.ie = (this.ie4 || this.ie5 || this.ie6)
   this.mac=(this.agent.indexOf("mac")>-1)
   this.ns6=(this.agent.indexOf("gecko")>-1 || window.sidebar)
   this.ns4=(!this.dom && document.layers)?1:0;
   this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6)
   this.usedom= this.ns6//Use dom creation
   this.reuse = this.ie||this.usedom //Reuse layers
   this.px=this.dom&&!this.op5?"px":""
   return this
}
// Déclaration de l'objet dans le code
// var bw=new cm_bwcheck();


// *****************************************************************************
// function_name() [ NS4.7 | IE5 ] : commentaires
// *****************************************************************************


function f_clientWidth() {
	return f_filterResults (
		window.innerWidth ? window.innerWidth : 0,
		document.documentElement ? document.documentElement.clientWidth : 0,
		document.body ? document.body.clientWidth : 0
	);
}
function f_clientHeight() {
	return f_filterResults (
		window.innerHeight ? window.innerHeight : 0,
		document.documentElement ? document.documentElement.clientHeight : 0,
		document.body ? document.body.clientHeight : 0
	);
}
function f_scrollLeft() {
	return f_filterResults (
		window.pageXOffset ? window.pageXOffset : 0,
		document.documentElement ? document.documentElement.scrollLeft : 0,
		document.body ? document.body.scrollLeft : 0
	);
}
function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}
function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
