$.oSettings = {}; function setAriaInvalid(){ $('input, select, textarea').attr('aria-invalid','false'); $('.form-control.is-invalid, .was-validated .form-control:invalid').attr('aria-invalid','true'); } (function() { 'use strict'; window.addEventListener('load', function() { var forms = document.getElementsByClassName('needs-validation'); var validation = Array.prototype.filter.call(forms, function(form) { form.addEventListener('submit', function(event) { if (form.checkValidity() === false) { event.preventDefault(); event.stopPropagation(); form.classList.add('was-validated'); setAriaInvalid(); $('input, textarea').on('focusout, blur, keyup', function(){ setAriaInvalid(); }); $("select").change(function(){ setAriaInvalid(); }); $('input[aria-invalid=true], select[aria-invalid=true], textarea[aria-invalid=true]').filter(':first').focus(); } }, false); }); }, false); })(); $(document).ready(function(){ function checkMinYrs(type,minyears,joint) { if (type == 'residence') { if (joint) { fieldsetID = "joint_previous_residence"; years = 'jointyearsatresidence'; months = 'jointmonthsatresidence'; } else { fieldsetID = "previous_residence"; years = 'yearsatresidence'; months = 'monthsatresidence'; } } else if (type == 'employer') { if (joint) { fieldsetID = "joint_previous_employer_information"; years = 'jointemployeryears'; months = 'jointemployermonths'; } else { fieldsetID = "previous_employer_information"; years = 'employeryears'; months = 'employermonths'; } } $('[name=' + years + '],' + '[name=' + months + ']').unbind("change").bind("change", function(event) { checkMinYrs(type,minyears,joint); }); if (fieldsetID) { var currentyears = ($('[name=' + years + ']').val()+'').replace(/\D/g,''); var currentmonths = ($('[name=' + months + ']').val()+'').replace(/\D/g,''); if (!currentyears || isNaN(currentyears)) currentyears = 0; if (!currentmonths || isNaN(currentmonths)) currentmonths = 0; var selector = '#' + fieldsetID + ' input, #' + fieldsetID + ' select, #' + fieldsetID + ' textarea'; $(selector).removeAttr("required").parent("div").siblings("label").removeClass("asterisk"); if (currentyears < minyears) { $(selector).each(function() { if ($(this).is(':visible')) { $(this).prop("required",true).parent("div").siblings("label").addClass("asterisk"); } }); } } } function spouseinfo(){ $("#spousename, #spouseincome").removeAttr("required").parent("div").siblings("label").removeClass("asterisk"); $('#field-spousename,#field-spouseincome').hide(); } spouseinfo(); $.oSettings.Category = { "dealerid":11390 ,"vehTypes":["Commercial Truck","Commercial Van",""] ,"categoryData":{"ATV":{"2004":["Arctic Cat\u00ae","Bombardier\u2122","Honda\u00ae","John Deere","Kawasaki","KYMCO","Polaris\u00ae","Suzuki","Yamaha"],"2005":["AlphaSports","Arctic Cat\u00ae","Bombardier\u2122","Honda\u00ae","John Deere","Kawasaki","KYMCO","Polaris\u00ae","Suzuki","Vento","Yamaha"],"2006":["Arctic Cat\u00ae","Bombardier\u2122","E-TON","Honda\u00ae","John Deere","Kawasaki","KYMCO","Polaris\u00ae","Suzuki","Tomberlin\u2122","United Motors","Vento","Yamaha"],"2007":["Arctic Cat\u00ae","Can-Am\u00ae","E-TON","Honda\u00ae","Hyosung","Kawasaki","KYMCO","Polaris\u00ae","Suzuki","Tomberlin\u2122","United Motors","Vento","Yamaha"],"2008":["Arctic Cat\u00ae","Can-Am\u00ae","E-TON","Honda\u00ae","Hyosung","Kawasaki","KTM","KYMCO","Polaris\u00ae","QLINK","Suzuki","Tomberlin\u2122","United Motors","Yamaha"],"2009":["Arctic Cat\u00ae","Can-Am\u00ae","E-TON","Honda\u00ae","Hyosung","Kawasaki","KTM","KYMCO","Polaris\u00ae","QLINK","Suzuki","Yamaha"],"2010":["Arctic Cat\u00ae","Can-Am\u00ae","Honda\u00ae","Kawasaki","KYMCO","Polaris\u00ae","QLINK","Suzuki","SYM","Yamaha"],"2011":["Arctic Cat\u00ae","Can-Am\u00ae","Honda\u00ae","Kawasaki","KYMCO","Polaris\u00ae","QLINK","Suzuki","Tomberlin\u2122","Yamaha"],"2012":["Arctic Cat\u00ae","Can-Am\u00ae"]},"Commercial Truck":{"2014":["Caterpillar","Chevrolet","Chrysler","E-ONE","Hitachi Construction Machinery","Hydrema","Inter test","Kalmar Ottawa","Nissan","Volkswagen"],"2015":["Chevrolet","E-ONE","GMC","Hitachi Construction Machinery","Kalmar Ottawa","Volkswagen"],"2016":["Ford","Hitachi Construction Machinery","Hydrema","Kalmar Ottawa"],"2017":["Elliott","E-ONE","Ford","Hydrema","Kalmar Ottawa","Terex\u00ae"],"2018":["Elliott","Ford","Hydrema","Kalmar Ottawa"],"2019":["Elliott","Ford","Hydrema","Kalmar Ottawa"]},"Commercial Van":{"2013":["Volkswagen"],"2014":["Chrysler","GMC","Volkswagen"],"2019":["GMC"]},"Motorcycle / Scooter":{"2004":["Aprilia","BMW","Buell","Ducati","Harley-Davidson\u00ae","Honda\u00ae","Kawasaki","KTM","KYMCO","Moto Guzzi","Piaggio","Suzuki","Triumph","Vespa","Victory Motorcycles\u00ae","Yamaha"],"2005":["AlphaSports","American IronHorse","Aprilia","Big Dog","BMW","Buell","Ducati","Harley-Davidson\u00ae","Honda\u00ae","Husqvarna","Kawasaki","KTM","KYMCO","Moto Guzzi","MZ","Norton","Piaggio","Suzuki","Triumph","Ural","Vento","Vespa","Victory Motorcycles\u00ae","Yamaha"],"2006":["American IronHorse","Aprilia","Big Dog","BMW","Buell","Ducati","Honda\u00ae","Husqvarna","Hyosung","Kawasaki","KTM","KYMCO","Moto Guzzi","MV Agusta","Piaggio","Suzuki","Tomberlin\u2122","Triumph","United Motors","Ural","Vento","Vespa","Victory Motorcycles\u00ae","Yamaha"],"2007":["American IronHorse","Aprilia","Big Dog","BMW","Buell","Ducati","E-TON","Honda\u00ae","Husqvarna","Hyosung","Kawasaki","KTM","KYMCO","Moto Guzzi","MV Agusta","Piaggio","Schwinn","Suzuki","Tomberlin\u2122","Triumph","United Motors","Ural","Vento","Vespa","Victory Motorcycles\u00ae","Yamaha"],"2008":["American IronHorse","Aprilia","Big Bear Choppers","Big Dog","BMW","Buell","Can-Am\u00ae","Ducati","E-TON","Fischer","Genuine Scooter Co.","Honda\u00ae","Husaberg","Husqvarna","Hyosung","Kawasaki","KTM","KYMCO","Moto Guzzi","MV Agusta","Piaggio","QLINK","Schwinn","Suzuki","SYM","Tomberlin\u2122","Triumph","United Motors","Ural","Vectrix","Vento","Vespa","Victory Motorcycles\u00ae","Yamaha"],"2009":["Aprilia","Big Bear Choppers","Big Dog","BMW","Buell","Can-Am\u00ae","Ducati","E-TON","Fischer","Genuine Scooter Co.","Honda\u00ae","Husaberg","Husqvarna","Hyosung","Indian Motorcycle\u00ae","Kawasaki","KTM","KYMCO","Lambretta","Moto Guzzi","MV Agusta","Peirspeed","Piaggio","QLINK","Schwinn","Suzuki","SYM","Tomos","Triumph","United Motors","Ural","Vectrix","Vespa","Victory Motorcycles\u00ae","Yamaha"],"2010":["Aprilia","Big Bear Choppers","Big Dog","BMW","Brammo","Buell","California Scooter Co.","Can-Am\u00ae","Ducati","E-TON","Fischer","Flyscooters","Genuine Scooter Co.","Honda\u00ae","Husaberg","Husqvarna","Hyosung","Indian Motorcycle\u00ae","Kawasaki","KTM","KYMCO","Lance","Moto Guzzi","MV Agusta","Peirspeed","Piaggio","QLINK","Saxon Motorcycle","Schwinn","Suzuki","SYM","Tomos","Triumph","Ural","Vectrix","Vespa","Victory Motorcycles\u00ae","Yamaha","Zero"],"2011":["Aprilia","BETA","Big Dog","BMW","Brammo","California Scooter Co.","Can-Am\u00ae","Ducati","Fischer","GAS GAS","Genuine Scooter Co.","Honda\u00ae","Husaberg","Husqvarna","Hyosung","Indian Motorcycle\u00ae","Kawasaki","KTM","KYMCO","Moto Guzzi","MV Agusta","Peirspeed","Piaggio","QLINK","Saxon Motorcycle","Schwinn","Suzuki","Tomos","Triumph","Ural","Vectrix","Vespa","Victory Motorcycles\u00ae","Yamaha","Zero"],"2012":["BETA","BMW","Can-Am\u00ae","Ducati","GAS GAS","Genuine Scooter Co.","Kawasaki","Lance","Moto Guzzi","MV Agusta","Saxon Motorcycle","Suzuki"],"2013":["Victory Motorcycles\u00ae"]},"Personal Watercraft":{"2004":["Honda\u00ae","Kawasaki","Polaris\u00ae","Sea-Doo","Yamaha"],"2005":["Honda\u00ae","Kawasaki","Sea-Doo","Yamaha"],"2006":["Honda\u00ae","Kawasaki","Sea-Doo","Yamaha"],"2007":["Honda\u00ae","Kawasaki","Sea-Doo","Yamaha"],"2008":["Honda\u00ae","Kawasaki","Sea-Doo","Yamaha"],"2009":["Honda\u00ae","Kawasaki","Sea-Doo","Yamaha"],"2010":["Kawasaki","Sea-Doo","Yamaha"],"2011":["Kawasaki","Sea-Doo","Yamaha"],"2012":["Kawasaki","Sea-Doo"]},"Snowmobile":{"2004":["Arctic Cat\u00ae","Polaris\u00ae","Ski-Doo","Yamaha"],"2005":["Arctic Cat\u00ae","Polaris\u00ae","Ski-Doo","Yamaha"],"2006":["Arctic Cat\u00ae","Polaris\u00ae","Ski-Doo","Yamaha"],"2007":["Arctic Cat\u00ae","Polaris\u00ae","Ski-Doo","Yamaha"],"2008":["Arctic Cat\u00ae","Polaris\u00ae","Ski-Doo","Yamaha"],"2009":["Arctic Cat\u00ae","Polaris\u00ae","Ski-Doo","Yamaha"],"2010":["Arctic Cat\u00ae","Polaris\u00ae","Ski-Doo","Yamaha"],"2011":["Arctic Cat\u00ae","Polaris\u00ae","Ski-Doo","Yamaha"],"2012":["Arctic Cat\u00ae","Ski-Doo","Yamaha"],"2013":["Arctic Cat\u00ae","Ski-Doo","Yamaha"]},"Utility Vehicle":{"2005":["Bombardier\u2122","John Deere","Kawasaki","Kubota","Polaris\u00ae","Suzuki","Yamaha"],"2006":["Arctic Cat\u00ae","Cub Cadet","John Deere","Kawasaki","Kubota","Land Pride","Polaris\u00ae","Yamaha"],"2007":["Arctic Cat\u00ae","Cub Cadet","E-TON","John Deere","Kawasaki","Kubota","Land Pride","Polaris\u00ae","Yamaha"],"2008":["Arctic Cat\u00ae","Cub Cadet","E-TON","John Deere","Kawasaki","Kubota","Land Pride","Polaris\u00ae","QLINK","United Motors","Yamaha"],"2009":["Arctic Cat\u00ae","Cub Cadet","Honda\u00ae","John Deere","Kawasaki","Kubota","KYMCO","Polaris\u00ae","QLINK","Yamaha"],"2010":["Arctic Cat\u00ae","Bobcat\u00ae","Cub Cadet","Honda\u00ae","John Deere","Kawasaki","Kubota","KYMCO","New Holland","Polaris\u00ae","QLINK"],"2011":["Arctic Cat\u00ae","Bobcat\u00ae","Can-Am\u00ae","Case IH","Cub Cadet","Honda\u00ae","John Deere","Kawasaki","KIOTI","Kubota","KYMCO","New Holland","Polaris\u00ae","QLINK","Yamaha"],"2012":["Arctic Cat\u00ae","Cub Cadet","John Deere","Kubota"]}} ,"categoryList":{"Commercial Truck":[{"id":358,"bodySubType":"Boom"},{"id":357,"bodySubType":"Box"},{"id":7746,"bodySubType":"Cab & Chassis"},{"id":362,"bodySubType":"Cargo"},{"id":360,"bodySubType":"Dump"},{"id":361,"bodySubType":"Flatbed"},{"id":359,"bodySubType":"Service"}],"Commercial Van":[{"id":356,"bodySubType":"Cargo"}]} }; $.oSettings.dealershipurl = "https://www.sunstatebuscenters.com/"; $("#previous_employer_information, #joint_previous_employer_information").prop("disabled", true).hide(); $.oSettings.SelectVehTypeOpt = $('#category').not('.customoptions').html(); $.oSettings.SelectMakeOpt = $('#make').not('.customoptions').html(); $.oSettings.SelectModelOpt = $('#model').not('.customoptions').html(); // Populate Vehicle Types $.oSettings.vehtypeOptions = ""; var vTypesArray = new Array(); $.oSettings.Category.vehTypes.sort(); $.each($.oSettings.Category.vehTypes, function(key, vehtype){ if(vehtype != '' && $.inArray(vehtype, vTypesArray) == -1){ $.oSettings.vehtypeOptions += ''; vTypesArray.push(vehtype); } }); $.each($.oSettings.Category.categoryData, function(vehtype,value){ $.oSettings.Category.categoryData[vehtype] = null; $.oSettings.Category.categoryData[vehtype.toLowerCase()] = value; }); if($.oSettings.vehtypeOptions) $('#category').not('.customoptions').html($.oSettings.SelectVehTypeOpt+$.oSettings.vehtypeOptions); switchIndividualJoint($('#applicationtype').val()); $('select.select-applicationtype').change(function(){ switchIndividualJoint($(this).val()); }); function switchIndividualJoint(this_val){ if(this_val != 'Joint'){ this_val = 'Individual'; } $('select.select-applicationtype').val(this_val); if($('#applicationtype').val() == 'Joint'){ $('.joint-app-element').not('#joint_previous_employer_information').show(); $('.joint-app-element input, .joint-app-element select, .joint-app-element textarea').prop('disabled', false); }else{ $('.joint-app-element').hide(); $('.joint-app-element input, .joint-app-element select, .joint-app-element textarea').prop('disabled', true); } } $('#switch-make-field').click(function(){ switchSelectText('make'); }); $('#switch-model-field').click(function(){ switchSelectText('model'); }); $('#category,#makeyear,#make').change(function(){ loadMakesModels(); }); function switchSelectText(fieldname){ $('#model,#modeltxt').val(''); if(fieldname == 'make') $('#make,#maketxt').val(''); var field = $('#field-' + fieldname); if(field.hasClass('display-select')){ field.removeClass('display-select'); if(fieldname == 'make') $('#field-model').removeClass('display-select'); }else if($('#' + fieldname).find('option').length > 1){ field.addClass('display-select'); } switchSelectTextDisable(); } function switchSelectTextDisable(){ $('#make:not([readonly]),#maketxt:not([readonly]),#model:not([readonly]),#modeltxt:not([readonly])').prop('disabled', false); if($('#field-make').hasClass('display-select')){ $('#maketxt:not([readonly])').prop('disabled', true); $('label#makelabel').attr('for','make'); }else{ $('#make:not([readonly])').prop('disabled', true); $('label#makelabel').attr('for','maketxt'); } if($('#field-model').hasClass('display-select')){ $('#modeltxt:not([readonly])').prop('disabled', true); $('label#modellabel').attr('for','model'); }else{ $('#model:not([readonly])').prop('disabled', true); $('label#modellabel').attr('for','modeltxt'); } } function cleankey(str){ var output = ((str === undefined || str === null || str == '') ? '' : str) + ""; output = output.toLowerCase(); output = $("
").html(output).text(); output = output.replace(/\W+/g,""); return output; } function loadMakesModels(){ $.oSettings.selectedYear = $('#makeyear').val(); $.oSettings.selectedMake = $('#make:visible').val() || ''; $.oSettings.selectedModel = $('#model:visible').val() || ''; $("#make").not('.customoptions').html($.oSettings.SelectMakeOpt); $("#model").not('.customoptions').html($.oSettings.SelectModelOpt); $.oSettings.selectedVehType = ($('#category').val() + '').toLowerCase(); // Populate Makes if($("select#make.customoptions").length <= 0){ $.oSettings.makeOptions = ''; $('#field-make').removeClass('display-select'); if($.oSettings.Category.categoryData[$.oSettings.selectedVehType] && $.oSettings.Category.categoryData[$.oSettings.selectedVehType][$.oSettings.selectedYear]){ if(($.oSettings.selectedVehType.length > 0) && ($.oSettings.selectedYear.length > 0)){ $.each($.oSettings.Category.categoryData[$.oSettings.selectedVehType][$.oSettings.selectedYear],function(key,make){ if(make) $.oSettings.makeOptions += ''; }); } }else{ $('#field-make, #field-model').removeClass('display-select'); } if($.oSettings.makeOptions){ $("#make").not('.customoptions').html($.oSettings.SelectMakeOpt + $.oSettings.makeOptions); $('#field-make').addClass('display-select'); }else{ $('#field-make').removeClass('display-select'); } } // Populate Models if($("select#model.customoptions").length <= 0){ $('#field-model').removeClass('display-select'); $.getJSON("incfiles/GetMakesModels.php",{ "dealershipurl":$.oSettings.dealershipurl ,"type":($('#category').val() ? encodeURIComponent($('#category').val()) : "") ,"year":($('#makeyear').val() ? encodeURIComponent($('#makeyear').val()) : "") ,"make":($('#make').val() ? encodeURIComponent($('#make').val()) : "") },function(j){ $.oSettings.modelOptions = ''; if (j && j.length > 0){ for (var i = 0; i < j.length; i++) { var model = j[i].modeltrim.replace(/ Base$/,""); $.oSettings.modelOptions += ''; } } if($.oSettings.modelOptions){ $('#model').not('.customoptions').html($.oSettings.SelectModelOpt + $.oSettings.modelOptions); $('#field-model').addClass('display-select'); }else{ $('#field-model').removeClass('display-select'); } switchSelectTextDisable(); }); } switchSelectTextDisable(); } loadMakesModels(); });