$(document).ready(function(){ if ($('#value-me').length != 0) { GetNewCaptcha(); } if ($('#perpage').length != 0) { /* Paging */ $("#perpage").change(function() { document.perpageform.submit(); }); } /* Search Options - Used Motorhomes, New Motorhomes & Used Cars */ $('#MakeDropDown').live('change', function(event) { $.ajax({ url : '/fetchmodels-new.asp', beforeSend:function() { //alert($('#quicksearch').serialize()); $('#wait').show(); }, type : 'GET', dataType : 'html', data : $('#quicksearch').serialize(), error: function(data) { alert ('ERROR: ' + data); }, success: function( data ) { //alert(data); //console.log('New Model loaded'); $('#ModelDropDown').replaceWith(data); $('#wait').delay(4000).hide(); // $.uniform.update("#ModelDropDown"); } }); }); $('.typeSelect,#branchID,#webSection,#vTypeSelect').live('click change', function(event) { //var thebranchID=$(this).attr('rel'); // var theVTypeIDa=$(this).attr('id'); // var theVTypeID = theVTypeIDa.replace(/[^\d]+/,''); // // // var $target = $(event.target); // if ( $target.is('.typeSelect') ) { // // $('#vType').val(theVTypeID); // //$('#branchID').val(thebranchID); // $('.selected').removeClass('selected'); // $(this).addClass('selected'); // } $vType_owners=$('#vTypeSelect').val(); var exploded = $vType_owners.split('-'); var theVTypeID =exploded[0]; var theOwnersID =exploded[1]; //alert(theVTypeID + ' - ' + theOwnersID); $('#vType').val(theVTypeID); $('#owners').val(theOwnersID); $.ajax({ url : '/fetchmakes-new.asp', beforeSend:function() { //alert($('#quicksearch').serialize()); $('#wait').show(); }, type : 'GET', dataType : 'html', data : $('#quicksearch').serialize(), error: function(data) { //alert ('ERROR MAKE: ' + data); }, success: function( data ) { //alert(data); $('#MakeDropDown').replaceWith(data); //console.log('New Makes laoded'); $.ajax({ url : '/fetchmodels-new.asp', beforeSend:function() { //alert($('#quicksearch').serialize()); }, type : 'GET', dataType : 'html', data : $('#quicksearch').serialize(), error: function(data) { //alert ('ERROR MODEL: ' + data); }, success: function( data ) { //alert(data); $('#ModelDropDown').replaceWith(data); $('#wait').delay(1200).hide(); //console.log('New Models loaded'); } }); } }); return false; }); ///live count $('.typeSelect,#quicksearch select').live('change click', function(event) { $.ajax({ url : '/getstockcount.asp', beforeSend:function() { //alert($('#quicksearch').serialize()); $('#wait').show(); }, type : 'GET', dataType : 'html', data : $('#quicksearch').serialize(), error: function(data) { alert ('ERROR: ' + data); }, success: function( data ) { //alert(data); //console.log('New Model loaded'); //$('#thecount').replaceWith(data); $('#livecount').replaceWith(data); $('#wait').delay(1200).hide(); // $.uniform.update("#ModelDropDown"); } }); }); /* Make model search */ GetModels(0); })