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;
}

function setFooter() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('conteneur').offsetHeight;
			var footerElement = document.getElementById('footer');
			var footerHeight  = footerElement.offsetHeight;
			if (windowHeight - (contentHeight + footerHeight) >= 0) {
				document.getElementById('conteneur').style.height = contentHeight + (windowHeight - (contentHeight + footerHeight)) + 'px';
				footerElement.style.position = 'relative';
				/*footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';*/
			}
			else {
				footerElement.style.position = 'static';
			}
		}
	}
}

function setPagepleine(x) 
{
	if (document.getElementById) 
	{
		var windowHeight = getWindowHeight();
		if (windowHeight > 0) 
		{
			var contentHeight = document.getElementById(x).offsetHeight;
			//alert(windowHeight+' X '+contentHeight+' X '+taille_div);
			if (windowHeight - contentHeight >= 0) 
			{
				document.getElementById(x).style.height = windowHeight + 'px';
				
				//alert(document.getElementById(x).style.height);
				//document.getElementById(x).style.height = '2000px';
				/*footerElement.style.top = (windowHeight - (contentHeight + footerHeight)) + 'px';*/
			}
		}
	}
}

/*
window.onload = function() {
	setPagepleine();
}

window.onresize = function() {
	setPagepleine();
}
*/


var bas_de_page=400;      // Position en bas de fenetre
var Hauteur=20;         //Hauteur du div   
var pos_x=4;            //Position du div (horizontal)
//var pos_y=bas_de_page;    //Position du div (vertical)
var pos_y=10;
var MonObjet;

function GetObject(ID) {
   if (document.getElementById) {
      return document.getElementById(ID);
   }
   if (document.layers) {
      return eval('document.'+ID);
   }
   if (document.all) {
      return eval('document.all.'+ID);
   }
}

function MoveTo(MyObject, x, y) {   // Déplacement du DIV
   if (document.getElementById||document.all) {
      //MyObject.style.left = x + "px";
      MyObject.style.top = y + "px";
      return;
   }
   if (document.layers) MyObject.moveTo(x, y);
}

function InitObjet(ID) {            //Initialisation du DIV
   MonObjet = GetObject(ID);
   MoveTo(MonObjet, pos_x, bas_de_page);
   scroll();
}

function scroll() {                  // Défilement du DIV
   if (pos_y > (-1 * Hauteur)) {      //Teste si le DIV est complètement sorti
      pos_y--;
      MoveTo(MonObjet, pos_x, pos_y)
   }
   else {
      pos_y=bas_de_page;
      MoveTo(MonObjet, pos_x, pos_y)
   }
   var timer = setTimeout('scroll();',60);
}
