var cms={www_root:"/",langId:"ru",c_searchAC:0};var CONST_INPUT_MAX_LENGTH=256,CONST_TEXTAREA_MAX_LENGTH=1024*8;$(function(){if(jQuery.fn.lightBox){$('a[class=zoom],a[class*=zoomStatic]').lightBox();$('a[class=zoom] img').before('<span class="zoomImg">&nbsp;</span>')}$("textarea,input:text").each(function(){var b=$(this);var c=b.attr("maxlength");if(!c||parseInt(c/1024/1024)>5){if(this.tagName=="TEXTAREA"){b.attr("maxlength",CONST_TEXTAREA_MAX_LENGTH)}else{b.attr("maxlength",CONST_INPUT_MAX_LENGTH)}}});$("textarea").bind("keyup",function(){if(this.value.length>$(this).attr("maxlength")){this.value=this.value.substr(0,$(this).attr("maxlength"))}});$(".sp0000").each(function(){var c="";var d=decodeURIComponent($(this).html());var b=d.length;for(b;b>0;b--){c+=d.substring(b-1,b)}c=c.replace(/sp0001/g,"@");c=c.replace(/sp0002/g,"mail");c=c.replace(/sp0003/g,":");c=c.replace(/sp0004/g,".");c=c.replace(/sp0005/g,"ru");c=c.replace(/sp0006/g,"com");$(this).after(c).remove()});$("#siteErrorLink").bind("click",function(b){b.preventDefault();$("#siteError").jqm().jqmShow()});$(":submit","#siteError").bind("click",function(c){c.preventDefault();if(checkFormEx($(this).parent("form").get(0))){var b=$(".t","#siteError");if(!b.attr("isChanged")){alert("Опишите ошибку");b.focus();return}$.ajax({type:"POST",data:{siteErrorText:b.val(),hookEx:"true"},success:function(d){$("#siteError").html(d)}});$("#siteError").html("Loading...")}});if(cms.c_searchAC){var a=$("form[.search] input[name='s']");a.autocomplete(a.form().attr("action")).result(function(b,d,c){if(d){a.val(d[1])}})}});function akiraList(e,d){$("#bigImage").attr("href",e);var c=getVarInt("width",$("img","#bigImage").attr("src"));var b=getVarInt("ratio",$("img","#bigImage").attr("src"));if(!c){alert("Error: akiraList - #bigImage.width not set");return false}var a=d+"width="+c;a=a.replace("ratio=0&","ratio="+b);a=a.replace("ratio=1&","ratio="+b);$("img","#bigImage").attr("src",a);return false}function formChecker(a){this._form=a;this._validateMode=a.getAttribute("validator")}formChecker.prototype.inputValidator=function(a){var b=a.getAttribute("validator");if(b==null){b=this._validateMode}return(!(b=="full"&&$.trim(a.value)==""))};formChecker.prototype.check=function(c){var a=this;var b=true;$("input[title]:visible, textarea[title]:visible, select[title]:visible",this._form).removeClass("inputInvalid").each(function(){if(a.inputValidator(this)==false){$(this).addClass("inputInvalid");if(b){this.focus();var e=this.title;if(!e){e=this.name}var f="Вы должны заполнить поле";if(cms.langId=="en"){f="Your must fill"}alert(f+" '"+e+"'.")}b=false}if(b){var d=this.name.replace(/\[/g,"__");d=d.replace(/\]/g,"__");d=d.replace(/____/g,"__");d="labels["+d+"]";if(!$('input[name="'+d+'"]',a._form).length){$(a._form).append('<input type="hidden" name="'+d+'" value="'+this.title+'"/>')}}});return b};function checkFormEx(b){var a=new formChecker(b).check(b);if(a){$('button[type="submit"]',b).each(function(){this.disabled=true});if($(b).attr("method")=="post"&&!$('input[name="hookEx"]',b).length){$(b).append('<input type="hidden" name="hookEx" value="true"/>')}}return a}function repass(){$(".alert_r").myHide(function(){$(this).remove()});if($(".alert_g").length){$(".alert_g,.alert_r").myHide(function(){$(this).remove()})}else{$.ajax({url:cms.www_root,data:"mode=cmsLoginRepass",success:function(a){$(".clear").after(a);$(".alert_g").myShow()}})}return false}function repassOk(){var a=$("select").val();$(".alert_g").html("Loading...");$.ajax({url:cms.www_root,data:"mode=cmsLoginRepass&to="+a,success:function(b){$(".alert_g").html(b)}})}var __=document;function getCookie(d){var c=d+"=",b=document.cookie,e="",a="";if(b.length>0){e=b.indexOf(c);if(e!=-1){e+=c.length;a=b.indexOf(";",e);if(a==-1){a=b.length}return unescape(b.substring(e,a))}}return""}function setCookie(c,e,b){var a=false,d=c+"="+escape(e);if(!b&&b!=-1){b=24*60*60*1000*30}if(b>0){a=new Date();a.setTime(a.getTime()+b)}if(a){d+="; expires="+a}document.cookie=d+"; path=/"}function delCookie(a){document.cookie=a+"=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/"}function cmsFlipClientBlock(){$("#adminCtrl").myToggle(function(){if($("#adminCtrl:visible").length==0){$(this).attr("class","adminCtrl2C2");$("#adminCtrlC").attr("class","adminCtrl1C2")}else{$(this).attr("class","adminCtrl2C1");$("#adminCtrlC").attr("class","adminCtrl1C1")}});setCookie("fcmsCLB",$("#adminCtrl").hasClass("adminCtrl2C1"));return false}function getVar(a,c){if(!c){c=window.location.href}a=a.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var b=new RegExp("[\\?&]"+a+"=([^&#]*)").exec(c);if(b==null){return""}else{return b[1]}}function getVarInt(b,d,c){if(!c){c=0}var a=parseInt(getVar(b,d));if(isNaN(a)){a=c}return a}jQuery.fn.extend({myShow:function(a){return this.animate({opacity:"show"},"fast",a)},myHide:function(a){return this.animate({opacity:"hide"},"fast",a)},myToggle:function(a){return this.animate({height:"toggle",opacity:"toggle"},"fast",a)},form:function(){return $(this).parents("form:first")}});jQuery.extend({isHtml:function(a){return !!(typeof a==="string"&&/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/.exec(a))},modal:function(a){if(!$(".jqmWindow").length){$("body").append('<div class="jqmWindow"></div>')}if(typeof a==="string"){a={ajax:a}}if(!a.ajaxText){a.ajaxText="Загрузка...";if(cms.langId=="en"){a.ajaxText="Loading..."}}$(".jqmWindow").jqm(a).jqmShow();return false},modalClose:function(){$(".jqmWindow").jqmHide()}});function filterInput(b,c){if(!c){c=/[0-9,.]+/}var a=b.value.match(c).join("");if(a!=b.value){b.value=a}}function cmsClearLogs(b){$(b).parent().parent().hide();$.ajax({url:window.location.href,data:"admin=clearLog",complete:function(){}});return false}function cmsJump(){return false}var isOverlayVisible=false;function overlay(){this._overlay=false;this._overlayInnerBlock=false}overlay.prototype.show=function(c){isOverlayVisible=true;var a=parseInt($("#overlayText").width());var b=parseInt($("#overlayText").height());if(a&&b){$("#overlayInnerBox").css({width:a,height:b})}$("embed, object, select").css({visibility:"hidden"});$("body").append('<div id="overlay"></div>');this._overlay=$("#overlay");this._overlayInnerBlock=c;this._overlayInnerBlock.show();this._overlay.css({opacity:0.6,width:this.widthEx(),height:this.heightEx()}).fadeIn();this._overlay.click(function(){overlay.close()});this._overlayInnerBlock.click(function(d){if(d.target.id===overlay._overlayInnerBlock.attr("id")){overlay.close();return false}return true});overlay.ajusSize();$(window).bind("resize",overlay.ajusSize);$(document).bind("keydown",overlay.keyboardAction)};overlay.prototype.ajusSize=function(){var a=overlay.getPageScroll();overlay._overlayInnerBlock.css({top:a[1]+($(window).height()/20),left:a[0]}).show();overlay._overlay.css({width:overlay.widthEx(),height:overlay.heightEx()})};overlay.prototype.setSize=function(b,j,c,e){if(!e){e=0}b=parseInt(b);j=parseInt(j);var d=$("#overlayInnerBox").width();var h=$("#overlayInnerBox").height();var f=(b+e*2);var g=(j+e*2);var a=d-f;var i=h-g;$("#overlayInnerBox").animate({width:f,height:g},400,function(){if(c){c()}});if((a==0)&&(i==0)){if($.browser.msie){overlay.pause(250)}else{overlay.pause(100)}}};overlay.prototype.pause=function(c){var b=new Date();a=null;do{var a=new Date()}while(a-b<c)};overlay.prototype.close=function(){this._overlay.remove();this._overlayInnerBlock.fadeOut("fast",function(){if(overlay._overlayInnerBlock){overlay._overlayInnerBlock.remove()}});$("embed, object, select").css({visibility:"visible"});$(window).unbind("resize",overlay.ajusSize);$(document).unbind("keydown",overlay.keyboardAction);isOverlayVisible=false};overlay.prototype.keyboardAction=function(c){c=c||window.event;var a=(c.DOM_VK_ESCAPE)?c.DOM_VK_ESCAPE:27;var b=String.fromCharCode(c.keyCode).toLowerCase();if(b=="c"||b=="x"||c.keyCode==a){overlay.close()}};overlay.prototype.getPageScroll=function(){var b,a;if(self.pageYOffset){a=self.pageYOffset;b=self.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollTop){a=document.documentElement.scrollTop;b=document.documentElement.scrollLeft}else{if(document.body){a=document.body.scrollTop;b=document.body.scrollLeft}}}arrayPageScroll=new Array(b,a);return arrayPageScroll};overlay.prototype.heightEx=function(){if($.browser.msie&&$.browser.version<7){var b=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);var a=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);if(b<a){return $(window).height()+"px"}else{return b+"px"}}else{return $(document).height()+"px"}};overlay.prototype.widthEx=function(){if($.browser.msie&&$.browser.version<7){var a=Math.max(document.documentElement.scrollWidth,document.body.scrollWidth);var b=Math.max(document.documentElement.offsetWidth,document.body.offsetWidth);if(a<b){return $(window).width()+"px"}else{return a+"px"}}else{return $(document).width()+"px"}};var overlay=new overlay();(function(a){a.fn.overlay=function(b,c){if(!c){c=""}if(!b){b=this.html()}if(!c){b='<div id="overlayText">'+b+"</div>"}a("body").append('<div id="overlayInner" class="'+c+'"><div id="overlayInnerBox">'+b+"</div></div>");overlay.show(a("#overlayInner"))}})(jQuery);function fixModalSize(b,a){if(!jQuery.browser.msie){if(a){b.css({position:"absolute"})}else{b.css({position:"fixed"})}}else{if(b.height()>$(window).height()){b.addClass("jqmWindowFixed")}}if(b.width()>$(window).width()){b.css({left:"0px","margin-left":"0px"})}else{b.css({left:"50%","margin-left":"-"+(b.width()/2)+"px"})}}(function(d){d.fn.jqm=function(f){var e={overlay:50,overlayClass:"jqmOverlay",closeClass:"jqmClose",trigger:".jqModal",ajax:o,ajaxText:"",target:o,modal:o,toTop:o,onShow:o,onHide:o,onLoad:o};return this.each(function(){if(this._jqm){return n[this._jqm].c=d.extend({},n[this._jqm].c,f)}p++;this._jqm=p;n[p]={c:d.extend(e,d.jqm.params,f),a:o,w:d(this).addClass("jqmID"+p),s:p};if(e.trigger){d(this).jqmAddTrigger(e.trigger)}})};d.fn.jqmAddClose=function(f){return l(this,f,"jqmHide")};d.fn.jqmAddTrigger=function(f){return l(this,f,"jqmShow")};d.fn.jqmShow=function(e){return this.each(function(){d.jqm.open(this._jqm,e)})};d.fn.jqmHide=function(e){return this.each(function(){d.jqm.close(this._jqm,e)})};d.jqm={hash:{},open:function(B,A){var m=n[B],q=m.c,i="."+q.closeClass,v=(parseInt(m.w.css("z-index"))),v=(v>0)?v:3000,f=d("<div></div>").css({height:"100%",width:"100%",position:"fixed",left:0,top:0,"z-index":v-1,opacity:q.overlay/100});if(m.a){return o}m.t=A;m.a=true;m.w.css("z-index",v);if(q.modal){if(!a[0]){k("bind")}a.push(B)}else{if(q.overlay>0){m.w.jqmAddClose(f)}else{f=o}}m.o=(f)?f.addClass(q.overlayClass).prependTo("body"):o;if(c){d("html,body").css({height:"100%",width:"100%"});if(f){f=f.css({position:"absolute"})[0];for(var w in {Top:1,Left:1}){f.style.setExpression(w.toLowerCase(),"(_=(document.documentElement.scroll"+w+" || document.body.scroll"+w+"))+'px'")}}}if(q.ajax){var e=q.target||m.w,x=q.ajax,e=(typeof e=="string")?d(e,m.w):d(e),x=(x.substr(0,1)=="@")?d(A).attr(x.substring(1)):x;e.html(q.ajaxText).load(x,function(){if(q.onLoad){q.onLoad.call(this,m)}if(i){m.w.jqmAddClose(d(i,m.w))}j(m)})}else{if(i){m.w.jqmAddClose(d(i,m.w))}}if(q.toTop&&m.o){m.w.before('<span id="jqmP'+m.w[0]._jqm+'"></span>').insertAfter(m.o)}(q.onShow)?q.onShow(m):m.w.show();j(m);return o},close:function(f){var e=n[f];if(!e.a){return o}e.a=o;if(a[0]){a.pop();if(!a[0]){k("unbind")}}if(e.c.toTop&&e.o){d("#jqmP"+e.w[0]._jqm).after(e.w).remove()}if(e.c.onHide){e.c.onHide(e)}else{e.w.hide();if(e.o){e.o.remove()}}return o},params:{}};var p=0,n=d.jqm.hash,a=[],c=d.browser.msie&&(d.browser.version=="6.0"),o=false,g=d('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),j=function(e){if(c){if(e.o){e.o.html('<p style="width:100%;height:100%"/>').prepend(g)}else{if(!d("iframe.jqm",e.w)[0]){e.w.prepend(g)}}}h(e)},h=function(f){try{d(":input:visible",f.w)[0].focus()}catch(e){}},k=function(e){d()[e]("keypress",b)[e]("keydown",b)[e]("mousedown",b)},b=function(m){var f=n[a[a.length-1]],i=(!d(m.target).parents(".jqmID"+f.s)[0]);if(i){h(f)}return !i},l=function(e,f,i){return e.each(function(){var m=this._jqm;d(f).each(function(){if(!this[i]){this[i]=[];d(this).click(function(){for(var q in {jqmShow:1,jqmHide:1}){for(var r in this[q]){if(n[this[q][r]]){n[this[q][r]].w[q](this)}}}return o})}this[i].push(m)})})}})(jQuery);(function(a){a.fn.lightBox=function(e){var b=this;e=jQuery.extend({containerBorderSize:10,img:[],activeImage:0},e);function f(){if(isOverlayVisible){return false}d(this,b);return false}function d(k,n){var q='<div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-n"><span id="lightbox-num"></span><a href="#" id="lightbox-down" target="_blank" title="Download">&nbsp;</a><a href="#" id="lightbox-link" target="_blank" title="Direct link">&nbsp;</a><a href="#" id="lightbox-cls">&nbsp;</a><a href="#" id="lightbox-n-btnPrev">&nbsp;</a><a href="#" id="lightbox-n-btnNext">&nbsp;</a></div><div id="lightbox-loading"><a href="#">&nbsp;</a></div></div><div id="lightbox-cid"><span id="lightbox-caption"></span></div>';a(document).overlay(q,"lightbox");a("#lightbox-loading[a],#lightbox-cls").click(function(){overlay.close();return false});a("#lightbox-n-btnPrev,#lightbox-n-btnNext").bind("click",function(){if(this.id=="lightbox-n-btnPrev"){if(e.activeImage==0){e.activeImage=e.img.length-1}else{e.activeImage=e.activeImage-1}}else{if(e.activeImage>=(e.img.length-1)){e.activeImage=0}else{e.activeImage=e.activeImage+1}}g();return false});e.img.length=0;e.activeImage=0;var l="",s=false,p=false,o=0;for(o=0;o<n.length;o++){s=a(n[o]);var r=false,m=0;for(m=0;m<e.img.length;m++){if(e.img[m][0]==s.attr("href")){r=true;break}}if(r){continue}l="";if(s.attr("title")){l="<h1>"+s.attr("title")+"</h1>"}else{p=s.next("[className=lightboxText]");if(p.length>0){l=p.html()}else{p=s.find("img[alt]");if(p.length>0){l="<h1>"+p.attr("alt")+"</h1>"}}}e.img.push(new Array(s.attr("href"),l))}jQuery.unique(e.img);while(e.img[e.activeImage][0]!=a(k).attr("href")){e.activeImage++}g()}function g(){a("#lightbox-loading").show();a("#overlayInnerBox").css("height",a("#overlayInnerBox").height());a("#lightbox-image,#lightbox-caption,#lightbox-n,#lightbox-n-btnPrev,#lightbox-n-btnNext,#lightbox-cid,#lightbox-num").hide();var i=new Image();i.onload=function(){a("#lightbox-image").attr("src",e.img[e.activeImage][0]);a("#lightbox-link").attr("href",e.img[e.activeImage][0]);var j=e.img[e.activeImage][0].split("/apps/");j=j[0]+"/gz/apps/"+j[1];a("#lightbox-down").attr("href",j);if(i.width<200){i.width=200}overlay.setSize(i.width,i.height,h,e.containerBorderSize);a("#lightbox-n-btnPrev,#lightbox-n-btnNext").css({height:i.height});i.onload=function(){}};i.src=e.img[e.activeImage][0]}function h(){a("#lightbox-loading").hide();a("#overlayInnerBox").css("height","auto");a("#lightbox-image").fadeIn(function(){a("#lightbox-n,#lightbox-n a").slice(0,4).show();if(e.img.length>1){a("#lightbox-num").html((e.activeImage+1)+"/"+e.img.length).show();a("#lightbox-n-btnPrev,#lightbox-n-btnNext").show();if(e.img[e.activeImage][1]){a("#lightbox-caption").html(e.img[e.activeImage][1]).show();a("#lightbox-cid").slideDown("fast",c)}}})}function c(){overlay.ajusSize()}if(this.length){this.filter(function(){return !a(this).hasClass("zoomStatic")}).unbind("click").click(f)}return this}})(jQuery);(function(a){a.fn.extend({autocomplete:function(b,c){var d=typeof b=="string";c=a.extend({},a.Autocompleter.defaults,{url:d?b:null,data:d?null:b,delay:d?a.Autocompleter.defaults.delay:100,max:c&&!c.scroll?20:150},c);c.highlight=c.highlight||function(e){return e};c.formatMatch=c.formatMatch||c.formatItem;return this.each(function(){new a.Autocompleter(this,c)})},result:function(b){return this.bind("result",b)},search:function(b){return this.trigger("search",[b])},flushCache:function(){return this.trigger("flushCache")},setOptions:function(b){return this.trigger("setOptions",[b])},unautocomplete:function(){return this.trigger("unautocomplete")}});a.Autocompleter=function(n,h){var d={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var c=a(n).attr("autocomplete","off").addClass(h.inputClass);var l;var r="";var o=a.Autocompleter.Cache(h);var f=0;var w;var z={mouseDownOnSelect:false};var t=a.Autocompleter.Select(h,n,e,z);var y;a.browser.opera&&a(n.form).bind("submit.autocomplete",function(){if(y){y=false;return false}});c.bind((a.browser.opera?"keypress":"keydown")+".autocomplete",function(A){w=A.keyCode;switch(A.keyCode){case d.UP:A.preventDefault();if(t.visible()){t.prev()}else{v(0,true)}break;case d.DOWN:A.preventDefault();if(t.visible()){t.next()}else{v(0,true)}break;case d.PAGEUP:A.preventDefault();if(t.visible()){t.pageUp()}else{v(0,true)}break;case d.PAGEDOWN:A.preventDefault();if(t.visible()){t.pageDown()}else{v(0,true)}break;case h.multiple&&a.trim(h.multipleSeparator)==","&&d.COMMA:case d.TAB:case d.RETURN:if(e()){A.preventDefault();y=true;return false}break;case d.ESC:t.hide();break;default:clearTimeout(l);l=setTimeout(v,h.delay);break}}).focus(function(){f++}).blur(function(){f=0;if(!z.mouseDownOnSelect){u()}}).click(function(){if(f++>1&&!t.visible()){v(0,true)}}).bind("search",function(){var A=(arguments.length>1)?arguments[1]:null;function B(F,E){var C;if(E&&E.length){for(var D=0;D<E.length;D++){if(E[D].result.toLowerCase()==F.toLowerCase()){C=E[D];break}}}if(typeof A=="function"){A(C)}else{c.trigger("result",C&&[C.data,C.value])}}a.each(i(c.val()),function(C,D){g(D,B,B)})}).bind("flushCache",function(){o.flush()}).bind("setOptions",function(){a.extend(h,arguments[1]);if("data" in arguments[1]){o.populate()}}).bind("unautocomplete",function(){t.unbind();c.unbind();a(n.form).unbind(".autocomplete")});function e(){var B=t.selected();if(!B){return false}var A=B.result;r=A;if(h.multiple){var C=i(c.val());if(C.length>1){A=C.slice(0,C.length-1).join(h.multipleSeparator)+h.multipleSeparator+A}A+=h.multipleSeparator}c.val(A);x();c.trigger("result",[B.data,B.value]);return true}function v(C,B){if(w==d.DEL){t.hide();return}var A=c.val();if(!B&&A==r){return}r=A;A=k(A);if(A.length>=h.minChars){b();c.addClass(h.loadingClass);if(!h.matchCase){A=A.toLowerCase()}g(A,m,x)}else{p();t.hide()}}function i(B){if(!B){return[""]}var C=B.split(h.multipleSeparator);var A=[];a.each(C,function(D,E){if(a.trim(E)){A[D]=a.trim(E)}});return A}function k(A){if(!h.multiple){return A}var B=i(A);return B[B.length-1]}function s(A,B){if(h.autoFill&&(k(c.val()).toLowerCase()==A.toLowerCase())&&w!=d.BACKSPACE){c.val(c.val()+B.substring(k(r).length));a.Autocompleter.Selection(n,r.length,r.length+B.length)}}function u(){clearTimeout(l);l=setTimeout(x,200)}function x(){var A=t.visible();t.hide();clearTimeout(l);p();if(h.mustMatch){c.search(function(B){if(!B){if(h.multiple){var C=i(c.val()).slice(0,-1);c.val(C.join(h.multipleSeparator)+(C.length?h.multipleSeparator:""))}else{c.val("")}}})}if(A){a.Autocompleter.Selection(n,n.value.length,n.value.length)}}function m(B,A){if(A&&A.length&&f){p();t.display(A,B);s(B,A[0].value);t.show()}else{x()}}function g(B,D,A){if(!h.matchCase){B=B.toLowerCase()}var C=o.load(B);if(C&&C.length){D(B,C)}else{if((typeof h.url=="string")&&(h.url.length>0)){var E={timestamp:+new Date()};a.each(h.extraParams,function(F,G){E[F]=typeof G=="function"?G():G});a.ajax({url:h.url,data:a.extend({s:escape(k(B)),ac:1},E),success:function(G){var F=h.parse&&h.parse(G)||q(G);o.add(B,F);D(B,F)}})}else{t.emptyList();A(B)}}}function q(D){var A=[];var C=D.split("\n");for(var B=0;B<C.length;B++){var E=a.trim(C[B]);if(E){E=E.split("|");A[A.length]={data:E,value:E[0],result:h.formatResult&&h.formatResult(E,E[0])||E[0]}}}return A}function p(){c.removeClass(h.loadingClass)}var j=false;function b(){if(j){return}a("body").append("<style>body .ac_results			{ padding: 0; border: 1px solid #666; background: #fff; overflow: hidden; z-index: 99999 }\r\nbody .ac_results ul		{ width: 100%; list-style-position: outside; list-style: none; padding: 0; margin: 0 }\r\nbody .ac_results li  		{ margin: 0; padding: 2px 5px; cursor: default; display: block; font: menu; font-size: 12px; line-height: 16px; overflow: hidden }\r\nbody .ac_loading			{ background: #fff url("+cms.www_root+"misc/img/ajax2.gif) right center no-repeat !important }\r\nbody .ac_odd 				{ background: #f5f5f5 }\r\nbody .ac_hi 				{ color: #c40000 }\r\nbody .ac_over 				{ background: #ebffce }\r\n</style>")}};a.Autocompleter.defaults={inputClass:"ac_input",resultsClass:"ac_results",loadingClass:"ac_loading",minChars:1,delay:400,matchCase:false,matchSubset:true,matchContains:false,cacheLength:10,max:100,mustMatch:false,extraParams:{},selectFirst:false,formatItem:function(b){return b[0]},formatMatch:null,autoFill:false,width:280,multiple:false,multipleSeparator:", ",highlight:function(c,b){return c.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+b.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong class='ac_hi'>$1</strong>")},scroll:true,scrollHeight:350};a.Autocompleter.Cache=function(c){var f={};var d=0;function h(l,k){if(!c.matchCase){l=l.toLowerCase()}var j=l.indexOf(k);if(j==-1){return false}return j==0||c.matchContains}function g(j,i){if(d>c.cacheLength){b()}if(!f[j]){d++}f[j]=i}function e(){if(!c.data){return false}var k={},j=0;if(!c.url){c.cacheLength=1}k[""]=[];for(var m=0,l=c.data.length;m<l;m++){var p=c.data[m];p=(typeof p=="string")?[p]:p;var o=c.formatMatch(p,m+1,c.data.length);if(o===false){continue}var n=o.charAt(0).toLowerCase();if(!k[n]){k[n]=[]}var q={value:o,data:p,result:c.formatResult&&c.formatResult(p)||o};k[n].push(q);if(j++<c.max){k[""].push(q)}}a.each(k,function(r,s){c.cacheLength++;g(r,s)})}setTimeout(e,25);function b(){f={};d=0}return{flush:b,add:g,populate:e,load:function(n){if(!c.cacheLength||!d){return null}if(!c.url&&c.matchContains){var m=[];for(var j in f){if(j.length>0){var o=f[j];a.each(o,function(p,k){if(h(k.value,n)){m.push(k)}})}}return m}else{if(f[n]){return f[n]}else{if(c.matchSubset){for(var l=n.length-1;l>=c.minChars;l--){var o=f[n.substr(0,l)];if(o){var m=[];a.each(o,function(p,k){if(h(k.value,n)){m[m.length]=k}});return m}}}}}return null}}};a.Autocompleter.Select=function(e,j,l,p){var i={ACTIVE:"ac_over"};var k,f=-1,r,m="",s=true,c,o;function n(){if(!s){return}c=a("<div/>").hide().addClass(e.resultsClass).css("position","absolute").appendTo(document.body);o=a("<ul/>").appendTo(c).mouseover(function(t){if(q(t).nodeName&&q(t).nodeName.toUpperCase()=="LI"){f=a("li",o).removeClass(i.ACTIVE).index(q(t));a(q(t)).addClass(i.ACTIVE)}}).click(function(t){a(q(t)).addClass(i.ACTIVE);l();j.focus();return false}).mousedown(function(){p.mouseDownOnSelect=true}).mouseup(function(){p.mouseDownOnSelect=false});if(e.width>0){c.css("width",e.width)}s=false}function q(u){var t=u.target;while(t&&t.tagName!="LI"){t=t.parentNode}if(!t){return[]}return t}function h(t){k.slice(f,f+1).removeClass(i.ACTIVE);g(t);var v=k.slice(f,f+1).addClass(i.ACTIVE);if(e.scroll){var u=0;k.slice(0,f).each(function(){u+=this.offsetHeight});if((u+v[0].offsetHeight-o.scrollTop())>o[0].clientHeight){o.scrollTop(u+v[0].offsetHeight-o.innerHeight())}else{if(u<o.scrollTop()){o.scrollTop(u)}}}}function g(t){f+=t;if(f<0){f=k.size()-1}else{if(f>=k.size()){f=0}}}function b(t){return e.max&&e.max<t?e.max:t}function d(){o.empty();var u=b(r.length);for(var v=0;v<u;v++){if(!r[v]){continue}var w=e.formatItem(r[v].data,v+1,u,r[v].value,m);if(w===false){continue}var t=a("<li/>").html(e.highlight(w,m)).addClass(v%2==0?"ac_even":"ac_odd").appendTo(o)[0];a.data(t,"ac_data",r[v])}k=o.find("li");if(e.selectFirst){k.slice(0,1).addClass(i.ACTIVE);f=0}}return{display:function(u,t){n();r=u;m=t;d()},next:function(){h(1)},prev:function(){h(-1)},pageUp:function(){if(f!=0&&f-8<0){h(-f)}else{h(-8)}},pageDown:function(){if(f!=k.size()-1&&f+8>k.size()){h(k.size()-1-f)}else{h(8)}},hide:function(){c&&c.hide();k&&k.removeClass(i.ACTIVE);f=-1},visible:function(){return c&&c.is(":visible")},current:function(){return this.visible()&&(k.filter("."+i.ACTIVE)[0]||e.selectFirst&&k[0])},show:function(){var v=a(j).offset();c.css({width:typeof e.width=="string"||e.width>0?e.width:a(j).width(),top:v.top+j.offsetHeight,left:v.left}).show();if(e.scroll){o.scrollTop(0);o.css({maxHeight:e.scrollHeight,overflow:"auto"});if(a.browser.msie&&typeof document.body.style.maxHeight==="undefined"){var t=0;k.each(function(){t+=this.offsetHeight});var u=t>e.scrollHeight;o.css("height",u?e.scrollHeight:t);if(!u){k.width(o.width()-parseInt(k.css("padding-left"))-parseInt(k.css("padding-right")))}}}},selected:function(){var t=k&&k.filter("."+i.ACTIVE).removeClass(i.ACTIVE);return t&&t.length&&a.data(t[0],"ac_data")},emptyList:function(){o&&o.empty()},unbind:function(){c&&c.remove()}}};a.Autocompleter.Selection=function(d,e,c){if(d.createTextRange){var b=d.createTextRange();b.collapse(true);b.moveStart("character",e);b.moveEnd("character",c);b.select()}else{if(d.setSelectionRange){d.setSelectionRange(e,c)}else{if(d.selectionStart){d.selectionStart=e;d.selectionEnd=c}}}d.focus()}})(jQuery);