

var relative = 0;



function positionFooter() {



	if (relative == 1) {

		document.getElementById('footer').style.cssText = 'position: relative !important; visibility: visible !important';

		return 1;

	}



	menuBottom 		= getBottom('sidebar_left');

	sidebarBottom = getBottom('sidebar_right');

	mainBottom		= Math.max( getBottom('main_2col'), getBottom('main_3col') );



	maxBottom = Math.max ( menuBottom, Math.max( sidebarBottom, mainBottom ) );



	footerElement = document.getElementById('footer');



	bottomPos = (maxBottom+5);



	WW = GetWidth();

	WH = GetHeight();



	screenBottomPos = WH-footerElement.offsetHeight;



	newPos = Math.max( bottomPos, screenBottomPos );



	footerElement.style.cssText = 'left: 0px !important; top: '+newPos+'px !important; width: '+WW+'px !important; visibility: visible !important';

}



function getBottom (divName) {

	d = document.getElementById(divName);

	if(!d) return 0;

	return (d.offsetTop+d.offsetHeight);

}



function GetWidth() {

  var x = 0;

  if (self.innerHeight) {

          x = self.innerWidth;

  }



  else if (document.documentElement && document.documentElement.clientHeight) {

          x = document.documentElement.clientWidth;

  }

  else if (document.body) {

          x = document.body.clientWidth;

  }

  return x;

}



function GetHeight() {

        var y = 0;

        if (self.innerHeight) {

                y = self.innerHeight;

        }

        else if (document.documentElement && document.documentElement.clientHeight) {

                y = document.documentElement.clientHeight;

        }

        else if (document.body) {

                y = document.body.clientHeight;

        }

        return y;



}

