Files
OMS/app/desktop/statics/js_mini/tools_min.js
2025-12-28 23:13:25 +08:00

2 lines
23 KiB
JavaScript

var MessageBox=new Class({Implements:[Events,Options],options:{element:"messagebox",type:"default",autohide:!1,type2class:{default:"default",error:"exception",notice:"warning"}},initialize:function(t,i){for(e in this.setOptions(i),$clear(MessageBox.delay),this.options.element=$(this.options.element),this.options.element.$events)this.options.element.removeEvents(e);this.options.element.className=this.options.element.className.replace(/(default|warning|exception)/,""),this.options.element.set("html",t);var s=this.options.autohide;return s&&(s="number"==$type(s)?s:3e3,MessageBox.delay=this.hide.delay(s,this)),this.show()},show:function(){return this.options.element.addClass(this.options.type2class[this.options.type]),this.fireEvent("onShow",arguments)},hide:function(){return this.options.element.removeClass(this.options.type2class[this.options.type]),this.fireEvent("onHide",arguments)}});MessageBox.delay=0,$extend(MessageBox,{error:function(t){new MessageBox(t,{type:"error",autohide:!0})},success:function(t){new MessageBox(t,{autohide:!0})},show:function(t){new MessageBox(t,{type:"notice",autohide:!0})}}),function(){var s,n;Dialog=new Class({Implements:[Options,Events],options:{onShow:$empty,onHide:$empty,onClose:$empty,onLoad:$empty,callback:!1,iframe:!1,ajaksable:!0,width:700,height:400,dialogBoxWidth:2,title:"",dragable:!0,resizeable:!0,singlon:!0,modal:!0,ajaxoptions:{update:!1,evalScripts:!0,method:"get",autoCancel:!0,render:!0}},initialize:function(i,t){var e;(this.currentRegionDialogs=$$(".dialog")).some(function(t,e){if(t.retrieve("serial")==i.toString().trim()&&"none"!=t.style.display)return t.inject(document.body),!0})||(this.url=i,this.setOptions(t),t=this.options,e=this.options.iframe?null!=n?n:n=getTplById("dialogwithframe"):null!=s?s:s=getTplById("dialog"),this.dialog=new Element("div",{id:"dialog_"+this.UID,class:"dialog",styles:{visibility:"hidden",zoom:1,opacity:0,zIndex:65534}}),this.UID=$uid(this.dialog),this.dialog.set("id","dialog_"+this.UID).setHTML(e).inject(document.body).store("serial",i.toString().trim()),this.options.callback&&this.dialog.store("callback",this.options.callback),this.dialog_head=$E(".dialog-head",this.dialog).addEvent("click",function(t){1<$$(".dialog").length&&this.inject(document.body)}.bind(this.dialog)),this.dialog_body=$E(".dialog-content-body",this.dialog),this.setTitle(t.title||"&nbsp;"),$E(".btn-close",this.dialog_head).addEvents({click:function(t){t=t&&new Event(t).stop(),this.close()}.bind(this),mousedown:function(t){new Event(t).stop()}}),t.dragable&&this.dragDialog(),t.resizeable?this.dialog_body.makeResizable({handle:$E(".btn-resize",this.dialog),limit:{x:[200,.9*window.getSize().x],y:[100,Math.max(window.getSize().y,window.getScrollSize().y)]},onDrag:function(){this.setDialogWidth()}.bind(this)}):$E(".btn-resize",this.dialog).hide(),t.ajaksable||(t.ajaxoptions.render=!1),$extend(t.ajaxoptions,{update:this.dialog_body,sponsor:!1,resizeupdate:!1,evalScripts:!1,onRequest:function(){}.bind(this),onFailure:function(){this.close(),new MessageBox("对话框加载失败",{type:"error",autohide:!0})}.bind(this),onComplete:function(){this.fireEvent("onComplete",$splat(arguments)),this.showDialog.attempt(arguments,this)}.bind(this)}),this.popup(i,t))},popup:function(t,e){this.fireEvent("onShow",this),this.initContent(t,e)},initContent:function(t,e,i){e=e||this.options;var s,n=this;if(i||(s=arguments.callee,this.reload=function(){s(t,e,!0)}),e.iframe){if(new MessageBox(LANG_Dialog.loading,{type:"notice"}),e.ajaxoptions.data){var o,a=e.ajaxoptions.data;switch(typeOf(a)){case"element":a=document.id(a).toQueryString();break;case"object":case"hash":a=Object.toQueryString(a)}return(o=new Element("form")).adopt(a.toFormElements()),o.set({id:"abbcc",action:t,method:e.ajaxoptions.method,target:this.dialog_body.name}),o.injectAfter(this.dialog_body),this.dialog_body.set("src","about:blank").addEvent("load",function(){n.showDialog.call(n,this),new MessageBox(LANG_Dialog.loading,{autohide:!0}),this.removeEvent("load",arguments.callee),o.submit()})}return this.dialog_body.set("src",t).addEvent("load",function(){n.showDialog.call(n,this),new MessageBox(LANG_Dialog.success,{autohide:!0}),this.removeEvent("load",arguments.callee)})}if("element"!=$type(t))W.page(t,e.ajaxoptions);else{try{this.dialog_body.empty().adopt(t)}catch(t){this.dialog_body.setHTML(LANG_Dialog.error)}i||this.showDialog.call(this)}},showDialog:function(t,e,i){var s=$E("*[isCloseDialogBtn]",this.dialog);s&&s.addEvent("click",this.close.bind(this));var n=$E("form[isCloseDialog]",this.dialog);n&&n.store("target",{onComplete:function(t){if(t){var e={};try{e=JSON.decode(t)}catch(t){}var i=e.finder_id;e.error||(this.close(),i&&finderGroup[i]&&finderGroup[i].refresh())}}.bind(this)}),this.dialog.store("instance",this),this.setDialog_bodySize();var o=this.currentRegionDialogs,a=o?o.length:0;a&&0<a?this.dialog.position($H(o[a-1].getPosition()).map(function(t){return t+20})).setOpacity(1):this.dialog.amongTo(window),this.options.modal&&MODALPANEL.show(),$exec(i),this.fireEvent("onLoad",this)},close:function(){try{this.fireEvent("onClose",this.dialog)}catch(t){}return this.dialog.style.display="none",this.dialog.remove(),$("dialogdragghost_"+this.UID)&&$("dialogdragghost_"+this.UID).remove(),!(0<this.currentRegionDialogs.length)&&(this.options.modal&&MODALPANEL.hide(),"nodialog")},hide:function(){this.fireEvent("onHide"),this.close.call(this)},setDialog_bodySize:function(){this.options.height="string"==$type(this.options.height)?this.options.height.toInt():this.options.height,this.options.width="string"==$type(this.options.width)?this.options.width.toInt():this.options.width;var t=window.getSize(),e=t.x,i=t.y;this.options.width>e&&(this.options.width=e-100),this.options.height>i&&(this.options.height=i-100);var s=this.dialog.getElement(".dialog-content-head").getSize().y+this.dialog.getElement(".dialog-content-foot").getSize().y;this.dialog_body.setStyles({height:this.options.height<1?this.options.height*window.getSize().y-s:this.options.height-s,width:this.options.width<1?this.options.width*window.getSize().x:this.options.width}),this.setDialogWidth()},setDialogWidth:function(){this.dialog.setStyle("width",this.dialog_body.getSize().x+this.dialog.getElement(".dialog-box").getPatch().x)},setTitle:function(t){$E(".dialog-title",this.dialog_head).set("html",t)},dragDialog:function(){var e=this.dialog,i=new Element("div",{id:"dialogdragghost_"+this.UID});i.setStyles({position:"absolute",cursor:"move",background:"#66CCFF",display:"none",opacity:.3,zIndex:65535}).inject(document.body),this.addEvent("load",function(t){i.setStyles(e.getCis())}),new Drag(i,{handle:this.dialog_head,limit:{x:[0,window.getSize().x],y:[0,window.getSize().y]},onStart:function(){i.setStyles(e.getCis()),i.show()},onComplete:function(){var t=i.getPosition();e.setStyles({top:t.y,left:t.x}),i.hide()}})}})}();var validatorMap=new Hash({required:[LANG_Validate.required,function(t,e){return null!=e&&""!=e&&""!=e.trim()}],number:[LANG_Validate.number,function(t,e){return null==e||""==e||!isNaN(e)&&!/^\s+$/.test(e)}],digits:[LANG_Validate.digits,function(t,e){return null==e||""==e||!/[^\d]/.test(e)}],unsignedint:[LANG_Validate.unsignedint,function(t,e){return null==e||""==e||!/[^\d]/.test(e)&&0<e}],unsigned:[LANG_Validate.unsigned,function(t,e){return null==e||""==e||!isNaN(e)&&!/^\s+$/.test(e)&&0<=e}],positive:[LANG_Validate.positive,function(t,e){return null==e||""==e||!isNaN(e)&&!/^\s+$/.test(e)&&0<e}],alpha:[LANG_Validate.alpha,function(t,e){return null==e||""==e||/^[a-zA-Z]+$/.test(e)}],alphaint:[LANG_Validate.alphaint,function(t,e){return null==e||""==e||!/\W/.test(e)||/^[a-zA-Z0-9]+$/.test(e)}],alphanum:[LANG_Validate.alphanum,function(t,e){return null==e||""==e||!/\W/.test(e)||/^[\u4e00-\u9fa5a-zA-Z0-9]+$/.test(e)}],code:[LANG_Validate.code,function(t,e){return null==e||""==e||/^[a-zA-Z0-9_-]+$/.test(e)}],date:[LANG_Validate.date,function(t,e){return null==e||""==e||/^(19|20)[0-9]{2}-([1-9]|0[1-9]|1[012])-([1-9]|0[1-9]|[12][0-9]|3[01])$/.test(e)}],email:[LANG_Validate.email,function(t,e){return null==e||""==e||/(\S)+[@]{1}(\S)+[.]{1}(\w)+/.test(e)}],url:[LANG_Validate.url,function(t,e){return null==e||""==e||/^(http|https|ftp):\/\/([A-Z0-9][A-Z0-9_-]*)(:(\d+))?\/?/i.test(e)}],area:[LANG_Validate.area,function(t,e){return t.getElements("select").every(function(t){var e=t.getValue();return t.focus(),""!=e&&"_NULL_"!=e})}],greater:[LANG_Validate.greater,function(t){var e=t.getPrevious("input[type=text]");return""===t.getValue()||t.getValue().toInt()>e.getValue().toInt()}],requiredcheckbox:[LANG_Validate.requiredonly,function(t){var e=t.getParent(),i=t.get("name")?e.getElements('input[type=checkbox][name="'+t.get("name")+'"]'):e.getElements("input[type=checkbox]");return i.some(function(t){return 1==t.checked})}],requiredradio:[LANG_Validate.requiredonly,function(t){var e=t.getParent(),i=t.get("name")?e.getElements('input[type=radio][name="'+t.get("name")+'"]'):e.getElements("input[type=radio]");return i.some(function(t){return 1==t.checked})}]}),validate=function(t){if(!t)return!0;var e=t.match("form")?t.getElements("[vtype]"):[t],n=!1,i=e.every(function(s){var t=s.get("vtype");if(!$chk(t))return!0;if(!s.isDisplay()&&"hidden"!=s.getAttribute("type"))return!0;var e=t.split("&&");return s.get("required")&&(e=["required"].combine(e.clean())),t.split("&&").every(function(t){if(!validatorMap[t])return!0;var e=s.getNext(".caution"),i=s.get("caution")||validatorMap[t][0];return validatorMap[t][1](s,s.getValue())?(e&&e.hasClass("error")&&e.remove(),!0):(e&&e.hasClass("caution")?e&&e.hasClass("caution")&&e.get("html")!=i&&e.set("html",i):(new Element("span",{class:"error caution notice-inline",html:i}).injectAfter(s),s.removeEvents("blur").addEvent("blur",function(){validate(s)&&(e&&e.hasClass("error")&&e.remove(),s.removeEvent("blur",arguments.callee))})),"hidden"!=s.type&&s.isDisplay()&&!n&&(n=s),!1)})});if(t.match("form")&&n)try{n.focus()}catch(t){}return i},HistoryManager=new Class({Implements:[Options,Events],options:{observeDelay:100,stateSeparator:";",iframeSrc:"blank.html"},dataOptions:{skipDefaultMatch:!0,defaults:[],regexpParams:""},initialize:function(t){return this.modules||(this.setOptions(t),this.modules=$H({}),this.count=history.length,this.states=[],this.states[this.count]=this.getHash(),this.state=null),this},start:function(){return this.observe.periodical(this.options.observeDelay,this),this.started=!0,this.observe(),this.update(),this.fireEvent("onStart",[this.state]),this},register:function(i,t,e,s,n,o){this.modules||this.initialize();var a=$merge(this.dataOptions,o||{},{defaults:t,onMatch:e,onGenerate:s,regexp:n});return a.regexp=a.regexp||i+"-([\\w_-]*)","string"==typeof a.regexp&&(a.regexp=new RegExp(a.regexp,a.regexpParams)),a.onGenerate=a.onGenerate||function(t){return i+"-"+t[0]},a.values=a.defaults.copy(),this.modules.set(i,a),this.fireEvent("onUnregister",[i,a]),{setValues:function(t){return this.setValues(i,t)}.bind(this),setValue:function(t,e){return this.setValue(i,t,e)}.bind(this),generate:function(t){return this.generate(i,t)}.bind(this),unregister:function(){return this.unregister(i)}.bind(this)}},unregister:function(t){this.fireEvent("onRegister",[t]),this.modules.remove(t)},setValues:function(t,e){var i=this.modules.get(t);return!i||i.values.isSimilar(e)||(i.values=e,this.update()),this},setValue:function(t,e,i){var s=this.modules.get(t);return s&&s.values[e]!=i&&(s.values[e]=i,this.update()),this},generate:function(t,e){var i=this.modules.get(t),s=i.values.copy();i.values=e;var n=this.generateState();return i.values=s,"#"+n},observe:function(){var s;this.timeout||(s=this.getState(),this.state!=s&&(Browser.Engine.trident&&!document.querySelectorAll&&null!==this.state?this.setState(s,!0):this.state=s,this.modules.each(function(t,e){var i=s.match(t.regexp);i?(i.splice(0,1),i.complement(t.defaults),i.isSimilar(t.defaults)||(t.values=i)):t.values=t.defaults.copy(),t.onMatch(t.values,t.defaults)}),this.fireEvent("onStateChange",[s]).fireEvent("onObserverChange",[s])))},generateState:function(){var i=[];return this.modules.each(function(t,e){t.skipDefaultMatch&&t.values.isSimilar(t.defaults)||i.push(t.onGenerate(t.values))}),i.join(this.options.stateSeparator)},update:function(){if(!this.started)return this;var t=this.generateState();return!this.state&&!t||this.state==t||(this.setState(t),this.fireEvent("onStateChange",[t]).fireEvent("onUpdate",[t])),this},observeTimeout:function(){this.timeout?this.timeout=$clear(this.timeout):this.timeout=this.observeTimeout.delay(200,this)},getHash:function(){var t=top.location.href,e=t.indexOf("#")+1;return e?t.substr(e):""},getState:function(){var t=this.getHash();if(this.iframe){var e=this.iframe.contentWindow.document;if(!e||"state"!=e.body.id)return this.istate;var i=e.body.innerText;if(this.state==t)return i;this.istateOld=!0}return t},setState:function(t,e){if(t=$pick(t,""),top.location.hash=t||"#",Browser.Engine.trident&&!document.querySelectorAll&&(!e||this.istateOld)){this.iframe||(this.iframe=new Element("iframe",{src:this.options.iframeSrc,style:"visibility: hidden;height:1px;"}).injectInside(document.body),this.istate=this.state);try{var i=this.iframe.contentWindow.document;i.open(),i.write('<html><body id="state">'+t+"</body></html>"),i.close(),this.istateOld=!1}catch(t){}}this.state=t},extend:$extend});Array.implement({isSimilar:function(t){return this.toString()==t.toString()},complement:function(t){for(var e=0,i=this.length;e<i;e++)this[e]=$pick(this[e],t[e]||null);return this},copy:function(t,e){(t=t||0)<0&&(t=this.length+t),e=e||this.length-t;for(var i=[],s=0;s<e;s++)i[s]=this[t++];return i}}),function(){this.$globalEval=Browser.exec;this.Wpage=new Class({Extends:Request,exoptions:{evalScripts:!0,link:"cancel",message:!1,render:!0,sponsor:!1,clearUpdateMap:!0,updateMap:{},url:"",data:"",headers:{"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript, text/html, application/xml, text/xml, */*"},async:!0,format:!1,method:"post",emulation:!0,urlEncoded:!0,encoding:"utf-8",evalResponse:!1,noCache:!1,update:!1},initialize:function(t,e){var i;t=$merge(this.exoptions,t),this.parent(t),$(document.body).addEvent("click",function(t){for(var e=$(t.target),i=0;i<3;i++)e&&!$chk(e.get("href"))&&(e=e.getParent());if(!e||!e.get("href"))return null;var s=e.get("target")||"",n=e.href||"",o=(e.get("text"),!((!$chk(s)||s.match(/({|:)/))&&!n.match(/^javascript.+/i)&&!e.onclick)),a=new RegExp(""+SHOPADMINDIR);if(s.match(/blank/)&&n.match(a))return t.stop(),_open(n);if(o)return null;if(t.stop(),s.match(/::/)){var r=s.split("::");switch(r[0]){case"dialog":return new Dialog(n,JSON.decode(r[1]||{}));case"open":return _open(n,JSON.decode(r[1]||{}));case"command":return Ex_Loader("cmdrunner",function(){new cmdrunner(n,JSON.decode(r[1]||{})).run()})}}if(t.shift)return open(n.replace("?","#"));W.page(n,$extend({method:"get"},JSON.decode(s)),e)}),t.singlepage||(void 0!==history.pushState?(i=location.hash.slice(1)?location.hash.slice(1):e,this.page("index.php?"+i),window.onpopstate=function(t){this.popstate=!0,t.state&&this.page("index.php?"+t.state.go)}.bind(this)):Ex_Loader("historyMan",function(){var t=new HistoryManager({iframeSrc:SHOPBASE+"/app/desktop/view/blank.html"});this.hstMan=t.register("page",[e],function(t,e){var i="index.php?"+(t.input?t.input:e[0]);return this.page(i)}.bind(this),function(t){return t[0]},".*"),t.start()}.bind(this)))},success:function(t,e){if(/text\/jcmd/.test(this.getHeader("Content-type")))return this.doCommand.apply(this,$splat(arguments));var i=(t=t.stripScripts(function(t){this.response.javascript=t}.bind(this))).match(/<body[^>]*>([\s\S]*?)<\/body>/i);i&&(t=i[1]);var s,n=this.options.update,o=this.options.updateMap;this.options.clearUpdateMap&&$H(o).each(function(t,e){!/side-/.test(e)&&t&&t.empty().fixEmpty()}),t=t.replace(/<\!-{5}(.*?)-{5}([\s\S]*?)-{5}(.*?)-{5}>/g,function(){var t=o[t=arguments[1]]||$(t),e=arguments[2]||null;return e&&t&&t.empty().set("html",e).fixEmpty(),""}),n.empty().set("html",t),n!=LAYOUT.content_main||(s=this.options.url.match("index\\.php\\?(.*)"))&&s[1]&&(void 0!==history.pushState?(history[this.popstate?"replaceState":"pushState"]({go:s[1]},"","#"+s[1]),this.popstate=!1):this.hstMan&&this.hstMan.setValue(0,s[1])),this.render(n),this.options.evalScripts&&Browser.exec(this.response.javascript),this.onSuccess(t,e,this.response.javascript),this.onComplete()},onFailure:function(){switch(this.status){case 404:new MessageBox(LANG_Wpage.failure.status_404,{type:"error",autohide:!0});break;case 401:new MessageBox(LANG_Wpage.failure.status_401,{type:"error"});break;case 403:new MessageBox(LANG_Wpage.failure.status_401,{type:"notice",autohide:!0});break;default:new MessageBox(LANG_Wpage.failure.status+this.status+"]",{type:"error",autohide:!0})}this.parent()},doCommand:function(i,s){var t,n=this;if("string"==$type(i))try{t=JSON.decode(i)}catch(t){}else t=i;if(t&&"string"!=$type(t)){var o=(t=$H(t)).getKeys(),a=t.getValues();return new MessageBox(a[0],{type:"success"==o[0]?"default":o[0],onHide:function(){if("error"==o[0])return n.onSuccess(i,s)},onShow:function(){if("error"!=o[0]){if(!$chk(a[1]))return n.onSuccess(i,s);var t,e={};"forward"==o[1]&&$extend(e,{method:n.options.method,data:n.options.data}),n.onSuccess(i,s),(t=a[1].match(/javascript:([\s\S]+)/))?$globalEval(t[1]):n.page(a[1],e)}},autohide:t.autohide||1500})}new MessageBox(i,{type:"notice",onHide:function(){n.onSuccess(i,s)},autohide:4e3})},eventClear:function(){for(e in this.$events)for(var t=this.$events[e].clean(),i=t.length;i--;)this.removeEvent(e,t[i]);return this},page:function(){var t=Array.flatten(arguments).link({url:String.type,options:Object.type,sponsor:Element.type});if(this.eventClear(),i=t.options&&t.options.update?$(t.options.update):"")for(e in i.retrieve("events",{}))i.removeEvents(e);delete this.options.updateMap,t.options=t.options||{},this.setOptions(this.exoptions),t.options&&this.setOptions(t.options),t.sponsor&&(this.options.sponsor=t.sponsor),t.url&&(this.options.url=t.url),!this.options.update&&this.options.sponsor&&"element"==$type(this.options.sponsor)&&(this.options.update=this.options.sponsor.getContainer());var i=this.options.update=$(this.options.update||LAYOUT.content_main),s={".side-r-content":LAYOUT.side_r_content,".mainHead":i.getPrevious(),".mainFoot":i.getNext(),".side-content":LAYOUT.side.getElement(".side-content")};this.options.updateMap=$merge(s,this.options.updateMap),this.setHeader("WORKGROUND",top.currentWorkground||"NULL"),this.send(this.options),this.msgBox=new MessageBox(this.options.message||LANG_Wpage.loading,{type:"notice"})},render:function(t){if(!this.options.render)return this;t=t||this.options.update;var a=this;$(t).getElements("form").each(function(t){t.addEvent("submit",function(t){var s=this;if(s.retrieve("submiting"))return t.stop();if(!validate(s))return t.stop(),new MessageBox(LANG_Wpage.form.error,{type:"error",autohide:!0});$ES("textarea[ishtml=true]",s).getValue();var e=s.get("target");if("_blank"==e)return!0;if("multipart/form-data"==s.get("enctype")||"multipart/form-data"==s.get("encoding")){s.target="upload";var n=$(s).retrieve("target",{});if("onRequest"in n&&"function"==$type(n.onRequest))try{n.onRequest()}catch(t){}return $("uploadframe").addEvent("load",function(){s&&s.uid&&s.eliminate("submiting");var t=this.contentWindow.document,e=t.body[t.body.innerText?"innerText":"textContent"],i=null;try{(i=JSON.decode(e))&&i.splash&&a.eventClear().doCommand.call(a,i)}catch(t){}if("onComplete"in n&&"function"==$type(n.onComplete))try{n.onComplete(e)}catch(t){}i||new MessageBox(LANG_Wpage.form.complete,{autohide:2e3}),$("uploadframe").removeEvent("load",arguments.callee).set("src",$("uploadframe").retrieve("default:src"))}).store("default:src",$("uploadframe").src),s.store("submiting",!0).submit(),new MessageBox(LANG_Wpage.form.loading,{type:"notice"}),!0}t.stop();var i=$merge(s.retrieve("target",{}),JSON.decode(e)),o=i.onComplete||$empty;i.onComplete=function(){o.apply(a,$splat(arguments)),s&&s.uid&&s.eliminate("submiting")},a.page(s.store("submiting",!0).action,$merge({method:s.method,data:s,message:LANG_Wpage.form.loading},i),s)})})},onComplete:function(t){new MessageBox(LANG_Wpage.complete,{autohide:1e3});var e,i=this.options.update,s=$(i).getElements("input[date]");s&&s.length&&Ex_Loader("picker",function(){s.each(function(t){t.makeCalable()})}),BREADCRUMBS&&(e=BREADCRUMBS.split(":"),[LAYOUT.head,LAYOUT.side].clean().each(function(i){i.getElements(".current").removeClass("current"),e.each(function(t){var e=i.getElement("a[mid="+t+"]");e&&e.addClass("current")})}));var n=$(i).getElements("input[autocompleter], textarea[autocompleter]");n&&n.length&&Ex_Loader("autocompleter",function(){n.each(function(t){var e=t.get("autocompleter"),i="?app=desktop&ctl=autocomplete&params="+e,s=e.match(/:([^,]*)/)[1];t.addEvent("keydown",function(t){13==t.code&&t.stop()});var n=$merge({getVar:s,fxOptions:!1,delay:300,callJSON:function(){return window.autocompleter_json},injectChoice:function(t){var e=t[this.options.getVar],i=new Element("li",{html:this.markQueryValue(e)});i.inputValue=e,this.addChoiceEvents(i).inject(this.choices)}},JSON.decode(t.get("ac_options")));new Autocompleter.script(t,i,n)})})}})}();var DropMenu=new Class({Implements:[Events,Options,LazyLoad],options:{onLoad:$empty,onShow:$empty,onHide:$empty,showMode:function(t){t.setStyle("display","block")},hideMode:function(t){t.setStyle("display","none")},dropClass:"droping",eventType:"click",relative:document.body,stopEl:!1,stopState:!1,lazyEventType:"show",delay:200,offset:{x:0,y:20}},initialize:function(t,e){var i;this.element=$(t),this.element&&(this.setOptions(e),i=this.options.menu||this.element.get("dropmenu"),this.menu=$(i)||$E("."+i,this.element.getParent()),this.menu&&this.load().attach()._lazyloadInit(this.menu))},attach:function(){var e=this.options,i=e.stopState;e.dropClass;return"mouse"!=e.eventType?this.element.addEvent("click",function(t){this.showTimer&&$clear(this.showTimer),i&&t.stop(),this.showTimer=this.show().outMenu.delay(this.options.delay,this)}.bind(this)):$$(this.element,this.menu).addEvents({mouseenter:function(t){this.show(),this.timer&&$clear(this.timer)}.bind(this),mouseleave:function(){this.status&&(this.timer=this.hide.delay(this.options.delay,this))}.bind(this)}),this.menu.addEvent("click",function(t){return!0===e.stopEl&&(e.stopEl="stop"),e.stopEl?t[e.stopEl]():this.hide()}.bind(this)),this},load:function(){return this.fireEvent("load",[this.element,this])},show:function(){return this.fireEvent("initShow"),this.status?this:(this.element.addClass(this.options.dropClass),this.options.showMode.call(this,this.menu),this.options.relative&&this.position({page:this.element.getPosition(this.options.relative)}),this.status=!0,this.fireEvent("show",this.menu))},hide:function(){this.options.hideMode.call(this,this.menu),this.element.removeClass(this.options.dropClass),this.status=!1,this.fireEvent("hide",this.menu)},position:function(t){var e=this.options,i=$(e.relative),s=(i||window).getSize(),n=(i||window).getScroll(),o={x:this.menu.offsetWidth,y:this.menu.offsetHeight};if(e.temppos){var a=t.page.x+e.offset.x,r=t.page.y+this.element.getSize().y+e.offset.y;return this.menu.setStyles({top:r,left:a})}var h,l={x:"left",y:"top"},d={};for(var u in l){this.fireEvent("position",u),d[l[u]]=t.page[u]+this.options.offset[u],d[l[u]]+o[u]-n[u]>s[u]&&(h=this.options.size?this.element.getSize()[u]:0,d[l[u]]=t.page[u]+this.options.offset[u]-o[u]+h)}return this.menu.setStyles(d),this},outMenu:function(){var e=this;document.body.addEvent("click",function(t){e.options.stopEl!=t.target&&e.menu&&(e.hide.call(e),$clear(e.showTimer),this.removeEvent("click",arguments.callee))})}});