// This has been autogenerated by \lib\JSMin\jsmin.exe, do not modify manually

var PriceSlider=function(options){var defaultOptions={startPriceMin:5000,startPriceMax:7000,finishPriceMin:100000,finishPriceMax:200000,roundAt:100,formatThousands:false};var options=$.extend(defaultOptions,options);var $top=$('#price-slider .handle span');var $handle=$('#price-slider .handle');var $pmin=$('#price-slider p.min');var $pmax=$('#price-slider p.max');$('<div class="accessibility"><label for="PriceRangeMin">Minimum price</label><input id="PriceRangeMin" name="PriceRangeMin" type="text" class="frmText" value="5000" /><label for="PriceRangeMax">Maximum price</label><input id="PriceRangeMax" name="PriceRangeMax" type="text" class="frmText" value="7000" /></div>').appendTo('#price');var $minField=$('input#PriceRangeMin');var $maxField=$('input#PriceRangeMax');var startPriceMin=options.startPriceMin;var startPriceMax=options.startPriceMax;var finishPriceMin=options.finishPriceMin;var finishPriceMax=options.finishPriceMax;var roundAt=options.roundAt;var formatThousands=options.formatThousands;var currentMin=options.userMin;var currentMax=options.userMax;var minMultiplyFactor=0.0051;var maxMultiplyFactor=0.0056;var maxPosition=496;var init=function(){$('#price-slider').removeClass('hidden');$('#price-slider').slider({min:0,max:maxPosition,handle:'.handle',slide:sliding,stop:updatePrice});$('#price-slider a .handle').css({border:'none',outline:0});setInitialPosition();};var sliding=function(){var pos=parseInt($handle.css('left'),10);calculateSlidingPrices(pos);renderPrice();setTopHandle();};var getPosFromPrice=function(){var price=currentMin;if(price<=startPriceMin)
{return 0;}else if(price>=finishPriceMin){return maxPosition;}else{return Math.round(Math.log(price/startPriceMin)/minMultiplyFactor);}}
var calculateSlidingPrices=function(pos){if(pos!==0&&pos<maxPosition){minPrice=roundAt*(Math.round(startPriceMin*Math.exp(minMultiplyFactor*pos)/roundAt));currentMin=minPrice;var newPos=getPosFromPrice();maxPrice=roundAt*(Math.round(startPriceMax*Math.exp(maxMultiplyFactor*newPos)/roundAt));}else if(pos>=maxPosition){minPrice=finishPriceMin;maxPrice=finishPriceMax;}else{minPrice=startPriceMin;maxPrice=startPriceMax;}
currentMin=minPrice;currentMax=maxPrice;};var setTopHandle=function(){var width=(parseInt($handle.css('left'),10)*0.17)+17;if(width<17){width=17;}
$handle.css('width',(width+'px'));$top.css('paddingRight',$handle.css('width'));if(width>25){$pmax.css('left',(width-2)+'px');}};var renderPrice=function(){$pmin.text(formatThousands?(currentMin/1000)+'k':currentMin);$pmax.text(formatThousands?(currentMax/1000)+'k':currentMax);};var updatePrice=function(){$minField.val(currentMin);$maxField.val(currentMax);};var setInitialPosition=function(){var x=getPosFromPrice();$handle.css('left',getPosFromPrice()+'px');sliding();updatePrice();};init();};function validateCarChooser(){var errorCaption='Oops';var checkboxError='Did you forget something? Make sure you tick at least one box for car type and move the slider to where you need it.';var errorId='error-message';var boxWidth='596';var boxHeight='110';var $checkboxes=$('form#PriceRangeAndTypeForm input:checkbox');var valid=false;$checkboxes.each(function(i){if(this.checked===true){valid=true;}});if(valid!==true){$('<div id="'+errorId+'" class="hidden"><p>'+checkboxError+'</p><div class="error-bot"></div></div>').appendTo('body');tb_show(errorCaption,'#TB_inline?width='+boxWidth+'&height='+boxHeight+'&inlineId='+errorId,'','tb_error');}
return valid;}