/* CREACION DE SUBMITS PARA FORMULARIO ----------------------------------------------------------------------*/ var pdf = function(){ new Insertion.Top('formReseCont',''); document.forms[0].submit(); } var pdf2 = function(){ new Insertion.Top('formconfirm',''); document.forms[0].submit(); } /* COLAPSABLES Y APPEARS GENERALES ---------------------------------------------------------------------------*/ var proto = { calendario : function(){ /*$j.map($j(".cale"),function(e){ $j("#" + e.id).calendar({ autoPopUp: 'both', buttonImageOnly: true,buttonImage: 'https://www.monterilla.cl/templates/default/imag/auxi/auxiCale.gif', buttonText: 'Ícono de calendario para fecha de inicio',firstDay: 1,dayNames: ['D','L','M','M','J','V','S'],monthNames: ['Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agoto','Septiembre','Octubre','Noviembre','Diciembre'],currentText:'Hoy',nextText:'Sig»',prevText:'«Ant',closeText:'Cerrar',clearText:'Limpiar'}); })*/ }, queEsVali : function(){ Effect.toggle('oculVali','appear',{duration:0.4}); }, queSkype : function(){ Effect.toggle('oculSkype','appear',{duration:0.4}); }, oculRss : function(){ Effect.toggle('oculRss','appear',{duration:0.4}); }, oculRssGene : function(){ Effect.toggle('oculRssGene','appear',{duration:0.4}); }, vali : function(){ Effect.toggle('subValida','appear',{duration:0.1}); }, linkRese : function(){ Effect.toggle('oculRese','blind'); }, verCond : function(){ if ($('oculCond').style.display=='none'){ if($('acepEn')){ $('linkCond').innerHTML="(Hide conditions)"; } else{ $('linkCond').innerHTML="(Ocultar condiciones)"; } } else{ if($('acepEn')){ $('linkCond').innerHTML="(View conditions)"; } else{ $('linkCond').innerHTML="(Ver Condiciones)"; } } Effect.toggle('oculCond','blind'); }, verPoli : function(){ if ($('oculPoli').style.display=='none'){ $('linkPoli').style.display='none'; $('strongPoli').style.display=''; } else{ $('linkPoli').style.display=''; $('strongPoli').style.display='none'; } Effect.toggle('oculPoli','blind'); }, paso3 : function(){ if($('acep').checked==true){ $('paso3').disabled=false; $('paso3').addClassName('boton'); $('paso3').removeClassName('botonInac'); } else{ $('paso3').disabled=true; $('paso3').addClassName('botonInac'); $('paso3').removeClassName('boton'); } }, numePasa : function(responseXMLCli){ var item=responseXMLCli.responseXML.documentElement.getElementsByTagName('contenido')[0]; var pasajero=item.getElementsByTagName('pasajero')[0].firstChild.data; if(pasajero==0){ $('numePasa').update('1'); $('plural').update(''); } if(pasajero==1){ $('numePasa').update('1'); $('plural').update(''); } else{ $('numePasa').update(pasajero); $('plural').update('s'); } }, cm: function (texto) { var moneda = ""; texto = parseInt(texto); texto = "" + texto; dec=0; for ( i=(texto.length-1); i>=0 ; i-- ) { if ( dec == 3 ) { moneda = "." + moneda; dec = 1; } else dec++; moneda = texto.charAt(i) + moneda; } moneda = moneda; return moneda; }, adds:function(){ if (!$('oferta')){ $('cargando').hide(); var F = $('formReseCont').serialize(true); var precio=F.habitacion; var dolar=F.dolar; /*calculamos los dias*/ var r = F.intime.split("/"); var e = F.outtime.split("/"); t = Math.floor((new Date(e[2],e[1],e[0]).getTime() - new Date(r[2],r[1],r[0]).getTime()) / (1000*60*60*24)); if (t < 0 || !t){ var t=0;} //alert(e); $('peso').update(proto.cm(precio*t)); $('dolar').update(Math.floor( ( (precio*t) / (119/100) ) /dolar ) ); var h=$('habitacion').selectedIndex; var hab=$('habitacion').options[h].text; if (hab=="Doble Estándar" || hab=="Doble Superior" || hab=="Suite" || hab=="Standard Double" || hab=="Special Double") $('estaPref').show(); else $('estaPref').hide(); var pars = 'pasajeros='+hab; var url = '/getajax.php'; var myAjax = new Ajax.Request( url,{ method: "get", parameters: pars, onComplete: proto.numePasa } ); } } }; /* * Función menuCamp * Función encargada de paginar los contenidos de campanas y promociones full * @param {string} Contienen el elemento [objeto] al que se le ha hecho click */ var porid = { idname: function(e) { if(e.target.id){ if(eval("this."+e.target.id)!=undefined){ eval("this."+e.target.id)(e.target); } } }, menuCont : function(){ $j(".seccCamp").hide(); if(document.URL.match(/#n/)){ url = document.URL.split("#"); $j("#"+url[1]).show(); $j("#link-"+url[1]).parent().addClass("acti"); } else{ $j("#n1").show(); $j("#link-n1").parent().addClass("acti"); } }, linkMenuCont : function(e){ url = e.target.href.split("#"); $j(".seccCamp").hide(); $j("#menuCont li").removeClass("acti"); $j("#"+url[1]).show(); $j("#"+e.target.id).parent().addClass("acti"); }, startImagTop : function(){ $j('.contImag').innerfade({ animationtype: 'fade', speed: 200, timeout: 4000, type: 'random_start', containerheight: '336px' });}, startPlanTop : function(){ $j('.contPlan').innerfade({ animationtype: 'fade', speed: 200, timeout: 4000, type: 'random_start', containerheight: '336px' }); }, stopImagTop : function(e){ clearTimeout(time); $j("#imagThum li").removeClass("acti"); imag = e.target.id.split("-"); $j(".contImag li").fadeOut(200) $j("#"+imag[1]).fadeIn(200); $j("#"+e.target.id).parent().parent().addClass("acti"); }, stopPlanTop : function(e){ clearTimeout(time); $j("#planThum li").removeClass("acti"); imag = e.target.id.split("-"); $j(".contPlan li").fadeOut(200) $j("#"+imag[1]).fadeIn(200); $j("#"+e.target.id).parent().parent().addClass("acti"); } } var porclass = { boxShow : function(e){ var id = e.target.id.split("link-"); $j("#ocul-"+id[1]).fadeIn(500); }, boxHide : function(e){ var id = e.target.id.split("link-"); $j("#ocul-"+id[1]).fadeOut(500); } } /* DETECCION DE EVENTOS GENERALES ------------------------------------------------------------------------*/ var $j = jQuery.noConflict(); //inicializamos todo $j(document).ready( function() { proto.calendario(); $j(".hide").hide(); $j(".cruiOfer").change(function(e){ $j(this).parents('fieldset').children('input[type=submit]').removeAttr('disabled').removeClass('botonInac').addClass('boton'); //$('oferta').disabled=false; //$('oferta').addClassName('boton'); //$('oferta').removeClassName('botonInac'); var entrada = e.target.value; var r = entrada.split("/"); var salida = parseInt(r[0]) + 1 + "/" + r[1] + "/" +r[2]; $j('#outtime1').val(salida); } ); if(document.getElementById("menuCont")){ porid.menuCont(); porid.startImagTop(); porid.startPlanTop(); $j("#menuCont li a").bind("click",function(e){ porid.linkMenuCont(e); return false; }); $j("#imagThum li a").bind("click",function(e){ porid.stopImagTop(e); return false; }); $j("#planThum li a").bind("click",function(e){ porid.stopPlanTop(e); return false; }); } $j(".oci").change(function(e){ if ($('intime_0').selectedIndex!=0){ var intime0=$('intime_0').selectedIndex; $('outtime_0').selectedIndex= intime0; $('oferta_0').disabled=false; $('oferta_0').addClassName('boton'); $('oferta_0').removeClassName('botonInac'); } else{ $('oferta_0').disabled=true; $('oferta_0').addClassName('botonInac'); $('oferta_0').removeClassName('boton'); } /* if ($('intime_1').selectedIndex!=0){ var intime1=$('intime_1').selectedIndex; $('outtime_1').selectedIndex= intime1; $('oferta_1').disabled=false; $('oferta_1').addClassName('boton'); $('oferta_1').removeClassName('botonInac'); } else{ $('oferta_1').disabled=true; $('oferta_1').addClassName('botonInac'); $('oferta_1').removeClassName('boton'); } if ($('intime_2').selectedIndex!=0){ var intime2=$('intime_2').selectedIndex; $('outtime_2').selectedIndex= intime2; $('oferta_2').disabled=false; $('oferta_2').addClassName('boton'); $('oferta_2').removeClassName('botonInac'); } else{ $('oferta_2').disabled=true; $('oferta_2').addClassName('botonInac'); $('oferta_2').removeClassName('boton'); } if ($('intime_3').selectedIndex!=0){ var intime3=$('intime_3').selectedIndex; $('outtime_3').selectedIndex= intime3; $('oferta_3').disabled=false; $('oferta_3').addClassName('boton'); $('oferta_3').removeClassName('botonInac'); } else{ $('oferta_3').disabled=true; $('oferta_3').addClassName('botonInac'); $('oferta_3').removeClassName('boton'); } */ }); if($('queBlogA')){$('queBlogA').href="javascript:;"} if($('queEsVali')){$('queEsVali').href="javascript:;"} if($('queRssGene')){$('queRssGene').href="javascript:;"} if($('subValida')){$('subValida').hide();} if($('oculCond')){$('oculCond').hide();} if($('oculPoli')){$('oculPoli').hide();} if($('linkReseOcul')){$('oculRese').hide();} if($('estaPref')){ var h=$('habitacion').selectedIndex; var hab=$('habitacion').options[h].text; if (hab!="Doble Estándar" && hab!="Doble Superior" && hab!="Suite" && hab!="Standard Double" && hab!="Special Double") $('estaPref').hide(); } $j('.js').bind("click", function(e){porid.idname(e); return false;}); $j('.boxShow').mouseover(function(e){porclass.boxShow(e); return false;}); $j('.boxShow').mouseout(function(e){porclass.boxHide(e); return false;}); /*proto*/ if ($('queEsVali')) Event.observe('queEsVali', 'click', proto.queEsVali); if ($('cerrarVali')) Event.observe('cerrarVali', 'click', proto.queEsVali); if ($('queSkype')) Event.observe('queSkype', 'click', proto.queSkype); if ($('cerrarSkype')) Event.observe('cerrarSkype', 'click', proto.queSkype); if ($('queBlog')) Event.observe('queBlog', 'click', proto.oculRss); if ($('cerrarRss')) Event.observe('cerrarRss', 'click', proto.oculRss); if ($('queRssGene')) Event.observe('queRssGene', 'click', proto.oculRssGene); if ($('cerrarRssGene')) Event.observe('cerrarRssGene', 'click', proto.oculRssGene); if ($('valida')) Event.observe('valida', 'click', proto.vali); if ($('linkReseOcul')) Event.observe('linkReseOcul', 'click', proto.linkRese); if ($('linkCond')) Event.observe('linkCond', 'click', proto.verCond); if ($('linkPoli')) Event.observe('linkPoli', 'click', proto.verPoli); if ($('linkPoliSec')) Event.observe('linkPoliSec', 'click', proto.verPoli); if ($('acep')) Event.observe('acep', 'click', proto.paso3); /*end proto*/ /*formularios calculos*/ /* if ($('intime')) Event.observe('intime', 'click', newcale0); if ($('outtime')) Event.observe('outtime', 'click',newcale1); if ($('testdiv0')) Event.observe('testdiv0', 'click', proto.adds); if ($('testdiv1')) Event.observe('testdiv1', 'click', proto.adds); */ if ($('formReseCont')) new Form.EventObserver($("formReseCont"), proto.adds); /*end formularios calculos*/ if ($('pdf1')) Event.observe('pdf1', 'click', pdf); if ($('pdf2')) Event.observe('pdf2', 'click', pdf2); })