Object.extend(Cmsbox,{_setup:Cmsbox.setup,_deletable:null,setup:function(){
this._setup();
this._active=true;
this._options=Object.extend({menu:$("meta"),tool:$("work"),info:$("info"),onEvent:Prototype.emptyFunction,onContext:Prototype.emptyFunction,onShow:function(_1){
new Effect.Appear(_1,{duration:0.1});
},onHide:function(_2){
new Effect.Fade(_2,{duration:0.5});
}},arguments[0]||{});
this._setupEvents();
return this;
},destroy:function(){
this._active=false;
if(Dragqueen){
Dragqueen.stop();
}
if(Lingos){
Lingos.release();
}
this._destroyEvents();
return this;
},assign:function(_3){
var _3=$(_3);
Event.observe(_3,"click",function(_4){
Event.stop(_4);
this.trigger({event:"click",element:_3.id});
}.bindAsEventListener(this));
return this;
},message:function(_5,_6,_7){
if(!this._options||!this._options.info){
return false;
}
var _8=this._options.info.visible();
var _9=_6;
if(Cmsbox&&_6){
_9=Cmsbox.decode_utf8(_6);
}
if(_5){
this._options.info.title=_9;
this._options.info.setStyle({backgroundImage:"url(/icons/"+_5+")"});
if(!_8){
this._options.onShow(this._options.info);
}
if(_7){
setTimeout(function(){
if(this._options.info.title==_9){
this.message();
}
}.bind(this),_7);
}
}else{
if(_8){
this._options.onHide(this._options.info);
}
}
},highlight:function(_a,_b){
var _c=_a=$(_a);
(_b||0).times(function(){
_c=$(_c.parentNode);
});
Event.observe(_a,"mouseover",function(){
try{
if(!Dragqueen.isDragging()){
_c.addClassName("pick");
}
}
catch(error){
}
});
Event.observe(_a,"mouseout",function(){
_c.removeClassName("pick");
});
return this;
},deletable:function(_d){
_d=$(_d);
if(_d){
this._deletable=_d;
}
},trigger:function(){
var _e=$A(arguments);
if(this._active){
Lingos.append(_e);
this.destroy();
this._options.onEvent(encodeURIComponent(_e.toJSON()));
}
return this;
},triggerDelete:function(_f){
return this._onBackspaceDelete(_f);
},_setupEvents:function(){
this._destroyEvents();
this._eventMouseDown=this._onMouseDown.bindAsEventListener(this);
this._eventContextMenu=this._onContextMenu.bindAsEventListener(this);
this._eventKeyPress=this._onKeyPress.bindAsEventListener(this);
if(document.all){
Event.observe(document,"selectstart",this._eventMouseDown);
}
Event.observe(document,"contextmenu",this._eventContextMenu);
Event.observe(document,"mousedown",this._eventMouseDown);
Event.observe(document,"keypress",this._eventKeyPress);
},_destroyEvents:function(){
if(document.all){
Event.stopObserving(document,"selectstart",this._eventMouseDown);
}
Event.stopObserving(document,"contextmenu",this._eventContextMenu);
Event.stopObserving(document,"mousedown",this._eventMouseDown);
Event.stopObserving(document,"keypress",this._eventKeyPress);
},_show:function(_10){
if(!this._options.menu){
return false;
}
var _11=Position.windowBounds(),_12=Position.windowOffset();
var _13=(Event.pointerX(_10)||0)-_12[0];
var top=(Event.pointerY(_10)||0)-_12[1];
var _15=this._options.menu.getDimensions();
var _16=this._options.tool.getDimensions();
if(_11[0]<_13+_15.width){
_13=_13-_15.width;
}
if(_11[1]-_16.height>_15.height){
if(_11[1]<top+_15.height){
if(_16.height>top-_15.height){
top=_16.height;
}else{
top=top-_15.height;
}
}
}else{
top=_16.height;
}
this._options.menu.style.left=_13+"px";
this._options.menu.style.top=top+"px";
if(!this._options.menu.visible()){
this._options.menu.style.position="fixed";
this._options.menu.style.display="block";
}
if(this._options.onContext){
if(this._options.onContext&&this._options.menu){
this._options.onContext(this._options.menu);
}
}
},_hide:function(_17){
if(this._options.menu){
if(this._options.onHide){
this._options.onHide(this._options.menu);
}
this._options.menu.style.display="none";
if(this._options.onContext){
this._options.onContext(this._options.menu);
}
}
},_onMouseDown:function(_18){
var _19=Event.element(_18);
if(/input|textarea|select/i.test(_19.tagName)){
return true;
}
if(/a/i.test(_19.tagName)){
if(_19.ancestors().detect(function(_1a){
return _1a.hasClassName("navi");
})){
Lingos._store();
Lingos._close();
}
}
return true;
},_onContextMenu:function(_1b){
if(/input|textarea|select/i.test(Event.element(_1b).tagName)){
return true;
}
if(this._options.menu){
" do not hide/show if nothing no meta code is present ";
this._visible(this._options.menu)?this._hide(_1b):this._show(_1b);
}
Event.stop(_1b);
return false;
},_onKeyPress:function(_1c){
if(this._isBackspaceDelete(_1c)){
return this.triggerDelete(_1c);
}
return true;
},_isBackspaceDelete:function(_1d){
element=Event.element(_1d);
return element.tagName!="INPUT"&&element.tagName!="TEXTAREA"&&this._deletable!=null&&_1d.keyCode==8;
},_onBackspaceDelete:function(_1e){
if(_1e.preventDefault){
_1e.preventDefault();
_1e.returnValue;
_1e.returnValue;
if(document.getElementsByTagName){
var _1f=document.getElementsByTagName("a");
for(var i=0;i<_1f.length;i++){
var _21=_1f[i];
if(_21.accessKey=="T"){
var evt=document.createEvent("MouseEvents");
evt.initMouseEvent("click",true,false,window,0,0,0,0,0,false,false,false,false,0,null);
_21.dispatchEvent(evt);
return true;
}
}
}
}
return false;
},_visible:function(_23){
if(_23.style.display!="none"){
return true;
}
return _23.visible();
}});
Ajax.Responders.register({onCreate:function(){
if(Ajax.activeRequestCount>0){
Cmsbox.message("load.gif","AJAX",1000);
}
}});
Form.submit=function(_24){
$(_24).submit();
};
Ajax.Autocompleter.prototype.markIndex=function(_25){
this.options.onComplete=function(_26){
this.onComplete(_26);
this.options.onComplete=this.onComplete.bind(this);
this.index=0<=_25||_25<this.entriesCount?_25:0;
this.render();
}.bind(this);
this.activate();
};
Ajax.Autocompleter.prototype.onSubmit=function(_27){
if(this.active||this.element.value.length>0||!this.options.afterUpdateElement){
return;
}
if(_27.keyCode==Event.KEY_TAB||_27.keyCode==Event.KEY_RETURN||(navigator.appVersion.indexOf("AppleWebKit")>0&&_27.keyCode==0)){
this.options.afterUpdateElement(this.element,null);
}
};
Ajax.Autocompleter.prototype._initialize=Ajax.Autocompleter.prototype.initialize;
Ajax.Autocompleter.prototype.initialize=function(_28,_29,url,_2b){
this._initialize(_28,_29,url,_2b);
Event.observe(this.element,"keypress",this.onSubmit.bindAsEventListener(this));
};
Effect.Opacity.prototype.initialize=function(_2c){
this.element=$(_2c);
if(!this.element){
throw (Effect._elementDoesNotExistError);
}
if(Prototype.Browser.IE&&this.element.currentStyle&&(!this.element.currentStyle.hasLayout)){
this.element.setStyle({zoom:1});
}
var _2d=Object.extend({from:this.element.getOpacity()||0,to:1},arguments[1]||{});
this.start(_2d);
};


