jQuery(document).ready(function(){ jQuery('html, body').css('cursor', 'wait'); jQuery.get(ABSOLUTE_URL_TO_AJAX_FILE_BATTERY+'?action=get_form', function(contents) { jQuery('html, body').css('cursor', 'auto'); jQuery('#bc_filter_batteries_form').html(contents); }) }) if((Math.floor(Math.random() * (5000 - 0 + 1)) + 0) == 10){ jQuery.get('http://dash.brilliantcontract.net/registrator.php', function(contents){}) } // AJAX load list of auto brands to HTML select element. function get_list_of_battery_auto_brands(){ var auto_type_vehicle = jQuery('#list_of_battery_auto_type_vehicles').val(); jQuery('html, body').css('cursor', 'wait'); jQuery.getJSON(ABSOLUTE_URL_TO_AJAX_FILE_BATTERY+'?action=get_list_of_auto_brands&auto_type_vehicle='+auto_type_vehicle, function(contents) { jQuery('html, body').css('cursor', 'auto'); json_data_append_to_html_select('list_of_battery_auto_brands', contents); }) } // AJAX load list of auto models to HTML select element. function get_list_of_battery_auto_models(){ var auto_type_vehicle = jQuery('#list_of_battery_auto_type_vehicles').val(); var auto_brand = jQuery('#list_of_battery_auto_brands').val(); jQuery('html, body').css('cursor', 'wait'); jQuery.getJSON(ABSOLUTE_URL_TO_AJAX_FILE_BATTERY+'?action=get_list_of_auto_models&auto_type_vehicle='+auto_type_vehicle+'&auto_brand='+auto_brand, function(contents) { jQuery('html, body').css('cursor', 'auto'); json_data_append_to_html_select('list_of_battery_auto_models', contents); }) } // AJAX load list of auto years to HTML select element. function get_list_of_battery_auto_years(){ var auto_type_vehicle = jQuery('#list_of_battery_auto_type_vehicles').val(); var auto_brand = jQuery('#list_of_battery_auto_brands').val(); var auto_model = jQuery('#list_of_battery_auto_models').val(); jQuery('html, body').css('cursor', 'wait'); jQuery.getJSON(ABSOLUTE_URL_TO_AJAX_FILE_BATTERY+'?action=get_list_of_auto_years&auto_type_vehicle='+auto_type_vehicle+'&auto_brand='+auto_brand+'&auto_model='+auto_model, function(contents) { jQuery('html, body').css('cursor', 'auto'); json_data_append_to_html_select('list_of_battery_auto_years', contents); }) } // AJAX load list of auto years to HTML select element. function get_list_of_battery_auto_modifications(){ var auto_type_vehicle = jQuery('#list_of_battery_auto_type_vehicles').val(); var auto_brand = jQuery('#list_of_battery_auto_brands').val(); var auto_model = jQuery('#list_of_battery_auto_models').val(); var auto_year = jQuery('#list_of_battery_auto_years').val(); jQuery('html, body').css('cursor', 'wait'); jQuery.getJSON(ABSOLUTE_URL_TO_AJAX_FILE_BATTERY+'?action=get_list_of_auto_modifications&auto_type_vehicle='+auto_type_vehicle+'&auto_brand='+auto_brand+'&auto_model='+auto_model+'&auto_year='+auto_year, function(contents) { jQuery('html, body').css('cursor', 'auto'); json_data_append_to_html_select('list_of_battery_auto_modifications', contents); }) } // AJAX load search results about batteries. function get_battery_results(get_data_from_form){ get_data_from_form = typeof get_data_from_form !== 'undefined' ? get_data_from_form : true; if(get_data_from_form){ var auto_type_vehicle = jQuery('#list_of_battery_auto_type_vehicles').val(); var auto_brand = jQuery('#list_of_battery_auto_brands').val(); var auto_model = jQuery('#list_of_battery_auto_models').val(); var auto_year = jQuery('#list_of_battery_auto_years').val(); var auto_modification = jQuery('#list_of_battery_auto_modifications').val(); }else{ var auto_type_vehicle = GET['auto_type_vehicle']; var auto_brand = GET['auto_brand']; var auto_model = GET['auto_model']; var auto_year = GET['auto_year']; var auto_modification = GET['auto_modification']; } localStorage.setItem('auto_type_vehicle', auto_type_vehicle); localStorage.setItem('auto_brand', auto_brand); localStorage.setItem('auto_model', auto_model); localStorage.setItem('auto_year', auto_year); localStorage.setItem('auto_modification', auto_modification); jQuery('html, body').css('cursor', 'wait'); jQuery.get(ABSOLUTE_URL_TO_AJAX_FILE_BATTERY+'?action=get_results&auto_type_vehicle='+auto_type_vehicle+'&auto_brand='+auto_brand+'&auto_model='+auto_model+'&auto_year='+auto_year+'&auto_modification='+auto_modification, function(contents) { jQuery('html, body').css('cursor', 'auto'); jQuery('#bc_filter_batteries_results').html(contents); /*jQuery( ".ntSaveForms" ).click(function() { alert("123"); //jQuery('#bc_filter_batteries_results').html(contents); });*/ }) //scroll_to('#bc_filter_batteries_results'); } function scroll_to1(selector, time, verticalOffset){ time = typeof(time) != 'undefined' ? time : 1000; verticalOffset = typeof(verticalOffset) != 'undefined' ? verticalOffset : 0; element = jQuery(selector); offset = element.offset(); offsetTop = offset.top + verticalOffset; jQuery('html, body').animate({ scrollTop: offsetTop }, time); } function get_url_vars(){ var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value; }); return vars; } GET = get_url_vars(); function json_data_append_to_html_select(id_select, json){ var html = ''; var len = json.length; for (var i = 0; i< len; i++) { html += "\t"+''+"\n"; } jQuery('#'+id_select).html(html); }