var ar_path=location.pathname.split("/");var lang_dir='/';if(ar_path[1]=='ukr')lang_dir='/'+ar_path[1]+'/';function OpenImagePopup(imgPath,title,alt,spec_text,w,h){if(w&&h){var left=(self.opera?document.body.innerWidth:screen.availWidth)/2-w/2;var top=(self.opera?document.body.clientHeight:screen.availHeight)/2-h/2;var width=self.opera?document.body.innerWidth:screen.availWidth;var height=self.opera?document.body.clientHeight:screen.availHeight;if(h>height*0.8||w>width*0.8)
var scrollbar=1;else
var scrollbar=0;var win=window.open('','preview','width='+w+',height='+h+',left='+left+',top='+top+',screenX=0,screenY=0,resizable=1,scrollbars='+scrollbar+',status=0');}else
var win=window.open('','preview','width=50,height=50,left=0,top=0,screenX=0,screenY=0,resizable=1,scrollbars=0,status=0');var winDoc=win.document;if(title==undefined)title='Закрыть';if(alt==undefined)alt='Закрыть';var content='<html><head><title>'+title+'</title>'+'<style>body{margin:10px;}img{border:1px solid #e3e3e3;}</style>'+'</head><body><a href="javascript:self.close()">'+'<img alt="'+alt+'" id="image" src="'+imgPath+'" /></a><br>'+(spec_text||'<span style="font-family: Arial; font-size: 9px">* Вид товара в продаже может не совпадать с фотографией</span></body></html>')
win.document.write(content);if(!w&&!h){winDoc.body.onload=function(){var obj=winDoc.getElementById('image');var w=obj.width,h=obj.height;var iHeight=document.body.clientHeight,iWidth=self.innerWidth;var left=(self.opera?iWidth:screen.availWidth)/2-w/2;var top=(self.opera?iHeight:screen.availHeight)/2-h/2;win.resizeTo(w+30,h+120);win.moveTo(left,top);}
win.onload=winDoc.body.onload;}
win.document.close();win.focus();}
function show_vis_prod(offset){var cur_item,new_item,cur_index,items_cnt;cur_item=$("div.recent div.box:visible");var cur_index=$("div.recent div.box").index(cur_item);var items_cnt=$("div.recent div.box").length;if(offset==1&&cur_index<items_cnt-1){if(cur_index==0)
$("div.recent .previous").toggleClass("hidden");if(cur_index==items_cnt-2)
$("div.recent .next").toggleClass("hidden");new_item=$("div.recent div.box:visible").next();}else if(offset==-1&&cur_index>0){if(cur_index==1)
$("div.recent .previous").toggleClass("hidden");if(cur_index==items_cnt-1)
$("div.recent .next").toggleClass("hidden");new_item=$("div.recent div.box:visible").prev();}
else
return;cur_item.hide();new_item.show();}
function check_for_compare_silent(cid,pid){var d=new Date();d.setTime(d.getTime()+3600*24*14*1000);document.cookie="c_"+cid+"_p"+pid+"=1; expires="+d.toUTCString()+"; path=/";ar_compare_ids[ar_compare_ids.length]=pid;$('div#add_to_favs').html('<span class="cmp"><noindex>'+go_to+' <a href="'+lang_dir+'compare/'+cid+'/?pids='+ar_compare_ids.join("-")+"&dscr="+pid+"&return_path="+escape(location.pathname+(location.search?location.search:'')+location.hash)+'">'+comparison+'</noindex></span>');$('span#f_cnt').html(parseInt($('span#f_cnt').html())+1);}
function check_for_compare(cid,pid,is_checked){is_checked=is_checked||$("#ch_cmp_"+pid).attr("class")=="remove"?0:1;if(is_checked){var d=new Date();d.setTime(d.getTime()+3600*24*14*1000);document.cookie="c_"+cid+"_p"+pid+"=1; expires="+d.toUTCString()+"; path=/";ar_compare_ids[ar_compare_ids.length]=pid;$("#ch_cmp_"+pid).html('<span class="cmp"></span>');$("span.cmp").html('<noindex>'+go_to+' <a href="'+lang_dir+'compare/'+cid+'/?pids='+ar_compare_ids.join("-")+"&return_path="+escape(location.pathname+(location.search?location.search:'')+location.hash)+'">'+comparison+'</noindex>');if($("#com-block span").length)
$("#com-block span").text(parseInt($("#com-block span").text())+1);else
$("#com-block .i3").html("<strong>"+compare_goods+":</strong> <span>1</span>");$("#com-block").removeClass("hidden");if(parseInt($("#com-block span").text())>1&&!comp_but){$("#com-block .i3 strong").remove();$("<a>"+compare_goods+"</a>").prependTo("#com-block .i3");$("#com-block .i3 a").after(":");comp_but=1;}
$('span#f_cnt').html(parseInt($('span#f_cnt').html())+1);if(comp_but){$("#com-block .i3 a").attr("href",lang_dir+'compare/'+cid+'/?pids='+ar_compare_ids.join("-")+"&return_path="+escape(location.pathname+(location.search?location.search:'')+location.hash));}}}
function toggleAlphaLinks(from_link,to_link){$('div.alphabet ul:gt(0) li a').each(function(){this.href=this.href.replace(from_link,to_link);});}
$(document).ready(function(){$(".fullttx").hide();$.popupactive=true;$("div#price_block").hover(function(){},function(){$("div#price_block").css('display','none');$("div#price_block").html('');});$("div#com_block").hover(function(){},function(){$("div#com_block").css('display','none');$("div#com_block").html('');});$("td strong.title").hover(function(){var parent_td=$(this).parents("td");var mappos=$(this).offset(mappos);var hidden_layer=parent_td.find('div.hidden');if(hidden_layer.html()!=null){$("div#com_block").html(hidden_layer.html());var popup_width=parent_td.width();$("div#com_block").css({width:popup_width+'px',top:mappos["top"]-4,left:mappos["left"]-5,display:'block'});}},function(){})
$("div.description strong.title").hover(function(){var parent_td=$(this).parents("div.description");var mappos=$(this).offset(mappos);var hidden_layer=parent_td.find('div.hidden');if(hidden_layer.html()!=null){$("div#com_block").html(hidden_layer.html());var popup_width=parent_td.width();$("div#com_block").css({width:popup_width+'px',top:mappos["top"]-4,left:mappos["left"]-5,display:'block'});}},function(){})
$("#cur_sel").hover(function(){parent_el=$(this);var mappos=parent_el.position();$("div#currency").css({top:mappos["top"]-5,left:mappos["left"]-1,display:'block'});},function(){})
$("div#currency").hover(function(){},function(){$("div#currency").css('display','none');});$("input[name=s_text]").hover(function(){$("div#currency").css('display','none');},function(){});$("a.cluetip").hover(function(){var container=$(this).parents("span.left");var mappos=$(this).offset();var hidden_layer=$(this).next('div.hidden');if(!hidden_layer.find('span.hlp_txt span').html()){hidden_layer.find('span.hlp_txt span').load($(this).attr('rel'),{},function(txt){$("div#dscr_block").find("span.hlp_txt span").html(txt);$("div#dscr_block").find("span.hlp_txt img").remove();hidden_layer.find("span.hlp_txt img").remove();});}
var popup_width=container.width();popup_width=popup_width?popup_width:500;if(hidden_layer.html()!=null){$("div#dscr_block").html(hidden_layer.html());$("div#dscr_block").css({width:popup_width+'px',top:mappos["top"]-5,left:mappos["left"]-5,display:'block'});}
$("div#dscr_block").find("a").hover(function(){},function(){$("div#dscr_block").css('display','none');$("div#dscr_block").html('');})},function(){})
$("#report_error").click(function(){var prod_id=$(this).attr("href").substr(1);showErrorDialog(prod_id);})
cities_init();sort_init();$("#suggest").suggest(lang_dir+"srch/");$(document).keydown(function(event){if(!event.ctrlKey&&!event.shiftKey&&!event.altKey&&!event.target.type&&event.keyCode>=48&&event.keyCode<=223)
$("#suggest").focus();});$(".gr-box .rel a").mouseover(function(){$('<img />').attr("src",$(this).attr("rel")).prependTo($(this));})
$(".addopt").click(function(){$('div.tab h2').toggleClass('hidden');$('div.tab .itemdescr').toggleClass('hidden');$('#param-head .addopt').toggleClass('hidden');$('#param-head .left').toggleClass('hidden');if($('div.itemdescr').length)
$('.report_er').toggleClass('hidden');return false;})});function switchCur(from_id,to_id){$(".cur-"+from_id).removeClass("currency-active").addClass("under-dot");$(".cur-"+to_id).addClass("currency-active").removeClass("under-dot");$(".cur-"+from_id+'-val').addClass("hidden");$(".cur-"+to_id+'-val').removeClass("hidden");}
function cities_init(){$("#oth_city_lnk").hover(function(){var mappos=$(this).offset(mappos);$("div#pop_sets").html($("div#cities_list").html());$("div#pop_sets").css({top:mappos["top"]-5,left:mappos["left"]-4,display:'block'});},function(){})
$("div#pop_sets").hover(function(){},function(){$("div#pop_sets").css('display','none');});$("div#pop_sets").click(function(){$("div#pop_sets").css('display','none');})}
function sort_init(){$("#oth_sort_lnk").hover(function(){var mappos=$(this).offset(mappos);$("div#pop_sets").html($("div#sort_types").html());$("div#pop_sets").css({top:mappos["top"]-5,left:mappos["left"]-4,display:'block'});},function(){})}
var Url={encode:function(string){return escape(this._utf8_encode(string));},decode:function(string){return this._utf8_decode(unescape(string));},_utf8_encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}
else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}
else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
return utftext;},_utf8_decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}
else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}
else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
return string;}}
function utf2win(s)
{s1='';for(n=0;n<s.length;n++){c=s.charCodeAt(n);c1=c<0x80?c:c>=0x410&&c<=0x44F?c-0x350:c==0x451?0xB8:c==0x401?0xA8:c==0xA0||c==0xA4||c==0xA6||c==0xA7||c==0xA9||c==0xAB||c==0xAC||c==0xAD||c==0xAE||c==0xB0||c==0xB1||c==0xB5||c==0xB6||c==0xB7||c==0xBB?c:c==0x2013?0x96:c==0x2014?0x97:c==0x2018?0x91:c==0x2019?0x92:c==0x201A?0x82:c==0x201C?0x93:c==0x201D?0x94:c==0x201E?0x84:c==0x2020?0x86:c==0x2021?0x87:c==0x2022?0x95:c==0x2026?0x85:c==0x2030?0x89:c==0x203A?0x9B:c==0x20AC?0x88:c==0x2116?0xB9:c==0x2122?0x99:c==0x402?0x80:c==0x403?0x81:c==0x404?0xAA:c==0x405?0xBD:c==0x406?0xB2:c==0x407?0xAF:c==0x408?0xA3:c==0x409?0x8A:c==0x40A?0x8C:c==0x40B?0x8E:c==0x40C?0x8D:c==0x40E?0xA1:c==0x40F?0x8F:c==0x452?0x90:c==0x453?0x83:c==0x454?0xBA:c==0x455?0xBE:c==0x456?0xB3:c==0x457?0xBF:c==0x458?0xBC:c==0x459?0x9A:c==0x45A?0x9C:c==0x45B?0x9E:c==0x45C?0x9D:c==0x45E?0xA2:c==0x45F?0x9F:c==0x490?0xA5:c==0x491?0xB4:c==0x2039?0x8B:undefined;s1+=c1!=undefined?String.fromCharCode(c1):'&#'+c+';';}
return s1;}
function trackFirmView(c_id){$.get("/firms_view/",{"id":c_id},function(){});}
function showReqDialog(prod_id,price_id){$("#r_form").html($("#loading").html());$('#r_form').load(lang_dir+"req-callback/"+(prod_id?prod_id+'/':'0/')+(price_id?price_id+'/':'0/'));$('#request_form').center();$('#request_form').toggleClass('hidden');return false;}
function showErrorDialog(prod_id){$("#er_form").html($("#loading").html());$('#er_form').load(lang_dir+"report_error/"+prod_id+'.htm');$('#report_er_form').center();$('#report_er_form').toggleClass('hidden');return false;}
function showOrder(order_id){$("#request_form").center();$("#r_form").html($("#loading").html());$('#r_form').load(lang_dir+"req-order/"+order_id+"/");$('#request_form').toggleClass('hidden');return false;}
function antiRangeFunc(D,C,A){if(D==0)return 0;if(C==0){if(D==0){return 0}C=1}var B=Math.log(C)/Math.log(A);return((Math.log(D)/Math.log(A)-B)/(1-B))}
function rangeFunc(E,D,B){if(D==0){if(E==0){return 0}
D=1}
var C=Math.log(D)/Math.log(B);var A=Math.round(Math.pow(B,E*(1-C)+C));if(E==0){A=Math.floor(A/10)*10}
else{if(E==1){A=Math.ceil(A/10)*10}
else{A=Math.round(A/10)*10}}
return A};jQuery.fn.center=function()
{var w=$(window);var height=window.innerHeight?window.innerHeight:$(window).height();this.css("top",(height-this.height())/2+w.scrollTop()+"px");return this;}
$(document).ready(function(){$('#quickselect,#quickselect2').click(function(){var cat_list=$("select[name=cat_id_1] > option");var brand_list=$("select[name=cat_id_1] > option");var prod_list=$("select[name=cat_id_1] > option");var cat_id=0;var brand_id=0;var prod_id=0;if($("#fast_cat_id").length){cat_id=$("#fast_cat_id").val();}
if($("#fast_brand_id").length&&$("#fast_prod_id").length){brand_id=$("#fast_brand_id").val();prod_id=$("#fast_prod_id").val();}
if(!cat_list.length){var sel=$("select[name=cat_id_1]");$.getJSON(lang_dir+"go_fast/",{},function(data){sel.empty();$.each(data.items,function(i,item){$("<option></option>").attr("value",item.id).html(item.title).appendTo(sel);});if(cat_id)
$("select[name=cat_id_1] > option[value="+cat_id+"]").attr("selected","selected");})}
if(brand_list.length<2&&cat_id){if(brand_id)
fast_select_brands('b_id_1',cat_id,brand_id);else
fast_select_brands('b_id_2',cat_id,brand_id);}
if(prod_list.length<2&&cat_id&&brand_id){fast_select_products('prod_id_1',cat_id,brand_id,prod_id);}});$("select[name=cat_id]").change(function(){var sel=$("select[name=b_id]");if($(this).val()>0){$.getJSON(lang_dir+"go_fast/",{cat_id:$(this).val()},function(data){sel.empty();$.each(data.items,function(i,item){$("<option></option>").attr("value",item.f_id).html(item.value).appendTo(sel);});$("<option value=\"0\">"+producer+"</option>").prependTo(sel);sel.get(0).options[0].selected=true;})
$("input[name=b_cat_fast]").attr("disabled","");}else{sel.empty();$("<option value=\"0\">"+producer+"</option>").prependTo(sel);$("input[name=b_cat_fast]").attr("disabled","disabled");$("input[name=b_brand_fast]").attr("disabled","disabled");}})
$("select[name=b_id]").change(function(){var sel=$("select[name=prod_id]");if($(this).val()>0){var sel=$("select[name=prod_id]");$.getJSON(lang_dir+"go_fast/",{cat_id:$("select[name=cat_id]").val(),b_id:$(this).val()},function(data){sel.empty();$.each(data,function(i,item){$("<option></option>").attr("value",item.id).html(item.title).appendTo(sel);});$("<option value=\"\">"+choose_product+"</option>").prependTo(sel);sel.get(0).options[0].selected=true;})
$("input[name=b_brand_fast]").attr("disabled","");}else{sel.empty();$("<option value=\"0\">"+choose_product+"</option>").prependTo(sel);$("input[name=b_brand_fast]").attr("disabled","disabled");}})
$("select[name=cat_id_1]").change(function(){if($(this).val()>0){fast_select_brands('b_id_1',$(this).val(),0);}else{$("select[name=b_id_1]").empty();$("<option value=\"0\">"+producer+"</option>").prependTo(sel);}})
function fast_select_brands(name,category_id,cur_brand_id){var sel=$("select[name="+name+"]");$.getJSON(lang_dir+"go_fast/",{cat_id:category_id},function(data){sel.empty();$.each(data.items,function(i,item){$("<option></option>").attr("value",item.f_id).html(item.value).appendTo(sel);});if(name!='b_id_2'){$("<option value=\"0\">"+producer+"</option>").prependTo(sel);if(cur_brand_id)
$("select[name="+name+"] > option[value="+cur_brand_id+"]").attr("selected","selected");else
sel.get(0).options[0].selected=true;}})}
$("select[name=b_id_1]").change(function(){if($(this).val()>0){fast_select_products("prod_id_1",$("select[name=cat_id_1]").val(),$(this).val(),0);}else{$("select[name=prod_id_1]").empty();$("<option value=\"0\">"+choose_product+"</option>").prependTo(sel);}})
function fast_select_products(name,category_id,brand_id,cur_product_id){var sel=$("select[name="+name+"]");$.getJSON(lang_dir+"go_fast/",{cat_id:category_id,b_id:brand_id},function(data){sel.empty();$.each(data,function(i,item){$("<option></option>").attr("value",item.uri).attr("id","prod_"+item.id).html(item.title).appendTo(sel);});$("<option value=\"0\">"+choose_product+"</option>").prependTo(sel);if(cur_product_id>0)
$("select[name="+name+"] > option#prod_"+cur_product_id).attr("selected","selected");else
sel.get(0).options[0].selected=true;})}
$("select[name=b_id_2]").change(function(){var sel=$("select[name=prod_id_1]");var _dscr=0;var _return_path="";if(ar_match=location.href.match(/dscr=(\d+)/))
_dscr=ar_match[1];if(ar_match=location.href.match(/return_path=([^&]+)/))
_return_path=ar_match[1];if($(this).val()>0){var sel=$("select[name=prod_id_1]");$.getJSON(lang_dir+"go_fast/",{cat_id:$("select[name=cat_id_1]").val(),b_id:$(this).val(),compare_add:1,dscr:_dscr,return_path:_return_path},function(data){sel.empty();$.each(data,function(i,item){$("<option></option>").attr("value",item.uri).html(item.title).appendTo(sel);});$("<option value=\"0\">"+choose_product+"</option>").prependTo(sel);sel.get(0).options[0].selected=true;})}else{sel.empty();$("<option value=\"0\">"+choose_product+"</option>").prependTo(sel);}})
$("select[name=prod_id]").change(function(){if($(this).val()!='0'){$("#prod_img").empty();$.getJSON(lang_dir+"go_fast/",{cat_id:$("select[name=cat_id]").val(),b_id:$("select[name=b_id]").val(),prod_id:$(this).val()},function(data){$("<a>").attr("target","_blank").attr("href",data.uri).appendTo("#prod_img");$("<img>").attr("src",data.img_src).attr("alt",data.title).appendTo("#prod_img a");})}});$("select[name=prod_id_1]").change(function(){if($(this).val()!='0')
location.href=$(this).val();})
$("input[name=b_cat_fast]").click(function(){if($("select[name=cat_id]").val())
location.href=lang_dir+'products/'+$("select[name=cat_id]").val();})
$("input[name=b_brand_fast]").click(function(){if($("select[name=b_id]").val())
location.href=lang_dir+'products/'+$("select[name=cat_id]").val()+'/f-'+$("select[name=b_id]").val();})});
(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&/6.0/.test(navigator.userAgent)){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+
(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)
this.insertBefore(document.createElement(html),this.firstChild);});}
return this;};})(jQuery);
(function($){$.suggest=function(input,options){var $input=$(input).attr("autocomplete","off");var $results=$(document.createElement("ul"));var timeout=false;var prevLength=0;var prevValue=$input.val();var cache=[];var cacheSize=0;$results.addClass(options.resultsClass).appendTo('body');resetPosition();$(window).load(resetPosition).resize(resetPosition);$input.blur(function(){setTimeout(function(){$results.hide()},200);});try{$results.bgiframe();}catch(e){}
if($.browser.mozilla||$.browser.opera)
$input.keypress(processKey);else
$input.keydown(processKey);function resetPosition(){var offset=$input.offset();$results.css({top:(offset.top+input.offsetHeight)+'px',left:offset.left+'px',width:$input.innerWidth()});}
function checkChanged(){if(prevValue!=$input.val())
{suggest();prevValue=$input.val();}}
setInterval(checkChanged,200);function processKey(e){if((/27$|38$|40$/.test(e.keyCode)&&$results.is(':visible'))||(/^13$|^9$/.test(e.keyCode)&&getCurrentResult())){if(e.preventDefault)
e.preventDefault();if(e.stopPropagation)
e.stopPropagation();e.cancelBubble=true;e.returnValue=false;switch(e.keyCode){case 38:prevResult();break;case 40:nextResult();break;case 9:case 13:selectCurrentResult();break;case 27:$results.hide();break;}}}
function suggest(){var q=$.trim($input.val());if(q.length>=options.minchars){cached=checkCache(q);if(cached){displayItems(cached['items']);}else{$.get(options.source,{q:q},function(txt){$results.hide();var items=parseTxt(txt,q);displayItems(items);addToCache(q,items,txt.length);});}}else{$results.hide();}}
function checkCache(q){for(var i=0;i<cache.length;i++)
if(cache[i]['q']==q){cache.unshift(cache.splice(i,1)[0]);return cache[0];}
return false;}
function addToCache(q,items,size){while(cache.length&&(cacheSize+size>options.maxCacheSize)){var cached=cache.pop();cacheSize-=cached['size'];}
cache.push({q:q,size:size,items:items});cacheSize+=size;}
function displayItems(items){if(!items)
return;if(!items.length){$results.hide();return;}
var html='';for(var i=0;i<items.length;i++)
html+='<li'+(items[i]["class"]!='undefined'?' class='+items[i]["class"]:'')+'>'+items[i]["txt"]+'</li>';$results.html(html).show();$results.children('li:not(.categ)').mouseover(function(){$results.children('li').removeClass(options.selectClass);$(this).addClass(options.selectClass);}).click(function(e){e.preventDefault();e.stopPropagation();selectCurrentResult();return true;});}
function parseTxt(txt,q){var items=[];var res=new Array();var tokens=txt.split(options.delimiter);var reg_exp=new RegExp("categ|");for(var i=0;i<tokens.length;i++){var token=$.trim(tokens[i]);if(token){items[i]=new Array();res=token.split("|");if(res[0]=="categ"){items[i]["class"]=res[0];items[i]["txt"]=res[1];}else{items[i]["txt"]=res[0];}}}
return items;}
function getCurrentResult(){if(!$results.is(':visible'))
return false;var $currentResult=$results.children('li.'+options.selectClass);if(!$currentResult.length)
$currentResult=false;return $currentResult;}
function selectCurrentResult(){$currentResult=getCurrentResult();location.href=$currentResult.find("a").attr("href");}
function nextResult(){$currentResult=getCurrentResult();if($currentResult){$next_el=$currentResult.next("li[class!='categ']");if(!$next_el.length){$next_el=$currentResult.next().next();}
$currentResult.removeClass(options.selectClass);if($next_el.length)
$next_el.addClass(options.selectClass);else
$results.children('li:eq(1)').addClass(options.selectClass);}else{$results.children('li:eq(1)').addClass(options.selectClass);}}
function prevResult(){$currentResult=getCurrentResult();if($currentResult){$prev_el=$currentResult.prev("li[class!='categ']");if(!$prev_el.length){$prev_el=$currentResult.prev().prev();}
$currentResult.removeClass(options.selectClass);if($prev_el.length)
$prev_el.addClass(options.selectClass);else
$results.children('li:last-child').addClass(options.selectClass);}else{$results.children('li:last-child').addClass(options.selectClass);}}}
$.fn.suggest=function(source,options){if(!source)
return;options=options||{};options.source=source;options.delay=options.delay||100;options.resultsClass=options.resultsClass||'ac_results';options.selectClass=options.selectClass||'ac_over';options.matchClass=options.matchClass||'ac_match';options.minchars=options.minchars||2;options.delimiter=options.delimiter||'\n';options.onSelect=options.onSelect||false;options.maxCacheSize=options.maxCacheSize||65536;this.each(function(){new $.suggest(this,options);});return this;};})(jQuery);
(function($){var trailing_whitespace=true;$.fn.truncate=function(options){var opts=$.extend({},$.fn.truncate.defaults,options);$(this).each(function(){var content_length=$.trim(squeeze($(this).text())).length;if(content_length<=opts.max_length)
return;var actual_max_length=opts.max_length-opts.more.length-3;var truncated_node=recursivelyTruncate(this,actual_max_length);var full_node=$(this).hide();truncated_node.insertAfter(full_node);findNodeForMore(truncated_node).append('... (<a href="#show more content">'+opts.more+'</a>)');findNodeForLess(full_node).append(' (<a href="#show less content">'+opts.less+'</a>)');truncated_node.find('a:last').click(function(){truncated_node.hide();full_node.show();return false;});full_node.find('a:last').click(function(){truncated_node.show();full_node.hide();return false;});});}
$.fn.truncate.defaults={max_length:100,more:'more',less:'less'};function recursivelyTruncate(node,max_length){return(node.nodeType==3)?truncateText(node,max_length):truncateNode(node,max_length);}
function truncateNode(node,max_length){var node=$(node);var new_node=node.clone().empty();var truncatedChild;node.contents().each(function(){var remaining_length=max_length-new_node.text().length;if(remaining_length==0)return;truncatedChild=recursivelyTruncate(this,remaining_length);if(truncatedChild)new_node.append(truncatedChild);});return new_node;}
function truncateText(node,max_length){var text=squeeze(node.data);if(trailing_whitespace)
text=text.replace(/^ /,'');trailing_whitespace=!!text.match(/ $/);var text=text.slice(0,max_length);text=$('<div/>').text(text).html();return text;}
function squeeze(string){return string.replace(/\s+/g,' ');}
function findNodeForMore(node){var $node=$(node);var last_child=$node.children(":last");if(!last_child)return node;var display=last_child.css('display');if(!display||display=='inline')return $node;return findNodeForMore(last_child);};function findNodeForLess(node){var $node=$(node);var last_child=$node.children(":last");if(last_child&&last_child.is('p'))return last_child;return node;};})(jQuery);