window.onload=initAll;window.onunload=function(){};var xhr=false;var sharedServer="http://ww11.aitsafe.com/cf/add.cfm";var sharedId="D229456";var privateServer="http://ww8.aitsafe.com/cf/add.cfm";var privateId="A5112580";var hotelsArray=[];var destino=" ";var ChosenHotel=" ";var roundDiscount=0.6;var oneWayDiscount=0.4;var oneWayTotal=0;var roundTotal=0;var roundPrice=0;var onePrice=0;var finalRound=0;var finalOne=0;var resType=" ";var exceptionState=" ";var sharedCoupon=0;var privateCoupon=0;var offerMsg=" ";var exception=["CLUB MED","CLUB MED CANCUN","CLUB MED CANCUN YUCATAN","CLUB MED RESORT","CLUB MED YUCATAN","CLUB MED YUCATAN CANCUN","CLUB MEDITERRANEO","MARRIOT COURTYARD","MOON PALACE CANCUN","MOON PALACE CANCUN NIZUC","MOON PALACE GOLF AND RESORT","MOON PALACE GOLF AND SPA","MOON PALACE GOLF AND SPA RESORT","MOON PALACE GOLF CLUB","MOON PALACE GOLF RESORT","MOON PALACE NIZUC","MOON PALACE RESORT","MOON PALACE SUNRISE"];var privateIncludesList="<h3>Incluye:</h3> <ul><li>Vehiculo privado con A/C</li><li>Seguro de Viajero</li><li>Recibimiento en el Aeropuerto</li><li>Monitoreo de vuelo</li><li>Conductor bilingüe profesional</li><li>100% reembolsable 24 hrs. antes</li><li>Impuesto de Aeropuerto</li><li>Cambio de vuelo y retrasos incluidos</li><li>Servicio de transportacion las 24 horas del dia</li><li>Vehiculo espacioso para pasajeros y equipaje</li><li>Servicio al cliente las 24 hrs. del dia en Mexico</li></ul>";var sharedIncludesList="<h3>Incluye:</h3> <ul><li>Disponible de <span class='sharedAvailable'>8:00a.m. to 8:00 p.m. SOLAMENTE</span></li><li>Comparta el vehiculo con hasta 10 pasajeros</li><li>Servicio al cliente las 24 hrs del dia en Mexico</li><li>Multiples paradas - Hasta 4 paradas</li><li>Recibimiento en el aeropuerto</li><li>Conductores profesionales</li><li>Vehiculos parten cada hora</li><li>Cambio de vuelo y retrasos incluidos</li><li>100% reembolsable 24 hrs. antes</li><li>Seguro de Viajero</li><li>Impuestos de aeropuerto</li></ul>";var destMsgPart1="<div id='lng-msg'><p>El lugar en que se hospedara esta localizado en";var destMsgPart2="del aeropuerto. Usted tiene dos opciones, transportacion colectiva y privada. Por favor este conciente que no hay Taxis disponibles en el Aeropuerto, solamente compañias autorizadas pueden recogerlo y usted debe hacer sus reservaciones por adelantado. En las secciones de abajo usted puede leer informacion sobre estas dos opciones y escoger el mejor servicio posible para sus necesidades de transportacion. Tome ventaja de los descuentos disponibles solamente para las reservaciones por Internet.</p></div>";var CShuttlePList={"cancun":{"round":{"1-2 Pax":50,"3-7 Pax":65,"8-10 Pax":70},"oneway":{"1-2 Pax":30,"3-7 Pax":35,"8-10 Pax":40},"airportRound":{"1-2 Pax":65,"3-7 Pax":75,"8-10 Pax":95},"airportOneWay":{"1-2 Pax":45,"3-7 Pax":50,"8-10 Pax":55},"shared":{"oneway":14,"round":23},headerMsg:destMsgPart1+" <strong>Cancun</strong> aproximadamente 40 minutos "+destMsgPart2},"isla mujeres":{"round":{"1-2 Pax":60,"3-7 Pax":70,"8-10 Pax":75},"oneway":{"1-2 Pax":35,"3-7 Pax":40,"8-10 Pax":40},"airportRound":{"1-2 Pax":70,"3-7 Pax":75,"8-10 Pax":95},"airportOneWay":{"1-2 Pax":45,"3-7 Pax":50,"8-10 Pax":55},"shared":{"oneway":18,"round":30},headerMsg:destMsgPart1+" <strong>Isla Mujeres</strong>. Lo transferiremos a el puerto del ferry en Puerto Juarez. Que esta localizado aproximadamente a 30 minutos "+destMsgPart2},"puerto juarez":{"round":{"1-2 Pax":60,"3-7 Pax":70,"8-10 Pax":75},"oneway":{"1-2 Pax":35,"3-7 Pax":40,"8-10 Pax":45},"airportRound":{"1-2 Pax":70,"3-7 Pax":75,"8-10 Pax":95},"airportOneWay":{"1-2 Pax":45,"3-7 Pax":50,"8-10 Pax":55},"shared":{"oneway":18,"round":30},headerMsg:destMsgPart1+" <strong>Puerto Juarez</strong> aproximadamente a 30 minutos "+destMsgPart2},"playa mujeres":{"round":{"1-2 Pax":70,"3-7 Pax":80,"8-10 Pax":90},"oneway":{"1-2 Pax":40,"3-7 Pax":45,"8-10 Pax":50},"airportRound":{"1-2 Pax":90,"3-7 Pax":100,"8-10 Pax":110},"airportOneWay":{"1-2 Pax":60,"3-7 Pax":65,"8-10 Pax":70},"shared":{"oneway":0,"round":0},headerMsg:destMsgPart1+" <strong>Playa Mujeres</strong> aproximadamente a 30 minutos "+destMsgPart2},"puerto morelos":{"round":{"1-2 Pax":70,"3-7 Pax":80,"8-10 Pax":90},"oneway":{"1-2 Pax":40,"3-7 Pax":45,"8-10 Pax":50},"airportRound":{"1-2 Pax":90,"3-7 Pax":100,"8-10 Pax":110},"airportOneWay":{"1-2 Pax":60,"3-7 Pax":65,"8-10 Pax":70},"shared":{"oneway":23,"round":45},headerMsg:destMsgPart1+" <strong>Puerto Morelos</strong> aproximadamente a 25 minutos "+destMsgPart2},"paraiso beach":{"round":{"1-2 Pax":80,"3-7 Pax":90,"8-10 Pax":100},"oneway":{"1-2 Pax":40,"3-7 Pax":50,"8-10 Pax":55},"airportRound":{"1-2 Pax":95,"3-7 Pax":105,"8-10 Pax":115},"airportOneWay":{"1-2 Pax":65,"3-7 Pax":70,"8-10 Pax":75},"shared":{"oneway":23,"round":45},headerMsg:destMsgPart1+" <strong>Paraiso Beach</strong> aproximadamente a 25 minutos "+destMsgPart2},"playa del carmen":{"round":{"1-2 Pax":105,"3-7 Pax":110,"8-10 Pax":120},"oneway":{"1-2 Pax":50,"3-7 Pax":60,"8-10 Pax":65},"airportRound":{"1-2 Pax":125,"3-7 Pax":135,"8-10 Pax":145},"airportOneWay":{"1-2 Pax":80,"3-7 Pax":85,"8-10 Pax":90},"shared":{"oneway":23,"round":45},headerMsg:destMsgPart1+" <strong>Playa del Carmen</strong> aproximadamente a 1 hora "+destMsgPart2},"maroma beach":{"round":{"1-2 Pax":80,"3-7 Pax":90,"8-10 Pax":100},"oneway":{"1-2 Pax":40,"3-7 Pax":50,"8-10 Pax":55},"airportRound":{"1-2 Pax":95,"3-7 Pax":105,"8-10 Pax":115},"airportOneWay":{"1-2 Pax":65,"3-7 Pax":70,"8-10 Pax":75},"shared":{"oneway":23,"round":45},headerMsg:destMsgPart1+" <strong>Maroma Beach</strong> aproximadamente a 30 minutos "+destMsgPart2},"playacar":{"round":{"1-2 Pax":105,"3-7 Pax":110,"8-10 Pax":120},"oneway":{"1-2 Pax":50,"3-7 Pax":60,"8-10 Pax":65},"airportRound":{"1-2 Pax":125,"3-7 Pax":135,"8-10 Pax":145},"airportOneWay":{"1-2 Pax":80,"3-7 Pax":85,"8-10 Pax":90},"shared":{"oneway":23,"round":45},headerMsg:destMsgPart1+" <strong>Playacar</strong> aproximadamente a 1 hora y 10 minutos "+destMsgPart2},"cozumel":{"round":{"1-2 Pax":105,"3-7 Pax":110,"8-10 Pax":120},"oneway":{"1-2 Pax":55,"3-7 Pax":60,"8-10 Pax":65},"airportRound":{"1-2 Pax":125,"3-7 Pax":135,"8-10 Pax":145},"airportOneWay":{"1-2 Pax":80,"3-7 Pax":85,"8-10 Pax":90},"shared":{"oneway":23,"round":45},headerMsg:destMsgPart1+" <strong>Cozumel</strong>. Lo transferiremos a el puerto del ferry en in Playa del Carmen que esta localizada aproximadamente a 1 hora "+destMsgPart2},"xcaret":{"round":{"1-2 Pax":100,"3-7 Pax":110,"8-10 Pax":120},"oneway":{"1-2 Pax":60,"3-7 Pax":65,"8-10 Pax":70},"airportRound":{"1-2 Pax":135,"3-7 Pax":145,"8-10 Pax":165},"airportOneWay":{"1-2 Pax":90,"3-7 Pax":95,"8-10 Pax":105},"shared":{"oneway":23,"round":45},headerMsg:destMsgPart1+" <strong>Xcaret</strong> aproximadamente a 1 hora y 20 minutos "+destMsgPart2},"puerto aventuras":{"round":{"1-2 Pax":115,"3-7 Pax":130,"8-10 Pax":135},"oneway":{"1-2 Pax":65,"3-7 Pax":70,"8-10 Pax":70},"airportRound":{"1-2 Pax":150,"3-7 Pax":155,"8-10 Pax":165},"airportOneWay":{"1-2 Pax":95,"3-7 Pax":100,"8-10 Pax":105},"shared":{"oneway":28,"round":55},headerMsg:destMsgPart1+" <strong>Puerto Aventuras</strong> aproximadamente a 1 hora y 20 minutos "+destMsgPart2},"calica":{"round":{"1-2 Pax":115,"3-7 Pax":130,"8-10 Pax":135},"oneway":{"1-2 Pax":65,"3-7 Pax":70,"8-10 Pax":70},"airportRound":{"1-2 Pax":135,"3-7 Pax":145,"8-10 Pax":165},"airportOneWay":{"1-2 Pax":90,"3-7 Pax":95,"8-10 Pax":105},"shared":{"oneway":0,"round":0},headerMsg:destMsgPart1+" the <strong>Port of Calica</strong> aproximadamente a 1 hora y 25 minutos "+destMsgPart2},"paamul":{"round":{"1-2 Pax":115,"3-7 Pax":130,"8-10 Pax":135},"oneway":{"1-2 Pax":65,"3-7 Pax":70,"8-10 Pax":70},"airportRound":{"1-2 Pax":150,"3-7 Pax":155,"8-10 Pax":165},"airportOneWay":{"1-2 Pax":95,"3-7 Pax":100,"8-10 Pax":105},"shared":{"oneway":0,"round":0},headerMsg:destMsgPart1+" <strong>Paamul</strong> aproximadamente a 1 hora y 20 minutos "+destMsgPart2},"xpu ha":{"round":{"1-2 Pax":115,"3-7 Pax":130,"8-10 Pax":135},"oneway":{"1-2 Pax":65,"3-7 Pax":70,"8-10 Pax":70},"airportRound":{"1-2 Pax":150,"3-7 Pax":155,"8-10 Pax":165},"airportOneWay":{"1-2 Pax":95,"3-7 Pax":100,"8-10 Pax":105},"shared":{"oneway":35,"round":70},headerMsg:destMsgPart1+" <strong>Xpu Ha</strong> aproximadamente a 1 hora y 40 minutos "+destMsgPart2},"akumal":{"round":{"1-2 Pax":130,"3-7 Pax":145,"8-10 Pax":160},"oneway":{"1-2 Pax":75,"3-7 Pax":80,"8-10 Pax":85},"airportRound":{"1-2 Pax":170,"3-7 Pax":180,"8-10 Pax":195},"airportOneWay":{"1-2 Pax":105,"3-7 Pax":110,"8-10 Pax":115},"shared":{"oneway":35,"round":70},headerMsg:destMsgPart1+" <strong>Akumal</strong> aproximadamente a 1 hora y 30 minutos "+destMsgPart2},"tankah":{"round":{"1-2 Pax":145,"3-7 Pax":175,"8-10 Pax":190},"oneway":{"1-2 Pax":80,"3-7 Pax":95,"8-10 Pax":100},"airportRound":{"1-2 Pax":190,"3-7 Pax":195,"8-10 Pax":215},"airportOneWay":{"1-2 Pax":110,"3-7 Pax":115,"8-10 Pax":125},"shared":{"oneway":0,"round":0},headerMsg:destMsgPart1+" <strong>Tankah</strong> aproximadamente a 1 hora y 50 minutos "+destMsgPart2},"tulum":{"round":{"1-2 Pax":145,"3-7 Pax":175,"8-10 Pax":190},"oneway":{"1-2 Pax":80,"3-7 Pax":95,"8-10 Pax":100},"airportRound":{"1-2 Pax":190,"3-7 Pax":195,"8-10 Pax":215},"airportOneWay":{"1-2 Pax":110,"3-7 Pax":115,"8-10 Pax":125},"shared":{"oneway":35,"round":70},headerMsg:destMsgPart1+" <strong>Tulum</strong> aproximadamente a 1 hora y 45 minutos "+destMsgPart2},"zona hotelera de tulum":{"round":{"1-2 Pax":145,"3-7 Pax":175,"8-10 Pax":190},"oneway":{"1-2 Pax":80,"3-7 Pax":95,"8-10 Pax":100},"airportRound":{"1-2 Pax":195,"3-7 Pax":200,"8-10 Pax":220},"airportOneWay":{"1-2 Pax":115,"3-7 Pax":120,"8-10 Pax":130},"shared":{"oneway":35,"round":70},headerMsg:destMsgPart1+" <strong>Zona Hotelera de Tulum</strong> aproximadamente a 2 horas "+destMsgPart2},"holbox":{"round":{"1-2 Pax":430,"3-7 Pax":570,"8-10 Pax":680},"oneway":{"1-2 Pax":215,"3-7 Pax":285,"8-10 Pax":340},"airportRound":{"1-2 Pax":430,"3-7 Pax":570,"8-10 Pax":680},"airportOneWay":{"1-2 Pax":215,"3-7 Pax":285,"8-10 Pax":340},"shared":{"oneway":0,"round":0},headerMsg:destMsgPart1+" <strong>Holbox</strong> aproximadamente a 2 horas "+destMsgPart2},"chiquila":{"round":{"1-2 Pax":430,"3-7 Pax":570,"8-10 Pax":680},"oneway":{"1-2 Pax":215,"3-7 Pax":285,"8-10 Pax":340},"airportRound":{"1-2 Pax":430,"3-7 Pax":570,"8-10 Pax":680},"airportOneWay":{"1-2 Pax":215,"3-7 Pax":285,"8-10 Pax":340},"shared":{"oneway":0,"round":0},headerMsg:destMsgPart1+" <strong>Chiquila</strong> aproximadamente a 2 horas "+destMsgPart2},"valladolid":{"round":{"1-2 Pax":430,"3-7 Pax":570,"8-10 Pax":680},"oneway":{"1-2 Pax":215,"3-7 Pax":285,"8-10 Pax":340},"airportRound":{"1-2 Pax":430,"3-7 Pax":570,"8-10 Pax":680},"airportOneWay":{"1-2 Pax":215,"3-7 Pax":285,"8-10 Pax":340},"shared":{"oneway":0,"round":0},headerMsg:destMsgPart1+" <strong>Valladolid</strong> aproximadamente a 2 horas "+destMsgPart2},"boca paila":{"round":{"1-2 Pax":430,"3-7 Pax":570,"8-10 Pax":680},"oneway":{"1-2 Pax":215,"3-7 Pax":285,"8-10 Pax":340},"airportRound":{"1-2 Pax":430,"3-7 Pax":570,"8-10 Pax":680},"airportOneWay":{"1-2 Pax":215,"3-7 Pax":285,"8-10 Pax":340},"shared":{"oneway":0,"round":0},headerMsg:destMsgPart1+" <strong>Boca Paila</strong> aproximadamente a 2 horas y 10 minutos "+destMsgPart2},"chichen itza":{"round":{"1-2 Pax":540,"3-7 Pax":760,"8-10 Pax":860},"oneway":{"1-2 Pax":270,"3-7 Pax":380,"8-10 Pax":430},"airportRound":{"1-2 Pax":540,"3-7 Pax":760,"8-10 Pax":860},"airportOneWay":{"1-2 Pax":270,"3-7 Pax":380,"8-10 Pax":430},"shared":{"oneway":0,"round":0},headerMsg:destMsgPart1+" <strong>Chichen Itza</strong> aproximadamente a 2 horas y 30 minutos "+destMsgPart2},"merida":{"round":{"1-2 Pax":810,"3-7 Pax":1030,"8-10 Pax":1140},"oneway":{"1-2 Pax":405,"3-7 Pax":515,"8-10 Pax":570},"airportRound":{"1-2 Pax":810,"3-7 Pax":1030,"8-10 Pax":1140},"airportOneWay":{"1-2 Pax":405,"3-7 Pax":515,"8-10 Pax":570},"shared":{"oneway":0,"round":0},headerMsg:destMsgPart1+" <strong>Merida</strong> aproximadamente a 4 horas "+destMsgPart2},"chetumal":{"round":{"1-2 Pax":810,"3-7 Pax":1030,"8-10 Pax":1140},"oneway":{"1-2 Pax":405,"3-7 Pax":515,"8-10 Pax":570},"airportRound":{"1-2 Pax":810,"3-7 Pax":1030,"8-10 Pax":1140},"airportOneWay":{"1-2 Pax":405,"3-7 Pax":515,"8-10 Pax":570},"shared":{"oneway":0,"round":0},headerMsg:destMsgPart1+" <strong>Chetumal</strong> aproximadamente a 5 horas "+destMsgPart2},"costa maya":{"round":{"1-2 Pax":730,"3-7 Pax":920,"8-10 Pax":1030},"oneway":{"1-2 Pax":365,"3-7 Pax":460,"8-10 Pax":515},"airportRound":{"1-2 Pax":730,"3-7 Pax":920,"8-10 Pax":1030},"airportOneWay":{"1-2 Pax":365,"3-7 Pax":460,"8-10 Pax":515},"shared":{"oneway":0,"round":0},headerMsg:destMsgPart1+" <strong>Costa Maya</strong> aproximadamente a 5 horas "+destMsgPart2}};function initAll(){destino=document.getElementById("destino").value;document.getElementById("searchField").onkeyup=searchSuggest;if(window.XMLHttpRequest){xhr=new XMLHttpRequest();}else{if(window.ActiveXObject){try{xhr=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}if(xhr){xhr.onreadystatechange=setHotelsArray;xhr.open("GET","scripts/hlistesp.xml",true);xhr.send(null);}else{alert("Sorry, but I couldn't create an XMLHttpRequest");}$("#shared-warning").hide();$("#reserve-shared").bind("click",function(e){$('html, body').animate({scrollTop:200},'slow');if($("#tripType").css("display")=="block"){resType="Servicio Colectivo";$("#shared-warning").show();var tripTypeIndex=document.getElementById("tripMenuID").selectedIndex;removeAllChildren("tripType");if(document.getElementById("CarInfoId")){deleteElementByID("CarInfoId");}if(offerMsg!==" "){}var tMenu=populateTripMenu(roundTotal,oneWayTotal);document.getElementById("tripType").appendChild(tMenu);$("#tripType").fadeIn("slow");$("#tenPercent").fadeIn("slow");document.getElementById("tripType").className="tripshow";document.getElementById("tenPercent").className="tshow";document.getElementById("tripMenuID").selectedIndex=tripTypeIndex;document.getElementById("tripMenuID").onchange=genLastSection;document.getElementById("carType").innerHTML="<img src='images/daffyImgs/shared-img-bottom.jpg' />";document.getElementById("dynform").action=sharedServer;document.getElementById("userid").value=sharedId;if(document.getElementById("resTypeHeader")){if(tripTypeIndex==1){var hmsg="Esta haciendo una reservacion para un viaje redondo de "+resType;}else if(tripTypeIndex==2){var hmsg="Esta haciendo una reservacion para un viaje sencillo de "+resType;}document.getElementById("resTypeHeader").innerHTML=hmsg;}}else{resType="Servicio Colectivo";$("#shared-warning").show();if(document.getElementById("CarInfoId")){deleteElementByID("CarInfoId");}var tMenu=populateTripMenu(roundTotal,oneWayTotal);document.getElementById("tripType").appendChild(tMenu);$("#tripType").fadeIn("slow");$("#tenPercent").fadeIn("slow");document.getElementById("tripType").className="tripshow";document.getElementById("tenPercent").className="tshow";document.getElementById("tripMenuID").selectedIndex=0;document.getElementById("tripMenuID").onchange=genLastSection;document.getElementById("carType").innerHTML="<img src='images/daffyImgs/shared-img-bottom.jpg' />";document.getElementById("dynform").action=sharedServer;document.getElementById("userid").value=sharedId;}});$("#reserve-private").bind("click",function(e){$('html, body').animate({scrollTop:200},'slow');if($("#tripType").css("display")==="block"){resType="Transportacion Privada";$("#shared-warning").hide();var tripTypeIndex=document.getElementById("tripMenuID").selectedIndex;removeAllChildren("tripType");var tMenu=populateTripMenu(finalRound,finalOne);document.getElementById("tripType").appendChild(tMenu);document.getElementById("tripType").className="tripshowpriv";document.getElementById("tenPercent").className="tshowpriv";$("#tripType").fadeIn("slow");$("#tenPercent").fadeIn("slow");document.getElementById("tripMenuID").selectedIndex=tripTypeIndex;document.getElementById("tripMenuID").onchange=genLastSection;document.getElementById("carType").innerHTML="<img src='images/daffyImgs/private-img-bottom.jpg' />";document.getElementById("dynform").action=privateServer;document.getElementById("userid").value=privateId;if(document.getElementById("resTypeHeader")){if(tripTypeIndex===1){var hmsg="Esta haciendo una reservacion para un viaje redondo de "+resType;}else if(tripTypeIndex==2){var hmsg="Esta haciendo una reservacion para un viaje sencillo de "+resType;}document.getElementById("resTypeHeader").innerHTML=hmsg;}}else{resType="Transportacion Privada";$("#shared-warning").hide();var tMenu=populateTripMenu(finalRound,finalOne);document.getElementById("tripType").appendChild(tMenu);document.getElementById("tripType").className="tripshowpriv";document.getElementById("tenPercent").className="tshowpriv";$("#tripType").fadeIn("slow");$("#tenPercent").fadeIn("slow");document.getElementById("tripMenuID").selectedIndex=0;document.getElementById("tripMenuID").onchange=genLastSection;document.getElementById("carType").innerHTML="<img src='images/daffyImgs/private-img-bottom.jpg' />";document.getElementById("dynform").action=privateServer;document.getElementById("userid").value=privateId;}});function kH(e){var pK=e?e.which:window.event.keyCode;return pK!=13;}document.onkeypress=kH;if(document.layers){document.captureEvents(Event.KEYPRESS);}if(ChosenHotel!="")if(destino!=""){fillDestInfo();document.getElementById("foldingContent").className="hide";}}function setHotelsArray(){if(xhr.readyState===4){if(xhr.status===200){if(xhr.responseXML){var allHotels=xhr.responseXML.getElementsByTagName("item");for(var i=0;i<allHotels.length;i++){hotelsArray[i]=allHotels[i].getElementsByTagName("label")[0].firstChild;}}}else{alert("There was a problem with the request "+xhr.status);}}}function BuscameloJEJE(){if(document.getElementById("searchField").value==""){ChosenHotel=document.getElementById("searchField").value;destino=getValue(ChosenHotel);document.getElementById("paxMenuID").onchange=checkConditions;}}function searchSuggest(){var str=document.getElementById("searchField").value;document.getElementById("searchField").className="";if(str!==""){document.getElementById("popups").innerHTML="";for(var i=0;i<hotelsArray.length;i++){var thisHotel=hotelsArray[i].nodeValue;if(thisHotel.toLowerCase().indexOf(str.toLowerCase())===0){var tempDiv=document.createElement("div");tempDiv.innerHTML=thisHotel;tempDiv.onclick=makeChoice;tempDiv.className="suggestions";document.getElementById("popups").appendChild(tempDiv);}}var foundCt=document.getElementById("popups").childNodes.length;if(foundCt===0){document.getElementById("searchField").className="error";}}document.getElementById("foldingContent").className="hide";document.getElementById("paxMenuID").onchange=checkConditions;if(ChosenHotel==="other"){if(document.getElementById("otherHotel").className!=="othershow"){if($("#destInfo").css("display")==="block"){$("#destInfo").css({display:"none"});}if($("#tripType").css("display")==="block"){removeAllChildren("tripType");$("#tripType").css({display:"none"});$("#tenPercent").css({display:"none"});}if($("#flightInfo").css("display")==="block"){removeAllChildren("flightInfo");$("#flightInfo").css({display:"none"});document.getElementById("carType").className="";document.getElementById("formSubmit").className="";}document.getElementById("otherHotel").className="othershow";genLabel("otherHotelInput","Hotel Name/Lodging: ");var hotelNode=document.createElement("input");hotelNode.name="product[]";hotelNode.type="text";hotelNode.size="31";document.getElementById("otherHotelInput").appendChild(hotelNode);genBreakLine("otherHotelInput");genLabel("otherHotelInput","Destination:");var dMenu=populateDestinationMenu();document.getElementById("otherHotelInput").appendChild(dMenu);genBreakLine("otherHotelInput");document.getElementById("destMenu").selectedIndex=0;document.getElementById("destMenu").onchange=storeDest;}}else if(document.getElementById("paxMenuID").selectedIndex!==0&&ChosenHotel!==" "){if($("#destInfo").css("display")==="block"){removeAllChildren("sharedPrices");removeAllChildren("sharedIncludes");removeAllChildren("privatePrices");removeAllChildren("privateIncludes");}fillDestInfo();}}function makeChoice(evt){var thisDiv=(evt)?evt.target:window.event.srcElement;document.getElementById("searchField").value=thisDiv.innerHTML;ChosenHotel=thisDiv.innerHTML;document.getElementById("popups").innerHTML="";destino=getValue(ChosenHotel);document.getElementById("foldingContent").className="hide";document.getElementById("paxMenuID").onchange=checkConditions;if(ChosenHotel==="other"){if(document.getElementById("otherHotel").className!=="othershow"){if($("#destInfo").css("display")==="block"){$("#destInfo").css({display:"none"});}if($("#tripType").css("display")==="block"){removeAllChildren("tripType");$("#tripType").css({display:"none"});$("#tenPercent").css({display:"none"});}if($("#flightInfo").css("display")==="block"){removeAllChildren("flightInfo");$("#flightInfo").css({display:"none"});document.getElementById("carType").className="";document.getElementById("formSubmit").className="";}document.getElementById("otherHotel").className="othershow";genLabel("otherHotelInput","Hotel Name/Lodging: ");var hotelNode=document.createElement("input");hotelNode.name="product[]";hotelNode.type="text";hotelNode.size="31";document.getElementById("otherHotelInput").appendChild(hotelNode);genBreakLine("otherHotelInput");genLabel("otherHotelInput","Destination:");var dMenu=populateDestinationMenu();document.getElementById("otherHotelInput").appendChild(dMenu);genBreakLine("otherHotelInput");document.getElementById("destMenu").selectedIndex=0;document.getElementById("destMenu").onchange=storeDest;}}else if(document.getElementById("paxMenuID").selectedIndex!==0&&ChosenHotel!==" "){if($("#destInfo").css("display")==="block"){removeAllChildren("sharedPrices");removeAllChildren("sharedIncludes");removeAllChildren("privatePrices");removeAllChildren("privateIncludes");}fillDestInfo();}}function checkConditions(){if(document.getElementById("otherHotel").className==="othershow"&&document.getElementById("destMenu").selectedIndex===0){$("#otherValidation").css({display:"block"});document.getElementById("otherValidation").innerHTML="You must enter a destination to continue";}else{if($("#more-than-ten").css("display")==="block"){$("#more-than-ten").css({display:"none"});if($("#destInfo").css("display")==="block"){$("#destInfo").css({display:"none"});}cleanBelowFlightInfo();}if(($("#destInfo").css("display")==="block")&&(document.getElementById("paxMenuID").selectedIndex===0)){alert("You need to choose a number of passengers");document.getElementById("paxMenuID").selectedIndex=1;}if($("#destInfo").css("display")==="block"){removeAllChildren("sharedPrices");removeAllChildren("sharedIncludes");removeAllChildren("privatePrices");removeAllChildren("privateIncludes");}if(ChosenHotel!=" "){fillDestInfo();}}}function fillDestInfo(){if(document.getElementById("paxMenuID").selectedIndex===11){$("#more-than-ten").css({display:"block"});if($("#destInfo").css("display")==="block"){$("#destInfo").css({display:"none"});}cleanBelowFlightInfo();}else{$("#destInfo").fadeIn("slow");$("#logos-wrap").fadeIn("slow");exceptionState=checkExceptions();if(CShuttlePList[destino].shared.oneway!==0&&exceptionState){addSharedPriceInfo();document.getElementById("sharedIncludes").className="showBak";document.getElementById("sResButton").className="";}else{removeAllChildren("sharedPrices");removeAllChildren("sharedIncludes");document.getElementById("sResButton").className="noShow";document.getElementById("sharedIncludes").className="";document.getElementById("sharedPrices").innerHTML="<h3>Servicio Colectivotivo no esta disponible para este hotel</h3>";}addPrivatePriceInfo();addIncludesInfo();if($("#more-than-ten").css("display")==="block"){$("#more-than-ten").css({display:"none"});if($("#destInfo").css("display")==="block"){$("#destInfo").css({display:"none"});}cleanBelowFlightInfo();}}}function addIncludesInfo(){document.getElementById("dest-msg").innerHTML=CShuttlePList[destino].headerMsg;document.getElementById("privateIncludes").innerHTML=privateIncludesList;if(CShuttlePList[destino].shared.oneway!==0&&exceptionState){document.getElementById("sharedIncludes").innerHTML=sharedIncludesList;}}function addPrivatePriceInfo(){var paxmenu=document.getElementById("paxMenuID");var paxno=paxmenu.options[paxmenu.selectedIndex].innerHTML;var vehicleType=processPaxNum(paxno);roundPrice=CShuttlePList[destino].round[vehicleType];onePrice=CShuttlePList[destino].oneway[vehicleType];var oneAirPrice=CShuttlePList[destino].airportOneWay[vehicleType]+25;var roundAirPrice=CShuttlePList[destino].airportRound[vehicleType]+50;var roundSave=CShuttlePList[destino].airportRound[vehicleType];var oneSave=CShuttlePList[destino].airportOneWay[vehicleType];var carImg=" ";switch(vehicleType){case"1-2 Pax":carImg='<img src="images/daffyImgs/vehicle1to2.jpg"/>';break;case"3-7 Pax":carImg='<img src="images/daffyImgs/vehicle3to7.jpg"/>';break;case"8-10 Pax":carImg='<img src="images/daffyImgs/vehicle8to10.jpg"/>';break;default:alert("error on addPrivatePriceInfo");}var beSafeOne=0;var beSafeRound=0;finalOne=onePrice;finalRound=roundPrice;var priceContent="<div id='small-cars'>"+carImg+"</div><h3>Transportacion Privada<br/>(Precio por vehiculo en Dolares)</h3><table width='100%'border='0'><tr><td width='40%'></td><th width='17%'>Viaje Sencillo</th><th width='17%'>Viaje Redondo</th><td width='26%'></td></tr><tr><td class='tText'><span class='pricePer'>Precio en el Aeropuerto:</span></td><td class='demPrice'>"+"$"+oneAirPrice.toFixed(2)+"</td><td class='demPrice'>"+"$"+roundAirPrice.toFixed(2)+"</td><td></td></tr><tr><td class='tText rPrice'>Precio total por Internet:</td><td class='rPrice emPrice'>"+"$"+oneSave.toFixed(2)+"</td><td class='rPrice emPrice'>"+"$"+roundSave.toFixed(2)+"</td><td class='promo-msg'>(La mejor opcion)</td></tr><tr><td class='tText rText'>Reserve ahora por solo:</td><td class='online-discount'>"+"$"+finalOne.toFixed(2)+"</td><td class='online-discount'>"+"$"+finalRound.toFixed(2)+"</td><td></td></tr></table>";document.getElementById("privatePrices").innerHTML=priceContent;if(oneWayTotal>onePrice){document.getElementById("priv-recommend").className="show";$("td.promo-msg").css("display","block");$("#departs").css("display","none");}else{document.getElementById("priv-recommend").className="";$("#departs").css("display","block");}if((onePrice>=100)&&(roundPrice>=100)){$("#pResMsg").addClass("show");$("#priv-recommend").addClass("showPromo");if($("#priv-recommend").hasClass("show")){$("#priv-recommend").removeClass("show");$("#priv-recommend").addClass("showPromo");}}else if($("#pResMsg").hasClass("show")){$("#pResMsg").removeClass("show");if($("#priv-recommend").hasClass("showPromo"))$("#priv-recommend").removeClass("showPromo");}if((onePrice<100)&&(roundPrice>=100)){$("#rResMsg").addClass("show");$("#priv-recommend").addClass("showPromo");if($("#priv-recommend").hasClass("show")){$("#priv-recommend").removeClass("show");$("#priv-recommend").addClass("showPromo");}}else if($("#rResMsg").hasClass("show")){$("#rResMsg").removeClass("show");if($("#priv-recommend").hasClass("showPromo"))$("#priv-recommend").removeClass("showPromo");}if(resType=="Transportacion Privada"){rePopulateTripMenu(finalRound,finalOne);}}function addSharedPriceInfo(){var paxmenu=document.getElementById("paxMenuID");var paxStr=paxmenu.options[paxmenu.selectedIndex].innerHTML;var paxno=processString(paxStr);findDiscount(paxno);if(paxno==2&&destino=="cancun"){var oneWayShared=14;var roundShared=17;oneWayTotal=14*paxno;roundTotal=17*paxno;}else{var oneWayShared=CShuttlePList[destino].shared.oneway;var roundShared=CShuttlePList[destino].shared.round;oneWayTotal=CShuttlePList[destino].shared.oneway*paxno;roundTotal=CShuttlePList[destino].shared.round*paxno;}attachOffer(paxno);var priceContent="<div id='departs'><!--<img src='images/daffyImgs/departs-every-20.png' />--></div><h3>Servicio Colectivo<br />(Todos los precios son en Dolares)</h3><table width='100%' border='0'><tr><th width='39%'></th><th width='14%'>Viaje Sencillo</th><th width='14%'>Viaje Redondo</th><th width='32%'></th></tr><tr><td class='tText'><span class='pricePer'>Precio Por Persona:</span></td><td>"+"$"+oneWayShared+".00"+"</td><td>"+"$"+roundShared+".00"+"</td><td>&nbsp;</td></tr><tr><td class='rPrice tText'>Precio Total por Internet:</td><td class='rPrice emPrice'>"+"$"+oneWayTotal+".00"+"</td><td class='rPrice emPrice'>"+"$"+roundTotal+".00"+"</td><td class='promo-msg'>Vea opcion privada<img src='images/daffyImgs/sm-red-arrow.png' /></td></tr><tr></table>";document.getElementById("sharedPrices").innerHTML=priceContent;if(resType=="Servicio Colectivo"){rePopulateTripMenu(roundTotal,oneWayTotal);}}function rePopulateTripMenu(rPrice,oPrice){if(document.getElementById("tripMenuID")){var savedIndex=document.getElementById("tripMenuID").selectedIndex;removeAllChildren("tripType");var tripmenu=populateTripMenu(rPrice,oPrice);tripmenu.selectedIndex=savedIndex;document.getElementById("tripType").appendChild(tripmenu);document.getElementById("tripMenuID").onchange=genLastSection;}}function storeDest(){if($("#otherValidation").css("display")=="block"){$("#otherValidation").css({display:"none"});document.getElementById("otherValidation").innerHTML="";}var dMenu=document.getElementById("destMenu");destino=dMenu.options[dMenu.selectedIndex].value;if(document.getElementById("paxMenuID").selectedIndex!==0){fillDestInfo();}}function populateTripMenu(rPrice,owayPrice){var tripMenu=document.createElement("select");tripMenu.name="productpr";tripMenu.id="tripMenuID";var optionToAdd=document.createElement("option");optionToAdd.selected="selected";optionToAdd.innerHTML="Elija una opcion";tripMenu.appendChild(optionToAdd);if(resType==="Transportacion Privada"){createTripOption(tripMenu,"Viaje Redondo",rPrice,"",roundPrice);createTripOption(tripMenu,"Viaje Sencillo",owayPrice,"",onePrice);}else if(resType==="Servicio Colectivo"){createTripOption(tripMenu,"Viaje Redondo",rPrice,"",rPrice);createTripOption(tripMenu,"Viaje Sencillo",owayPrice,"",owayPrice);}return tripMenu;}function createTripOption(menu,kind,price,savings,priceSent){var optionToAdd=document.createElement("option");optionToAdd.value=":"+priceSent;optionToAdd.innerHTML=kind+": $"+price.toFixed(2)+savings;menu.appendChild(optionToAdd);}function genLastSection(){if($("#flightInfo").css("display")==="block"){removeAllChildren("flightInfo");if(document.getElementById("tripMenuID").selectedIndex===1){generateRound();document.getElementById("formSubmit").className="subShow";if(resType=="Transportacion Privada"){document.getElementById("tenPercent").className="tshowprivGif";}else{document.getElementById("tenPercent").className="tshow";}$("#one-message").hide();$("#round-message").show();}else if(document.getElementById("tripMenuID").selectedIndex===2){generateOneWay();document.getElementById("formSubmit").className="subShow";if(resType=="Transportacion Privada"){document.getElementById("tenPercent").className="tshowprivGif";}else{document.getElementById("tenPercent").className="tshow";}$("#round-message").hide();$("#one-message").show();}else if(document.getElementById("tripMenuID").selectedIndex===0){if(document.getElementById("formSubmit").className==="subShow"){document.getElementById("formSubmit").className="";}if(($("#flightInfo").css("display:block"))){}addH3("flightInfo","You need to choose a round trip or one way to continue","warningMsg");$("#carType").removeClass("show");document.getElementById("tenPercent").className="tshowpriv";$("#round-message").hide();$("#one-message").hide();}else{alert("error on genLastSection");}}else{$("#flightInfo").fadeIn("slow");if(document.getElementById("tripMenuID").selectedIndex===1){generateRound();document.getElementById("formSubmit").className="subShow";if(resType=="Transportacion Privada"){document.getElementById("tenPercent").className="tshowprivGif";}else{document.getElementById("tenPercent").className="tshow";}$("#one-message").hide();$("#round-message").show();}else if(document.getElementById("tripMenuID").selectedIndex===2){generateOneWay();document.getElementById("formSubmit").className="subShow";if(resType=="Transportacion Privada"){document.getElementById("tenPercent").className="tshowprivGif";}else{document.getElementById("tenPercent").className="tshow";}$("#round-message").hide();$("#one-message").show();}else if(document.getElementById("tripMenuID").selectedIndex===0){if(document.getElementById("formSubmit").className==="subShow"){document.getElementById("formSubmit").className="";}if(document.getElementById("flightInfo").className==="flightshow"){document.getElementById("flightInfo").className="";}alert("Please choose Round trip or One way trip");document.getElementById("tenPercent").className="tshowpriv";$("#round-message").hide();$("#one-message").hide();}else{alert("error on genLastSection");}}}function genLastSectionTempCopy(){if(document.getElementById("flightInfo").className==="flightshow"){removeAllChildren("flightInfo");if(document.getElementById("tripMenuID").selectedIndex===1){generateRound();document.getElementById("formSubmit").className="subShow";}else if(document.getElementById("tripMenuID").selectedIndex===2){generateOneWay();document.getElementById("formSubmit").className="subShow";}else if(document.getElementById("tripMenuID").selectedIndex===0){if(document.getElementById("formSubmit").className==="subShow"){document.getElementById("formSubmit").className="";}if(document.getElementById("flightInfo").className==="flightshow"){document.getElementById("flightInfo").className="";}document.getElementById("tripTypeValidation").className="show";}else{alert("error on genLastSection");}}else{document.getElementById("flightInfo").className="flightshow";if(document.getElementById("tripMenuID").selectedIndex===1){generateRound();document.getElementById("formSubmit").className="subShow";}else if(document.getElementById("tripMenuID").selectedIndex===2){generateOneWay();document.getElementById("formSubmit").className="subShow";}else if(document.getElementById("tripMenuID").selectedIndex===0){if(document.getElementById("formSubmit").className==="subShow"){document.getElementById("formSubmit").className="";}if(document.getElementById("flightInfo").className==="flightshow"){document.getElementById("flightInfo").className="";}alert("Please choose Round trip or One way trip");}else{alert("error on genLastSection");}}}function generateOneWay(){document.getElementById("carType").className="show";if(document.getElementById("tripTypeValidation").className==="show"){document.getElementById("tripTypeValidation").className="";}var firstHeader="Esta haciendo una reservacion para un viaje sencillo de "+resType;if($("#otherHotel").css("display")!=="block"){if(document.getElementById("destinoInfo")){document.getElementById("destinoInfo").value=destino;}else{genHiddenField("destinoDiv",destino,"destinoInfo");}}addH3("flightInfo",firstHeader,"resTypeHeader");generateDiv("flightInfo","infoName");genLabel("infoName","Su nombre: ");genInputTextField("infoName","text","product[]","customerName","");generateDiv("flightInfo","nameWarning");generateDiv("flightInfo","infoTransfer");genLabel("infoTransfer","Tipo de viaje: ");var transfer_type=document.createElement("select");transfer_type.name="product[]";transfer_type.id="transferType";createOption(transfer_type,"Escoja uno");createOption(transfer_type,"Llegada");createOption(transfer_type,"Salida");document.getElementById("infoTransfer").appendChild(transfer_type);document.getElementById("transferType").onchange=departureCheck;generateDiv("flightInfo","infoTransferWarning");generateDiv("flightInfo","infoDate");genFlightDateField("infoDate","one_way");$("#one_way").datepicker({beforeShowDay:$.datepicker.restrictDays,minDate:'0d'});generateDiv("flightInfo","infoFlight");genFlightNumField("infoFlight","oneFlightInfo");generateDiv("flightInfo","infoTime");genFlightTimeField("infoTime","oneWayTime");generateDiv("flightInfo","flightWarningMsg");}function generateRound(){document.getElementById("carType").className="show";if(document.getElementById("tripTypeValidation").className==="show"){document.getElementById("tripTypeValidation").className="";}var firstHeader="Esta haciendo una reservacion para un viaje redondo de "+resType;if($("#otherHotel").css("display")!=="block"){if(document.getElementById("destinoInfo")){document.getElementById("destinoInfo").value=destino;}else{genHiddenField("destinoDiv",destino,"destinoInfo");}}addH3("flightInfo",firstHeader,"resTypeHeader");generateDiv("flightInfo","infoName");genLabel("infoName","Your Name: ");genInputTextField("infoName","text","product[]","customerName","");generateDiv("flightInfo","nameWarning");genHiddenField("flightInfo","Arriving","arrivingNote");generateDiv("flightInfo","infoArrivalLabel");genLabel("infoArrivalLabel","INFORMACION DE LLEGADA");generateDiv("flightInfo","infoADate");genFlightDateField("infoADate","aDate");generateDiv("flightInfo","infoAFlight");genFlightNumField("infoAFlight","arrivalFlightInfo");generateDiv("flightInfo","infoATime");genFlightTimeField("infoATime","arrivalTime");generateDiv("flightInfo","ArrivalWarningMsg");genHiddenField("flightInfo","Departing","departingNote");generateDiv("flightInfo","infoDepartureLabel");genLabel("infoDepartureLabel","INFORMACION DE SALIDA");generateDiv("flightInfo","infoDDate");genFlightDateField("infoDDate","dDate");generateDiv("flightInfo","infoDFlight");genFlightNumField("infoDFlight","departureFlightInfo");generateDiv("flightInfo","infoDTime");genFlightTimeField("infoDTime","departureTime");var departureMsg=document.createElement("p");departureMsg.innerHTML="  *La hora que tu vuelo parte de Cancun.";document.getElementById("infoDTime").appendChild(departureMsg);generateDiv("flightInfo","DepartureWarningMsg");$("#aDate").datepicker({beforeShowDay:$.datepicker.restrictDays,minDate:'0d'});$("#dDate").datepicker({beforeShowDay:$.datepicker.restrictDays,minDate:'0d'});}function addH3(divToAdd,Msg,itemId){var header=document.createElement("h3");header.innerHTML=Msg;header.id=itemId;document.getElementById(divToAdd).appendChild(header);}function genFlightDateField(divToAdd,CalID){genLabel(divToAdd,"Fecha");var calField=document.createElement("input");calField.name="product[]";calField.id=CalID;calField.size="16";document.getElementById(divToAdd).appendChild(calField);}function genFlightNumField(divToAdd,flightId){genLabel(divToAdd,"Aerolinea y vuelo");var fInfo=document.createElement("input");fInfo.name="product[]";fInfo.type="text";fInfo.id=flightId;fInfo.size="12";document.getElementById(divToAdd).appendChild(fInfo);}function genFlightTimeField(divToAdd,timeId){genLabel(divToAdd,"Hora");var tInfo=document.createElement("select");tInfo.name="product[]";tInfo.id=timeId+"Hour";createOption(tInfo,"--");createOption(tInfo,"1");createOption(tInfo,"2");createOption(tInfo,"3");createOption(tInfo,"4");createOption(tInfo,"5");createOption(tInfo,"6");createOption(tInfo,"7");createOption(tInfo,"8");createOption(tInfo,"9");createOption(tInfo,"10");createOption(tInfo,"11");createOption(tInfo,"12");document.getElementById(divToAdd).appendChild(tInfo);var mInfo=document.createElement("select");mInfo.name="product[]";mInfo.id=timeId+"Minutes";createOption(mInfo,"--");createOption(mInfo,"00");createOption(mInfo,"05");createOption(mInfo,"10");createOption(mInfo,"15");createOption(mInfo,"20");createOption(mInfo,"25");createOption(mInfo,"30");createOption(mInfo,"35");createOption(mInfo,"40");createOption(mInfo,"45");createOption(mInfo,"50");createOption(mInfo,"55");document.getElementById(divToAdd).appendChild(mInfo);var tInfoAmPm=document.createElement("select");tInfoAmPm.name="product[]";tInfoAmPm.id=timeId+"Ampm";createOption(tInfoAmPm,"--");createOption(tInfoAmPm,"A.M.");createOption(tInfoAmPm,"P.M.");document.getElementById(divToAdd).appendChild(tInfoAmPm);}function generateDiv(divToAdd,divId){var newdiv=document.createElement("div");newdiv.id=divId;document.getElementById(divToAdd).appendChild(newdiv);}function genInputTextField(divToAdd,fieldType,fieldName,fieldId,fieldClass){var newElm=document.createElement("input");newElm.name=fieldName;newElm.type=fieldType;newElm.id=fieldId;newElm.className=fieldClass;document.getElementById(divToAdd).appendChild(newElm);}function departureCheck(){if(document.getElementById("transferType").selectedIndex===0){if(document.getElementById("departureMsg")){deleteElementByID("departureMsg");}}else if(document.getElementById("transferType").selectedIndex===1){if(document.getElementById("departureMsg")){deleteElementByID("departureMsg");}}else if(document.getElementById("transferType").selectedIndex===2){var depMsg=document.createElement("p");depMsg.innerHTML="*La hora que tu vuelo parte de Cancun.";depMsg.id="departureMsg";document.getElementById("infoTime").appendChild(depMsg);}}function removeAllChildren(elementID){var cell=document.getElementById(elementID);if(cell.hasChildNodes()){while(cell.childNodes.length>=1){cell.removeChild(cell.firstChild);}}}function validate(dynform){var name=dynform.customerName.value;if(dynform.one_way){var oneWayDate=dynform.one_way.value;}if(dynform.aDate){var arrivalDate=dynform.aDate.value;}if(dynform.dDate){var departureDate=dynform.dDate.value;}if(dynform.transferType){var tType=dynform.transferType;}if(dynform.oneFlightInfo){var oneFInfo=dynform.oneFlightInfo.value;}if(dynform.arrivalFlightInfo){var arrivalInfo=dynform.arrivalFlightInfo.value;}if(dynform.departureFlightInfo){var departureInfo=dynform.departureFlightInfo.value;}if(dynform.oneWayTime){var oneTime=dynform.oneWayTime.value;}if(dynform.arrivalTime){var aTime=dynform.arrivalTime.value;}if(dynform.departureTime){var dTime=dynform.departureTime.value;}if(dynform.oneWayTimeHour){var oneTimeHour=dynform.oneWayTimeHour.value;}if(dynform.oneWayTimeMinutes){var oneTimeMinutes=dynform.oneWayTimeMinutes.value;}if(dynform.oneWayTimeAmpm){var oneTimeAmpm=dynform.oneWayTimeAmpm.value;}if(dynform.arrivalTimeHour){var aTimeHour=dynform.arrivalTimeHour.value;}if(dynform.arrivalTimeMinutes){var aTimeMinutes=dynform.arrivalTimeMinutes.value;}if(dynform.arrivalTimeAmpm){var aTimeAmpm=dynform.arrivalTimeAmpm.value;}if(dynform.departureTimeHour){var dTimeHour=dynform.departureTimeHour.value;}if(dynform.departureTimeMinutes){var dTimeMinutes=dynform.departureTimeMinutes.value;}if(dynform.departureTimeAmpm){var dTimeAmpm=dynform.departureTimeAmpm.value;}var nameRegex=/^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$/;var emailRegex=/^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;var messageRegex=new RegExp(/<\/?\w+((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>/gim);if(document.getElementById("tripMenuID").selectedIndex==1){if(name===""){eraseRoundWarnings();document.getElementById("nameWarning").innerHTML="Please enter your name";dynform.customerName.focus();return false;}if(!name.match(nameRegex)){eraseRoundWarnings();document.getElementById("nameWarning").innerHTML="You have entered an invalid name";dynform.customerName.focus();return false;}if(arrivalDate===""){eraseRoundWarnings();document.getElementById("ArrivalWarningMsg").innerHTML="Please enter the date of your arrival";document.getElementById("ArrivalWarningMsg").className="showLeft";dynform.aDate.focus();return false;}if((arrivalDate==="December 24, 2008")||(arrivalDate==="December 25, 2008")||(arrivalDate==="December 31, 2008")||(arrivalDate==="January 1, 2009")){eraseRoundWarnings();document.getElementById("ArrivalWarningMsg").innerHTML="Unfortunately, December 24th, 25th, 31st and January 1st are sold out. Please choose a different date from the calendar";document.getElementById("ArrivalWarningMsg").className="showBlue";return false;}if(arrivalInfo===""){eraseRoundWarnings();document.getElementById("ArrivalWarningMsg").innerHTML="Enter Airline Name and Flight Number";document.getElementById("ArrivalWarningMsg").className="show";dynform.arrivalFlightInfo.focus();return false;}if(aTimeHour==="--"){eraseRoundWarnings();document.getElementById("ArrivalWarningMsg").innerHTML="Enter the hour of your flight";document.getElementById("ArrivalWarningMsg").className="showRight";dynform.arrivalTimeHour.focus();return false;}if(aTimeMinutes==="--"){eraseRoundWarnings();document.getElementById("ArrivalWarningMsg").innerHTML="Please Enter the minutes";document.getElementById("ArrivalWarningMsg").className="showRight";dynform.arrivalTimeMinutes.focus();return false;}if(aTimeAmpm==="--"){eraseRoundWarnings();document.getElementById("ArrivalWarningMsg").innerHTML="Please enter AM or PM";document.getElementById("ArrivalWarningMsg").className="showRight";dynform.arrivalTimeAmpm.focus();return false;}if(departureDate===""){eraseRoundWarnings();document.getElementById("DepartureWarningMsg").innerHTML="Enter the date of your departure";document.getElementById("DepartureWarningMsg").className="showLeft";dynform.dDate.focus();return false;}if((departureDate==="December 24, 2008")||(departureDate==="December 25, 2008")||(departureDate==="December 31, 2008")||(departureDate==="January 1, 2009")){eraseRoundWarnings();document.getElementById("DepartureWarningMsg").innerHTML="Unfortunately, December 24th, 25th, 31st and January 1st are sold out. Please choose a different date from the calendar";document.getElementById("DepartureWarningMsg").className="showBlue";return false;}if(departureInfo===""){eraseRoundWarnings();document.getElementById("DepartureWarningMsg").innerHTML="Enter Airline Name and Flight Number";document.getElementById("DepartureWarningMsg").className="show";dynform.departureFlightInfo.focus();return false;}if(dTimeHour==="--"){eraseRoundWarnings();document.getElementById("DepartureWarningMsg").innerHTML="Enter the hour of your flight";document.getElementById("DepartureWarningMsg").className="showRight";dynform.departureTimeHour.focus();return false;}if(dTimeMinutes==="--"){eraseRoundWarnings();document.getElementById("DepartureWarningMsg").innerHTML="Please Enter the minutes";document.getElementById("DepartureWarningMsg").className="showRight";dynform.departureTimeMinutes.focus();return false;}if(dTimeAmpm==="--"){eraseRoundWarnings();document.getElementById("DepartureWarningMsg").innerHTML="Please enter AM or PM";document.getElementById("DepartureWarningMsg").className="showRight";dynform.departureTimeAmpm.focus();return false;}}else if(document.getElementById("tripMenuID").selectedIndex==2){if(name===""){eraseOneWayWarnings();document.getElementById("nameWarning").innerHTML="Please enter your name";dynform.customerName.focus();return false;}if(!name.match(nameRegex)){eraseOneWayWarnings();document.getElementById("nameWarning").innerHTML="You have entered an invalid name";dynform.customerName.focus();return false;}if(tType){if(tType.selectedIndex===0){eraseOneWayWarnings();document.getElementById("infoTransferWarning").innerHTML="Please choose the type of transfer you need";dynform.transferType.focus();return false;}}if(oneWayDate===""){eraseOneWayWarnings();document.getElementById("flightWarningMsg").innerHTML="Please enter the date of your flight";document.getElementById("flightWarningMsg").className="showLeft";dynform.one_way.focus();return false;}if((oneWayDate==="December 24, 2008")||(oneWayDate==="December 25, 2008")||(oneWayDate==="December 31, 2008")||(oneWayDate==="January 1, 2009")){eraseOneWayWarnings();document.getElementById("flightWarningMsg").innerHTML="Unfortunately, December 24th, 25th, 31st and January 1st are sold out. Please choose a different date from the calendar";document.getElementById("flightWarningMsg").className="showBlue";return false;}if(oneFInfo===""){eraseOneWayWarnings();document.getElementById("flightWarningMsg").innerHTML="Enter Airline Name and Flight Number";document.getElementById("flightWarningMsg").className="show";dynform.oneFlightInfo.focus();return false;}if((oneTimeHour==="--")){eraseOneWayWarnings();document.getElementById("flightWarningMsg").innerHTML="Enter the hour of your flight";document.getElementById("flightWarningMsg").className="showRight";dynform.oneWayTimeHour.focus();return false;}if((oneTimeMinutes==="--")){eraseOneWayWarnings();document.getElementById("flightWarningMsg").innerHTML="Please Enter the minutes";document.getElementById("flightWarningMsg").className="showRight";dynform.oneWayTimeMinutes.focus();return false;}if((oneTimeAmpm==="--")){eraseOneWayWarnings();document.getElementById("flightWarningMsg").innerHTML="Please enter AM or PM";document.getElementById("flightWarningMsg").className="showRight";dynform.oneWayTimeAmpm.focus();return false;}}return true;}function eraseOneWayWarnings(){document.getElementById("nameWarning").innerHTML="";document.getElementById("infoTransferWarning").innerHTML="";document.getElementById("flightWarningMsg").innerHTML="";document.getElementById("flightWarningMsg").className="";}function eraseRoundWarnings(){document.getElementById("nameWarning").innerHTML="";document.getElementById("ArrivalWarningMsg").innerHTML="";document.getElementById("DepartureWarningMsg").innerHTML="";document.getElementById("ArrivalWarningMsg").className="";document.getElementById("DepartureWarningMsg").className="";}function cleanBelowFlightInfo(){if($("#tripType").css("display")==="block"){$("#tripType").css({display:"none"});removeAllChildren("tripType");$("#tenPercent").css({display:"none"});}if($("#flightInfo").css("display")==="block"){$("#flightInfo").css({display:"none"});document.getElementById("carType").className="";document.getElementById("formSubmit").className="";removeAllChildren("flightInfo");}}function getValue(hname){if(xhr.readyState===4){if(xhr.status===200){if(xhr.responseXML){var allHotelsVar2=xhr.responseXML.getElementsByTagName("item");for(var i=0;i<allHotelsVar2.length;i++){if(allHotelsVar2[i].getElementsByTagName("label")[0].firstChild.nodeValue==hname){return allHotelsVar2[i].getElementsByTagName("value")[0].firstChild.nodeValue;}}return"error, there was no such hotel in the list";}}else{alert("There was a problem with the request "+xhr.status);}}}function processPaxNum(paxnum){paxnum=processString(paxnum);paxNumber=paxnum;if(paxnum<3){if(document.getElementById("CarInfoId")){deleteElementByID("CarInfoId");genHiddenField("carInfo","Car 1-2 Pax","CarInfoId");}else{genHiddenField("carInfo","Car 1-2 Pax","CarInfoId");}return"1-2 Pax";}else if(paxnum<8){if(document.getElementById("CarInfoId")){deleteElementByID("CarInfoId");genHiddenField("carInfo","Van 3-7 Pax","CarInfoId");}else{genHiddenField("carInfo","Van 3-7 Pax","CarInfoId");}return"3-7 Pax";}else{if(document.getElementById("CarInfoId")){deleteElementByID("CarInfoId");genHiddenField("carInfo","Van 8-10 Pax","CarInfoId");}else{genHiddenField("carInfo","Van 8-10 Pax","CarInfoId");}return"8-10 Pax";}alert("error in processPaxNum");}function populateDestinationMenu(){var destinationMenu=document.createElement("select");destinationMenu.name="product[]";destinationMenu.id="destMenu";var optionToAdd=document.createElement("option");optionToAdd.selected="selected";optionToAdd.innerHTML="Please Select Your Destination";destinationMenu.appendChild(optionToAdd);createOption(destinationMenu,"akumal");createOption(destinationMenu,"boca paila");createOption(destinationMenu,"calica");createOption(destinationMenu,"cancun");createOption(destinationMenu,"chetumal");createOption(destinationMenu,"chichen itza");createOption(destinationMenu,"chiquila");createOption(destinationMenu,"cozumel");createOption(destinationMenu,"holbox");createOption(destinationMenu,"isla mujeres");createOption(destinationMenu,"maroma beach");createOption(destinationMenu,"merida");createOption(destinationMenu,"paamul");createOption(destinationMenu,"paraiso beach");createOption(destinationMenu,"playa del carmen");createOption(destinationMenu,"playa mujeres");createOption(destinationMenu,"playacar");createOption(destinationMenu,"puerto aventuras");createOption(destinationMenu,"puerto juarez");createOption(destinationMenu,"puerto morelos");createOption(destinationMenu,"tankah");createOption(destinationMenu,"tulum");createOption(destinationMenu,"tulum hotel zone");createOption(destinationMenu,"valladolid");createOption(destinationMenu,"xcaret");createOption(destinationMenu,"xpu ha");return destinationMenu;}function createOption(Menu,opt){var optionToAdd=document.createElement("option");optionToAdd.value=opt;optionToAdd.innerHTML=opt;Menu.appendChild(optionToAdd);}function processString(str){if(str.charAt(0)===" "){return str.charAt(0);}else return str.substr(0,2);}function deleteElementByID(elementID){var elementToDelete=document.getElementById(elementID);var parentNode=elementToDelete.parentNode;var nodeVar=parentNode.firstChild;var j=1;if(nodeVar.id===elementID){parentNode.removeChild(parentNode.childNodes[0]);}else{var nodeBro=nodeVar.nextSibling;while(nodeBro.id!=elementID){nodeBro=nodeBro.nextSibling;j++;}parentNode.removeChild(parentNode.childNodes[j]);}}function genHiddenField(divToAdd,infoToSend,fieldId){var info=document.createElement("input");info.name="product[]";info.type="hidden";info.value=infoToSend;info.id=fieldId;document.getElementById(divToAdd).appendChild(info);}function genLabel(divToAdd,labelText){var transTypeLabel=document.createElement("label");transTypeLabel.innerHTML=labelText;document.getElementById(divToAdd).appendChild(transTypeLabel);}function genBreakLine(divToAdd){var bLine=document.createElement("br");document.getElementById(divToAdd).appendChild(bLine);}function attachOffer(pxnum){var offer=pxnum*10;if(offer>50){offer=50;}offerMsg=" ";}function findDiscount(paxnum){if(paxnum<3){sharedCoupon=30;privateCoupon=30;}else if(paxnum<8){sharedCoupon=60;privateCoupon=60;}else{sharedCoupon=60;privateCoupon=90;}}function displayDiscount(num){if(num<=0){return"Free";}else{return"$"+num.toFixed(2);}}function checkExceptions(){var i;for(i=0;i<exception.length;i+=1){if(ChosenHotel===exception[i])return false;}return true;}