//Valida fecha dd/MM/yyyy
function validaFecha( strValue ) {
  var objRegExp = /^\d{2}\/\d{2}\/\d{4}$/
  if(!objRegExp.test(strValue))
    return false;
  else {
    var arrayDate = strValue.split('/');
    var arrayLookup = { '01' : 31,'03' : 31, '04' : 30,'05' : 31,'06' : 30,'07' : 31,'08' : 31,'09' : 30,'10' : 31,'11' : 30,'12' : 31}
    var intDay = parseInt(arrayDate[0],10);
    if(arrayLookup[arrayDate[1]] != null) {
      if(intDay <= arrayLookup[arrayDate[1]] && intDay != 0)
        return true;
    }
    var intMonth = parseInt(arrayDate[1],10);
    if (intMonth == 2) { 
       var intYear = parseInt(arrayDate[2],10);
		if( ((intYear % 4 == 0 && intDay <= 29) || (intYear % 4 != 0 && intDay <=28)) && intDay !=0)
          return true;
       }
  }
  return false;
}
function inicializarMenu(){
	document.getElementById('subMenu1').style.visibility = 'hidden';
	document.getElementById('subMenu2').style.visibility = 'hidden';
	document.getElementById('subMenu3').style.visibility = 'hidden';
	document.getElementById('subMenu4').style.visibility = 'hidden';
	document.getElementById('subMenu5').style.visibility = 'hidden';
	document.getElementById('subMenu6').style.visibility = 'hidden';
	document.getElementById('subMenu7').style.visibility = 'hidden';
	document.getElementById('subMenu1').style.height = 'auto';
	document.getElementById('subMenu2').style.height = 'auto';
	document.getElementById('subMenu3').style.height = 'auto';
	document.getElementById('subMenu4').style.height = 'auto';
	document.getElementById('subMenu5').style.height = 'auto';
	document.getElementById('subMenu6').style.height = 'auto';
	document.getElementById('subMenu7').style.height = 'auto';
}
 function es_mail(mail){
	if (mail.indexOf('@')==-1){
		return false;
	}
	else{
		mail_tmp=mail.substring(mail.indexOf('@'),mail.length);
		if (mail_tmp.indexOf('.')==-1){
			return false;
		}
		else{
			return true;
		}
	}
}

function dispararReserva()
{
	var combo = document.getElementById('reservasHoteles');
	var idiomaActual = document.getElementById('idiomaActual');
	if (idiomaActual == 'SP') {
		switch (combo.value)
		{
			case '1': {recordOutboundLink(this, 'Outbound Links', 'Hotel Reina Petronila Home');window.open('https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=ESPAL&property=ESRP&language=ES', 'ventana', ''); break;}
			case '2': {recordOutboundLink(this, 'Outbound Links', 'Hotel Hiberus Home');window.open('https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=ESPAL&property=ESHI&Language=ES', 'ventana', ''); break;}
			case '3': {recordOutboundLink(this, 'Outbound Links', 'Hotel Palafox Home');window.open('https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=ESPAL&property=ESPX&Language=ES', 'ventana', ''); break;}
			case '4': {recordOutboundLink(this, 'Outbound Links', 'Hotel Goya Home');window.open('https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=ESPAL&property=ESGO&Language=ES', 'ventana', ''); break;}
			case '5': {recordOutboundLink(this, 'Outbound Links', 'Hotel Alfonso Home');window.open('https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=ESPAL&property=ESAL&Language=ES', 'ventana', ''); break;}
			case '6': {recordOutboundLink(this, 'Outbound Links', 'Hotel Playa Victoria Home');window.open('https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=ESPAL&property=ESVI&Language=ES', 'ventana', ''); break;}
		}	
	} else {
		switch (combo.value)
		{
			case '1': {recordOutboundLink(this, 'Outbound Links', 'Hotel Reina Petronila Home');window.open('https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=ESPAL&property=ESRP', 'ventana', ''); break;}
			case '2': {recordOutboundLink(this, 'Outbound Links', 'Hotel Hiberus Home');window.open('https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=ESPAL&property=ESHI&Language=ES', 'ventana', ''); break;}
			case '3': {recordOutboundLink(this, 'Outbound Links', 'Hotel Palafox Home');window.open('https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=ESPAL&property=ESPX&Language=ES', 'ventana', ''); break;}
			case '4': {recordOutboundLink(this, 'Outbound Links', 'Hotel Goya Home');window.open('https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=ESPAL&property=ESGO&Language=ES', 'ventana', ''); break;}
			case '5': {recordOutboundLink(this, 'Outbound Links', 'Hotel Alfonso Home');window.open('https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=ESPAL&property=ESAL&Language=ES', 'ventana', ''); break;}
			case '6': {recordOutboundLink(this, 'Outbound Links', 'Hotel Playa Victoria Home');window.open('https://www.myfidelio.net/webui/AvailabilitySearch.aspx?chain=ESPAL&property=ESVI&Language=ES', 'ventana', ''); break;}
		}		
	}
	

	}
function dispararMailReserva(hotel)
{
	switch (hotel)
	  {
		case '1': {window.open('avisoDisponibilidad.aspx?id=Reina%20Petronila', 'ventana', 'width=500, height=480'); break;}
		case '2': {window.open('avisoDisponibilidad.aspx?id=Hiberus', 'ventana', 'width=500, height=480'); break;}
		case '5': {window.open('avisoDisponibilidad.aspx?id=Hotel%20Alfonso', 'ventana', 'width=500, height=480'); break;}
	  }

}
