var diainicio;
var mesinicio;
var anioinicio;
var diafin;
var mesfin;
var aniofin;
var fechafinch=false;
function reservadia(dia,mes){
diainicio=dia;
mesinicio=mes;
anioinicio=document.getElementById("anioagenda").value;
diafin=dia;
mesfin=mes;
aniofin=document.getElementById("anioagenda").value;

Anthem_InvokePageMethod(
            'inicio',
            [diainicio,mesinicio,anioinicio],
            function(result) {
  
            }
        );		
}
function calendariomeses(mes,anio){

	document.getElementById("Anthem_calendarioreserva__").innerHTML=nuevocalendario.calendariomueveteinit(mes,anio).value;
        
}
function calendariomesesres(mes,anio){

	document.getElementById("calendarioinicioreserva").innerHTML=nuevocalendario.calendariomuevete(0,mes,anio).value;
        
}
function reservadiains(dia,mes){
diainicio=dia;
mesinicio=mes;
anioinicio=document.getElementById("anioagendainit").value;
document.getElementById("tablacalendario").innerHTML="";

document.getElementById("calendarioinicioreserva").innerHTML=nuevocalendario.incioreserva(diainicio,mesinicio,anioinicio,diafin,mesfin,aniofin).value;
document.getElementById("calendariofinreserva").innerHTML=nuevocalendario.finreserva(diainicio,mesinicio,anioinicio,diafin,mesfin,aniofin).value;

}
function reservadiafin(dia,mes){
diafin=dia;
mesfin=mes;
document.getElementById("tablacalendario").innerHTML="";
aniofin=document.getElementById("anioagendafin").value;

document.getElementById("calendariofinreserva").innerHTML=nuevocalendario.finreserva(diainicio,mesinicio,anioinicio,diafin,mesfin,aniofin).value;
comprobarreserva();
}
function calendariomesesresfin(mes,anio){

	document.getElementById("calendariofinreserva").innerHTML=nuevocalendario.calendariomuevete(1,mes,anio,diainicio,mesinicio,anioinicio,diafin,mesfin,aniofin).value;
        
}
function calendariomesesres(mes,anio){

	document.getElementById("calendarioinicioreserva").innerHTML=nuevocalendario.calendariomuevete(0,mes,anio,diainicio,mesinicio,anioinicio,diafin,mesfin,aniofin).value;
        
}
function comprobarreserva(){
document.getElementById("paso1").style.display="none";
document.getElementById("paso2").innerHTML=nuevocalendario.chkofertas(diainicio,mesinicio,anioinicio,diafin,mesfin,aniofin).value;
}
function detoferta(inicio,fin,oferta){
cloferta();
var centroh=getPageSize();
var scr=getPageScroll();
var centrohor=scr[1]+(centroh[3]/2)-250;
var centrover=scr[2]+(centroh[4]/2)-250;
			var loading = document.createElement("div");
			loading.id = "dtoferta";
			loading.style.color = "black";
			loading.style.backgroundColor = "#e8e4cb";
			loading.style.position = "absolute";
            loading.style.width="500px";
loading.style.height="350px";
            loading.style.left = (centroh[0]/2)-250+"px";
			loading.style.top = centrohor +"px";
			loading.style.zIndex = "9999";
            loading.style.padding="10px";
            loading.style.border = "solid 1px #000000";
			loading.innerHTML = nuevocalendario.detallesoferta(inicio,fin,oferta).value;
			document.body.appendChild(loading);

}
function cloferta(){
if (document.getElementById("dtoferta")){
				var loading = document.getElementById("dtoferta");
			document.body.removeChild(loading);
				}
}
function finalizarreserva(){


	Anthem_PreCallBack();
nuevocalendario.finalreserva(document.getElementById("nombreapellidos").value,document.getElementById("telefono").value,document.getElementById("mail").value,'',document.getElementById("comentarios").value,getRadioButtonSelectedValue(),diainicio,mesinicio,anioinicio,diafin,mesfin,aniofin,inforeserva);

}
function inforeserva(res){
	Anthem_PostCallBack();
if (res.error!=null){
alert(res.error);
}else{
if (res.value=="ok"){
	document.getElementById("paso2").style.display="none";
document.getElementById("paso3").innerHTML="Su peticion de reserva se ha enviado correctamente.<br><p>La confirmacion definitiva de su reserva se realizara a traves del telefono o e-mail que nos ha proporcionado tan pronto como nos sea posible.</p><p> Muchas gracias por su confianza</p>";
}else{
alert(res.value);
}
}
}

function envcons(){
	Anthem_PreCallBack();
nuevocalendario.mandarcontacto(document.getElementById("nombre").value,document.getElementById("telefono").value,document.getElementById("mail").value,document.getElementById("comentarios").value,document.getElementById("apellidos").value,infocnt);

}
function infocnt(res){
	Anthem_PostCallBack();
if (res.error!=null){
alert(res.error);
}else{
if (res.value=="ok"){
	
document.getElementById("Anthem_textoinside__").innerHTML="Su consulta se ha enviado correctamente.<br><br>Le atenderemos al a trav&eacute;s del tel&eacute;fono o e-mail proporcionado.<br><br>Muchas gracias por su confianza";
}else{
alert(res.value);
}
}
}

function getRadioButtonSelectedValue()
{

for (var i=0; i < document._ctl0.ofertasreserva.length; i++)
   {
   if (document._ctl0.ofertasreserva[i].checked)
      {
      var rad_val = document._ctl0.ofertasreserva[i].value;
      }
   }
return rad_val;

}

