jQuery(document).ready(function(){
jQuery('#UJS_0').after('<a class="" href="#" onclick="jQuery.ajax({url: \'/franchise/updateOfferGrid/code/VEN-NST/page/0\', success: function(response) { $(&quot;#grid-items&quot;).fadeOut(&quot;fast&quot;, function(){$(&quot;#grid-items&quot;).html(response)});$(&quot;#grid-items&quot;).fadeIn(&quot;fast&quot;);}}); return false;">next</a>');$('#UJS_0').remove();
  $(".finder-element").change(function(){
    $.getJSON("/franchise/updateFranchiseFinderModule?selectedIndustryId=" + $('#industry').val() + "&selectedStateId=" + $('#location').val() + "&selectedInvestment=" + $('#investment').val(),
     {nt: Math.floor(Math.random()*1000001)},
     function(j){
//      $(".finder-element").attr("disabled","disabled");
        var options = '';

        for (var i = 0; i < j['industry'].length; i++) {
            if(j['industry'][i].selected == true)
            {
            selectedId = i +1;
            }
            options += '<option value="' + j['industry'][i].optionValue + '">' + j['industry'][i].optionDisplay + '</option>';
        }
        $("select#industry").html(options);
        $("select#industry option:nth-child(" + selectedId + ")").attr('selected', 'selected');
        var options = '';
        for (var i = 0; i < j['location'].length; i++) {
            if(j['location'][i].selected == true)
            {
                        selectedId = i +1;
            }
            options += '<option value="' + j['location'][i].optionValue + '">' + j['location'][i].optionDisplay + '</option>';
        }
        $("select#location").html(options);
        $("select#location option:nth-child(" + selectedId + ")").attr('selected', 'selected');

        var options = '';
        for (var i = 0; i < j['investment'].length; i++) {
            if(j['investment'][i].selected)
            {
                selectedId = i +1;
            }
            options += '<option value="' + j['investment'][i].optionValue + '">' + j['investment'][i].optionDisplay + '</option>';
        }
        $("select#investment").html(options);
        $("select#investment option:nth-child(" + selectedId + ")").attr('selected', 'selected');
        
//      $(".finder-element").removeAttr("disabled")

        $.ajax({url: "/franchise/updateOfferGrid?selectedIndustryId=" + $('#industry').val() + "&selectedStateId=" + $('#location').val() + "&selectedInvestment=" + $('#investment').val(),
                success: function(response) { $("#grid-items").fadeOut("fast", function(){$("#grid-items").html(response)});$("#grid-items").fadeIn("fast");}
        });
                 
     })
  })
;
$.fn.updateBasketStatus = function(){

  $.ajax({
    url: "/basket/updateBasketStatus",
    success: function(html){
            $('#basket-status').html(html)
  }
  });

}
;
 })