// EVENTS
function addOnload(fn) {
	var nowOnload = window.onload;
	window.onload = function() {
		fn();
		if(nowOnload !== null && typeof(nowOnload) == 'function') {nowOnload();}
	};
}

function addOnresize(fn) {
	var nowOnresize = window.onresize;
	window.onresize = function() {
		fn();
		if(nowOnresize !== null && typeof(nowOnresize) == 'function') {nowOnresize();}
	};
}

function chkAltura(){
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var sizebg = document.getElementById('bg-global-fix').offsetHeight;
	//alert("sizebg = "+sizebg+", yScroll ="+yScroll);
	if(sizebg < yScroll)
	document.getElementById('bg-global-fix').style.height=yScroll+"px";

}

addOnresize(chkAltura);
addOnload(chkAltura);