function rem(id) {
$("#"+id).prop('checked', false);
$("#dd_"+id).remove();
hideNotUsed();
}
$(function() {
hideNotUsed();
if (findBootstrapEnvironment() != "xs") {
var element = $('.follow-scroll'),
originalY = element.offset().top;
// Space between element and top of screen (when scrolling)
var topMargin = 20;
// Should probably be set in CSS; but here just for emphasis
element.css('position', 'relative');
$(window).on('scroll', function (event) {
var scrollTop = $(window).scrollTop();
element.stop(false, false).animate({
top: scrollTop < originalY
? 0
: scrollTop - originalY + topMargin
}, 300);
});
}
$(":checkbox").change(function(){
var id = this.id;
var type = id.substring(0, id.lastIndexOf('_'));
var item_id = id.substring(id.lastIndexOf('_') + 1 );
if(this.checked)
$("#"+type+"-search").append("
"+ $("#lb_" + id).text() +"");
else
$("#dd_" + id).remove();
hideNotUsed();
});
$("#clear-case_width").click(function(){
$("#case_width_from").val("");
$("#case_width_to").val("");
});
$("#clear-price").click(function(){
$("#price_from").val("");
$("#price_to").val("");
$("$special")
});
$(":checked").trigger("change");
});
function hideNotUsed()
{
$("dl[id$='-search']").each( function() {
$(this).hide();
});
$("input:checked").each(function () {
$("#" + this.id.substring(0, this.id.lastIndexOf('_')) + "-search").show();
});
}
function clearChks(panel) {
$("#" + panel).find(':checkbox').each(function(){
$(this).attr('checked', false).trigger( "change" );
});
}
function findBootstrapEnvironment() {
var envs = ['xs', 'sm', 'md', 'lg'];
$el = $('');
$el.appendTo($('body'));
for (var i = envs.length - 1; i >= 0; i--) {
var env = envs[i];
$el.addClass('hidden-' + env);
if ($el.is(':hidden')) {
$el.remove();
return env
}
}
}