var Weblife1={getUniqueId:function(A){if(!A){A=""}var B=false;while(!B){B=A+(1+Math.floor((Math.random()*32767)));if($(B)){B=false}}return B},attachContent:function(C,A){if(!A||!A.id){var B=$$("body")[0];B.appendChild(C)}else{if(A.empty()){A.appendChild(C)}else{var B=$$(A.id)[0];B.appendChild(C)}}},createBasicPopUp:function(B,I,G,C,H){if(!H){H=null}var A=Weblife1.getUniqueId(B?B:"container");if(!C){C="weblife1_popup"}var E=Weblife1.Html.createBasicPopUp(A,I,G,C);this.attachContent(E,H);try{new Insertion.Top($(A),G)}catch(D){try{$(A).appendChild(G)}catch(F){}}return $(A)},getPageSize:function(B){var C,A;if(window.innerHeight&&window.scrollMaxY){C=window.innerWidth+window.scrollMaxX;A=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){C=document.body.scrollWidth;A=document.body.scrollHeight}else{C=document.body.offsetWidth;A=document.body.offsetHeight}}if(B&&$("page")){windowWidth=$("page").getWidth();if(self.innerHeight){windowHeight=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){windowHeight=document.documentElement.clientHeight}else{if(document.body){windowHeight=document.body.clientHeight}}}}else{if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth}else{windowWidth=self.innerWidth}windowHeight=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight}else{if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight}}}}if(B){if(A>windowHeight){pageHeight=windowHeight}else{pageHeight=A}if(C>windowWidth){pageWidth=windowWidth}else{pageWidth=C}}else{if(A<windowHeight){pageHeight=windowHeight}else{pageHeight=A}if(C<windowWidth){pageWidth=C}else{pageWidth=windowWidth}}return{width:pageWidth,height:pageHeight}},getOffset:function(){var A=$$("body")[0];return Position.realOffset(A)},isArray:function(B){try{if(B.constructor.toString().indexOf("Array")==-1){return false}else{return true}}catch(A){}return false},mergeRecursive:function(D,C){for(var B in C){try{if(C[B].constructor==Object){D[B]=Weblife1.mergeRecursive(D[B],C[B])}else{D[B]=C[B]}}catch(A){D[B]=C[B]}}return D}};Weblife1.Html={_buildStyleAttributes:function(B){var A="";if((typeof B)=="object"){for(var C in B){if(Object.prototype[C]){continue}A+=C+": "+B[C]+"; "}}return A},createBasicPopUp:function(B,C,D,A){if(!A){A="weblife1_popup"}if(!B){throw"Weblife1.Html.createBasicPopUp expects to get an valid element id in first parameter!"}if(!D){D=Builder.node("div",{align:"center",style:"font-weight: bold;"},[Builder.node("img",{src:"/images/icons/ajax-loader-bar.gif"}),Builder.node("br"),"Loading ..."])}return Builder.node("div",{id:B,"class":A,style:Weblife1.Html._buildStyleAttributes(C)})},createButton:function(A,B,C,D,E){return Builder.node("button",{"class":"btn",type:"button",href:A,id:D?D:Weblife1.getUniqueId("weblife1button"),style:Weblife1.Html._buildStyleAttributes(C)},[Builder.node("span",{},Builder.node("span",{},B))])},create2ColumnsLayer:function(C,B,E,D,A){return Builder.node("div",{"class":"clearfloat",style:"width:"+(A?A:"100%")+";"},[Builder.node("div",{"class":"floatLeft",style:"width:"+(E?E:"49%")+";"},[C]),Builder.node("div",{"class":"floatRight",style:"width:"+(D?D:"49%")+";"},[B])])},createConfirmBoxContent:function(K,I,D,F,J,A,B,C,E){if(!(D||B)||!K){throw"confirm html generator expects at least information of message and one button"}if(!A){A=250}else{if(A<100){throw"confirm html generator expect width to be bigger than 100px"}}var H=new Array();if(I){H.push(Builder.node("div",{"class":"popup_title"},I))}H.push(Builder.node("div",{"class":"popup_message"},K));if(D&&B){var G=(A-30)/2-27;H.push(Weblife1.Html.create2ColumnsLayer(Weblife1.Html.createButton((E?E:"javascript:;"),B,{width:G+"px"},C?C:null),Weblife1.Html.createButton((J?J:"javascript:;"),D,{width:G+"px"},F?F:"javascript:;"),(G+27)+"px",(G+27)+"px"))}else{if(D){var G=A-27;H.push(Weblife1.Html.createButton((J?J:"javascript:;"),D,{width:G+"px"},F?F:null))}else{if(D){var G=A-27;H.push(Weblife1.Html.createButton((E?E:"javascript:;"),B,{width:G+"px"},C?C:null))}}}return Builder.node("span",null,H)},hoverListElement:function(B,A){if(!(B=$(B))){return }if(!("li").match(B)){if(!(B=B.up("li"))){return }}$A(B.up("ul").getElementsBySelector("li")).any(function(C){if(C.hasClassName(A)){C.removeClassName(A);return true}return false});B.addClassName(A)}};Weblife1.AjaxApp=Class.create();Weblife1.AjaxApp.prototype={_components:null,_mode:null,_isProcessed:true,_ajaxUrl:"/ajax/app",initialize:function(B,C,A){if(A){this._ajaxUrl=A}if(!Weblife1.isArray(B)){throw"Expect components of Weblife1.AjaxApp initialization to be given as an array!"}this._mode=C;this._components=B},isProcessed:function(){return this._isProcessed},doProcess:function(){this._isProcessed=false;try{if(this._prepareRequest()&&this._mode){reqObj=this._preRequest(this);var B=Weblife1.AjaxApp.Responder.getInst();B.doRequest("/ajax/app",this._mode,reqObj,(function(C){this.doPostProcess(C)}).bind(this))}}catch(A){alert(A)}},doPostProcess:function(B){try{if(!B||((typeof B)!="object")){this.doInterrupt()}this._postRequest();if(this._handleResponse(B)){this.doInterrupt()}}catch(A){alert(A)}},doInterrupt:function(){this._components.each((function(A){if(A.doShutdown){A.doShutdown()}}).bind(this));this._isProcessed=true},_prepareRequest:function(){return this._components.all((function(A){if(A.doPrepareRequest){return A.doPrepareRequest(this)}return true}).bind(this))},_preRequest:function(){var A={};this._components.each(function(B){if(B.doPreRequest){A=Weblife1.mergeRecursive(A,B.doPreRequest())}});return A},_postRequest:function(){this._components.each((function(A){if(A.doPostRequest){A.doPostRequest(this)}}).bind(this))},_handleResponse:function(A){return this._components.all((function(B){if(B.doHandleResponse){return B.doHandleResponse(this,A)}return true}).bind(this))}};Weblife1.AjaxApp._Responder=Class.create();Weblife1.AjaxApp._Responder.prototype={requestCount:0,container:null,showLoadingBar:false,xOffset:1000,positionUpdater:null,initialize:function(){Ajax.Responders.register({onCreate:(function(){this._showLoader()}).bind(this),onComplete:(function(){this._closeLoader()}).bind(this)})},doRequest:function(url,mode,requestObj,responseFunc){new Ajax.Request(url,{method:"post",postBody:"mode="+mode+"&request="+Object.toJSON(requestObj),requestHeaders:["Pragma","no-cache","Cache-Control","must-revalidate","If-Modified-Since","Sat, 1 Jan 2000 00:00:00 GMT"],onSuccess:(function(response){var json=unescape(response.responseText);if(((typeof responseFunc)=="function")&&json.substring(0,1)=="{"){var responseObj=eval("("+json+")");responseFunc(responseObj)}}).bind(responseFunc),onFailure:(function(){responseFunc()})})},_closeLoader:function(){if((--this.requestCount==0)&&!this.container){return }if(this.positionUpdater instanceof PeriodicalExecuter){this.positionUpdater.stop()}this.positionUpdater=null;var A=Weblife1.getOffset();new Effect.Move(this.container,{x:this.xOffset,y:A[1]+20,mode:"absolute",duration:0.25,afterFinish:(function(){this._close()}).bind(this)})},_close:function(){if(!this.container){return false}this.container.innerHTML="";this.container.appendChild(Builder.node("img",{src:"/images/icons/ajax-loader-bar-finished.gif"}));this.container.appendChild(Builder.node("div",{align:"center"},"Finished!"));new Effect.Highlight(this.container,{startcolor:"#ff0000",endcolor:"#000000",duration:2,afterFinish:(function(){if(this.container){this.container.remove();this.container=null;this.requestCount=0}}).bind(this)})},_updatePosition:function(){var A=Weblife1.getOffset();new Effect.Move(this.container,{x:this.xOffset,y:A[1]+20,mode:"absolute",duration:0.5})},_showLoader:function(){this.requestCount++;if(this.container||!this.showLoadingBar){return }this.container=Weblife1.getUniqueId("loadinfo");var A=Weblife1.getOffset();Weblife1.attachContent(Builder.node("div",{id:this.container,"class":"weblife1_popup",style:"width: 130px; font-weight: bold; left: "+this.xOffset+"px; top: "+(A[1]-50)+"px; padding: 5px 10px; "},[Builder.node("img",{src:"/images/icons/ajax-loader-bar.gif"}),Builder.node("div",{align:"center"},"Loading ..."),]));new Effect.Move(this.container,{x:0,y:70,mode:"relative"});this.container=$(this.container);this.positionUpdater=new PeriodicalExecuter((function(B){this._updatePosition()}).bind(this),1)}};Weblife1.AjaxApp.Responder={_responder:null,getInst:function(){if(!(this._responder instanceof Weblife1.AjaxApp._Responder)){this._responder=new Weblife1.AjaxApp._Responder()}return this._responder}};Weblife1.AjaxApp.Component=Class.create();Weblife1.AjaxApp.Component.prototype={initialize:function(){},evalResponse:function(A,B){var C=null;if((C=A.response)&&(C=C.component)&&(C=C[B])){return C}return false}};Weblife1.AjaxApp.Setup=Class.create();Weblife1.AjaxApp.Setup.prototype={initialize:function(){},_app:null};var AutoComplete=Class.create({selector:null,input:null,_timeout:null,visible:false,drawn:false,_hideTimeout:null,options:null,initialize:function(A,C,B){this.action=C;this.input=$(A);this.input.autocomplete="off";this.options=new AutoComplete.Options(B||{});if(!this.input){alert("No input field/binding field given or found")}if(!this.action){alert("No action url specified")}this.selector=document.createElement("select");Event.observe(this.input,"focus",this._onInputFocus.bindAsEventListener(this));Event.observe(this.input,"keydown",this._onInputKeyDown.bindAsEventListener(this));Event.observe(this.input,"blur",this._onInputBlur.bindAsEventListener(this));Event.observe(this.selector,"blur",this._onSelectorBlur.bindAsEventListener(this));Event.observe(this.selector,"focus",this._onSelectorFocus.bindAsEventListener(this));Event.observe(this.selector,"change",this._onSelectorChange.bindAsEventListener(this));Event.observe(window,"resize",this._reposition.bind(this));Event.observe(window,"scroll",this._reposition.bind(this))},_onInputFocus:function(A){this._onSelectorFocus(A)},_onSelectorBlur:function(A){this._onInputBlur(A)},_onInputBlur:function(A){this._hideTimeout=setTimeout(this._checkOnBlur.bind(this),100)},_checkOnBlur:function(){this._hideTimeout=null;this.hide()},_onInputKeyUp:function(A){this._suggest(A)&&Event.stop(A)},_onInputKeyDown:function(A){this._suggest(A)&&Event.stop(A)},_onSelectorFocus:function(A){if(this._hideTimeout){clearTimeout(this._hideTimeout);this._hideTimeout=null}},_onSelectorChange:function(A){this.select()},draw:function(){if(this.drawn){return }if(this.options.cssClass){this.selector.className=this.options.cssClass}Element.setStyle(this.selector,{display:"none",position:"absolute",zIndex:1000,width:this.input.offsetWidth+"px"});this.selector.size=this.options.size;document.body.appendChild(this.selector);this.input.autocomplete="off";this.drawn=true},hide:function(){if(!this.drawn||!this.visible){return }this.visible=false;if(window.Scriptaculous){new Effect.BlindUp(this.selector,{duration:this.options.delay,queue:"end",afterFinish:function(A){Element.setStyle(this.selector,{display:"none"});this.selector.options.length=0;setTimeout(this._restoreFocus.bind(this),50)}.bind(this)})}else{Element.setStyle(this.selector,{display:"none"});this.selector.options.length=0;setTimeout(this._restoreFocus.bind(this),50)}},_restoreFocus:function(){this.input.focus()},show:function(){if(!this.drawn){this.draw()}var A=null;if(this.selector.options.length){if(window.Scriptaculous){new Effect.BlindDown(this.selector,{duration:this.options.delay,queue:"end"})}else{Element.setStyle(this.selector,{display:"inline"})}this._reposition();this.visible=true}},_cancelTimeout:function(){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}},_suggest:function(C){this._cancelTimeout();var B=Event.keyPressed(C);var A=[20,16,17,91,121,122,123,124,125,126,127,128,129,130,131,132,45,36,35,33,34,144,145,44,19,93,];if(A.indexOf(B)>-1){return false}switch(B){case Event.KEY_LEFT:case Event.KEY_RIGHT:return false;break;case Event.KEY_TAB:case Event.KEY_BACKSPACE:case 46:this.cancel();return false;break;case Event.KEY_RETURN:if(this.visible){this.select();return true}return false;break;case Event.KEY_ESC:this.cancel();return true;break;case Event.KEY_UP:case Event.KEY_DOWN:this._interact(C);return true;break;default:break}if(this.input.value.length>=this.options.threshold-1){this._timeout=setTimeout(this._sendRequest.bind(this),1000*this.options.delay)}return false},_sendRequest:function(){this._request=new Ajax.Request(this.action,{postBody:"mode=usersuggest&request={}&s="+encodeURIComponent(this.input.value),onComplete:this._process.bind(this),method:this.options.requestMethod})},_reposition:function(){if(!this.drawn){return }var A=Position.cumulativeOffset(this.input);A.push(A[0]+this.input.offsetWidth);A.push(A[1]+this.input.offsetHeight);Element.setStyle(this.selector,{left:A[0]+"px",top:A[3]+"px"})},_process:function(B,A){this.selector.options.length=0;switch(this.options.resultFormat){case AutoComplete.Options.RESULT_FORMAT_XML:this._parseXML(B.responseXML);break;case AutoComplete.Options.RESULT_FORMAT_JSON:if(!A){A=B.responseText&&B.responseText.isJSON()?B.responseText.evalJSON():null}this._parseJSON(A);break;case AutoComplete.Options.RESULT_FORMAT_TEXT:this._parseText(B.responseText);break;default:alert("Unable to parse result type. Make sure you've set the resultFormat option correctly");break}if(this.selector.options.length>(this.options.size)){this.selector.size=this.options.size}else{this.selector.size=this.selector.options.length>1?this.selector.options.length:2}if(this.selector.options.length){this.selector.selectedIndex=-1;this.show()}else{this.cancel()}},_parseXML:function(B){var A=null;for(var C=0;C<B.childNodes.length;C++){if(B.childNodes[C].tagName){A=B.childNodes[C].childNodes}}if(!A){alert("Could not parse response XML.");return }for(C=0;C<A.length;C++){suggestion=A.item(C).firstChild.nodeValue;this._addOption(suggestion)}},_parseJSON:function(A){if(!A){A=[]}for(i=0;i<A.length;i++){this._addOption(A[i])}},_parseText:function(B){var A=(B||"").split(/\n/);for(i=0;i<A.length;i++){this._addOption(A[i])}},_addOption:function(A){var B=new Option(A,A);Prototype.Browser.IE?this.selector.add(B):this.selector.add(B,null)},cancel:function(){this.hide()},select:function(){if(this.selector.options.length){this.input.value=this.selector.options[this.selector.selectedIndex].value}this.cancel();if(typeof this.options.onSelect=="function"){this.options.onSelect(this.input)}},_interact:function(B){if(!this.visible){return }var A=Event.keyPressed(B);if(A!=Event.KEY_UP&&A!=Event.KEY_DOWN){return }var C=this.selector.options.length;if(A==Event.KEY_UP){if(this.selector.selectedIndex==0){this.selector.selectedIndex=this.selector.options.length-1}else{this.selector.selectedIndex--}}else{if(this.selector.selectedIndex==this.selector.options.length-1){this.selector.selectedIndex=0}else{this.selector.selectedIndex++}}}});AutoComplete.Options=Class.create({size:3,cssClass:null,onSelect:null,threshold:3,delay:0.2,requestMethod:"POST",resultFormat:"json",initialize:function(A){Object.extend(this,A||{})}});Object.extend(AutoComplete.Options,{RESULT_FORMAT_XML:"xml",RESULT_FORMAT_JSON:"json",RESULT_FORMAT_TEXT:"text"});Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_SHIFT:16,KEY_CONTROL:17,KEY_CAPSLOCK:20,KEY_SPACE:32,keyPressed:function(A){return Prototype.Browser.IE?window.event.keyCode:A.which}});Weblife1.AjaxApp.Component.Pagetracker=Class.create();Weblife1.AjaxApp.Component.Pagetracker.prototype=Object.extend(new Weblife1.AjaxApp.Component(),{doHandleResponse:function(B,A){var D=null;if((D=this.evalResponse(A,"pagetracker"))&&D.url){if(!Weblife1.isArray(D.url)){try{try{urchinTracker(D.url)}catch(C){}pageTracker._trackPageview(D.url)}catch(C){}}else{D.url.each((function(E){try{try{urchinTracker(E)}catch(F){}pageTracker._trackPageview(E)}catch(F){}}).bind(this))}}return true}});Weblife1.AjaxApp.Component.Append=Class.create();Weblife1.AjaxApp.Component.Append.prototype=Object.extend(new Weblife1.AjaxApp.Component(),{_element:null,initialize:function(A){if(Weblife1.isArray(A)){this._element=A}else{if(A=$(A)){this._element=A}}},doHandleResponse:function(B,A){var C=null;if((C=this.evalResponse(A,"append"))&&C.content){if(C.element&&$(C.element)){this._element=$(C.element)}if(!this._element){return true}if(!Weblife1.isArray(this._element)){if(this._element){this._updateElement(this._element,C.content)}}else{this._element.each((function(D){if(D=$(D)){this._updateElement(D,C.content)}}).bind(this))}}return true},_updateElement:function(B,C){if(B&&C){try{new Insertion.Bottom(B,C);return }catch(A){}try{B.insert(C);return }catch(A){try{B.appendChild(C)}catch(A){}}}}});Weblife1.AjaxApp.Component.Window=Class.create();Weblife1.AjaxApp.Component.Window.prototype=Object.extend(new Weblife1.AjaxApp.Component(),{_element:null,initialize:function(A){var C={bindElement:null,dockingPoint:null,dockOffsetX:0,dockOffsetY:0,fixCoordX:0,fixCoordY:0,width:250,height:null,draggable:false,defaultContent:null,doCloseOnRequest:true,sendOnSubmit:false};var B=Object.extend(C,A||{});this._defaultContent=B.defaultContent;this._draggable=B.draggable?true:false;this._sendOnSubmit=B.sendOnSubmit?true:false;this._doCloseOnRequest=(B.doCloseOnRequest&&!B.defaultContent)?true:false;this._width=B.width>100?B.width:250;this._height=B.height>100?B.height:null;this._dockOffsetX=B.dockOffsetX>0?B.dockOffsetX:0;this._dockOffsetY=B.dockOffsetY>0?B.dockOffsetY:0;this._fixCoordX=B.fixCoordX>0?B.fixCoordX:0;this._fixCoordY=B.fixCoordY>0?B.fixCoordY:0;this._bindElement=$(B.bindElement)?$(B.bindElement):null;switch(B.dockingPoint){case"bottom-right":case"bottom-left":case"top-right":case"top-left":this._dockingPoint=B.dockingPoint;break;default:this._dockingPoint=null}},doShutdown:function(){if(this._element){this._element.remove();this._element=null}return true},_render:function(E){var B={width:this._width+"px",position:"absolute",display:"block"};if(this._height){B.height=this._height+"px"}if(this._fixCoordX>0||this._fixCoordY>0){B.top=this._fixCoordY;B.left=this._fixCoordX}else{if(this._bindElement&&this._dockingPoint){var F=this._bindElement.getDimensions();var C=Position.cumulativeOffset(this._bindElement);F=Object.extend({left:C[0],top:C[1]},F);B.top=F.top+this._dockOffsetY;B.left=F.left+this._dockOffsetX;if(this._dockingPoint=="bottom-right"||this._dockingPoint=="bottom-left"){B.top=B.top+F.height}if(this._dockingPoint=="bottom-right"||this._dockingPoint=="top-right"){B.left=B.left+F.width}}else{var D=Weblife1.getPageSize(true);var A=Weblife1.getOffset();B.top=(D.height-this._height)/2+A[1];B.left=(D.width-this._width)/2;B.top=(B.top<0)?0:B.top;B.left=(B.left<0)?0:B.left}}B.top+="px";B.left+="px";this._element=Weblife1.createBasicPopUp("weblife1window",B,E);if(this._draggable){new Draggable(this._element)}},doPrepareRequest:function(A){if(!this._element&&this._defaultContent){this._render(this._defaultContent)}return true},doPreRequest:function(){var B=null;var A={};if(this._element&&(B=this._element.down("form"))){A={request:{component:{window:B.serialize(true)}}}}if(this._doCloseOnRequest&&this._element){this.doShutdown()}return A},doHandleResponse:function(C,B){this.doShutdown();var D=null;if((D=this.evalResponse(B,"window"))&&D.content){if(D.draggable===true){this._draggable=true}else{if(D.draggable===false){this._draggable=false}}if(D.sendOnSubmit===true){this._sendOnSubmit=true}else{if(D.sendOnSubmit===false){this._sendOnSubmit=false}}if(D.dockOffsetX>0){this._dockOffsetX=D.dockOffsetX}if(D.dockOffsetY>0){this._dockOffsetY=D.dockOffsetY}if(D.width>100){this._width=D.width}if(D.height>100){this._height=D.height}if(D.doCloseOnRequest===true){this._doCloseOnRequest=true}else{if(D.doCloseOnRequest===false){this._doCloseOnRequest=false}}if(D.fixCoordX>0){this._fixCoordX=D.fixCoordX}if(D.fixCoordY>0){this._fixCoordY=D.fixCoordY}if(D.bindElement&&$(D.bindElement)){this._bindElement=$(D.bindElement)}if(D.dockingPoint){switch(D.dockingPoint){case"bottom-right":case"bottom-left":case"top-right":case"top-left":this._dockingPoint=D.dockingPoint;break}}this._render(D.content);if(D.processor){if(Weblife1.isArray(D.processor)){D.processor.each((function(E){if($(E)){$(E).observe("click",(function(G){var F=Event.element(G);F.stopObserving("click");C.doProcess()}).bind(C))}}).bind(C))}else{if(D.processor&&$(D.processor)){$(D.processor).observe("click",(function(F){var E=Event.element(F);E.stopObserving("click");C.doProcess()}).bind(C))}}}if(D.interruptor){if(Weblife1.isArray(D.interruptor)){D.interruptor.each((function(E){if($(E)){$(E).observe("click",(function(G){var F=Event.element(G);F.stopObserving("click");C.doInterrupt()}).bind(C))}}).bind(C))}else{if($(D.interruptor)){$(D.interruptor).observe("click",(function(F){var E=Event.element(F);E.stopObserving("click");C.doInterrupt()}).bind(C))}}}if(this._sendOnSubmit){var A=this._element.down("form");if(A){A.observe("submit",(function(F){var E=Event.element(F);E.stopObserving("click");C.doProcess();Event.stop(F)}).bind(C))}}if(this._element&&!isNaN(D.timeout)){new PeriodicalExecuter((function(E){C.doInterrupt();E.stop()}).bind(C),D.timeout)}return false}return true}});Weblife1.AjaxApp.Component.Prepend=Class.create();Weblife1.AjaxApp.Component.Prepend.prototype=Object.extend(new Weblife1.AjaxApp.Component(),{_element:null,initialize:function(A){if(Weblife1.isArray(A)){this._element=A}else{if(A=$(A)){this._element=A}}},doHandleResponse:function(B,A){var C=null;if((C=this.evalResponse(A,"prepend"))&&C.content){if(C.element&&$(C.element)){this._element=$(C.element)}if(!this._element){return true}if(!Weblife1.isArray(this._element)){if(this._element){this._updateElement(this._element,C.content)}}else{this._element.each((function(D){if(D=$(D)){this._updateElement(D,C.content)}}).bind(this))}}return true},_updateElement:function(B,C){if(B&&C){try{new Insertion.Top(B,C);return }catch(A){}try{B.insert({top:C});return }catch(A){try{if(!B.hasChildNodes()){B.appendChild(C)}else{B.insertBefore(C,B.down())}}catch(A){}}}}});Weblife1.AjaxApp.Component.Hidead=Class.create();Weblife1.AjaxApp.Component.Hidead.prototype=Object.extend(new Weblife1.AjaxApp.Component(),{initialize:function(){},doShutdown:function(){$$("select","object","embed").each(function(A){A.style.visibility="visible"});return true},doPrepareRequest:function(A){$$("select","object","embed").each(function(B){B.style.visibility="hidden"});return true}});Weblife1.AjaxApp.Component.UpdateByKey=Class.create();Weblife1.AjaxApp.Component.UpdateByKey.prototype=Object.extend(new Weblife1.AjaxApp.Component(),{_arrElements:[],_updateKeyContent:null,_updateKeyElement:null,initialize:function(A,C,B){this._updateKeyContent=(C?C:null);this._updateKeyElement=(B?B:null);this._setElementsToUpdate(A)},doHandleResponse:function(B,A){var C=null;if((C=this.evalResponse(A,"update"))&&C[this._updateKeyContent]){if(C[this._updateKeyElement]){this._setElementsToUpdate(C[this._updateKeyElement])}if(this._arrElements.length==0){return true}if(!Weblife1.isArray(this._arrElements)){this._arrElements=$(this._arrElements);if(this._arrElements){this._updateElement(this._arrElements,C[this._updateKeyContent])}}else{this._arrElements.each((function(D){if(D=$(D)){this._updateElement(D,C[this._updateKeyContent])}}).bind(this))}}return true},_setElementsToUpdate:function(A){this._arrElements=[];if(Weblife1.isArray(A)){this._arrElements=A}else{this._arrElements.push(A)}},_updateElement:function(B,C){if(B&&C){try{B.update(C)}catch(A){try{B.innerHTML="";B.appendChild(C)}catch(A){}}}}});Weblife1.AjaxApp.Component.Dropdown=Class.create();Weblife1.AjaxApp.Component.Dropdown.prototype=Object.extend(new Weblife1.AjaxApp.Component(),{_element:null,_timeObserver:null,_contentCache:null,initialize:function(A,B){if(!(A=$(A))){return }var D={width:null,cacheable:false,defaultContent:null,closeTimeout:null,destination:null};var C=Object.extend(D,B||{});this._width=C.width;this._cacheable=C.cacheable?true:false;this._defaultContent=C.defaultContent;this._destination=$(C.destination);this._destination=this._destination?this._destination:null;if(C.closeTimeout&&(typeof C.closeTimeout)=="number"&&C.closeTimeout>0){this._closeTimeout=C.closeTimeout}else{this._closeTimeout=null}this._bindElement=A},doShutdown:function(){if(this._element){if(this._timeObserver!=null){this._timeObserver.stop();this._timeObserver=null}Effect.Fade(this._element,{afterFinish:function(A){A.element.remove()},duration:0.3});this._element=null}return true},_render:function(C){if(this._element){this._element.update(C)}else{var A={display:"none"};var D=this._bindElement.getDimensions();if(this._width){A.width=this._width+"px"}else{if(D.width-10>0){A.width=(D.width-10)+"px"}}if(!this._destination){var B=Position.cumulativeOffset(this._bindElement);D=Object.extend(D,{left:B[0],top:B[1]});A.left=D.left+"px";A.top=D.top+D.height+"px"}this._element=Weblife1.createBasicPopUp("weblife1dropdown",A,C,"weblife1_dropdown",this._destination);Effect.Appear(this._element,{duration:0.3})}},doPrepareRequest:function(A){if(!this._bindElement){throw"DropDown Component expects to get a valid parent element!"}if(this._cacheable&&this._contentCache){this._render(this._contentCache);this._attachAutoCloser(A);return false}else{if(this._defaultContent){this._render(this._defaultContent)}}return true},_attachAutoCloser:function(A){if(this._timeObserver==null&&this._closeTimeout){this._timeObserver=new PeriodicalExecuter((function(){A.doInterrupt();if(this._timeObserver instanceof PeriodicalExecuter){this._timeObserver.stop()}this._timeObserver=null}).bind(this,A),this._closeTimeout)}},doHandleResponse:function(B,A){var C=null;if((C=this.evalResponse(A,"dropdown"))&&C.content){if(this._cacheable){this._contentCache=C.content}this._render(C.content);this._attachAutoCloser(B);if(C.interruptor){if(Weblife1.isArray(C.interruptor)){C.interruptor.each((function(D){if($(D)){$(D).observe("click",(function(E){B.doInterrupt()}).bind(B))}}).bind(B))}else{if($(C.interruptor)){$(C.interruptor).observe("click",(function(D){B.doInterrupt()}).bind(B))}}}return false}return true}});Weblife1.AjaxApp.Component.Confirm=Class.create();Weblife1.AjaxApp.Component.Confirm.prototype=Object.extend(new Weblife1.AjaxApp.Component(),{_title:null,_message:null,_mode:1,_element:null,initialize:function(A,C,B){if(A){this._message=A}if(C){this._title=C}if(B){this._mode=B}},doShutdown:function(){if(this._element){this._element.remove();this._element=null}return true},_showConfirmBox:function(E){var F=Weblife1.getPageSize(true);var D=Weblife1.getOffset();var A=(F.height-100)/2+D[1];var G=(F.width-250)/2;A=(A<0)?0:A;G=(G<0)?0:G;this._element=Weblife1.createBasicPopUp("confirm",{width:"250px",position:"absolute",padding:"10px",left:G+"px",top:A+"px"});var C=this._element.id;var B=C+"_okayButton";var H=C+"_cancelButton";if(this._mode==1){this._element.innerHTML="";this._element.appendChild(Weblife1.Html.createConfirmBoxContent(this._message,this._title,"Ja",B,null,230,"Nein",H,null))}else{if(this._mode==2){this._element.innerHTML="";this._element.appendChild(Weblife1.Html.createConfirmBoxContent(this._message,this._title,"Abbrechen",H,null,250))}else{if(this._mode==3){this._element.innerHTML="";this._element.appendChild(Weblife1.Html.createConfirmBoxContent(this._message,this._title,"Ja",B,null,250))}}}if(this._mode==1||this._mode==3){$(B).observe("click",(function(I){E.doProcess()}).bind(E))}if(this._mode==1||this._mode==2){$(H).observe("click",(function(I){E.doInterrupt()}).bind(E))}},doPrepareRequest:function(A){if(!(this._message&&(this._mode==1||this._mode==2||this._mode==3))){return true}if(this._element){return this.doShutdown()}this._showConfirmBox(A);return false},doHandleResponse:function(B,A){var C=null;if((C=this.evalResponse(A,"confirm"))&&C.mode&&C.message){this._mode=C.mode;this._message=C.message;this._title=C.title;this._showConfirmBox(B);return false}return true}});Weblife1.AjaxApp.Component.Overlay=Class.create();Weblife1.AjaxApp.Component.Overlay.prototype=Object.extend(new Weblife1.AjaxApp.Component(),{_element:null,initialize:function(A){var C={color:"#000",opacity:0.5,appearTime:0.2,interruptOnClick:false,showPreRequest:false,showPostRequest:false};var B=Object.extend(C,A||{});this._color=B.color;this._opacity=(B.opacity>0&&B.opacity<=1)?B.opacity:C.opacity;this._appearTime=(B.appearTime>=0)?B.appearTime:C.appearTime;this._interruptOnClick=(B.interruptOnClick)?true:false;if(B.showPostRequest){this._showPreRequest=false;this._showPostRequest=true}else{this._showPreRequest=true;this._showPostRequest=false}},doShutdown:function(){if(this._element){this._element.remove();this._element=null}return true},_showOverlay:function(C){if(this._element){return }var B=Weblife1.getUniqueId("weblife1overlay");var A=Weblife1.getPageSize();Weblife1.attachContent(Builder.node("div",{id:B,"class":"weblife1_overlay",style:"display: none; background-color: "+this._color+";"}));this._element=$(B);this._element.setStyle({width:A.width+"px",height:A.height+"px"});new Effect.Appear(this._element,{duration:this._appearTime,from:0,to:this._opacity});if(this._interruptOnClick){this._element.observe("click",(function(D){C.doInterrupt()}).bind(C))}},doPrepareRequest:function(A){if(this._showPreRequest){this._showOverlay(A)}return true},doPostRequest:function(A){if(this._showPostRequest){this._showOverlay(A)}}});Weblife1.AjaxApp.Component.Delete=Class.create();Weblife1.AjaxApp.Component.Delete.prototype=Object.extend(new Weblife1.AjaxApp.Component(),{_preDel:[],_postDel:[],initialize:function(A,B){if(Weblife1.isArray(A)){this._preDel=A}else{if(A=$(A)){this._preDel=[A]}}if(Weblife1.isArray(B)){this._postDel=B}else{if(B=$(B)){this._postDel=[B]}}},doPreRequest:function(){this._doDeletion(this._preDel)},doHandleResponse:function(B,A){var C=null;if((C=this.evalResponse(A,"delete"))&&C.elements){this._doDeletion(C.elements)}this._doDeletion(this._postDel);return true},_doDeletion:function(C){if(Weblife1.isArray(C)&&C.length){var A=null;for(var B=0;B<C.length;B++){if(A=$(C[B])){A.remove()}}}}});Weblife1.AjaxApp.Component.Data=Class.create();Weblife1.AjaxApp.Component.Data.prototype=Object.extend(new Weblife1.AjaxApp.Component(),{_data:null,_extResponse:null,initialize:function(B,A){this._data=((typeof B)=="object")?B:{};if((typeof A)=="function"){this._extResponse=A}},doPreRequest:function(){return{request:{component:{data:this._data}}}},doHandleResponse:function(B,A){var C=null;if((C=this.evalResponse(A,"data"))&&C.response&&(((typeof C.response)=="object")||((typeof C.response)=="string"))&&(typeof this._extResponse)=="function"){this._extResponse(C.response)}return true}});Weblife1.AjaxApp.Component.Update=Class.create();Weblife1.AjaxApp.Component.Update.prototype=Object.extend(new Weblife1.AjaxApp.Component(),{_element:null,initialize:function(A){if(Weblife1.isArray(A)){this._element=A}else{if(A=$(A)){this._element=A}}},doHandleResponse:function(B,A){var C=null;if((C=this.evalResponse(A,"update"))&&C.content){if(C.element&&$(C.element)){this._element=$(C.element)}if(!this._element){return true}if(!Weblife1.isArray(this._element)){if(this._element){this._updateElement(this._element,C.content)}}else{this._element.each((function(D){if(D=$(D)){this._updateElement(D,C.content)}}).bind(this))}}return true},_updateElement:function(B,C){if(B&&C){try{B.update(C)}catch(A){try{B.innerHTML="";B.appendChild(C)}catch(A){}}}}});Weblife1.AjaxApp.Component.Display=Class.create();Weblife1.AjaxApp.Component.Display.prototype=Object.extend(new Weblife1.AjaxApp.Component(),{_preHide:[],_preShow:[],_postHide:[],_postShow:[],initialize:function(E,C,F,D){var B=0;var A=null;if(E){this._attach("preHide",E)}if(C){this._attach("preShow",C)}if(F){this._attach("postHide",F)}if(D){this._attach("postShow",D)}},_attach:function(D,C){var B=0;var A=null;if(Weblife1.isArray(C)){for(B=0;B<preHide.length;B++){if(A=$(C[B])){switch(D){case"preHide":this._preHide.push(A);break;case"preShow":this._preShow.push(A);break;case"postHide":this._postHide.push(A);break;case"postShow":this._postShow.push(A);break}}}}else{if(C=$(C)){switch(D){case"preHide":this._preHide.push(C);break;case"preShow":this._preShow.push(C);break;case"postHide":this._postHide.push(C);break;case"postShow":this._postShow.push(C);break}}}},_show:function(B){var A=0;for(A=0;A<B.length;A++){try{B[A].show()}catch(C){}}},_hide:function(B){var A=0;for(A=0;A<B.length;A++){try{B[A].hide()}catch(C){}}},doPrepareRequest:function(A){this._hide(this._preHide);this._show(this._preShow);return true},doHandleResponse:function(B,A){var C=null;if((C=this.evalResponse(A,"display"))){if(C.postHide){this._attach("postHide",C.postHide)}if(C.postShow){this._attach("postShow",C.postShow)}}this._hide(this._postHide);this._show(this._postShow)}});Weblife1.AjaxApp.Setup.Abstractlist=Class.create();Weblife1.AjaxApp.Setup.Abstractlist.prototype=Object.extend(new Weblife1.AjaxApp.Setup(),{_showLoader:function(B,A){var C=Weblife1.getUniqueId("loader");loadingNode=Builder.node("li",{id:C,"class":"loading"},[Builder.node("img",{src:"/images/icons/ajax-loader.gif"})," "+Szene1Translator.translate("loadingDots")]);if(A&&B.hasChildNodes()){B.insertBefore(loadingNode,B.down("li"))}else{B.appendChild(loadingNode)}return C},_replaceElementByLoader:function(B,A){var C=Weblife1.getUniqueId("loader");A=$(A);loadingNode=Builder.node("li",{id:C,"class":"loading"},[Builder.node("img",{src:"/images/icons/ajax-loader.gif"})," "+Szene1Translator.translate("loadingDots")]);A.replace(loadingNode);return C}});Weblife1.AjaxApp.Setup.DeleteEntry=Class.create();Weblife1.AjaxApp.Setup.DeleteEntry.prototype=Object.extend(new Weblife1.AjaxApp.Setup,{initialize:function(C,A,B){if(!C){return }if(A=$(A)){if((typeof B)=="object"){B=Weblife1.mergeRecursive(B,{element:A.identify()})}else{B={element:A.identify()}}}this._app=new Weblife1.AjaxApp([new Weblife1.AjaxApp.Component.Data(B),new Weblife1.AjaxApp.Component.Delete()],C);this._app.doProcess()}});Weblife1.AjaxApp.Setup.CommentLoader=Class.create();Weblife1.AjaxApp.Setup.CommentLoader.prototype=Object.extend(new Weblife1.AjaxApp.Setup.Abstractlist(),{initialize:function(B,D,F,C){if(!(D=$(D))){return }if(F&&D.getStyle("display")=="block"){D.hide();return }else{D.show()}if(D.hasChildNodes()&&F){return }else{if(F){var E=this._showLoader(D,false)}else{var E=this._replaceElementByLoader(D,B)}}var A=new Array();A.push(new Weblife1.AjaxApp.Component.Data(C),new Weblife1.AjaxApp.Component.Update(D),new Weblife1.AjaxApp.Component.Pagetracker());this._app=new Weblife1.AjaxApp(A,"comments");this._app.doProcess()}});Weblife1.AjaxApp.Setup.Photoload=Class.create();Weblife1.AjaxApp.Setup.Photoload.prototype=Object.extend(new Weblife1.AjaxApp.Setup(),{initialize:function(E,D,A,F){var C={defaultContent:"loading....",draggable:true,sendOnSubmit:true};if(!E){return }var B=new Array();B.push(new Weblife1.AjaxApp.Component.Data(Object.extend({},D||{}),A),new Weblife1.AjaxApp.Component.Window(Object.extend(C,F||{})),new Weblife1.AjaxApp.Component.Pagetracker());this._app=new Weblife1.AjaxApp(B,E);this._app.doProcess()}});Weblife1.AjaxApp.Setup.Servercall=Class.create();Weblife1.AjaxApp.Setup.Servercall.prototype=Object.extend(new Weblife1.AjaxApp.Setup(),{initialize:function(E,D,A,F){var C={defaultContent:"loading....",draggable:true,sendOnSubmit:true};if(!E){return }var B=new Array();B.push(new Weblife1.AjaxApp.Component.Hidead(),new Weblife1.AjaxApp.Component.Data(Object.extend({},D||{}),A),new Weblife1.AjaxApp.Component.Window(Object.extend(C,F||{})));this._app=new Weblife1.AjaxApp(B,E);this._app.doProcess()}});Weblife1.AjaxApp.Setup.CommentPoster=Class.create();Weblife1.AjaxApp.Setup.CommentPoster.prototype=Object.extend(new Weblife1.AjaxApp.Setup.Abstractlist(),{initialize:function(B,D,C){var F=null;if(!(D=$(D))||!(B=$(B))||!(F=B.down("textarea"))){return }var A=F.value;B.reset();B.up("div").hide();if(A.length==0||A==F.value){F.focus();return }if((typeof C)=="object"){C=Weblife1.mergeRecursive(C,{action:"post",text:A})}else{return false}if(D.getStyle("display")=="none"){D.show()}var E=this._showLoader(D,false);this._app=new Weblife1.AjaxApp([new Weblife1.AjaxApp.Component.Data(C),new Weblife1.AjaxApp.Component.Delete([],[E]),new Weblife1.AjaxApp.Component.Update(D),new Weblife1.AjaxApp.Component.Append(D),new Weblife1.AjaxApp.Component.Pagetracker(),new Weblife1.AjaxApp.Component.Window()],"comments");this._app.doProcess()}});Weblife1.AjaxApp.Setup.Loadobject=Class.create();Weblife1.AjaxApp.Setup.Loadobject.prototype=Object.extend(new Weblife1.AjaxApp.Setup(),{initialize:function(B,C){var A=new Array();A.push(new Weblife1.AjaxApp.Component.Data(B,C));this._app=new Weblife1.AjaxApp(A,"objectload");this._app.doProcess()}});Weblife1.AjaxApp.Setup.Window=Class.create();Weblife1.AjaxApp.Setup.Window.prototype=Object.extend(new Weblife1.AjaxApp.Setup(),{initialize:function(F,D,G,E){var B={defaultContent:"loading....",draggable:true,sendOnSubmit:true};var C={interruptOnClick:true,showPreRequest:true};if(!F){return }var A=new Array();A.push(new Weblife1.AjaxApp.Component.Hidead(),new Weblife1.AjaxApp.Component.Overlay(Object.extend(C,E||{})),new Weblife1.AjaxApp.Component.Update(D),new Weblife1.AjaxApp.Component.Window(Object.extend(B,G||{})),new Weblife1.AjaxApp.Component.Pagetracker());this._app=new Weblife1.AjaxApp(A,F);this._app.doProcess()}});Weblife1.AjaxApp.Setup.Quickpage=Class.create();Weblife1.AjaxApp.Setup.Quickpage.prototype=Object.extend(new Weblife1.AjaxApp.Setup(),{initialize:function(D,C){var B=new Array();C=$(C);if(!C.id){C.setAttribute("id",Weblife1.getUniqueId("weblife1_quickpagecaller_"))}var A=C.id;B.push(new Weblife1.AjaxApp.Component.Update(A),new Weblife1.AjaxApp.Component.Window({defaultContent:"loading....",draggable:true,bindElement:A,dockingPoint:"bottom-right"}),new Weblife1.AjaxApp.Component.Data({username:D}));this._app=new Weblife1.AjaxApp(B,"quickpage");this._app.doProcess()}});Weblife1.AjaxApp.Setup.Dropdown=Class.create();Weblife1.AjaxApp.Setup.Dropdown.prototype=Object.extend(new Weblife1.AjaxApp.Setup(),{_status:null,initialize:function(D,F,B){var E={defaultContent:null,width:150,cacheable:true,bindElement:null,destination:null};var C=Object.extend(E,B||{});if(!(D=$(D))){return }if(!F){return }if(!C.bindElement||!(C.bindElement=$(C.bindElement))){C.bindElement=D}D.setAttribute("onclick",null);D.observe("click",(function(G){this.handle()}).bind(this));var A=new Array();A.push(new Weblife1.AjaxApp.Component.Hidead(),new Weblife1.AjaxApp.Component.Dropdown(C.bindElement,C),new Weblife1.AjaxApp.Component.Pagetracker());this._app=new Weblife1.AjaxApp(A,F);this._app.doProcess()},handle:function(){if(this._app.isProcessed()){this._app.doProcess()}else{this._app.doInterrupt()}}});Weblife1.AjaxApp.Setup.Confirm=Class.create();Weblife1.AjaxApp.Setup.Confirm.prototype=Object.extend(new Weblife1.AjaxApp.Setup(),{initialize:function(C,F,D,B,E){var A=new Array();A.push(new Weblife1.AjaxApp.Component.Confirm(C,F,(E?E:3)),new Weblife1.AjaxApp.Component.Data((D?D:null)));this._app=new Weblife1.AjaxApp(A,B?B:null);this._app.doProcess()}});Weblife1.AjaxApp.Setup.AjaxForm=Class.create();Weblife1.AjaxApp.Setup.AjaxForm.prototype=Object.extend(new Weblife1.AjaxApp.Setup(),{initialize:function(G,F,H,E,D){var B={defaultContent:"loading....",draggable:true,sendOnSubmit:true};var C={interruptOnClick:true,showPreRequest:true};if(!G){return }var A=new Array();A.push(new Weblife1.AjaxApp.Component.Data(F),new Weblife1.AjaxApp.Component.Hidead(),new Weblife1.AjaxApp.Component.Overlay(Object.extend(C,E||{})),new Weblife1.AjaxApp.Component.Update(D),new Weblife1.AjaxApp.Component.Window(Object.extend(B,H||{})));this._app=new Weblife1.AjaxApp(A,G);this._app.doProcess()}});Weblife1.AjaxApp.Setup.StatusLoader=Class.create();Weblife1.AjaxApp.Setup.StatusLoader.prototype=Object.extend(new Weblife1.AjaxApp.Setup.Abstractlist(),{initialize:function(C,A,B){if(!(C=$(C))){return }var D=this._showLoader(C,false);this._app=new Weblife1.AjaxApp([new Weblife1.AjaxApp.Component.Data(B),new Weblife1.AjaxApp.Component.Update(C),new Weblife1.AjaxApp.Component.UpdateByKey(A,"navigation")],"userstatus");this._app.doProcess()}});