Фильтр товаров
';
for(var key in html_obj) {
html_text = html_text + '
';
$("#af_select_options").children(':first').remove();
$("#af_select_options").append(html_text);
if (typeof(elem) == 'object') {
$.scrollTo($('#af_select_options').offset().top-300,800);
}
if (arr['price_max'] > 0) {
var left_limit = parseInt(arr['price_min']*0.9);
if (left_limit 930192.99) {
right_limit = 930192.99;
}
$('#af_price_slider').trackbar({
onMove : function() {
$('#af_price_from').val(this.leftValue);
$('#af_price_to').val(this.rightValue);
debounceUpdateUnijaxFilterForm($('#af_price_slider'), 1000);
},
onMoveLeft : function(leftOut) {
if (leftOut) {
$('#af_price_from').val(null);
} else {
$('#af_price_from').val(this.leftValue);
}
debounceUpdateUnijaxFilterForm($('#af_price_slider'), 1000);
},
onMoveRight : function(rightOut) {
if (rightOut) {
$('#af_price_to').val(null);
} else {
$('#af_price_to').val(this.rightValue);
}
debounceUpdateUnijaxFilterForm($('#af_price_slider'), 1000);
},
leftLimit : left_limit,
leftValue : arr['price_from'],
leftValueLimit : arr['price_min'],
rightLimit : right_limit,
rightValue : arr['price_to'],
rightValueLimit : arr['price_max']
});
window.price_min = arr['price_min'];
window.price_max = arr['price_max'];
}
});
})(jQuery);
}
function removeSelectOptions(id) {
var input = document.getElementById(id);
input.checked=false;
if (jQuery(input).is(':radio')) {
jQuery('input:radio[name='+jQuery(input).attr('name')+']:nth(0)').attr('checked',true);
}
updateUnijaxFilterForm();
return false;
}
function viewTooltip(elem, mode) {
if (mode=='show') {
jQuery("#af_tooltip").remove();
jQuery("body").append("';
if (key != '') {
html_text = html_text + '
';
}
html_text = html_text + ''+key+':
';
}
html_text = html_text + html_obj[key]+'"+jQuery(elem).next().html()+"
");
jQuery('#af_tooltip')
.css('top',(jQuery(elem).offset().top - 5) + 'px')
.css('left',(jQuery(elem).offset().left + 20) + 'px')
.fadeIn("fast");
} else {
jQuery('#af_tooltip').remove();
}
}
(function($) {
$.fn.trackbar = function(op, id){
op = $.extend({
onMove: function(){},
onMoveLeft: function(leftOut){},
onMoveRight: function(rightOut){},
width: 177,
leftLimit: 0,
leftValue: 0,
leftValueLimit: 0,
rightLimit: 100,
rightValue: 100,
rightValueLimit: 100,
jq: this
},op);
$.trackbar.getObject(id).init(op);
}
$.trackbar = {
archive : [],
getObject : function(id) {
if(typeof id == 'undefined')id = this.archive.length;
if(typeof this.archive[id] == "undefined"){
this.archive[id] = new this.hotSearch(id);
}
return this.archive[id];
}
};
$.trackbar.hotSearch = function(id) {
this.id = id;
this.leftWidth = 0;
this.leftLimitWidth = 0;
this.rightWidth = 0;
this.rightLimitWidth = 0;
this.width = 0;
this.intervalWidth = 0;
this.leftLimit = 0;
this.leftValue = 0;
this.leftValueLimit = 0;
this.rightLimit = 0;
this.rightValue = 0;
this.rightValueLimit = 0;
this.valueInterval = 0;
this.widthRem = 10;
this.valueWidth = 0;
this.roundUp = 0;
this.x0 = 0; this.y0 = 0;
this.blockX0 = 0;
this.rightX0 = 0;
this.leftX0 = 0;
this.moveState = false;
this.moveIntervalState = false;
this.debugMode = false;
this.clearLimits = false;
this.clearValues = true;
this.onMove = null;
this.onMoveLeft = null;
this.onMoveRight = null;
this.leftBlock = null;
this.leftLimitBlock = null;
this.rightBlock = null;
this.rightLimitBlock = null;
this.leftBegun = null;
this.rightBegun = null;
this.centerBlock = null;
this.itWasMove = false;
}
$.trackbar.hotSearch.prototype = {
ERRORS : {
1 : "Ошибка при инициализации объекта",
2 : "Левый бегунок не найден",
3 : "Правый бегунок не найден",
4 : "Левая область ресайза не найдена",
5 : "Правая область ресайза не найдена",
6 : "Не задана ширина области бегунка",
7 : "Не указано максимальное изменяемое значение",
8 : "Не указана функция-обработчик значений",
9 : "Не указана область клика"
},
LEFT_BLOCK_PREFIX : "leftBlock",
RIGHT_BLOCK_PREFIX : "rightBlock",
LEFT_BEGUN_PREFIX : "leftBegun",
RIGHT_BEGUN_PREFIX : "rightBegun",
CENTER_BLOCK_PREFIX : "centerBlock",
gebi : function(id) {
return this.jq.find('#'+id)[0];
},
addHandler : function(object, event, handler, useCapture) {
if (object.addEventListener) {
object.addEventListener(event, handler, useCapture ? useCapture : false);
} else if (object.attachEvent) {
object.attachEvent('on' + event, handler);
} else alert(this.errorArray[9]);
},
defPosition : function(event) {
var x = y = 0;
if (document.attachEvent != null) {
x = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
y = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
}
if (!document.attachEvent && document.addEventListener) {
x = event.clientX + window.scrollX;
y = event.clientY + window.scrollY;
}
return {x:x, y:y};
},
absPosition : function(obj) {
var x = y = 0;
while(obj) {
x += obj.offsetLeft;
y += obj.offsetTop;
obj = obj.offsetParent;
}
return {x:x, y:y};
},
debug : function(keys) {
if (!this.debugMode) return;
var mes = "";
for (var i = 0; i \