/*
	Hotusa_Shared.js : Código compartido

	Autor: WebHotelPlus
*/

var m_bFitFooter = true;
window.onload    = _OnLoad;

// ------------------------------------
// _OnLoad
function _OnLoad()
{
	if ( typeof OnInit == "function" )
		OnInit();

	if( m_bFitFooter )
		window.setTimeout( "FitFooter()", 200 );
}

// ------------------------------------
// AdjustFooter
function AdjustFooter()
{
	HideFooter();
	ShowFooter();
}

// ------------------------------------
// HideFooter
function HideFooter()
{
	document.getElementById( "idFootPage" ).style.marginTop = "0px";
	document.getElementById( "idFootPage" ).style.display   = "none";
}

// ------------------------------------
// ShowFooter
function ShowFooter()
{
	setTimeout( "FitFooter()", 200 );
}

// ------------------------------------
// FitFooter
function FitFooter()
{
	try
	{
		document.getElementById( "idFootPage" ).style.display   = "block";
		
		var cbDocHeight  = document.documentElement.clientHeight;
		var cbFootHeight = document.getElementById( "idFootPage" ).offsetHeight;
		var cbFootTop    = document.getElementById( "idFootPage" ).offsetTop;
		
		var cbMarginTop = cbDocHeight - cbFootHeight -  cbFootTop;

		if( cbMarginTop < 0 )
			return;

		document.getElementById( "idFootPage" ).style.marginTop = cbMarginTop + "px";
	}
	catch( e ) { alert(e.message); }
}

