function setWord(l, a, r, b) {
   document.getElementById(a).value = l;
   document.getElementById(b).value = r}
$.fn.trackbar = function(a) {
   a = $.extend( {
      onMove : function() {
         }
      , dual : true, width : 250, leftLimit : 0, leftValue : 500, rightLimit : 5000, rightValue : 1500, jq : this}
   , a);
   $.trackbar.getObject().init(a)};
$.trackbar = {
   archive : [], getObject : function(a) {
      if(typeof a == 'undefined') {
         a = this.archive.length}
      if(typeof this.archive[a] == "undefined") {
         this.archive[a] = new this.hotSearch(a)}
      return this.archive[a]}
   };
$.trackbar.hotSearch = function(a) {
   this.id = a;
   this.leftWidth = 0;
   this.rightWidth = 0;
   this.width = 0;
   this.intervalWidth = 0;
   this.leftLimit = 0;
   this.leftValue = 0;
   this.rightLimit = 0;
   this.rightValue = 0;
   this.valueInterval = 0;
   this.widthRem = 6;
   this.valueWidth = 0;
   this.roundUp = 0;
   this.x0 = 0;
   this.y0 = 0;
   this.blockX0 = 0;
   this.rightX0 = 0;
   this.leftX0 = 0;
   this.dual = true;
   this.moveState = false;
   this.moveIntervalState = false;
   this.debugMode = false;
   this.clearLimits = false;
   this.clearValues = false;
   this.onMove = null;
   this.leftBlock = null;
   this.rightBlock = 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(a) {
      return this.jq.find('#' + a)[0]}
   , addHandler : function(a, b, c, d) {
      if(a.addEventListener) {
         a.addEventListener(b, c, d ? d : false)}
      else if(a.attachEvent) {
         a.attachEvent('on' + b, c)}
      else {
         alert(this.errorArray[9])}
      }
   , defPosition : function(a) {
      var x = 0;
      var y = 0;
      if(document.attachEvent) {
         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 = a.clientX + window.scrollX;
         y = a.clientY + window.scrollY}
      return {
         x : x, y : y}
      }
   , absPosition : function(a) {
      var x = 0;
      var y = 0;
      while(a) {
         x += a.offsetLeft;
         y += a.offsetTop;
         a = a.offsetParent}
      return {
         x : x, y : y}
      }
   , debug : function(a) {
      if(!this.debugMode) {
         return}
      var b = "";
      for(var i = 0; i < a.length; i++) {
         b += this.ERRORS[a[i]] + " : "}
      b = b.substring(0, b.length - 3);
      alert(b)}
   , init : function(b) {
      try {
         this.dual = typeof b.dual != "undefined" ?!!b.dual : this.dual;
         this.leftLimit = b.leftLimit || this.leftLimit;
         this.rightLimit = b.rightLimit || this.rightLimit;
         this.width = b.width || this.width;
         this.onMove = b.onMove || this.onMove;
         this.clearLimits = b.clearLimits || this.clearLimits;
         this.clearValues = b.clearValues || this.clearValues;
         this.roundUp = b.roundUp || this.roundUp;
         this.jq = b.jq;
         this.jq.html('<table' + (this.width ? ' style="width:' + this.width + 'px;"':'') + 'class="trackbar" onSelectStart="return false;"><tr><td class="l"><div id="leftBlock"><span></span><span class="limit"></span><img id="leftBegun" ondragstart="return false;" src="/static/images/trackbar_l.png" width="6" height="13" alt="" /></div></td><td class="c" id="centerBlock"></td><td class="r"><div id="rightBlock"><span></span><span class="limit"></span><img id="rightBegun" ondragstart="return false;" src="/static/images/trackbar_r.png" width="6" height="13" alt="" /></div></td></tr></table>');
         if(!this.onMove) {
            this.debug([1, 8]);
            return}
         this.leftBegun = this.gebi(this.LEFT_BEGUN_PREFIX);
         if(!this.leftBegun) {
            this.debug([1, 2]);
            return}
         this.rightBegun = this.gebi(this.RIGHT_BEGUN_PREFIX);
         if(!this.rightBegun) {
            this.debug([1, 3]);
            return}
         this.leftBlock = this.gebi(this.LEFT_BLOCK_PREFIX);
         if(!this.leftBlock) {
            this.debug([1, 4]);
            return}
         this.rightBlock = this.gebi(this.RIGHT_BLOCK_PREFIX);
         if(!this.rightBlock) {
            this.debug([1, 5]);
            return}
         this.centerBlock = this.gebi(this.CENTER_BLOCK_PREFIX);
         if(!this.centerBlock) {
            this.debug([1, 9]);
            return}
         if(!this.width) {
            this.debug([1, 6]);
            return}
         if(!this.rightLimit) {
            this.debug([1, 7]);
            return}
         this.valueWidth = this.width - 2 * this.widthRem;
         this.rightValue = b.rightValue || this.rightLimit;
         this.leftValue = b.leftValue || this.leftLimit;
         if(!this.dual) {
            this.rightValue = this.leftValue}
         this.valueInterval = this.rightLimit - this.leftLimit;
         this.leftWidth = parseInt((this.leftValue - this.leftLimit) / this.valueInterval * this.valueWidth, 10) + this.widthRem;
         this.rightWidth = this.valueWidth - parseInt((this.rightValue - this.leftLimit) / this.valueInterval * this.valueWidth, 10) + this.widthRem;
         if(!this.clearLimits) {
            this.leftBlock.firstChild.nextSibling.innerHTML = this.leftLimit;
            this.rightBlock.firstChild.nextSibling.innerHTML = this.rightLimit}
         this.setCurrentState();
         this.onMove();
         var c = this;
         this.addHandler(document, "mousemove", function(a) {
            if(c.moveState) {
               c.moveHandler(a)}
            if(c.moveIntervalState) {
               c.moveIntervalHandler(a)}
            }
         );
         this.addHandler(document, "mouseup", function() {
            c.moveState = false; c.moveIntervalState = false}
         );
         this.addHandler(this.leftBegun, "mousedown", function(a) {
            a = a || window.event; if(a.preventDefault) {
               a.preventDefault()}
            a.returnValue = false; c.moveState = "left"; c.x0 = c.defPosition(a).x; c.blockX0 = c.leftWidth}
         );
         this.addHandler(this.rightBegun, "mousedown", function(a) {
            a = a || window.event; if(a.preventDefault) {
               a.preventDefault()}
            a.returnValue = false; c.moveState = "right"; c.x0 = c.defPosition(a).x; c.blockX0 = c.rightWidth}
         );
         this.addHandler(this.centerBlock, "mousedown", function(a) {
            a = a || window.event; if(a.preventDefault) {
               a.preventDefault()}
            a.returnValue = false; c.moveIntervalState = true; c.intervalWidth = c.width - c.rightWidth - c.leftWidth; c.x0 = c.defPosition(a).x; c.rightX0 = c.rightWidth; c.leftX0 = c.leftWidth}
         );
         this.addHandler(this.centerBlock, "click", function(a) {
            if(!c.itWasMove) {
               c.clickMove(a)}
            c.itWasMove = false}
         );
         this.addHandler(this.leftBlock, "click", function(a) {
            if(!c.itWasMove) {
               c.clickMoveLeft(a)}
            c.itWasMove = false}
         );
         this.addHandler(this.rightBlock, "click", function(a) {
            if(!c.itWasMove) {
               c.clickMoveRight(a)}
            c.itWasMove = false}
         )}
      catch(e) {
         this.debug([1])}
      }
   , clickMoveRight : function(a) {
      a = a || window.event;
      if(a.preventDefault) {
         a.preventDefault()}
      a.returnValue = false;
      var x = this.defPosition(a).x - this.absPosition(this.rightBlock).x;
      var w = this.rightBlock.offsetWidth;
      if(x <= 0 || w <= 0 || w < x || (w - x) < this.widthRem) {
         return}
      this.rightWidth = (w - x);
      this.rightCounter();
      this.setCurrentState();
      this.onMove()}
   , clickMoveLeft : function(a) {
      a = a || window.event;
      if(a.preventDefault) {
         a.preventDefault()}
      a.returnValue = false;
      var x = this.defPosition(a).x - this.absPosition(this.leftBlock).x;
      var w = this.leftBlock.offsetWidth;
      if(x <= 0 || w <= 0 || w < x || x < this.widthRem) {
         return}
      this.leftWidth = x;
      this.leftCounter();
      this.setCurrentState();
      this.onMove()}
   , clickMove : function(a) {
      a = a || window.event;
      if(a.preventDefault) {
         a.preventDefault()}
      a.returnValue = false;
      var x = this.defPosition(a).x - this.absPosition(this.centerBlock).x;
      var w = this.centerBlock.offsetWidth;
      if(x <= 0 || w <= 0 || w < x) {
         return}
      if(x >= w / 2) {
         this.rightWidth += (w - x);
         this.rightCounter()}
      else {
         this.leftWidth += x;
         this.leftCounter()}
      this.setCurrentState();
      this.onMove()}
   , setCurrentState : function() {
      var x;
      this.leftBlock.style.width = this.leftWidth + "px";
      if(!this.clearValues) {
         this.leftBlock.firstChild.innerHTML = (!this.dual && this.leftWidth > this.width / 2) ? "" : this.leftValue}
      if(!this.dual) {
         x = this.leftBlock.firstChild.offsetWidth;
         this.leftBlock.firstChild.style.right = (this.widthRem * (1 - 2 * (this.leftWidth - this.widthRem) / this.width) - ((this.leftWidth - this.widthRem) * x / this.width)) + 'px'}
      this.rightBlock.style.width = this.rightWidth + "px";
      if(!this.clearValues) {
         this.rightBlock.firstChild.innerHTML = (!this.dual && this.rightWidth >= this.width / 2) ? "" : this.rightValue}
      if(!this.dual) {
         x = this.rightBlock.firstChild.offsetWidth;
         this.rightBlock.firstChild.style.left = (this.widthRem * (1 - 2 * (this.rightWidth - this.widthRem) / this.width) - ((this.rightWidth - this.widthRem) * x / this.width)) + 'px'}
      }
   , moveHandler : function(a) {
      this.itWasMove = true;
      a = a || window.event;
      if(a.preventDefault) {
         a.preventDefault()}
      a.returnValue = false;
      if(this.moveState == "left") {
         this.leftWidth = this.blockX0 + this.defPosition(a).x - this.x0;
         this.leftCounter()}
      if(this.moveState == "right") {
         this.rightWidth = this.blockX0 + this.x0 - this.defPosition(a).x;
         this.rightCounter()}
      this.setCurrentState();
      this.onMove()}
   , moveIntervalHandler : function(a) {
      this.itWasMove = true;
      a = a || window.event;
      if(a.preventDefault) {
         a.preventDefault()}
      a.returnValue = false;
      var b = this.defPosition(a).x - this.x0;
      if(b > 0) {
         this.rightWidth = this.rightX0 - b > this.widthRem ? this.rightX0 - b : this.widthRem;
         this.leftWidth = this.width - this.rightWidth - this.intervalWidth}
      else {
         this.leftWidth = this.leftX0 + b > this.widthRem ? this.leftX0 + b : this.widthRem;
         this.rightWidth = this.width - this.leftWidth - this.intervalWidth}
      this.rightCounter();
      this.leftCounter();
      this.setCurrentState();
      this.onMove()}
   , rightCounter : function() {
      if(this.dual) {
         this.rightWidth = this.rightWidth > this.width - this.leftWidth ? this.width - this.leftWidth : this.rightWidth;
         this.rightWidth = this.rightWidth < this.widthRem ? this.widthRem : this.rightWidth;
         this.rightValue = this.leftLimit + this.valueInterval - parseInt((this.rightWidth - this.widthRem) / this.valueWidth * this.valueInterval, 10);
         if(this.roundUp) {
            this.rightValue = parseInt(this.rightValue / this.roundUp, 10) * this.roundUp}
         if(this.leftWidth + this.rightWidth >= this.width) {
            this.rightValue = this.leftValue}
         }
      else {
         this.rightWidth = this.rightWidth > (this.width - this.widthRem) ? this.width - this.widthRem : this.rightWidth;
         this.rightWidth = this.rightWidth < this.widthRem ? this.widthRem : this.rightWidth;
         this.leftWidth = this.width - this.rightWidth;
         this.rightValue = this.leftLimit + this.valueInterval - parseInt((this.rightWidth - this.widthRem) / this.valueWidth * this.valueInterval, 10);
         if(this.roundUp) {
            this.rightValue = parseInt(this.rightValue / this.roundUp, 10) * this.roundUp}
         this.leftValue = this.rightValue}
      }
   , leftCounter : function() {
      if(this.dual) {
         this.leftWidth = this.leftWidth > this.width - this.rightWidth ? this.width - this.rightWidth : this.leftWidth;
         this.leftWidth = this.leftWidth < this.widthRem ? this.widthRem : this.leftWidth;
         this.leftValue = this.leftLimit + parseInt((this.leftWidth - this.widthRem) / this.valueWidth * this.valueInterval, 10);
         if(this.roundUp) {
            this.leftValue = parseInt(this.leftValue / this.roundUp, 10) * this.roundUp}
         if(this.leftWidth + this.rightWidth >= this.width) {
            this.leftValue = this.rightValue}
         }
      else {
         this.leftWidth = this.leftWidth > (this.width - this.widthRem) ? this.width - this.widthRem : this.leftWidth;
         this.leftWidth = this.leftWidth < this.widthRem ? this.widthRem : this.leftWidth;
         this.rightWidth = this.width - this.leftWidth;
         this.leftValue = this.leftLimit + parseInt((this.leftWidth - this.widthRem) / this.valueWidth * this.valueInterval, 10);
         if(this.roundUp) {
            this.leftValue = parseInt(this.leftValue / this.roundUp, 10) * this.roundUp}
         this.rightValue = this.leftValue}
      }
   }; 