function Anthem_PreCallBack() {
			var centroh=getPageSize();
var scr=getPageScroll();
var centrohor=scr[1]+(centroh[3]/2)-75;
			var loading = document.createElement("div");
			loading.id = "cargando";
			loading.style.color = "black";
			loading.style.backgroundColor = "#e8e4cb";
			loading.style.position = "absolute";
            loading.style.width="150px";
            loading.style.left = (centroh[0]/2)-75+"px";
			loading.style.top = centrohor +"px";
			loading.style.zIndex = "9999";
            loading.style.padding="10px";
            loading.style.border = "solid 1px #000000";
			loading.innerHTML = "Cargando datos,<br>Espere un momento,<br>por favor...";
			document.body.appendChild(loading);
		}

		function Anthem_PostCallBack() {
			if (document.getElementById("cargando")){
				var loading = document.getElementById("cargando");
			document.body.removeChild(loading);
				}
		}
function Anthem_Error(result) {
					//alert('Anthem_Error was invoked with the following error message: ' + result.error);
				}

 function cargarseccion(pagina,lblsec,principal) {
	if(pagina=="reservas")
{
	window.open('http://www.hotelfernangonzalez.com/reservas.htm','_parent');
}
else 	if(pagina=="ofertas")
{
	window.open('http://www.hotelfernangonzalez.com/ofertas.htm','_parent');
}
else
{


		Anthem_InvokePageMethod(
            'seccion',
            [pagina,lblsec],
            function(result) {
 if (pagina=="reservas"){
var now = new Date ();
diainicio=now.getDate();
mesinicio=now.getMonth()+1;
anioinicio=now.getFullYear();
diafin=now.getDate();
mesfin=now.getMonth()+1;
aniofin=now.getFullYear();	
 }
            }
        );
}
    }
	

function alerta(mensaje){
alert(mensaje);
}



function calendariolat(){

if (document.getElementById("mesagenda")){
index.nuevocalendario(document.getElementById("mesagenda").value,document.getElementById("anioagenda").value,cargarlateralreserva);
document.getElementById("Anthem_calendarioreserva__").innerHTML = "Cargando ...";
}else{
var myDate = new Date();
index.nuevocalendario(myDate.getMonth()+1,myDate.getFullYear(),cargarlateralreserva);
document.getElementById("Anthem_calendarioreserva__").innerHTML = "Cargando ...";
}
}
function calendariores(){


Anthem_InvokePageMethod(
            'diareservainicio',
            [1,1,1,document.getElementById("mesagenda").value,document.getElementById("anioagenda").value],
            function(result) {
  
            }
        );

}
function calendariomeses(mes,anio){
	document.getElementById("Anthem_calendarioreserva__").innerHTML = "Cargando ...";
index.nuevocalendario(mes,anio,cargarlateralreserva);
}



function cargarlateralreserva(res)
{
	if(res.error!= null)
	{
		alert(res.error);
}
	else{
document.getElementById("Anthem_calendarioreserva__").innerHTML = res.value;
		}	
}



function getPageScroll(){

	var xScroll, yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
		xScroll = self.pageXOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
		xScroll = document.documentElement.scrollLeft;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
		xScroll = document.body.scrollLeft;	
	}

	arrayPageScroll = new Array(xScroll,yScroll) 
	return arrayPageScroll;
}
function getPageSize(){
	
	var xScroll, yScroll;
	
	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 windowWidth, windowHeight;
	
//	console.log(self.innerWidth);
//	console.log(document.documentElement.clientWidth);

	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

//	console.log("xScroll " + xScroll)
//	console.log("windowWidth " + windowWidth)

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
//	console.log("pageWidth " + pageWidth)

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}
