// ----------------- BROWSER CHECK -----------------

var version = parseInt(navigator.appVersion);
var isNS4, isIE4, isIE5, isMAC, v=0

ns6 = document.getElementById?1:0
ie = document.all?1:0
n = document.layers?1:0

if (n) {
	isNS4 = true;
	doc = "document."; 
	sty = "";
	zon = "show";
	speed = 10;
	ligne = 1;
}

if (ns6) {
	isNS6 = true;
	doc = "document."; 
	sty = "";
	zon = "show";
	speed = 10;
	ligne = 8;
}

if (ie) {
	ns6=0;
	isIE4 = true;
	isNS6 = false;
	doc = "document.all.";
	sty = ".style";
	zon = "visible";
	speed = 30;
	ligne = 2;
}



if (navigator.appVersion.indexOf("MSIE 5") != -1) isIE5=true;
if (navigator.userAgent.indexOf('Mac') != -1) isMAC = true
if (isIE4 && !isMAC) v = 19
if (isIE4 && isMAC && !isIE5) v = -30

// ROLLOVER

function Roll(ImgSrc,ImgName) {
 Chemin= "images/";
 if (document.images) document.images[ImgSrc].src = Chemin + ImgName;
}

// --------------- GENERATION STYLE --------------
function MakeStyle(st_name,m_left,m_top,st_other) {
		if (ie) {
			//haut = (document.body.offsetHeight/2)-(doc_height/2)-4 + m_top;
			gauche = (document.body.offsetWidth/2)-(doc_width/2)-9 + m_left;
		} else if (n) {
			//haut = ((window.innerHeight/2))-(doc_height/2)-12 + m_top;
			gauche = ((window.innerWidth/2))-(doc_width/2)-9 + m_left;
		} else {
			haut = ((window.innerHeight/2))-(doc_height/2)-4 + m_top;
			gauche = ((window.innerWidth/2))-(doc_width/2) + m_left;
		}
		/*if(haut <= m_top) {
			haut = m_top;
		}*/
		if(gauche <= m_left) {
			gauche=m_left;
		}
		gauche=m_left;
		haut = m_top;
	document.write("<style>#" + st_name + "{position:absolute; left:" + gauche + "px; top:" + haut + "px;" + st_other + "}</style>");
	eval(st_name + "_top=" + m_top);
	eval(st_name + "_left=" + m_left);
}

function resize_place(st_name) {
	if ((ie) || (ns6)) {
		m_top = eval(st_name + "_top");
		m_left = eval(st_name + "_left");
		if (ie) {
			//haut = ((document.body.offsetHeight/2))-((doc_height/2))-4 + m_top;
			gauche = ((document.body.offsetWidth/2))-((doc_width/2))-9 + m_left;
		} else {
			haut = ((window.innerHeight/2))-(doc_height/2)-4 + m_top;
			gauche = ((window.innerWidth/2))-(doc_width/2) + m_left;
		}
		/*if(haut<=m_top) {
			haut=m_top;
		}*/
		haut = m_top;
		gauche=m_left;
		if(gauche<=m_left) {
			gauche=m_left;
		}
		if (ie) {
			eval("document.all." + st_name + ".style.left = gauche");
			eval("document.all." + st_name + ".style.top = haut");
		} else {
			eval("document.getElementById('" + st_name + "').style.left = gauche");
			eval("document.getElementById('" + st_name + "').style.top = haut");
		}
	} else {
		window.document.location.reload();
	}
}

function init() {
	initialisation();
	onresize = call_resize;
}


// --------------------- ASCENCEUR ---------------------
var downok, upok

function xroll(nom,y,h) {
	this.nom = nom;
	if (isIE4) {
		this.calque = eval('document.all.'+nom+'2.style');
		this.hauteur = eval('document.all.'+nom+'2.scrollHeight');
	} else if (isNS4) {
		this.calque = eval('document.'+nom+'.document.'+nom+'2');
		this.hauteur = eval('document.'+nom+'.document.'+nom+'2.document.height');
	} else {
		this.hauteur = eval('document.getElementById("'+nom+'2").offsetHeight');
		this.calque = eval('document.getElementById("'+nom+'2").style');
	}

	this.calque.height = this.hauteur
	this.limite = h - this.hauteur
	this.y = y;
	this.up = f_up;
	this.mtop = movetop;
	this.down = f_down;
	this.obj = 'X'+nom;
}

function f_up() {
	if (this.y <= this.limite) { upok = 0; }
	if (upok) {
		this.y -= ligne;
		this.calque.top = this.y;
	 	setTimeout(this.obj+'.up()',speed)
	 }
}

function f_down() {
	if (this.y >= 0) downok = 0;
	if (downok) {
		this.y += ligne;
		this.calque.top = this.y;
		setTimeout(this.obj+'.down()',speed)
	}
}

function movetop() {
	this.y = 0;
	this.calque.top = this.y;
//	this.calque.top = "0px";
}


