//===========================================
// checkBrowser Object
function checkBrowser() {
	var b = navigator.appName
	if (b == "Netscape") this.b = "ns"
	else if (b == "Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.ver = navigator.appVersion
	this.v	 = parseInt(this.ver);
	this.dom = ( document.getElementById )
	this.ie  = ( this.b == "ie" && this.v >=4 )
	this.ie5 = ( this.ver.indexOf("MSIE 5") >-1 && this.dom )
	this.ie4 = ( document.all && !this.dom )
	this.ns  = ( this.b == "ns" && this.v >=4 )
	this.ns5 = ( this.dom && this.v >= 5 )
	this.ns4 = ( document.layers && !this.dom )
}

is = new checkBrowser();

//===========================================
// Preload images

function MM_preloadImages() { //v3.0
  var d=document;
	if (d.images) {
		if (!d.MM_p) d.MM_p = new Array();
		var i, j=d.MM_p.length, a = MM_preloadImages.arguments;
		for(i=0; i<a.length; i++) {
				d.MM_p[j] = new Image;
				d.MM_p[j++].src = a[i];
		}
	}
}

//===========================================
// Find objets 

function MM_findObj(name, d) { //v3.0
  var i,x;
	if (!d) d = document;
	if (!(x=d[name])&& d.all) x = d.all[name];
	for (i=0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(name,d.layers[i].document);
	return x;
}

//===========================================
// Reference d'un calque Multi-plateforme

function DumpCalque( o ) {
	var msg = "\n----------------------------";
	msg += "\n" + o.name + "\n----------------------------";
	msg += "\nx = " + o.x + "\ny = " + o.y + "\nw = " + o.w + "\nh = " + o.h
	msg += "\nscrollHeight = " + o.scrollHeight + "\nclipHeight =" + o.clipHeight
	return msg;
}

function MakeRefObj( name , nest ) {

    nest = ( ! nest ) ? '' : 'document.' + nest + '.'
	this.name = name;

   	this.el  = (is.dom) ? document.getElementById(name) : (is.ie4) ? document.all[name] : (is.ns4) ? eval(nest+'document.'+name) : 0;
 	this.css = (is.dom) ? document.getElementById(name).style : (is.ie4 ) ? document.all[name].style : (is.ns4) ? eval(nest + 'document.' + name) : 0;

	this.x = parseInt(this.css.left);
	this.y = parseInt(this.css.top);
	this.w = parseInt((is.ie) ? this.css.pixelWidth  : this.css.clip.right);
	this.h = parseInt((is.ie) ? this.css.pixelHeight : this.css.clip.bottom);

	this.scrollHeight = (is.ns4) ? this.css.document.height : this.el.offsetHeight
	this.clipHeight   = (is.ns4) ? this.css.clip.height : this.el.offsetHeight
}

{
var c=MakeRefObj.prototype
	c.isIn   = IsInCalque
	c.SetVisible = SetVisible
}

function IsInCalque(  x , y ) {
	if ( x >= this.x &&
		 x <= (this.x + this.w) &&
		 y >= this.y &&
		 y <= (this.y + this.h) ) return true;
	else return false;
}

function SetVisible( visible ) {
	if (visible) this.css.visibility = (is.ns4) ? "show" : "visible";
	else this.css.visibility = (is.ns4) ? "hide" : "hidden"
}

//=======================================
// Rollover

TheImgRestore = new Image;
LoadRollover  = false;

function RollOn( name , img ) {
  var x;
	if ( LoadRollover && ( x=MM_findObj( name )) != null) {
		TheImgRestore = x;
		if (!x.oSrc) x.oSrc = x.src;
		x.src = img;
	}
}

function RollOff( name ) {
  var x;
	if (LoadRollover) {  
		x = TheImgRestore;
		x.src = x.oSrc;
	}
}

//===========================================
// Gestion des evenements souris

var EventAll	= 0;
var EventMove	= 1;
var EventDown	= 2;
var EventUp		= 4;
var EventTrt	= 0;


