var searchstarted = 0; var current_ser = ""; function uf(){ if (!searchstarted){ searchstarted = 1; return; } var ser = $('#searchform').serialize(); if (ser != current_ser){ //update count $('#wizard_matchcount').html('   '); $.ajax({ url: '/matchcount.php', data:ser, success: function(data){ $('#wizard_matchcount').html(data); $('#wizard_matchcount_frame').addClass('active'); } }); } current_ser = ser; } $(function () { var msie6 = $.browser == 'msie' && $.browser.version < 7; if (!msie6) { var top = $('#wizard_matchcount_frame').offset().top - parseFloat($('#wizard_matchcount_frame').css('margin-top').replace(/auto/, 0)); $(window).scroll(function (event) { // what the y position of the scroll is var y = $(this).scrollTop(); // whether that's below the form if (y >= top) { // if so, ad the fixed class $('#wizard_matchcount_frame').addClass('fixed'); } else { // otherwise remove it $('#wizard_matchcount_frame').removeClass('fixed'); } }); } }); $(document).ready(function() { //uf(); });