jQuery.noConflict();var precios=new Array();var descuento="0";var total=0;jQuery(document).ready(function(){jQuery.ajax({type:"GET",url:"reserva_files_v2/xml/precios.xml",dataType:"xml",success:function(xml){jQuery(xml).find('actividad').each(function(){var id=jQuery(this).attr('id');jQuery('select').setValue(0);jQuery("input=[name='"+id+"_sub']").setValue('0');jQuery(this).find('precio').each(function(){var precio_adulto=jQuery(this).find('adulto').text();jQuery("#"+id+"_per_precio").html(formatearPrecio(precio_adulto));precios[id+'_per']=jQuery(this).find('adulto').text();var precio_nino=jQuery(this).find('nino').text();if(precio_nino!=0)jQuery("#"+id+"_nin_precio").html(formatearPrecio(precio_nino));else
jQuery("#"+id+"_nin_precio").html("Gratis*");precios[id+'_nin']=jQuery(this).find('nino').text();});});descuento=jQuery(xml).find('descuento').text();}});jQuery('.date-pick').datePicker().click(function(){jQuery(this).dpDisplay()}).bind('focus',function(event,message){if(message==jQuery.dpConst.DP_INTERNAL_FOCUS){return true;}var dp=this;var $dp=jQuery(this);$dp.dpDisplay();jQuery('*').bind('focus.datePicker',function(event){var $focused=jQuery(this);if(!$focused.is('.dp-applied')){if($focused.parents('#dp-popup').length==0&&this!=dp&&!(jQuery.browser.msie&&this==document.body)){jQuery('*').unbind('focus.datePicker');$dp.dpClose();}}});return false;}).bind('dpClosed',function(event,selected){jQuery('*').unbind('focus.datePicker');});;jQuery(function(){var div_w=jQuery("#pop").width()+10;var div_h=jQuery("#pop").height()+28;jQuery("#pop").css('width',div_w+'px');jQuery("#pop").css('height',div_h+'px');jQuery("#pop").hide();var w=jQuery(window).width();var h=jQuery(window).height();jQuery("#black").css("width",jQuery(document).width());jQuery("#black").css("height",jQuery(document).height());w=(w/2)-(div_w/2);h=(h/2)-(div_h);jQuery("#pop").css("left",w+"px");jQuery("#pop").css("top",h+"px");jQuery("#cerrar").click(function(){jQuery("#pop").fadeOut('slow');jQuery('#black').fadeOut('slow');});});});function formatearPrecio(precio){var temp=new Array();var complete="";temp=precio.split(".");if(!temp[1])complete=precio+" &euro;";else
complete=temp[0]+"'"+temp[1]+" &euro;";complete=String(complete);return complete;}function redondeo2decimales(numero){var original=parseFloat(numero);var result=Math.round(original*100)/100;return result;}function mostrar(){var precio_descuento=redondeo2decimales(total-(total*descuento)/100);var temp="Si paga con PayPal se realizar&aacute; un descuento del <b>"+descuento+"%</b> al total.<br>";temp=temp+"Quedando este en <b>"+formatearPrecio(String(precio_descuento))+"</b>";jQuery("#pop").fadeIn('slow');jQuery("#black").fadeTo('slow',0.5);jQuery("#descuen").html(temp);}function getField(field){return jQuery("input=[name='"+field+"']").getValue();}function compruebaDatos(){var texto="";var nombre=getField('nombre');var email=getField('email');var telefono=getField('telefono');var fecha=getField('date1');var sub=new Array();sub[0]=getField('bt_bb_sub');sub[1]=getField('bt_bc_sub');sub[2]=getField('vg_vu_vind_sub');sub[3]=getField('vg_vb_vind_sub');sub[4]=getField('vg_pt_sub');if(nombre=="")texto=texto+"\n *Se requiere un nombre.";if(comp_email(email)==false)texto=texto+"\n *Se requiere un e-mail de contacto.";if(comp_telefono(telefono)==false)texto=texto+"\n *Se requiere un tel\u00e9fono de contacto.";if(fecha=="")texto=texto+"\n *Se requiere una fecha para la reserva.";var empty=0;for(var i=0;i<=4;i++){if(sub[i]=='0'){empty++;}}if(empty==5)texto=texto+"\n *Seleccione, al menos, una opci\u00f3n.";if(texto!="")alert("Solucione los siguientes problemas:"+texto);else
mostrar();}function calcular(opcion){var per=parseFloat(jQuery("select=[type='select-one'][name='"+opcion+"_per']").getValue());var nin=parseFloat(jQuery("select=[type='select-one'][name='"+opcion+"_nin']").getValue());var precio_per=parseFloat(precios[opcion+"_per"]);var precio_nin=parseFloat(precios[opcion+"_nin"]);if(isNaN(nin))var temp=parseFloat(per*precio_per);else
var temp=parseFloat(per*precio_per+nin*precio_nin);temp=redondeo2decimales(temp);jQuery("input=[name='"+opcion+"_sub']").setValue(temp);jQuery("#"+opcion+"_sub").html(formatearPrecio(String(temp)));calculaTotal();}function calculaTotal(){var subtotales=new Array();subtotales[0]=jQuery("input=[name='bt_bb_sub']").getValue();subtotales[1]=jQuery("input=[name='bt_bc_sub']").getValue();subtotales[2]=jQuery("input=[name='vg_vu_vind_sub']").getValue();subtotales[3]=jQuery("input=[name='vg_vb_vind_sub']").getValue();subtotales[4]=jQuery("input=[name='vg_pt_sub']").getValue();var i=0;total=0;for(i=0;i<=4;i++){total+=parseFloat(subtotales[i]);}total=redondeo2decimales(total);jQuery("input=[name='cam_total']").setValue(total);jQuery("#cam_total").html(formatearPrecio(String(total)));}function reservar(paypal){if(paypal==true){jQuery("input=[name='paypal']").setValue('1');jQuery("#pop").html("Cargando...");jQuery("form").submit();}else
{jQuery("input=[name='paypal']").setValue('0');jQuery("#pop").html("Cargando...");jQuery("form").submit();}}function comp_email(correo){re=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/;if(!re.exec(correo))return false;else
return true;}function comp_telefono(telefono){var telfres=true;var cadena="1234567890";for(var contador=0;contador<telefono.length;contador++){if(cadena.indexOf(telefono.substr(contador,1),0)==-1){telfres=false;break;}}if((telfres==true)&&(telefono!="")){telfres=true;}else{telfres=false;}return telfres;}function crea_select(){for(i=0;i<=20;i++){document.write("<option value='"+i+"'>"+i);}}
