$(function() { var SelfechaSalida=false; ordenaCoches(); /* Autocompletador del campo busqueda */ var borraList=true; $('#txt_buscar').autocomplete({ html:true, source:'/integra/coche_destino_autocomplete.asp', minLength:1,delay:0, select: function( event, ui ) { borraList=false; var list_id=document.getElementById('PickupLocationID'); ui.item ? list_id.value=ui.item.id : list_id.value=''; } }); $('#txt_buscar2').autocomplete({ html:true, source:'/integra/coche_destino_autocomplete.asp', minLength:1,delay:0, select: function( event, ui ) { borraList=false; var list_id=document.getElementById('DropoffLocationID'); ui.item ? list_id.value=ui.item.id : list_id.value=''; } }); function resetIDs() { // resetamos id del txtdestino $('#PickupLocationID').val(''); if (borraList) { $('#PickupLocationID').val(''); $('#DropoffLocationID').val(''); } else { borraList=true; } if ($('#IDE').length) { $('#IDE').val('');} } $("#datepicker").datepicker( $.datepicker.regional[ "es" ] ); $("#datepicker").datepicker( "option", "showAnim", "blind" ); $("#PickupDate").datepicker({ minDate: 1, numberOfMonths: 2, onSelect: function( selectedDate ) { var date2 = $('#PickupDate').datepicker('getDate'); date2.setDate(date2.getDate()+1); $( "#DropoffDate" ).datepicker( "option", "minDate", date2 ); if (SelfechaSalida==false) { setTimeout(function() { $('#DropoffDate').datepicker("show") }, 50); } } }); $("#DropoffDate").datepicker({ minDate: 1, numberOfMonths: 2, onSelect: function( selectedDate ) { SelfechaSalida=true; $( "#PickupDate" ).datepicker( "option", "maxDate", selectedDate ); } }); }); function buscaMultiple(obj) { $('#txt_buscar').val( $("#MulRS" + obj).attr("data-name") ) ; $('#PickupLocationID').val ( $("#MulRS" + obj).attr("data-id") ) ; buscacoche(); } function refreshPintaCoches(){ var categorias = $('#campoFiltroCategorias').val() ; if (categorias != '' ) { categorias = ',,' + categorias + ',,'; } var uiSliderMin = parseInt( $( "#slider-range" ).slider( "values", 0 )); var uiSliderMax = parseInt( $( "#slider-range" ).slider( "values", 1 )); var n=0; $( "div[id^='CAR_']" ).each( function( index ) { var oculta = false; var datasort = parseInt( $(this).attr( 'data-sort')); if ( datasort < uiSliderMin ) { oculta=true; } if ( datasort > uiSliderMax ) { oculta=true; } if (categorias != '' ) { var categoria_coche = ',' + $(this).attr('data-cat') + ','; var size_coche = ',' + $(this).attr('data-siz') + ','; if ( !(categorias.indexOf( categoria_coche ) > 0) && !(categorias.indexOf( size_coche ) > 0) ) { oculta=true; } } if ( oculta == true ) { $(this).hide(); } else { $(this).show(); n++; } }); $('#cochesEncontrados').html(n); } function autoBucaCoche(oficina,oficinaID) { $('#txt_buscar').val(oficina); $('#PickupLocationID').val(oficinaID); $("html, body").animate({ scrollTop: $("#formBuscador").offset().top }, 1200, function(){ $("#PickupDate").datepicker("show"); }); } //Sort Ascending by name attribute function ordenaCoches(){ $("#listadocoches>div").tsort({attr:'data-sort'}); }