//------------------------------------------------------------------------------------------
// Programmeur 		: (c) creavoc - Daniel Lavoie
// Annee		: 2007
// Fichier 		: utils_screen.js
// But 			: librairie des functions retounant des valeurs de l'ecran du visiteur
// Modification		: -
//------------------------------------------------------------------------------------------

function utils_screen_largeur_document() {
    var windowWidth=0;
    if (typeof(window.innerWidth)=='number') {
        windowWidth=window.innerWidth;
    }
    else {
     if (document.documentElement&&
       document.documentElement.clientWidth) {
         windowWidth = document.documentElement.clientWidth;
    }
    else {
     if (document.body&&document.body.clientWidth) {
         windowWidth=document.body.clientWidth;
      }
     }
    }
    return windowWidth;
}

function utils_screen_hauteur_document() {
    var windowHeight=0;
	var hauteur_fenetre = (window.innerHeight); //donne la hauteur de la fenêtre
    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 utils_screen_hauteur_page() {
	//return document.body.clientHeight;
	var x,y;
    var test1 = document.body.scrollHeight;
	var hauteur_fenetre = (window.screen.availHeight/100)*77; //donne la hauteur de la fenêtre
	    var test2 = document.body.offsetHeight;

    if (test1 > test2) // all but Explorer Mac
    {
        x = document.body.scrollWidth;
        y = document.body.scrollHeight;
    }
    else // Explorer Mac;
         //would also work in Explorer 6 Strict, Mozilla and Safari
    {
        x = document.body.offsetWidth;
        y = document.body.offsetHeight;
    }
	if (hauteur_fenetre > y){
		y = hauteur_fenetre;
	}
    return y;
	
}

function utils_screen_position_scroll_vertial() {
    var pageY;
    if(typeof(window.pageYOffset)=='number') {
       pageY=window.pageYOffset;
    }
    else {
       pageY=document.documentElement.scrollTop;
	}
	D=document;
    db=!D.documentElement.clientWidth?D.body:D.documentElement  //quirk IE6
    gk=window.Event?1:0/*Gecko*/;
	sy=gk?pageY:db.scrollTop;                             //scroll v
	return sy;
}



