window.onload = window.onresize = function() {
	setFooter('containerFooter','containerMain',0);
}
// [FUNCTIONS]
function setFooter(footerId,contentId,spacing) {
	var ie = navigator.userAgent.toLowerCase().indexOf('msie');
	if (document.getElementById) { // && ie == -1) {
		var windowHeight = getWindowHeight();
		if (windowHeight>0) {
			var _tmpObjC = document.getElementById(contentId);
			var _tmpObjF = document.getElementById(footerId);
			if(_tmpObjF && _tmpObjC){
				var contentHeight = _tmpObjC.offsetHeight;
				var footerHeight = _tmpObjF.offsetHeight;
				var total = eval(contentHeight+footerHeight+spacing);
				// _tmpObjF has to be position: absolute for this stuff to work
				if ( windowHeight > total ) {
					_tmpObjF.style.top = '';   //work IE and FF
					_tmpObjF.style.bottom = '0px';   //work IE and FF
				} else {
					_tmpObjF.style.top = contentHeight+'px';
				}
			}
		}
	}
}

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;
}