function montre(){
	//On ne fais rien, cette fonction ne sert que pour ie6
}

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 getBrowser() {
	agent = navigator.userAgent.toLowerCase();
	if(agent.indexOf('msie') != -1)
		return "ie";
	else if(agent.indexOf('mozilla') != -1)
		return "firefox";
	else if(agent.indexOf('opera') == -1)
		return "opera";
	else if(agent.indexOf('safari') == -1)
		return "safari";
	else
		return "other";
}


var windowHeight = 0;
var pageHeight = 0;
var topHeight = 0;
var menuHeight = 0;
var bodyHeight = 0;
var footerHeight = 0;


function getElementsHeight() {
	windowHeight = getWindowHeight();
	topHeight = document.getElementById('top').offsetHeight;
	bodyHeight = document.getElementById('body').offsetHeight;
	footerHeight = document.getElementById('bottom').offsetHeight;
}


function setAdminFooter() {
	if (document.getElementById) {
		getElementsHeight();
		
		if (windowHeight > 0) {
			var footerElement = document.getElementById('bottom');
			var pageHeight = topHeight+bodyHeight+footerHeight;
			
			if (windowHeight - pageHeight >= 0) {
				footerElement.style.position = 'relative';
				footerElement.style.top = eval(windowHeight - (pageHeight)) + 'px';
				//alert('WindowHeight = ' + windowHeight + '\nPageHeight = ' + pageHeight + '\nTopHeight = ' +  topHeight + '\nMenuHeight = ' + menuHeight +'\nBodyHeight = ' + bodyHeight + '\nFooterHeight = ' + footerHeight);
			}
		}
	}
}

function setFooter() {
	if (document.getElementById) {
		getElementsHeight();
		var pageHeight = document.getElementById('page').offsetHeight;
		var menuRight = document.getElementById('nav-right-bgrnd');
		
		if (windowHeight > 0 && (pageHeight > windowHeight)) {
			var height = pageHeight - (topHeight+footerHeight+10);
			
			// Hauteur minium...
			if(height < 455)
				height = 455;
			menuRight.style.height = height + 'px';
		}
		else
		{
			//Bidouille offset firefox/IE
			browser = getBrowser();
			 if(browser != "ie") {
				var offset = 1;
				var height = windowHeight - (topHeight+footerHeight+offset);
			}else {
				var offset = 4;
				var height = windowHeight - (topHeight+footerHeight+offset);
			}
			
			menuRight.style.height = height + 'px';
		}
	}
}


function customersLogin() {
	document.frmcustomers.submit();
}


function getInputFocus(input) {
	input.style.borderColor='#B37F80';
}

function lostInputFocus(input) {
	input.style.borderColor='#999';
}


function getXhrObject() {
	var xhr_object = null; 
	     
    if(window.XMLHttpRequest) {
		// Firefox 
		xhr_object = new XMLHttpRequest(); 
    }
    else if(window.ActiveXObject) 
	{
		// Internet Explorer 
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
    }
    else 
	{
		// XMLHttpRequest non support? par le navigateur 
		return null; 
    }
	
	return xhr_object;
}



function showTooltip(id, top, left) {
	var div = document.getElementById(id);
	if(div) {
		div.style.top = top + 'px';
		div.style.left = left + 'px';
	}
	div.style.display = 'block';
}


function hideTooltip(id) {
	var div = document.getElementById(id);
	div.style.display = 'none';
}