]> git.openstreetmap.org Git - osqa.git/blob - osqa/forum/skins/default/media/js/osqa.main.min.js
Updated CSS and reformatted in IntelliJ
[osqa.git] / osqa / forum / skins / default / media / js / osqa.main.min.js
1 var response_commands={update_post_score:function(a,d,b){var c=$("#"+a+"-"+d+"-score");c.html(parseInt(c.html())+b)},update_user_post_vote:function(c,e,b){var a=$("#"+c+"-"+e+"-upvote");var d=$("#"+c+"-"+e+"-downvote");a.removeClass("on");d.removeClass("on");if(b=="up"){a.addClass("on")}else{if(b=="down"){d.addClass("on")}}},update_favorite_count:function(b){var c=$("#favorite-count");var a=parseInt(c.html());if(isNaN(a)){a=0}a+=b;if(a==0){a=""}c.html(a)},update_favorite_mark:function(a){if(a=="on"){$("#favorite-mark").addClass("on")}else{$("#favorite-mark").removeClass("on")}},mark_accepted:function(b){$(".accepted-answer").removeClass("accepted-answer");$(".accept-answer.on").removeClass("on");var a=$("#answer-container-"+b);a.addClass("accepted-answer");a.find(".accept-answer").addClass("on")},unmark_accepted:function(b){var a=$("#answer-container-"+b);a.removeClass("accepted-answer");a.find(".accept-answer").removeClass("on")},update_comment_score:function(d,b){var c=$("#comment-"+d+"-score");var a=parseInt(c.html());if(isNaN(a)){a=0}a+=b;if(a==0){a=""}c.html(a)},update_likes_comment_mark:function(c,a){var b=$("#comment-"+c+"-like");if(a=="on"){b.addClass("on")}else{b.removeClass("on")}},remove_comment:function(b){var a=$("#comment-"+b);a.css("background","red");a.fadeOut("slow",function(){a.remove()})},insert_comment:function(g,c,a,f,e,h,b){var i=$("#comments-container-"+g+"-"+c);var d=$("#new-comment-skeleton-"+g+"-"+c).html().toString();d=d.replace(new RegExp("%ID%","g"),a).replace(new RegExp("%COMMENT%","g"),f).replace(new RegExp("%USERNAME%","g"),e).replace(new RegExp("%PROFILE_URL%","g"),h).replace(new RegExp("%DELETE_URL%","g"),b);i.append(d);$("#comment-"+a).slideDown("slow")},update_comment:function(b,a){var c=$("#comment-"+b);c.find(".comment-text").html(a);c.slideDown("slow")},mark_deleted:function(b,a){if(b=="answer"){var d=$("#answer-container-"+a);d.addClass("deleted")}else{var c=$("#question-table");c.addClass("deleted")}},set_subscription_button:function(a){$(".subscription_switch").html(a)},set_subscription_status:function(a){$(".subscription-status").html(a)}};function show_message(a,b){var c=$('<div class="vote-notification"><h3>'+b+"</h3>(click to close)</div>");c.click(function(d){$(".vote-notification").fadeOut("fast",function(){$(this).remove()})});a.parent().append(c);c.fadeIn("fast")}function process_ajax_response(b,a){if(!b.success&&b.error_message!=undefined){show_message(a,b.error_message)}else{if(typeof b.commands!=undefined){for(var c in b.commands){response_commands[c].apply(null,b.commands[c])}if(b.message!=undefined){show_message(a,b.message)}}}}$(function(){$("a.ajax-command").live("click",function(){var a=$(this);$.getJSON(a.attr("href"),function(b){process_ajax_response(b,a)});return false});$("div.comment-form-container").each(function(){var l=$(this);var o=l.find("form");var g=l.find("textarea");var a=l.find('input[type="submit"]');var e=$(".comment-chars-left");var b=l.find(".comments-char-left-count");var m=l.parent().find(".comment-tools");var n=m.find(".add-comment-link");var f=l.parent().find(".comments-container");var k=parseInt(b.html());var h=false;function i(){g.val("");b.html(k);e.removeClass("warn");h=false}i();function d(){var q=g.val().length;var p=true;if(q<k){if(q<k*0.75){e.removeClass("warn")}else{e.addClass("warn")}}else{p=false}b.html(k-q);return p}function c(){l.slideDown("slow");n.fadeOut("slow")}function j(){l.slideUp("slow");n.fadeIn("slow")}n.click(function(){i();c();return false});m.find(".show-all-comments-link").click(function(){f.find(".not_top_scorer").slideDown("slow");$(this).fadeOut("slow");m.find(".comments-showing").fadeOut("slow");return false});$("#"+f.attr("id")+" .comment-edit").live("click",function(){var q=$(this);var r=/comment-(\d+)-edit/.exec(q.attr("id"))[1];var s=q.parents(".comment");var p=s.find(".comment-text").text().trim();h=r;g.val(p);d();s.slideUp("slow");c();return false});g.keyup(d);a.click(function(){if(g.val().length>k){show_message(a,"Your comment exceeds the max number of characters allowed.")}else{var p={comment:g.val()};if(h){p.id=h}$.post(o.attr("action"),p,function(q){process_ajax_response(q,a);i()},"json")}j();return false})})});function pickedTags(){var a=function(j,k,i,l){var h=scriptUrl;if(i=="add"){h+=$.i18n._("mark-tag/");if(k=="good"){h+=$.i18n._("interesting/")}else{h+=$.i18n._("ignored/")}}else{h+=$.i18n._("unmark-tag/")}h=h+j+"/";var g={type:"POST",url:h};if(l!==false){g.success=l}$.ajax(g)};var f=function(k,h,i,g){var j=function(){k[h].remove();delete k[h]};if(g){a(h,i,"remove",j)}else{j()}};var b=function(k,h,i,j,g){k.unbind("mouseover").bind("mouseover",function(){$(this).attr("src",mediaUrl("media/images/close-small-hover.png"))});k.unbind("mouseout").bind("mouseout",function(){$(this).attr("src",mediaUrl("media/images/close-small-dark.png"))});k.click(function(){f(h,i,j,g)})};var d=function(k,j){var i=$.trim($(k).prev().attr("value"));var g=interestingTags;var l=ignoredTags;var h;if(j=="bad"){g=ignoredTags;l=interestingTags;h=$("div .tags.ignored")}else{if(j!="good"){return}else{h=$("div .tags.interesting")}}if(i in l){f(l,i,j,false)}if(!(i in g)){a(i,j,"add",function(){var n=$("<span></span>");n.addClass("deletable-tag");var m=$("<a></a>");m.attr("rel","tag");m.attr("href",scriptUrl+$.i18n._("tags/")+i);m.html(i);var o=$("<img></img>");o.addClass("delete-icon");o.attr("src",mediaUrl("/media/images/close-small-dark.png"));b(o,g,i,j,true);n.append(m);n.append(o);h.append(n);g[i]=n})}};var c=function(){var g="interesting-tag-";var j="ignored-tag-";var i=RegExp("^"+g);var h=RegExp("^"+j);interestingTags={};ignoredTags={};$(".deletable-tag").each(function(l,n){var k=$(n).attr("id");var o,m;if(i.test(k)){o=k.replace(g,"");m=interestingTags;reason="good"}else{if(h.test(k)){o=k.replace(j,"");m=ignoredTags;reason="bad"}else{return}}m[o]=$(n);b($(n).find("img"),m,o,reason,true)})};var e=function(){$("#hideIgnoredTagsCb").unbind("click").click(function(){$.ajax({type:"POST",dataType:"json",cache:false,url:scriptUrl+$.i18n._("command/"),data:{command:"toggle-ignored-questions"}})})};return{init:function(){c();e();$("#interestingTagInput, #ignoredTagInput").autocomplete(tags,{minChars:1,matchContains:true,max:20,multiple:true,multipleSeparator:" ",formatItem:function(j,h,g){return j.n+" ("+j.c+")"},formatResult:function(j,h,g){return j.n}});$("#interestingTagAdd").click(function(){d(this,"good")});$("#ignoredTagAdd").click(function(){d(this,"bad")})}}}$(document).ready(function(){if(window.tags!=undefined){pickedTags().init()}});Hilite={elementid:"content",exact:true,max_nodes:1000,onload:true,style_name:"hilite",style_name_suffix:true,debug_referrer:""};Hilite.search_engines=[["local","q"],["cnprog\\.","q"],["google\\.","q"],["search\\.yahoo\\.","p"],["search\\.msn\\.","q"],["search\\.live\\.","query"],["search\\.aol\\.","userQuery"],["ask\\.com","q"],["altavista\\.","q"],["feedster\\.","q"],["search\\.lycos\\.","q"],["alltheweb\\.","q"],["technorati\\.com/search/([^\\?/]+)",1],["dogpile\\.com/info\\.dogpl/search/web/([^\\?/]+)",1,true]];Hilite.decodeReferrer=function(m){var j=null;var l=new RegExp("");for(var n=0;n<Hilite.search_engines.length;n++){var k=Hilite.search_engines[n];l.compile("^http://(www\\.)?"+k[0],"i");var h=m.match(l);if(h){var i;if(isNaN(k[1])){i=Hilite.decodeReferrerQS(m,k[1])}else{i=h[k[1]+1]}if(i){i=decodeURIComponent(i);if(k.length>2&&k[2]){i=decodeURIComponent(i)}i=i.replace(/\'|"/g,"");i=i.split(/[\s,\+\.]+/);return i}break}}return null};Hilite.decodeReferrerQS=function(k,m){var h=k.indexOf("?");var n;if(h>=0){var i=new String(k.substring(h+1));h=0;n=0;while((h>=0)&&((n=i.indexOf("=",h))>=0)){var l,j;l=i.substring(h,n);h=i.indexOf("&",n)+1;if(l==m){if(h<=0){return i.substring(n+1)}else{return i.substring(n+1,h-1)}}else{if(h<=0){return null}}}}return null};Hilite.hiliteElement=function(i,j){if(!j||i.childNodes.length==0){return}var l=new Array();for(var g=0;g<j.length;g++){j[g]=j[g].toLowerCase();if(Hilite.exact){l.push("\\b"+j[g]+"\\b")}else{l.push(j[g])}}l=new RegExp(l.join("|"),"i");var h={};for(var g=0;g<j.length;g++){if(Hilite.style_name_suffix){h[j[g]]=Hilite.style_name+(g+1)}else{h[j[g]]=Hilite.style_name}}var k=function(a){var c=l.exec(a.data);if(c){var o=c[0];var d="";var e=a.splitText(c.index);var f=e.splitText(o.length);var b=a.ownerDocument.createElement("SPAN");a.parentNode.replaceChild(b,e);b.className=h[o.toLowerCase()];b.appendChild(e);return b}else{return a}};Hilite.walkElements(i.childNodes[0],1,k)};Hilite.hilite=function(){var d=Hilite.debug_referrer?Hilite.debug_referrer:document.referrer;var c=null;d=Hilite.decodeReferrer(d);if(d&&((Hilite.elementid&&(c=document.getElementById(Hilite.elementid)))||(c=document.body))){Hilite.hiliteElement(c,d)}};Hilite.walkElements=function(k,i,j){var h=/^(script|style|textarea)/i;var l=0;while(k&&i>0){l++;if(l>=Hilite.max_nodes){var g=function(){Hilite.walkElements(k,i,j)};setTimeout(g,50);return}if(k.nodeType==1){if(!h.test(k.tagName)&&k.childNodes.length>0){k=k.childNodes[0];i++;continue}}else{if(k.nodeType==3){k=j(k)}}if(k.nextSibling){k=k.nextSibling}else{while(i>0){k=k.parentNode;i--;if(k.nextSibling){k=k.nextSibling;break}}}}};if(Hilite.onload){if(window.attachEvent){window.attachEvent("onload",Hilite.hilite)}else{if(window.addEventListener){window.addEventListener("load",Hilite.hilite,false)}else{var __onload=window.onload;window.onload=function(){Hilite.hilite();__onload()}}}}var mediaUrl=function(a){return scriptUrl+"m/"+osqaSkin+"/"+a};(function(a){a.i18n={setDictionary:function(b){b=b},_:function(d,c){var b=d;if(i18n_dict&&i18n_dict[d]){b=i18n_dict[d]}return this.printf(b,c)},toEntity:function(d){var b="";for(var c=0;c<d.length;c++){if(d.charCodeAt(c)>128){b+="&#"+d.charCodeAt(c)+";"}else{b+=d.charAt(c)}}return b},stripStr:function(b){return b.replace(/^\s*/,"").replace(/\s*$/,"")},stripStrML:function(d){var c=d.split("\n");for(var b=0;b<c.length;b++){c[b]=stripStr(c[b])}return stripStr(c.join(" "))},printf:function(e,b){if(!b){return e}var d="";var f=e.split("%s");for(var c=0;c<b.length;c++){if(f[c].lastIndexOf("%")==f[c].length-1&&c!=b.length-1){f[c]+="s"+f.splice(c+1,1)[0]}d+=f[c]+b[c]}return d+f[f.length-1]}}})(jQuery);var i18nZh={"insufficient privilege":"??????????","cannot pick own answer as best":"??????????????","anonymous users cannot select favorite questions":"?????????????","please login":"??????","anonymous users cannot vote":"????????",">15 points requried to upvote":"??+15?????????",">100 points required to downvote":"??+100?????????","please see":"??","cannot vote for own posts":"??????????","daily vote cap exhausted":"????????????????","cannot revoke old vote":"??????????????","please confirm offensive":"??????????????????????","anonymous users cannot flag offensive posts":"???????????","cannot flag message as offensive twice":"???????","flag offensive cap exhausted":"?????????????5?�??�???","need >15 points to report spam":"??+15??????�???�?","confirm delete":"?????/????????","anonymous users cannot delete/undelete":"???????????????","post recovered":"?????????????","post deleted":"????????????","add comment":"????","community karma points":"????","to comment, need":"????","delete this comment":"?????","hide comments":"????","add a comment":"????",comments:"??","confirm delete comment":"?????????",characters:"??","can write":"???","click to close":"???????","loading...":"???...","tags cannot be empty":"???????","tablimits info":"??5????????????20????","content cannot be empty":"???????","content minchars":"????? {0} ???","please enter title":"??????","title minchars":"????? {0} ???","delete":"??",undelete:"??",bold:"??",italic:"??",link:"???",quote:"??","preformatted text":"??",image:"??","numbered list":"??????","bulleted list":"??????",heading:"??","horizontal bar":"???",undo:"??",redo:"??","enter image url":'<b>??????</b></p><p>???<br />http://www.example.com/image.jpg   "????"',"enter url":'<b>??Web??</b></p><p>???<br />http://www.cnprog.com/   "????"</p>"',"upload image":"?????????"};var i18nEn={"need >15 points to report spam":"need >15 points to report spam ",">15 points requried to upvote":">15 points required to upvote ","tags cannot be empty":"please enter at least one tag","anonymous users cannot vote":"sorry, anonymous users cannot vote ","anonymous users cannot select favorite questions":"sorry, anonymous users cannot select favorite questions ","to comment, need":"(to comment other people's posts, karma ","please see":"please see ","community karma points":" or more is necessary) - ","upload image":"Upload image:","enter image url":'enter URL of the image, e.g. http://www.example.com/image.jpg "image title"',"enter url":'enter Web address, e.g. http://www.example.com "page title"',"daily vote cap exhausted":"sorry, you've used up todays vote cap","cannot pick own answer as best":"sorry, you cannot accept your own answer","cannot revoke old vote":"sorry, older votes cannot be revoked","please confirm offensive":"are you sure this post is offensive, contains spam, advertising, malicious remarks, etc.?","flag offensive cap exhausted":"sorry, you've used up todays cap of flagging offensive messages ","confirm delete":"are you sure you want to delete this?","anonymous users cannot delete/undelete":"sorry, anonymous users cannot delete or undelete posts","post recovered":"your post is now restored!","post deleted":"your post has been deleted","confirm delete comment":"do you really want to delete this comment?","can write":"have ","tablimits info":"up to 5 tags, no more than 20 characters each","content minchars":"please enter more than {0} characters","title minchars":"please enter at least {0} characters",characters:"characters left","cannot vote for own posts":"sorry, you cannot vote for your own posts","cannot flag message as offensive twice":"cannot flag message as offensive twice ",">100 points required to downvote":">100 points required to downvote "};var i18nEs={"insufficient privilege":"privilegio insuficiente","cannot pick own answer as best":"no puede escoger su propia respuesta como la mejor","anonymous users cannot select favorite questions":"usuarios anonimos no pueden seleccionar","please login":"por favor inicie sesi�n","anonymous users cannot vote":"usuarios an�nimos no pueden votar",">15 points requried to upvote":">15 puntos requeridos para votar positivamente",">100 points required to downvote":">100 puntos requeridos para votar negativamente","please see":"por favor vea","cannot vote for own posts":"no se puede votar por sus propias publicaciones","daily vote cap exhausted":"cuota de votos diarios excedida","cannot revoke old vote":"no puede revocar un voto viejo","please confirm offensive":"por favor confirme ofensiva","anonymous users cannot flag offensive posts":"usuarios an�nimos no pueden marcar publicaciones como ofensivas","cannot flag message as offensive twice":"no puede marcar mensaje como ofensivo dos veces","flag offensive cap exhausted":"cuota para marcar ofensivas ha sido excedida","need >15 points to report spam":"necesita >15 puntos para reportar spam","confirm delete":"�Est� seguro que desea borrar esto?","anonymous users cannot delete/undelete":"usuarios an�nimos no pueden borrar o recuperar publicaciones","post recovered":"publicaci�n recuperada","post deleted":"publicaci�n borrada?","add comment":"agregar comentario","community karma points":"reputaci�n comunitaria","to comment, need":"para comentar, necesita reputaci�n","delete this comment":"borrar este comentario","hide comments":"ocultar comentarios","add a comment":"agregar comentarios",comments:"comentarios","confirm delete comment":"�Realmente desea borrar este comentario?",characters:"caracteres faltantes","can write":"tiene ","click to close":"haga click para cerrar","loading...":"cargando...","tags cannot be empty":"las etiquetas no pueden estar vac�as","tablimits info":"hasta 5 etiquetas de no mas de 20 caracteres cada una","content cannot be empty":"el contenido no puede estar vac�o","content minchars":"por favor introduzca mas de {0} caracteres","please enter title":"por favor ingrese un t�tulo","title minchars":"por favor introduzca al menos {0} caracteres","delete":"borrar",undelete:"recuperar",bold:"negrita",italic:"cursiva",link:"enlace",quote:"citar","preformatted text":"texto preformateado",image:"imagen","numbered list":"lista numerada","bulleted list":"lista no numerada",heading:"??","horizontal bar":"barra horizontal",undo:"deshacer",redo:"rehacer","enter image url":'introduzca la URL de la imagen, por ejemplo?<br />http://www.example.com/image.jpg   "titulo de imagen"',"enter url":'introduzca direcciones web, ejemplo?<br />http://www.cnprog.com/   "titulo del enlace"</p>"',"upload image":"cargar imagen?","questions/":"preguntas/","vote/":"votar/"};var i18n={en:i18nEn,zh_CN:i18nZh,es:i18nEs};var i18n_dict=i18n[i18nLang];(function(c){var h,i;var d=0;var a=32;var e;c.fn.TextAreaResizer=function(){return this.each(function(){h=c(this).addClass("processed"),i=null;c(this).wrap('<div class="resizable-textarea"><span></span></div>').parent().append(c('<div class="grippie"></div>').bind("mousedown",{el:this},b));var k=c("div.grippie",c(this).parent())[0];k.style.marginRight=(k.offsetWidth-c(this)[0].offsetWidth)+"px"})};function b(k){h=c(k.data.el);h.blur();d=j(k).y;i=h.height()-d;h.css("opacity",0.25);c(document).mousemove(g).mouseup(f);return false}function g(m){var k=j(m).y;var l=i+k;if(d>=(k)){l-=5}d=k;l=Math.max(a,l);h.height(l+"px");if(l<a){f(m)}return false}function f(k){c(document).unbind("mousemove",g).unbind("mouseup",f);h.css("opacity",1);h.focus();h=null;i=null;d=0}function j(k){return{x:k.clientX+document.documentElement.scrollLeft,y:k.clientY+document.documentElement.scrollTop}}})(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:10,max:c&&!c.scroll?10: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(l,g){var c={UP:38,DOWN:40,DEL:46,TAB:9,RETURN:13,ESC:27,COMMA:188,PAGEUP:33,PAGEDOWN:34,BACKSPACE:8};var b=a(l).attr("autocomplete","off").addClass(g.inputClass);var j;var p="";var m=a.Autocompleter.Cache(g);var e=0;var u;var x={mouseDownOnSelect:false};var r=a.Autocompleter.Select(g,l,d,x);var w;a.browser.opera&&a(l.form).bind("submit.autocomplete",function(){if(w){w=false;return false}});b.bind((a.browser.opera?"keypress":"keydown")+".autocomplete",function(y){u=y.keyCode;switch(y.keyCode){case c.UP:y.preventDefault();if(r.visible()){r.prev()}else{t(0,true)}break;case c.DOWN:y.preventDefault();if(r.visible()){r.next()}else{t(0,true)}break;case c.PAGEUP:y.preventDefault();if(r.visible()){r.pageUp()}else{t(0,true)}break;case c.PAGEDOWN:y.preventDefault();if(r.visible()){r.pageDown()}else{t(0,true)}break;case g.multiple&&a.trim(g.multipleSeparator)==","&&c.COMMA:case c.TAB:case c.RETURN:if(d()){y.preventDefault();w=true;return false}break;case c.ESC:r.hide();break;default:clearTimeout(j);j=setTimeout(t,g.delay);break}}).focus(function(){e++}).blur(function(){e=0;if(!x.mouseDownOnSelect){s()}}).click(function(){if(e++>1&&!r.visible()){t(0,true)}}).bind("search",function(){var y=(arguments.length>1)?arguments[1]:null;function z(D,C){var A;if(C&&C.length){for(var B=0;B<C.length;B++){if(C[B].result.toLowerCase()==D.toLowerCase()){A=C[B];break}}}if(typeof y=="function"){y(A)}else{b.trigger("result",A&&[A.data,A.value])}}a.each(h(b.val()),function(A,B){f(B,z,z)})}).bind("flushCache",function(){m.flush()}).bind("setOptions",function(){a.extend(g,arguments[1]);if("data" in arguments[1]){m.populate()}}).bind("unautocomplete",function(){r.unbind();b.unbind();a(l.form).unbind(".autocomplete")});function d(){var z=r.selected();if(!z){return false}var y=z.result;p=y;if(g.multiple){var A=h(b.val());if(A.length>1){y=A.slice(0,A.length-1).join(g.multipleSeparator)+g.multipleSeparator+y}y+=g.multipleSeparator}b.val(y);v();b.trigger("result",[z.data,z.value]);return true}function t(A,z){if(u==c.DEL){r.hide();return}var y=b.val();if(!z&&y==p){return}p=y;y=i(y);if(y.length>=g.minChars){b.addClass(g.loadingClass);if(!g.matchCase){y=y.toLowerCase()}f(y,k,v)}else{n();r.hide()}}function h(z){if(!z){return[""]}var A=z.split(g.multipleSeparator);var y=[];a.each(A,function(B,C){if(a.trim(C)){y[B]=a.trim(C)}});return y}function i(y){if(!g.multiple){return y}var z=h(y);return z[z.length-1]}function q(y,z){if(g.autoFill&&(i(b.val()).toLowerCase()==y.toLowerCase())&&u!=c.BACKSPACE){b.val(b.val()+z.substring(i(p).length));a.Autocompleter.Selection(l,p.length,p.length+z.length)}}function s(){clearTimeout(j);j=setTimeout(v,200)}function v(){var y=r.visible();r.hide();clearTimeout(j);n();if(g.mustMatch){b.search(function(z){if(!z){if(g.multiple){var A=h(b.val()).slice(0,-1);b.val(A.join(g.multipleSeparator)+(A.length?g.multipleSeparator:""))}else{b.val("")}}})}if(y){a.Autocompleter.Selection(l,l.value.length,l.value.length)}}function k(z,y){if(y&&y.length&&e){n();r.display(y,z);q(z,y[0].value);r.show()}else{v()}}function f(z,B,y){if(!g.matchCase){z=z.toLowerCase()}var A=m.load(z);if(A&&A.length){B(z,A)}else{if((typeof g.url=="string")&&(g.url.length>0)){var C={timestamp:+new Date()};a.each(g.extraParams,function(D,E){C[D]=typeof E=="function"?E():E});a.ajax({mode:"abort",port:"autocomplete"+l.name,dataType:g.dataType,url:g.url,data:a.extend({q:i(z),limit:g.max},C),success:function(E){var D=g.parse&&g.parse(E)||o(E);m.add(z,D);B(z,D)}})}else{r.emptyList();y(z)}}}function o(B){var y=[];var A=B.split("\n");for(var z=0;z<A.length;z++){var C=a.trim(A[z]);if(C){C=C.split("|");y[y.length]={data:C,value:C[0],result:g.formatResult&&g.formatResult(C,C[0])||C[0]}}}return y}function n(){b.removeClass(g.loadingClass)}};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:true,formatItem:function(b){return b[0]},formatMatch:null,autoFill:false,width:0,multiple:false,multipleSeparator:", ",highlight:function(c,b){return c.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+b.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<strong>$1</strong>")},scroll:true,scrollHeight:180};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}if(a.fn.bgiframe){o.bgiframe()}}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);var notify=function(){var a=false;return{show:function(b){if(b){$("body").css("margin-top","2.2em");$(".notify span").html(b)}$(".notify").fadeIn("slow");a=true},close:function(b){if(b){$.post(scriptUrl+$.i18n._("messages/")+$.i18n._("markread/"),{formdata:"required"})}$(".notify").fadeOut("fast");$("body").css("margin-top","0");a=false},isVisible:function(){return a}}}();