var apf={VERSION:"3.0beta",CDN:"",READY:false,NODE_HIDDEN:101,NODE_VISIBLE:102,NODE_O3:103,KEYBOARD:2,KEYBOARD_MOUSE:true,SUCCESS:1,TIMEOUT:2,ERROR:3,OFFLINE:4,debug:false,includeStack:[],initialized:false,AppModules:[],autoLoadSkin:false,started:false,crypto:{},config:{},_GET:{},$asyncObjects:{"apf.oHttp":1},basePath:"./",ns:{apf:"http://ajax.org/2005/aml",aml:"http://ajax.org/2005/aml",xsd:"http://www.w3.org/2001/XMLSchema",xhtml:"http://www.w3.org/1999/xhtml",xslt:"http://www.w3.org/1999/XSL/Transform",xforms:"http://www.w3.org/2002/xforms",ev:"http://www.w3.org/2001/xml-events"},availHTTP:[],releaseHTTP:function(c){if(apf.brokenHttpAbort){return;}if(self.XMLHttpRequestUnSafe&&c.constructor==XMLHttpRequestUnSafe){return;}c.onreadystatechange=function(){};c.abort();this.availHTTP.push(c);},browserDetect:function(){if(this.$bdetect){return;}this.$bdetect=true;var n=navigator.userAgent.toLowerCase()||"";this.isOpera=(self.opera&&Object.prototype.toString.call(self.opera)=="[object Opera]");this.isKonqueror=n.indexOf("konqueror")!=-1;this.isSafari=/a/.__proto__=="//";this.isSafariOld=false;this.isIphone=n.indexOf("iphone")!=-1||n.indexOf("aspen simulator")!=-1;this.isChrome=Boolean(/source/.test((/a/.toString+"")))||n.indexOf("chrome")!=-1;this.isWebkit=this.isSafari||this.isChrome||this.isKonquerer;if(this.isWebkit){var q=n.match(/applewebkit\/(\d+)/);if(q){this.webkitRev=parseInt(q[1]);this.isSafariOld=parseInt(q[1])<420;}}this.isGecko=(function(a){a[a]=a+"";return a[a]!=a+"";})(new String("__count__"));this.isGecko3=this.isGecko&&(function m(){})[-5]=="x";this.isGecko35=this.isGecko&&(/a/[-1]&&Object.getPrototypeOf)?true:false;this.versionGecko=this.isGecko?parseFloat(n.match(/(?:firefox|gecko)\/([\d\.]+)/i)[1]):-1;var s;this.isIE=!+"\v1";if(this.isIE){this.isIE=parseFloat(n.match(/msie ([\d\.]*)/)[1]);}this.isIE8=this.isIE==8&&(s=true);this.isIE7=!s&&this.isIE==7&&(s=true);if(this.isIE==8&&document.documentMode==7){apf.isIE7=true;apf.isIE8=false;apf.isIE7Emulate=true;apf.isIE=7;}this.isIE6=!s&&this.isIE==6&&(s=true);var t=(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase();this.isWin=(t=="win");this.isMac=(t=="mac");this.isLinux=(t=="linux");this.isAIR=n.indexOf("adobeair")!=-1;try{}catch(o){this.isDeskrun=false;}},setCompatFlags:function(){this.TAGNAME=apf.isIE?"baseName":"localName";this.styleSheetRules=apf.isIE?"rules":"cssRules";this.brokenHttpAbort=apf.isIE6;this.canUseHtmlAsXml=apf.isIE;this.supportNamespaces=!apf.isIE;this.cannotSizeIframe=apf.isIE;this.hasConditionCompilation=apf.isIE;this.supportOverflowComponent=apf.isIE;this.hasEventSrcElement=apf.isIE;this.canHaveHtmlOverSelects=!apf.isIE6&&!apf.isIE5;this.hasInnerText=apf.isIE;this.hasMsRangeObject=apf.isIE;this.descPropJs=apf.isIE;this.hasClickFastBug=apf.isIE;this.hasExecScript=window.execScript?true:false;this.canDisableKeyCodes=apf.isIE;this.hasTextNodeWhiteSpaceBug=apf.isIE||apf.isIE>=8;this.hasCssUpdateScrollbarBug=apf.isIE;this.canUseInnerHtmlWithTables=!apf.isIE;this.hasSingleResizeEvent=!apf.isIE;this.hasStyleFilters=apf.isIE;this.supportOpacity=!apf.isIE;this.supportPng24=!apf.isIE6&&!apf.isIE5;this.cantParseXmlDefinition=apf.isIE50;this.hasDynamicItemList=!apf.isIE||apf.isIE>=7;this.canImportNode=apf.isIE;this.hasSingleRszEvent=!apf.isIE;this.hasXPathHtmlSupport=!apf.isIE;this.hasFocusBug=apf.isIE;this.hasReadyStateBug=apf.isIE50;this.dateSeparator=apf.isIE?"-":"/";this.canCreateStyleNode=!apf.isIE;this.supportFixedPosition=!apf.isIE||apf.isIE>=7;this.hasHtmlIdsInJs=apf.isIE&&apf.isIE<8||apf.isWebkit;this.needsCssPx=!apf.isIE;this.hasCSSChildOfSelector=!apf.isIE||apf.isIE>=8;this.styleAttrIsObj=apf.isIE<8;this.hasAutocompleteXulBug=apf.isGecko;this.loadsLocalFilesSync=apf.isIE||apf.isGecko;this.mouseEventBuffer=apf.isIE?20:6;this.hasComputedStyle=typeof document.defaultView!="undefined"&&typeof document.defaultView.getComputedStyle!="undefined";this.supportCSSAnim=apf.isWebkit&&(apf.webkitRev>525);this.w3cRange=Boolean(window.getSelection);this.locale=(apf.isIE?navigator.userLanguage:navigator.language).toLowerCase();this.characterSet=document.characterSet||document.defaultCharset||"utf-8";var i=document.createElement("div");this.hasContentEditable=(typeof i.contentEditable=="string"||typeof i.contentEditable=="boolean");i=null;delete i;this.supportVML=apf.isIE;this.supportSVG=!apf.isIE;this.hasHtml5XDomain=apf.versionGecko>=3.5;this.supportCanvas=!!document.createElement("canvas").getContext;this.supportCanvasText=!!(this.supportCanvas&&typeof document.createElement("canvas").getContext("2d").fillText=="function");this.hasVideo=!!document.createElement("video")["canPlayType"];this.hasAudio=!!document.createElement("audio")["canPlayType"];this.hasGeolocation=!!navigator.geolocation;this.supportHashChange=("onhashchange" in self)&&!apf.isIE7Emulate||apf.isIE8;i=document.createElement("input");var d=this;(function(a){for(var c in a){i.setAttribute("type",c);d["hasInput"+c.charAt(0).toUpperCase()+c.substr(1).replace("-l","L")]=!!(i.type!=="text");}})({search:1,tel:1,url:1,email:1,datetime:1,date:1,month:1,week:1,time:1,"datetime-local":1,number:1,range:1,color:1});i=null;delete i;this.maxHttpRetries=apf.isOpera?0:3;this.percentageMatch=new RegExp();this.percentageMatch.compile("([\\-\\d\\.]+)\\%","g");this.reMatchXpath=new RegExp();this.reMatchXpath.compile("(^|\\|)(?!\\@|[\\w-]+::)","g");apf.isGears=!!apf.initGears()||0;},extend:function(q,n){var m,o,i=!q.notNull;if(arguments.length==2){for(m in n){if(i||n[m]){q[m]=n[m];}}return q;}for(o=1;o<arguments.length;o++){n=arguments[o];for(m in n){if(i||n[m]){q[m]=n[m];}}}return q;},$extend:function(i,l){for(var j in l){i[j]=l[j];}return i;},ajax:function(){return this.oHttp.get.apply(this.oHttp,arguments);},start:function(){this.started=true;var F=location.href.split("#")[0].split("?")[0];this.host=location.hostname&&F.replace(/(\/\/[^\/]*)\/.*$/,"$1");this.hostPath=F.replace(/\/[^\/]*$/,"")+"/";this.setCompatFlags();if(this.isIE){apf.runIE();}if(apf.isWebkit){apf.runWebkit();}if(this.isOpera){apf.runOpera();}if(this.isGecko||!this.isIE&&!apf.isWebkit&&!this.isOpera){apf.runGecko();}for(var E,i,l,J,n,o,a,D=location.href.split(/[?&]/),I=D.length,G=1;G<I;G++){if(J=D[G].match(/(.*?)(\..*?|\[.*?\])?=([^#]*)/)){n=decodeURI(J[1]).toLowerCase(),o=this._GET;if(J[2]){for(l=decodeURI(J[2]).replace(/\[\s*\]/g,"[-1]").split(/[\.\[\]]/),E=0,i=l.length;E<i;E++){a=l[E],o=o[n]?o[n]:o[n]=(parseInt(a)==a)?[]:{},n=a.replace(/^["\'](.*)["\']$/,"$1");}}o[n!="-1"?n:o.length]=unescape(decodeURI(J[3]));}}this.oHttp=new this.http();this.Init.addConditional(this.parseAppMarkup,apf,["body"]);try{if(apf.isIE){document.execCommand("BackgroundImageCache",false,true);}}catch(m){}this.started=true;if(this.load_done){this.execDeferred();}this.root=true;for(var E=0;E<apf.$required.length;E++){apf.include(apf.$required[E]);}apf.require=apf.include;},nsqueue:{},findPrefix:function(n,l){var m;if(n.nodeType==9){if(!n.documentElement){return false;}if(n.documentElement.namespaceURI==l){return n.prefix||n.scopeName;}m=n.documentElement;}else{if(n.namespaceURI==l){return n.prefix||n.scopeName;}m=n.ownerDocument.documentElement;if(m&&m.namespaceURI==l){return n.prefix||n.scopeName;}while(n.parentNode){n=n.parentNode;if(n.namespaceURI==l){return n.prefix||n.scopeName;}}}if(m){for(var i=0;i<m.attributes.length;i++){if(m.attributes[i].nodeValue==l){return m.attributes[i][apf.TAGNAME];}}}return false;},importClass:function(n,j,l){if(!n){throw new Error(apf.formatErrorString(1018,null,"importing class","Could not load reference. Reference is null"));}if(!j){return apf.exec(n.toString(),l);}var m=n.toString().replace(/^\s*function\s*\w*\s*\([^\)]*\)\s*\{/,"").replace(/\}\s*$/,"");return apf.exec(m,l);},toString:function(){return"[Ajax.org Platform (apf)]";},all:[],implement:function(i){if(arguments.length==1){i.call(this);}else{for(var l,a=0,n=arguments.length;a<n;a++){l=arguments[a];arguments[a].call(this);}}return this;},uniqueHtmlIds:0,setUniqueHtmlId:function(d){var i;d.setAttribute("id",i="q"+this.uniqueHtmlIds++);return i;},getUniqueId:function(){return this.uniqueHtmlIds++;},lookup:function(c){return this.all[c];},findHost:function(i){while(i&&i.parentNode){try{if(i.host){break;}}catch(d){}i=i.parentNode;}return(i&&i.host&&typeof i.host!="string")?i.host:false;},setReference:function(d,i){return self[d]&&self[d].hasFeature?0:(self[d]=i);},console:{debug:function(j,i,l){},time:function(j,i,l){},log:function(j,i,l){},info:function(j,i,l){},warn:function(j,i,l){},error:function(j,i,l){},dir:function(c){this.info(apf.vardump(c,null,false).replace(/ /g,"&nbsp;").replace(/</g,"&lt;"));}},formatErrorString:function(u,s,t,w,n,q,o){apf.lastErrorMessage=w;return w;},getDirname:function(c){return((c||"").match(/^([^#]*\/)[^\/]*(?:$|\#)/)||{})[1];},getFilename:function(c){return((c||"").split("?")[0].match(/(?:\/|^)([^\/]+)$/)||{})[1];},getAbsolutePath:function(i,d){return !d||!i||d.match(/^\w+\:\/\//)?d:i.replace(/\/$/,"")+"/"+d;},include:function(q,n,m){apf.console.info("including js file: "+q);var t=n?apf.getAbsolutePath(apf.basePath||"",q):q;if(apf.isSafariOld&&!apf.started){document.write('<script type="text/javascript" src="'+t+'"><\/script>');}else{var o=document.getElementsByTagName("head")[0],s=document.createElement("script");if(m){s.setAttribute("_apf_type",m);}s.src=t;o.appendChild(s);}},$required:[],require:function(){var l=apf.getDirname(location.href),j=0,i=arguments.length;for(;j<i;j++){this.$required.push(apf.getAbsolutePath(l,arguments[j]));}},Init:{queue:[],cond:{combined:[]},done:{},add:function(d,i){if(this.inited){d.call(i);}else{if(d){this.queue.push([d,i]);}}},addConditional:function(l,j,i){if(typeof i!="string"){if(this.checkCombined(i)){return l.call(j);}this.cond.combined.push([l,j,i]);}else{if(self[i]){l.call(j);}else{if(!this.cond[i]){this.cond[i]=[];}this.cond[i].push([l,j]);this.checkAllCombined();}}},checkAllCombined:function(){for(var c=0;c<this.cond.combined.length;c++){if(!this.cond.combined[c]){continue;}if(this.checkCombined(this.cond.combined[c][2])){this.cond.combined[c][0].call(this.cond.combined[c][1]);this.cond.combined[c]=null;}}},checkCombined:function(d){for(var i=0;i<d.length;i++){if(!this.done[d[i]]){return false;}}return true;},run:function(i){this.inited=this.done[i]=true;this.checkAllCombined();var j=i?this.cond[i]:this.queue;if(!j){return;}for(var l=0;l<j.length;l++){j[l][0].call(j[l][1]);}}},amlParts:[],parseStrategy:0,parsePartialAml:function(G){var E;if(apf.isIE){E=function(i){try{var m={IMG:1,LINK:1,META:1,INPUT:1,BR:1,HR:1,AREA:1,BASEFONT:1},j=new RegExp(i.outerHTML.replace(/([\(\)\|\\\.\^\$\{\}\[\]])/g,"\\$1")+".*"+i.tagName),a=i.parentNode.outerHTML.replace(/\n/g,"").match(j),c=a[0]+">".replace(/(\w+)\s*=\s*([^\>="'\s ]+)( |\s|\>|\/\>)/g,'$1="$2"$3').replace(/ disabled /g," disabled='true' ").replace(/\]\]\&gt;/g,"]]>").replace(/<(\w+)(\s[^>]*[^\/])?>/g,function(o,q,n){if(m[q]){return"<"+q+(n||"")+"/>";}else{return o;}});}catch(d){return;}var l=apf.getAmlDocFromString("<div jid='"+(M++)+"' "+F+">"+c+"</div>").documentElement;while(l.childNodes.length>1){l.removeChild(l.lastChild);}apf.AppNode.appendChild(l);};}else{E=function(d){var c=d.outerHTML.replace(/ _moz-userdefined=""/g,""),a=apf.getAmlDocFromString("<div jid='"+(M++)+"' "+F+">"+c+"</div>").documentElement;while(a.childNodes.length>1){a.removeChild(a.lastChild);}if(apf.isWebkit){a=apf.AppNode.ownerDocument.importNode(a,true);}apf.AppNode.appendChild(a);};}var C=document.body.outerHTML.match(/(\w+)\s*=\s*["']http:\/\/ajax\.org\/2005\/aml["']/);if(!C){return false;}var F="xmlns:"+C[0],A=(RegExp.$1||"").toUpperCase();if(apf.isOpera){A=A.toLowerCase();}if(!A){return false;}A+=":";apf.AppNode=apf.getAmlDocFromString("<"+A.toLowerCase()+"application "+F+" />").documentElement;var N,B,P,K=false,M=0,I=document.body;while(I){K=I.nodeType==1&&I.tagName.substr(0,2)==A;if(K){E(P=I);if(apf.isIE){B=I;var Q=1,D=B.nextSibling;if(D){B.parentNode.removeChild(B);while(D&&(D.nodeType!=1||D.tagName.indexOf(A)>-1)){if(D.nodeType==1){Q+=D.tagName.charAt(0)=="/"?-1:1;}if(Q==0){if(N){N.parentNode.removeChild(N);}N=D;break;}D=(B=D).nextSibling;if(!D){D=B;break;}if(B.nodeType==1){B.parentNode.removeChild(B);if(N){N.parentNode.removeChild(N);N=null;}}else{if(N){N.parentNode.removeChild(N);}N=B;}}I=D;}else{if(N){N.parentNode.removeChild(N);}N=B;}}else{if(N){N.parentNode.removeChild(N);}N=I;}if(apf.amlParts.length&&apf.amlParts[apf.amlParts.length-1][1]==P){apf.amlParts[apf.amlParts.length-1][1]=-1;}apf.amlParts.push([I.parentNode,apf.isIE?I.nextSibling:I.nextSibling]);}else{if(I.tagName=="SCRIPT"&&I.getAttribute("src")&&(I.getAttribute("src").indexOf("ajax.org")>-1)){var J=I.outerHTML.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/<SCRIPT[^>]*\>\s*<\!\[CDATA\[>?/i,"").replace(/<SCRIPT[^>]*\>(?:<\!\-\-)?/i,"").replace(/(\/\/)?\s*\&\#8211;>\s*<\/SCRIPT>/i,"").replace(/\-\->\s*<\/SCRIPT>/i,"").replace(/\]\](?:\&gt\;|>)\s*<\/SCRIPT>/i,"").replace(/<\/SCRIPT>$/mi,"").replace(/<\/?\s*(?:p|br)\s*\/?>/ig,"").replace(/<\!--\s*.*?\s*-->\s*<script.*/ig,"").replace(/\\+(['"])/g,"$1");if(J.trim()){var O=apf.getAmlDocFromString("<div jid='"+(M++)+"' "+F+">"+J+"</div>").documentElement;if(apf.isWebkit){O=apf.AppNode.ownerDocument.importNode(O,true);}apf.AppNode.appendChild(O);apf.amlParts.push([I.parentNode,I.nextSibling]);}}}if(!K&&I.firstChild||I.nextSibling){if(!K&&I.firstChild){I=I.firstChild;}else{I=I.nextSibling;}}else{do{I=I.parentNode;if(I.tagName=="BODY"){I=null;}}while(I&&!I.nextSibling);if(I){I=I.nextSibling;}}}if(N){N.parentNode.removeChild(N);}},parseAppMarkup:function(d){var i=false;if(this.parseStrategy==1||!this.parseStrategy&&!d&&document.documentElement.outerHTML.split(">",1)[0].indexOf(apf.ns.aml)==-1){this.parsePartialAml(d);if(this.parseStrategy==1||apf.amlParts.length){apf.isParsingPartial=true;apf.loadAmlIncludes(apf.AppNode);if(!self.ERROR_HAS_OCCURRED){apf.initialize();}return;}else{i=true;}}if(i&&document.documentElement.outerHTML.split(">",1)[0].indexOf(apf.ns.aml)==-1){return false;}if(this.parseStrategy==21||!this.parseStrategy&&!d){return apf.oHttp.get((apf.alternativeAml||document.body&&document.body.getAttribute("xmlurl")||location.href).split(/#/)[0],{callback:function(z,a,w){if(a!=apf.SUCCESS){var t=new Error(apf.formatErrorString(0,null,"Loading XML application data","Could not load XML from remote source: "+w.message));if(w.tpModule.retryTimeout(w,a,null,t)===true){return true;}throw t;}var u=z.replace(/\<\!DOCTYPE[^>]*>/,"").replace(/&nbsp;/g," ").replace(/^[\r\n\s]*/,"");if(!apf.supportNamespaces){u=u.replace(/xmlns\=\"[^"]*\"/g,"");}if(self.ERROR_HAS_OCCURRED){return;}if(apf.isIE){document.body.innerHTML="";}else{var s=document.body.childNodes;for(var c=s.length-1;c>=0;c--){s[c].parentNode.removeChild(s[c]);}}document.body.style.display="block";apf.initialize(u);},ignoreOffline:true});}else{document.body.style.display="block";if(!self.ERROR_HAS_OCCURRED){apf.initialize(d.outerHTML||d.xml);}}},namespaces:{},setNamespace:function(d,i){this.namespaces[d]=i;i.namespaceURI=d;},initialize:function(t){if(apf.initialized){return;}apf.initialized=true;apf.console.info("Initializing...");clearInterval(apf.Init.interval);apf.Init.run();var A=parseFloat(apf.getStyle(document.body,"marginTop"));apf.doesNotIncludeMarginInBodyOffset=(document.body.offsetTop!==A);if(apf.isParsingPartial){apf.config.setDefaults();apf.hasSingleRszEvent=true;var D=document.body;var C=D.lastChild;apf.AmlParser.parseMoreAml(apf.AppNode,D,null,true,false);var s,E,u,B,w=null,z=D.lastChild;while(z&&C!=z){B=apf.amlParts[z.getAttribute("jid")];u=z.previousSibling;if(B){s=B[0];if("P".indexOf(s.tagName)>-1){w=s.parentNode.insertBefore(apf.getNode(z,[0]),s);}else{E=apf.getNode(z,[0]);while(E){if(E){w=s.insertBefore(E,typeof B[1]=="number"?w:B[1]);}else{w=typeof B[1]=="number"?w:B[1];}E=apf.getNode(z,[0]);}}z.parentNode.removeChild(z);}z=u;}$setTimeout("apf.layout.forceResize();");}else{apf.window.init(t);}},execDeferred:function(){var c=apf.load_events.length;while(c--){(apf.load_events.shift())();}},load_events:[],load_timer:null,load_done:false,load_init:null,addDomLoadEvent:function(i){if(!this.$bdetect){this.browserDetect();}if(apf.load_done){return i();}if(!apf.load_init){apf.load_init=function(){if(apf.load_done){return;}clearInterval(apf.load_timer);apf.load_timer=null;apf.load_done=true;if(apf.started){apf.execDeferred();}};}apf.load_events.push(i);if(i&&apf.load_events.length==1){var w=document,t="undefined";if((typeof w.readyState!=t&&w.readyState=="complete")||(typeof w.readyState==t&&(w.getElementsByTagName("body")[0]||w.body))){return apf.load_init();}if(w.addEventListener&&!apf.isOpera){window.addEventListener("DOMContentLoaded",apf.load_init,false);}else{if(apf.isIE&&window==top){apf.load_timer=setInterval(function(){try{w.documentElement.doScroll("left");}catch(a){$setTimeout(arguments.callee,0);return;}apf.load_init();},10);}else{if(apf.isOpera){w.addEventListener("DOMContentLoaded",function(){apf.load_timer=setInterval(function(){for(var a=0,c=w.styleSheets.length;a<c;a++){if(w.styleSheets[a].disabled){return;}}apf.load_init();},10);},false);}else{if(apf.isWebkit&&!apf.isIphone){var q=w.getElementsByTagName("link"),u=q.length,s;for(;u>=0;u++){if(!q[u]||q[u].getAttribute("rel")!="stylesheet"){q.splice(u,0);}}s=q.length;apf.load_timer=setInterval(function(){if(/loaded|complete/.test(w.readyState)&&w.styleSheets.length==s){apf.load_init();}},10);}else{var o=window.onload;window.onload=function(){apf.load_init();if(o){o();}};}}}}}},addListener:function(j,l,i){if(j.addEventListener){j.addEventListener(l,i,false);}else{if(j.attachEvent){j.attachEvent("on"+l,i);}}return this;},removeListener:function(j,l,i){if(j.removeEventListener){j.removeEventListener(l,i,false);}else{if(j.detachEvent){j.detachEvent("on"+l,i);}}return this;},unload:function(n){this.isDestroying=true;this.popup.destroy();var l,m=0,i=this.all.length;for(;m<i;m++){l=this.all[m];if(l&&l!=n&&l.destroy&&!l.apf){l.destroy(false);}}for(m=0,i=this.availHTTP.length;m<i;m++){this.availHTTP[m]=null;}this.availHTTP.length=0;if(apf.xmldb){apf.xmldb.unbind(apf.window);}this.isDestroying=false;}};var $xmlns=function(n,j,l,m){if(!apf.supportNamespaces){if(!m){m=apf.findPrefix(n,l);}if(n.style||n==document){return n.getElementsByTagName(j);}else{if(m){(n.nodeType==9?n:n.ownerDocument).setProperty("SelectionNamespaces","xmlns:"+m+"='"+l+"'");}return n.selectNodes(".//"+(m?m+":":"")+j);}}return n.getElementsByTagNameNS(l,j);};var $setTimeout=setTimeout;var $setInterval=setInterval;document.documentElement.className+=" has_apf";apf.browserDetect();apf.Init.run("apf");apf.Class=function(){};apf.Class.prototype=new (function(){var FUN="function",OBJ="object",UNDEF="undefined",SEL="selected|selection";PROP="prop.",MODEL="model",VALUE="value";this.$regbase=0;this.hasFeature=function(test){return this.$regbase&test;};this.$initStack=[];this.$bufferEvents=[];this.$init=function(callback,nodeFunc,struct){if(typeof callback==FUN||callback===true){this.$bufferEvents=this.$bufferEvents.slice();if(callback===true){return this;}this.$initStack=this.$initStack.slice();this.$initStack.push(callback);return this;}this.addEventListener=realAddEventListener;this.$removalQueue=[];if(this.nodeType!=2){this.$uniqueId=apf.all.push(this)-1;}this.$captureStack={};this.$eventsStack={};this.$funcHandlers={};var i=0,l=this.$initStack.length;for(;i<l;i++){this.$initStack[i].apply(this,arguments);}for(i=0,l=this.$bufferEvents.length;i<l;i++){this.addEventListener.apply(this,this.$bufferEvents[i]);}delete realAddEventListener;delete this.$initStack;delete this.$bufferEvents;if(struct&&struct.htmlNode){this.$pHtmlNode=struct.htmlNode;this.ownerDocument.$domParser.$continueParsing(this);apf.queue.empty();}return this;};this.implement=apf.implement;this.$handlePropSet=function(prop,value){this[prop]=value;};this.$bindProperty=function(myProp,bObject,bProp,fParsed){if(!fParsed){return bObject.$handlePropSet(bProp,this[myProp]);}var eventName=PROP+myProp,eFunc,isBeingCalled,isLang;(this.$eventsStack[eventName]||(this.$eventsStack[eventName]=[])).push(eFunc=function(e){if(isBeingCalled){return;}apf.$lm_has_lang=false;isBeingCalled=true;try{if(fParsed.asyncs){return fParsed.call(bObject,bObject.xmlRoot,function(value){bObject.setProperty(bProp,value,true,false,10);if(apf.$lm_has_lang&&!isLang){isLang=true;apf.language.addProperty(bObject,bProp,fParsed);}isBeingCalled=false;});}else{var value=fParsed.call(bObject,bObject.xmlRoot);}}catch(e){apf.console.warn("[331] Could not execute binding for property "+bProp+"\n\n"+e.message);isBeingCalled=false;return;}bObject.setProperty(bProp,value,true,false,10);if(apf.$lm_has_lang&&!isLang){isLang=true;apf.language.addProperty(bObject,bProp,fParsed);}isBeingCalled=false;});return eFunc;};this.$attrExcludePropBind=false;this.$setDynamicProperty=function(prop,pValue){var exclNr=this.$attrExcludePropBind[prop],options;if(SEL.indexOf(prop)>-1){options={xpathmode:2,parsecode:true};}else{if(exclNr==2){options={nostring:true};}else{if(exclNr===0){options={parsecode:true};}}}var fParsed=apf.lm.compile(pValue,options);if(prop==MODEL){(this.$modelParsed=fParsed).instruction=pValue;}if(fParsed.type==2){this[prop]=!pValue;return this.setProperty(prop,fParsed.str);}if(exclNr==2||fParsed.xpaths.length&&exclNr!=1){if(!this.hasFeature(apf.__DATABINDING__)){this.implement(apf.StandardBinding);}this.$addAttrBind(prop,fParsed,pValue);}var matches=exclNr&&exclNr!=3&&prop!=MODEL?{}:fParsed.props,found=false,_self=this,o,node,bProp,p;for(p in matches){if(typeof matches[p]==FUN){continue;}o=p.split(".");if(o.length>2){bProp=o.pop();try{node=eval(o.join("."));}catch(e){if(arguments[2]){apf.console.warn("[287] Could not execute binding test : "+pValue.replace(/</g,"&lt;")+"\n\n"+e.message);}else{apf.queue.add(prop+":"+this.$uniqueId,function(){_self.$clearDynamicProperty(prop);_self.$setDynamicProperty(prop,pValue,true);});}continue;}if(typeof node!=OBJ||!node.$regbase){bProp=o[1];node=self[o[0]];}else{o.push(bProp);}}else{bProp=o[1];node=self[o[0]]||o[0]=="this"&&this;}if(!node){if(arguments[2]){apf.console.warn("[287] Could not execute binding test : "+pValue.replace(/</g,"&lt;")+"\n\n"+o[0]+" does not exist");}else{apf.queue.add(prop+":"+this.$uniqueId,function(){_self.$clearDynamicProperty(prop);_self.$setDynamicProperty(prop,pValue,true);});return;}}if(!node.$bindProperty){continue;}if(!this.$funcHandlers[prop]){this.$funcHandlers[prop]=[];}this.$funcHandlers[prop].push({amlNode:node,prop:bProp,handler:node.$bindProperty(bProp,this,prop,fParsed)});found=true;}if(found){this.$funcHandlers[prop][0].handler({initial:true});}else{if(exclNr){return this.setProperty(prop,pValue);}apf.$lm_has_lang=false;try{if(fParsed.asyncs){return fParsed.call(this,this.xmlRoot,function(value){_self.setProperty(prop,value,true);if(apf.$lm_has_lang){apf.language.addProperty(this,prop,fParsed);}});}else{var value=fParsed.call(this,this.xmlRoot);}}catch(e){apf.console.warn("[331] Could not execute binding test or: "+pValue.replace(/</g,"&lt;")+"\n\n"+e.message);return;}this[prop]=!value;this.setProperty(prop,value,true);if(apf.$lm_has_lang){apf.language.addProperty(this,prop,fParsed);}}};this.$clearDynamicProperty=function(prop){if(this.$removeAttrBind){this.$removeAttrBind(prop);}apf.language.removeProperty(this,prop);if(prop==MODEL){this.$modelParsed=null;}var f,i,l,h=this.$funcHandlers[prop];if(h&&typeof h!=FUN){for(i=0,l=h.length;i<l;i++){(f=h[i]).amlNode.removeEventListener(PROP+f.prop,f.handler);}delete this.$funcHandlers[prop];}};this.watch=function(propName,callback){var eventName=PROP+propName,wrapper=function(e){callback.call(this,propName,e.oldvalue,e.value);};wrapper.callback=callback;(this.$eventsStack[eventName]||(this.$eventsStack[eventName]=[])).push(wrapper);};this.unwatch=function(propName,callback){var list,eventName=PROP+propName;if(!(list=this.$eventsStack[eventName])){return;}for(var i=0,l=list.length;i<l;i++){if(list[i].callback==callback){list.remove(i);return;}}};this.getAvailableProperties=function(){return this.$supportedProperties.slice();};this.setProperty=function(prop,value,forceOnMe,setAttr,inherited){var s,r,arr,e,i,l,oldvalue=this[prop],isChanged=(typeof value==OBJ)?value!=(typeof oldvalue==OBJ?oldvalue:null):String(oldvalue)!==String(value),eventName=PROP+prop;if(isChanged){if(!forceOnMe){if(this.xmlRoot&&typeof value!=OBJ&&(!(s=this.$attrExcludePropBind[prop]))&&(r=(this.$attrBindings&&this.$attrBindings[prop]||prop!=VALUE&&this.$bindings[prop]&&this.$bindings[prop][0]))){if(r.cvalue.type==3){return apf.setNodeValue(this.$getDataNode(prop.toLowerCase(),this.xmlRoot,true),value,true);}}else{if(typeof apf.offline!=UNDEF){if(apf.loaded&&apf.offline.state.enabled){apf.offline.state.set(this,prop,typeof value==OBJ?value.name:value);}else{if(apf.offline.enabled){}}}}}if(this.$handlePropSet(prop,value,forceOnMe)===false){return;}value=this[prop];if(setAttr){this.setAttribute(prop,value,true);}}if(arr=this.$eventsStack[eventName]){for(i=0,l=arr.length;i<l;i++){if(arr[i].call(this,e||(e=new apf.AmlEvent(eventName,{prop:prop,value:value,oldvalue:oldvalue})))===false){e.returnValue=false;}}}if((aci||(aci=apf.config.$inheritProperties))[prop]&&this.$amlLoaded){if(inherited!=10&&!value){delete this.$inheritProperties[prop];if(this.$setInheritedAttribute(prop)){return;}}else{if(inherited!=10){this.$inheritProperties[prop]=inherited||-1;}}if((!e||e.returnValue!==false)&&this.childNodes){(function recur(nodes){var i,l,node,n;for(i=0,l=nodes.length;i<l;i++){node=nodes[i];if(node.nodeType!=1){continue;}if(!(n=node.$inheritProperties[prop])){recur(node.childNodes);}else{if(n>0){node.setProperty(prop,value,false,false,2);}}}})(this.childNodes);}}return value;};var aci;this.getProperty=function(prop){return this[prop];};apf.eventDepth=0;var allowEvents={DOMNodeInsertedIntoDocument:1,DOMNodeRemovedFromDocument:1};this.dispatchEvent=function(eventName,options,e){var arr,result,rValue,i,l;apf.eventDepth++;e=options&&options.name?options:e;if(this.disabled&&!allowEvents[eventName]){result=false;}else{if(!e||!e.currentTarget){if(!(options||(options={})).currentTarget){options.currentTarget=this;}if(arr=this.$captureStack[eventName]){for(i=0,l=arr.length;i<l;i++){rValue=arr[i].call(this,e||(e=new apf.AmlEvent(eventName,options)));if(typeof rValue!=UNDEF){result=rValue;}}}}if(options&&options.captureOnly){return e&&typeof e.returnValue!=UNDEF?e.returnValue:result;}else{if(this["on"+eventName]){result=this["on"+eventName].call(this,e||(e=new apf.AmlEvent(eventName,options)));}if(arr=this.$eventsStack[eventName]){for(i=0,l=arr.length;i<l;i++){if(!arr[i]){continue;}rValue=arr[i].call(this,e||(e=new apf.AmlEvent(eventName,options)));if(typeof rValue!=UNDEF){result=rValue;}}}}}if((e&&e.bubbles&&!e.cancelBubble||options&&options.bubbles)&&this!=apf){rValue=(this.parentNode||apf).dispatchEvent(eventName,null,e||(e=new apf.AmlEvent(eventName,options)));if(typeof rValue!=UNDEF){result=rValue;}}var p;while(this.$removalQueue.length){p=this.$removalQueue.shift();p[0].remove(p[1]);}if(--apf.eventDepth==0&&this.ownerDocument&&!this.ownerDocument.$domParser.$parseContext&&!apf.isDestroying&&apf.queue){apf.queue.empty();}return e&&typeof e.returnValue!=UNDEF?e.returnValue:result;};this.addEventListener=function(a,b,c){this.$bufferEvents.push([a,b,c]);};var realAddEventListener=function(eventName,callback,useCapture){if(eventName.substr(0,2)=="on"){eventName=eventName.substr(2);}var stack=useCapture?this.$captureStack:this.$eventsStack;if(!stack[eventName]){stack[eventName]=[];}if(stack[eventName].indexOf(callback)==-1){stack[eventName].unshift(callback);}var f;if(f=this.$eventsStack["$event."+eventName]){f[0].call(this,callback);}};this.removeEventListener=function(eventName,callback,useCapture){var stack=useCapture?this.$captureStack:this.$eventsStack;if(stack[eventName]){this.$removalQueue.push([stack[eventName],callback]);}};this.hasEventListener=function(eventName){return(this.$eventsStack[eventName]&&this.$eventsStack[eventName].length>0);};this.destroy=function(deep,clean){if(typeof this.$uniqueId==UNDEF&&this.nodeType!=2){return;}this.$amlLoaded=false;this.$amlDestroyed=true;if(this.$destroy){this.$destroy();}this.dispatchEvent("DOMNodeRemoved");this.dispatchEvent("DOMNodeRemovedFromDocument");apf.all[this.$uniqueId]=undefined;if(!this.nodeFunc&&this.nodeType!=2){try{if(this.id||this.name){self[this.id||this.name]=null;}}catch(ex){}return;}if(this.$ext&&!this.$ext.isNative&&this.$ext.nodeType==1&&this.localName!="a"){this.$ext.oncontextmenu=this.$ext.host=null;if(clean){if(this.localName!="collection"){this.$ext.parentNode.removeChild(this.$ext);}}}if(this.$int&&!this.$int.isNative&&this.$int.nodeType==1&&this.localName!="a"){this.$int.host=null;}this.$aml=null;if(deep&&this.childNodes){var nodes=this.childNodes;for(i=nodes.length-1;i>=0;i--){if(nodes[i].destroy){nodes[i].destroy(true,clean&&this.localName=="collection");}}this.childNodes=null;}if(this.parentNode&&this.removeNode){this.removeNode();}else{if(this.ownerElement&&!this.ownerElement.$amlDestroyed){this.ownerElement.removeAttributeNode(this);}}if(this.$focussable&&this.focussable){apf.window.$removeFocus(this);}if(this.attributes){var attr=this.attributes;for(var i=attr.length-1;i>=0;i--){this.$clearDynamicProperty(attr[i].nodeName);attr[i].destroy();}}try{if(this.id||this.name){self[this.id||this.name]=null;}}catch(ex){}apf.nameserver.remove(this.localName,this);};})();apf.extend(apf,new apf.Class().$init());apf.Init.run("class");apf.color={colors:{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgrey:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",grey:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},fixHSB:function(c){return{h:Math.min(360,Math.max(0,c.h)),s:Math.min(100,Math.max(0,c.s)),b:Math.min(100,Math.max(0,c.b))};},fixRGB:function(c){return{r:Math.min(255,Math.max(0,c.r)),g:Math.min(255,Math.max(0,c.g)),b:Math.min(255,Math.max(0,c.b))};},fixHex:function(m){var i=6-m.length;if(i>0){var l=[],n=0;for(;n<i;n++){l.push("0");}l.push(m);m=l.join("");}return m;},hexToRGB:function(c){c=parseInt(((c.indexOf("#")>-1)?c.substring(1):c),16);return{r:c>>16,g:(c&65280)>>8,b:(c&255)};},hexToHSB:function(c){return this.RGBToHSB(this.hexToRGB(c));},RGBToHSB:function(o){var q={h:0,s:0,b:0};var n=Math.min(o.r,o.g,o.b),l=Math.max(o.r,o.g,o.b),m=l-n;q.b=l;if(l!=0){}q.s=l!=0?255*m/l:0;if(q.s!=0){if(o.r==l){q.h=(o.g-o.b)/m;}else{if(o.g==l){q.h=2+(o.b-o.r)/m;}else{q.h=4+(o.r-o.g)/m;}}}else{q.h=-1;}q.h*=60;if(q.h<0){q.h+=360;}q.s*=100/255;q.b*=100/255;return q;},HSBToRGB:function(s){var w={},o=Math.round(s.h),q=Math.round(s.s*255/100),A=Math.round(s.b*255/100);if(q==0){w.r=w.g=w.b=A;}else{var z=A,t=(255-q)*A/255,u=(z-t)*(o%60)/60;if(o==360){o=0;}if(o<60){w.r=z,w.b=t,w.g=t+u;}else{if(o<120){w.g=z,w.b=t,w.r=z-u;}else{if(o<180){w.g=z,w.r=t,w.b=t+u;}else{if(o<240){w.b=z,w.r=t,w.g=z-u;}else{if(o<300){w.b=z,w.g=t,w.r=t+u;}else{if(o<360){w.r=z,w.g=t,w.b=z-u;}else{w.r=0,w.g=0,w.b=0;}}}}}}}return{r:Math.round(w.r),g:Math.round(w.g),b:Math.round(w.b)};},RGBToHex:function(i){var j=[i.r.toString(16),i.g.toString(16),i.b.toString(16)],l=0;for(;l<3;l++){if(j[l].length==1){j[l]="0"+j[l];}}return j.join("");},HSBToHex:function(c){return this.RGBToHex(this.HSBToRGB(c));}};if(typeof isFinite=="undefined"){function isFinite(c){return c+1!=c;}}apf.ARRAY=1;apf.NUMBER=2;apf.DATE=3;apf.BOOLEAN=4;apf.STRING=5;apf.REGEXP=6;apf.FUNCTION=7;Array.prototype.dataType=apf.ARRAY;Number.prototype.dataType=apf.NUMBER;Date.prototype.dataType=apf.DATE;Boolean.prototype.dataType=apf.BOOLEAN;String.prototype.dataType=apf.STRING;RegExp.prototype.dataType=apf.REGEXP;Function.prototype.dataType=apf.FUNCTION;apf.getCgiString=function(o,q,s){var i=[];function n(d,a){var c;if(apf.isArray(d)){for(var j=0;j<d.length;j++){n(d[j],a+"%5B%5D");}}else{if(typeof d=="object"){for(c in d){if(apf.isSafariOld&&(!d[c]||typeof p[c]!="object")){continue;}if(typeof d[c]=="function"){continue;}n(d[c],a+"%5B"+encodeURIComponent(c)+"%5D");}}else{i.push(a+"="+encodeURIComponent(d));}}}if(q){i.push("func="+s);for(var t=0;t<o[0].length;t++){n(o[0][t],"f%5B"+t+"%5D");}}else{for(prop in o){if(apf.isSafariOld&&(!o[prop]||typeof o[prop]=="function")){continue;}n(o[prop],prop);}}return i.join("&");};apf.fromCgiString=function(w){if(!w){return false;}var t={};w=w.split("&");for(var i,q=0;q<w.length;q++){i=w[q].split("=");i[0]=decodeURIComponent(i[0]);var u=i[0].replace(/\]/g,"").split("[");var s=t;for(var j=0;j<u.length;j++){if(s[u[j]]){s=s[u[j]];}else{if(u.length==j+1){if(u[j]){s[u[j]]=decodeURIComponent(i[1]);}else{s.push(decodeURIComponent(i[1]));}break;}else{s[u[j]]=!u[j+1]?[]:{};s=s[u[j]];}}}}return t;};Function.prototype.extend=function(){apf.extend.apply(this,[this].concat(Array.prototype.slice.call(arguments)));return this;};Function.prototype.bindWithEvent=function(){var j=this,n=Array.prototype.slice.call(arguments),l=n.shift(),m=n.shift();return function(a){if(!a){a=window.event;}if(m!==false){a=new apf.AbstractEvent(a,window);}return j.apply(l,[a].concat(n).concat(Array.prototype.slice.call(arguments)));};};Array.prototype.copy=function(){var i=[];for(var j=0,l=this.length;j<l;j++){i[j]=this[j]&&this[j].copy?this[j].copy():this[j];}return i;};Array.prototype.merge=function(){for(var i=0,n=arguments.length;i<n;i++){for(var l=0,j=arguments[i].length;l<j;l++){this.push(arguments[i][l]);}}};Array.prototype.arrayAdd=function(){var q=this.copy();for(var i=0,o=arguments.length;i<o;i++){for(var l=0,j=q.length;l<j;l++){q[l]+=arguments[i][l];}}return q;};Array.prototype.equals=function(j){for(var l=0,i=this.length;l<i;l++){if(this[l]!=j[l]){return false;}}return true;};Array.prototype.makeUnique=function(){var i,j,l=[];for(i=0,j=this.length;i<j;i++){if(l.indexOf(this[i])==-1){l.push(this[i]);}}this.length=0;for(i=0,j=l.length;i<j;i++){this.push(l[i]);}return this;};Array.prototype.contains=function(d,i){return this.indexOf(d,i)!=-1;};Array.prototype.indexOf=Array.prototype.indexOf||function(m,l){var i=this.length;for(var n=(l<0)?Math.max(0,i+l):l||0;n<i;n++){if(this[n]===m){return n;}}return -1;};Array.prototype.lastIndexOf=Array.prototype.lastIndexOf||function(m,l){var i=this.length;for(var n=(l>=i)?i-1:(l<0)?l+i:i-1;n>=0;n--){if(this[n]===m){return n;}}return -1;};Array.prototype.pushUnique=function(c){if(this.indexOf(c)==-1){this.push(c);}return this;};Array.prototype.search=function(){for(var l=0,j=arguments.length;l<j;l++){if(typeof this[l]!="array"){continue;}for(var i=0;i<j;i++){if(this[l][i]!=arguments[i]){break;}else{if(i==(j-1)){return this[l];}}}}};Array.prototype.each=Array.prototype.forEach=Array.prototype.forEach||function(j){for(var l=0,i=this.length;l<i;l++){j.call(this,this[l],l,this);}return this;};Array.prototype.remove=function(i){for(var d=this.length-1;d>=0;d--){if(this[d]!=i){continue;}this.splice(d,1);}return this;};Array.prototype.removeIndex=function(c){if(!this.length){return null;}return this.splice(c,1);};Array.prototype.insertIndex=function(i,d){this.splice(d,0,i);};Array.prototype.invert=Array.prototype.reverse=Array.prototype.reverse||function(){var i=this.length-1;for(var l,j=0;j<Math.ceil(0.5*i);j++){l=this[j];this[j]=this[i-j];this[i-j]=l;}return this;};Array.prototype.filter=Array.prototype.filter||function(n,i){var o=[];for(var q=0,l=this.length;q<l;q++){if(n.call(i,this[q],q,this)){o.push(this[q]);}}return o;};Array.prototype.every=Array.prototype.every||function(m,l){for(var n=0,i=this.length;n<i;n++){if(!m.call(l,this[n],n,this)){return false;}}return true;};Array.prototype.map=Array.prototype.map||function(n,i){var o=[];for(var q=0,l=this.length;q<l;q++){o[q]=n.call(i,this[q],q,this);}return o;};Array.prototype.some=Array.prototype.some||function(m,l){for(var n=0,i=this.length;n<i;n++){if(m.call(l,this[n],n,this)){return true;}}return false;};Number.prototype.toPrettyDigit=Number.prototype.toPrettyDigit||function(){var c=this.toString();return(c.length==1)?"0"+c:c;};RegExp.prototype.getNativeFlags=function(){return(this.global?"g":"")+(this.ignoreCase?"i":"")+(this.multiline?"m":"")+(this.extended?"x":"")+(this.sticky?"y":"");};RegExp.prototype.addFlags=function(c){return new RegExp(this.source,(c||"")+this.getNativeFlags());};String.prototype.uCaseFirst=function(){return this.substr(0,1).toUpperCase()+this.substr(1);};String.prototype.trim=function(){return this.replace(/[\s\n\r]*$/,"").replace(/^[\s\n\r]*/,"");};String.prototype.repeat=function(c){return Array(c+1).join(this);};String.prototype.count=function(c){return this.split(c).length-1;};String.prototype.stripTags=function(){return this.replace(/<\/?[^>]+>/gi,"");};String.prototype.escape=function(){return escape(this);};String.prototype.toXml=function(){var j=apf.getXml("<root>"+this+"</root>");if(j.childNodes.length==1){return j.childNodes[0];}else{var l=j.ownerDocument.createDocumentFragment(),i=j.childNodes;while(i.length){l.appendChild(i[0]);}return l;}};if(typeof window!="undefined"&&typeof window.document!="undefined"&&typeof window.document.createElement=="function"){String.prototype.escapeHTML=function(){this.escapeHTML.text.data=this;return this.escapeHTML.div.innerHTML;};String.prototype.unescapeHTML=function(){var j=document.createElement("div");j.innerHTML=this.stripTags();if(j.childNodes[0]){if(j.childNodes.length>1){var i=[];for(var l=0;l<j.childNodes.length;l++){i.push(j.childNodes[l].nodeValue);}return i.join("");}else{return j.childNodes[0].nodeValue;}}return"";};String.prototype.escapeHTML.div=document.createElement("div");String.prototype.escapeHTML.text=document.createTextNode("");String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);if("<\n>".escapeHTML()!=="&lt;\n&gt;"){String.prototype.escapeHTML=null;}if("&lt;\n&gt;".unescapeHTML()!=="<\n>"){String.prototype.unescapeHTML=null;}}if(!String.prototype.escapeHTML){String.prototype.escapeHTML=function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");};}if(!String.prototype.unescapeHTML){String.prototype.unescapeHTML=function(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");};}String.prototype.truncate=function(i,d){return this.length>=i?this.substring(0,i-(d?4:1))+(d?"...":""):this;};String.prototype.pad=function(i,j,l){return l?(this+Array(i).join(j)).slice(0,i):(Array(i).join(j)+this).slice(-i);};apf.PAD_LEFT=false;apf.PAD_RIGHT=true;String.prototype.splitSafe=function(j,i,l){return(l&&this.toLowerCase()||this).replace(/(?:^\s+|\n|\s+$)/g,"").split(new RegExp("[\\s ]*"+j+"[\\s ]*","g"),i||999);};String.prototype.appendRandomNumber=function(j){for(var i=[],l=1;l<=j;l++){i.push(apf.randomGenerator.generate(1,9));}return this.toString()+i.join("");};String.prototype.prependRandomNumber=function(j){for(var i=[],l=1;l<=j;l++){i.push(apf.randomGenerator.generate(1,9));}return i.join("")+this.toString();};String.prototype.sprintf=function(){var l=this.toString(),i=0,m=l.indexOf("%s");while(m>=0){var n=arguments[i++]||" ";l=l.substr(0,m)+n+l.substr(m+2);m=l.indexOf("%s");}return l;};apf.iepngfix=(function(){var t=null,u=null,q=true,n,o=function(){if(!n){n=apf.skins.skins["default"].mediaPath+"/blank.gif";}if(u===null){if(t){u=t.splitSafe(",");}else{u=[document];}}function j(m){if(m.currentStyle.backgroundImage.match(/\.png/i)!==null){s(m);}if(m.tagName=="IMG"&&m.src.match(/\.png$/i)!==null){w(m);}if(q&&(m.tagName=="A"||m.tagName=="INPUT")&&m.style.position===""){m.style.position="relative";}}for(var i=0,l=u.length,c;i<l;i++){if(typeof u[i]=="string"){u[i]=document.getElementById(u[i]);}c=u[i];if(!c){continue;}if(c!=document){j(c);}for(var d=c.all.length-1,a=null;(a=c.all[d]);d--){j(a);}}},s=function(d){var a="scale",i=d.currentStyle.backgroundImage,c=i.substring(5,i.length-2);if(d.currentStyle.backgroundRepeat=="no-repeat"){a="crop";}d.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+c+"', sizingMethod='"+a+"')";d.style.backgroundImage="url("+n+")";},w=function(c){var a=c.src;c.style.width=c.width+"px";c.style.height=c.height+"px";c.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+a+"', sizingMethod='scale')";c.src=n;};return{limitTo:function(a){t=a;return this;},run:o};})();apf.json2xml_Obj={};apf.json2xml_Attr={};apf.json2xml_ObjByAttr={};apf.json2Xml=(function(){var c=function(D,t,E,F){var G,n,i,m;function B(d){return d.replace(/&/g,"&amp;").replace(/\</g,"&lt;").replace(/\>/g,"&gt;");}if(!F){if(t!=(i=t.replace(/[^a-zA-Z0-9_-]/g,"_"))){apf.console.warn("Json2XML, invalid characters found in JSON tagname '"+t,"json2Xml");}t=i;}if(apf.isArray(D)){for(G=0,n=D.length;G<n;G++){c(D[G],t,E);}}else{if(typeof D=="object"){var a=false,C=null;if(!F){E.push("<",t);}for(G in D){if((n=apf.json2xml_Attr[G])||G.charAt(0)=="@"){if(!n&&!C){C=apf.json2xml_ObjByAttr[G.slice(1)];}if(!F){E.push(" ",n?n:G.slice(1),'="',B(D[G].toString()),'"');}}else{a=true;}}if(a){if(!F){E.push(">");}if(m=(C||apf.json2xml_Obj[t])){if(m==1){m={child:t.replace(/(.*)s$/,"$1")||t,key:"name",value:"value"};}for(G in D){if(G.charAt(0)!="@"&&!apf.json2xml_Attr[G]){if(typeof(i=D[G])=="object"){if(apf.json2xml_Obj[G]){c(i,G,E);}else{E.push("<",m.child," ",m.key,'="',B(G.toString()),'" >');c(i,G,E,true);E.push("</",m.child,">\n");}}else{E.push("<",m.child," ",m.key,'="',G,'" ');if(m.value){if(m.value==1){E.push("/>");}else{E.push(m.value,'="',B(D[G].toString()),'"/>');}}else{E.push(">",B(D[G].toString()),"</",m.child,">");}}}}if(!F){E.push("</",t,">\n");}}else{for(G in D){if(!apf.json2xml_Attr[G]&&G.charAt(0)!="@"){if(G.match(/[^a-zA-Z0-9_-]/g)){apf.console.warn("Json2XML, invalid characters found in JSON tagname: '"+G,"json2Xml");}else{c(D[G],G,E,false);}}}if(!F){E.push("</",t,">");}}}else{if(!F){E.push("/>");}}}else{if(!F){E.push("<",t,">",B(D.toString()),"</",t,">");}else{E.push(B(D.toString()));}}}};return function(a,t,q){var s=(typeof a=="string"&&apf.isJson(a))?JSON.parse(a.replace(/""/g,'" "')):a,o=[],i;c(s,"jsondoc",o,false);return apf.getXmlDom(o.join("").replace(/\t|\n/g,""),t,true);};})();apf.xml2json=function(ad,u){var ac,m={},V,T=ad.childNodes,aa,n,o,U,w,Y,Z,ab,W,X,ae,j,af,t,i;if(!u){if(w=(ad.attributes)){for(Y=0,Z=w.length;Y<Z;Y++){X=apf.json2xml_Attr[ab=w[Y].nodeName]||("@"+ab);if(X.indexOf("@a_")!=0){m[X]=w[Y].nodeValue,ac=true;}}}}for(var n=0,o=T.length;n<o;n++){if((U=T[n]).nodeType!=1){continue;}i=U.tagName;ac=true;X=W=null,V={};if(w=(U.attributes)){for(Y=0,Z=w.length;Y<Z;Y++){V["@"+(ab=w[Y].nodeName)]=w[Y].nodeValue;if(!W){W=apf.json2xml_ObjByAttr[ab];}}}if(X=W||apf.json2xml_Obj[i]){if(X==1){X={key:"name",value:"value"};}for(aa=U.childNodes,Y=0,Z=aa.length;Y<Z;Y++){if((W=aa[Y]).nodeType!=1){continue;}if(t=apf.json2xml_Obj[W.nodeName]){var s={};for(ae=W.childNodes,j=0,af=ae.length;j<af;j++){if((s1=ae[j]).nodeType!=1){continue;}if(ab=s1.getAttribute(t.key)){s[ab]=(t.value==1?(s1.childNodes.length?apf.xml2json(s1,1):1):(s1.getAttribute(t.value||"value"))||apf.xml2json(s1,1));}}V[W.nodeName]=s;}else{if(ab=W.getAttribute(X.key)){V[ab]=(X.value==1?(W.childNodes.length?apf.xml2json(W,1):1):(W.getAttribute(X.value||"value"))||apf.xml2json(W,1));}}}}else{V=apf.xml2json(U);}if(m[i]!==undefined){if((W=m[i]).dataType!=apf.ARRAY){m[i]=[W,V];}else{m[i].push(V);}}else{m[i]=V;}}return ac?m:apf.queryValue(ad,"text()");};apf.isJson=(function(){var n=/\\["\\\/bfnrtu]/g,j=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,l=/(?:^|:|,)(?:\s*\[)+/g,m=/^[\],:{}\s]*$/;return function(a){if(!a){return false;}return m.test(a.replace(n,"@").replace(j,"]").replace(l,""));};})();if(!self.JSON){self.JSON=(function(){var A=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),s=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),w={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},u=function(d,c,a){return c?w[c]:String.fromCharCode(parseInt(a,16));},D=new String(""),E="\\",z={"{":Object,"[":Array},C=Object.hasOwnProperty,t=function(c,a){c=a+c;return c.substring(c.length-a.length);},B={0:function(c){if(c.nodeType&&c.ownerDocument&&c.cloneNode(true)){return"apf.xmldb.getXml("+JSON.stringify(apf.getXmlString(c))+")";}var d=[];for(var a in c){d.push('"'+a.replace(/(["\\])/g,"\\$1")+'": '+JSON.stringify(c[a]));}return"{"+d.join(", ")+"}";},5:function(a){a='"'+a.replace(/(["\\])/g,"\\$1")+'"';return a.replace(/(\n)/g,"\\n").replace(/\r/g,"");},2:function(a){return a.toString();},4:function(a){return a.toString();},3:function(a){return'{"jsonclass":["sys.ISODate", ["'+t(a.getUTCFullYear(),"0000")+t(a.getUTCMonth()+1,"00")+t(a.getUTCDate(),"00")+"T"+t(a.getUTCHours(),"00")+":"+t(a.getUTCMinutes(),"00")+":"+t(a.getUTCSeconds(),"00")+'"]]}';},1:function(d){for(var a=[],c=0;c<d.length;c++){a.push(JSON.stringify(d[c]));}return"["+a.join(", ")+"]";},7:function(a){return;}};return{parse:function(c,l){var m=c.match(A),G;var a=m[0];if("{"==a){G={};}else{if("["==a){G=[];}else{throw new Error(a);}}var d,o,j=[G];for(var n=1,q=m.length;n<q;++n){a=m[n];switch(a.charCodeAt(0)){default:o=j[0];o[d||o.length]=+(a);d=void 0;break;case 34:a=a.substring(1,a.length-1);if(a.indexOf(E)!==-1){a=a.replace(s,u);}o=j[0];if(!d){if(o instanceof Array){d=o.length;}else{d=a||D;break;}}o[d]=a;d=void 0;break;case 91:o=j[0];j.unshift(o[d||o.length]=[]);d=void 0;break;case 93:j.shift();break;case 102:o=j[0];o[d||o.length]=false;d=void 0;break;case 110:o=j[0];o[d||o.length]=null;d=void 0;break;case 116:o=j[0];o[d||o.length]=true;d=void 0;break;case 123:o=j[0];j.unshift(o[d||o.length]={});d=void 0;break;case 125:j.shift();break;}}if(j.length){throw new Error();}if(l){var i=function(U,V){var T=U[V];if(T&&typeof T=="object"){var R=null;for(var P in T){if(C.call(T,P)&&T!==U){var Q=i(T,P);if(Q!==void 0){T[P]=Q;}else{if(!R){R=[];}R.push(P);}}}if(R){for(var F=R.length;--F>=0;){delete T[R[F]];}}}return l.call(U,V,T);};G=i({"":G},"");}return G;},stringify:function(a){if(typeof args=="function"||apf.isNot(a)){return"null";}return B[a.dataType||0](a);}};})();}apf.serialize=function(c){return self.JSON.stringify(c);};apf.unserialize=function(c){if(!c){return c;}return self.JSON.parse(c);};apf.hotkeys={};apf.keyMods={ctrl:1,alt:2,shift:4,meta:8};apf.keyNames={"32":"Spacebar","13":"Enter","9":"Tab","27":"Esc","46":"Del","36":"Home","35":"End","107":"+","37":"Left Arrow","38":"Up Arrow","39":"Right Arrow","40":"Down Arrow","33":"Page Up","34":"Page Down","112":"F1","113":"F2","114":"F3","115":"F4","116":"F5","117":"F6","118":"F7","119":"F8","120":"F9","121":"F10","122":"F11","123":"F12"};apf.registerHotkey=function(s,t){var A=0,w;var i=s.splitSafe("\\-|\\+| ",null,true),q=false,u=false;for(var z=0;z<i.length;z++){if(apf.keyMods[i[z]]){A=A|apf.keyMods[i[z]];if(apf.isMac){q=(apf.keyMods[i[z]]===apf.keyMods.ctrl);u=(apf.keyMods[i[z]]===apf.keyMods.meta);}}else{w=i[z];}}if(q&&!u){A=A|apf.keyMods.meta;}(apf.hotkeys[A]||(apf.hotkeys[A]={}))[w]=t;if(!apf.initHotkey){apf.initHotkey=true;apf.addEventListener("hotkey",function(c){if(apf.isMac&&c.metaKey){c.ctrlKey=true;}var d=0|(c.ctrlKey?1:0)|(c.shiftKey?2:0)|(c.shiftKey?4:0)|(c.metaKey?8:0);var a=apf.keyNames[c.keyCode];if(!d&&!a){return;}var j=(apf.hotkeys[d]||{})[(a||String.fromCharCode(c.keyCode)).toLowerCase()];if(j){j();c.returnValue=false;}});}};apf.removeHotkey=function(c){apf.registerHotkey(c,null);};apf.AbstractEvent=function(j,l){l=l||window;var m=l.document;j=j||l.event;if(j.$extended){return j;}this.$extended=true;this.event=j;this.type=j.type;this.target=j.target||j.srcElement;while(this.target&&this.target.nodeType==3){this.target=this.target.parentNode;}if(this.type.indexOf("key")!=-1){this.code=j.which||j.keyCode;}else{if(this.type.match(/(click|mouse|menu)/i)){m=(!m.compatMode||m.compatMode=="CSS1Compat")?m.html:m.body;this.page={x:j.pageX||j.clientX+(m?m.scrollLeft:0),y:j.pageY||j.clientY+(m?m.scrollTop:0)};this.client={x:(j.pageX)?j.pageX-l.pageXOffset:j.clientX,y:(j.pageY)?j.pageY-l.pageYOffset:j.clientY};if(this.type.match(/DOMMouseScroll|mousewheel/)){this.wheel=(j.wheelDelta)?j.wheelDelta/120:-(j.detail||0)/3;}this.rightClick=(j.which==3)||(j.button==2);this.relatedTarget=null;if(this.type.match(/over|out/)){if(this.type=="mouseover"){this.relatedTarget=j.relatedTarget||j.fromElement;}else{if(this.type=="mouseout"){this.relatedTarget=j.relatedTarget||j.toElement;}else{try{while(this.relatedTarget&&this.relatedTarget.nodeType==3){this.relatedTarget=this.relatedTarget.parentNode;}}catch(n){}}}}}}this.shift=Boolean(j.shiftKey);this.control=Boolean(j.ctrlKey);this.alt=Boolean(j.altKey);this.meta=Boolean(j.metaKey);this.stop=function(){return this.stopPropagation().preventDefault();};this.stopPropagation=function(){if(this.event.stopPropagation){this.event.stopPropagation();}else{this.event.cancelBubble=true;}return this;};this.preventDefault=function(){if(this.event.preventDefault){this.event.preventDefault();}else{this.event.returnValue=false;}return this;};};apf.AbstractEvent.KEYS={enter:13,up:38,down:40,left:37,right:39,esc:27,space:32,backspace:8,tab:9,"delete":46,fromCode:function(i){for(var d in this){if(this[d]==i){return d;}return null;}}};apf.AbstractEvent.stop=function(c){return(new apf.AbstractEvent(c)).stop();};apf.AbstractEvent.addListener=function(j,l,i){if(j.addEventListener){j.addEventListener(l,i,false);}else{if(j.attachEvent){j.attachEvent("on"+l,i);}}return this;};apf.AbstractEvent.removeListener=function(j,l,i){if(j.removeEventListener){j.removeEventListener(l,i,false);}else{if(j.detachEvent){j.detachEvent("on"+l,i);}}return this;};apf.setStyleRule=function(B,i,E,C,u){B=B.toLowerCase();if(!C){var w=(u||self).document.styleSheets;for(var A=w.length-1;A>=0;A--){try{var D=w[A][apf.styleSheetRules];for(var z=0;z<D.length;z++){if(D.item(z).selectorText.toLowerCase()==B){D.item(z).style[i]=E;return true;}}}catch(j){}}}else{var D=(u||self).document.styleSheets[C||0][apf.styleSheetRules];for(var z=0;z<D.length;z++){if(D.item(z).selectorText.toLowerCase()==B){D.item(z).style[i]=E;return true;}}}return false;};apf.getStyleRule=function(A,i,B,t){A=A.toLowerCase();if(!B){var u=(t||self).document.styleSheets;for(var z=u.length-1;z>=0;z--){try{var C=u[z][apf.styleSheetRules];for(var w=0;w<C.length;w++){if(C.item(w).selectorText.toLowerCase()==A){return C.item(w).style[i];}}}catch(j){}}}else{var C=(t||self).document.styleSheets[B||0][apf.styleSheetRules];for(var w=0;w<C.length;w++){if(C.item(w).selectorText.toLowerCase()==A){return C.item(w).style[i];}}}return false;};apf.setStyleClass=function(n,o,m,l){if(!n||this.disabled){return;}if(o){if(m){m[m.length]=o;}else{m=[o];}}var q=new RegExp("(^| +)(?:"+(m?m.join("|"):"")+")","gi");n.className!=null?(n.className=n.className.replace(q," ")+(o?" "+o:"")):n.setAttribute("class",(n.getAttribute("class")||"").replace(q," ")+(o?" "+o:""));return n;};apf.importCssString=function(q,m,n){m=m||document;var o=m.getElementsByTagName("head")[0];if(!apf.supportOpacity){q=q.replace(/opacity[ \s]*\:[ \s]*([\d\.]+)/g,function(a,c){return"filter:progid:DXImageTransform.Microsoft.Alpha(opacity="+(c*100)+")";});}if(apf.canCreateStyleNode){var l=m.createElement("style");l.appendChild(m.createTextNode(q));if(n){l.setAttribute("media",n);}o.appendChild(l);}else{o.insertAdjacentHTML("beforeend",".<style media='"+(n||"all")+"'>"+q+"</style>");}};apf.getStyleRecur=function(i,j){var l=apf.hasComputedStyle?document.defaultView.getComputedStyle(i,"").getPropertyValue(j.replace(/([A-Z])/g,function(c,a){return"-"+a.toLowerCase();})):i.currentStyle[j];return((!l||l=="transparent"||l=="inherit")&&i.parentNode&&i.parentNode.nodeType==1)?this.getStyleRecur(i.parentNode,j):l;};apf.importStylesheet=function(l,j){for(var i=0;i<l.length;i++){if(!l[i][1]){continue;}if(apf.isIE){(j||window).document.styleSheets[0].addRule(l[i][0],l[i][1]);}else{(j||window).document.styleSheets[0].insertRule(l[i][0]+" {"+l[i][1]+"}",0);}}};apf.isInRect=function(n,j,l){var m=this.getAbsolutePosition(n);if(j<m[0]||l<m[1]||j>n.offsetWidth+m[0]-10||l>n.offsetHeight+m[1]-10){return false;}return true;};apf.getOverflowParent=function(c){c=c.offsetParent;while(c&&(this.getStyle(c,"overflow")!="hidden"||"absolute|relative".indexOf(this.getStyle(c,"position"))==-1)){c=c.offsetParent;}return c||document.documentElement;};apf.getPositionedParent=function(c){c=c.offsetParent;while(c&&c.tagName.toLowerCase()!="body"&&"absolute|relative".indexOf(this.getStyle(c,"position"))==-1){c=c.offsetParent;}return c||document.documentElement;};apf.getAbsolutePosition=function(I,B,F){if("getBoundingClientRect" in document.documentElement){if(apf.doesNotIncludeMarginInBodyOffset&&I==document.body){return[I.offsetLeft+(parseFloat(apf.getStyle(I,apf.descPropJs?"marginLeft":"margin-top"))||0),+(I.scrollLeft||0),I.offsetTop+(parseFloat(apf.getStyle(I,apf.descPropJs?"marginTop":"margin-top"))||0)+(I.scrollTop||0)];}var C=I.getBoundingClientRect(),K=C.top,E=C.left,N=(apf.isIE&&apf.isIE<8);if(!(apf.isIE&&I==document.documentElement)){E+=document.body.scrollLeft||document.documentElement.scrollLeft||0;K+=document.body.scrollTop||document.documentElement.scrollTop||0;}return[E-(N?2:0),K-(N?2:0)];}var q=F?0:I.offsetLeft,G=F?0:I.offsetTop;I=F?I:I.offsetParent||I.parentNode;if(apf.isIE8&&B){M=this.getStyle(I,"borderLeftWidth");q-=(apf.isIE&&I.currentStyle.borderLeftStyle!="none"&&M=="medium"?2:parseInt(M)||0);D=this.getStyle(I,"borderTopWidth");G-=(apf.isIE&&I.currentStyle.borderTopStyle!="none"&&D=="medium"?2:parseInt(D)||0);}var M,D,o;while(I&&I!=B){M=apf.isOpera||apf.isIE8?0:this.getStyle(I,apf.descPropJs?"borderLeftWidth":"border-left-width");q+=(apf.isIE&&I.currentStyle.borderLeftStyle!="none"&&M=="medium"?2:parseInt(M)||0)+I.offsetLeft;if(apf.isIE&&!apf.isIE8&&apf.getStyle(I,"styleFloat")=="none"&&apf.getStyle(I,"position")=="relative"){var J=I.previousSibling;while(J){if(J.nodeType==1){o=apf.getStyle(J,"styleFloat");if(o=="left"){q-=parseInt(apf.getStyle(I,"marginLeft"))||0;break;}else{if(o=="right"){break;}}}J=J.previousSibling;}}D=apf.isOpera||apf.isIE8?0:this.getStyle(I,apf.descPropJs?"borderTopWidth":"border-top-width");G+=(apf.isIE&&I.currentStyle.borderTopStyle!="none"&&D=="medium"?2:parseInt(D)||0)+I.offsetTop;if(!apf.isGecko&&I!=B&&(I.tagName!="HTML"||I.ownerDocument!=document)){q-=I.scrollLeft;G-=I.scrollTop;}if(I.tagName.toLowerCase()=="table"){G-=parseInt(I.border||0)+parseInt(I.cellSpacing||0);q-=parseInt(I.border||0)+parseInt(I.cellSpacing||0)*2;}else{if(I.tagName.toLowerCase()=="tr"){var O;G-=(O=parseInt(I.parentNode.parentNode.cellSpacing));while(I.previousSibling){G-=(I=I.previousSibling).offsetHeight+O;}}}if(apf.isIE&&!I.offsetParent&&I.parentNode.nodeType==1){q-=I.parentNode.scrollLeft;G-=I.parentNode.scrollTop;}I=I.offsetParent;}return[q,G];};apf.getViewPort=function(i){i=i||window;var d=(!i.document.compatMode||i.document.compatMode=="CSS1Compat")?i.document.html||i.document.documentElement:i.document.body;return{x:i.pageXOffset||d.scrollLeft,y:i.pageYOffset||d.scrollTop,width:i.innerWidth||d.clientWidth,height:i.innerHeight||d.clientHeight};};apf.plane={init:function(){if(!this.plane){this.plane=document.createElement("DIV");document.body.appendChild(this.plane);this.plane.style.background="url(images/spacer.gif)";this.plane.style.position="absolute";this.plane.style.zIndex=100000000;this.plane.style.left=0;this.plane.style.top=0;}},lastCursor:null,show:function(n,t,u){this.init();var w=this.plane;this.current=n;if(!t){this.lastZ=this.current.style.zIndex;this.current.style.zIndex=100000;}else{this.plane.appendChild(n);}var q=(w.parentNode==document.body?(apf.isIE?document.documentElement.offsetWidth-(apf.isIE<8?2:4):window.innerWidth):w.parentNode.offsetWidth);var s=(w.parentNode==document.body?(apf.isIE?document.documentElement.offsetHeight-(apf.isIE<8?2:4):window.innerHeight):w.parentNode.offsetHeight);if(u){if(this.lastCursor===null){this.lastCursor=document.body.style.cursor;}document.body.style.cursor=apf.getStyle(n,"cursor");}this.plane.style.display="block";var o=apf.getDiff(w.parentNode);this.plane.style.width=(q-o[0])+"px";this.plane.style.height=(s-o[1])+"px";return w;},hide:function(){var c=apf.isChildOf(this.plane,document.activeElement);if(this.lastZ){if(this.current.style.zIndex==100000){this.current.style.zIndex=this.lastZ;}this.lastZ=null;}if(this.current.parentNode==this.plane){this.plane.parentNode.appendChild(this.current);}this.plane.style.display="none";if(c){if(!apf.isIE){document.activeElement.focus();}apf.document.activeElement.$focus();}this.current=null;if(this.lastCursor!==null){document.body.style.cursor=this.lastCursor;this.lastCursor=null;}return this.plane;}};apf.xmlDiff=function(av,az){var aJ={},aO=[],aY=[],aC=1,aG=2,aT=3,aI=4,l={},aE={},ao={},am={},aX={},aB={include:{}},ax,t,aH,aV,aQ,aP,aL,a,aF,aD,aw,q,ap,aW,aU,at,au=[],j;(function aK(z,s,u){var o,c,m,w,d,n,A;s+="/"+z.tagName;if(w=(c=z.childNodes).length){for(o=0;o<w;o++){if((n=c[o]).nodeType==1){aK(c[o],s,u);}else{A=s+"/"+n.nodeType,(u[A]||(u[A]=[])).push(n),n.$isValid=false;}}}if(w=(m=z.attributes).length){for(o=0;o<w;o++){A=s+"/@"+(d=m[o]).nodeName,(u[A]||(u[A]=[])).push(d),d.$isValid=false;}}(u[s]||(u[s]=[])).push(z);z.$isValid=false;})(av,"",aJ);aB.include[av.parentNode.$uniqueId]=av;(function aM(X,U,Y,R,K){var c,Q,N,C,o,J,E,A,W,P,m,w,B,G,n,V,M,z,Z,D,T,u,F=0,I=[],d={length:0},s=K.include;U+="/"+X.tagName;if(!(G=Y[U])){(l[U]||(l[U]=[])).push({arr:null,node:X,curNode:K});return false;}else{J=(M={}).include={};for(E=0,P=G.length;E<P;E++){if((o=G[E])){J[o.$uniqueId]=o;}}J.length=P;}if(P=(A=X.childNodes).length){for(E=0;E<P;E++){if((w=A[E]).nodeType==1){aM(w,U,Y,R,M);}else{if((n=Y[B=U+"/"+w.nodeType])){for(c=0,Q=null,N=w.nodeValue,O=0,C=n.length;O<C;O++){if((V=n[O])&&V.nodeValue==N){if(!Q){Q={node:w,index:O,arr:n,curNode:M,pcur:[V.parentNode.$uniqueId],found:[O]};}else{Q.found.push(O),Q.pcur.push(V.parentNode.$uniqueId);}c++;}}if(c){z=Q.pcur,Z=z.length;for(O=0;O<Z;O++){if(M[z[O]]){M[z[O]]+=(1/c);}else{M[z[O]]=(1/c);}}(am[B]||(am[B]=[])).push(Q);continue;}(l[B]||(l[B]=[])).push({arr:n,node:w,curNode:M});continue;}(l[B]||(l[B]=[])).push({isNew:true,arr:null,node:w,curNode:M});}}}if(P=(W=X.attributes).length){for(E=0;E<P;E++){pattr=U+"/@"+(m=W[E]).nodeName;if(n=Y[pattr]){for(c=0,Q=null,N=m.nodeValue,O=0,C=n.length;O<C;O++){if((V=n[O])&&V.nodeValue==N){if(!Q){Q={node:m,index:O,arr:n,curNode:M,pcur:[V.ownerElement.$uniqueId],found:[O]};}else{Q.found.push(O),Q.pcur.push(V.ownerElement.$uniqueId);}c++;}}if(c){z=Q.pcur,Z=z.length;for(O=0;O<Z;O++){if(M[z[O]]){M[z[O]]+=(1/c);}else{M[z[O]]=(1/c);}}(aX[pattr]||(aX[pattr]=[])).push(Q);continue;}(aE[pattr]||(aE[pattr]=[])).push({arr:n,node:m,curNode:M});continue;}(aE[pattr]||(aE[pattr]=[])).push({isNew:true,arr:null,node:m,curNode:M});}}for(D in M){if(M[D]>F){F=M[D],T=1;}else{if(M[D]==F){T++;}}}if(!F){T=G.length;for(E=T;E>=0;E--){if(!G[E]){continue;}R=(u=G[E]).parentNode;if(u.$isValid||!J[u.$uniqueId]||!s[R.$uniqueId]){delete J[u.$uniqueId],T--;continue;}if(!d[R.$uniqueId]){d[R.$uniqueId]=R,d.length++;}I.push(u);}}else{for(D in M){if(M[D]!=F){continue;}R=(u=apf.all[D]).parentNode;if(u.$isValid||!J[u.$uniqueId]||!s[R.$uniqueId]){delete J[u.$uniqueId],T--;continue;}if(!d[R.$uniqueId]){d[R.$uniqueId]=R,d.length++;}I.push(u);}}if(I.length){K.include=d;}for(Q=null,E=0,P=I.length;E<P;E++){R=(o=I[E]).parentNode;if(K[R.$uniqueId]){K[R.$uniqueId]+=1/T;}else{K[R.$uniqueId]=1/T;}if(T>1){if(!Q){Q={node:X,arr:G,curNode:M,curParentNode:K,found:I};(ao[U]||(ao[U]=[])).push(Q);}if(T>(o.$matchedNodes||0)){o.$matchedNodes=T;}}else{o.$isValid=true;for(var O=G.length-1;O>=0;O--){if(G[O]==o){delete G[O];break;}}}}if(!I.length){(l[B]||(l[B]=[])).push({arr:G,node:X,curNode:K});}M.curNode=I[0],M.parent=K,M.curPath=U;})(az,"",aJ,av,aB);function an(o){var u=ao[o];if(!u){return;}var n,m,E,w,c,B,A,z,D,C,s;for(A=0,C=u.length;A<C;A++){z=(n=u[A]).found,D=100000;for(w=B=0,E=z.length;B<E;B++){if((m=z[B]).$isValid){continue;}c=m.$matchedNodes;if(c<D){D=c,w=1;}else{if(c==D){w++;}}}if(w==1){for(B=0,E=z.length;B<E;B++){if(!(m=z[B]).$isValid&&m.$matchedNodes==D){m.$isValid=true,n.curNode.curNode=m;break;}}}else{if(w){var d=n.curParentNode.include;if(d.length==1){s=n.curParentNode.curNode;for(B=0,E=z.length;B<E;B++){if(!(m=z[B]).$isValid&&m.$matchedNodes==D&&m.parentNode==s){m.$isValid=true,n.curNode.curNode=m;break;}}continue;}an(n.curParentNode.curPath),s=n.curParentNode.curNode;for(B=0,E=z.length;B<E;B++){if(!(m=z[B]).$isValid&&m.$matchedNodes==D&&m.parentNode==s){m.$isValid=true,n.curNode.curNode=m;break;}}}}}delete ao[o];}for(aP in ao){an(aP);}for(aP in am){ax=am[aP],aH=ax.length,t=ax[0].arr;for(aD=0;aD<aH;aD++){a=ax[aD],aW=a.found;if((aL=a.curNode)&&(aL=aL.curNode)){if(t[a.index]&&aL==t[a.index].parentNode){delete t[a.index];}else{for(aQ=false,aF=0;aF<aW.length;aF++){if(t[aW[aF]]&&t[aW[aF]].parentNode==aL){delete t[aW[aF]],aQ=true;break;}}if(!aQ){(l[aP]||(l[aP]=[])).push(a);}}}else{}}}for(aP in aX){ax=aX[aP],aH=ax.length,t=ax[0].arr;for(aD=0;aD<aH;aD++){a=ax[aD],aW=a.found;if((aL=a.curNode)&&(aL=aL.curNode)){if(t[a.index]&&aL==t[a.index].ownerElement){delete t[a.index];}else{for(aQ=false,aF=0;aF<aW.length;aF++){if(t[aW[aF]]&&t[aW[aF]].ownerElement==aL){delete t[aW[aF]],aQ=true;break;}}if(!aQ){(aE[aP]||(aE[aP]=[])).push(a);}}}else{}}}for(aP in aE){ax=aE[aP],aH=ax.length,t=ax[0].arr||au,aV=t.length;for(aD=0;aD<aH;aD++){aw=ax[aD];if((aL=aw.curNode)&&(aL=aL.curNode)){if(aw.node.nodeName=="id"){aL.setAttribute("id",aw.node.nodeValue);}else{aO.push([aI,aL,aw.node]);}for(aF=0;aF<aV;aF++){if(t[aF]&&t[aF].ownerElement==aL){delete t[aF];break;}}}else{}}}for(aP in l){ax=l[aP],aH=ax.length,t=ax[0].arr||au,aV=t.length;for(aD=0;aD<aH;aD++){a=ax[aD];if((aL=a.curNode)&&(aL=aL.curNode)){aY.push(aU=[aC,aL,a.node]);for(aF=0;aF<aV;aF++){if(t[aF]&&t[aF].parentNode==aL){if(a.node.nodeType!=1){aU[0]=aG;aU[1]=t[aF];}else{aY.length--;}delete t[aF];break;}}}else{}}}for(at in aJ){q=aJ[at];for(aD=0,aH=q.length;aD<aH;aD++){ap=q[aD];if(ap&&!ap.$isValid&&(ap.parentNode||ap.ownerElement).$isValid){aO.push([aT,ap]);}}}var aS=new Date().getTime();var aN={},aR=av.ownerDocument;for(aD=0,aH=aY.length;aD<aH;aD++){switch((q=aY[aD])[0]){case aG:q[1].$setValue(q[2].nodeValue);if(q[1].nodeType!=2){var ay=apf.getChildNumber(q[1]),aA=apf.getChildNumber(q[2]);if(ay!=aA){q[1].parentNode.insertBefore(q[1],q[1].parentNode.childNodes[aA]);}}break;case aC:if(!q[1].canHaveChildren){q[1].$aml=q[2].parentNode;if(q[1].$redraw){q[1].$redraw();}continue;}if(q[1].render!="runtime"){var ar=q[1].parentNode;while(ar&&ar.nodeType==1&&!ar.getAttribute("render")){ar=ar.parentNode;}if(ar&&ar.render){if(ar.$amlList){ar.$amlList.push(q);}else{ar.$amlList=[q];ar.addEventListener("beforerender",function(n){var d=this.$amlList;this.$amlList=null;for(var s,m=0,c=d.length;m<c;m++){s=d[m];var o=apf.getChildNumber(j=s[2]);s[1].insertBefore(aR.importNode(j,true),s[1].childNodes[o]);}this.$rendered=true;this.removeEventListener("beforerender",arguments.callee);return false;});ar.$rendered=false;}}else{(q[1].$amlList||(q[1].$amlList=[]))[apf.getChildNumber(q[2])]=q;aN[q[1].$uniqueId]=q[1];}}else{q[1].$aml=q[2].parentNode;q[1].$rendered=false;}break;}}var aq;for(var i in aN){aq=aN[i].$amlList;for(var q,aD=0;aD<aq.length;aD++){q=aq[aD];if(!q){continue;}q[1].insertBefore(aR.importNode(q[2],true),q[1].childNodes[aD]);}}for(aD=0,aH=aO.length;aD<aH;aD++){switch((q=aO[aD])[0]){case aT:if((j=q[1]).destroy){j.destroy(true,true);}else{if(j.parentNode){j.parentNode.removeChild(j);}else{j.ownerElement.removeAttributeNode(j);}}break;case aI:q[1].setAttribute((q=q[2]).nodeName,q.nodeValue);break;}}apf.queue.empty();alert(new Date().getTime()-aS);};apf.silverlight=(function(){var ad=0;var ab=false;var ap="http://go2.microsoft.com/fwlink/?LinkID=";var ao=false;var ac=null;function ae(){window.location.reload(false);}function aa(c){if(c==undefined){c=null;}var t=false;var s=null;try{var l=null;var u=false;if(window.ActiveXObject){try{l=new ActiveXObject("AgControl.AgControl");if(c===null){t=true;}else{if(l.IsVersionSupported(c)){t=true;}}l=null;}catch(d){u=true;}}else{u=true;}if(u){var j=navigator.plugins["Silverlight Plug-In"];if(j){if(c===null){t=true;}else{var q=j.description;if(q==="1.0.30226.2"){q="2.0.30226.2";}var o=q.split(".");while(o.length>3){o.pop();}while(o.length<4){o.push(0);}var n=c.split(".");while(n.length>4){n.pop();}var a;var m;var i=0;do{a=parseInt(n[i]);m=parseInt(o[i]);i++;}while(i<n.length&&a===m);if(a<=m&&!isNaN(a)){t=true;}}}}}catch(d){t=false;}return t;}function am(){if(!apf.silverlight.isBrowserRestartRequired&&ae){try{navigator.plugins.refresh();}catch(a){}if(aa(null)&&!ab){ae();ab=true;}else{$setTimeout(am,3000);}}}function an(){navigator.plugins.refresh();apf.silverlight.isBrowserRestartRequired=aa(null);if(!apf.silverlight.isBrowserRestartRequired){am();if(!ao){af();ao=true;}}else{if(window.navigator.mimeTypes){var a=navigator.mimeTypes["application/x-silverlight-2"];var i=navigator.mimeTypes["application/x-silverlight-2-b2"];var d=navigator.mimeTypes["application/x-silverlight-2-b1"];var c=d;if(i){c=i;}if(!a&&(d||i)){if(!ao){W();ao=true;}}else{if(a&&c){if(a.enabledPlugin&&c.enabledPlugin){if(a.enabledPlugin.description!=c.enabledPlugin.description){if(!ao){ar();ao=true;}}}}}}}}function ai(s,a,n,d,u,j,i){var t={},m=d,w=u;t.version=m.version;m.source=s;t.alt=m.alt;if(j){m.initParams=j;}if(m.isWindowless&&!m.windowless){m.windowless=m.isWindowless;}if(m.framerate&&!m.maxFramerate){m.maxFramerate=m.framerate;}if(n&&!m.id){m.id=n;}delete m.ignoreBrowserVer;delete m.inplaceInstallPrompt;delete m.version;delete m.isWindowless;delete m.framerate;delete m.data;delete m.src;delete m.alt;var o;if(aa(t.version)){for(var q in w){if(w[q]){if(q=="onLoad"&&typeof w[q]=="function"&&w[q].length!=1){var c=w[q];w[q]=function(z){return c(document.getElementById(n),i,z);};}var l=T(w[q]);if(l!=null){m[q]=l;w[q]=null;}else{throw"typeof events."+q+" must be 'function' or 'string'";}}}o=P(m);}else{o=U(t);}if(a){a.innerHTML=o;}else{return o;}}function P(a){var c=[];c.push('<object type="application/x-silverlight" data="data:application/x-silverlight,"');if(a.id!=null){c.push(' id="'+al(a.id)+'"');}if(a.width!=null){c.push(' width="'+a.width+'"');}if(a.height!=null){c.push(' height="'+a.height+'"');}c.push(" >");delete a.id;delete a.width;delete a.height;for(var d in a){if(a[d]){c.push('<param name="'+al(d)+'" value="'+al(a[d])+'" />');}}c.push("</object>");return c.join("");}function V(a){var c=a;var d=ai(c.source,c.parentElement,c.id,c.properties,c.events,c.initParams,c.context);if(c.parentElement==null){return d;}}function U(i){var a="";var c=ap;var d=i.version;if(i.alt){a=i.alt;}else{if(!d){d="";}a="<a href='javascript:Silverlight.getSilverlight(\"{1}\");' style='text-decoration: none;'><img src='{2}' alt='Get Microsoft Silverlight' style='border-style: none'/></a>";a=a.replace("{1}",d);a=a.replace("{2}",c+"108181");}return a;}function X(d){if(ac){ac();}var j="";var a=String(d).split(".");if(a.length>1){var c=parseInt(a[0]);if(isNaN(c)||c<2){j="1.0";}else{j=a[0]+"."+a[1];}}var i="";if(j.match(/^\d+\056\d+$/)){i="&v="+j;}ak("114576"+i);}function ak(a){top.location=ap+String(a);}function al(d){var a;var c="";if(d==null){return null;}for(var i=0;i<d.length;i++){a=d.charCodeAt(i);if(((a>96)&&(a<123))||((a>64)&&(a<91))||((a>43)&&(a<58)&&(a!=47))||(a==95)){c=c+String.fromCharCode(a);}else{c=c+"&#"+a+";";}}return c;}function ah(i,j){var d;var a=j.ErrorType;d=j.ErrorCode;var c=["\nSilverlight error message     \n          ErrorCode: ",d,"\n          ErrorType: ",a,"       \n          Message: ",j.ErrorMessage,"     \n"];if(a=="ParserError"){c.push("XamlFile: ",j.xamlFile,"     \n              Line: ",j.lineNumber,"     \n              Position: ",j.charPosition,"     \n");}else{if(a=="RuntimeError"){if(j.lineNumber!=0){c.push("Line: ",j.lineNumber,"     \n                    Position: ",j.charPosition,"     \n");}c.push("MethodName: ",j.methodName,"     \n");}}throw new Error(apf.formatErrorString(0,this,c.join("")));}function aq(){for(var a=ad-1;a>=0;a--){window["__slEvent"+a]=null;}ad=0;if(window.removeEventListener){window.removeEventListener("unload",aq,false);}else{window.detachEvent("onunload",aq);}}function T(c){var d="";if(typeof c=="string"){d=c;}else{if(typeof c=="function"){if(ad==0){if(window.addEventListener){window.addEventListener("onunload",aq,false);}else{window.attachEvent("onunload",aq);}}var a=ad++;d="__slEvent"+a;window[d]=c;}else{d=null;}}return d;}function Q(){}function ar(){}function W(){}function af(){}function Z(d,i){var a=false;try{if(i.ErrorCode==8001&&!ao){W();ao=true;}else{if(i.ErrorCode==8002&&!ao){ar();ao=true;}else{if(i.ErrorCode==5014||i.ErrorCode==2106){if(R(i.getHost())){a=true;}}else{a=true;}}}}catch(c){}return a;}function ag(d){var a=false;try{if(R(d.getHost())){a=true;}}catch(c){}return a;}function R(i){var a=false,j="2.0.31005",c=null;try{if(i.IsVersionSupported(j+".99")){c=Q;a=true;}else{if(i.IsVersionSupported(j+".0")){c=ar;}else{c=W;}}if(c&&!ao){c();ao=true;}}catch(d){}return a;}var Y={};function aj(a){if(typeof a=="undefined"){a="1.0";}if(typeof Y[a]=="undefined"){Y[a]=aa(a);}return Y[a];}return{onGetSilverlight:null,isBrowserRestartRequired:false,startup:an,createObject:ai,createObjectEx:V,getSilverlight:X,default_error_handler:ah,isAvailable:aj};})();apf.flash=(function(){function getControlVersion(){var version,axo;try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");version=axo.GetVariable("$version");}catch(e){}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version="WIN 6,0,21,0";axo.AllowScriptAccess="always";version=axo.GetVariable("$version");}catch(e){}}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version=axo.GetVariable("$version");}catch(e){}}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");version="WIN 3,0,18,0";}catch(e){}}if(!version){try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");version="WIN 2,0,0,11";}catch(e){version=-1;}}return version;}function getSwfVersion(){var flashVer=-1,sAgent=navigator.userAgent.toLowerCase();if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){var swVer2=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"",swfDescr=navigator.plugins["Shockwave Flash"+swVer2].description,aDescr=swfDescr.split(" "),aTempMaj=aDescr[2].split("."),nMajor=aTempMaj[0],nMinor=aTempMaj[1],sRev=aDescr[3];if(sRev==""){sRev=aDescr[4];}if(sRev[0]=="d"){sRev=sRev.substring(1);}else{if(sRev[0]=="r"){sRev=sRev.substring(1);if(sRev.indexOf("d")>0){sRev=sRev.substring(0,sRev.indexOf("d"));}}}flashVer=nMajor+"."+nMinor+"."+sRev;}}else{if(sAgent.indexOf("webtv/2.6")!=-1){flashVer=4;}else{if(sAgent.indexOf("webtv/2.5")!=-1){flashVer=3;}else{if(sAgent.indexOf("webtv")!=-1){flashVer=2;}else{if(apf.isIE&&!apf.isOpera){flashVer=getControlVersion();}}}}}return flashVer;}function detectFlashVersion(reqMajorVer,reqMinorVer,reqRevision){var versionStr=getSwfVersion();if(versionStr==-1){return false;}if(versionStr!=0){var aVersions;if(apf.isIE&&!apf.isOpera){var aTemp=versionStr.split(" "),sTemp=aTemp[1];aVersions=sTemp.split(",");}else{aVersions=versionStr.split(".");}var nMajor=aVersions[0],nMinor=aVersions[1],sRev=aVersions[2];if(nMajor>parseFloat(reqMajorVer)){return true;}if(nMajor==parseFloat(reqMajorVer)){if(nMinor>parseFloat(reqMinorVer)){return true;}if(nMinor==parseFloat(reqMinorVer)&&sRev>=parseFloat(reqRevision)){return true;}}return false;}}function generateObj(objAttrs,params,embedAttrs,stdout){if(stdout=="undefined"){stdout=false;}var i,str=[];if(apf.isIE&&!apf.isOpera){str.push("<object ");for(i in objAttrs){str.push(i,'="',objAttrs[i],'" ');}str.push(">");for(i in params){str.push('<param name="',i,'" value="',params[i],'" />');}str.push("</object>");}else{str.push("<embed ");for(i in embedAttrs){str.push(i,'="',embedAttrs[i],'" ');}str.push("></embed>");}var sOut=str.join("");if(stdout===true){document.write(sOut);}return sOut;}function AC_FL_RunContent(options){var ret=AC_GetArgs(options,"movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash");return generateObj(ret.objAttrs,ret.params,ret.embedAttrs);}function buildContent(options){var v=isEightAvailable();if(isAvailable()&&!v){return buildInstaller(options||{});}if(v){return AC_FL_RunContent(options);}return'This content requires the             <a href="http://www.adobe.com/go/getflash/">Adobe Flash Player</a>.';}function embed(options){var obj=options.context,node=options.htmlNode,prop=options.property||"$player";delete options.context,delete options.htmlNode,delete options.property;var content=buildContent(options),cb=function(){$setTimeout(function(){node.innerHTML=content;obj[prop]=getElement(options.id);$setTimeout(function(){var fail=null;if(!obj[prop].parentNode){fail="File Uploader error: The movie has to be enabled manually because of Flashblock. No browser refresh is required.";}else{if(obj[prop].style.display=="none"){fail="File Uploader error: Adblock Plus blocks or hides the movie. Please enable it and refresh your browser.";}else{if(!obj[prop].offsetWidth){fail="File Uploader error: The Flash movie failed to load. Please check if the file exists and the path is correct.";}}}if(fail){obj.dispatchEvent("error",{message:fail});}},1000);},200);};return apf.loaded?cb():apf.addEventListener("load",cb);}function buildInstaller(options){if(!options){options={};}var ret=AC_GetArgs(options,"movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash"),MMPlayerType=(apf.isIE==true)?"ActiveX":"PlugIn",MMredirectURL=window.location;document.title=document.title.slice(0,47)+" - Flash Player Installation";var MMdoctitle=document.title;return AC_FL_RunContent({src:"playerProductInstall",FlashVars:"MMredirectURL="+MMredirectURL+"&MMplayerType="+MMPlayerType+"&MMdoctitle="+MMdoctitle+"",width:"100%",height:"100%",align:"middle",id:ret.embedAttrs.name,quality:"high",bgcolor:"#000000",name:ret.embedAttrs.name,allowScriptAccess:"always",type:"application/x-shockwave-flash",pluginspage:"http://www.adobe.com/go/getflashplayer"});}var sSrc="src|movie",sObj="onafterupdate|onbeforeupdate|onblur|oncellchange|onclick|ondblclick|ondrag|ondragend|ondragenter|ondragleave|ondragover|ondrop|onfinish|onfocus|onhelp|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup|onload|onlosecapture|onpropertychange|onreadystatechange|onrowsdelete|onrowenter|onrowexit|onrowsinserted|onstart|onscroll|onbeforeeditfocus|onactivate|onbeforedeactivate|ondeactivate|type|codebase|id",sEmb="width|height|align|vspace|hspace|class|title|accesskey|name|tabindex";function AC_GetArgs(options,srcParamName,classid,mimeType){var i,name,ret={embedAttrs:{},params:{},objAttrs:{}};for(i in options){name=i.toLowerCase();if(name=="classid"){continue;}if(name=="pluginspage"){ret.embedAttrs[i]=options[i];}else{if(sSrc.indexOf(name)>-1){ret.embedAttrs.src=options[i];ret.params[srcParamName]=options[i];}else{if(sObj.indexOf(name)>-1){ret.objAttrs[i]=options[i];}else{if(sEmb.indexOf(name)>-1){ret.embedAttrs[i]=ret.objAttrs[i]=options[i];}else{ret.embedAttrs[i]=ret.params[i]=options[i];}}}}}ret.objAttrs.classid=classid;if(mimeType){ret.embedAttrs.type=mimeType;}return ret;}function getElement(id){var elem;if(typeof id=="object"){return id;}if(apf.isIE){return self[id];}else{elem=document[id]?document[id]:document.getElementById(id);if(!elem){elem=apf.lookup(id);}return elem;}}var hash={},uniqueID=1;function addPlayer(player){hash[++uniqueID]=player;return uniqueID;}function getPlayer(id){return hash[id];}function callMethod(id,methodName){var player=hash[id];if(player==null){throw new Error(apf.formatErrorString(0,this,"Player with id: "+id+" not found"));}if(player[methodName]==null){throw new Error(apf.formatErrorString(0,this,"Method "+methodName+" Not found"));}var args=[],i=2,l=arguments.length;for(;i<l;i++){args.push(decode(arguments[i]));}player[methodName].apply(player,args);}function remote(o,fn){if(typeof o=="string"){o=hash[o];}var rs=o.CallFunction('<invoke name="'+fn+'" returntype="javascript">'+__flash__argumentsToXML(arguments,2)+"</invoke>");return eval(rs);}function encode(data){if(!data||typeof data!="string"){return data;}return data.replace(/\&([^;]*)\;/g,"&amp;$1;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace("\\","&custom_backslash;").replace(/\0/g,"\\0").replace(/\"/g,"&quot;");}function decode(data){if(data&&data.length&&typeof data!="string"){data=data[0];}if(!data||typeof data!="string"){return data;}return data.replace(/\&custom_lt\;/g,"<").replace(/\&custom_gt\;/g,">").replace(/\&custom_backslash\;/g,"\\").replace(/\\0/g,"\0");}var aIsAvailable={};function isAvailable(sVersion){if(typeof sVersion!="string"){sVersion="6.0.65";}var aVersion=sVersion.split(".");while(aVersion.length<3){aVersion.push("0");}if(typeof aIsAvailable[sVersion]=="undefined"){aIsAvailable[sVersion]=detectFlashVersion(parseInt(aVersion[0]),parseInt(aVersion[1]),parseInt(aVersion[2]));}return aIsAvailable[sVersion];}function isEightAvailable(){return isAvailable("8.0.0");}var oSandboxTypes={remote:"remote (domain-based) rules",localwithfile:"local with file access (no internet access)",localwithnetwork:"local with network (internet access only, no local access)",localtrusted:"local, trusted (local + internet access)"};function getSandbox(sType){var oSandbox={type:null,description:null,noRemote:false,noLocal:false,error:null};oSandbox.type=sType.toLowerCase();oSandbox.description=oSandboxTypes[(typeof oSandboxTypes[oSandbox.type]!="undefined"?oSandbox.type:"unknown")];if(oSandbox.type=="localwithfile"){oSandbox.noRemote=true;oSandbox.noLocal=false;oSandbox.error="Flash security note: Network/internet URLs will not                                  load due to security restrictions.                                 Access can be configured via Flash Player Global Security                                 Settings Page:                                  http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html";}else{if(oSandbox.type=="localwithnetwork"){oSandbox.noRemote=false;oSandbox.noLocal=true;}else{if(oSandbox.type=="localtrusted"){oSandbox.noRemote=false;oSandbox.noLocal=false;}}}return oSandbox;}return{isAvailable:isAvailable,isEightAvailable:isEightAvailable,buildContent:buildContent,embed:embed,encode:encode,decode:decode,getElement:getElement,addPlayer:addPlayer,getPlayer:getPlayer,callMethod:callMethod,getSandbox:getSandbox,remote:remote};})();apf.setcookie=function(u,s,w,n,t,q){var o=u+"="+escape(s)+";";if(w){o+="expires="+new Date(w+new Date().getTimezoneOffset()*60).toGMTString()+";";}if(n){o+="path="+n+";";}if(t){o+="domain="+t+";";}if(q){o+="secure";}document.cookie=o;return s;};apf.getcookie=function(m){var n=document.cookie.split("; ");for(var l=0;l<n.length;l++){var i=n[l].split("=");if(m==i[0]){return unescape(i[1]);}}return"";};apf.delcookie=function(d,i){document.cookie=d+"=blah; expires=Fri, 31 Dec 1999 23:59:59 GMT;"+(i?"domain="+i:"");};apf.highlightXml=apf.highlightCode=function(i){var q=i.split(/\n\r?/);for(var n=1000,o=0,l=q.length;o<l;o++){n=Math.min(n,q[o].match(/^(\s+)?[^\s]/)&&RegExp.$1.length||1000);if(!n){break;}}i=i.replace(new RegExp("^ {"+n+"}","gm"),"").replace(/<!--([\s\S]+?)-->|<\?([\w\-]+)([\s\S]+?)\?>|<\!\[CDATA\[([\s\S]*?)\]\]>|<(\w+:)?script([\s\S]*?)>([\s\S]*?)<\/(?:\w+:)?script>|<([\/\w\:\-]+)([\s\S]*?)(\/?)>/g,function(c,G,a,E,D,B,F,d,j,C,m){if(G){return'<span style="color:green">&lt;!--'+G+"--&gt;</span>";}else{if(a){return'<span style="color:orange">&lt;?'+a+"</span>"+apf.highlightJs(E,true)+'<span style="color:orange">?&gt;</span>';}else{if(D){return'<span style="color:gray">&lt;![CDATA['+D+"]]&gt;</span>";}else{if(B){return'<span style="color:#127ac6">&lt;'+B+"script"+(C?"</span>"+C.replace(/("[\s\S]*?")|([\w\-\:]+)/g,function(u,s,t){if(s){return s;}return'<span style="color:red">'+t+"</span>";})+'<span style="color:#127ac6">&gt;</span>':"&gt;</span>")+apf.highlightJs(d,true)+'<span style="color:#127ac6">&lt;/'+B+"script&gt;</span>";}else{if(j){return'<span style="color:#127ac6">&lt;'+(j.substr(0,2)=="a:"?"<a href='element."+j.substr(2)+"'>"+j+"</a>":j)+(C?"</span>"+C.replace(/("[\s\S]*?")|([\w\-\:]+)/g,function(u,s,t){if(s){return s;}return'<span style="color:red">'+t+"</span>";})+'<span style="color:#127ac6">'+m+"&gt;</span>":"&gt;</span>");}}}}}});return i;};apf.convertAmlToJson=function(n){var q=apf.getXml("<a:app xmlns:a='"+apf.ns.apf+"'>"+n+"</a:app>",null,true);var s=[],t={"true":1,"false":1};var m=(function o(K,i,Q){var V=new Array(i+2).join("  "),l=[];for(var d,c=0,T=K.length;c<T;c++){d=K[c];if(d.nodeType==3||d.nodeType==4){if(d.nodeValue.replace(/[\s]*$/,"").replace(/^[\s]*/,"")){(Q||l).push("data",'"'+d.nodeValue.trim().replace(/"/g,'\\"').replace(/\n/g,"\\\n")+'"');}continue;}else{if(d.nodeType==8){l.push(V+"//"+d.nodeValue);continue;}else{if(d.nodeType!=1){continue;}else{if(d[apf.TAGNAME]=="script"){var O=d.childNodes;for(var N=0,j=O.length;N<j;N++){if(O[N].nodeValue.trim()!="//"){s.push(O[N].nodeValue.replace(/^ {16}/gm,"").replace(/\/\/$/,"")+"\n");}}continue;}}}}var W,a=d.childNodes.length+(W=d.attributes).length;var R=0,M=[];l.push(V+"new apf."+d[apf.TAGNAME]+(a||!i?"({":"()"+(i==0?";":(c==T-1?"":","))));if(!i){M.push("htmlNode","document.body");R=Math.max(8,R);}for(var P,N=0,j=W.length;N<j;N++){M.push((P=W[N]).nodeName,P.nodeName.substr(0,2)=="on"?"function(){"+P.nodeValue+"}":(parseInt(P.nodeValue)==P.nodeValue||t[P.nodeValue]?P.nodeValue:'"'+P.nodeValue.replace(/"/g,'\\"')+'"'));R=Math.max(P.nodeName.length,R);}var U="";if(d[apf.TAGNAME]=="model"&&d.childNodes.length){M.push("data",'"'+apf.serializeChildren(d).trim().replace(/"/g,'\\"').replace(/\r?\n/g,"\\\n")+'"');}else{if(a){var U=o(d.childNodes,i+2,M);}}R=Math.max(U?10:4,R);R++;for(N=0,j=M.length;N<j;N+=2){l.push(V+"  "+M[N].pad(R," ",apf.PAD_RIGHT)+": "+M[N+1]+(N!=j-2||U?",":""));}if(U){l.push(V+"  "+"childNodes".pad(R," ",apf.PAD_RIGHT)+": [");l.push(U.substr(0,U.length-1));l.push(V+"  ]");}if(a||!i){l.push(V+"})"+(i==0?";":(c==T-1?"":",")));}}return l.join("\n")+(i==0?"\n\n"+s.join("").trim():"");})(q.childNodes,0);return m+"\n\n";};apf.highlightJs=function(l,t){if(!t){var q=l.split(/\n\r?/);for(var i=1000,o=0,s=q.length;o<s;o++){i=Math.min(i,q[o].match(/^(\s+)?[^\s]/)&&RegExp.$1.length||1000);if(!i){break;}}l=l.replace(new RegExp("^ {"+i+"}","gm"),"");}return l.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/(\/\*[\s\S]+\*\/)|(\/\/.*)$|("(?:[^"\\]+|\\[\s\S])*")|('(?:[^'\\]+|\\[\s\S])*')|(\W)(apf|break|continue|do|for|import|new|this|void|case|default|else|function|in|return|typeof|while|comment|delete|export|if|label|switch|var|with|abstract|implements|protected|boolean|instanceOf|public|byte|int|short|char|interface|static|double|long|synchronized|false|native|throws|final|null|transient|float|package|true|goto|private|catch|enum|throw|class|extends|try|const|finally|debugger|super)(\W)|(\W)(\w+)(\s*\()/gm,function(n,c,C,a,j,F,E,m,D,G,d){if(G){return D+'<span style="color:#ff8000">'+G+"</span>"+d;}else{if(C||c){return'<span style="color:green">'+(C||c)+"</span>";}else{if(a||j){return'<span style="color:#808080">'+(a||j)+"</span>";}else{if(F){return F+'<span style="color:#127ac6">'+E+"</span>"+m;}}}}});};apf.highlightCode2=function(i){var j=[],l=[];return i.replace(/(\/\*[\s\S]*?\*\/|\/\/.*)/g,function(a){j.push(a);return"###n"+(j.length-1)+"###";}).replace(/\"([\s\S]*?)\"/g,function(a,c){l.push(c);return"###s"+(l.length-1)+"###";}).replace(/\'([\s\S]*?)\'/g,function(a,c){l.push(c);return"###q"+(l.length-1)+"###";}).replace(/(\<)|(\>)/g,function(a,c,d){return"<span stylecolorwhite>"+(c?"@lt@":"@gt@")+"</span>";}).replace(/(\W)-?([\d\.]+)(\W)/g,"$1<span stylecolor#127ac6>$2</span>$3").replace(/([\|\&\=\;\,\:\?\+\*\-]+)/g,"<span stylecolorwhite>$1</span>").replace(/(\W)(break|continue|do|for|import|new|this|void|case|default|else|function|in|return|typeof|while|comment|delete|export|if|label|switch|var|with|abstract|implements|protected|boolean|instanceOf|public|byte|int|short|char|interface|static|double|long|synchronized|false|native|throws|final|null|transient|float|package|true|goto|private|catch|enum|throw|class|extends|try|const|finally|debugger|super)(\W)/g,"$1<span stylecolorgreen>$2</span>$3").replace(/([\(\)\{\}\[\]])/g,"<span stylecoloryellow>$1</span>").replace(/###n(\d+)###/g,function(a,c){return"<span stylecolorpurple>"+j[c].escapeHTML()+"</span>";}).replace(/###s(\d+)###/g,function(a,c){return'<span stylecolorgray>"'+l[c].escapeHTML()+'"</span>';}).replace(/###q(\d+)###/g,function(a,c){return"<span stylecolorgray>'"+l[c].escapeHTML()+"'</span>";}).replace(/stylecolor(.*?)\>/g,"style='color:$1'>").replace(/@(.*?)@/g,"&$1;");};apf.formatJS=function(q){var n=0,m=0;var d=[],o=[];return q.replace(/(\/\*[\s\S]*?\*\/|\/\/.*)/g,function(a){d.push(a);return"###n"+(d.length-1)+"###";}).replace(/\"([\s\S]*?)\"/g,function(a,c){o.push(c);return"###s"+(o.length-1)+"###";}).replace(/\'([\s\S]*?)\'/g,function(a,c){o.push(c);return"###q"+(o.length-1)+"###";}).replace(/;+/g,";").replace(/{;/g,"{").replace(/({)|(})|(\()|(\))|(;)/g,function(B,a,A,l,j,i){if(a){n++;}if(A){n--;}if(l){m++;return l;}if(j){m--;return j;}var c="";for(var C=0;C<n;C++){c+="\t";}if(a){return"{\n"+c;}if(A){return"\n"+c+"}";}if(i){return(m>0)?i:(";\n"+c);}}).replace(/;\s*\n\s*\n/g,";\n").replace(/}var/g,"}\nvar").replace(/([\n\s]*)###n(\d+)###[\n\s]*/g,function(a,c,i){return c+d[i]+c;}).replace(/###s(\d+)###/g,function(a,c,i){return'"'+o[c]+'"';}).replace(/###q(\d+)###/g,function(a,c,i){return"'"+o[c]+"'";});};apf.pasteWindow=function(i){var d=window.open("about:blank");d.document.write(i);};apf.xmlEntityMap={quot:"34",amp:"38",apos:"39",lt:"60",gt:"62",nbsp:"160",iexcl:"161",cent:"162",pound:"163",curren:"164",yen:"165",brvbar:"166",sect:"167",uml:"168",copy:"169",ordf:"170",laquo:"171",not:"172",shy:"173",reg:"174",macr:"175",deg:"176",plusmn:"177",sup2:"178",sup3:"179",acute:"180",micro:"181",para:"182",middot:"183",cedil:"184",sup1:"185",ordm:"186",raquo:"187",frac14:"188",frac12:"189",frac34:"190",iquest:"191",agrave:"192",aacute:"193",acirc:"194",atilde:"195",auml:"196",aring:"197",aelig:"198",ccedil:"199",egrave:"200",eacute:"201",ecirc:"202",euml:"203",igrave:"204",iacute:"205",icirc:"206",iuml:"207",eth:"208",ntilde:"209",ograve:"210",oacute:"211",ocirc:"212",otilde:"213",ouml:"214",times:"215",oslash:"216",ugrave:"217",uacute:"218",ucirc:"219",uuml:"220",yacute:"221",thorn:"222",szlig:"223",agrave:"224",aacute:"225",acirc:"226",atilde:"227",auml:"228",aring:"229",aelig:"230",ccedil:"231",egrave:"232",eacute:"233",ecirc:"234",euml:"235",igrave:"236",iacute:"237",icirc:"238",iuml:"239",eth:"240",ntilde:"241",ograve:"242",oacute:"243",ocirc:"244",otilde:"245",ouml:"246",divide:"247",oslash:"248",ugrave:"249",uacute:"250",ucirc:"251",uuml:"252",yacute:"253",thorn:"254",yuml:"255",oelig:"338",oelig:"339",scaron:"352",scaron:"353",yuml:"376",fnof:"402",circ:"710",tilde:"732",alpha:"913",beta:"914",gamma:"915",delta:"916",epsilon:"917",zeta:"918",eta:"919",theta:"920",iota:"921",kappa:"922",lambda:"923",mu:"924",nu:"925",xi:"926",omicron:"927",pi:"928",rho:"929",sigma:"931",tau:"932",upsilon:"933",phi:"934",chi:"935",psi:"936",omega:"937",alpha:"945",beta:"946",gamma:"947",delta:"948",epsilon:"949",zeta:"950",eta:"951",theta:"952",iota:"953",kappa:"954",lambda:"955",mu:"956",nu:"957",xi:"958",omicron:"959",pi:"960",rho:"961",sigmaf:"962",sigma:"963",tau:"964",upsilon:"965",phi:"966",chi:"967",psi:"968",omega:"969",thetasym:"977",upsih:"978",piv:"982",ensp:"8194",emsp:"8195",thinsp:"8201",zwnj:"8204",zwj:"8205",lrm:"8206",rlm:"8207",ndash:"8211",mdash:"8212",lsquo:"8216",rsquo:"8217",sbquo:"8218",ldquo:"8220",rdquo:"8221",bdquo:"8222",dagger:"8224",dagger:"8225",bull:"8226",hellip:"8230",permil:"8240",prime:"8242",prime:"8243",lsaquo:"8249",rsaquo:"8250",oline:"8254",frasl:"8260",euro:"8364",image:"8465",weierp:"8472",real:"8476",trade:"8482",alefsym:"8501",larr:"8592",uarr:"8593",rarr:"8594",darr:"8595",harr:"8596",crarr:"8629",larr:"8656",uarr:"8657",rarr:"8658",darr:"8659",harr:"8660",forall:"8704",part:"8706",exist:"8707",empty:"8709",nabla:"8711",isin:"8712",notin:"8713",ni:"8715",prod:"8719",sum:"8721",minus:"8722",lowast:"8727",radic:"8730",prop:"8733",infin:"8734",ang:"8736",and:"8743",or:"8744",cap:"8745",cup:"8746","int":"8747",there4:"8756",sim:"8764",cong:"8773",asymp:"8776",ne:"8800",equiv:"8801",le:"8804",ge:"8805",sub:"8834",sup:"8835",nsub:"8836",sube:"8838",supe:"8839",oplus:"8853",otimes:"8855",perp:"8869",sdot:"8901",lceil:"8968",rceil:"8969",lfloor:"8970",rfloor:"8971",lang:"9001",rang:"9002",loz:"9674",spades:"9824",clubs:"9827",hearts:"9829",diams:"9830"};apf.htmlentities=function(c){return c.escapeHTML();};apf.xmlentities=function(c){return c.replace(/&([a-z]+);/gi,function(a,i){if(apf.xmlEntityMap[i=i.toLowerCase()]){return"&#"+apf.xmlEntityMap[i]+";";}return a;});};apf.html_entity_decode=function(c){return(c||"").replace(/\&\#38;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&nbsp;/g," ");};apf.isCharacter=function(c){return(c<112||c>122)&&(c==32||c>42||c==8);};apf.randomGenerator={d:new Date(),seed:null,A:48271,M:2147483647,Q:null,R:null,oneOverM:null,generate:function(i,d){if(this.seed==null){this.seed=2345678901+(this.d.getSeconds()*16777215)+(this.d.getMinutes()*65535);}this.Q=this.M/this.A;this.R=this.M%this.A;this.oneOverM=1/this.M;return Math.floor((d-i+1)*this.next()+i);},next:function(){var i=this.seed/this.Q;var l=this.seed%this.Q;var j=this.A*l-this.R*i;if(j>0){this.seed=j;}else{this.seed=j+this.M;}return(this.seed*this.oneOverM);}};apf.getNoCacheUrl=function(c){return c+(c.indexOf("?")==-1?"?":"&")+"nocache="+new Date().getTime();};apf.parseExpression=function(str){if(!apf.parseExpression.regexp.test(str)){return str;}return eval(RegExp.$1);};apf.parseExpression.regexp=/^\{([\s\S]*)\}$/;apf.formatNumber=function(j,m){var n=parseFloat(j);if(!n){return j;}var l=new String(Math.round(n*100)/100).replace(/(\.\d?\d?)$/,function(a){return a.pad(3,"0",apf.PAD_RIGHT);});if(l.indexOf(".")==-1){l+=".00";}return m+l;};apf.exec=function(str,win){if(!str){return str;}if(!win){win=self;}if(apf.isO3){eval(str,self);}else{if(apf.hasExecScript){win.execScript(str);}else{var head=win.document.getElementsByTagName("head")[0];if(head){var script=win.document.createElement("script");script.setAttribute("type","text/javascript");script.text=str;head.appendChild(script);head.removeChild(script);}else{eval(str,win);}}}return str;};apf.K=function(){};apf.isNumber=function(c){return parseFloat(c)==c;};apf.isArray=function(c){return Object.prototype.toString.call(c)==="[object Array]";};apf.isTrue=function(c){return(c===true||c==="true"||c==="on"||typeof c=="number"&&c>0||c==="1");};apf.isFalse=function(c){return(c===false||c==="false"||c==="off"||c===0||c==="0");};apf.isNot=function(c){return(!c&&typeof c!="string"&&c!==0||(typeof c=="number"&&!isFinite(c)));};apf.removePathContext=function(i,d){if(!d){return"";}if(d.indexOf(i)>-1){return d.substr(i.length);}return d;};apf.cancelBubble=function(d,i){d.cancelBubble=true;if(i.$focussable&&!i.disabled){apf.window.$focus(i);}};apf.destroyHtmlNode=function(d){if(!d){return;}if(!apf.isIE||d.ownerDocument!=document){if(d.parentNode){d.parentNode.removeChild(d);}return;}var i=document.getElementById("IELeakGarbageBin");if(!i){i=document.createElement("DIV");i.id="IELeakGarbageBin";i.style.display="none";document.body.appendChild(i);}i.appendChild(d);i.innerHTML="";};apf.getRules=function(l){var j={};for(var i=l.firstChild;i;i=i.nextSibling){if(i.nodeType!=1){continue;}else{if(!j[i[apf.TAGNAME]]){j[i[apf.TAGNAME]]=[];}j[i[apf.TAGNAME]].push(i);}}return j;};apf.getBox=function(l,m){if(!m){m=0;}if(l==null||(!parseInt(l)&&parseInt(l)!=0)){return[0,0,0,0];}var i=l.split(" ");for(var n=0;n<i.length;n++){i[n]=parseInt(i[n])||0;}switch(i.length){case 1:i[1]=i[0];i[2]=i[0];i[3]=i[0];break;case 2:i[2]=i[0];i[3]=i[1];break;case 3:i[3]=i[1];break;}return i;};apf.getNode=function(m,i){var l=0;if(m!=null){for(var n=0;n<m.childNodes.length;n++){if(m.childNodes[n].nodeType==1){if(l==i[0]){m=m.childNodes[n];if(i.length>1){i.shift();m=this.getNode(m,i);}return m;}l++;}}}return null;};apf.getFirstElement=function(c){return c.firstChild.nodeType==1?c.firstChild:c.firstChild.nextSibling;};apf.getLastElement=function(c){return c.lastChild.nodeType==1?c.lastChild:c.lastChild.previousSibling;};apf.selectTextHtml=function(l){if(!apf.hasMsRangeObject){return;}var i=document.selection.createRange();try{i.moveToElementText(l);}catch(j){}i.select();};apf.isChildOf=function(j,l,n){if(!j||!l){return false;}if(l.nodeType==2){l=l.selectSingleNode("..");}if(n&&j==l){return true;}var m=l.parentNode;while(m){if(m==j){return true;}m=m.parentNode;}return false;};apf.isOnlyChild=function(t,s){if(!t||!t.parentNode||s&&s.indexOf(t.nodeType)==-1){return false;}var o,l,i,q=t.parentNode.childNodes;for(o=0,l=q.length;o<l;o++){i=q[o];if(i.nodeType==1&&i!=t){return false;}if(i.nodeType==3&&!i.nodeValue.trim()){return false;}}return true;};apf.getChildNumber=function(n,j){var i=n.parentNode,q=0;if(!i){return 0;}for(var o=0;o<i.childNodes.length;o++){if(i.childNodes[o]==n){return q;}if(!j||n.nodeType==1&&n.tagName==i.childNodes[o].tagName){q++;}}return q;};apf.mergeXml=function(F,Q,i){if(typeof Q!="object"){Q=getElementById(Q);}if(i&&i.clearContents){var J,G,l,N=Q.selectNodes("descendant::node()[@"+apf.xmldb.xmlListenTag+"]");for(l=N.length-1;l>=0;l--){var j=N[l].getAttribute(apf.xmldb.xmlListenTag).split(";");for(G=j.length-1;G>=0;G--){J=apf.all[j[G]];if(J.dataParent&&J.dataParent.xpath){J.dataParent.parent.signalXmlUpdate[J.$uniqueId]=true;}else{if(J.$model){J.$model.$waitForXml(J);}}}}var N=Q.childNodes;for(var l=N.length-1;l>=0;l--){Q.removeChild(N[l]);}}if(i&&i.start){var M,O,N,K,l,I,E=i.marker;if(!E){}if(E.getAttribute("start")-i.start==0){E.setAttribute("start",i.start+i.length);M=parseInt(E.getAttribute("reserved"));E.setAttribute("reserved",M+i.length);O=E;}else{if(i.start+i.length==E.getAttribute("end")){E.setAttribute("end",i.start+i.length);O=E.nextSibling;M=parseInt(E.getAttribute("reserved"))+parseInt(E.getAttribute("end"))-i.length;}else{var s=E.parentNode.insertBefore(E.cloneNode(true),E);s.setAttribute("end",i.start-1);E.setAttribute("start",i.start+i.length);M=parseInt(E.getAttribute("reserved"));E.setAttribute("reserved",M+i.length);O=E;}}N=F.childNodes;if(Q.ownerDocument.importNode){K=Q.ownerDocument;for(l=0,I=N.length;l<I;l++){Q.insertBefore(K.importNode(N[l],true),O).setAttribute(apf.xmldb.xmlIdTag,i.documentId+"|"+(M+l));}}else{for(l=N.length-1;l>=0;l--){Q.insertBefore(N[0],O).setAttribute(apf.xmldb.xmlIdTag,i.documentId+"|"+(M+l));}}}else{O=i.beforeNode||apf.getNode(Q,[0]);N=F.childNodes;if(Q.ownerDocument.importNode){K=Q.ownerDocument;for(l=0,I=N.length;l<I;l++){Q.insertBefore(K.importNode(N[l],true),O);}}else{for(l=N.length-1;l>=0;l--){Q.insertBefore(N[0],O);}}}if(i&&i.copyAttributes){var P=F.attributes;for(l=0;l<P.length;l++){if(P[l].nodeName!=apf.xmldb.xmlIdTag){Q.setAttribute(P[l].nodeName,P[l].nodeValue);}}}return Q;};apf.setNodeValue=function(s,t,n,u){if(!s){return;}var q,o,w;if(u){q=u.undoObj;o=u.xpath;w=u.newNodes;q.extra.oldValue=u.forceNew?"":apf.queryValue(s,o);q.xmlNode=s;if(o){s=apf.createNodeFromXpath(s,o,w,u.forceNew);}q.extra.appliedNode=s;}if(s.nodeType==1){if(!s.firstChild){s.appendChild(s.ownerDocument.createTextNode("-"));}s.firstChild.nodeValue=apf.isNot(t)?"":t;if(n){apf.xmldb.applyChanges("synchronize",s,q);}}else{s.nodeValue=apf.isNot(t)?"":t;if(n){apf.xmldb.applyChanges("synchronize",s.parentNode||s.ownerElement||s.selectSingleNode(".."),q);}}};apf.setQueryValue=function(n,j,l){var m=apf.createNodeFromXpath(n,j);if(!m){return null;}apf.setNodeValue(m,l,true);return m;};apf.queryValue=function(i,d){if(!i){return"";}if(i.nodeType==2){return i.nodeValue;}if(d){i=i.selectSingleNode(d);if(!i){return"";}}return i.nodeType==1?(!i.firstChild?"":i.firstChild.nodeValue):i.nodeValue;};apf.queryValues=function(o,t){var s=[];if(!o){return s;}var n=o.selectNodes(t);if(!n.length){return s;}for(var q=0;q<n.length;q++){var i=n[q];if(i.nodeType==1){i=i.firstChild;}s.push(i.nodeValue||"");}return s;};apf.queryNodes=function(i,d){if(d&&(apf.hasXPathHtmlSupport&&d.selectSingleNode||!d.style)){return d.selectNodes(i);}return apf.XPath.selectNodes(i,d);};apf.queryNode=function(l,i){if(i&&(apf.hasXPathHtmlSupport&&i.selectSingleNode||!i.style)){return i.selectSingleNode(l);}var j=apf.queryNodes(l+(apf.isIE?"":"[1]"),i?i:null);return j.length>0?j[0]:null;};apf.getInheritedAttribute=function(n,o,m){var q,l;if(n.nodeValue!=1){n=n.parentNode;}while(n&&(n.nodeType!=1||!(q=o&&((l=n.getAttribute(o))||typeof l=="string")||m&&m(n)))){n=n.parentNode;}if(l==""){return"";}return !q&&o&&apf.config?apf.config[o]:q;};apf.createNodeFromXpath=function(I,E,G,D){var P,Q="",C=E.replace(/('.*?')|(".*?")|\|/g,function(a,c,d){if(c||d){return c||d;}return"-%-|-%-";}).split("-%-|-%-")[0].split("/");if(!D&&(P=I.selectSingleNode(E))){return P;}var F=C.length-1;if(D){if(C[F].trim().match(/^\@(.*)$|^text\(\)$/)){F--;}}for(var O,i=false,K=0;K<F;K++){if(!i&&I.selectSingleNode(Q+(K!=0?"/":"")+C[K])){Q+=(K!=0?"/":"")+C[K];continue;}var N=C[K].match(/(\w+)\[@([\w-]+)=(\w+)\]/);if(N){C[K]=N[1];}i=true;O=I.selectSingleNode(Q||".").appendChild(I.ownerDocument.createElement(C[K]));if(N){O.setAttribute(N[2],N[3]);Q+=(Q?"/":"")+N[0];}else{Q+=(Q?"/":"")+C[K];}if(G){G.push(O);}}if(!Q){Q=".";}var R,J=C[F],T=I.nodeType==9?I:I.ownerDocument;do{if(J.match(/^\@(.*)$/)){(R||I.selectSingleNode(Q)).setAttributeNode(R=I.ownerDocument.createAttribute(RegExp.$1));}else{if(J.trim()=="text()"){R=(R||I.selectSingleNode(Q)).appendChild(I.ownerDocument.createTextNode(""));}else{var M=J.match(/(\w+)\[@([\w-]+)=(\w+)\]/);if(M){J=M[1];}R=(R||I.selectSingleNode(Q)).appendChild(T.createElement(J));if(M){R.setAttribute(M[2],M[3]);}if(G){G.push(R);}}}Q+=(Q?"/":"")+C[F];}while((J=C[++F]));return R;};apf.convertMethods={json:function(c){return JSON.stringify(apf.xml2json(c));},cgivars:function(j,F){if(!F){F="";}var G=[],E,C=j.childNodes,z={};for(var w=0;w<C.length;w++){if(C[w].nodeType!=1){continue;}var D=C[w].tagName;if(z[D]){continue;}var B=j.selectNodes(D);if(B.length>1){z[D]=true;for(var A=0;A<B.length;A++){E=this.cgivars(B[A],F+D+"["+A+"]");if(E){G.push(E);}}}else{E=this.cgivars(C[w],F+D);if(E){G.push(E);}}}var i=j.attributes;for(w=0;w<i.length;w++){if(i[w].nodeValue){if(F){G.push(F+"["+i[w].nodeName+"]="+escape(i[w].nodeValue));}else{G.push(i[w].nodeName+"="+escape(i[w].nodeValue));}}}if(G.length){return G.join("&");}E=apf.queryValue(j,"text()");if(F&&E){return F+"="+escape(E);}},cgiobjects:function(W,Z,T){if(!Z){Z="";}var a=[],j,N=W.childNodes,O={};for(var M=0;M<N.length;M++){var U=N[M];if(U.nodeType!=1){continue;}var i=U.tagName;if(i=="revision"){continue;}var X=apf.isOnlyChild(U.firstChild,[3,4]);var V=0;if(!U.attributes.length&&!X){var K=U.childNodes;for(var Y,P=0,R=K.length;P<R;P++){if(K[P].nodeType!=1){continue;}Y=Z+(T?"[":"")+i+(T?"]":"")+"["+M+"]";j=this.cgiobjects(K[P],Y,true);if(j){a.push(j);}if(apf.isOnlyChild(K[P].firstChild,[3,4])){a.push(Y+"["+K[P].tagName+"]="+escape(K[P].firstChild.nodeValue));}var Q,l,J=K[P].attributes;for(Q=0;Q<J.length;Q++){if(!(l=J[Q]).nodeValue){continue;}a.push(Y+"["+l.nodeName+"]="+escape(l.nodeValue));}}}else{if(X){a.push(Z+(T?"[":"")+i+(T?"]":"")+"="+escape(U.firstChild.nodeValue));}var l,J=U.attributes;for(P=0;P<J.length;P++){if(!(l=J[P]).nodeValue){continue;}a.push(Z+(T?"[":"")+i+"_"+l.nodeName+(T?"]":"")+"="+escape(l.nodeValue));}}}if(!T&&W.getAttribute("id")){a.push("id="+escape(W.getAttribute("id")));}if(a.length){return a.join("&");}}};apf.convertXml=function(d,i){return apf.convertMethods[i](d);};apf.getTextNode=function(d){for(var i=0;i<d.childNodes.length;i++){if(d.childNodes[i].nodeType==3||d.childNodes[i].nodeType==4){return d.childNodes[i];}}return false;};apf.getBoundValue=function(n,l,m){if(!l&&!n.xmlRoot){return"";}var j=n.$getDataNode("value",n.xmlRoot);return j?apf.queryValue(j):"";};apf.getArrayFromNodelist=function(j){for(var i=[],l=0;l<j.length;l++){i.push(j[l]);}return i;};apf.serializeChildren=function(o){var i=[],t=o.childNodes;for(var s,q=0,l=t.length;q<l;q++){i[q]=(s=t[q]).nodeType==1?s.xml||s.serialize():(s.nodeType==8?"":s.nodeValue);}return i.join("");};apf.getXmlString=function(i){var d=apf.xmldb.cleanNode(i.cloneNode(true));return d.xml||d.serialize();};apf.getXml=function(j,i,l){return apf.getXmlDom(j,i,l).documentElement;};apf.formatXml=function(l){l=l.trim();var i=l.split("\n");for(var n=0;n<i.length;n++){i[n]=i[n].trim();}i=i.join("\n").replace(/\>\n/g,">").replace(/\>/g,">\n").replace(/\n\</g,"<").replace(/\</g,"\n<").split("\n");i.removeIndex(0);i.removeIndex(i.length);for(var m=0,n=0;n<i.length;n++){i[n]="    ".repeat((i[n].match(/^\s*\<\//)?(m==0)?0:--m:(i[n].match(/^\s*\<[^\?][^>]+[^\/]\>/)?m++:m)))+i[n];}if(!l){return"";}return i.join("\n");};apf.xmlToXpath=function(s,i,t){if(!s){return"";}if(t===true&&s.nodeType==1&&s.getAttribute(apf.xmldb.xmlIdTag)){return"//node()[@"+apf.xmldb.xmlIdTag+"='"+s.getAttribute(apf.xmldb.xmlIdTag)+"']";}if(apf!=this&&this.lookup&&this.select){var B=this.lookup[s.tagName];if(B){var z=s.selectSingleNode(B).nodeValue;return"//"+s.tagName+"["+B+"='"+z+"']";}for(var w=0;w<this.select.length;w++){if(s.selectSingleNode(this.select[w][0])){var z=s.selectSingleNode(this.select[w][1]).nodeValue;return"//"+this.select[w][0]+"["+this.select[w][1]+"='"+z+"']";}}}if(s==i){return".";}if(!s.parentNode){return false;}var u=[],A=s;if(A.nodeType==2){u.push("@"+A.nodeName);A=A.ownerElement||s.selectSingleNode("..");}var C;do{u.unshift((A.nodeType==1?A.tagName:"text()")+"["+(t&&(C=A.nodeType==1&&A.getAttribute(apf.xmldb.xmlIdTag))?"@"+apf.xmldb.xmlIdTag+"='"+C+"'":(apf.getChildNumber(A,true)+1))+"]");A=A.parentNode;}while(A&&A.nodeType==1&&A!=i);return u.join("/");};apf.xpathToXml=function(d,i){if(!i){return false;}return i.selectSingleNode(d);};apf.diff_match_patch=new (function(){this.diffTimeout=1;this.diffEditCost=4;this.diffDualThreshold=32;this.matchThreshold=0.5;this.matchDistance=1000;this.patchDeleteThreshold=0.5;this.patchMargin=4;var s=-1,w=1,A=0,t=function(){var a=0,d=1,c=2;while(d!=c){a++;d=c;c=c<<1;}return a;},u=function(){this.diffs=[];this.start1=null;this.start2=null;this.length1=0;this.length2=0;},o=[];o[w]="+";o[s]="-";o[A]=" ";u.prototype.toString=function(){var i=(this.length1===0)?this.start1+",0":(this.length1==1)?this.start1+1:(this.start1+1)+","+this.length1,a=(this.length2===0)?this.start2+",0":(this.length2==1)?this.start2+1:(this.start2+1)+","+this.length2,c=["@@ -"+i+" +"+a+" @@\n"],j=0,d=this.diffs.length;for(;j<d;j++){c[j+1]=o[this.diffs[j][0]]+encodeURI(this.diffs[j][1])+"\n";}return c.join("").replace(/\x00/g,"%00").replace(/%20/g," ");};this.matchMaxBits=t();this.diff_main=function(n,c,i){if(n==c){return[[A,n]];}if(typeof i=="undefined"){i=true;}var d=i,m=this.diff_commonPrefix(n,c),l=n.substring(0,m);n=n.substring(m);c=c.substring(m);m=this.diff_commonSuffix(n,c);var j=n.substring(n.length-m);n=n.substring(0,n.length-m);c=c.substring(0,c.length-m);var a=z.call(this,n,c,d);if(l){a.unshift([A,l]);}if(j){a.push([A,j]);}this.diff_cleanupMerge(a);return a;};var z=function(Q,T,n){var i;if(!Q){return[[w,T]];}if(!T){return[[s,Q]];}var a=Q.length>T.length?Q:T,M=Q.length>T.length?T:Q,l=a.indexOf(M);if(l!=-1){i=[[w,a.substring(0,l)],[A,M],[w,a.substring(l+M.length)]];if(Q.length>T.length){i[0][0]=i[2][0]=s;}return i;}a=M=null;var P,O,d=this.diff_halfMatch(Q,T);if(d){return this.diff_main(d[0],d[2],n).concat([[A,d[4]]],this.diff_main(d[1],d[3],n));}if(n&&(Q.length<100||T.length<100)){n=false;}if(n){P=this.diff_linesToChars(Q,T);Q=P[0];T=P[1];O=P[2];}i=this.diff_map(Q,T);if(!i){i=[[s,Q],[w,T]];}if(n){this.diff_charsToLines(i,O);this.diff_cleanupSemantic(i);i.push([A,""]);var j=0,K=0,N=0,R="",c="";while(j<i.length){switch(i[j][0]){case w:N++;c+=i[j][1];break;case s:K++;R+=i[j][1];break;case A:if(K>=1&&N>=1){P=this.diff_main(R,c,false);i.splice(j-K-N,K+N);j=j-K-N;for(var m=P.length-1;m>=0;m--){i.splice(j,0,P[m]);}j=j+P.length;}N=0;K=0;R="";c="";break;}j++;}i.pop();}return i;};this.diff_linesToChars=function(a,c){var d=[""],j={};function i(n){var G="",F=0,E=-1,l=d.length;while(E<n.length-1){E=n.indexOf("\n",F);if(E==-1){E=n.length-1;}var m=n.substring(F,E+1);F=E+1;if(j.hasOwnProperty?j.hasOwnProperty(m):(j[m]!==undefined)){G+=String.fromCharCode(j[m]);}else{G+=String.fromCharCode(l);j[m]=l;d[l++]=m;}}return G;}return[i(a),i(c),d];};this.diff_charsToLines=function(c,j){var l=0,i,d,a;for(;l<c.length;l++){i=c[l][1];d=[];for(a=0;a<i.length;a++){d[a]=j[i.charCodeAt(a)];}c[l][1]=d.join("");}};this.diff_map=function(Y,aa){var n=(new Date()).getTime()+this.diffTimeout*1000,i=Y.length,U=aa.length,c=0,Q=i+U-1,R=this.diffDualThreshold*2<Q,X=[],ad=[],W={},ab={},d={},T=false,V=!!(d.hasOwnProperty),l=(i+U)%2,Z,ac,m,a,j;W[1]=0;ab[1]=0;for(;c<Q;c++){if(this.diffTimeout>0&&(new Date()).getTime()>n){return null;}X[c]={};for(m=-c;m<=c;m+=2){if(m==-c||m!=c&&W[m-1]<W[m+1]){Z=W[m+1];}else{Z=W[m-1]+1;}ac=Z-m;if(R){j=Z+","+ac;if(l&&(V?d.hasOwnProperty(j):(d[j]!==undefined))){T=true;}if(!l){d[j]=c;}}while(!T&&Z<i&&ac<U&&Y.charAt(Z)==aa.charAt(ac)){Z++;ac++;if(R){j=Z+","+ac;if(l&&(V?d.hasOwnProperty(j):(d[j]!==undefined))){T=true;}if(!l){d[j]=c;}}}W[m]=Z;X[c][Z+","+ac]=true;if(Z==i&&ac==U){return this.diff_path1(X,Y,aa);}else{if(T){ad=ad.slice(0,d[j]+1);a=this.diff_path1(X,Y.substring(0,Z),aa.substring(0,ac));return a.concat(this.diff_path2(ad,Y.substring(Z),aa.substring(ac)));}}}if(R){ad[c]={};for(m=-c;m<=c;m+=2){Z=(m==-c||m!=c&&ab[m-1]<ab[m+1])?ab[m+1]:ab[m-1]+1;ac=Z-m;j=(i-Z)+","+(U-ac);if(!l&&(V?d.hasOwnProperty(j):(d[j]!==undefined))){T=true;}if(l){d[j]=c;}while(!T&&Z<i&&ac<U&&Y.charAt(i-Z-1)==aa.charAt(U-ac-1)){Z++;ac++;j=(i-Z)+","+(U-ac);if(!l&&(V?d.hasOwnProperty(j):(d[j]!==undefined))){T=true;}if(l){d[j]=c;}}ab[m]=Z;ad[c][Z+","+ac]=true;if(T){X=X.slice(0,d[j]+1);a=this.diff_path1(X,Y.substring(0,i-Z),aa.substring(0,U-ac));return a.concat(this.diff_path2(ad,Y.substring(i-Z),aa.substring(U-ac)));}}}}return null;};this.diff_path1=function(l,d,i){var c=[],n=d.length,a=i.length,j=null,m=l.length-2;for(;m>=0;m--){while(1){if(l[m].hasOwnProperty?l[m].hasOwnProperty((n-1)+","+a):(l[m][(n-1)+","+a]!==undefined)){n--;if(j===s){c[0][1]=d.charAt(n)+c[0][1];}else{c.unshift([s,d.charAt(n)]);}j=s;break;}else{if(l[m].hasOwnProperty?l[m].hasOwnProperty(n+","+(a-1)):(l[m][n+","+(a-1)]!==undefined)){a--;if(j===w){c[0][1]=i.charAt(a)+c[0][1];}else{c.unshift([w,i.charAt(a)]);}j=w;break;}else{n--;a--;if(j===A){c[0][1]=d.charAt(n)+c[0][1];}else{c.unshift([A,d.charAt(n)]);}j=A;}}}}return c;};this.diff_path2=function(d,n,a){var c=[],i=0,j=n.length,l=a.length,C=null,m=d.length-2;for(;m>=0;m--){while(1){if(d[m].hasOwnProperty?d[m].hasOwnProperty((j-1)+","+l):(d[m][(j-1)+","+l]!==undefined)){j--;if(C===s){c[i-1][1]+=n.charAt(n.length-j-1);}else{c[i++]=[s,n.charAt(n.length-j-1)];}C=s;break;}else{if(d[m].hasOwnProperty?d[m].hasOwnProperty(j+","+(l-1)):(d[m][j+","+(l-1)]!==undefined)){l--;if(C===w){c[i-1][1]+=a.charAt(a.length-l-1);}else{c[i++]=[w,a.charAt(a.length-l-1)];}C=w;break;}else{j--;l--;if(C===A){c[i-1][1]+=n.charAt(n.length-j-1);}else{c[i++]=[A,n.charAt(n.length-j-1)];}C=A;}}}}return c;};this.diff_commonPrefix=function(c,d){if(!c||!d||c.charCodeAt(0)!==d.charCodeAt(0)){return 0;}var j=0,a=Math.min(c.length,d.length),l=a,i=0;while(j<l){if(c.substring(i,l)==d.substring(i,l)){j=l;i=j;}else{a=l;}l=Math.floor((a-j)/2+j);}return l;};this.diff_commonSuffix=function(d,i){if(!d||!i||d.charCodeAt(d.length-1)!==i.charCodeAt(i.length-1)){return 0;}var j=0,c=Math.min(d.length,i.length),l=c,a=0;while(j<l){if(d.substring(d.length-l,d.length-a)==i.substring(i.length-l,i.length-a)){j=l;a=j;}else{c=l;}l=Math.floor((c-j)/2+j);}return l;};this.diff_halfMatch=function(M,d){var c=M.length>d.length?M:d,J=M.length>d.length?d:M,a=this;if(c.length<10||J.length<1){return null;}function l(F,ab,Y){var W=F.substring(Y,Y+Math.floor(F.length/4)),aa=-1,B="",X,Z,C,D,V,E;while((aa=ab.indexOf(W,aa+1))!=-1){V=a.diff_commonPrefix(F.substring(Y),ab.substring(aa));E=a.diff_commonSuffix(F.substring(0,Y),ab.substring(0,aa));if(B.length<E+V){B=ab.substring(aa-E,aa)+ab.substring(aa,aa+V);X=F.substring(0,Y-E);Z=F.substring(Y+V);C=ab.substring(0,aa-E);D=ab.substring(aa+V);}}if(B.length>=F.length/2){return[X,Z,C,D,B];}else{return null;}}var n=l(c,J,Math.ceil(c.length/4)),G=l(c,J,Math.ceil(c.length/2)),j;if(!n&&!G){return null;}else{if(!G){j=n;}else{if(!n){j=G;}else{j=n[4].length>G[4].length?n:G;}}}var i,m,I,K;if(M.length>d.length){i=j[0];m=j[1];I=j[2];K=j[3];}else{I=j[0];K=j[1];i=j[2];m=j[3];}return[i,m,I,K,j[4]];};this.diff_cleanupSemantic=function(a){var i=false,n=[],c=0,d=null,m=0,j=0,l=0;while(m<a.length){if(a[m][0]==A){n[c++]=m;j=l;l=0;d=a[m][1];}else{l+=a[m][1].length;if(d!==null&&(d.length<=j)&&(d.length<=l)){a.splice(n[c-1],0,[s,d]);a[n[c-1]+1][0]=w;c--;c--;m=c>0?n[c-1]:-1;j=0;l=0;d=null;i=true;}}m++;}if(i){this.diff_cleanupMerge(a);}this.diff_cleanupSemanticLossless(a);};this.diff_cleanupSemanticLossless=function(V){var N=/[^a-zA-Z0-9]/,c=/\s/,P=/[\r\n]/,T=/\n\r?\n$/,X=/^\r?\n\r?\n/;function l(C,D){if(!C||!D){return 5;}var B=0;if(C.charAt(C.length-1).match(N)||D.charAt(0).match(N)){B++;if(C.charAt(C.length-1).match(c)||D.charAt(0).match(c)){B++;if(C.charAt(C.length-1).match(P)||D.charAt(0).match(P)){B++;if(C.match(T)||D.match(X)){B++;}}}}return B;}var m=1,W,O,d,a,Q,j,R,n,U,i;while(m<V.length-1){if(V[m-1][0]==A&&V[m+1][0]==A){W=V[m-1][1];O=V[m][1];d=V[m+1][1];a=this.diff_commonSuffix(W,O);if(a){Q=O.substring(O.length-a);W=W.substring(0,W.length-a);O=Q+O.substring(0,O.length-a);d=Q+d;}j=W;R=O;n=d;U=l(W,O)+l(O,d);while(O.charAt(0)===d.charAt(0)){W+=O.charAt(0);O=O.substring(1)+d.charAt(0);d=d.substring(1);i=l(W,O)+l(O,d);if(i>=U){U=i;j=W;R=O;n=d;}}if(V[m-1][1]!=j){if(j){V[m-1][1]=j;}else{V.splice(m-1,1);m--;}V[m][1]=R;if(n){V[m+1][1]=n;}else{V.splice(m+1,1);m--;}}}m++;}};this.diff_cleanupEfficiency=function(l){var d=false,m=[],E=0,D="",i=0,j=false,c=false,a=false,n=false;while(i<l.length){if(l[i][0]==A){if(l[i][1].length<this.diffEditCost&&(a||n)){m[E++]=i;j=a;c=n;D=l[i][1];}else{E=0;D="";}a=n=false;}else{if(l[i][0]==s){n=true;}else{a=true;}if(D&&((j&&c&&a&&n)||((D.length<this.diffEditCost/2)&&(j+c+a+n)==3))){l.splice(m[E-1],0,[s,D]);l[m[E-1]+1][0]=w;E--;D="";if(j&&c){a=n=true;E=0;}else{E--;i=E>0?m[E-1]:-1;a=n=false;}d=true;}}i++;}if(d){this.diff_cleanupMerge(l);}};this.diff_cleanupMerge=function(a){a.push([A,""]);var n=0,c=0,d=0,j="",l="",m;while(n<a.length){switch(a[n][0]){case w:d++;l+=a[n][1];n++;break;case s:c++;j+=a[n][1];n++;break;case A:if(c!==0||d!==0){if(c!==0&&d!==0){m=this.diff_commonPrefix(l,j);if(m!==0){if((n-c-d)>0&&a[n-c-d-1][0]==A){a[n-c-d-1][1]+=l.substring(0,m);}else{a.splice(0,0,[A,l.substring(0,m)]);n++;}l=l.substring(m);j=j.substring(m);}m=this.diff_commonSuffix(l,j);if(m!==0){a[n][1]=l.substring(l.length-m)+a[n][1];l=l.substring(0,l.length-m);j=j.substring(0,j.length-m);}}if(c===0){a.splice(n-c-d,c+d,[w,l]);}else{if(d===0){a.splice(n-c-d,c+d,[s,j]);}else{a.splice(n-c-d,c+d,[s,j],[w,l]);}}n=n-c-d+(c?1:0)+(d?1:0)+1;}else{if(n!==0&&a[n-1][0]==A){a[n-1][1]+=a[n][1];a.splice(n,1);}else{n++;}}d=0;c=0;j="";l="";break;}}if(a[a.length-1][1]===""){a.pop();}var i=false;n=1;while(n<a.length-1){if(a[n-1][0]==A&&a[n+1][0]==A){if(a[n][1].substring(a[n][1].length-a[n-1][1].length)==a[n-1][1]){a[n][1]=a[n-1][1]+a[n][1].substring(0,a[n][1].length-a[n-1][1].length);a[n+1][1]=a[n-1][1]+a[n+1][1];a.splice(n-1,1);i=true;}else{if(a[n][1].substring(0,a[n+1][1].length)==a[n+1][1]){a[n-1][1]+=a[n+1][1];a[n][1]=a[n][1].substring(a[n+1][1].length)+a[n+1][1];a.splice(n+1,1);i=true;}}}n++;}if(i){this.diff_cleanupMerge(a);}};this.diff_xIndex=function(a,n){var d=0,j=0,c=0,i=0,m=0,l=a.length;for(;m<l;m++){if(a[m][0]!==w){d+=a[m][1].length;}if(a[m][0]!==s){j+=a[m][1].length;}if(d>n){break;}c=d;i=j;}if(a.length!=m&&a[m][0]===s){return i;}return i+(n-c);};this.diff_prettyHtml=function(n){var i=[],j=0,m=0,l=n.length,a,d,c;for(;m<l;m++){a=n[m][0];d=n[m][1];c=d.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"&para;<BR>");switch(a){case w:i[m]='<INS STYLE="background:#E6FFE6;" TITLE="i='+j+'">'+c+"</INS>";break;case s:i[m]='<DEL STYLE="background:#FFE6E6;" TITLE="i='+j+'">'+c+"</DEL>";break;case A:i[m]='<SPAN TITLE="i='+j+'">'+c+"</SPAN>";break;}if(a!==s){j+=d.length;}}return i.join("");};this.diff_text1=function(a){var c=[],i=0,d=a.length;for(;i<d;i++){if(a[i][0]!==w){c[i]=a[i][1];}}return c.join("");};this.diff_text2=function(a){var c=[],i=0,d=a.length;for(;i<d;i++){if(a[i][0]!==s){c[i]=a[i][1];}}return c.join("");};this.diff_levenshtein=function(n){var c=0,j=0,d=0,m=0,l=n.length,a,i;for(;m<l;m++){a=n[m][0];i=n[m][1];switch(a){case w:j+=i.length;break;case s:d+=i.length;break;case A:c+=Math.max(j,d);j=0;d=0;break;}}return c+Math.max(j,d);};this.diff_toDelta=function(a){var c=[],i=0,d=a.length;for(;i<d;i++){switch(a[i][0]){case w:c[i]="+"+encodeURI(a[i][1]);break;case s:c[i]="-"+a[i][1].length;break;case A:c[i]="="+a[i][1].length;break;}}return c.join("\t").replace(/\x00/g,"%00").replace(/%20/g," ");};this.diff_fromDelta=function(d,a){var m=[],n=0,l=0;a=a.replace(/%00/g,"\0");var i=a.split(/\t/g),c=0,F=i.length,G,J,I;for(;c<F;c++){G=i[c].substring(1);switch(i[c].charAt(0)){case"+":try{m[n++]=[w,decodeURI(G)];}catch(j){throw new Error("Illegal escape in diff_fromDelta: "+G);}break;case"-":case"=":J=parseInt(G,10);if(isNaN(J)||J<0){throw new Error("Invalid number in diff_fromDelta: "+G);}I=d.substring(l,l+=J);if(i[c].charAt(0)=="="){m[n++]=[A,I];}else{m[n++]=[s,I];}break;default:if(i[c]){throw new Error("Invalid diff operation in diff_fromDelta: "+i[c]);}}}if(l!=d.length){throw new Error("Delta length ("+l+") does not equal source text length ("+d.length+").");}return m;};this.match_main=function(a,d,c){c=Math.max(0,Math.min(c,a.length));if(a==d){return 0;}else{if(!a.length){return -1;}else{if(a.substring(c,c+d.length)==d){return c;}else{return this.match_bitap(a,d,c);}}}};this.match_bitap=function(Z,i,ab){if(i.length>this.matchMaxBits){throw new Error("Pattern too long for this browser.");}var X=this.match_alphabet(i),ac=this;function ae(B,E){var C=B/i.length,D=Math.abs(ab-E);if(!ac.matchDistance){return D?1:C;}return C+(D/ac.matchDistance);}var U=this.matchThreshold,Y=Z.indexOf(i,ab);if(Y!=-1){U=Math.min(ae(0,Y),U);}Y=Z.lastIndexOf(i,ab+i.length);if(Y!=-1){U=Math.min(ae(0,Y),U);}Y=-1;var c=1<<(i.length-1),m=i.length+Z.length,d=0,n=i.length,T,aa,ad,W,V,R,l,a,j;for(;d<n;d++){T=0;aa=m;while(T<aa){if(ae(d,ab+aa)<=U){T=aa;}else{m=aa;}aa=Math.floor((m-T)/2+T);}m=aa;W=Math.max(1,ab-aa+1);V=Math.min(ab+aa,Z.length)+i.length;R=Array(V+2);R[V+1]=(1<<d)-1;for(l=V;l>=W;l--){a=X[Z.charAt(l-1)];if(d===0){R[l]=((R[l+1]<<1)|1)&a;}else{R[l]=((R[l+1]<<1)|1)&a|(((ad[l+1]|ad[l])<<1)|1)|ad[l+1];}if(R[l]&c){j=ae(d,l-1);if(j<=U){U=j;Y=l-1;if(Y>ab){W=Math.max(1,2*ab-Y);}else{break;}}}}if(ae(d+1,ab)>U){break;}ad=R;}return Y;};this.match_alphabet=function(a){var c={},d=0,i=a.length;for(;d<i;d++){c[a.charAt(d)]=0;}for(d=0;d<a.length;d++){c[a.charAt(d)]|=1<<(a.length-d-1);}return c;};this.patch_addContext=function(a,c){var j=c.substring(a.start2,a.start2+a.length1),d=0;while(c.indexOf(j)!=c.lastIndexOf(j)&&j.length<this.matchMaxBits-this.patchMargin-this.patchMargin){d+=this.patchMargin;j=c.substring(a.start2-d,a.start2+a.length1+d);}d+=this.patchMargin;var l=c.substring(a.start2-d,a.start2);if(l){a.diffs.unshift([A,l]);}var i=c.substring(a.start2+a.length1,a.start2+a.length1+d);if(i){a.diffs.push([A,i]);}a.start1-=l.length;a.start2-=l.length;a.length1+=l.length+i.length;a.length2+=l.length+i.length;};this.patch_make=function(M,d,n){var T,a;if(typeof M=="string"&&typeof d=="string"&&typeof n=="undefined"){T=M;a=this.diff_main(T,d,true);if(a.length>2){this.diff_cleanupSemantic(a);this.diff_cleanupEfficiency(a);}}else{if(typeof M=="object"&&typeof d=="undefined"&&typeof n=="undefined"){a=M;T=this.diff_text1(a);}else{if(typeof M=="string"&&typeof d=="object"&&typeof n=="undefined"){T=M;a=d;}else{if(typeof M=="string"&&typeof d=="string"&&typeof n=="object"){T=M;a=n;}else{throw new Error("Unknown call format to patch_make.");}}}}if(a.length===0){return[];}var j=[],Q=new u(),l=0,c=0,i=0,m=T,P=T,O=0,N=a.length,K,R;for(;O<N;O++){K=a[O][0];R=a[O][1];if(!l&&K!==A){Q.start1=c;Q.start2=i;}switch(K){case w:Q.diffs[l++]=a[O];Q.length2+=R.length;P=P.substring(0,i)+R+P.substring(i);break;case s:Q.length1+=R.length;Q.diffs[l++]=a[O];P=P.substring(0,i)+P.substring(i+R.length);break;case A:if(R.length<=2*this.patchMargin&&l&&N!=O+1){Q.diffs[l++]=a[O];Q.length1+=R.length;Q.length2+=R.length;}else{if(R.length>=2*this.patchMargin){if(l){this.patch_addContext(Q,m);j.push(Q);Q=new u();l=0;m=P;c=i;}}}break;}if(K!==w){c+=R.length;}if(K!==s){i+=R.length;}}if(l){this.patch_addContext(Q,m);j.push(Q);}return j;};var q=function(d){var c=[],j=0,i=d.length,m,l,a;for(;j<i;j++){m=d[j];l=new u();l.diffs=[];for(a=0;a<m.diffs.length;a++){l.diffs[a]=m.diffs[a].slice();}l.start1=m.start1;l.start2=m.start2;l.length1=m.length1;l.length2=m.length2;c[j]=l;}return c;};this.patch_apply=function(i,Q){if(i.length==0){return[Q,[]];}i=q(i);var a=this.patch_addPadding(i);Q=a+Q+a;this.patch_splitMax(i);var d=0,n=[],V=0,j=i.length,X,R,U,O,T,W,Z,m,P,Y,c,l;for(;V<j;V++){X=i[V];R=X.start2+d;U=this.diff_text1(X.diffs);T=-1;if(U.length>this.matchMaxBits){O=this.match_main(Q,U.substring(0,this.matchMaxBits),R);if(O!=-1){T=this.match_main(Q,U.substring(U.length-this.matchMaxBits),R+U.length-this.matchMaxBits);if(T==-1||O>=T){O=-1;}}}else{O=this.match_main(Q,U,R);}if(O==-1){n[V]=false;d-=X.length2-X.length1;}else{n[V]=true;d=O-R;if(T==-1){W=Q.substring(O,O+U.length);}else{W=Q.substring(O,T+this.matchMaxBits);}if(U==W){Q=Q.substring(0,O)+this.diff_text2(X.diffs)+Q.substring(O+U.length);}else{Z=this.diff_main(U,W,false);if(U.length>this.matchMaxBits&&this.diff_levenshtein(Z)/U.length>this.patchDeleteThreshold){n[V]=false;}else{this.diff_cleanupSemanticLossless(Z);m=0;for(Y=0,l=X.diffs.length;Y<l;Y++){c=X.diffs[Y];if(c[0]!==A){P=this.diff_xIndex(Z,m);}if(c[0]===w){Q=Q.substring(0,O+P)+c[1]+Q.substring(O+P);}else{if(c[0]===s){Q=Q.substring(0,O+P)+Q.substring(O+this.diff_xIndex(Z,m+c[1].length));}}if(c[0]!==s){m+=c[1].length;}}}}}}Q=Q.substring(a.length,Q.length-a.length);return[Q,n];};this.patch_addPadding=function(d){var i=this.patchMargin,j="",n=1,l=d.length;for(;n<=i;n++){j+=String.fromCharCode(n);}for(n=0;n<l;n++){d[n].start1+=i;d[n].start2+=i;}var a=d[0],m=a.diffs,c;if(m.length==0||m[0][0]!=A){m.unshift([A,j]);a.start1-=i;a.start2-=i;a.length1+=i;a.length2+=i;}else{if(i>m[0][1].length){c=i-m[0][1].length;m[0][1]=j.substring(m[0][1].length)+m[0][1];a.start1-=c;a.start2-=c;a.length1+=c;a.length2+=c;}}a=d[d.length-1];m=a.diffs;if(m.length==0||m[m.length-1][0]!=A){m.push([A,j]);a.length1+=i;a.length2+=i;}else{if(i>m[m.length-1][1].length){c=i-m[m.length-1][1].length;m[m.length-1][1]+=j.substring(0,c);a.length1+=c;a.length2+=c;}}return j;};this.patch_splitMax=function(l){var I=0,n,i,J,d,m,F,c,j,a,G;for(;I<l.length;I++){if(l[I].length1<=this.matchMaxBits){continue;}n=l[I];l.splice(I--,1);i=this.matchMaxBits;J=n.start1;d=n.start2;m="";while(n.diffs.length!==0){F=new u();c=true;F.start1=J-m.length;F.start2=d-m.length;if(m!==""){F.length1=F.length2=m.length;F.diffs.push([A,m]);}while(n.diffs.length!==0&&F.length1<i-this.patchMargin){j=n.diffs[0][0];a=n.diffs[0][1];if(j===w){F.length2+=a.length;d+=a.length;F.diffs.push(n.diffs.shift());c=false;}else{if(j===s&&F.diffs.length==1&&F.diffs[0][0]==A&&a.length>2*i){F.length1+=a.length;J+=a.length;c=false;F.diffs.push([j,a]);n.diffs.shift();}else{a=a.substring(0,i-F.length1-this.patchMargin);F.length1+=a.length;J+=a.length;if(j===A){F.length2+=a.length;d+=a.length;}else{c=false;}F.diffs.push([j,a]);if(a==n.diffs[0][1]){n.diffs.shift();}else{n.diffs[0][1]=n.diffs[0][1].substring(a.length);}}}}m=this.diff_text2(F.diffs).substring(m.length-this.patchMargin);G=this.diff_text1(n.diffs).substring(0,this.patchMargin);if(G!==""){F.length1+=G.length;F.length2+=G.length;if(F.diffs.length!==0&&F.diffs[F.diffs.length-1][0]===A){F.diffs[F.diffs.length-1][1]+=G;}else{F.diffs.push([A,G]);}}if(!c){l.splice(++I,0,F);}}}};this.patch_toText=function(c){var a=[],i=0,d=c.length;for(;i<d;i++){a[i]=c[i];}return a.join("");};this.patch_fromText=function(m){var j=[];if(!m){return j;}m=m.replace(/%00/g,"\0");var l=m.split("\n"),a=0,E=l.length,i=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/,F,G,d,c;while(a<E){F=l[a].match(i);if(!F){throw new Error("Invalid patch string: "+l[a]);}G=new u();j.push(G);G.start1=parseInt(F[1],10);if(F[2]===""){G.start1--;G.length1=1;}else{if(F[2]=="0"){G.length1=0;}else{G.start1--;G.length1=parseInt(F[2],10);}}G.start2=parseInt(F[3],10);if(F[4]===""){G.start2--;G.length2=1;}else{if(F[4]=="0"){G.length2=0;}else{G.start2--;G.length2=parseInt(F[4],10);}}a++;while(a<E){d=l[a].charAt(0);try{c=decodeURI(l[a].substring(1));}catch(n){throw new Error("Illegal escape in patch_fromText: "+c);}if(d=="-"){G.diffs.push([s,c]);}else{if(d=="+"){G.diffs.push([w,c]);}else{if(d==" "){G.diffs.push([A,c]);}else{if(d=="@"){break;}else{if(d===""){}else{throw new Error("Invalid patch mode '"+d+"' in: "+c);}}}}}a++;}}return j;};})();apf.popup={cache:{},focusFix:{INPUT:1,TEXTAREA:1,SELECT:1},setContent:function(m,n,o,q,l){if(!this.popup){this.init();}this.cache[m]={content:n,style:o,width:q,height:l};n.style.position="absolute";n.onmousedown=function(a){if(!a){a=event;}if(apf.hasFocusBug&&!apf.popup.focusFix[(a.srcElement||a.target).tagName]){apf.window.$focusfix();}(a||event).cancelBubble=true;};return n.ownerDocument;},removeContent:function(c){this.cache[c]=null;delete this.cache[c];},init:function(){this.popup={};apf.addEventListener("hotkey",function(c){if(c.keyCode=="27"||c.altKey){apf.popup.forceHide();}});},show:function(F,E){E=apf.extend({x:0,y:0,animate:false,ref:null,width:null,height:null,callback:null,draggable:false,resizable:false,allowTogether:false,autoCorrect:true},E);if(!this.popup){this.init();}if((!E.allowTogether||E.allowTogether!=this.last)&&this.last!=F){this.hide();}var B=this.cache[F];B.options=E;var D=B.content,z=false;if(!B.content.style.zIndex){B.content.style.zIndex=10000000;}if(B.content.style.display&&B.content.style.display.indexOf("none")>-1){B.content.style.display="";}if(E.ref){var o=apf.getAbsolutePosition(E.ref,B.content.offsetParent||B.content.parentNode),i=(E.y||0)+o[1],C=apf.getOverflowParent(B.content);if(E.width||B.width){D.style.width=((E.width||B.width)-3)+"px";}z=E.autoCorrect&&(i+(E.height||B.height||B.content.offsetHeight))>(C==document.documentElement?(apf.isIE?C.offsetHeight:(window.innerHeight+window.pageYOffset))+C.scrollTop:C.offsetHeight+C.scrollTop);D.style.top=(z?(i-(E.height||B.height||B.content.offsetHeight)):i)+"px";D.style.left=((E.x||0)+o[0])+"px";}apf.setStyleClass(D,z?"upward":"downward",[z?"downward":"upward"]);if(E.animate){if(E.animate=="fade"){apf.tween.single(D,{type:"fade",from:0,to:1,anim:apf.tween.NORMAL,steps:apf.isIE?5:10});}else{var G,w=apf.isIE8?5:7,A=0;G=setInterval(function(){var a=++A*((E.height||B.height)/w);D.style.height=a+"px";if(z){D.style.top=(i-a-E.y)+"px";}else{D.scrollTop=-1*(A-w)*((E.height||B.height)/w);}D.style.display="block";if(A>=w){clearInterval(G);if(E.callback){E.callback(D);}}},10);}}else{if(E.height||B.height){D.style.height=(E.height||B.height)+"px";}D.style.top=(i)+"px";D.style.display="block";if(E.callback){E.callback(D);}}$setTimeout(function(){apf.popup.last=F;});if(E.draggable){E.id=F;this.makeDraggable(E);}},hide:function(){if(this.isDragging){return;}var c=this.cache[this.last];if(c){if(c.content){c.content.style.display="none";}if(c.options&&c.options.onclose){c.options.onclose(apf.extend(c.options,{htmlNode:c.content}));c.options.onclose=false;}}},isShowing:function(c){return this.last&&this.last==c&&this.cache[this.last]&&this.cache[this.last].content.style.display!="none";},isDragging:false,makeDraggable:function(i){if(!apf.Interactive||this.cache[i.id].draggable){return;}var l=this.cache[i.id].content;this.cache[i.id].draggable=true;var j={$propHandlers:{},minwidth:10,minheight:10,maxwidth:10000,maxheight:10000,dragOutline:false,resizeOutline:false,draggable:true,resizable:i.resizable,$ext:l,oDrag:l.firstChild};l.onmousedown=l.firstChild.onmousedown=function(a){if(!a){a=event;}if(apf.hasFocusBug&&!apf.popup.focusFix[(a.srcElement||a.target).tagName]){apf.window.$focusfix();}(a||event).cancelBubble=true;};apf.implement.call(j,apf.Interactive);j.$propHandlers.draggable.call(j,true);j.$propHandlers.resizable.call(j,true);},forceHide:function(){if(this.last&&!apf.plane.current&&this.isShowing(this.last)){var c=apf.lookup(this.last);if(!c){this.last=null;}else{if(c.dispatchEvent("popuphide")!==false){this.hide();}}}},destroy:function(){for(var c in this.cache){if(this.cache[c]){this.cache[c].content.onmousedown=null;apf.destroyHtmlNode(this.cache[c].content);this.cache[c].content=null;this.cache[c]=null;}}if(!this.popup){return;}}};apf.nameserver={lookup:{},add:function(d,i){if(!this.lookup[d]){this.lookup[d]=[];}return this.lookup[d].push(i)-1;},register:function(i,j,l){if(!this.lookup[i]){this.lookup[i]={};}return(this.lookup[i][j]=l);},remove:function(j,n){var m=this.lookup[j];if(m){for(var l in m){if(m[l]==n){delete m[l];}}}},get:function(d,i){return this.lookup[d]?this.lookup[d][i]:null;},getAll:function(i){var o,l=[],q=this.lookup[i];if(!q){return l;}if(q.dataType==apf.ARRAY){for(var n=0;n<q.length;n++){l.push(q[n]);}}else{for(o in q){if(apf.isSafariOld&&(!q[o]||typeof q[o]!="object")){continue;}l.push(q[o]);}}return l;},getAllNames:function(j){var l,i=[];for(l in this.lookup[j]){if(parseInt(l)==l){continue;}i.push(l);}return i;}};apf.registry=apf.extend({put:function(i,j,l){this.register(l,i,j);},getNamespaces:function(){},getKeys:function(c){return this.getAllNames(c);},remove:function(d,i){delete this.lookup[i][d];},clear:function(c){this.lookup={};},$export:function(j){var l,i;for(l in this.lookup){for(i in this.lookup[l]){j.put(i,this.lookup[i][l],l);}}}},apf.nameserver);apf.registry.lookup={};apf.registry.get=function(d,i){return this.lookup[i]?this.lookup[i][d]:null;};apf.Init.run("nameserver");apf.history={inited:false,page:null,past:[],future:[],init:function(n,l,o){if(this.inited){return;}if(o){this.delay=o;}var q=location.href.match(/#(.*)$/)&&decodeURI(RegExp.$1)||apf._GET[l||-1]||n;this.inited=true;location.hash=q;this.hasChanged(q||null);if(apf.supportHashChange){window.onhashchange=function(){var a=location.hash.replace("#","");apf.history.hasChanged(decodeURI(a));};}else{if(apf.isIE){var m="<style>                    BODY, HTML{margin : 0;}                    h1{height : 100px;margin : 0;padding : 0;}                </style>                <body>                    <h1 id='"+q+"'>0</h1>                </body>                <script>                    var lastURL = -1;                    if(document.all){                        document.body.onscroll = checkUrl;                    }else{                        setInterval('checkUrl()', 200);                    }                    function checkUrl(){                        if (top.apf.isIE7Emulate && top.apf.history.lastHtml)                            document.body.innerHTML = top.apf.history.lastHtml;                        var nr=Math.round((document.all ? document.body : document.documentElement).scrollTop/100);                        if (top.apf.isIE7Emulate) {                            clearTimeout(top.apf.history.ie7timer);                            top.apf.history.ie7timer = setTimeout(function(){                                top.apf.history.hasChanged(document.getElementsByTagName('h1')[nr].id);                            }, 100);                        }                        else {                            top.apf.history.hasChanged(document.getElementsByTagName('h1')[nr].id);                        }                        lastURL = document.body.scrollTop;                    }                    checkUrl();                <\/script>";if(top==self){document.body.insertAdjacentHTML("beforeend","<iframe name='nav' style2='position:absolute;left:10px;top:10px;height:100px;width:100px;z-index:1000'                       style='width:1px;height:1px;' src='about:blank'></iframe>");document.frames.nav.document.open();document.frames.nav.document.write(m);document.frames.nav.document.close();}this.iframe=document.frames.nav;this.timer2=setInterval(function(){if(!apf.history.changingHash&&location.hash!="#"+apf.history.page){var c=location.hash.replace(/^#/,"");var a=apf.history.page;apf.history.setHash(c,true,true);apf.history.page=a;apf.history.hasChanged(c);}},apf.history.delay||1);}else{apf.history.lastUrl=location.href.toString();this.timer2=setInterval(function(){if(apf.history.lastUrl==location.href.toString()){return;}apf.history.lastUrl=location.href.toString();var a=location.hash.replace("#","");apf.history.hasChanged(decodeURI(a));},20);}}},to_name:null,setHash:function(n,j,l){if(this.changing||this.page==n||!l&&location.hash=="#"+n){this.to_name=n;return;}if(apf.isIE&&!apf.isIE8&&!j){this.to_name=n;return $setTimeout(function(){apf.history.setHash(apf.history.to_name,true);},200);}this.changePage(n);if(!this.inited){return this.init(n);}if(apf.isIE&&!apf.isIE8){var m=this.iframe.document.body.appendChild(this.iframe.document.createElement("h1"));m.id=n;m.innerHTML=this.length;this.lastHtml=this.iframe.document.body.innerHTML;}(apf.isIE&&!apf.isIE8?this.iframe:window).location.href="#"+n;if(!apf.isIE&&!apf.isIphone){apf.history.lastUrl=location.href.toString();}else{if(apf.isIE8){this.page=n;}}},timer:null,changePage:function(c){if(apf.isIE&&!apf.isIE8){this.page=c;this.changingHash=true;clearTimeout(this.timer);this.timer=$setTimeout(function(){location.hash=c;apf.history.changingHash=false;},1);}},update:function(l){var m,n,i=0;for(m=0,n=this.past.length;m<n&&i===0;m++){if(this.past[m]==l){i=m+1;}}if(i>0){this.future=this.past.slice(i,this.past.length-1).concat(this.future).makeUnique();this.past.splice(i,this.past.length-(i));i=-i;}else{for(m=0,n=this.future.length;m<n&&i===0;m++){if(this.future[m]==l){i=m+1;this.past=this.past.concat(this.future.splice(0,this.future.length-i)).makeUnique();}}if(i===0){this.past.push(l);i=1;}}return i;},hasChanged:function(c){if(c==this.page){return;}this.changePage(c);this.changing=true;apf.dispatchEvent("hashchange",{page:c,index:this.update(c)});this.changing=false;}};apf.config=new apf.Class().$init();apf.extend(apf.config,{disableRightClick:false,allowSelect:false,allowBlur:true,autoDisableActions:true,autoDisable:false,disableF5:true,autoHideLoading:true,disableSpace:true,defaultPage:"home",disableBackspace:true,undokeys:false,outline:false,dragOutline:false,resizeOutline:false,autoDisableNavKeys:true,disableTabbing:false,resourcePath:null,initdelay:true,liveText:false,iePngFix:false,iphoneFullscreen:true,iphoneStatusbar:"default",iphoneIcon:null,iphoneIconIsGlossy:false,iphoneFixedViewport:true,skinset:"default",name:self.window&&window.location.href.replace(/[^0-9A-Za-z_]/g,"_"),tags:{},defaults:{},baseurl:"",model:"@default","empty-message":"No items","loading-message":"Loading...","offline-message":"You are currently offline.",setDefaults:function(){if(apf.isParsingPartial){this.disableRightClick=false;this.allowSelect=true;this.autoDisableActions=true;this.autoDisable=false;this.disableF5=false;this.autoHideLoading=true;this.disableSpace=false;this.disableBackspace=false;this.undokeys=false;this.disableTabbing=true;this.allowBlur=true;}},getDefault:function(n,i){var m=this.defaults[n];if(!m){return;}for(var d=m.length-1;d>=0;d--){if(m[d][0]==i){return m[d][1];}}},setProperty:function(d,i){this[d.replace(/-(\w)/g,function(c,a){return a.toUpperCase();})]=this[d]=i;(this.$propHandlers&&this.$propHandlers[d]||apf.GuiElement.propHandlers[d]||apf.K).call(this,i);},$inheritProperties:{},$propHandlers:{baseurl:function(c){this.baseurl=apf.parseExpression(c);},language:function(c){apf.queue.add("language",function(){apf.setModel(apf.config.language,apf.language);});},layout:function(c){apf.queue.add("layout",function(){apf.setModel(apf.config.layout,apf.layout);});},"resource-path":function(c){this.resourcePath=apf.parseExpression(c||"").replace(/resources\/?|\/$/g,"");},iepngfix:function(i,d){this.iePngFix=(!apf.supportPng24&&(apf.isTrue(i)||d.getAttribute("iepngfix-elements")));if(this.iePngFix){$setTimeout(function(){apf.iepngfix.limitTo(d.getAttribute("iepngfix-elements")||"").run();});}},skinset:function(c){if(this.$amlLoaded){apf.skins.changeSkinset(c);}},outline:function(c){this.dragOutline=this.resizeOutline=this.outline=apf.isTrue(c);},"drag-outline":function(c){this.dragOutline=c?apf.isTrue(c):false;},"resize-outline":function(c){this.resizeOutline=c?!apf.isFalse(c):false;},login:function(i,d){apf.auth.init(d);},storage:function(c){if(c){apf.storage.init(c);}},offline:function(c){if(c&&typeof apf.offline!="undefined"){apf.offline.init(c);}},"disable-f5":function(c){if(apf.isDeskrun&&c){shell.norefresh=true;}},debug:function(c){apf.debug=c;}}});if(apf.history){apf.addEventListener("load",function(){apf.history.init(apf.config.defaultPage,"page");});}apf.offline={enabled:false,onLine:-1,resources:["application","models","transactions","queue","state"],autoInstall:false,storage:null,inited:false,rsbTimeout:600000,init:function(i){apf.makeClass(this);if(i){this.$aml=i;if(typeof i=="string"){}else{if(i.nodeType){if(i.getAttribute("resources")){this.providers=i.getAttribute("resources").split("|");}if(i.getAttribute("rsb-timeout")){this.rsbTimeout=parseInt(i.getAttribute("rsb-timeout"));}var o,n,q=i.attributes;for(n=0;n<q.length;n++){o=q[n];if(o.nodeName.indexOf("on")==0){this.addEventListener(o.nodeName,apf.lm.compile(o.nodeValue,{event:true,parsecode:true}));}}}else{apf.extend(this,i);}}}var a=apf.offline.application.init(i);if(a){this.storage=apf.storage.getProvider(a);}if(!this.storage){this.storage=apf.storage.initialized?apf.storage:apf.storage.init();}if(!this.storage){return;}if(!this.storage.isPermanent()){apf.addEventListener("exit",function(){return apf.offline.dispatchEvent("losechanges");});}if(this.storage.asyncInit){apf.document.$domParser.$shouldWait++;this.storage.ready(function(){apf.offline.storage.onready=null;apf.offline.continueInit();apf.document.$domParser.$continueParsing(apf.document.documentElement);});return;}this.continueInit();},continueInit:function(){for(var c=this.resources.length-1;c>=0;c--){if(!this[this.resources[c]]){this.resources.removeIndex(c);}else{this[this.resources[c]].init(this.$aml);}}this.enabled=true;this.detector.init(this.$aml);this.offlineTime=parseInt(this.storage.get("offlinetime",this.namespace));if(this.offlineTime){this.goOffline();}else{this.goOnline();}apf.offline.dispatchEvent("load");},$destroy:function(){if(this.provider&&this.provider.destroy){this.provider.destroy();}if(this.storage&&this.storage.destroy){this.storage.destroy();}for(var c=this.resources.length-1;c>=0;c--){if(this[this.resources[c]]&&this[this.resources[c]].destroy){this[this.resources[c]].destroy();}}},IDLE:0,TO_OFFLINE:1,TO_ONLINE:2,STOPPING:3,inProcess:0,$supportedProperties:["syncing","position","length","progress","onLine"],handlePropSet:function(j,l,i){this[j]=l;},goOffline:function(){if(!this.enabled||this.onLine===false||this.inProcess==this.TO_OFFLINE){return false;}if(this.inProcess){this.inProcess=this.STOPPING;return false;}if(this.dispatchEvent("beforeoffline")===false){return false;}this.setProperty("onLine",false);this.inProcess=this.TO_OFFLINE;if(!this.offlineTime){this.offlineTime=new Date().getTime();this.storage.put("offlinetime",this.offlineTime,this.namespace);}if(this.detector.enabled&&this.detector.detection!="manual"){this.detector.start();}if(!this.initial){this.initial={disableRSB:apf.xmldb.disableRSB};}apf.xmldb.disableRSB=true;this.inProcess=this.IDLE;this.dispatchEvent("afteroffline");return true;},goOnline:function(){if(!this.enabled||this.onLine===true||this.inProcess==this.TO_ONLINE){return false;}if(this.dispatchEvent("beforeonline")===false){return false;}this.setProperty("onLine",true);this.inProcess=this.TO_ONLINE;this.onlineTime=new Date().getTime();this.reloading=false;if(this.detector.enabled&&this.detector.detection=="error"){this.detector.stop();}this.$checkRsbTimeout();if(this.initial){apf.xmldb.disableRSB=this.initial.disableRSB;}var i=function(){this.startSync();this.dispatchEvent("afteronline");};var d=apf.document.getElementsByTagNameNS(apf.ns.apf,"auth")[0];if(!d){return;}if(d.needsLogin&&d.loggedIn){d.authRequired({object:this,retry:i});}else{i.call(this);}return true;},$checkRsbTimeout:function(){if(!this.rsbTimeout){return;}var n,q,o=apf.nameserver.getAll("remote");for(n=0;n<o.length;n++){var i=o[n];if(this.reloading||this.onlineTime-this.offlineTime>this.rsbTimeout){if(!this.reloading){if(this.dispatchEvent("beforereload")===false){break;}this.reloading=true;}i.discardBefore=this.onlineTime;for(q=0;k<i.models.length;q++){i.models[q].clear();apf.offline.models.addToInitQueue(i.models[q]);}}}if(this.reloading){apf.offline.transactions.clear("undo|redo");var j=apf.nameserver.getAll("actiontracker");for(var n=0;n<j.length;n++){j[n].reset();}}},$goOnlineDone:function(c){this.inProcess=this.IDLE;this.setProperty("syncing",false);if(c){this.offlineTime=null;this.initial=null;this.storage.remove("offlinetime",this.namespace);}else{this.goOffline();}},clear:function(){if(!this.enabled){return false;}for(var c=this.resources.length-1;c>=0;c--){if(this[this.resources[c]].clear){this[this.resources[c]].clear();}}},startSync:function(){if(this.syncing){return;}this.setProperty("syncing",true);var B=[],w=0,i=0,s=null,z,A;for(A=this.resources.length-1;A>=0;A--){if(this[this.resources[A]].sync){z=this[this.resources[A]].getSyncLength();if(z){B.push(this[this.resources[A]]);w+=z;}}}var u=apf.offline;var t=function(a){if(u.inProcess==u.STOPPING){if(!a.finished&&a.length-1!=a.position){s.stopSync(function(){u.$goOnlineDone(false);});}else{u.$goOnlineDone(false);}return;}if(a.finished){if(B.length){s=B.pop();s.sync(t);}else{u.$goOnlineDone(true);}return;}if(!a.start){i++;}u.setProperty("progress",parseInt(i/w*100));u.setProperty("position",i);u.setProperty("length",w);u.dispatchEvent("sync",apf.extend(a,{position:i,length:w}));};if(w){t({start:true});t({finished:true});}else{this.$goOnlineDone(true);}var C=apf.all;for(A=0;A<C.length;A++){if(C[A].$loadedWhenOffline){C[A].reload();}}},stopSync:function(){if(this.syncing){this.inProcess=this.STOPPING;}}};apf.offline.application={enabled:false,urls:[],providers:["deskrun","gears"],init:function(i){if(this.enabled){return;}this.namespace=apf.config.name+".apf.offline.application";if(typeof i=="string"){this.providers=i.split("|");}else{if(i.nodeType){if(i.getAttribute("version-get")){this.application.versionGet=i.getAttribute("version-get");}if(i.getAttribute("providers")){this.providers=i.getAttribute("providers").split("|");}if(i.getAttribute("auto-install")){this.autoInstall=apf.isTrue(i.getAttribute("auto-install"));}}}for(var d=0;d<this.providers.length;d++){if(!this[this.providers[d]]){continue;}if(this[this.providers[d]].isAvailable()){this.provider=this[this.providers[d]].init(this.storeName);if(this.provider!==false){this.provider.name=this.providers[d];break;}}}if(!this.provider){if(this.autoInstall){if(this.install()===false){apf.offline.application=null;return this.providers[0];}}else{apf.offline.application=null;return this.providers[0];}}if(!apf.loaded){apf.addEventListener("load",function(){if(apf.offline.application.enabled){apf.offline.application.save();}apf.removeEventListener("load",arguments.callee);});}else{apf.offline.addEventListener("load",function(){apf.offline.application.save();});}this.enabled=true;return this.provider.name;},install:function(){if(apf.offline.dispatchEvent("beforeinstall")===false){return false;}for(var c=0;c<this.providers.length;c++){if(!this[this.providers[c]]){continue;}if(this[this.providers[c]].install()){this.provider=this[this.providers[c]].init(this.storeName);if(this.provider!==false){break;}}}apf.offline.dispatchEvent("afterinstall");if(!this.provider){return false;}},clear:function(){if(this.provider){this.provider.clear();}},cache:function(c){if(c.indexOf(":")>-1&&c.indexOf("http://"+location.host)==-1){return;}this.urls.pushUnique(c.replace(/\#.*$/,""));},remove:function(c){this.urls.remove(c);},refresh:function(m){var n=apf.offline.storage;if(this.versionGet){var q=n.get("oldVersion",this.namespace);var o=null;var l=this;apf.getData(this.versionGet,{callback:function(d,a,c){if(a==apf.TIMEOUT){return c.tpModule.retryTimeout(c,a,apf.offline);}if(a==apf.OFFLINE){return;}if(a==apf.ERROR){n.remove("oldVersion",l.namespace);}if(apf.debug||!d||!q||q!=d){if(apf.offline.state.enabled){apf.offline.state.clear();if(apf.offline.state.realtime){apf.offline.state.search();}}l.search();l.provider.store(l.urls,m,d);}else{m({finished:true});}}});}else{this.search();this.provider.store(this.urls,m);}},search:function(){this.cache(window.location.href);var i,w=document.getElementsByTagName("script");for(i=0;i<w.length;i++){this.cache(w[i].getAttribute("src"));}w=document.getElementsByTagName("link");for(i=0;i<w.length;i++){if((w[i].getAttribute("rel")||"").toLowerCase()=="stylesheet"){continue;}this.cache(w[i].getAttribute("href"));}w=document.getElementsByTagName("img");for(i=0;i<w.length;i++){this.cache(w[i].getAttribute("src"));}w=document.getElementsByTagName("a");for(i=0;i<w.length;i++){this.cache(w[i].getAttribute("href"));}var q=this,t,s,j,u=document.styleSheets;for(i=0;i<u.length;i++){j=u[i];if(apf.isIE){if(j.readOnly){j.cssText.replace(/url\(\s*([^\) ]*)\s*\)/gi,function(c,a){q.cache(a);return"";});}}else{if(j.ownerNode.tagName=="STYLE"){continue;}for(t=0;t<j.cssRules.length;t++){s=j.cssRules[t].cssText;if(!s){continue;}s.replace(/url\(\s*([^\) ]*)\s*\)/gi,function(c,a){q.cache(a);return"";});}}}apf.skins.loadedCss.replace(/url\(\s*([^\) ]*)\s*\)/gi,function(c,a){q.cache(a);return"";});},save:function(i){if(!apf.offline.onLine){var d=function(){apf.offline.application.save();apf.offline.removeEventListener("afteronline",d);};apf.offline.addEventListener("afteronline",d);return;}this.refresh(i);}};apf.offline.application.gears={localServer:null,lastStore:null,cancelID:null,refreshing:false,fileIndex:0,init:function(){this.name=this.storeName.truncate(64);this.storeName=apf.config.name+".apf.offline";try{this.localServer=apf.nameserver.get("google","gears").create("beta.localserver","1.0");}catch(c){apf.console.warn("Error loading gears: "+c.message);return false;}return this;},install:function(){apf.isGears=true;},isAvailable:function(){return apf.isGears&&location.protocol!="file:";},clear:function(){this.localServer.removeStore(this.name);},store:function(s,n,q){this.localServer.removeStore(this.name);this.localServer.openStore(this.name);try{var t=this.lastStore=this.localServer.createStore(this.name);}catch(o){return false;}var m=this;this.refreshing=true;this.fileIndex=0;this.cancelID=t.capture(s,function(d,c,a){if(!c&&m.refreshing){m.cancelID=null;m.refreshing=false;if(n){n({error:true,message:"Unable to capture "+d});}return;}else{if(c){m.fileIndex++;if(n){n({position:m.fileIndex,length:listOfURLS.length});}}}if(c&&m.fileIndex>=s.length){m.cancelID=null;m.refreshing=false;if(q){apf.storage.put("oldVersion",q,null,apf.offline.application.storeName);}if(n){n({finished:true});}}});},abort:function(){if(!this.refreshing){return;}this.lastStore.abortCapture(this.cancelID);this.refreshing=false;}};apf.offline.transactions={enabled:false,init:function(){this.namespace=apf.config.name+".apf.offline.transactions";this.enabled=true;apf.addEventListener("load",function(){apf.offline.transactions.rebuildActionQueues();apf.removeEventListener("load",arguments.callee);});},actionNotAllowed:function(){apf.offline.dispatchEvent("transactioncancel",{message:"Transaction is not allowed",bubbles:true});return;},addAction:function(t,n,q){var s=this.namespace+"."+t.name+"."+q;var o=apf.offline.storage;var m=parseInt(o.get("length",s))||0;o.put(m,apf.serialize(q=="queue"?{undo:n.undo,undoObj:n.undoObj.$export()}:n.$export()),s);o.put("length",++m,s);},removeAction:function(w,u,s){var t=this.namespace+"."+w.name+"."+s;var n=apf.offline.storage;if(u){var q=parseInt(n.get("length",t))-1;var o=parseInt(n.get("start",t))||0;if(o==q||q<0){n.clear(t);return;}n.remove(q,t);n.put("length",q,t);}else{var o=parseInt(n.get("start",t))||0;var q=parseInt(n.get("length",t))||0;if(o+1==q){n.clear(t);return;}n.remove(o,t);n.put("start",++o,t);}},rebuildActionQueues:function(){var N=apf.offline.storage;var G=N.getNamespaces();if(!G){return;}var E,B=new RegExp(this.namespace+"\\.([^\\.]*)\\.([^\\.]*)");for(var I=[],j=0;j<G.length;j++){if(G[j].match(B)){I.push([RegExp.$1,RegExp.$2]);}}var j,C,i,K,D,F,J,O,M;for(j=0;j<I.length;j++){F=apf.nameserver.get("actiontracker",I[j][0]);M=I[j][1];E={};D=this.namespace+"."+F.name+"."+M;N.getAllPairs(D,E);J=parseInt(E.start)||0;O=parseInt(E.length)||0;K=[];if(M=="queue"){for(C=O-1;C>=J;C--){i=apf.unserialize(E[C]);i.undoObj=new apf.UndoData(i.undoObj,F).$import();K.unshift(i);}}else{for(C=O-1;C>=J;C--){i=apf.unserialize(E[C]);K.unshift(new apf.UndoData(i,F).$import());}}F.$loadQueue(K,M);apf.offline.sLookup=null;}},clearActions:function(d,i){apf.offline.storage.clear(this.namespace+"."+d.name+"."+i);},clear:function(o){if(!o){o="undo|redo|queue";}var m=apf.offline.storage;var n=m.getNamespaces();var q=new RegExp(this.namespace+"\\.([^\\.]*)\\.("+o+")");for(var i=0;i<n.length;i++){if(n[i].match(q)){m.clear(n[i]);}}},stopSync:function(c){c();},getSyncLength:function(){var l=apf.nameserver.getAll("actiontracker");var i=0;for(var j=0;j<l.length;j++){i+=l[j].$getQueueLength();}return i;},sync:function(m){var q=apf.nameserver.getAll("actiontracker");var n=0,i=0;for(var o=0;o<q.length;o++){if(q[o].$getQueueLength()){i+=q[o].$getQueueLength();q[o].$startQueue(function(a){if(n>=i-1){return false;}if(a){n=i;}m({position:++n,length:i});if(n>=i-1){m({finished:true});}});}}}};apf.offline.canTransact=function(){if(!apf.offline.enabled||this.onLine||this.transactions.enabled){return true;}if(this.dispatchEvent("transactioncancel",{message:"Could not execute transaction whilst being offline,                   silently doing nothing",bubbles:true})===true){return true;}return false;};apf.offline.detector={detectUrl:apf.basePath+"core/lib/offline/network_check.txt",detection:"auto",interval:5000,init:function(c){if(c.nodeType){if(c.getAttribute("detect-url")){this.detectUrl=c.getAttribute("detect-url");}else{this.detectUrl=(apf.config.resourcePath||apf.basePath)+"resources/network_check.txt";}this.detection=apf.isTrue(c.getAttribute("detection"))?"auto":c.getAttribute("detection")||"auto";if(c.getAttribute("interval")){this.interval=parseInt(c.getAttribute("interval"));}}if("error|auto".indexOf(this.detection)>-1){apf.addEventListener("error",function(a){if(a.state==apf.TIMEOUT){return !apf.offline.goOffline();}});}this.oHttp=new apf.http();this.oHttp.timeout=this.interval;this.isSiteAvailable();if(this.detection=="auto"){this.start();}},isSiteAvailable:function(c){this.oHttp.get(apf.getNoCacheUrl(this.detectUrl),{callback:function(a,j,l){if(j!=apf.SUCCESS||!window.navigator.onLine){apf.offline.goOffline(c);}else{apf.offline.goOnline(c);}},ignoreOffline:true,hideLogMessage:true});},start:function(){clearInterval(this.timer);var c=this;this.timer=setInterval(function(){c.isSiteAvailable();},this.interval);},stop:function(){clearInterval(this.timer);}};apf.offline.models={enabled:false,timer:null,models:{},initQueue:[],realtime:true,init:function(c){this.namespace=apf.config.name+".apf.offline.models";if(c.nodeType&&c.getAttribute("realtime")){this.realtime=!apf.isFalse(c.getAttribute("realtime"));}if(!this.realtime){apf.addEventListener("exit",function(){apf.offline.models.search();});}this.enabled=true;},markForUpdate:function(i){this.models[i.$uniqueId]=i;if(!this.timer){var d=this;this.timer=$setTimeout(function(){d.timer=null;var a=d.models;for(var c in a){d.updateModel(a[c]);}d.models={};},2000);}},clear:function(){apf.offline.storage.clear(this.namespace);},removeModel:function(i){var d=i.name||i.$uniqueId+".model";apf.offline.storage.remove(d,this.namespace);this.initQueue.remove(i);},updateModel:function(l){var i=l.name||l.$uniqueId+".model";var j=l.data.getAttribute(apf.xmldb.xmlDocTag);l.data.setAttribute(apf.xmldb.xmlDocTag+"_length",apf.xmldb.nodeCount[j]);apf.offline.storage.put(i,l.data.xml||l.data.serialize(),this.namespace);},loadModel:function(q){var l=q.name||q.$uniqueId+".model";var m=apf.offline.storage.get(l,this.namespace);if(!m){return false;}var n=apf.getXmlDom(m).documentElement;var o=n.getAttribute(apf.xmldb.xmlDocTag);apf.xmldb.nodeCount[o]=parseInt(n.getAttribute(apf.xmldb.xmlDocTag+"_length"));q.load(n);return true;},search:function(){var i={},j=apf.nameserver.getAll("model");for(var l=0;l<j.length;l++){if(i[j[l].$uniqueId]){continue;}i[j[l].$uniqueId]=true;this.updateModel(j[l]);}return true;},addToInitQueue:function(c){this.initQueue.pushUnique(c);c.session=false;},stopSync:function(c){c();},getSyncLength:function(){return this.initQueue.length;},sync:function(m){var q=this.initQueue.slice();this.initQueue.length=0;var n=0,i=q.length;for(var o=0;o<q.length;o++){q[o].init(function(){m({position:++n,length:i});if(n==i-1){m({finished:true});}});}}};apf.offline.queue={enabled:false,stack:[],init:function(){this.namespace=apf.config.name+".apf.offline.queue";this.enabled=true;},add:function(q){var o=this.namespace;var m=apf.offline.storage;var l=parseInt(m.get("length",o))||0;this.stack[l]=q;m.put(l,apf.serialize(q),o);m.put("length",++l,o);var n=q.callback;if(!q.undoObj&&n){n(null,apf.OFFLINE,apf.extend({offline:true},q));}},stopSync:function(c){this.stop=c;},getSyncLength:function(){return parseInt(apf.offline.storage.get("length",this.namespace))||0;},sync:function(n,u){if(this.stop){this.stop();this.stop=null;return;}var t=this.namespace;var q=apf.offline.storage;var o=parseInt(q.get("length",t))||0;var s=parseInt(q.get("start",t))||0;var w;if(this.stack[s]){w=this.stack[s];}else{w=this.$getCommInfo(q.get(s,t));if(!w){this.clear();apf.offline.stopSync();return n({finished:true});}this.stack[s]=w;}if(!w.callback2){w.callback2=w.callback;w.callback=function(a,c,d){if(w.callback2&&w.callback2.apply(window,arguments)===true){return true;}q.remove(s,t);q.put("start",s+1,t);apf.offline.queue.stack[s]=null;n({position:s,length:o,info:w});if(s==o-1){q.clear(t);n({finished:true});}else{apf.offline.queue.sync(n,true);}};}this.stack[s].retry();},clear:function(){apf.offline.storage.clear(this.namespace);},$getCommInfo:function(strCommItem){if(!strCommItem){return false;}var commObject,commInfo=apf.unserialize(strCommItem);for(var i=0;i<commInfo.$object.length;i++){commObject=self[commInfo.$object[i]]||eval(commInfo.$object[i]);if(commObject){break;}}commInfo.object=commObject;commInfo.retry=new Function(commInfo.$retry);return commInfo;}};apf.offline.state={enabled:false,states:{},realtime:true,lookup:{},init:function(i){this.namespace=apf.config.name+".apf.offline.state";if(i.nodeType){if(i.getAttribute("realtime")){this.realtime=!apf.isFalse(i.getAttribute("realtime"));}if(i.getAttribute("set")){this.setInstruction=i.getAttribute("set");}}apf.addEventListener("exit",function(){if(!apf.offline.state.realtime){var c=apf.offline.state.lookup;var a=apf.offline.storage;var m=apf.offline.state.namespace;for(var n in c){var m=apf.offline.state.namespace;a.put(n,c[n],m);}}if(apf.offline.state.setInstruction){apf.offline.state.send();}});var d=apf.extend({},apf.offline.storage||apf.storage);d.namespace=apf.config.name+".apf.registry";apf.registry.$export(d);apf.registry=d;if(apf.offline.storage.getAllPairs(this.namespace,this.lookup)){if(apf.offline.dispatchEvent("restore")===false){this.clear();this.lookup={};apf.offline.transactions.clear("undo|redo");}}apf.offline.transactions.doStateSync=true;this.enabled=true;},warned:false,timeout:{},set:function(o,t,q){if(!o.tagName){return;}var n=o.name||o.$uniqueId+"_"+o.tagName;var m=apf.offline.storage;t=n+"."+t;this.lookup[t]=q;if(!this.realtime){return;}var s=this.namespace;clearTimeout(this.timeout[t]);this.timeout[t]=$setTimeout(function(){m.put(t,q,s);},200);},get:function(j,i,l){return this.lookup[(j.name||j.$uniqueId+"_"+j.tagName)+"."+i];},getAll:function(n){var m,o={},l,q=n.name||n.$uniqueId+"_"+n.tagName;for(m in this.lookup){l=m.split(".");if(l[0]==q){o[l[1]]=this.lookup[m];}}return o;},clear:function(){apf.offline.storage.clear(this.namespace);var i=apf.registry.getNamespaces();for(var d=0;d<i.length;d++){apf.registry.clear(i[d]);}apf.offline.transactions.clear("undo|redo");},search:function(){var i=apf.offline.storage;var n,o,q,j=apf.all;for(o=0;o<j.length;o++){if(j[o].name&&j[o].getAvailableProperties){n=j[o].getAvailableProperties();for(q=0;q<n.length;q++){if(j[o][n[q]]){this.set(j[o],n[q],j[o][n[q]]);}}}}},send:function(){var l=apf.offline.storage;var m={};var n=l.getKeys(this.namespace);for(var i=0;i<n.length;i++){m[n[i]]=l.get(n[i],this.namespace);}apf.saveData(this.setInstruction,{ignoreOffline:true,data:apf.serialize(m),callback:function(a,c,d){if(d.tpModule.retryTimeout(d,c,apf.offline)===true){return true;}}});}};apf.printer={tagName:"printer",nodeFunc:apf.NODE_HIDDEN,lastContent:"",inited:false,init:function(aml){this.inited=true;this.$aml=aml;this.contentShower=document.body.appendChild(document.createElement("DIV"));this.contentShower.id="print_content";with(this.contentShower.style){width="100%";height="100%";backgroundColor="white";zIndex=100000000;}apf.importCssString("#print_content{display:none}");apf.importCssString((apf.hasCSSChildOfSelector?"body #print_content{display:block} body>*{display:none}":"body #print_content, body #print_content *{display:block} body *{display:none}"),"print");if(aml){var a,i,attr=aml.attributes;for(i=0;i<attr.length;i++){a=attr[i];if(a.nodeName.indexOf("on")==0){apf.addEventListener(a.nodeName,apf.lm.compile(a.nodeValue,{event:true,parsecode:true}));}}}function printPNGFix(disable){if(apf.supportPng24){return;}if(!apf.config.iePngFix){return;}for(var e,i=0,j=document.all.length;i<j;i++){e=document.all[i];if(e.filters["DXImageTransform.Microsoft.AlphaImageLoader"]||e._png_print){if(disable){e._png_print=e.style.filter;e.style.filter="";}else{e.style.filter=e._png_print;e._png_print="";}}}}window.onbeforeprint=function(){printPNGFix(true);apf.dispatchEvent("beforeprint");};window.onafterprint=function(){printPNGFix(false);apf.dispatchEvent("afterprint");};},preview:function(c){if(!this.inited){this.init();}if(typeof c!="string"){c=c.outerHTML||c.xml||c.serialize();}this.lastContent=c;this.contentShower.innerHTML=c;}};apf.print=function(c){if(!apf.printer.inited){apf.printer.init();}apf.printer.preview(c);window.print();};apf.tween={left:function(i,d){i.style.left=d+"px";},right:function(i,d){i.style.left="";i.style.right=d+"px";},top:function(i,d){i.style.top=d+"px";},bottom:function(i,d){i.style.top="";i.style.bottom=d+"px";},width:function(j,l,i){j.style.width=l+"px";},height:function(j,l,i){j.style.height=l+"px";},scrollTop:function(j,l,i){j.scrollTop=l;},scrollLeft:function(j,l,i){j.scrollLeft=l;},"height-rsz":function(j,l,i){j.style.height=l+"px";if(apf.hasSingleResizeEvent){window.onresize();}},mwidth:function(n,j,l){var m=apf.getDiff(n);n.style.width=j+"px";n.style.marginLeft=-1*(j/2+(parseInt(apf.getStyle(n,"borderLeftWidth"))||m[0]/2)+(l.margin||0))+"px";},mheight:function(n,j,l){var m=apf.getDiff(n);n.style.height=j+"px";n.style.marginTop=(-1*j/2-(parseInt(apf.getStyle(n,"borderTopWidth"))||m[1]/2)+(l.margin||0))+"px";},scrollwidth:function(i,d){i.style.width=d+"px";i.scrollLeft=i.scrollWidth;},scrollheight_old:function(l,i){try{l.style.height=i+"px";l.scrollTop=l.scrollHeight;}catch(j){alert(i);}},scrollheight:function(o,q,m){var n=apf.getHeightDiff(o),l=m.$int||o;o.style.height=Math.max((q+(m.diff||0)),0)+"px";l.scrollTop=l.scrollHeight-l.offsetHeight-n+(m.diff||0);},scrolltop:function(i,d){i.style.height=d+"px";i.style.top=(-1*d-2)+"px";i.scrollTop=0;},clipright:function(j,l,i){j.style.clip="rect(auto, auto, auto, "+l+"px)";j.style.marginLeft=(-1*l)+"px";},fade:function(i,d){if(apf.hasStyleFilters){i.style.filter="alpha(opacity="+parseInt(d*100)+")";}else{i.style.opacity=d;}},bgcolor:function(i,d){i.style.backgroundColor=d;},textcolor:function(i,d){i.style.color=d;},htmlcss:function(l,i,j){if(apf.hasStyleFilters&&j.type=="filter"){l.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+i+")";}else{l.style[j.type]=i+(j.needsPx?"px":"");}},NORMAL:0,EASEIN:1,EASEOUT:2,CSSTIMING:["linear","ease-in","ease-out","ease","ease-in-out","cubic-bezier"],CSSPROPS:{left:"left",right:"right",top:"top",bottom:"bottom",width:"width",height:"height",scrollTop:false,scrollLeft:false,mwidth:false,mheight:false,scrollwidth:false,scrollheight:false,fade:"opacity",bgcolor:"background-color",textcolor:"color"},queue:{},current:null,setQueue:function(d,i){if(!d.getAttribute("id")){apf.setUniqueHtmlId(d);}if(!this.queue[d.getAttribute("id")]){this.queue[d.getAttribute("id")]=[];}this.queue[d.getAttribute("id")].push(i);if(this.queue[d.getAttribute("id")].length==1){i(0);}},nextQueue:function(i){var d=this.queue[i.getAttribute("id")];if(!d){return;}d.shift();if(d.length){d[0](0);}},clearQueue:function(j,i){var l=this.queue[j.getAttribute("id")];if(!l){return;}if(i&&this.current&&this.current.control){this.current.control.stop=true;}l.length=0;},$calcSteps:function(u,C,w,t){var A,i;var s=[C];var B=0;var z=(w-C)/((Math.pow(t,2)+2*t+1)/(4*t));for(A=0;A<t;A++){if(!u&&!i){i=(w-C)/t;}else{if(u==1){i=z*Math.pow(((t-A))/t,3);}else{if(u==2){i=z*Math.pow(A/t,3);}}}s.push(s[s.length-1]+i);}s[s.length-1]=w;return s;},$calcColorSteps:function(a,C,c,G){var F=apf.color.colors,D=parseInt((F[C]||C).slice(1),16),E=parseInt((F[c]||c).slice(1),16),z=0,i=Math.round,A=[],B;for(;z<G;z++){B=z/(G-1),d2=1-B;A[A.length]="#"+("000000"+((i((D&255)*d2+(E&255)*B)&255)|(i((D&65280)*d2+(E&65280)*B)&65280)|(i((D&16711680)*d2+(E&16711680)*B)&16711680)).toString(16)).slice(-6);}return A;},single:function(t,s){s=apf.extend({steps:3,interval:20,anim:apf.tween.NORMAL,control:{}},s);if(t.nodeFunc>100){s.$int=t.$int;t=t.$ext;}if("fixed|absolute|relative".indexOf(apf.getStyle(t,"position"))==-1){t.style.position="relative";}var u=(apf.supportCSSAnim&&apf.tween.CSSPROPS[s.type]);s.method=u?s.type:apf.tween[s.type];if(u){var w=apf.tween.CSSPROPS[s.type];if(w===false){return this;}s.type=w||s.type;t.style[s.type]=s.from+(apf.tween.needsPix[s.type]?"px":"");$setTimeout(function(){t.style[s.type]=s.to+(apf.tween.needsPix[s.type]?"px":"");t.style.webkitTransition=s.type+" "+((s.steps*s.interval)/1000)+"s "+apf.tween.CSSTIMING[s.anim||0];var a=function(){if(s.onfinish){s.onfinish(t,s.userdata);}t.style.webkitTransition="";t.removeEventListener("webkitTransitionEnd",a);};t.addEventListener("webkitTransitionEnd",a);});return this;}var A,z=s.color?apf.tween.$calcColorSteps(s.anim,s.from,s.to,s.steps):apf.tween.$calcSteps(s.anim,parseFloat(s.from),parseFloat(s.to),s.steps),q=this,o=function(c){q.current=s;if(s.control&&s.control.stop){s.control.stop=false;apf.tween.clearQueue(t);if(s.onstop){s.onstop(t,s.userdata);}return;}if(s.onbeforeeach&&s.onbeforeeach(t,s.userdata)===false){return;}try{s.method(t,z[c],s);}catch(a){}if(s.oneach){s.oneach(t,s.userdata);}if(c<s.steps){A=$setTimeout(function(){o(c+1);},s.interval);}else{q.current=null;if(s.control){s.control.stopped=true;}if(s.onfinish){s.onfinish(t,s.userdata);}apf.tween.nextQueue(t);}};this.setQueue(t,o);return this;},multi:function(W,J){J=apf.extend({steps:3,interval:20,anim:apf.tween.NORMAL,control:{}},J);if(W.nodeFunc>100){J.$int=W.$int;W=W.$ext;}var K=apf.supportCSSAnim,Q=false,Z=((J.steps*J.interval)/1000),Y=apf.tween.CSSTIMING[J.anim||0];for(var O=[],j=[],P=0;P<J.tweens.length;P++){var G=J.tweens[P];if(G.oHtml&&G.oHtml.nodeFunc>100){G.$int=G.oHtml.$int;G.oHtml=G.oHtml.$ext;}K=(apf.supportCSSAnim&&apf.tween.CSSPROPS[G.type]);G.method=K?G.type:apf.tween[G.type]||apf.tween.htmlcss;if(K){var X=apf.tween.CSSPROPS[G.type];G.type=X||G.type;W.style[G.type]=G.from+(apf.tween.needsPix[G.type]?"px":"");j.push([G.type,G.to+(apf.tween.needsPix[G.type]?"px":"")]);O.push(G.type+" "+Z+"s "+Y+" 0");Q=true;}else{O.push(G.color?apf.tween.$calcColorSteps(J.anim,G.from,G.to,J.steps):apf.tween.$calcSteps(J.anim,parseFloat(G.from),parseFloat(G.to),J.steps));}}if(Q){W.style.webkitTransition=O.join(",");var U=0,N=function(){U++;if(U==j.length){if(J.onfinish){J.onfinish(W,J.userdata);}W.style.webkitTransition="";W.removeEventListener("webkitTransitionEnd",N);}};W.addEventListener("webkitTransitionEnd",N);for(var i=0,R=j.length;i<R;i++){W.style[j[i][0]]=j[i][1];}return this;}var M,I=J.tweens,V=this,T=function(d){V.current=J;if(J.control&&J.control.stop){J.control.stop=false;apf.tween.clearQueue(W);if(J.onstop){J.onstop(W,J.userdata);}return;}try{for(var c=0;c<O.length;c++){I[c].method(I[c].oHtml||W,O[c][d],I[c]);}}catch(a){}if(J.oneach){J.oneach(W,J.userdata);}if(d<J.steps){M=$setTimeout(function(){T(d+1);},J.interval);}else{V.current=null;if(J.control){J.control.stopped=true;}if(J.onfinish){J.onfinish(W,J.userdata);}apf.tween.nextQueue(W);}};this.setQueue(W,T);return this;},css:function(T,W,K,G){(K=K||{}).tweens=[];if(T.nodeFunc>100){T=T.$ext;}if(G){apf.setStyleClass(T,"",[W]);}var i=function(a,c){if(a){apf.setStyleClass(T,"",[W]);}else{apf.setStyleClass(T,W);}for(var d=0;d<K.tweens.length;d++){if(K.tweens[d].type=="filter"){continue;}T.style[K.tweens[d].type]="";}if(c){c.apply(this,arguments);}};var X=K.onfinish;var U=K.onstop;K.onfinish=function(){i(G,X);};K.onstop=function(){i(!G,U);};var J,R,I,j,M,N,O,P,F={};for(P=0;P<document.styleSheets.length;P++){O=document.styleSheets[P][apf.styleSheetRules];for(j=O.length-1;j>=0;j--){var Q=O[j];if(!Q.style||!Q.selectorText.match("."+W+"$")){continue;}for(N in Q.style){if(!Q.style[N]||this.cssProps.indexOf("|"+N+"|")==-1){continue;}if(N=="filter"){if(!Q.style[N].match(/opacity\=([\d\.]+)/)){continue;}R=RegExp.$1;J=(apf.getStyleRecur(T,N)||"").match(/opacity\=([\d\.]+)/);I=J?RegExp.$1:100;M=false;if(R==I){if(G){I=100;}else{R=100;}}}else{R=G&&T.style[N]||Q.style[N];if(G){T.style[N]="";}I=apf.getStyleRecur(T,N);M=N.match(/color/i)?true:false;}F[N]={type:N,from:(M?String:parseFloat)(G?R:I),to:(M?String:parseFloat)(G?I:R),color:M,needsPx:apf.tween.needsPix[N.toLowerCase()]||false};}}}for(var V in F){K.tweens.push(F[V]);}if(G){apf.setStyleClass(T,W);}return this.multi(T,K);},cssRemove:function(l,i,j){this.css(l,i,j,true);},needsPix:{left:true,top:true,bottom:true,right:true,width:true,height:true,fontSize:true,lineHeight:true,textIndent:true},cssProps:"|backgroundColor|backgroundPosition|color|width|filter|                |height|left|top|bottom|right|fontSize|                |letterSpacing|lineHeight|textIndent|opacity|                |paddingLeft|paddingTop|paddingRight|paddingBottom|                |borderLeftWidth|borderTopWidth|borderRightWidth|borderBottomWidth|                |borderLeftColor|borderTopColor|borderRightColor|borderBottomColor|                |marginLeft|marginTop|marginRight|marginBottom|"};apf.draw={initDriver:function(){if(!this.initLayer){var d,i=apf.supportVML?apf.draw.vml:apf.draw.canvas;for(d in i){this[d]=i[d];}}},basevars:function(){return["var  _math_,v,t=0,n=(new Date()).getTime()*0.001",",e=Math.E, p=Math.PI, p2=2*p, p12=0.5*p",",x, y, z, _x,_y,_z, zt, i, j, k, _opt_;"].join("");},vars:function(l,j,n,m){return["var  _math_,vx1 = v.vx1, vy1 = v.vy1,_rseed=1",",vx2 = v.vx2, vy2 = v.vy2, vw = vx2-vx1, vh = vy1-vy2",",vz2 = v.vz2, vz1 = v.vz1, vd = vz2-vz1",",zoom = 1/v.zoom",",a=v.a,b=v.b,c=v.c,d=v.d",",dw = l.dw",l?"-"+(l+n):"",",dh = l.dh",j?"-"+(j+m):"",",dw12 = dw*0.5, dh12 = dh*0.5",",dzw = dw/v.zoomx, dzh = -dh/v.zoomy",",dx = ",l?l:0,",dy = ",j?j:0,",mx = m&&m.x, my = m&&m.y",",db = dy+dh, dr = dx+dw",",tw = dw/vw, th = dh/vh, ty = -vy2*th+dy, tx = -vx1*tw+dx",",v,t=0,nt=0,n=(new Date()).getTime()*0.001, dt=-(l._n?l._n:n)+(l._n=n)",",e=Math.E, p=Math.PI, p2=2*p, p12=0.5*p",",x, y = 0, z = 0, _x,_y,_z, zt, i, j, k, _opt_, _anim = 0,","_storelut,_storelist,_translut,_speedlut,_overlaylut;"].join("");},defCamVec:function(){return"var inv=1/m00*(m11*m22-m12*m21)-m01*(m10*m22-m12*m20)+m02*(m10*m21-m11*m20);var mcx = inv*(m11*m22-m12*m21)*m03 + inv*(m02*m21-m01*m22)*m13 + inv*(m01*m12-m02*m11)*m23,    mcy = inv*(m12*m20-m10*m22)*m03 + inv*(m00*m22-m02*m20)*m13 + inv*(m02*m10-m00*m12)*m23,    mcz = inv*(m10*m21-m11*m20)*m03 + inv*(m01*m20-m00*m21)*m13 + inv*(m00*m11-m01*m10)*m23;";},setMatrix3D:function(i){var l=this.l;var j=["var m00=",i[0],",m01=",i[1],",m02=",i[2],",m03=",i[3],",m10=",i[4],",m11=",i[5],",m12=",i[6],",m13=",i[7],",m20=",i[8],",m21=",i[9],",m22=",i[10],",m23=",i[11],";"];if(l.p3d<0){this.ortho=1;j.push("var persp = dw / v.p3d/-v.tz, perspd = persp / ",l.ds,";");}else{this.ortho=0;j.push("var persp = dw / v.p3d, perspd = persp / ",l.ds,";");}return j.join("");},sincos3:function(l,m,n,j){return["var ",l,"cx = __cos(",m,"),",l,"sx = __sin(",m,"),",l,"cy = __cos(",n,"),",l,"sy = __sin(",n,"),",l,"cz = __cos(",j,"),",l,"sz = __sin(",j,");"].join("");},matrix4S:function(j,l,i){return[j,0,0,0,0,l,0,0,0,0,i,0,0,0,0,1];},matrix4T:function(l,i,j){return[1,0,0,l,0,1,0,i,0,0,1,j,0,0,0,1];},matrix4RP:function(c){return this.matrix4R(c+"cx",c+"sx",c+"cy",c+"sy",c+"cz",c+"sz");},matrix4R:function(n,m,o,q,s,t){return[[o,"*",s].join(""),["(-",t,"*",o,")"].join(""),q,0,["(",s,"*",m,"*",q,"+",t,"*",n,")"].join(""),["(-",m,"*",q,"*",t,"+",n,"*",s,")"].join(""),["(-",m,"*",o,")"].join(""),0,["(-",n,"*",q,"*",s,"+",m,"*",t,")"].join(""),["(",n,"*",q,"*",t,"+",s,"*",m,")"].join(""),["(",n,"*",o,")"].join(""),0,0,0,0,1];},matrixMul:function(){var d=arguments[arguments.length-1];for(var i=arguments.length-2;i>=0;i--){d=this.matrixAB(d,arguments[i]);}return d;},matrixAB:function(i,j){var A=[],a,t,w,z,B,C;for(t=0;t<16;t+=4){for(a=0;a<4;a++){C=[];if((w=i[t])&&(z=j[a])){C[C.length]=w==1?z:(z==1?w:(w+"*"+z));}if((w=i[t+1])&&(z=j[a+4])){C[C.length]=w==1?z:(z==1?w:(w+"*"+z));}if((w=i[t+2])&&(z=j[a+8])){C[C.length]=w==1?z:(z==1?w:(w+"*"+z));}if((w=i[t+3])&&(z=j[a+12])){C[C.length]=w==1?z:(z==1?w:(w+"*"+z));}A[A.length]=C.length?((C.length>1)?"("+C.join("+")+")":C[0]):0;}}return A;},backface3D:function(C,c,a){var u=C[0],w=C[1],A=C[2],t=0,z=1,B=2;if(c){t=c[0],z=c[1],B=c[2];}return this.ortho?["-((m00*",w[t],"+m01*",w[z],"+m02*",w[B],"+m03)-(__ax=m00*",u[t],"+m01*",u[z],"+m02*",u[B],"+m03))*","((m10*",A[t],"+m11*",A[z],"+m12*",A[B],"+m13)-(__ay=m10*",u[t],"+m11*",u[z],"+m12*",u[B],"+m13))+","((m10*",w[t],"+m11*",w[z],"+m12*",w[B],"+m13)-__ay)*((m00*",A[t],"+m01*",A[z],"+m02*",A[B],"+m03)-__ax)"].join(""):["(((__by=m10*",w[t],"+m11*",w[z],"+m12*",w[B],"+m13) - (__ay=m10*",u[t],"+m11*",u[z],"+m12*",u[B],"+m13)) *","((__cz=m20*",A[t],"+m21*",A[z],"+m22*",A[B],"+m23) - (__az=m20*",u[t],"+m21*",u[z],"+m22*",u[B],"+m23)) -","((__bz=m20*",w[t],"+m21*",w[z],"+m22*",w[B],"+m23) - __az) * ((__cy=m10*",A[t],"+m11*",A[z],"+m12*",A[B],"+m13) - __ay) ) * ","(__ax=m00*",u[t],"+m01*",u[z],"+m02*",u[B],"+m03) + ","((__bz - __az) * ((__cx=m00*",A[t],"+m01*",A[z],"+m02*",A[B],"+m03) - __ax) -","((__bx=m00*",w[t],"+m01*",w[z],"+m02*",w[B],"+m03) - __ax) * (__cz - __az) ) * __ay + ","((__bx - __ax) * (__cy - __ay) - (__by - __ay) * (__cx - __ax) ) * __az "].join("");},text3D:function(M,W,T,Q){var s=0,q,J,O,K=["__n=0;"],R=0,U=1,V=2,i,z,N,P,d,X;if(W){R=W[0],U=W[1],V=W[2];}return["if((__z = m20*",M[R],"+m21*",M[U],"+m22*",M[V],"+m23) < ",T,"){",this.text(["dw12+(m00*",M[R],"+m01*",M[U],"+m02*",M[V],"+m03)*",this.ortho?"persp":"(persp/__z)"].join(""),["dh12+(m10*",M[R],"+m11*",M[U],"+m12*",M[V],"+m13)*",this.ortho?"persp":"(persp/__z)"].join(""),Q),"}"].join("");},poly3DClip:function(K,z,Y,V,T){var s=0,i,M,z,P,N=["__n=0;"],U=0,W=1,X=2,R,q,O,Q,d,Z;if(Y){U=Y[0],W=Y[1],X=Y[2];}for(var s=0;s<K.length;s++){M=z[K[s]];N.push(["if(__n",s,"=(__z",s," = m20*",M[U],"+m21*",M[W],"+m22*",M[X],"+m23) < ",V,")__n++;"].join(""));}N.push("if(__n){","if(__n==",K.length,"){");for(var s=0;s<K.length;s++){M=z[K[s]];O=["dw12+(m00*",M[U],"+m01*",M[W],"+m02*",M[X],"+m03)*",this.ortho?"persp":"(persp/__z"+s+")"].join("");Q=["dh12+(m10*",M[U],"+m11*",M[W],"+m12*",M[X],"+m13)*",this.ortho?"persp":"(persp/__z"+s+")"].join("");if(s==0){N.push(this.moveTo(O,Q));}else{N.push(this.lineTo(O,Q));}}if(!T){N.push(this.close());}N.push("}else{");for(var s=0;s<K.length;s++){M=z[K[s]];if(s==0){N.push(["__x0=m00*",M[U],"+m01*",M[W],"+m02*",M[X],"+m03;","__y0=m10*",M[U],"+m11*",M[W],"+m12*",M[X],"+m13;","if( __o=__n0){",this.moveTo("dw12+__x0*"+(this.ortho?"persp":"(persp/__z0)"),"dh12+__y0*"+(this.ortho?"persp":"(persp/__z0)")),"}"].join(""));}else{N.push(["__xn=dw12+(__x",s,"=m00*",M[U],"+m01*",M[W],"+m02*",M[X],"+m03)*",(this.ortho?"persp;":"(persp/__z"+s+");"),"__yn=dh12+(__y",s,"=m10*",M[U],"+m11*",M[W],"+m12*",M[X],"+m13)*",(this.ortho?"persp;":"(persp/__z"+s+");"),"if( __n",s," && !__n",s-1," || !__n",s,"&& __n",s-1,"){","__z=(__zc=(",V,"-__z",s-1,")/(__z",s,"-__z",s-1,")) * __z",s,"+(__ze=1-__zc)* __z",s-1,";","__xi=dw12+(__zc*__x",s,"+__ze* __x",s-1,")*",(this.ortho?"persp":"(persp/__z)"),";","__yi=dh12+(__zc*__y",s,"+__ze* __y",s-1,")*",(this.ortho?"persp":"(persp/__z)"),";","if(!__o){__o=true;",this.moveTo("__xi","__yi"),"}else{",this.lineTo("__xi","__yi"),"}","}","if( __n",s,"){",this.lineTo("__xn","__yn"),"}"].join(""));}if(s==K.length-1){N.push(["if(!__n0 && __n",s," || __n0 && ! __n",s,"){","__z=(__zc=(",V,"-__z",s,")/(__z0-__z",s,")) * __z0+(__ze=1-__zc)* __z",s,";",this.lineTo(["dw12+(__zc*__x0+__ze* __x",s,")*",(this.ortho?"persp":"(persp/__z)")].join(""),["dh12+(__zc*__y0+__ze* __y",s,")*",(this.ortho?"persp":"(persp/__z)")].join("")),"}",T?"":this.close()].join(""));}}N.push("}};");return N.join("").replace(/m\d\d\*\(?0\)?\+/g,"");},poly3D:function(i,R,s){var j,O=1,P,q=0,M,T,N,d=[],J=new Array(R.length),K=new Array(R.length),Q,G,I;if(s){Q=s[0],G=s[1],I=s[2];}else{Q=0,G=1,I=2;}for(P=0;P<i.length;P++){M=i[P];if(M>=0){J[M]++;}}for(P=0;P<R.length;P++){if(J[P]>1){J[P]=q++;}else{J[P]=0;}}for(var P=0;P<i.length;P++){M=i[P];if(M>=0){T=R[M];N=[this.ortho?"":"zt = persp / ((zt=(m20*"+T[Q]+"+m21*"+T[G]+"+m22*"+T[I]+"+m23)<-0.01)?zt:-0.01);","dw12+(m00*"+T[Q]+"+m01*"+T[G]+"+m02*"+T[I]+"+m03)*"+(this.ortho?"persp":"zt"),"dh12+(m10*"+T[Q]+"+m11*"+T[G]+"+m12*"+T[I]+"+m13)*"+(this.ortho?"persp":"zt")];M=O?0:P;if(J[M]){N[1]="__t"+J[M]+(K[M]?"":"="+N[1]),N[2]="__t"+J[M]+(K[M]++?"":"="+N[2]);}}switch(M){case -1:O=1;d.push(this.close());break;case 0:O=0;d.push(N[0],this.moveTo(N[1],N[2]));break;case i.length-1:d.push(N[0],this.lineTo(N[1],N[2]),this.close());break;default:d.push(N[0],this.lineTo(N[1],N[2]));break;}}return d.join("").replace(/m\d\d\*\(?0\)?\+/g,"");},lineTo3D:function(n,m,q,o,s,t){return this.$do3D("lineTo",n,m,q,o,s,t);},moveTo3D:function(n,m,q,o,s,t){return this.$do3D("moveTo",n,m,q,o,s,t);},$store3D:function(d,i){return d+";"+i+";";},store3D:function(n,m,q,o,s,t){return this.$do3D("$store3D",n,m,q,o,s,t);},$do3D:function(G,w,C,D,z,B,K){var A,E,F;if(typeof w=="string"&&w.match(/[\[\]\*\+\-\/]/)){w="(_x="+w+")",A="_x";}else{w="("+w+")",A=w;}if(typeof C=="string"&&C.match(/[\[\]\*\+\-\/]/)){C="(_y="+C+")",E="_y";}else{C="("+C+")",E=C;}if(typeof D=="string"&&D.match(/[\[\]\*\+\-\/]/)){D="(_z="+D+")",F="_z";}else{D="("+D+")",F=D;}if(K){var J=[w,C,D],M=[A,E,F];w=J[A=K[0]],C=J[E=K[1]],D=J[F=K[2]];A=M[A],E=M[E],F=M[F];}var I=[];if(!this.ortho){I.push("zt =persp/((zt=m20*"+w+"+m21*"+C+"+m22*"+D+"+m23)<-0.01?zt:-0.01);");}I.push(this[G]((z===undefined?"":z)+"dw12+(m00*"+A+"+m01*"+E+"+m02*"+F+"+m03)*"+(this.ortho?"persp":"zt"),(B===undefined?"":B)+"dh12+(m10*"+A+"+m11*"+E+"+m12*"+F+"+m13)*"+(this.ortho?"persp":"zt")));return I.join("").replace(/m\d\d\*\(?0\)?\+/g,"");},parseStyle:function(Z,T,aa){var i={},U,P,s,X,o,j,n,R,Q;var ac=this;if(!(o=ac.stateTransition)[262145]){X={};for(P in o){for(j=0;j<32;j++){X[P|j]=o[P]|j;}}ac.stateTransition=X;}T=T?this.parseJSS(T.item?T.join(""):T,aa):{};function t(q,u,w){var a,c,d,l;for(c in u){if(q[c]===undefined){q[c]=ac.isDynamic(d=u[c])?ac.parseJSS(d):d;}}if(a=u.inherit){t(q,Z[a]||ac["$"+a],a);}if(l=T[w]){for(c in l){q[c]=l[c];}}}for(s in Z){if(typeof(P=Z[s])=="object"&&P!==null&&P["$"]==1){t(i[s]={},P,s);}}function V(q,l,u,w){var d,a,c;do{if(!u&&!w){d=i[l];}else{d=T[l+(u?"."+u:"")+(w?":"+w:"")];}if(typeof(d)=="object"){for(c in d){if(c.indexOf("$")==-1&&q[c]===undefined){q[c]=d[c];}}}if(w){w=ac.$stateInherit[a];}}while(w);}for(s in T){if(typeof(P=T[s])=="object"){o=s.match(/([\w\_-]+)\.?([\w\_-]+)?\:?([\w\_-]+)?/);var Y=o[1],ad=o[2],ab=o[3];if(ad||ab){U=i[s]={};if(ab){if(ad){V(U,Y,ad,ab);}V(U,Y,0,ab);}if(ad){V(U,Y,ad,0);}V(U,Y,0,0);U.$cls=ad?ad:"",U.$state=ab?ab:"";U.$base=X=i[Y];if(!X){alert("ERROR, baseless style found: "+Y);return;}(X.$stylelist?X.$stylelist:(X.$stylelist=[])).push(U);if(!ad){(X.$baselist?X.$baselist:(X.$baselist={}))[ab]=1;}else{(X.$clslist?X.$clslist:(X.$clsc=1,X.$clslist={}))[ad]=X.$clsc++;}}}}function m(a){if(a.stroke===null||a.stroke=="null"||a.stroke==0){delete a.stroke;}if(a.fill===null||a.fill=="null"||a.fill==0){delete a.fill;}if(a.family===null||a.family=="null"||a.family==0){delete a.family;}if((a.isshape&&a.fill===undefined&&a.stroke===undefined&&a.tile===undefined)||(a.isfont&&a.family===undefined)){return false;}if(a.isshape){a.opacity=a.opacity!==undefined?a.opacity:1;a.fillopacity=a.fillopacity!==undefined?a.fillopacity:a.opacity;a.gradopacity=a.gradopacity!==undefined?a.gradopacity:a.fillopacity;a.strokeopacity=a.strokeopacity!==undefined?a.strokeopacity:a.opacity;a.angle=a.angle!==undefined?a.angle:0;a.weight=a.weight!==undefined?a.weight:1;}return true;}for(s in i){if(typeof(X=i[s])=="object"){if(X.$baselist&&X.$clslist){delete X.$clsc;for(j in X.$clslist){for(n in X.$baselist){if(!i[o=s+"."+j+":"+n]){if((Q=i[s+":"+n])&&Q.overlay){(Q.$clsovl?Q.$clsovl:Q.$clsovl=[]).push(j);}else{i[o]=U={};for(P in (o=i[s+"."+j])){U[P]=o[P];}for(P in (o=T[s+":"+n])){U[P]=o[P];}U.$cls=j,U.$state=n,U.$base=X;m(U);X.$stylelist.push(U);}}}}}if(X.$stylelist){X.$storelut={};X.$speedlut={};X.$overlaylut={};var ad,ab,T,W;n=X.$stylelist;for(j=0;j<n.length;j++){U=n[j];ad=X.$clslist?(X.$clslist[U.$cls]||0):0;ab=apf.draw.stateBit[U.$state]||0;U.$lutvalue=ab|ad;U.$store=R;if(o=U.overlay){if(o=="base"){T=ad?ad:268435456;}else{T=(X.$clslist?(X.$clslist[o]||0):0)|(apf.draw.stateBit[o]||0);}}else{T=0;}X.$storelut[ab|ad]=j;X.$speedlut[ab|ad]=U.speed||1;if(T){X.$overlaylut[ab|ad]=T;}if(U.$clsovl){for(Q=U.$clsovl.length-1;Q>=0;Q--){ad=X.$clslist?(X.$clslist[U.$clsovl[Q]]||0):0;X.$storelut[ab|ad]=j;X.$speedlut[ab|ad]=U.speed||1;if(T){X.$overlaylut[ab|ad]=(T==268435456)?ad:T;}}}}}if(!m(X)){delete i[s];}}}return i;},stateBit:{0:0,init:16777216,hidden:65536,deinit:33554432,hover:131072,hoverin:16908288,hoverout:33685504,select:196608,selectin:16973824,selectout:33751040,selecthover:262144,selecthoverin:17039360,selecthoverout:33816576,animating:50659328},stateTransition:{16777216:0,33554432:65536,16908288:131072,33685504:0,16973824:196608,33751040:0,17039360:262144,33816576:196608,17104896:17104896},stateMask:{selected:16777216|8388608|2097152|1048576|524288,normal:536870912|134217728|67108864|33554432|262144,dynamic:536870912|268435456|67108864|33554432|8388608|4194304|1048576|524288|262144,hover:134217728|67108864|2097152|1048576},$stateInherit:{hidden:0,init:0,deinit:0,hover:0,hoverin:"hover",hoverout:"hover",select:0,selectin:"select",selectout:"select",selecthover:"hover",selecthoverin:"selecthover",selecthoverout:"selecthover",animating:0},$stateFallback:{init:1,hover:1,hoverin:"hover",hoverout:1,select:1,selectin:"select",selectout:1,selecthover:"hover",selecthoverin:"selecthover",selecthoverout:"select",hidden:1},getXYWH:function(j,l,m){var n;if(!((n=this.$getXYWH_NT[l])||(l=this.$getXYWH_TN[n=l]))){return"0";}if(j==null){return"0";}if(typeof(j)=="object"){if(j.sort){return --l>=j.length?"0":((n=j[l])&&n.sort&&!m?n.join(""):n);}return(n=j[n])===undefined||l>1?"0":(n&&n.sort&&!m?n.join(""):n);}return l==1?j:"0";},$getXYWH_NT:{1:"x",2:"y",3:"z",4:"w"},$getXYWH_TN:{x:1,y:2,z:3,w:4},getTRBL:function(j,l,m){var n;if(!((n=this.$getTRBL_NT[l])||(l=this.$getTRBL_TN[n=l]))){return"0";}if(j==null){return"0";}if(typeof(j)=="object"){if(j.sort){return --l>=j.length?"0":((n=j[l])&&n.sort&&!m?n.join(""):n);}return(n=j[n])===undefined||l>1?"0":(n&&n.sort&&!m?n.join(""):n);}return l==1?j:"0";},$getTRBL_NT:{1:"t",2:"r",3:"b",4:"l"},$getTRBL_TN:{t:1,y1:1,r:2,x2:2,b:3,y2:3,l:4,x1:4},getFlat:function(c){if(typeof(c)=="object"&&c.sort){return c.join("");}return c;},getColor:function(a){if(a.match(/\(/)){return a;}if(a.match(/^#/)){return"'"+a+"'";}var i=a.toLowerCase();return(this.colors[i])?"'"+this.colors[i]+"'":a;},getX:function(s,o,n,t,q){var m;return(typeof(m=s[n+"-x"])=="undefined"&&(typeof(m=s[n])!="object"||typeof(m=m[0])=="undefined"))?(typeof(q)!="undefined"?q:""):(o+m+t);},getY:function(t,q,n,u,s,w){var o;return(typeof(o=t[n+"-y"])=="undefined"&&(typeof(o=t[n])!="object"||typeof(o=o[1])=="undefined"))?(typeof(s)!="undefined"?s:""):(q+o+u);},checkX:function(o,m,q,n){var l;return(typeof(l=o[m+"-x"])=="undefined"&&(typeof(l=o[m])!="object"||typeof(l=l[0])=="undefined"))?(typeof(n)=="undefined"?"":n):q;},checkY:function(o,m,q,n){var l;return(typeof(l=o[m+"-y"])=="undefined"&&(typeof(l=o[m])!="object"||typeof(l=l[1])=="undefined"))?(typeof(n)=="undefined"?"":n):q;},isDynamic:function(a){return a&&typeof(a)=="string"&&!(a.indexOf(".")!=-1&&a.match(/^[\s:a-zA-Z0-9\/\\\._-]+$/))&&a.match(/[\(+*\/-]/)!=null;},baseMacro:function(i){for(var q=i.length,o=0,n;o<q;o++){if(typeof(n=i[o])=="object"){i[o]=this.parseJSS(n[0]);}}var j=this.optimize([this.basevars(),i.join(""),]);return j;},optimize:function(o){var s,n,q=[],t={},m=0;if(typeof(o)=="object"){o=o.join("");}o.replace(/\_\_(\w+)/g,function(c,a){if(!t[a]){if(a.length<=2){q.push("__"+a);}else{q.push("__"+a+"=Math."+a);}t[a]=1;}});o=o.replace(/(__(\w+))\((\-?\d+\.?\d*)\)/g,function(d,c,i,a){if(c=="__round"){return Math.round(a);}return Math[i](a);});if(o.match("_rndtab")){q.push("_rndtab=apf.draw.$rndtab");}o=q.length?o.replace(/\_math\_/,q.join(",")):o;t={},m=0,q=[];o=q.length?o.replace(/\_opt\_/,q.join(",")):o;o=o.replace(/__round\((d[wh])\)/g,"$1");return o;},parseJSS:function(ad,aj,Z,ac){if(!ad){return{};}var s=true;var ag=0,R=0,U,X,V,ah=0,i=[],ai=[],af=[],t=[],Q=[],T=[],W=Z||{},al=0,aa=[],ak=this,Y={1:"}",2:")",3:"]",4:")",5:"}"},ab={"{":1,"(":2,"[":3},ae=6;try{ad=ad.replace(/\/\*[\S\s]*?\*\/|\/\/.*?;/g,"");ad.replace(/(["'])|(\^)|([\w\.\_]+\:?[\w\_\s-]*)\s*\{\s*|([\w\_]+)\s*[:]+\s*|([\w\.\_]+)\s*\(\s*|(\#[0-9a-zA-Z]+|0x[0-9a-zA-Z]+)|(\d+\.?\d*[\_a-zA-Z]+)|([({\[])|([)}\]])|(\\["'{}\[\](),;\:]|\s*[\<\>\=*+\%@&\/]\s*|\s*\-\s+)|([,\s]+)|(;)|$/g,function(B,m,A,q,z,j,u,o,w,c,d,a,n,l){if(d||u){return B;}if(R||m){if(m&&!R){R=m;}else{if(R==m){R=0;}}return B;}if(a){t.push(ad.slice(ag,l));ai.push(t.join(""));ag=l+a.length,t=[];return B;}if(z){if(ae>=5){ae=6,al=z,ag=l+B.length;ai=[],t=[];}return B;}if(o){t.push(ad.slice(ag,l));U=B.match(/(\d\.?\d*)(.+)/);t.push(U[1],"*",U[2]);ag=l+B.length;return B;}if(j){T.push(ae=4);if(l>ag){t.push(ad.slice(ag,l));}if(t.length&&t[t.length-1].match(/\)\s*$/)){t.push("*");}if(U=j.match(/(\d\.?\d*)(.+)/)){t.push(U[1]+"*");j=U[2];}Q.push(t);af.push(ai);i.push(ah);ah=j;ai=[],t=[],ag=l+B.length;return B;}if(q){if(ae<5){throw ({t:"JSS Error - object scope found inside macro",p:l});}ag=l+B.length;T.push(ae=5);(q=q.replace(/^\s*/,"").replace(/\s*$/,"").split(" ")).length>1?(q=q[1]+"@"+q[0]):q=q[0];aa.push(W);W=(typeof(U=W[q])=="object")?U:(W[q]={});return B;}if(w){T.push(ae=ab[w]);if(ae==1&&al){T.pop();ag=l+B.length;T.push(ae=5);aa.push(W);W=(typeof(U=W[al])=="object")?U:(W[al]={});}else{if(ae==3){if(l>ag){t.push(ad.slice(ag,l));}Q.push(t);af.push(ai);ai=[],t=[],ag=l+w.length;}}return B;}if(c){if(!T.length||Y[ae=T.pop()]!=c){throw ({t:"JSS Error - closed "+ae+" with "+c,p:l});log();}switch(ae){case 3:t.push(ad.slice(ag,l));ai.push(t.join(""));if(af.length!=1){(t=Q.pop()).push("[",ai.join(","),"]");ai=af.pop();}else{Q.pop();U=af.pop();t=[];for(X=0,V=ai.length;X<V;X++){U.push(ai[X]);}ai=U;}ag=l+c.length;break;case 4:t.push(ad.slice(ag,l));ai.push(t.join(""));(t=Q.pop()).push((U=ak[ah])?U.apply(ak,ai):ah+"*("+ai.join(",")+")");ai=af.pop(),ah=i.pop(),ag=l+1;break;case 5:t.push(ad.slice(ag,l));ai.push(t.join(""));ag=l+c.length,t=[];if(al){W[al]=ai.length>1?ai:ai[0];}ai=[],al=null,W=aa.pop();break;}if(!af.length){ae=6;}return B;}if(ae>=5){t.push(ad.slice(ag,l));if((U=t.join("")).length){ai.push(U);}ag=l+B.length,t=[];if(al){W[al]=ai.length>1?ai:ai[0];}else{if(U&&T.length==0){W=ai.length>1?ai:ai[0];}}ai=[],al=null;}return B;});if(R){throw ({t:"JSS Error - Unclosed string found "+R,p:ag});}if(T.length>0){throw ({t:"JSS Error - Unclosed object found "+T[T.length-1],p:ag});}}catch(P){apf.alert_r(P);if(aj){aj.v=P.p>=0?P.t+" at: "+P.p+" ->"+ad.slice((U=P.p-4)<0?0:U,7)+"<-":P.t;}return null;}return W;},sin:function(a){return"__sin("+a+")";},cos:function(a){return"__cos("+a+")";},tan:function(a){return"__tan("+a+")";},asin:function(a){return"__asin("+a+")";},acos:function(a){return"__acos("+a+")";},atan:function(a){return"__atan("+a+")";},atan2:function(a){return"__atan2("+a+")";},floor:function(a){return"__floor("+a+")";},exp:function(a){return"__exp("+a+")";},log:function(a){return"__log("+a+")";},pow:function(a,i){return"__pow("+a+","+i+")";},random:function(a){return"__random("+a+")";},round:function(a){return"__round("+a+")";},sqrt:function(a){return"__sqrt("+a+")";},$pal:function(t,i){var o=["'#'+('000000'+(__round(","((__a=parseInt((__t=["];for(var q=2,n=arguments.length;q<n;q++){var s=arguments[q];o.push(q>2?",":"");if(apf.draw.colors[s]){o.push("'",apf.draw.colors[s],"'");}else{if(s.match(/\(/)){o.push(s);}else{if(s.match(/^#/)){o.push("'",s,"'");}else{o.push(s);}}}}if(t&2){o.push("])[ (__g=__floor( __c=(__f=(",i,")",(t&1)?"*"+(n-3):"",")<0?0:__f))>",n-3,"?",n-3,":__g].slice(1),16))&0xff)","*(__d=1-(__c-__floor(__c)))","+((__b=parseInt(__t[ (__g=__ceil(__c))>",n-3,"?",n-3,":__g","].slice(1),16))&0xff)*(__e=1-__d) )","+(__round(__d*(__a&0xff00)+__e*(__b&0xff00))&0xff00)","+(__round(__d*(__a&0xff0000)+__e*(__b&0xff0000))&0xff0000)",").toString(16)).slice(-6)");}else{o.push("])[ __floor( __c=(__f=(",i,")",t?"*"+(n-3):"",")<0?-__f:__f)%",n-2,"].slice(1),16))&0xff)","*(__d=1-(__c-__floor(__c)))","+((__b=parseInt(__t[ __ceil(__c)%",n-2,"].slice(1),16))&0xff)*(__e=1-__d) )","+(__round(__d*(__a&0xff00)+__e*(__b&0xff00))&0xff00)","+(__round(__d*(__a&0xff0000)+__e*(__b&0xff0000))&0xff0000)",").toString(16)).slice(-6)");}return o.join("");},$lut:function(n,s){var a=["(["],q,i=2,t=arguments.length;for(;i<t;i++){q=arguments[i];a.push(i>2?",":"");if(typeof(q)=="string"&&q.match(/\(/)||q.match(/^['"]/)){a.push(q);}else{a.push("'",q,"'");}}a.push("])[__floor((__b=((",s,")",n?"*"+(t-3):"",")%",t-2,")<0?-__b:__b)]");return a.join("");},$lin:function(n,s){var a=["((__t=["],q,i=2,t=arguments.length;for(;i<t;i++){q=arguments[i];a.push(i>2?",":"");if(typeof(q)=="string"&&q.match(/\(/)||q.match(/^['"]/)){a.push(q);}else{a.push("'",q,"'");}}a.push("])[__floor( __c=(__f=(",s,")",n?"*"+(t-3):"",")<0?-__f:__f)%",t-2,"]","*(__d=1-(__c-__floor(__c)))","+__t[ __ceil(__c)%",t-2,"]*(__e=1-__d) )");return a.join("");},fixed:function(l,j,a){j="parseFloat(("+l+").toFixed("+j+"))";return parseInt(a)?this.nozero(l,j):j;},padded:function(l,j,a){j="("+l+").toFixed("+j+")";return parseInt(a)?this.nozero(l,j):j;},abs:function(a){if(parseFloat(a)==a){return Math.abs(a);}if(typeof(a)=="number"||a.match(/$[a-z0-9_]+^/)){return"("+a+"<0?-"+a+":"+a+")";}return"((__t="+a+")<0?-__t:__t)";},min:function(o,s){if(s===null){return o;}if(parseFloat(o)==o&&parseFloat(s)==s){return Math.min(o,s);}var q=o,a=s,t=o,n=s;if(typeof(o)=="string"&&!o.match(/$-?[a-z0-9\_]+^/)){q="(__a="+o+")",t="__a";}if(typeof(s)=="string"&&!s.match(/$-?[a-z0-9\_]+^/)){a="(__b="+s+")",n="__b";}return"(("+q+")<("+a+")?"+t+":"+n+")";},max:function(o,s){if(s===null){return o;}if(parseFloat(o)==o&&parseFloat(s)==s){return Math.max(o,s);}var q=o,a=s,t=o,n=s;if(typeof(o)=="string"&&!o.match(/$-?[a-z0-9\_]+^/)){q="(__c="+o+")",t="__c";}if(typeof(s)=="string"&&!s.match(/$-?[a-z0-9\_]+^/)){a="(__d="+s+")",n="__d";}return"(("+q+")>("+a+")?"+t+":"+n+")";},clamp:function(c,l,a){if(l===null||a==null){return c;}return this.max(this.min(c,a),l);},pal:function(){var c=Array.prototype.slice.call(arguments,0);c.unshift(1);return this.$pal.apply(this,c);},pali:function(){var c=Array.prototype.slice.call(arguments,0);c.unshift(0);return this.$pal.apply(this,c);},palc:function(){var c=Array.prototype.slice.call(arguments,0);c.unshift(3);return this.$pal.apply(this,c);},palci:function(){var c=Array.prototype.slice.call(arguments,0);c.unshift(2);return this.$pal.apply(this,c);},lin:function(){var c=Array.prototype.slice.call(arguments,0);c.unshift(1);return this.$lin.apply(this,c);},lini:function(){var c=Array.prototype.slice.call(arguments,0);c.unshift(0);return this.$lin.apply(this,c);},lut:function(){var c=Array.prototype.slice.call(arguments,0);c.unshift(1);return this.$lut.apply(this,c);},luti:function(){var c=Array.prototype.slice.call(arguments,0);c.unshift(0);return this.$lut.apply(this,c);},$rgbpack:function(j,l,i){return("#"+("000000"+(((j<0?0:(j>255?255:parseInt(j)))<<16)+((l<0?0:(l>255?255:parseInt(l)))<<8)+((i<0?0:(i>255?255:parseInt(i))))).toString(16)).slice(-6));},rgb:function(j,l,i){if(parseFloat(j)==j&&parseFloat(l)==l&&parseFloat(i)==i){return this.$rgbpack(j,l,i);}return["('#'+('000000'+(",(parseFloat(j)==j?((j<0?0:(j>255?255:parseInt(j)))<<16):"(((__t="+j+")<0?0:(__t>255?255:parseInt(__t)))<<16)"),"+",(parseFloat(l)==l?((l<0?0:(l>255?255:parseInt(l)))<<8):"(((__t="+l+")<0?0:(__t>255?255:parseInt(__t)))<<8)+"),"+",(parseFloat(i)==i?((i<0?0:(i>255?255:parseInt(i)))):"(((__t="+i+")<0?0:(__t>255?255:parseInt(__t))))"),").toString(16)).slice(-6))"].join("");},$hsvpack:function(m,n,t){var s,i=t*(1-n),q=t*(1-n*((s=Math.floor(((m<0?-m:m)%1)*6))?m-s:1-(m-s)));switch(s){case 6:case 0:return this.$rgbpack(t,q,i);case 1:return this.$rgbpack(q,t,i);case 2:return this.$rgbpack(i,t,q);case 3:return this.$rgbpack(i,q,t);case 4:return this.$rgbpack(q,i,t);default:case 5:return this.$rgbpack.rgb(t,i,q);}},hsv:function(j,l,i){if(parseFloat(r)==r&&parseFloat(g)==g&&parseFloat(b)==b){return this.$hsvpack(r,g,b);}return"apf.draw.$hsvpack("+j+","+l+","+i+");";},rgbf:function(j,l,i){return this.rgb(parseFloat(j)==j?j*255:"255*("+j+")",parseFloat(l)==l?l*255:"255*("+l+")",parseFloat(i)==i?i*255:"255*("+i+")");},nozero:function(l,j,a){return"(("+l+")>-0.0000000001 && ("+l+")<0.0000000001)?"+(a!==undefined?a:"''")+":("+(j!==undefined?j:l)+")";},$rndtab:null,rnd:function(l){if(l){if(!this.$rndtab){var a,i=this.$rndtab=Array(256);for(a=-256;a<256;a++){i[a]=Math.random();}}return"_rndtab[__round(("+l+")*255)%255]";}return"((_rseed=(_rseed * 16807)%2147483647)/2147483647)";},ang:function(a){if(a==parseFloat(a)){return a*(Math.PI/180);}return"(("+a+")*p/180)";},snap:function(a,i){return"(__round(("+a+")/(__t=("+i+")))*__t)";},rnds:function(a,i){return this.rnd(this.snap(a,i));},tsin:function(a){return"(0.5+0.5*__sin("+a+"))";},tcos:function(a){return"(0.5+0.5*__cos("+a+"))";},usin:function(a){return"(0.5-0.5*__sin("+a+"))";},ucos:function(a){return"(0.5-0.5*__cos("+a+"))";},two:function(a){return"(0.5+0.5*("+a+"))";},easein:function(d,i){if(!i){i="3";}return["__pow(",d,",",i,")"].join("");},easeout:function(d,i){if(!i){i="3";}return["(1-__pow(1-(",d,"),",i,"))"].join("");},ease:function(l,j,i){if(!j){j="3";}if(!i){i=j;}return["(0.5*((__a=2*(",l,"))<1?","__pow(__a,",j,"):","(2-__pow(2-__a,",i,"))))"].join("");},fontz:function(a,i){return(-a/i)+(this.ortho?"*perspd":"*(perspd/__z)");},$canJoin:function(a,i){if(a.isfont&&i.isfont){return a.join!=null&&i.join!=null&&a.family===i.family&&a.join===i.join&&a.height==i.height&&a.width==i.width&&a.align===i.align&&a.color===i.color&&a.size===i.size&&a.style===i.style;}if(a.isshape&&i.isshape){return a.join!=null&&i.join!=null&&a.stroke===i.stroke&&a.join===i.join&&a.weight==i.weight&&a.fill===i.fill&&a.fillopacity===i.fillopacity&&a.strokeopacity===i.strokeopacity&&a.angle===i.angle;}return false;},$shape:{isshape:true,stroke:null,fill:null,tilex:"(this.$tilex)",tiley:"(this.$tiley)"},$font:{isfont:true,height:12,family:"verdana",weight:"normal",color:"#00000",size:10},draw3D:function(o,d,n,t,s,q){return"";},beginMouseState:function(F,i,C,E){var j=[],u=this.l;this.mousestyle=F;this.mousethis=i;this.mousefunc=C;this.mousestates=[];var G=F.$statelist,s,t,l,D;if(!G||!G.length){return"";}G=this.mousestates=G.slice(0);if(G[0]!=F){G.unshift(F);}if(!u._mousestyles){u._mousestyles=[];}for(s=0,t=G.length;s<t;s++){D=(l=G[s])._mid=u._mousestyles.push(l)-1;if(l.$store){l.$store._mid=D;}}j.push("_s = l._mousestyles[",F._mid,"], _sh = _s.$statehash, _sp = _s.$speedhash;");return j.join("");},checkMouseState:function(z,t){var i=[],C,j,s,a=this.mousestates,B;if(!a||!a.length){for(j=2,s=arguments.length;j<s;j++){i.push(arguments[j]);}i.push(true);this.style=this.mousestyle;B=this.mousefunc.apply(this.mousethis,i);this.style=0;return B;}B=["t=(n-",t,")*(_sp[_t=_sh[",z,"]]||100000);"];for(j=2,s=arguments.length;j<s;j++){i.push(C="_s"+(j-1));B.push(C,"=",arguments[j],(j!=s-1)?",":";");}i.push(true);B.push("switch(_t?_t._mid:0){");for(j=0,s=a.length;j<s;j++){var A=a[j];this.style=A;if(a[j]){B[B.length]=["case ",A._mid,":{","/*"+apf.vardump(A,0,1)+"*/\n",this.mousefunc.apply(this.mousethis,i),"}break;"].join("");}}B.push("};");this.style=0;return B.join("");},$endMouseState:function(){this.mousestyle=0;return"";},shapedPart:function(O,m,N,C,D,K,G){var t=this.style;var I="0",M="1";var w=this.getX,J=this.getY,E=this.checkX,F=this.checkY;switch(t.shape){default:case"pie":if(w(t,"","scale","","1")!="1"){D=["_x5=(",w(t,"(","offset",")+"),"(",D,")","+",w(t,"(","center",")","0.5"),"*(_x3=",K,")",w(t,"*(1-(_x4=","scale","))"),")*p2"].join("");K="_x5+(_x3*_x4)*p2";}else{D=["_x5=(",w(t,"(","offset",")+"),"(",D,")",")*p2"].join("");K="_x5+("+K+")*p2";}if(J(t,"","scale","","1")!="1"){I=[J(t,"(","offset",")+"),J(t,"(","center",")","0.5"),J(t,"*(1-(_y4=","scale","))")].join("");M="_y4";}else{I=[J(t,"(","offset",")","0")].join("");M="1";}if(I!="0"){O="_x6=__sin(_y8=((_x9="+D+")+(_y9="+K+"))*0.5)*(_x8="+I+")*(_x7="+N+")+("+O+")"+w(t,"+_x7*(","move",")");m="_y6=__cos(_y8)*_x8*(_y7="+C+")+("+m+")"+J(t,"+_y7*(","move",")");N="_x7*(_x3="+M+")";C="_y7*_x3";D="_x9";K="_y9";}else{O="_x6=("+O+")";m="_y6=("+m+")";N=M=="1"?"("+N+")":"("+N+")*(_x3="+M+")";C=M=="1"?"("+C+")":"("+C+")*_x3";}if(G){return["if( ((_x1=((",O,")-mx)/(",N,"))*_x1+(_y1=((",m,")-my)/(",C,"))*_y1) < 1 ){","_x1=(p+__atan2(_x1,_y1));","if( ((_x2=(",D,")%p2)<0?(_x2=p2-_x2):_x2) >","((_y2=(",K,")%p2)<0?(_y2=p2-_y2):_y2) ){","if(_x1 >= _x2 || _x1<=_y2 )return x;","}else{","if(_x1 >= _x2 && _x1<=_y2 )return x;","}","}"].join("");}else{return[this.moveTo(O,m),this.ellipse("_x6","_y6",N,C,D,K,1),this.close()].join("");}}},shapedRect:function(w,z,t,B,E){var F=this.style;var G=this.getX,m=this.getY,C=this.checkX,D=this.checkY;function A(){if(G(F,"","scale","","1")!="1"){w=[G(F,"dzw*(","offset",")+"),"(",w,")","+",G(F,"(","center",")","0.5"),"*(_x3=",t,")",G(F,"*(1-(_x4=","scale","))"),G(F,"+_x3*(","move",")")].join("");t="_x3*_x4";}else{w=[G(F,"dzw*(","offset",")+"),"(",w,")",G(F,"+(_x3="+t+")*(","move",")")].join("");t=C(F,"move","_x3",t);}if(m(F,"","scale","","1")!="1"){z=[m(F,"dzh*(","offset",")+"),"(",z,")","+",m(F,"(","center",")","0.5"),"*(_y3=",B,")",m(F,"*(1-(_y4=","scale","))"),m(F,"+_y3*(","move",")")].join("");B="_y3*_y4";}else{z=[m(F,"dzh*(","offset",")+"),"(",z,")",m(F,"+(_y3="+B+")*(","move",")")].join("");B=D(F,"move","_y3",B);}}switch(F.shape){case"rect":default:if(!F.rotate){A();if(E){return["if( (_x9 = mx - (",w,"))>=0 && _x9<(",t,")&&","    (_y9 = my - (",z,"))>=0 && _y9<(",B,")) return x;",].join("");}return this.rect(w,z,t,B);}else{return["_x9=(_x8=(_x6=",G(F,"(","center",")","0.5"),"*(_x3=",t,"))*(",G(F,"(1-(_x4=","scale","))","0"),"-1))+_x3",C(F,"scale","*_x4"),";","_y9=(_y8=(_y6=",m(F,"(","center",")","0.5"),"*(_y3=",B,"))*(",m(F,"(1-(_y4=","scale","))","0"),"-1))+_y3",D(F,"scale","*_y4"),";",this.moveTo("(_cr=__cos(_t="+F.rotate+"))*_x8-(_sr=__sin(_t))*_y8+(_x5="+G(F,"(","offset",")+")+w+"+_x6)","_sr*_x8+_cr*_y8+(_y5="+m(F,"(","offset",")+")+z+"+_y6)"),this.lineTo("_cr*_x9-_sr*_y8+_x5","_sr*_x9+_cr*_y8+_y5"),this.lineTo("_cr*_x9-_sr*_y9+_x5","_sr*_x9+_cr*_y9+_y5"),this.lineTo("_cr*_x8-_sr*_y9+_x5","_sr*_x8+_cr*_y9+_y5"),this.close()].join("");}case"circle":A();if(E){return["if( (_x9 = mx - (",w,"))>=0 && _x9<(",t,")&&","    (_y9 = my - (",z,"))>=0 && _y9<(",B,")) return x;",].join("");}return F.pie?[this.moveTo("_x6="+w+"+(_x5=0.5*("+t+"))","_y6="+z+"+(_y5=0.5*("+B+"))"),this.ellipse("_x6","_y6","_x5","_y5",G(F,"","range",""),m(F,"","range","")),this.close()].join(""):[this.ellipse(w+"+(_x5=0.5*("+t+"))",z+"+(_y5=0.5*("+B+"))","_x5","_y5",G(F,"","range",""),m(F,"","range","")),this.close()].join("");break;case"polygon":if(F.frames){}else{return["_x3=((_x2=",m(F,"","range","","2*p"),")-(_x1=",G(F,"","range","","0"),"))/(",F.steps||10,");v=_x1;",this.moveTo("(_x4="+w+")+__sin(_x1)*(_x5="+t+")","(_y4="+z+")+__cos(_x1)*(_y5="+B+")"),"for(v=_x1+_x3;v<_x2;v+=_x3){",this.lineTo("_x4+__sin(_x1)*_x5","_y4+__cos(_x1)*_y5"),"}",this.close()].join("");}break;case"math":if(F.frames){}else{A();return["_x7=((_x6=",m(F,"","range","","2*p"),")-(_x5=",G(F,"","range","","0"),"))/(",F.steps||10,");v=_x5;",this.moveTo("(_x8="+w+")+"+G(F,"(","path",")","0")+"*(_x9="+t+")","(_y8="+z+")+"+m(F,"(","path",")","0")+"*(_y9="+B+")"),"for(v=_x5+_x7;v<_x6;v+=_x7){",this.lineTo("_x8"+G(F,"+(","path",")*_x9"),"_y8"+m(F,"+(","path",")*_y9")),"}",this.close()].join("");}break;}return"";},$endDraw:function(){if(this.mousemode){return this.$endMouse();}if(this.statemode){return this.$endState();}var c=this.style;if(c){if(c.isshape){return this.$endShape();}if(c.isfont){return this.$endFont();}}return"";},serializeStyleState:function(o){var q=[],s,t,n,m;if(!o.$stylelist){return"";}q.push("$storelist:_n=[",Array(o.$stylelist.length).join("[],"),"[]]");q.push(",$storelut:{");s=o.$storelut;m=1;for(n in s){q.push(--m?",":"","0x",parseInt(n).toString(16),":_n[",s[n],"]");}q.push("},$speedlut:{");s=o.$speedlut;m=1;for(n in s){q.push(--m?",":"","0x",parseInt(n).toString(16),":",s[n]);}q.push("},$overlaylut:{");s=o.$overlaylut;m=1;for(n in s){q.push(--m?",":"","0x",parseInt(n).toString(16),":0x",parseInt(s[n]).toString(16));}q.push("}");return q.join("");},beginState:function(B,s,w,A,i){var C=[this.beginShape(B.$shadow||B)];this.statemode=1;this.statethis=s;this.stateargs=A;this.statefunc=w;this.statedyns=i||[];this.statedyns.push("t","x");var n=B.$stylelist,u,z;if(!n||!n.length){return C.join("");}C.push("_storelut = _s.$storelut, _storelist = _s.$storelist,_overlaylut = _s.$overlaylut,","_translut = apf.draw.stateTransition, _speedlut = _s.$speedlut ;\n");for(u=0,z=n.length;u<z;u++){C[C.length]="_storelist["+u+"].length=";}C[C.length]="0;";return C.join("");},drawState:function(A,s){var a=[],B,i,j,C=this.style.$stylelist,d;if(!C||!C.length){for(i=2,j=arguments.length;i<j;i++){a.push(arguments[i]);}return this.statefunc.apply(this.statethis,a);}var t=["if((_t=",A,")&0x0f000000){","if((t=(n-(",s,"))*(_speedlut[_t]||100000))>1){","_t=",A,"=_translut[_t],",s,"=n,t=0;","}","if(_t&0x0f000000)_anim=1,nt=1-t;","}"];for(i=2,j=arguments.length;i<j;i++){a.push(B="_s"+(i-1));t.push(B,"=",arguments[i],(i!=j-1)?",":";");}d=this.statedyns.join(",");B=a.join(",");t.push("if(_st=_storelut[_t]){","_st.push(",d,",",B,");","while(_t=_overlaylut[_t]){","if(_st = _storelut[_t]){_st.push(",d,",",B,");}","};","};","if(!_st){",this.statefunc.apply(this.statethis,a),"}\n");return t.join("");},$endState:function(){this.statemode=0;var n=this.style,a=[this.$endDraw()];var i=n.$stylelist,s,D,E,d,l=this.stateargs+this.statedyns.length,j=[],m=[];if(!i||!i.length){return a.join("");}for(s=this.statedyns.length;s<l;s++){j.push("_su[_sv+"+s+"]");}for(s=0;s<this.statedyns.length;s++){m.push(this.statedyns[s]+"=_su[_sv+"+s+"]");}m=m.join(",");for(s=0,D=i.length;s<D;s++){n=i[s];a[a.length]=["if((_st=(_su=_storelist["+s+"]).length)>0){","_sv=0,",m,";",this.beginShape(n),"for(_sv=0;_sv<_st;_sv+=",l,"){",m,",nt = 1-t;",this.statefunc.apply(this.statethis,j),"}",this.$endDraw(),"}else _styles[",n._id,"]._path=[];\n"].join("");}return a.join("");},beginFont:function(B,s,w,C,A,t){if(!B||s===undefined){return"document.title='beginFont Failed';";}var z=this.l,u=z._htmljoin,l=[this.$endDraw()];this.style=B;B._id=z._styles.push(B)-1;w=w!==undefined?w/z.ds:0;C=C!==undefined?C/z.ds:0;A=A!==undefined?A/z.ds:0;t=t!==undefined?t/z.ds:0;if(parseInt(B.left)!=B.left){this.mx="+("+B.left+")"+(w?"-"+w:"");}else{this.mx="+"+(B.left-w);}if(parseInt(B.top)!=B.top){this.my="+("+B.top+")"+(C?"-"+C:"");}else{this.my="+"+(B.top-C);}this.dynsize=(parseInt(B.size)!=B.size);B._txtdiv=["<div style='",(B.vertical)?"filter: flipv() fliph(); writing-mode: tb-rl;":"","position:absolute;cursor:default;overflow:hidden;left:0;top:0;display:none;font-family:",B.family,";color:",B.color,";font-weight:",B.weight,";",";font-size:",this.dynsize?10:B.size,"px;",(B.stroke!==undefined)?"border:1px solid "+B.stroke+";":"",(B.fill!==undefined)?"background:"+B.fill+";":"",(B.width!==undefined)?"width:"+B.width+"px;":"",(B.height!==undefined)?"height:"+B.height+"px;":"",(B.style!==undefined)?"font-style:"+B.style+";":"",(B.align!==undefined)?"text-align:"+B.align+";":"","'>-</div>"].join("");u.push("<div onmousedown='return false' style='cursor:default;position:absolute;left:",w,"px;top:",C,"px;width:",z.width-(A+w),"px;height:",z.height-(t+C),"px;overflow:hidden;'></div>");l.push("_s=_styles[",B._id,"],_tn=_s._txtnodes,_tc = 0;\n");l.push("if((_l=(",s,")) > _tn.length-_tc)apf.draw.$allocText(_s,_l);");return l.join("");},text:function(j,l,m){var n=((this.l.ds>1)?"/"+this.l.ds:"");return["if( (_t=_tn[_tc++]).s!=(_v=",m,") )_t.v.nodeValue=_t.s=_v;","if(_t.x!=(_v=__round(",j,")))_t.n.style.left=_t.x=(_v",n,this.mx,")+'px';","if(_t.y!=(_v=__round(",l,")))_t.n.style.top=_t.y=(_v",n,this.my,")+'px';",this.dynsize?["if(_t.sz!=(_v=__round(",this.style.size,"))&&_v>0)_t.n.style.fontSize=_t.sz=_v+'px';"].join(""):""].join("");},$allocText:function(o,m){var q,l=o._domnode,n=o._txtnodes;if(!n.length){l.innerHTML=Array(m+1).join(o._txtdiv);}else{l.insertAdjacentHTML("beforeend",Array(m+1).join(o._txtdiv));}while(m-->0){q=l.childNodes[n.length];n.push({x:-10000000000,y:-10000000000,n:q,v:q.firstChild,sz:-1,s:null});}},$endFont:function(){this.last=this.style._id;this.style=0;this.mx="",this.my="";return"_s._txtcount = _tc;";},$finalizeFont:function(i){var d=["if((_lc=(_s=_styles[",i._id,"])._txtused)>","(_tc=_s._txtcount)){_tn=_s._txtnodes;","for(;_lc>_tc;)_tn[--_lc].n.style.display='none';","_s._txtused=_tc;","} else if(_lc<_tc) {_tn=_s._txtnodes;","for(;_lc<_tc;)_tn[_lc++].n.style.display='block';","_s._txtused=_tc;","}\n"];return d.join("");},colors:apf.color.colors};apf.date=(function(){return{masks:{"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"},i18n:{beginWeekday:1,dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNumbers:{Sun:0,Mon:1,Tue:2,Wed:3,Thu:4,Fri:5,Sat:6,Sunday:0,Monday:1,Tuesday:2,Wednesday:3,Thursday:4,Friday:5,Saturday:6},monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],monthNumbers:{Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11}}};})();apf.date.dateFormat=(function(){var j=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,n=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,l=/[^-+\dA-Z]/g,m=function(a,c){a=String(a);c=c||2;while(a.length<c){a="0"+a;}return a;};return function(Q,M,c){var o=apf.date;if(arguments.length==1&&(typeof Q=="string"||Q instanceof String)&&!/\d/.test(Q)){M=Q;Q=undefined;}Q=Q?new Date(Q):new Date();if(isNaN(Q)){return"NaN";}M=String(o.masks[M]||M||o.masks["default"]);if(M.slice(0,4)=="UTC:"){M=M.slice(4);c=true;}var P=c?"getUTC":"get",J=Q[P+"Date"](),D=Q[P+"Day"](),O=Q[P+"Month"](),d=Q[P+"FullYear"](),R=Q[P+"Hours"](),K=Q[P+"Minutes"](),N=Q[P+"Seconds"](),i=Q[P+"Milliseconds"](),s=c?0:Q.getTimezoneOffset(),a={d:J,dd:m(J),ddd:o.i18n.dayNames[D],dddd:o.i18n.dayNames[D+7],m:O+1,mm:m(O+1),mmm:o.i18n.monthNames[O],mmmm:o.i18n.monthNames[O+12],yy:String(d).slice(2),yyyy:d,h:R%12||12,hh:m(R%12||12),H:R,HH:m(R),M:K,MM:m(K),s:N,ss:m(N),l:m(i,3),L:m(i>99?Math.round(i/10):i),t:R<12?"a":"p",tt:R<12?"am":"pm",T:R<12?"A":"P",TT:R<12?"AM":"PM",Z:c?"UTC":(String(Q).match(n)||[""]).pop().replace(l,""),o:(s>0?"-":"+")+m(Math.floor(Math.abs(s)/60)*100+Math.abs(s)%60,4),S:["th","st","nd","rd"][J%10>3?0:(J%100-J%10!=10)*J%10]};return M.replace(j,function(q){return q in a?a[q]:q.slice(1,q.length-1);});};})();apf.date.getDateTime=function(O,J){var F=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g;var D=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC:)(?:[-+]\d{4})?)\b/g;var K=0;var I,M=new Date().getFullYear(),G=1,d=1,E=12,C=0,m=0;var s=apf.date.i18n;if(!J){throw new Error(apf.formatErrorString(0,null,"date-format","Date format is null"));}J=J.replace(D,"");var N=J.replace(F,function(i,j,n){var l=O.substring(n+K,n+K+i.length);switch(i){case"d":case"m":case"h":case"H":case"M":case"s":if(!/[\/, :\-](d|m|h|H|M|s)$|^(d|m|h|H|M|s)[\/, :\-]|[\/, :\-](d|m|h|H|M|s)[\/, :\-]/.test(J)){throw new Error(apf.formatErrorString(0,null,"date-format","Dates without leading zero needs separators"));}var c=parseInt(O.substring(n+K,n+K+2));if(c.toString().length==2){K++;}return i=="d"?d=c:(i=="m"?G=c:(i=="M"?C=c:(i=="s"?m=c:E=c)));case"dd":return d=l;case"dddd":K+=s.dayNames[s.dayNumbers[l.substring(0,3)]+7].length-4;break;case"mm":return G=l;case"mmm":return G=s.monthNumbers[l]+1;case"mmmm":var a=s.monthNumbers[l.substring(0,3)];K+=s.monthNames[a+12].length-4;return G=a+1;case"yy":return M=parseInt(l)<70?"20"+l:l;case"yyyy":return M=l;case"hh":return E=l;case"HH":return E=l;case"MM":return C=l;case"ss":return m=l;case"'T'":case"'Z'":K-=2;break;}});return new Date(M,G-1,d,E,C,m);};Date.prototype.format=function(d,i){return apf.date.dateFormat(this,d,i);};Date.parse=function(i,d){return apf.date.getDateTime(i,d);};apf.xmldb=new (function(){this.xmlDocTag="a_doc";this.xmlIdTag="a_id";this.xmlListenTag="a_listen";this.htmlIdTag="id";this.disableRSB=false;var i=[];this.getElementById=function(a,c){if(!c){c=i[a.split("|")[0]];}if(!c){return false;}return c.selectSingleNode("descendant-or-self::node()[@"+this.xmlIdTag+"='"+a+"']");};this.getNode=function(a){if(!a||!a.getAttribute(this.htmlIdTag)){return false;}return this.getElementById(a.getAttribute(this.htmlIdTag).split("|",2).join("|"));};this.getNodeById=function(a,c){var d=a.split("|");d.pop();return this.getElementById(d.join("|"),c);};this.getDocumentById=function(a){return i[a];};this.getDocument=function(a){return i[a.getAttribute(this.xmlIdTag).split("|")[0]];};this.getID=function(c,a){return c.getAttribute(this.xmlIdTag)+"|"+a.$uniqueId;};this.getElement=function(s,d){var c=s.childNodes;for(var a=0,t=0;t<c.length;t++){if(c[t].nodeType!=1){continue;}if(a++==d){return c[t];}}};this.setModel=function(a){apf.nameserver.register("model",a.data.ownerDocument.documentElement.getAttribute(this.xmlDocTag),a);};this.findModel=function(a){return apf.nameserver.get("model",a.ownerDocument.documentElement.getAttribute(this.xmlDocTag));};this.getXmlId=function(a){return a.getAttribute(this.xmlIdTag)||this.nodeConnect(apf.xmldb.getXmlDocId(a),a);};this.getHtmlNode=function(c,a){if(c&&c.nodeType==1&&c.getAttribute(this.xmlIdTag)){return a.$findHtmlNode(c.getAttribute(this.xmlIdTag)+"|"+a.$uniqueId);}return null;};this.findHtmlNode=function(c,a){do{if(c.nodeType==1&&c.getAttribute(this.xmlIdTag)){return a.$findHtmlNode(c.getAttribute(this.xmlIdTag)+"|"+a.$uniqueId);}if(c==a.xmlRoot){return null;}c=c.parentNode;}while(c&&c.nodeType!=9);return null;};this.findXmlNode=function(c){if(!c){return false;}var a;while(c&&c.nodeType==1&&(c.tagName.toLowerCase()!="body"&&!(a=c.getAttribute(this.htmlIdTag))||(a||(a=c.getAttribute(this.htmlIdTag)))&&a.match(/^q/))){if(c.host&&c.host.$ext==c){return c.host.xmlRoot;}c=c.parentNode;}if(!c||c.nodeType!=1){return false;}if(c.tagName.toLowerCase()=="body"){return false;}return this.getNode(c);};this.getXml=apf.getXml;this.nodeCount={};this.nodeConnect=function(c,d,t,s){if(!this.nodeCount[c]){this.nodeCount[c]=0;}var a;a=d.getAttribute(this.xmlIdTag)||d.setAttribute(this.xmlIdTag,(a=c+"|"+ ++this.nodeCount[c]))||a;if(!s){return a;}var o=a+"|"+s.$uniqueId;if(t){t.setAttribute(this.htmlIdTag,o);}return o;};this.addNodeListener=function(d,c,a){var n=d.getAttribute(this.xmlListenTag);a||(a=String(c.$uniqueId));if(!n||n.indexOf(a)==-1){d.setAttribute(this.xmlListenTag,n?n+";"+a:a);}return d;};this.removeNodeListener=function(z,u,o){var a=z.getAttribute(this.xmlListenTag);var d=(a?a.split(";"):[]);if(!o){o=u.$uniqueId;}for(var w=[],c=0;c<d.length;c++){if(d[c]!=o){w.push(d[c]);}}z.setAttribute(this.xmlListenTag,w.join(";"));return z;};this.setTextNode=apf.setTextNode=function(d,a,o,q){var c;if(o){c=d.selectSingleNode(o);if(!c){return;}d=c.nodeType==1?c:null;}if(d||!c){c=d.selectSingleNode("text()");if(!c){c=d.appendChild(d.ownerDocument.createTextNode(""));}}if(q){q.extra.oldValue=c.nodeValue;}c.nodeValue=a;this.applyChanges("text",c.parentNode,q);this.applyRSB(["setTextNode",d,a,o],q);};this.setAttribute=apf.setAttribute=function(c,d,a,o,q){(o?c.selectSingleNode(o):c).setAttribute(d,a);this.applyChanges("attribute",c,q);this.applyRSB(["setAttribute",c,d,a,o],q);};this.removeAttribute=apf.removeAttribute=function(c,d,n,a){if(a){a.name=d;}(n?c.selectSingleNode(n):c).removeAttribute(d);this.applyChanges("attribute",c,a);this.applyRSB(["removeAttribute",c,d,n],a);};this.replaceNode=apf.replaceNode=function(c,a,d,q){if(d){a=a.selectSingleNode(d);}if(q){q.oldNode=a;q.xmlNode=c;}var o=a.parentNode;o.replaceChild(c,a);this.copyConnections(a,c);this.applyChanges("replacechild",c,q);this.applyRSB(["replaceChild",a,c,d],q);return c;};this.addChildNode=apf.addChildNode=function(u,w,d,c,t){var z=u.insertBefore(u.ownerDocument.createElement(w),c);for(var a=0;a<d.length;a++){z.setAttribute(d[a][0],d[a][1]);}if(t){t.extra.addedNode=z;}this.applyChanges("add",z,t);this.applyRSB(["addChildNode",u,w,d,c],t);return z;};this.appendChild=apf.appendChild=function(w,a,d,t,s,u){if(t&&w.selectSingleNode(a.tagName)){return false;}if(u){this.cleanNode(a);}if(w.ownerDocument.importNode&&w.ownerDocument!=a.ownerDocument){a=w.ownerDocument.importNode(a,true);}if(s){var c=[];var w=apf.createNodeFromXpath(w,s,c);if(c.length){w.appendChild(a);while(c.length){if(w==c.pop()&&c.length){w=w.parentNode;}}}}else{if(a.parentNode){this.removeNode(a);}}w.insertBefore(a,d);this.applyChanges("add",a,u);this.applyRSB(["appendChild",w,a.xml,d,t,s],u);return a;};this.moveNode=apf.moveNode=function(a,c,d,o,q){if(!q){q={extra:{}};}q.extra.oldParent=c.parentNode;q.extra.beforeNode=c.nextSibling;q.extra.parent=(o?a.selectSingleNode(o):a);this.applyChanges("move-away",c,q);this.applyRSB(["moveNode",a,c,d,o],q);if(!apf.isWebkit&&apf.xmldb.getXmlDocId(c)!=apf.xmldb.getXmlDocId(a)){c.removeAttributeNode(c.getAttributeNode(this.xmlIdTag));this.nodeConnect(apf.xmldb.getXmlDocId(a),c);}if(apf.isWebkit&&a.ownerDocument!=c.ownerDocument){c=a.ownerDocument.importNode(c,true);}q.extra.parent.insertBefore(c,d);this.applyChanges("move",c,q);};this.removeNode=apf.removeNode=function(d,n,a){if(n){d=d.selectSingleNode(n);}if(a){a.extra.parent=d.parentNode;a.extra.removedNode=d;a.extra.beforeNode=d.nextSibling;}this.applyRSB(["removeNode",d,n],a);this.applyChanges("remove",d,a);var c=d.parentNode;c.removeChild(d);this.applyChanges("redo-remove",d,null,c);};this.removeNodeList=apf.removeNodeList=function(d,q){for(var a=[],c=0;c<d.length;c++){if(q){a.push({pNode:d[c].parentNode,removedNode:d[c],beforeNode:d[c].nextSibling});}this.applyChanges("remove",d[c],q);var s=d[c].parentNode;s.removeChild(d[c]);this.applyChanges("redo-remove",d[c],null,s);}if(q){q.extra.removeList=a;}this.applyRSB(["removeNodeList",d,null],q);};var j={},l;this.$hasQueue=false;this.applyChanges=function(R,X,c,W){if(typeof apf.offline!="undefined"&&apf.offline.models.enabled&&apf.offline.models.realtime){var U=apf.nameserver.get("model",apf.xmldb.getXmlDocId(X));if(U){apf.offline.models.markForUpdate(U);}}if(c&&!c.xmlNode){c.xmlNode=X;}var Q=W;var O=(X.nodeType==1?X:X.parentNode);if(!this.delayUpdate&&"|remove|move-away|".indexOf("|"+R+"|")>-1){this.notifyQueued();}var P,d,M,K,N,Y,J,T,Z,a;while(O&&O.nodeType!=9){P=O.getAttribute(this.xmlListenTag);if(P){M=P.split(";");for(K=0;K<M.length;K++){d=M[K];if(d.charAt(0)=="p"){d=d.split("|");T=apf.all[d[1]];if(T){var U=apf.all[d[3]];var V=U.$propBinds[d[1]][d[2]].root;T.$execProperty(d[2],V?U.data.selectSingleNode(V):U.data);}continue;}Y=j[d];if(!Y){j[d]=Y=[];}if("|update|attribute|text|".indexOf("|"+R+"|")>-1){a=false;for(N=0;N<Y.length;N++){if(Y[N]&&X==Y[N][1]&&"|update|attribute|text|".indexOf("|"+Y[N][0]+"|")>-1){Y[N]=null;a=true;continue;}}Y.push(["update",X,O,c,Q]);Z=true;continue;}if(!this.delayUpdate&&"|remove|move-away|add|".indexOf("|"+R+"|")>-1){T=apf.all[d];if(T){T.$xmlUpdate(R,X,O,c,Q);}}else{Y.push([R,X,O,c,Q]);Z=true;}}}O=O.parentNode||W;if(O==W){W=null;}}if(c&&!this.delayUpdate){apf.xmldb.notifyQueued();}else{if(Z){clearTimeout(l);apf.xmldb.notifyQueued();}}};this.notifyQueued=function(){this.$hasQueue=false;clearTimeout(l);for(var a in j){var o=j[a];var c=apf.all[a];if(!c||!o){continue;}for(var d=0;d<o.length;d++){if(!o[d]){continue;}c.$xmlUpdate.apply(c,o[d]);}}j={};};this.notifyListeners=function(a){var c=a.getAttribute(apf.xmldb.xmlListenTag);if(c){c=c.split(";");for(var d=0;d<c.length;d++){apf.all[c[d]].$xmlUpdate("synchronize",a,a);}}};this.applyRSB=function(c,q){if(apf.xmldb.disableRSB){return;}var a=c[1]&&c[1].length&&c[1][0]||c[1],o=apf.xmldb.getXmlDocId(a),d=apf.nameserver.get("model",o);if(!d&&apf.isO3){d=self[o];}if(!d){if(!apf.nameserver.getAll("remove").length){return;}return;}if(!d.rsb){return;}if(q){d.rsb.queueMessage(c,d,q);}else{d.rsb.sendChange(c,d);}};this.copyConnections=function(c,d){try{d.setAttribute(this.xmlListenTag,c.getAttribute(this.xmlListenTag));}catch(a){}try{d.setAttribute(this.xmlIdTag,c.getAttribute(this.xmlIdTag));}catch(a){}};this.cleanNode=function(a){try{var c,d=a.selectNodes("descendant-or-self::node()[@"+this.xmlListenTag+"]");for(c=d.length-1;c>=0;c--){d[c].removeAttribute(this.xmlListenTag);}d=a.selectNodes("descendant-or-self::node()[@"+this.xmlIdTag+"]");for(c=d.length-1;c>=0;c--){d[c].removeAttribute(this.xmlIdTag);}d=a.selectNodes("descendant-or-self::node()[@"+this.xmlDocTag+"]");for(c=d.length-1;c>=0;c--){d[c].removeAttribute(this.xmlDocTag);}d=a.selectNodes("descendant-or-self::node()[@a_loaded]");for(c=d.length-1;c>=0;c--){d[c].removeAttribute("a_loaded");}}catch(o){}return a;};this.copy=this.getCleanCopy=apf.getCleanCopy=function(a){return apf.xmldb.cleanNode(a.cloneNode(true));};this.unbind=function(z){for(var d={},B=0;B<z.apf.all.length;B++){if(z.apf.all[B]&&z.apf.all[B].unloadBindings){d[z.apf.all[B].unloadBindings()]=true;}}for(var c=0;c<i.length;c++){if(!i[c]){continue;}var w=i[c].selectNodes("//self::node()[@"+this.xmlListenTag+"]");for(var B=0;B<w.length;B++){var C=w[B].getAttribute(this.xmlListenTag).split(";");for(var A=[],a=0;a<C.length;a++){if(!d[C[a]]){A.push(C[a]);}}if(A.length!=C.length){w[B].setAttribute(this.xmlListenTag,A.join(";"));}}}};this.getXmlDocId=function(c,n){var a=c.ownerDocument.documentElement;if(!apf.isChildOf(a,c)){a=c;}var d=(a||c).getAttribute(this.xmlDocTag)||i.indexOf(a||c.ownerDocument||c);if(d&&d>-1){return d;}d=i.push(a||c.ownerDocument||c)-1;if(a){a.setAttribute(this.xmlDocTag,d);}if(n){apf.nameserver.register("model",d,n);}return i.length-1;};});apf.resize=function(){this.scales={scalex:false,scaley:false,scaleratio:false,dwidth:0,dheight:0,snap:false,gridW:48,gridH:48};this.htmlElement;var c=[];this.init=function(){c=[new apf.resize.square("top","left",this),new apf.resize.square("top","middle",this),new apf.resize.square("top","right",this),new apf.resize.square("middle","left",this),new apf.resize.square("middle","right",this),new apf.resize.square("bottom","left",this),new apf.resize.square("bottom","middle",this),new apf.resize.square("bottom","right",this)];};this.grab=function(i,a){this.htmlElement=i;this.scales=a;if(!c.length){this.init();}this.show();};this.hide=function(){for(var a=0,i=c.length;a<i;a++){c[a].visible=false;c[a].repaint();}};this.show=function(){var q=this.scales.scalex;var t=this.scales.scaley;var a=this.scales.scaleratio;for(var l=0,s=c.length,i;l<s;l++){i=c[l];i.visible=q&&t?true:(t&&!q?(i.posX=="middle"?true:false):(q&&!t?(i.posY=="middle"?true:false):(a?((i.posY=="top"||i.posY=="bottom")&&i.posX!=="middle"?true:false):false)));i.repaint();}};this.destroy=function(){for(var a=0;a<c.length;a++){c[a].destroy();}};};apf.resize.square=function(n,m,q){this.visible=true;this.posX=m;this.posY=n;var o=0;var l=this;this.htmlElement=q.htmlElement.parentNode.appendChild(document.createElement("div"));apf.setStyleClass(this.htmlElement,"square");this.repaint=function(){if(this.visible){var d=q.htmlElement;this.htmlElement.style.display="block";var D=parseInt(d.style.width)+apf.getDiff(d)[0];var a=parseInt(d.style.height)+apf.getDiff(d)[1];var i=parseInt(d.style.top);var t=parseInt(d.style.left);var C=this.htmlElement.offsetWidth;var F=this.htmlElement.offsetHeight;var c=n=="top"?i-o-F:n=="middle"?i+a/2-F/2:i+a+o;var j=m=="left"?t-o-C:m=="middle"?t+D/2-C/2:t+D+o;var E=(n=="middle"?"w-resize":(m=="middle"?"n-resize":(n+m=="topleft"||n+m=="bottomright")?"nw-resize":"ne-resize"));this.htmlElement.style.top=(c-1)+"px";this.htmlElement.style.left=(j-1)+"px";this.htmlElement.style.cursor=E;}else{var C=this.htmlElement.offsetWidth;this.htmlElement.style.display="none";}};this.destroy=function(){apf.destroyHtmlNode(this.htmlElement);};this.htmlElement.onmouseover=function(a){apf.setStyleClass(l.htmlElement,"squareHover");};this.htmlElement.onmouseout=function(a){apf.setStyleClass(l.htmlElement,"",["squareHover"]);};this.htmlElement.onmousedown=function(a){a=(a||event);var ai=q.htmlElement,ad=a.clientX,ag=a.clientY,aa=ai.parentNode.offsetTop,c=ai.parentNode.offsetLeft,am=q.scales.dwidth,d=q.scales.dheight,ab=q.scales.snap,at=q.scales.gridH,j=q.scales.gridW,w=apf.flow.isBlock(ai),af=w.other.ratio,al=l.posX,ao=l.posY,Z,ae,ah,aq,an,ap,ar,aj,Y=parseInt(ai.style.left),ak=parseInt(ai.style.top),ac=parseInt(ai.style.width),t=parseInt(ai.style.height),i=false;q.onresizedone(ac,t,ak,Y);if(a.preventDefault){a.preventDefault();}document.onmousemove=function(u){u=(u||event);an=u.clientX-ad;ap=u.clientY-ag;var s=u.shiftKey,z=af;if(s){if(al=="right"&&ao=="bottom"){Z=ac+an;ae=Z/z;aq=Y;ah=ak;}else{if(al=="right"&&ao=="top"){Z=ac+an;ae=Z/z;aq=Y;ah=ak-an/z;}else{if(al=="left"&&ao=="bottom"){Z=ac-an;ae=Z/z;aq=Y+an;ah=ak;}else{if(al=="left"&&ao=="top"){Z=ac-an;ae=Z/z;aq=Y+an;ah=ak+an/z;}}}}if(Z>=am&&ae>=d){Z=ar=Math.max(am,Z);ae=aj=Math.max(d,ae);}else{Z=ar;ae=aj;return false;}}else{Z=al=="right"?ac+an:(al=="left"?ac-an:ac);ae=ao=="bottom"?t+ap:(ao=="top"?t-ap:t);aq=al=="right"?Y:(al=="left"?Math.min(Y+ac-am,Y+an):Y);ah=ao=="bottom"?ak:(ao=="top"?Math.min(ak+t-d,ak+ap):ak);Z=Math.max(am,Z);ae=Math.max(d,ae);}if(ab){aq=Math.floor(aq/j)*j;ah=Math.floor(ah/at)*at;Z=Math.ceil(Z/j)*j;ae=Math.ceil(ae/at)*at;}if(q.onresize){q.onresize(ai,ah,aq,Z,ae);}q.show();i=true;};document.onmouseup=function(s){document.onmousemove=null;if(q.onresizedone&&i){q.onresizedone(Z,ae,ah,aq);w.other.ratio=Z/ae;i=false;}};};};apf.queue={q:{},timer:null,add:function(i,d){this.q[i]=d;if(!this.timer){this.timer=$setTimeout("apf.queue.empty()");}},empty:function(j){clearTimeout(this.timer);this.timer=null;if(apf.layout&&apf.layout.$hasQueue){apf.layout.processQueue();}if(apf.xmldb&&apf.xmldb.$hasQueue){apf.xmldb.notifyQueued();}var l=this.q;for(var j in l){var i=l[j];if(i){delete l[j];i();}}}};apf.storage={modules:{},init:function(d){if(!d){d=this.autodetect();}var i=this.getProvider(d);apf.storage=apf.extend(i,this);apf.storage.init=null;return i;},getProvider:function(d){var i=apf.storage.modules[d];if(!i||typeof i!="object"){return false;}if(!i.isAvailable()){return false;}if(!i.initialized&&(!i.init||i.init()===false)){return false;}i.name=d;apf.extend(i,this.base);return i;},autodetect:function(){for(var c in this.modules){if(c=="memory"){continue;}if(this.modules[c].isAvailable()){return c;}}return this.modules.memory?"memory":null;},base:{namespace:"default",isValidKeyArray:function(c){return(!c||!c.join)?false:/^[0-9A-Za-z_\.\-]*$/.test(c.join(""));},isValidKey:function(c){return(c===null||c===undefined)?false:/^[0-9A-Za-z_\.\-]*$/.test(c);},getAllPairs:function(n,q){var m=this.getKeys(n);if(!m||!m.length){return;}var i=this.getMultiple(m,n);for(var o=0;o<m.length&&i;o++){if(i[o]){q[m[o]]=i[o];}}return m.length;}}};apf.selection=function(ak,U,ad){ak=ak||window;U=U||window.document;this.current=null;var Q="function",aa="undefined",ag="character",R="Text",Y="Control",W="None",af,ai=(ad&&typeof ad.$visualFocus==Q),ae=this;this.get=function(){return apf.w3cRange?ak.getSelection():U.selection;};this.set=function(){if(!this.current){return null;}if(apf.w3cRange){this.moveToBookmark(this.current);return this.current;}try{if(ai){ad.$visualFocus();}else{ak.focus();}this.current.select();}catch(a){}if(ai){ad.$visualFocus();}else{ak.focus();}return this.current;};this.cache=function(a){if(apf.w3cRange){if(a){this.current=this.getBookmark();}return this;}var c=U.selection;this.current=c.createRange();this.current.type=c.type;if(this.current.type==R&&this.current.text==""&&!af){af=$setTimeout(this.cache,0);}else{clearTimeout(af);af=null;}return this;};this.getRange=function(){var d=this.get(),c;try{if(d){c=d.rangeCount>0?d.getRangeAt(0):(d.createRange?d.createRange():U.createRange());}}catch(a){}if(!c){c=apf.w3cRange?U.createRange():U.body.createTextRange();}return c;};this.setRange=function(c){if(apf.w3cRange){var d=this.get();if(d){d.removeAllRanges();d.addRange(c);}}else{try{c.select();}catch(a){}}return this;};var ab,N="BR|IMG|HR|INPUT",O="P|BUTTON|TEXTAREA|SELECT|DIV|H[1-6]|ADDRESS|PRE|OL|UL|LI|TABLE|TBODY|TR|DT|DE|TD|SUB|SUP",Z="SELECT|BUTTON|TEXTAREA",aj=new RegExp("^(?:"+O+")$","i"),ac=new RegExp("^(?:"+Z+")$","i"),T=new RegExp("^(?:"+N+")$","i");this.inline=N;this.block=O;this.form=Z;function V(a){return(apf.isOpera||apf.isIE)?a:a.replace(/\r\n/g," ");}function al(a){return String(apf.isIE?a.nodeType==3?a.nodeValue:a.innerText:a.textContent);}function M(a){return String(a.nodeType==3?apf.isIE?a.nodeValue:a.textContent:a.innerHTML);}function P(j,c){var a,i=0,d="",l=0,m=j.childNodes.length;for(;l<m;l++){a=j.childNodes[l];if(ac.test(a.nodeName)){d+="<->"+(apf.isIE?"":V(al(a)).replace(/./gi," "))+"</->";}else{if(aj.test(a.nodeName)){d+="<+>"+(apf.isIE?"":V(al(a)).replace(/./gi," "))+"</+>";}else{if(T.test(a.nodeName)){d+="<>";}else{if(a.nodeName=="SPAN"&&(i=_4.attr(a,"scaytid"))){d+="<"+i+">"+V(M(a))+"</>";}else{d+=V(M(a));}}}}}return d;}function X(a,c,j,i){var d;i=i||this.containerNode;c=c?new RegExp("^(?:"+c+")$"):null;while(a&&a!=i){if(c&&c.test(a.nodeName.toUpperCase())){return a;}if(j){for(d in j){if(a.getAttribute(d)!==null&&j[d]===null){return a;}if((j[d]!==null&&a.getAttribute(d)!==null&&!(a.getAttribute(d)===false))?!j[d]:j[d]){return a;}}}a=a.parentNode;}return false;}this.getBookmark=function(q,o){var j=-16777215,d=this.getRange(),C=apf.getViewPort(ak),A=U.body,a={scrollX:C.x,scrollY:C.y,collapse:0,start:0},F=this.get();ab=null;if(q=="simple"){a.rng=d;return a;}if(!apf.w3cRange){if(d.item){var B=d.item(0),J=A.getElementsByTagName(B.nodeName),E=0,G=J.length;for(;E<G;E++){if(B==J[E]){return !(D=E);}}return apf.extend(a,{tag:B.nodeName,index:D});}var s,w,D,z;s=d.duplicate();s.moveToElementText(A);s.collapse(true);w=Math.abs(s.move(ag,j));s=d.duplicate();s.collapse(true);D=Math.abs(s.move(ag,j));s=d.duplicate();s.collapse(false);var n=0;z=s.duplicate();z.moveEnd(ag,1);z.collapse(false);var l=z.parentElement();if(aj.test(l.nodeName)){if(X(s.parentElement(),O,null,A)!=l){ab=l;}}return apf.extend(a,{start:D-w-n,length:Math.abs(s.move(ag,j))-D});}var c=F.anchorNode;while(c&&(c.nodeType!=1)){c=c.parentNode;}if(c&&c.nodeName=="IMG"){return a;}if(!F){return null;}var m,t=d.startContainer,I=F.anchorNode,u=o?o(I):null;if(F.isCollapsed){a.collapse=1;c=X(I,O)||A;if(I.nodeType==3){m=U.createTreeWalker(c,NodeFilter.SHOW_TEXT,null,false);while(J=m.nextNode()){if(J==I){a.start=a.start+F.anchorOffset;break;}a.start+=V(J.nodeValue||"").length;}}else{if(I!=c){m=U.createTreeWalker(c,NodeFilter.SHOW_ALL,null,false);while(J=m.nextNode()){if(J==I){break;}a.start+=V(J.nodeValue||"").length;}}for(E=0,G=d.startOffset;E<G;E++){a.start+=parseInt(String(t.childNodes[E].textContent).length);}}a.end=a.start;if(!u){a.content=t.textContent||t.innerHTML;try{if(d.startOffset==0&&t.previousSibling&&(/IMG|BR|INPUT/.test(t.previousSibling.nodeName))){a.br=t.previousSibling;}if(t.childNodes[d.startOffset-1]&&(/IMG|BR|INPUT/.test(t.childNodes[d.startOffset-1].nodeName))){a.br=t.childNodes[d.startOffset-1];}}catch(B){}}if(u&&d.startOffset==0){J=u.previousSibling;while(J&&((J.nodeType==3&&J.textContent=="")||(J.nodeType!=3&&J.innerHTML==""))){if(J&&(/IMG|BR|INPUT/.test(J.nodeName))){a.br=J;a.br2=J.nextSibling;break;}J=J.previousSibling;}}apf.extend(a,{block:c,node:t,offset:d.startOffset});return a;}var i=[];c=0;m=U.createTreeWalker(A,NodeFilter.SHOW_TEXT,null,false);while((J=m.nextNode())!=null){if(J==t){i[0]=c;}if(J==d.endContainer){i[1]=c;break;}c+=V(J.nodeValue||"").length;}apf.extend(a,{start:i[0]+d.startOffset,end:i[1]+d.endOffset,block:A});return a;};this.moveToBookmark=function(d){var a,t=this.get(),i=U.body,u=this.getRange();function o(J,z){var F,B,D,G,I,w=0,C={},E=-1,A=U.createTreeWalker(d.block,NodeFilter.SHOW_TEXT,null,false);while(F=A.nextNode()){D=F.nodeValue||"";G=V(D).length;w+=G;if(d.collapse){if(w>=J){B=X(F,O)||i;}if(w==J){E=B==d.block?1:0;}if(E==-1&&w>J||E==1){C.endNode=C.startNode=F;C.endOffset=C.startOffset=J-(w-G);return C;}}else{if(w>=J&&!C.startNode){I=J-(w-G);C.startNode=F;C.startOffset=J-(w-G);}if(w>=z){C.endNode=F;C.endOffset=z-(w-G);return C;}}}return null;}if(!d){return false;}if(!apf.w3cRange){U.body.setActive();if(a=d.rng){try{a.select();}catch(j){}return true;}if(d.tag){a=i.createControlRange();var s=U.getElementsByTagName(d.tag),n=0,q=s.length;for(;n<q;n++){if(n==d.index){a.addElement(s[n]);}}}else{try{if(d.start<0){return true;}a=t.createRange();if(ab){a.moveToElementText(ab);a.moveStart(ag,-2);a.expand(word);a.collapse(false);}else{a.moveToElementText(i);a.collapse(true);a.moveStart(ag,d.start);a.moveEnd(ag,d.length);}}catch(m){return true;}}try{a.select();}catch(j){}return true;}if(!t){return false;}a=u.cloneRange();if(d.rng){t.removeAllRanges();t.addRange(d.rng);}else{if(typeof d.node!=aa){var c=false;if((d.node.nodeType==3&&d.node.parentNode!=null&&d.node.textContent==d.content)||(d.node.nodeType!=3&&d.node.innerHTML==d.content)){a.setStart(d.node,d.offset);a.collapse(true);c=true;}if(typeof d.br!=aa&&(/IMG|BR|INPUT/.test(d.br.nodeName))){if(d.br.nextSibling){a.selectNode(d.br.nextSibling);a.collapse(true);}else{a.selectNode(d.br);a.collapse(false);}c=true;}if(c){if(!apf.isOpera){t.removeAllRanges();}t.addRange(a);i.focus();ak.scrollTo(d.scrollX,d.scrollY);return;}}if(typeof d.start!=aa&&typeof d.end!=aa){try{var l=o(d.start,d.end);if(l){a.setStart(l.startNode,l.startOffset);a.setEnd(l.endNode,l.endOffset);ak.scrollTo(d.scrollX,d.scrollY);if(!apf.isOpera){t.removeAllRanges();}t.addRange(a);}}catch(j){apf.console.error(j);}}return;}};this.getContent=function(d){if(typeof d!="string"){d="html";}var m=this.getRange(),n=this.get(),j,i,a,c=U.body;if(d=="text"){return this.isCollapsed()?"":(m.text||(n.toString?n.toString():""));}if(this.isCollapsed()){return"";}if(typeof m.htmlText!=aa){return m.htmlText;}var l,a=m.cloneContents();if(!a.childNodes.length){return"";}l=a.childNodes[0].ownerDocument.createElement("div");l.appendChild(a);return l.innerHTML;};this.setContent=function(i,a){var j=this.getRange();if(!a){i=apf.htmlCleaner.prepare(i,true);}if(j.insertNode){i+='<span id="__caret">_</span>';j.deleteContents();j.insertNode(this.getRange().createContextualFragment(i));var d=U.getElementById("__caret");var c=d.previousSibling;j=U.createRange();j.setStartBefore(d);j.setEndAfter(d);this.setRange(j);U.execCommand("Delete",false,null);if(d&&d.parentNode){d.parentNode.removeChild(d);}return c;}else{if(j.item){this.remove();j=this.getRange();}i=i.replace(/^<(\w+)/,'<$1 id="__caret"');j.pasteHTML(i);var c=U.getElementById("__caret");if(c){c.removeAttribute("id");return c;}}};var ah={img:1,hr:1,li:1,table:1,tr:1,td:1,embed:1,object:1,ol:1,ul:1};this.getType=function(){var d=this.get();if(apf.isIE){return d.type;}else{var a="Text";if(d&&d.rangeCount==1){var c=d.getRangeAt(0);if(c.startContainer==c.endContainer&&(c.endOffset-c.startOffset)==1&&c.startContainer.nodeType==1&&ah[c.startContainer.childNodes[c.startOffset].nodeName.toLowerCase()]){a=Y;}}return a;}};this.getSelectedNode=function(){var c=this.getRange();if(!apf.isIE){if(!c){return U;}var d=this.get(),a=c.commonAncestorContainer;if(!c.collapsed){if(apf.isWebkit&&d.anchorNode&&d.anchorNode.nodeType==1){return d.anchorNode.childNodes[d.anchorOffset];}if(c.startContainer==c.endContainer){if(c.startOffset-c.endOffset<2){if(c.startContainer.hasChildNodes()){a=c.startContainer.childNodes[c.startOffset];}}}}return a;}return c.item?c.item(0):c.parentElement();};this.getParentNode=function(){switch(this.getType()){case Y:if(apf.isIE){return this.getSelectedNode().parentElement;}else{return this.getSelectedNode().parentNode;}case W:return;default:var c=this.get();if(apf.isIE){return c.createRange().parentElement();}else{if(c){var a=c.anchorNode;while(a&&a.nodeType!=1){a=a.parentNode;}return a;}}break;}};this.selectNode=function(d){var j,i;while(d.nodeType==1&&d.firstChild){d=d.firstChild;}if(apf.isIE){j=this.get();if(!d){d=j.createRange().parentElement();}try{j.empty();}catch(a){}try{i=U.body.createControlRange();i.addElement(d);}catch(a){i=U.body.createTextRange();try{i.moveToElementText(d.nodeType!=1?d.parentNode:d);}catch(c){if(d.nodeValue){i.findText(d.nodeValue);}}}try{i.select();}catch(a){}}else{i=this.getRange();if(d){i.selectNode(d);}j=this.get();j.removeAllRanges();j.addRange(i);}return this;};this.collapse=function(c){var d=this.getRange(),a;if(d.item){a=d.item(0);d=U.body.createTextRange();d.moveToElementText(a);}d.collapse(!!c);this.setRange(d);return this;};this.isCollapsed=function(){var a=this.getRange(),c=this.get();if(!a||a.item){return false;}return !c||a.boundingWidth==0||a.collapsed;};this.hasAncestorNode=function(a){var d,i=this.getRange();if(this.getType()==Y||!apf.isIE){d=this.getSelectedNode();if(!d&&!apf.isIE){try{d=i.startContainer;}catch(c){}}}else{d=i.parentElement();}while(d){if(apf.isIE){if(d.tagName==a){return true;}else{if(d.nodeType==1&&d.tagName==a){return true;}}}d=d.parentNode;}return false;};this.moveToAncestorNode=function(a){var c,d,j=this.getRange();a=a.toUpperCase();if(apf.isIE){if(this.getType()==Y){for(d=0;d<j.length;d++){if(j(d).parentNode){c=j(d).parentNode;break;}}}else{c=j.parentElement();}while(c&&c.nodeName!=a){c=c.parentNode;}return c;}else{var i=this.getSelectedNode();if(!i){i=ak.getSelection().getRangeAt(0).startContainer;}while(i){if(i.tagName==a){return i;}i=i.parentNode;}return null;}};this.remove=function(){var c=this.get(),a;if(apf.isIE){if(c.type!=W){c.clear();}}else{if(c){for(a=0;a<c.rangeCount;a++){c.getRangeAt(a).deleteContents();}}}return this;};this.$destroy=function(){ak=U=ad=this.current=ae=null;delete ak;delete U;delete ad;delete this.current;delete ae;};};apf.htmlCleaner=(function(){var l=null,n=null,m={table:1,TABLE:1},j={br:1,img:1,input:1,hr:1};return{prepare:function(c,i){if(!l){l=[/<(\/?)strong>|<strong( [^>]+)>/gi,/<(\/?)em>|<em( [^>]+)>/gi,/&apos;/g,/(<(\/?)(span|strong|em|u|i|b|a|strike|sup|sub|font|img)(?:\s+[\s\S]*?)?>)|(<br[\s\S]*?>)|(<(\/?)([\w\-]+)(?:\s+[\s\S]*?)?>)|([^<>]*)/gi,/(<a[^>]*href=)([^\s^>]+)*([^>]*>)/gi,/<p><\/p>/gi,/<a( )([^>]+)\/>|<a\/>/gi];}if(apf.isGecko){c=c.replace(l[0],"<$1b$2>").replace(l[1],"<$1i$2>");}else{if(apf.isIE){c=c.replace(l[2],"&#39;").replace(l[4],"$1$2 _apf_href=$2$3");var C=[],B=false,z=[],d=[],a=[],s=false;c.replace(l[3],function(u,Q,O,M,N,q,T,o,R){if(Q){var w=z.push(Q);M=M.toLowerCase();if(!j[M]){if(O){if(!d[d.length-1]||d[d.length-1][0]!=M){z.length--;}else{d.length--;}}else{d.push([M,w]);}}B=true;}else{if(R){z.push(R);B=true;}else{if(N){if(B){if(d.length){z.push(N);}else{C.push("<p>",z.join(""),"</p>");z=[];}if(!d.length){B=false;}}else{if((a.length||s)&&N.indexOf("_apf_marker")>-1){}else{C.push("<p>&nbsp;</p>");}}}else{if(q){if(T){if(a[a.length-1]!=o.toLowerCase()){return;}else{a.length--;}if(z.length){C.push(z.join(""));z=[];}s=2;}else{var t=z.length&&z.join("").trim();var P=t?z:C;if(!m[o]){if(P[P.length-1]=="<p>&nbsp;</p>"){P[P.length-1]="";}else{if(t&&!a.length){P.push("<p></p>");}}}if(z.length){if(!t||a.length){C.push(z.join(""));z=[];}else{C.push("<p>",z.join(""),"</p>");z=[];}}a.push(o.toLowerCase());}C.push(q);B=false;}}}}s=s==2?1:false;});var A;if((A=z.join("")).trim()){C.push(i?A:"<p>"+A+"</p>");}c=C.join("");}}c=(apf.xmlentities?apf.xmlentities(c):c).replace(l[6],"<a$1$2></a>");return c;},parse:function(A,c,z){if(!n){n=[/<br[^>]*><\/li>/gi,/<br[^>]*_apf_placeholder="1"\/?>/gi,/<(a|span|div|h1|h2|h3|h4|h5|h6|pre|address)>[\s\n\r\t]*<\/(a|span|div|h1|h2|h3|h4|h5|h6|pre|address)>/gi,/<(tr|td)>[\s\n\r\t]*<\/(tr|td)>/gi,/[\s]*_apf_href="?[^\s^>]+"?/gi,/(".*?"|'.*?')|(\w)=([^'"\s>]+)/gi,/<((?:br|input|hr|img)(?:[^>]*[^\/]|))>/ig,/<p>&nbsp;$/mig,/(<br[^>]*?>(?:[\r\n\s]|&nbsp;)*<br[^>]*?>)|(<(\/?)(span|strong|em|u|i|b|a|br|strike|sup|sub|font|img)(?:\s+.*?)?>)|(<(\/?)([\w\-]+)(?:\s+.*?)?>)|([^<>]*)/gi,/<\/p>/gi,/<p>/gi,/<\s*\/?\s*(?:\w+:\s*)?[\w-]*[\s>\/]/g];}if(apf.isIE){A=A.replace(n[7],"<p></p>").replace(n[9],"<br />").replace(n[10],"");}else{if(A=="<br>"){A="";}}A=(apf.xmlentities?apf.xmlentities(A):A).replace(n[0],"</li>").replace(n[1],"").replace(n[2],"").replace(n[3],"<$1>&nbsp;</$2>").replace(n[4],"").replace(n[6],"<$1 />").replace(n[11],function(o){return o.toLowerCase();});if(apf.isIE&&!z){var i=[],a=true,u=[],w=[],d=[];A.replace(n[8],function(K,P,o,R,M,t,Q,s,q){if(o){if(apf.isIE){o=o.replace(n[5],function(B,C,B,D){return C||B+'="'+D+'"';});}var O=u.push(o);if(!j[M]){if(R){if(!w[w.length-1]||w[w.length-1][0]!=M){u.length--;}else{w.length--;}}else{w.push([M,O]);}}a=true;}else{if(q){u.push(q);a=true;}else{if(P){if(a){if(w.length){u.push(P);}else{i.push("<p>",u.join("").trim()||"&nbsp;","</p>");u=[];a=false;}}else{i.push("<p>&nbsp;</p>");}}else{if(t){if(Q){if(d[d.length-1]!=s){return;}else{d.length--;}if(u.length){i.push(u.join(""));u=[];}}else{if(apf.isIE){t=t.replace(n[5],function(B,C,B,D){return C||B+'="'+D+'"';});}var T=u.length?u:i;if(T[T.length-1]=="<p>&nbsp;</p>"){T.length--;}if(u.length){var N;if(d.length||(N=u.join("").trim()).replace(/<.*?>/g,"").trim()==""){i.push(N||u.join(""));u=[];}else{i.push("<p>",(N||u.join("").trim()||"&nbsp;").replace(/<br \/>[\s\r\n]*$/,""),"</p>");u=[];}}d.push(s);}i.push(t);a=false;}}}}});if(u.length){i.push("<p>"+u.join("").replace(/<br \/>[\s\r\n]*$/,"")+"</p>");}A=i.join("");}else{A=A.replace(/<br[^>]*_apf_marker="1"[^>]*>/gi,"<br />");}return A;}};})();apf.Sort=function(n){var m={};this.parseXml=function(t,c){if(c){m={};}m.order=t.order;m.getValue=t.csort||t.$compile("sort");m.getNodes=self[t["nodes-method"]];m.ascending=(m.order||"").indexOf("desc")==-1;m.order=null;if(t["data-type"]){m.method=l[t["data-type"]];}else{if(t["sort-method"]){m.method=self[t["sort-method"]];}else{m.method=l.alpha;}}var s=t["date-format"];if(s){m.sort_dateFmtStr=s;m.method=l.date;var d=s.match(/(D+|Y+|M+|h+|m+|s+)/g);if(d){for(var i={},a=0;a<d.length;a++){i[d[a].substr(0,1)]=a+1;}m.dateFormat=new RegExp(s.replace(/([^\sDYMhms])/g,"\\$1").replace(/YYYY/,"(\\d\\d\\d\\d)").replace(/(DD|YY|MM|hh|mm|ss)/g,"(\\d\\d)"));m.dateReplace="$"+i.M+"/$"+i.D+"/$"+i.Y;if(i.h){m.dateReplace+=" $"+i.h+":$"+i.m+":$"+i.s;}}}};this.set=function(a,c){if(c){m={};}apf.extend(m,a);if(!m.ascending){m.ascending=a.order?a.order.indexOf("desc")==-1:true;}m.order=null;if(a.type){m.method=l[a.type];}else{if(a.method){m.method=self[a.method];}else{if(!m.method){m.method=l.alpha;}}}if(!m.getValue){m.getValue=function(d){return apf.queryValue(d,m.xpath);};}};this.get=function(){return apf.extend({},m);};this.findSortSibling=function(i,a){var d=getNodes?getNodes(i,a):this.getTraverseNodes(i);for(var c=0;c<d.length;c++){if(!compare(a,d[c],true,sortSettings)){return d[c];}}return null;};var j=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000"];var l={alpha:function(a){return a.toString().toLowerCase();},number:function(a){return(a.length<j.length?j[j.length-a.length]:"")+a;},date:function(c,d){var a=m.dateFormat;var s=m.dateReplace;var i=m.sort_dateFmtStr;var t;if(!a){t=new Date(c);}else{if(i=="*"){t=Date.parse(c);}else{t=(new Date(c.replace(a,s))).getTime();}}c=""+t.getTime();if(c=="NaN"){c="0";}return(c.length<j.length?j[j.length-c.length]:"")+c;}};this.apply=function(i,D,d,A,F){var C=[],a=i.length;while(a--){var B=m.getValue(i[a]);if(i){C[C.length]={toString:function(){return this.v;},xmlNode:i[a],v:(m.method||l.alpha)(B||"",D,i[a])};}}C.sort();var c=F?Math.min(C.length,A+F):C.length;if(!A){A=0;}if(d){if(m.ascending){for(a=A;a<c;a++){f(a,c,C[a].xmlNode,C[a].v);}}else{for(a=c-1;a>=A;a--){f(c-a-1,c,C[a].xmlNode,C[a].v);}}}else{var E=[];if(m.ascending){for(a=A;a<c;a++){E[E.length]=C[a].xmlNode;}}else{for(a=c-1;a>=A;a--){E[E.length]=C[a].xmlNode;}}return E;}};if(n){this.parseXml(n);}};apf.skins={skins:{},css:[],events:["onmousemove","onmousedown","onmouseup","onmouseout","onclick","ondragcopy","ondragstart"],Init:function(G,w,F){var C=(w?w.getAttribute("id"):null)||G.getAttribute("id");var B=(w?w.getAttribute("src").match(/\//)||F:"")?(F||w.getAttribute("src")).replace(/\/[^\/]*$/,"")+"/":"";var A=(G.getAttribute("media-path")?apf.getAbsolutePath(B||apf.hostPath,G.getAttribute("media-path")):(w?w.getAttribute("media-path"):null));var u=(G.getAttribute("icon-path")?apf.getAbsolutePath(B||apf.hostPath,G.getAttribute("icon-path")):(w?w.getAttribute("icon-path"):null));if(!C){C="default";}if(G.getAttribute("id")){document.body.className+=" "+G.getAttribute("id");}var i=C.split("|");C=i[0];if(!this.skins[C]||C=="default"){this.skins[C]={base:B,name:C,iconPath:typeof u!="string"&&!u?"icons/":u,mediaPath:typeof A!="string"&&!A?"images/":A,templates:{},originals:{},xml:G};if(i.length>1){for(var z=0;z<i.length;z++){this.skins[i[z]]=this.skins[C];}}}if(!this.skins["default"]&&this.$first==w){this.skins["default"]=this.skins[C];}var D=G.childNodes;for(var z=D.length-1;z>=0;z--){if(D[z].nodeType!=1){continue;}this.skins[C].templates[D[z].getAttribute("name")]=D[z];if(D[z].ownerDocument){this.importSkinDef(D[z],B,C);}}this.purgeCss(A||B+"images/",u||B+"icons/");if(this.queue[C]){for(var E in this.queue[C]){this.queue[C][E]();}}},loadStylesheet:function(filename,title){var o;with(o=document.getElementsByTagName("head")[0].appendChild(document.createElement("LINK"))){rel="stylesheet";type="text/css";href=filename;title=title;}return o;},importSkinDef:function(xmlNode,basepath,name){var i,l,nodes=$xmlns(xmlNode,"style",apf.ns.aml),tnode,node;for(i=0,l=nodes.length;i<l;i++){node=nodes[i];if(node.getAttribute("src")){this.loadStylesheet(node.getAttribute("src").replace(/src/,basepath+"/src"));}else{var test=true;if(node.getAttribute("condition")){try{test=eval(node.getAttribute("condition"));}catch(e){test=false;}}if(test){tnode=node.firstChild;while(tnode){this.css.push(tnode.nodeValue);tnode=tnode.nextSibling;}}}}nodes=$xmlns(xmlNode,"alias",apf.ns.apf);var t=this.skins[name].templates;for(i=0;i<nodes.length;i++){if(!nodes[i].firstChild){continue;}t[nodes[i].firstChild.nodeValue.toLowerCase()]=xmlNode;}},loadedCss:"",purgeCss:function(i,j){if(!this.css.length){return;}var l=this.css.join("\n").replace(/images\//g,i).replace(/icons\//g,j);apf.importCssString(l);this.loadedCss+=l;this.css=[];},loadCssInWindow:function(s,A,w,q){this.css=[];var z=s.split(":");var o=this.skins[z[0]];var u=o.templates[z[1]];this.importSkinDef(u,o.base,o.name);var t=this.css.join("\n").replace(/images\//g,w).replace(/icons\//g,q);apf.importCssString(t);this.css=[];},setSkinPaths:function(j,m){j=j.split(":");var n=j[0];var l=j[1];m.iconPath=this.skins[n].iconPath;m.mediaPath=this.skins[n].mediaPath;},getTemplate:function(w,A){w=w.split(":");var s=w[0];var z=w[1];if(!this.skins[s]){if(A){return false;}return false;}if(!this.skins[s].templates[z]){return false;}var u=this.skins[s].templates[z];var q=this.skins[s].originals[z];if(!q){q=this.skins[s].originals[z]={};var t=$xmlns(u,"presentation",apf.ns.aml)[0].childNodes;for(var i=0;i<t.length;i++){if(t[i].nodeType!=1){continue;}q[t[i].baseName||t[i][apf.TAGNAME]]=t[i];}}return q;},getCssString:function(c){return apf.queryValue($xmlns(this.skins[c.split(":")[0]].xml,"style",apf.ns.aml)[0],"text()");},changeSkinset:function(i){var d=apf.document.documentElement;while(d){if(d&&d.nodeFunc==apf.NODE_VISIBLE&&d.hasFeature(apf.__PRESENTATION__)&&!d.skinset){d.$propHandlers.skinset.call(d,i);d.skinset=null;}if(d.firstChild||d.nextSibling){d=d.firstChild||d.nextSibling;}else{do{d=d.parentNode;}while(d&&!d.nextSibling);if(d){d=d.nextSibling;}}}},queue:{},waitForSkin:function(i,j,l){if(this.skins[i]){return;}(this.queue[i]||(this.queue[i]={}))[j]=l;return true;},iconMaps:{},addIconMap:function(c){this.iconMaps[c.name]=c;if(c.size){c.width=c.height=c.size;}else{if(!c.width){c.width=1;}if(!c.height){c.height=1;}}},setIcon:function(w,A,s){if(!A){w.style.backgroundImage="";return;}if(w.tagName.toLowerCase()=="img"){w.setAttribute("src",A?(s||"")+A:"");return;}var o=A.split(":");var q=this.iconMaps[o[0]];if(q){var t,u,z=o[1].split(",");t=(z[(q.type=="vertical")?1:0]||0)*q.width;u=(z[(q.type=="vertical")?0:1]||0)*q.height;w.style.backgroundImage="url("+(s||"")+q.src+")";w.style.backgroundPosition=((-1*t)-q.offset[0])+"px "+((-1*u)-q.offset[1])+"px";}else{w.style.backgroundImage="url("+(s||"")+A+")";}}};apf.flow={isMoved:false,objCanvases:{},connectionsTemp:null,connectionsManager:null,sSize:7,fsSize:15,init:function(){document.body.onmousedown=function(F){F=(F||event);var E=F.target||F.srcElement,K=false;if(E.tagName=="HTML"){return;}while(E!=document.body&&!apf.flow.findBlock(E.id)){E=E.parentNode||E.parentElement;}var D=apf.flow.isBlock(E);if(!D){return;}if(!D.draggable){return;}var Q=F.clientX,l=F.clientY,t=0,M=0,I=parseInt(E.style.left),O=parseInt(E.style.top),C,P;var J=D.canvas.snap,G=D.canvas.gridW,N=D.canvas.gridH;if(F.preventDefault){F.preventDefault();}document.body.onmousemove=function(a){a=(a||event);K=true;t=a.clientX-Q;M=a.clientY-l;C=O+M;P=I+t;if(J){E.style.left=Math.round(P/G)*G+"px";E.style.top=Math.round(C/N)*N+"px";}else{E.style.left=P+"px";E.style.top=C+"px";}D.onMove();apf.flow.onblockmove();return false;};document.body.onmouseup=function(a){document.body.onmousemove=null;if(apf.flow.onaftermove&&K){apf.flow.onaftermove(M,t);K=false;}};};}};apf.flow.canvas=function(c){if(!c.getAttribute("id")){apf.setUniqueHtmlId(c);}this.id=c.getAttribute("id");this.htmlElement=c;this.htmlBlocks={};this.htmlConnectors={};this.scrollPointer=null;this.lastTop=0;this.lastLeft=0;this.mode="normal";this.disableremove=false;this.snap=false;this.gridW=48;this.gridH=48;this.initCanvas=function(){apf.flow.objCanvases[this.htmlElement.getAttribute("id")]=this;};this.removeConnector=function(a){var j=this.htmlConnectors[a];j.htmlElement.parentNode.removeChild(j.htmlElement);this.htmlConnectors[a]=j=null;delete this.htmlConnectors[a];};this.deselectConnections=function(){for(var a in this.htmlConnectors){var i=this.htmlConnectors[a];if(i.selected){i.deselect("selected");i.deselectInputs("Selected");i.selected=false;}}};this.setMode=function(a){this.mode=a;};this.getMode=function(){return this.mode;};this.getWindowScrollLeft=function(){return document.documentElement.scrollLeft||document.body.scrollLeft;};this.getWindowScrollTop=function(){return document.documentElement.scrollTop||document.body.scrollTop;};this.scrollLeft=function(){this.htmlElement.scrollLeft=9999;};this.scrollTop=function(){this.htmlElement.scrollTop=9999;};this.getScrollLeft=function(){return this.htmlElement.scrollLeft;};this.getScrollTop=function(){return this.htmlElement.scrollTop;};this.addScrollPointer=function(){this.scrollPointer=this.htmlElement.appendChild(document.createElement("div"));this.scrollPointer.className="scrollPointer";};this.moveLeftScrollPointer=function(a){var i=parseInt(a)+150;this.scrollPointer.style.left=i+"px";this.lastLeft=parseInt(a);};this.moveTopScrollPointer=function(a){var i=parseInt(a)+150;this.scrollPointer.style.top=i+"px";this.lastTop=parseInt(a);};this.getWidth=function(){return this.htmlElement.offsetWidth;};this.getHeight=function(){return this.htmlElement.offsetHeight;};};apf.flow.block=function(l,m,n){this.canvas=m;this.htmlElement=l;this.id=l.getAttribute("id");this.moveListeners=new Array();this.draggable=true;this.htmlOutputs={};this.image=null;this.other=n;var j=this;this.destroy=function(){this.htmlElement.onmouseover=this.htmlElement.onmouseout=this.htmlElement.onclick=null;for(var a=this.moveListeners.length-1;a>=0;a--){this.moveListeners[a].destroy();this.moveListeners.removeIndex(a);}delete this.canvas.htmlBlocks[this.id];};this.initBlock=function(){this.canvas.htmlBlocks[this.id]=this;var A,w,i,a,c=this.htmlElement.childNodes,d=0,z=c.length;for(;d<z;d++){A=c[d].tagName;if(A&&(A=A.toLowerCase())){if(A=="div"){w=c[d].childNodes;for(i=0,a=w.length;i<a;i++){if(w[i].tagName&&w[i].tagName.toLowerCase()=="img"){this.imageContainer=c[d];this.image=w[i];}}}else{if(A=="blockquote"){this.caption=c[d];}}}}if(!this.other.type){apf.setStyleClass(this.htmlElement,"empty");this.image.style.display="none";}else{if(this.other.picture==null){this.image.style.display="none";}else{this.image.style.display="block";this.image.src=this.other.picture;this.image.onload=function(){j.changeRotation(j.other.rotation,j.other.fliph,j.other.flipv,true);};}}this.other.ratio=this.other.dwidth/this.other.dheight;this.changeRotation(j.other.rotation,j.other.fliph,j.other.flipv,true);this.setCaption(this.other.caption);this.setLock(this.other.lock,true);this.updateOutputs();};this.updateOutputs=function(){var i,c,s,a,d,t=this.other.inputList;for(i in t){c=this.htmlOutputs[i]?this.htmlOutputs[i]:new apf.flow.input(this,i);if(!this.htmlOutputs[i]){this.htmlOutputs[i]=c;}s=this.updateInputPos(t[i]);a=s[0]-(s[2]=="left"||s[2]=="right"?Math.ceil(parseInt(apf.getStyle(c.htmlElement,"width"))/2):Math.ceil(apf.flow.sSize/2));d=s[1]-(s[2]=="top"||s[2]=="bottom"?Math.ceil(parseInt(apf.getStyle(c.htmlElement,"height"))/2):Math.ceil(apf.flow.sSize/2));c.lastUpdate=s;c.moveTo(a,d);}};this.outputsVisibility=function(a){var c=this.htmlOutputs;for(var i in c){var d=c[i];if(a){d.show();}else{d.hide();}}};this.setLock=function(c,a){if(this.other.lock!==c||a){this.draggable=!c;this.other.lock=c;this.outputsVisibility(!c);if(c){apf.setStyleClass(this.htmlElement,"locked");}else{apf.setStyleClass(this.htmlElement,"",["locked"]);}}};this.setCaption=function(c){var a=this.caption;if(!a||a.nodeType!=1){return;}a.innerHTML=c;if(this.other.capPos=="inside"){if(a.offsetWidth!==0&&a.offsetHeight!==0){a.style.marginLeft="-"+(Math.ceil(a.offsetWidth/2))+"px";a.style.marginTop="-"+(Math.ceil(a.offsetHeight/2))+"px";}}};this.moveTo=function(d,i){var a=parseInt(this.htmlElement.style.top),c=parseInt(this.htmlElement.style.left);if(a!==d||c!==i){this.htmlElement.style.top=d+"px";this.htmlElement.style.left=i+"px";if(this.canvas.lastTop<d||d>this.canvas.getHeight()-100){this.canvas.moveTopScrollPointer(d);this.canvas.scrollTop();}if(this.canvas.lastLeft<i&&i>this.canvas.getWidth()-100){this.canvas.moveLeftScrollPointer(i);this.canvas.scrollLeft();}}};this.resize=function(i,d){var c=parseInt(this.htmlElement.style.width),a=parseInt(this.htmlElement.style.height);if(c!==i||a!==d){this.htmlElement.style.width=this.imageContainer.style.width=i+"px";this.htmlElement.style.height=this.imageContainer.style.height=d+"px";this.image.style.height=d+"px";this.image.style.width=i+"px";this.image.style.filter="";}};this.changeRotation=function(d,i,a,o){var u=this.other,c=[u.rotation,u.fliph,u.flipv];if(!u.type){return;}u.rotation=parseInt(d)%360||0;u.fliph=String(i)=="true"?true:false;u.flipv=String(a)=="true"?true:false;var w=(u.fliph&&!u.flipv?"horizontal":(!u.fliph&&u.flipv?"vertical":"none"));this.repaintImage(w,u.rotation,"rel");};this.repaintImage=function(E,c,i){var z=this.image;if(z.style.display=="none"){return;}z.style.display="block";z.angle=!i?((z.angle==undefined?0:z.angle)+c)%360:c;var d,B=Math.PI*(z.angle>=0?z.angle:360+z.angle)/180,C=Math.cos(B),a=Math.sin(B);if(document.all&&!window.opera){d=document.createElement("img");d.src=z.src;d.style.height=z.height+"px";d.style.width=z.width+"px";d.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11="+C+",M12="+(-a)+",M21="+a+",M22="+C+",SizingMethod='auto expand')";if(E!=="none"){d.style.filter+="progid:DXImageTransform.Microsoft.BasicImage("+(E=="horizontal"?"mirror=1":"rotation=2, mirror=1")+")";}}else{d=document.createElement("canvas");if(!z.oImage){d.oImage=new Image();d.oImage.src=z.src;}else{d.oImage=z.oImage;}d.style.width=d.width=Math.abs(C*d.oImage.width)+Math.abs(a*d.oImage.height);d.style.height=d.height=Math.abs(C*d.oImage.height)+Math.abs(a*d.oImage.width);var A=d.getContext("2d");A.save();switch(E){case"vertical":A.translate(0,d.oImage.height);A.scale(1,-1);break;case"horizontal":A.translate(d.oImage.height,0);A.scale(-1,1);break;}if(B<=Math.PI/2){A.translate(a*d.oImage.height,0);}else{if(B<=Math.PI){A.translate(d.width,-C*d.oImage.height);}else{if(B<=1.5*Math.PI){A.translate(-C*d.oImage.width,d.height);}else{A.translate(0,-a*d.oImage.width);}}}A.rotate(B);try{A.drawImage(d.oImage,0,0,d.oImage.width,d.oImage.height);A.restore();}catch(D){}}d.angle=z.angle;this.imageContainer.replaceChild(d,z);this.image=d;};this.onMove=function(){for(var a=0,d=this.moveListeners,c=d.length;a<c;a++){d[a].onMove();}};this.updateInputPos=function(X,V){var c=this.htmlElement,Z=this.other,Y=parseInt(c.style.width),Q=parseInt(c.style.height),ac=X?X.position:"auto",ae=X?X.x:Y/2,af=X?X.y:Q/2,ad=Z.dwidth,i=Z.dheight,ah=Z.flipv,w=Z.fliph,aa=Z.rotation,ag={0:"top",1:"right",2:"bottom",3:"left",top:0,right:1,bottom:2,left:3},o=apf.flow.sSize,a=Math.floor(apf.flow.sSize/2);ac=(ac=="auto")?"auto":ag[(ag[ac]+parseInt(aa)/90)%4];if(ac!=="auto"){if(ah){ac=ac=="top"?"bottom":(ac=="bottom"?"top":ac);}if(w){ac=ac=="left"?"right":(ac=="right"?"left":ac);}ae=(aa==90||aa==270)?ae*Q/i:ae*Y/ad;af=(aa==90||aa==270)?af*Y/ad:af*Q/i;var R=ae,T=af;R=(aa==90)?Y-af-1:(aa==180?Y-ae-1:(aa==270?af:ae));T=(aa==90)?ae:(aa==180?Q-af-1:(aa==270?Q-ae-1:af));R=w?Y-R:R;T=ah?Q-T:T;R=w?(ac=="top"||ac=="bottom"?R-1:R):R;T=ah?(ac=="left"||ac=="right"?T-1:T):T;R=ac=="top"||ac=="bottom"?R-(o/2)+(apf.isIE||apf.isOpera||apf.isChrome?1:0):R;T=ac=="left"||ac=="right"?T-(o/2)+(apf.isIE||apf.isOpera||apf.isChrome?1:0):T;}else{var W=parseInt(c.style.top),d=parseInt(c.style.left),ab=V[1],U=V[0];ad=V[2],i=V[3];if(W+Q*1.5<ab){ac="bottom";}else{if(W>ab+i*1.5){ac="top";}else{if(d>U+ad/2){ac="left";}else{if(d<U){ac="right";}else{ac="left";}}}}R=(ac=="top"||ac=="bottom")?Y/2-a:ac=="right"?Y:0;T=(ac=="left"||ac=="right")?Q/2-a:ac=="bottom"?Q:0;}return[R,T,ac];};this.htmlElement.onmouseup=function(a){if(!j.other.type&&j.canvas.mode=="connection-add"){apf.flow.connectionsManager.addBlock(j,0);}};};apf.flow.input=function(n,m){this.objBlock=n;this.htmlElement=n.htmlElement.appendChild(document.createElement("div"));this.number=m;this.lastUpdate=null;var q=this;apf.setStyleClass(this.htmlElement,"input");this.hide=function(){this.htmlElement.style.display="none";};this.show=function(){this.htmlElement.style.display="block";};this.moveTo=function(c,a){this.htmlElement.style.left=c+"px";this.htmlElement.style.top=a+"px";};var o;var l;this.htmlElement.onmousedown=function(B){B=(B||event);B.cancelBubble=true;apf.flow.isMoved=true;var c=q.objBlock.canvas,a=q.htmlElement.parentNode,C=c.mode;if(B.preventDefault){B.preventDefault();}l=new apf.flow.virtualMouseBlock(c,B);var d=apf.flow.findConnector(q.objBlock,q.number);if(d){var i=d.source?d.connector.objDestination:d.connector.objSource,A=d.source?d.connector.objSource:d.connector.objDestination,z=d.source?d.connector.other.input:d.connector.other.output,j=d.source?d.connector.other.output:d.connector.other.input;l.other.inputList[1].position=A.updateInputPos(A.other.inputList[j])[2];q.objBlock.onremoveconnection([d.connector.other.xmlNode]);apf.flow.removeConnector(d.connector.htmlElement);o=new apf.flow.addConnector(c,i,l,{output:z,input:1});apf.flow.connectionsManager.addBlock(i,z);c.setMode("connection-change");}else{o=new apf.flow.addConnector(c,q.objBlock,l,{output:q.number});apf.flow.connectionsManager.addBlock(q.objBlock,q.number);c.setMode("connection-add");}o.newConnector.virtualSegment=true;l.onMove(B);document.body.onmousemove=function(s){s=(s||event);if(l){l.onMove(s);}};document.body.onmouseup=function(s){s=(s||event);var t=s.target||s.srcElement;document.body.onmousemove=null;apf.flow.isMoved=false;if(t&&c.mode=="connection-change"){if((t.className||"").indexOf("input")==-1){apf.flow.connectionsManager.addBlock(A,j);}}apf.flow.connectionsManager.clear();if(o){apf.flow.removeConnector(o.newConnector.htmlElement);}if(l){l.onMove(s);l.destroy();l=null;q.objBlock.canvas.setMode("normal");}};};this.htmlElement.onmouseup=function(a){apf.flow.connectionsManager.addBlock(q.objBlock,q.number);};this.htmlElement.onmouseover=function(c){var a=q.objBlock.canvas.mode;if(a=="connection-add"||a=="connection-change"){apf.setStyleClass(q.htmlElement,"inputHover");}};this.htmlElement.onmouseout=function(a){apf.setStyleClass(q.htmlElement,"",["inputHover"]);};};apf.flow.connectionsManager=new (function(){this.addBlock=function(l,i){if(l&&(i||i==0)){var j=apf.flow.connectionsTemp;if(!j){apf.flow.connectionsTemp={objBlock:l,inputNumber:i};}else{if(j.objBlock.id!==l.id||j.inputNumber!==i){l.oncreateconnection(j.objBlock.other.xmlNode,j.inputNumber,l.other.xmlNode,i);l.canvas.setMode("normal");}this.clear();}}};this.clear=function(){apf.flow.connectionsTemp=null;};})();apf.flow.virtualMouseBlock=function(l){var j=[0,0,"virtual"];this.canvas=l;this.htmlElement=document.createElement("div");this.canvas.htmlElement.appendChild(this.htmlElement);this.htmlElement.style.display="block";this.moveListeners=new Array();this.draggable=0;this.htmlOutputs={};this.htmlOutputs[1]={htmlElement:this.htmlElement.appendChild(document.createElement("div")),number:1,lastUpdate:j};this.other={};this.other.inputList={};this.other.inputList[1]={x:j[0],y:j[1],position:j[2]};apf.setStyleClass(this.htmlElement,"vMB");var i=apf.getAbsolutePosition(this.canvas.htmlElement);this.onMove=function(d){this.htmlElement.style.left=(d.clientX+2+this.canvas.getWindowScrollLeft()+this.canvas.getScrollLeft()-i[0])+"px";this.htmlElement.style.top=(d.clientY+2+this.canvas.getWindowScrollTop()+this.canvas.getScrollTop()-i[1])+"px";for(var a=0,c=this.moveListeners.length;a<c;a++){this.moveListeners[a].onMove();}};this.destroy=function(){this.htmlElement.parentNode.removeChild(this.htmlElement);};this.updateInputPos=function(a){return j;};};apf.flow.connector=function(E,G,D,F,w){this.htmlSegments=[];var I=[];this.htmlLabel=null;this.htmlStart=null;this.htmlEnd=null;this.objSource=D;this.objDestination=F;this.other=w;this.selected=false;this.htmlElement=E;this.virtualSegment=null;var A=apf.flow.sSize,u=apf.flow.fsSize,C=Math.floor(A/2),z=this.objSource.htmlElement,B=this.objDestination.htmlElement,J=this;this.initConnector=function(){if(!E.getAttribute("id")){apf.setUniqueHtmlId(E);}G.htmlConnectors[E.getAttribute("id")]=this;this.objSource.moveListeners.push(this);this.objDestination.moveListeners.push(this);this.activateInputs();this.onMove();};this.activateInputs=function(){this.i1=w.output&&this.objSource.other.inputList[w.output]?this.objSource.other.inputList[w.output]:{x:0,y:0,position:"auto"};this.i2=w.input&&this.objDestination.other.inputList[w.input]?this.objDestination.other.inputList[w.input]:{x:0,y:0,position:"auto"};};this.destroy=function(){this.deselectInputs("Selected");var d=this.objSource.moveListeners,a=0,c=d.length;for(;a<c;a++){if(d[a]==this){this.objSource.moveListeners.removeIndex(a);}}var i=this.objDestination.moveListeners;for(a=0,c=i.length;a<c;a++){if(i[a]==this){this.objDestination.moveListeners.removeIndex(a);}}G.removeConnector(this.htmlElement.getAttribute("id"));};this.onMove=function(){this.draw();if(this.selected){this.deselectInputs("Hover");this.deselect("selected");this.deselectInputs("Selected");this.selected=false;}};this.draw=function(){var q,o,j=[],m=[parseInt(z.style.left),parseInt(z.style.top)],s=[parseInt(B.style.left),parseInt(B.style.top)];I=this.htmlSegments;this.htmlSegments=[];if(this.i1.position=="auto"||this.i2.position=="auto"){q=this.objSource.updateInputPos(this.i1,s);o=this.objDestination.updateInputPos(this.i2,m);}else{q=this.objSource.htmlOutputs[w.output].lastUpdate;o=this.objDestination.htmlOutputs[w.input].lastUpdate;}var a=q[2];var n=o[2];m[0]+=q[0];m[1]+=q[1];s[0]+=o[0];s[1]+=o[1];if(a!=="virtual"){m=this.createSegment(m,[u,a],true);}if(n!=="virtual"){s=this.createSegment(s,[u,n],true);}j=m;var c=m[0]>s[0]?(m[1]>s[1]?"TL":(m[1]<s[1]?"BL":"ML")):(m[0]<s[0]?(m[1]>s[1]?"TR":(m[1]<s[1]?"BR":"MR")):(m[1]>s[1]?"TM":(m[1]<s[1]?"MM":"BM"))),l=c+(a=="left"?1:(a=="right"?2:a=="top"?4:8))+(n=="left"?1:(n=="right"?2:n=="top"?4:8));switch(l){case"TR41":j=this.createSegment(j,[apf.isGecko?m[1]-s[1]:Math.ceil(m[1]-s[1]),"top"]);j=this.createSegment(j,[apf.isGecko?s[0]-m[0]:Math.ceil(s[0]-m[0]),"right"]);break;case"TR44":case"TR14":case"TR11":j=this.createSegment(j,[apf.isGecko?m[1]-s[1]:Math.ceil(m[1]-s[1]),"top"]);j=this.createSegment(j,[apf.isGecko?s[0]-m[0]:Math.floor(s[0]-m[0]),"right"]);break;case"BR22":case"BR24":case"BR42":case"BR44":j=this.createSegment(j,[apf.isGecko?s[0]-m[0]:Math.floor(s[0]-m[0]),"right"]);j=this.createSegment(j,[Math.ceil(Math.abs(s[1]-m[1])),"bottom"]);break;case"BR41":j=this.createSegment(j,[apf.isGecko?(s[0]-m[0])/2:(s[0]-m[0])/2,"right"]);j=this.createSegment(j,[s[1]-m[1],"bottom"]);j=this.createSegment(j,[apf.isGecko?(s[0]-m[0])/2:Math.ceil((s[0]-m[0])/2),"right"]);break;case"BR48":case"BR28":j=this.createSegment(j,[apf.isGecko?(s[0]-m[0])/2:(s[0]-m[0])/2,"right"]);j=this.createSegment(j,[apf.isGecko?s[1]-m[1]:Math.ceil(s[1]-m[1]),"bottom"]);j=this.createSegment(j,[apf.isGecko?(s[0]-m[0])/2:(s[0]-m[0])/2,"right"]);break;case"BR21":j=this.createSegment(j,[apf.isGecko?(s[0]-m[0])/2:(s[0]-m[0])/2,"right"]);j=this.createSegment(j,[apf.isGecko?s[1]-m[1]:Math.ceil(s[1]-m[1]),"bottom"]);j=this.createSegment(j,[parseInt((s[0]-m[0])/2)+1,"right"]);break;case"TL44":case"TL42":case"TL24":case"TL22":j=this.createSegment(j,[apf.isGecko?m[1]-s[1]:Math.ceil(m[1]-s[1]),"top"]);j=this.createSegment(j,[apf.isGecko?m[0]-s[0]:Math.ceil(m[0]-s[0]),"left"]);break;case"TR21":case"TR24":case"TR81":case"TR84":case"TR21":case"TR24":case"TR81":case"TR84":j=this.createSegment(j,[apf.isGecko?(s[0]-m[0])/2:(s[0]-m[0])/2,"right"]);j=this.createSegment(j,[apf.isGecko?m[1]-s[1]:Math.ceil(m[1]-s[1]),"top"]);j=this.createSegment(j,[apf.isGecko?(s[0]-m[0])/2:(s[0]-m[0])/2,"right"]);break;case"BR18":case"BR88":case"BR81":case"BR11":j=this.createSegment(j,[s[1]-m[1],"bottom"]);j=this.createSegment(j,[apf.isGecko?s[0]-m[0]:Math.ceil(s[0]-m[0]),"right"]);break;case"BR14":j=this.createSegment(j,[apf.isGecko?(s[1]-m[1])/2:Math.ceil((s[1]-m[1])/2),"bottom"]);j=this.createSegment(j,[apf.isGecko?s[0]-m[0]:Math.floor(s[0]-m[0]),"right"]);j=this.createSegment(j,[Math.ceil((s[1]-m[1])/2),"bottom"]);break;case"BR84":case"BR82":case"BR12":j=this.createSegment(j,[apf.isGecko?(s[1]-m[1])/2:Math.ceil((s[1]-m[1])/2),"bottom"]);j=this.createSegment(j,[apf.isGecko?s[0]-m[0]:Math.floor(s[0]-m[0]),"right"]);j=this.createSegment(j,[(s[1]-m[1])/2,"bottom"]);break;case"BL84":case"BL24":case"BL21":j=this.createSegment(j,[apf.isGecko?(s[1]-m[1])/2:Math.ceil((s[1]-m[1])/2),"bottom"]);j=this.createSegment(j,[apf.isGecko?m[0]-s[0]:Math.ceil(m[0]-s[0]),"left"]);j=this.createSegment(j,[apf.isGecko?(s[1]-m[1])/2:Math.ceil((s[1]-m[1])/2),"bottom"]);break;case"BL11":case"BL14":case"BL41":case"BL44":case"BL81":j=this.createSegment(j,[apf.isGecko?m[0]-s[0]:Math.ceil(m[0]-s[0]),"left"]);j=this.createSegment(j,[apf.isGecko?s[1]-m[1]:Math.ceil(s[1]-m[1]),"bottom"]);break;case"BL12":case"BL18":case"BL42":case"BL48":j=this.createSegment(j,[apf.isGecko?(m[0]-s[0])/2:(m[0]-s[0])/2,"left"]);j=this.createSegment(j,[apf.isGecko?s[1]-m[1]:Math.ceil(s[1]-m[1]),"bottom"]);j=this.createSegment(j,[apf.isGecko?(m[0]-s[0])/2:(m[0]-s[0])/2,"left"]);break;case"BL88":case"BL82":case"BL28":case"BL22":j=this.createSegment(j,[apf.isGecko?s[1]-m[1]:Math.ceil(s[1]-m[1]),"bottom"]);j=this.createSegment(j,[apf.isGecko?m[0]-s[0]:Math.ceil(m[0]-s[0]),"left"]);break;case"TL88":case"TL81":case"TL18":case"TL11":j=this.createSegment(j,[apf.isGecko?m[0]-s[0]:Math.ceil(m[0]-s[0]),"left"]);j=this.createSegment(j,[apf.isGecko?m[1]-s[1]:Math.ceil(m[1]-s[1]),"top"]);break;case"TL41":j=this.createSegment(j,[apf.isGecko?(m[1]-s[1])/2:Math.floor((m[1]-s[1])/2),"top"]);j=this.createSegment(j,[apf.isGecko?m[0]-s[0]:Math.ceil(m[0]-s[0]),"left"]);j=this.createSegment(j,[apf.isGecko?(m[1]-s[1])/2:Math.ceil((m[1]-s[1])/2),"top"]);break;case"TL48":case"TL28":case"TL21":j=this.createSegment(j,[apf.isGecko?(m[1]-s[1])/2:Math.floor((m[1]-s[1])/2),"top"]);j=this.createSegment(j,[apf.isGecko?m[0]-s[0]:Math.ceil(m[0]-s[0]),"left"]);j=this.createSegment(j,[apf.isGecko?(m[1]-s[1])/2:Math.floor((m[1]-s[1])/2),"top"]);break;case"TL12":case"TL14":case"TL82":case"TL84":j=this.createSegment(j,[apf.isGecko?(m[0]-s[0])/2:(m[0]-s[0])/2,"left"]);j=this.createSegment(j,[apf.isGecko?m[1]-s[1]:Math.ceil(m[1]-s[1]),"top"]);j=this.createSegment(j,[apf.isGecko?(m[0]-s[0])/2:(m[0]-s[0])/2,"left"]);break;case"TR12":case"TR18":case"TR42":case"TR48":j=this.createSegment(j,[apf.isGecko?(m[1]-s[1])/2:Math.floor((m[1]-s[1])/2),"top"]);j=this.createSegment(j,[apf.isGecko?s[0]-m[0]:Math.floor(s[0]-m[0]),"right"]);j=this.createSegment(j,[apf.isGecko?(m[1]-s[1])/2:Math.floor((m[1]-s[1])/2),"top"]);break;case"TR22":case"TR28":case"TR82":case"TR88":j=this.createSegment(j,[apf.isGecko?s[0]-m[0]:Math.floor(s[0]-m[0]),"right"]);j=this.createSegment(j,[apf.isGecko?m[1]-s[1]:Math.ceil(m[1]-s[1]),"top"]);break;default:switch(c){case"ML":j=this.createSegment(j,[apf.isGecko?m[0]-s[0]:Math.ceil(m[0]-s[0]),"left"]);break;case"MM":j=this.createSegment(j,[apf.isGecko?m[0]-s[0]:Math.ceil(m[0]-s[0]),"left"]);j=this.createSegment(j,[apf.isGecko?s[1]-m[1]:Math.ceil(s[1]-m[1]),"bottom"]);break;case"TM":j=this.createSegment(j,[apf.isGecko?m[1]-s[1]:Math.ceil(m[1]-s[1]),"top"]);j=this.createSegment(j,[apf.isGecko?m[0]-s[0]:Math.ceil(m[0]-s[0]),"left"]);break;case"MR":j=this.createSegment(j,[apf.isGecko?s[0]-m[0]:Math.floor(s[0]-m[0]),"right"]);if(l.substring(2,4)=="41"){break;}j=this.createSegment(j,[Math.abs(s[1]-m[1]),"bottom"]);break;}break;}for(var d=I.length-1;d>=0;d--){I[d][0].style.display="none";}if(this.other.label){this.htmlLabel=apf.flow.label(this);}if(this.other.type){var i=this.other.type.split("-");if(i[0]!=="none"){this.htmlStart=apf.flow.connectorsEnds(this,"start",i[0]);}if(i[1]!=="none"){this.htmlEnd=apf.flow.connectorsEnds(this,"end",i[1]);}}};this.createSegment=function(m,j,d){var a=j[1],c=j[0],i=m[0]||0,P=m[1]||0,q=I.shift(),o=this,t=q?q[0]:null,Q=(a=="top"||a=="bottom")?"ver":"hor";if(!t){t=E.appendChild(document.createElement("div"));apf.setUniqueHtmlId(t);apf.setStyleClass(t,"segment");if(o.selected){o.select("selected");}var n=this.objSource.canvas;t.onmouseover=function(K){if(!apf.flow.isMoved&&((n.mode=="connection-change"&&o.selected)||n.mode=="connection-add")){o.select("hover");}};t.onmouseout=function(K){o.deselect("hover");};t.onmousedown=function(K){K=K||event;K.cancelBubble=true;o.deselect("selected");o.select("clicked");};t.onmouseup=function(N){N=(N||event);N.cancelBubble=true;var M=N.ctrlKey,K=o.selected;if(!M){o.objSource.canvas.deselectConnections();}o.selected=K?false:o.selected?false:true;if(o.selected){o.selectInputs("Selected");o.deselect("clicked");o.select("selected");n.setMode("connection-change");}else{o.deselectInputs("Selected");o.deselect("clicked");o.deselect("selected");n.setMode("normal");}};}t.plane=Q;var l=Q=="ver"?A:c,R=Q=="ver"?c:A,s="segment seg_"+Q;if(o.virtualSegment){s+=" seg_"+Q+"_virtual";}t.className=s;if(a=="top"){P-=c;}if(a=="left"){i-=c;}t.style.display="block";t.style.left=i+(Q=="hor"&&!d||(a=="left"&&d)?3:0)+"px";t.style.top=P+(Q=="ver"?3:0)+"px";t.style.width=l+(a=="left"&&d?-3:(a=="right"&&d?3:0))+"px";t.style.height=R+"px";if(a=="bottom"){P+=R;}if(a=="right"){i+=l;}this.htmlSegments.push([t,a]);return[i,P];};this.deselect=function(a){var c=this.htmlElement.childNodes,i=0,d=c.length;for(;i<d;i++){if((c[i].className||"").indexOf("segment")!=-1){apf.setStyleClass(c[i],"",["seg_"+c[i].plane+"_"+a]);}}if(!this.selected){this.deselectInputs("Selected");}if(this.htmlLabel&&a=="selected"){this.htmlLabel.className="label";}};this.select=function(a){var c=this.htmlElement.childNodes,i=0,d=c.length;for(;i<d;i++){if((c[i].className||"").indexOf("segment")!=-1){apf.setStyleClass(c[i],"seg_"+c[i].plane+"_"+a);}}this.selectInputs();if(this.htmlLabel&&a=="selected"){this.htmlLabel.className="label labelSelected";}};this.selectInputs=function(d){if(this.other.output&&this.objSource.htmlOutputs[w.output]){var a=this.objSource.htmlOutputs[w.output].htmlElement;apf.setStyleClass(a,"input"+d);}if(this.other.input&&this.objDestination.htmlOutputs[w.input]){var c=this.objDestination.htmlOutputs[w.input].htmlElement;apf.setStyleClass(c,"input"+d);}};this.deselectInputs=function(d){if(this.other.output&&this.objSource.htmlOutputs[this.other.output]){var a=this.objSource.htmlOutputs[this.other.output].htmlElement;apf.setStyleClass(a,"",["input"+d]);}if(this.other.input&&this.objDestination.htmlOutputs[this.other.input]){var c=this.objDestination.htmlOutputs[this.other.input].htmlElement;apf.setStyleClass(c,"",["input"+d]);}};};apf.flow.connectorsEnds=function(w,A,l){var s=(A=="start")?w.htmlStart:w.htmlEnd,z=w.htmlSegments[A=="start"?0:1],q=parseInt(z[0].style.left),t=parseInt(z[0].style.top),u=s?s:w.htmlElement.appendChild(document.createElement("div"));t+=(z[1]=="top")?parseInt(z[0].style.height)-14:0;q+=(z[1]=="left")?parseInt(z[0].style.width)-11:(z[1]=="right"?3:0);u.style.left=q+"px";u.style.top=t+"px";u.className="connector-end "+l+" or"+z[1];return u;};apf.flow.label=function(t,o){o=o||Math.ceil(t.htmlSegments.length/2);var l,q=t.htmlSegments[o],n=parseInt(q[0].style.left),s=parseInt(q[0].style.top);if(t.htmlLabel){l=t.htmlLabel;}else{l=t.htmlElement.appendChild(document.createElement("span"));apf.setStyleClass(l,"label");}n+=q[1]=="top"||q[1]=="bottom"?q[0].offsetWidth+3:(q[0].offsetWidth-l.offsetWidth)/2;s+=q[1]=="top"||q[1]=="bottom"?(q[0].offsetHeight-l.offsetHeight)/2:q[0].offsetHeight-2;l.style.left=n+"px";l.style.top=s+"px";l.innerHTML=t.other.label;return l;};apf.flow.findBlock=function(c){var j=apf.flow.objCanvases;for(var l in j){if(j[l].htmlBlocks[c]){return j[l].htmlBlocks[c];}}};apf.flow.isBlock=function(c){if(!c){return;}var l,n,m=apf.flow.objCanvases;for(l in m){n=m[l].htmlBlocks[c.getAttribute("id")];if(n){return n;}}};apf.flow.isCanvas=function(c){if(c){return apf.flow.objCanvases[c.id];}};apf.flow.findConnector=function(G,C,w,B){var F,c,D,J,z,I,E,A=apf.flow.objCanvases;for(F in A){E=A[F].htmlConnectors;for(c in E){if(E[c]){D=E[c].objSource,J=E[c].objDestination,z=E[c].other.output,I=E[c].other.input;if(w&&B){if(D.id==G.id&&z==C&&J.id==w.id&&I==B){return{connector:E[c],source:true};}else{if(J.id==G.id&&I==C&&D.id==w.id&&z==B){return{connector:E[c],source:false};}}}else{if(D==G&&z==C){return{connector:E[c],source:true};}else{if(J==G&&I==C){return{connector:E[c],source:false};}}}}}}};apf.flow.isConnector=function(c){var j=apf.flow.objCanvases;for(var l in j){if(j[l].htmlConnectors[c.id]){return j[l].htmlConnectors[c.id];}}};apf.flow.getCanvas=function(i){var d=apf.flow.isCanvas(i);if(!d){d=new apf.flow.canvas(i);d.initCanvas();}return d;};apf.flow.removeCanvas=function(i){var d=apf.flow.isCanvas(i);d.destroy();};apf.flow.addBlock=function(m,n,j){if(m&&!apf.flow.isBlock(m)){if(!m.getAttribute("id")){apf.setUniqueHtmlId(m);}var l=new apf.flow.block(m,n,j);l.initBlock();return l;}};apf.flow.removeBlock=function(d){var i=apf.flow.isBlock(d);i.destroy();};apf.flow.addConnector=function(c,n,d,o){var q=c.htmlElement.appendChild(document.createElement("div"));this.newConnector=new apf.flow.connector(q,c,n,d,o);this.newConnector.initConnector();};apf.flow.removeConnector=function(i){var d=apf.flow.isConnector(i);if(d){d.destroy();}delete d;};apf.layout={layouts:{},addParent:function(l,i){var j;if(!(j=l.getAttribute("id"))){j=apf.setUniqueHtmlId(l);}return this.layouts[j]={layout:new apf.layoutParser(l,i),controls:[]};},splitters:{},freesplitters:[],vars:{},getSplitter:function(i){if(!this.splitters[this.getHtmlId(i.parentNode)]){this.splitters[this.getHtmlId(i.parentNode)]=[];}if(this.freesplitters.length){var l=this.freesplitters.pop();}else{var l=new apf.splitter();var j=apf.findHost(i.parentNode)||apf.document.documentElement;l.parentNode=j;l.skinset=apf.getInheritedAttribute(j,"skinset");l.dispatchEvent("DOMNodeInsertedIntoDocument");}this.splitters[this.getHtmlId(i.parentNode)].push(l);return l;},clearSplitters:function(j){var i=this.splitters[this.getHtmlId(j.parentNode)];if(!i){return;}for(var l=0;l<i.length;l++){this.freesplitters.push(i[l]);if(!i[l].$ext.parentNode){continue;}i[l].$ext.parentNode.removeChild(i[l].$ext);}i.length=0;},get:function(j,i){var l=this.layouts[j.getAttribute("id")];if(!l){l=this.addParent(j,i);}return l;},isLoadedXml:function(o){var n=o.childNodes;var m=o.selectSingleNode(".//node[@name]");var q=m?self[m.getAttribute("name")]:null;var s=q.$ext.parentNode;var t=this.getHtmlId(s);return(this.loadedXml[t]==o);},$loadFrom:function(c){apf.getData(c,{callback:function(a){if(!a){return;}apf.layout.loadXml(a);}});},loadedXml:{},cacheXml:{},loadXml:function(i){var s=i.childNodes;var w=i.selectSingleNode(".//node[@name]");var q=w?self[w.getAttribute("name")]:null;var t=q.$ext.parentNode;var A=this.get(t,apf.getBox(i.getAttribute("margin")||""));var u=this.getHtmlId(t);this.metadata=[];for(var z=0;z<s.length;z++){if(s[z].nodeType!=1){continue;}A.root=this.parseXml(s[z],A);break;}this.compile(t);if(apf.window.inited){this.activateRules(t);}this.loadedXml[u]=i;},metadata:[],getData:function(d,i){return{vbox:(d=="vbox"),hbox:(d=="hbox"),node:"vbox|hbox".indexOf(d)==-1,children:[],isRight:false,isBottom:false,edgeMargin:0,splitter:null,minwidth:0,minheight:0,weight:1,pHtml:i.parentNode,size:[300,200],position:[0,0],last:{},copy:function(){var a=apf.extend({},this);if(!this.node){a.children=[];for(var c=0;c<this.children.length;c++){a.children[c]=this.children[c].copy();a.children[c].parent=a;}}return a;},setPosition:function(c,a){this.oHtml.style.left=c+"px";this.oHtml.style.top=a+"px";this.position=[c,a];},setFloat:function(){var a=apf.getDiff(this.oHtml);this.oHtml.style.width=(this.size[0]-a[0])+"px";if(this.state<0){this.oHtml.style.height=(this.size[1]-a[1])+"px";}this.prehide();this.hidden=3;if(this.hid){var c=apf.lookup(this.hid);if(c.syncAlignment){c.syncAlignment(this);}}},unfloat:function(){if(this.hidden!=3){return;}this.show();},state:-1,minimize:function(a){if(this.state<0){this.lastfheight=this.fheight;this.fheight=""+a;this.lastsplitter=this.splitter;if(this.parent.vbox){this.splitter=-1;}this.state=1;}},restore:function(){if(this.state>0){this.fheight=this.lastfheight;this.splitter=this.lastsplitter;this.state=-1;}},hidden:false,hiddenChildren:[],prehide:function(a){if(this.hidden==3){this.hidden=true;if(this.hid){apf.lookup(this.hid).visible=false;}if(this.oHtml){this.oHtml.style.display="none";}return;}if(this.hidden&&!a){return;}if(!this.parent){return;}this.hidepos={prev:this.parent.children[this.stackId-1],next:this.parent.children[this.stackId+1]};this.hidden=true;var c,l,t=0,z,w,u=["children","hiddenChildren"];while(u.length){c=this.parent[u.pop()];for(z=0,w=c.length;z<w;z++){l=c[z];if(l!=this&&!l.hidden){t=1;break;}}}if(!t){this.parent.prehide(a);}if(a){return this.hide(true);}if(apf.layout.dlist.contains(this)){apf.layout.dlist.remove(this);return false;}else{apf.layout.dlist.pushUnique(this);}},preshow:function(a){if(!this.hidden){return;}this.hidden=false;if(a){return this.show(true);}if(this.parent.hidden){this.parent.preshow();}if(apf.layout.dlist.contains(this)){apf.layout.dlist.remove(this);return false;}else{apf.layout.dlist.pushUnique(this);}},hide:function(c){var m=this.parent.children;m.removeIndex(this.stackId);for(var a=0;a<m.length;a++){m[a].stackId=a;}this.parent.hiddenChildren.push(this);if(c){return;}if(this.hidden!=3){if(this.hid){apf.lookup(this.hid).visible=false;}if(this.oHtml){this.oHtml.style.display="none";}}},show:function(c){var m=this.parent.children;if(this.hidepos.prev&&this.hidepos.prev.parent==this.parent&&!this.hidepos.prev.hidden&&!apf.layout.dlist.contains(this.hidepos.prev)){if(m.length<this.hidepos.prev.stackId+1){m.push(this);}else{m.insertIndex(this,this.hidepos.prev.stackId+1);}}else{if(this.hidepos.next&&this.hidepos.next.parent==this.parent&&!this.hidepos.next.hidden&&!apf.layout.dlist.contains(this.hidepos.next)){if(this.hidepos.next.stackId==0){m.unshift(this);}else{if(m.length<this.hidepos.next.stackId-1){m.push(this);}else{m.insertIndex(this,this.hidepos.next.stackId-1);}}}else{if(!this.hidepos.prev){m.unshift(this);}else{if(!this.hidepos.next){m.push(this);}else{if(this.stackId<m.length){m.insertIndex(this,this.stackId);}else{m.push(this);}}}}}for(var a=0;a<m.length;a++){if(m[a]){m[a].stackId=a;}}this.parent.hiddenChildren.remove(this);if(!c){if(this.hidden!=3){if(this.hid){apf.lookup(this.hid).visible=true;}if(this.oHtml){this.oHtml.style.display="block";}}}this.hidden=false;this.hidepos=null;},remove:function(){var c=this.parent;if(!c){return;}if(this.hidden||c.hiddenChildren.contains(this)){c.hiddenChildren.remove(this);apf.layout.dlist.remove(this);}else{var o=c.children;o.remove(this);for(var n=0;n<o.length;n++){o[n].stackId=n;}}for(var a in this.last){if(a=="splitter"){if(c.originalMargin){if(c.parent.pOriginalMargin){c.parent.splitter=null;c.parent.edgeMargin=c.parent.pOriginalMargin[0];c.parent.pOriginalMargin=null;delete c.last.splitter;}c.splitter=null;c.edgeMargin=c.originalMargin[0];c.originalMargin=null;}}this[a]=c[a]||this.last[a];}this.last={};if(!c.children.length&&!c.hiddenChildren.length){c.remove();}this.parent=null;},add:function(a){this.parent=a;if(this.hidden){var m=a.hiddenChildren;m.push(this);}else{var m=a.children;m.push(this);for(var c=0;c<m.length;c++){if(m[c]){m[c].stackId=c;}}}}};},parseXml:function(x,layout,amlNode,norecur){var aData=this.getData(typeof amlNode=="string"?amlNode:x.localName||x[apf.TAGNAME],layout.layout);if(aData.node){if(!amlNode){amlNode=self[x.getAttribute("name")];}aData.oHtml=amlNode.$ext;amlNode.aData=aData;amlNode.$setLayout("alignment");var aml=amlNode;if(aml.getAttribute("width")){aData.fwidth=aml.getAttribute("width");}if(aml.getAttribute("height")){aData.fheight=aml.getAttribute("height");}if(!this.getHtmlId(aData.oHtml)){apf.setUniqueHtmlId(aData.oHtml);}aData.id=this.getHtmlId(aData.oHtml);if(aData.oHtml.style){aData.oHtml.style.position="absolute";}aData.hid=amlNode.$uniqueId;}else{aData.id=this.metadata.push(aData)-1;}if(x.getAttribute("align")){aData.template=x.getAttribute("align");}if(x.getAttribute("lean")){aData.isBottom=x.getAttribute("lean").match(/bottom/);}if(x.getAttribute("lean")){aData.isRight=x.getAttribute("lean").match(/right/);}if(x.getAttribute("edge")&&x.getAttribute("edge")!="splitter"){aData.edgeMargin=x.getAttribute("edge");}if(x.getAttribute("weight")){aData.weight=parseFloat(x.getAttribute("weight"));}if(x.getAttribute("splitter")||x.getAttribute("edge")=="splitter"){aData.splitter=x.getAttribute("splitter")||(x.getAttribute("edge")=="splitter"?4:false);}if(x.getAttribute("width")){aData.fwidth=String(apf.parseExpression(x.getAttribute("width")));}if(x.getAttribute("height")){aData.fheight=String(apf.parseExpression(x.getAttribute("height")));}if(x.getAttribute("lastsplitter")){aData.lastsplitter=x.getAttribute("lastsplitter");}if(x.getAttribute("hidden")){aData.hidden=(x.getAttribute("hidden")==3)?x.getAttribute("hidden"):apf.isTrue(x.getAttribute("hidden"));}else{if(x.getAttribute("visible")=="false"){aData.hidden=true;}}if(x.getAttribute("state")){aData.state=x.getAttribute("state");}if(x.getAttribute("stack")){aData.stackId=parseInt(x.getAttribute("stack"));}if(x.getAttribute("position")){aData.position=x.getAttribute("position").split(",");}if(x.getAttribute("size")){aData.size=x.getAttribute("size").split(",");}if(aData.fwidth&&aData.fwidth.indexOf("/")>-1){aData.fwidth=eval(aData.fwidth);if(aData.fwidth<=1){aData.fwidth=(aData.fwidth*100)+"%";}}if(aData.fheight&&aData.fheight.indexOf("/")>-1){aData.fheight=eval(aData.fheight);if(aData.fheight<=1){aData.fheight=(aData.fheight*100)+"%";}}aData.edgeMargin=Math.max(aData.splitter||0,aData.edgeMargin||0);if(aData.node&&amlNode.syncAlignment){amlNode.syncAlignment(aData);}if(!norecur&&!aData.node){var nodes=x.childNodes;for(var last,a,i=0;i<nodes.length;i++){if(nodes[i].nodeType!=1){continue;}a=this.parseXml(nodes[i],layout);if(last&&last.hidden){last.hidepos.next=a;}if(a.hidden){if(a.hid){var j=apf.lookup(a.hid);if(a.hidden===true&&j.visible){j.visible=false;a.oHtml.style.display="none";}if(a.hidden==3){var diff=apf.getDiff(a.oHtml);a.oHtml.style.left=a.position[0]+"px";a.oHtml.style.top=a.position[1]+"px";a.oHtml.style.width=(a.size[0]-diff[0])+"px";a.oHtml.style.height=((!this.state||this.state<0?a.size[1]:a.fheight)-diff[1])+"px";}}aData.hiddenChildren.push(a);a.hidepos={prev:aData.children[aData.children.length-1]};}else{if(a.hid){var j=apf.lookup(a.hid);if(!j.visible){j.visible=true;a.oHtml.style.display="block";}}a.stackId=aData.children.push(a)-1;}a.parent=aData;last=a;}}aData.xml=x;return aData;},getXml:function(j){var i=apf.layout.get(j);var l=i.root.xml?i.root.xml.ownerDocument.createElement("layout"):apf.xmldb.getXml("<layout />");apf.layout.parseToXml(i.root,l);return l;},saveXml:function(){for(var i in this.loadedXml){var n=this.loadedXml[i];var q=this.layouts[i];var l=q.root;for(var o=n.childNodes.length-1;o>=0;o--){n.removeChild(n.childNodes[o]);}this.parseToXml(l,n);}},parseToXml:function(w,q){var o=w.xml?w.xml.cloneNode(false):q.ownerDocument.createElement(w.vbox?"vbox":(w.hbox?"hbox":"node"));q.appendChild(o);if(w.template){o.setAttribute("align",w.template);}if(w.edgeMargin){o.setAttribute("edge",w.edgeMargin);}if(w.weight){o.setAttribute("weight",w.weight);}if(w.splitter){o.setAttribute("splitter",w.splitter===false?-1:w.splitter);}if(w.fwidth){o.setAttribute("width",w.fwidth);}if(w.fheight){o.setAttribute("height",w.fheight);}if(w.minwidth){o.setAttribute("minwidth",w.minwidth);}if(w.minheight){o.setAttribute("minheight",w.minheight);}if(w.lastfheight){o.setAttribute("lastheight",w.lastfheight);}if(w.lastsplitter){o.setAttribute("lastsplitter",w.lastsplitter);}if(w.hidden){o.setAttribute("hidden",(w.hidden==3)?"3":"true");}else{if(o.getAttribute("hidden")){o.removeAttribute("hidden");}}if(w.stackId){o.setAttribute("stack",w.stackId);}if(w.state>0){o.setAttribute("state",w.state);}else{if(o.getAttribute("state")){o.removeAttribute("state");}}if(w.position){o.setAttribute("position",w.position.join(","));}if(w.size){o.setAttribute("size",w.size.join(","));}var i=w.children.copy();for(var s=0;s<w.hiddenChildren.length;s++){var t=w.hiddenChildren[s].hidepos;if(t.prev){var u=i.indexOf(t.prev);if(u<0){i.unshift(w.hiddenChildren[s]);}else{i.insertIndex(w.hiddenChildren[s],u);}}else{if(t.next){var u=i.indexOf(t.next);if(u-1<0){i.unshift(w.hiddenChildren[s]);}else{i.insertIndex(w.hiddenChildren[s],u-1);}}else{i.push(w.hiddenChildren[s]);}}}for(var s=0;s<i.length;s++){this.parseToXml(i[s],o);}},checkInheritance:function(o){var q=o.children[o.children.length-1];if(o.originalMargin){if(o.parent.pOriginalMargin){o.parent.splitter=null;o.parent.edgeMargin=o.parent.pOriginalMargin[0];o.parent.pOriginalMargin=null;o.splitter=o.last.splitter;delete o.last.splitter;}o.splitter=null;var n=o.originalMargin[1];o.edgeMargin=o.originalMargin[0];n.splitter=n.splitter===false?false:n.last.splitter;o.originalMargin=null;delete n.last.splitter;}if(q&&q.template&&(q.splitter||q.splitter===null&&o.originalMargin)&&o.parent){if(!o.splitter){q.last.splitter=o.splitter=q.splitter;o.originalMargin=[o.edgeMargin,q];o.edgeMargin=Math.max(o.edgeMargin,o.splitter);}q.splitter=null;if(o.parent&&o.stackId==o.parent.children.length-1&&(o.parent.parent&&o.parent.parent.children.length>1)){if(!o.parent.splitter){o.last.splitter=o.parent.splitter=o.splitter;o.parent.last.splitter=null;o.parent.edgeMargin=Math.max(o.parent.edgeMargin,o.parent.splitter);o.parent.pOriginalMargin=[o.parent.edgeMargin];}o.splitter=null;}else{if(o.parent.pOriginalMargin){o.parent.splitter=null;o.parent.edgeMargin=o.parent.pOriginalMargin[0];o.parent.pOriginalMargin=null;o.splitter=o.last.splitter;delete o.last.splitter;}}}for(var s=0;s<o.children.length;s++){if(!o.children[s].node){this.checkInheritance(o.children[s]);}}var i=o.children[0];if(i&&o.parent){if(o.vbox){if(!o.fwidth&&i.fwidth||i.last.fwidth&&i.fwidth!==null&&i.last.fwidth==o.fwidth){i.last.fwidth=o.fwidth=i.fwidth;i.fwidth=null;}var t=o.parent;if((t&&!t.fheight&&i.fheight||i.last.fheight&&i.fheight!==null&&i.last.fheight==t.fheight)&&o.children.length==1){i.last.fheight=t.fheight=i.fheight;i.fheight=null;}}else{if((!o.fheight&&i.fheight||i.last.fheight&&i.fheight!==null&&i.last.fheight==o.fheight)&&o.children.length==1){i.last.fheight=o.fheight=i.fheight;i.fheight=null;}}if(i.weight||i.last.weight&&i.last.weight==o.weight){i.last.weight=o.weight=i.weight;}}},compileAlignment:function(q){if(!q.children.length){this.removeRule(q.pHtml,"layout");var l=this.layouts[q.pHtml.getAttribute("id")];if(l){apf.layout.clearSplitters(l.layout);}return;}var i=q.children;for(var n=false,o=0;o<i.length;o++){if(i[o].template=="bottom"){if(i[o].splitter){i[o-1].splitter=i[o].splitter;i[o].splitter=null;}i[o-1].edgeMargin=Math.max(i[o].edgeMargin,i[o-1].edgeMargin||0,i[o-1].splitter||0);i[o].edgeMargin=null;}if(i[o].hidden){i[o].prehide(true);}}this.checkInheritance(q);var l=this.layouts[q.pHtml.getAttribute("id")];l.layout.compile(q.copy());l.layout.reset();},addAlignNode:function(F,M){var n=(typeof F.align=="undefined"?F.getAttribute("align"):F.align).split("-");var Q=M.children;var l=F.aData;if(typeof F.splitter=="undefined"){if(n[1]=="splitter"){l.splitter=n[2]||4;}else{l.splitter=false;}}l.edgeMargin=Math.max(l.edgeMargin,l.splitter||0);n=n[0];l.template=n;if(n=="top"){for(var J=Q.length,O=0;O<Q.length;O++){if(Q[O].template!="top"){J=O;break;}}for(var O=Q.length-1;O>=J;O--){Q[O+1]=Q[O];Q[O].stackId=O+1;}Q[J]=l;Q[J].stackId=J;l.parent=M;}else{if(n=="bottom"){l.stackId=Q.push(l)-1;l.parent=M;}else{var P=null;for(var J=-1,O=0;O<Q.length;O++){if(Q[O].hbox){P=Q[O];break;}else{if(Q[O].node&&Q[O].template=="top"){J=O;}}}if(!P){var i=apf.layout.get(M.pHtml);P=apf.layout.parseXml(apf.xmldb.getXml("<hbox />"),i,null,true);P.parent=M;if(J>-1){for(var O=Q.length-1;O>J;O--){Q[O+1]=Q[O];Q[O].stackId++;}Q[J+1]=P;P.stackId=J+1;}else{P.stackId=Q.unshift(P)-1;}}var G,I=P.children.concat(P.hiddenChildren);for(var O=0;O<I.length;O++){if(I[O].template==n){G=I[O];break;}}I=P.children;if(!G){var i=apf.layout.get(M.pHtml);G=apf.layout.parseXml(apf.xmldb.getXml("<vbox />"),i,null,true);G.parent=P;G.template=n;if(n=="left"){if(!l.fwidth){var K;for(var a=false,O=0;O<I.length;O++){if(I[O].template=="middle"){a=I[O];break;}}if(a&&!a.children.length){I.remove(a);for(var O=0;O<I.length;O++){I[O].stackId=O;}}}I.unshift(G);for(var O=0;O<I.length;O++){I[O].stackId=O;}}else{if(n=="right"){if(l.fwidth){var K;for(var a=false,O=0;O<I.length;O++){if(I[O].template=="middle"||I[O].template=="left"&&!I[O].fwidth){a=true;break;}}if(!a){K=apf.layout.parseXml(apf.xmldb.getXml("<vbox />"),i,null,true);K.parent=P;K.template="middle";K.stackId=I.push(K)-1;}}G.stackId=I.push(G)-1;}else{if(n=="middle"){for(var s,O=0;O<I.length;O++){if(I[O].template=="right"){s=O;}}var N=I[s];if(N){I[s]=G;G.stackId=s;N.stackId=I.push(N)-1;}else{G.stackId=I.push(G)-1;}}}}}l.stackId=G.children.push(l)-1;l.parent=G;if(G.hidden){G.preshow(true);}}}},compile:function(j){var l=this.layouts[j.getAttribute("id")];if(!l){return false;}var i=l.root.copy();l.layout.compile(i);l.layout.reset();},removeAll:function(i){i.children.length=null;this.compileAlignment(i);var d=this.getHtmlId(i.pHtml);if(!this.rules[d]){delete this.qlist[d];}},timer:null,qlist:{},dlist:[],$hasQueue:false,queue:function(n,m,j){this.$hasQueue=true;var l;if(!(l=this.getHtmlId(n))){l=apf.setUniqueHtmlId(n);}if(this.qlist[l]){if(m){this.qlist[l][2].push(m);}if(j){this.qlist[l][1]=j;}return;}this.qlist[l]=[n,j,[m]];if(!this.timer){this.timer=$setTimeout("apf.layout.processQueue()");}},processQueue:function(){clearTimeout(this.timer);this.timer=null;this.$hasQueue=false;var q,i,l,n,o;for(q=0;q<this.dlist.length;q++){if(this.dlist[q].hidden){this.dlist[q].hide();}else{this.dlist[q].show();}}for(i in this.qlist){n=this.qlist[i];if(n[1]){apf.layout.compileAlignment(n[1]);}o=n[2];for(q=0,l=o.length;q<l;q++){if(o[q]){o[q].$updateLayout();}}apf.layout.activateRules(n[0]);}if(apf.hasSingleRszEvent){apf.layout.forceResize();}this.qlist={};this.dlist=[];},rules:{},onresize:{},getHtmlId:function(c){return c.getAttribute?c.getAttribute("id"):1;},setRules:function(o,m,n,q){if(!this.getHtmlId(o)){apf.setUniqueHtmlId(o);}if(!this.rules[this.getHtmlId(o)]){this.rules[this.getHtmlId(o)]={};}var l=this.rules[this.getHtmlId(o)][m];if(!q&&l){this.rules[this.getHtmlId(o)][m]=n+"\n"+l;}else{this.rules[this.getHtmlId(o)][m]=n;}},getRules:function(d,i){return i?this.rules[this.getHtmlId(d)][i]:this.rules[this.getHtmlId(d)];},removeRule:function(t,n){var w=this.getHtmlId(t);if(!this.rules[w]){return;}var u=this.rules[w][n]||false;delete this.rules[w][n];var q;for(q in this.rules[w]){}if(!q){delete this.rules[w];}if(apf.hasSingleRszEvent){if(this.onresize[w]){this.onresize[w]=null;}else{var s=t.parentNode;while(s&&s.nodeType==1&&!this.onresize[s.getAttribute("id")]){s=s.parentNode;}if(s&&s.nodeType==1){var o=this.onresize[s.getAttribute("id")];if(o.children){delete o.children[w];}}}}return u;},activateRules:function(D,z){if(!D){var I,C;for(I in this.rules){C=document.getElementById(I);if(!C||C.onresize){continue;}this.activateRules(C);}if(apf.hasSingleRszEvent&&window.onresize){window.onresize();}return;}var B,E,w,J,K=[];if(!apf.hasSingleRszEvent){J=this.rules[this.getHtmlId(D)];if(!J){D.onresize=null;return false;}for(E in J){if(typeof J[E]!="string"){continue;}K.push(J[E]);}B=apf.needsCssPx?new Function(K.join("\n")):new Function(K.join("\n").replace(/ \+ 'px'|try\{\}catch\(e\)\{\}\n/g,""));D.onresize=B;if(!z){B();}}else{var F=this.getHtmlId(D);J=this.rules[F];if(!J){return false;}for(E in J){if(typeof J[E]!="string"){continue;}K.push(J[E]);}var G=D.parentNode;while(G&&G.nodeType==1&&!this.onresize[G.getAttribute("id")]){G=G.parentNode;}var A=new Function(K.join("\n"));if(this.onresize[F]){A.children=this.onresize[F].children;}if(G&&G.nodeType==1){var M=this.onresize[G.getAttribute("id")];(M.children||(M.children={}))[F]=A;}else{this.onresize[F]=A;}if(!z){A();}if(!window.onresize){var B=function(a){try{var i=[];for(var c in a){i.unshift(a[c]);}for(var d=0;d<i.length;d++){i[d]();if(i[d].children){B(i[d].children);}}}catch(j){}};window.onresize=function(){B(apf.layout.onresize);};}}},forceResize:function(i){if(apf.hasSingleRszEvent){return window.onresize&&window.onresize();}var q=i.onresize;if(q){q();}var n=i.getElementsByTagName("*");for(var o=0,l=n.length;o<l;o++){if(n[o].onresize){n[o].onresize();}}},paused:{},pause:function(l,j){if(apf.hasSingleRszEvent){var i=this.getHtmlId(l);this.paused[i]=this.onresize[i]||true;if(j){this.onresize[i]=j;this.onresize[i].children=this.paused[i].children;j();}else{delete this.onresize[i];}}else{this.paused[this.getHtmlId(l)]=l.onresize||true;if(j){l.onresize=j;j();}else{l.onresize=null;}}},play:function(l){if(!this.paused[this.getHtmlId(l)]){return;}if(apf.hasSingleRszEvent){var i=this.getHtmlId(l);var j=this.paused[i];if(typeof j=="function"){this.onresize[i]=j;}else{delete this.onresize[i];}if(window.onresize){window.onresize();}this.paused[this.getHtmlId(l)]=null;}else{var j=this.paused[this.getHtmlId(l)];if(typeof j=="function"){l.onresize=j;j();}else{l.onresize=null;}this.paused[this.getHtmlId(l)]=null;}}};apf.layout.load=apf.layout.loadXml;apf.getWindowWidth=function(){return apf.isIE?document.documentElement.offsetWidth-(apf.isIE8?4:0):window.innerWidth;};apf.getWindowHeight=function(){return apf.isIE?document.documentElement.offsetHeight-(apf.isIE8?4:0):window.innerHeight;};apf.layoutParser=function(n,s){s=(s&&s.length==4)?s:[0,0,0,0];this.pMargin=s;this.RULES=[];this.parentNode=n;if(!this.parentNode.getAttribute("id")){apf.setUniqueHtmlId(this.parentNode);}var m={};var q=0;var o=0;this.createSplitters=true;this.setMargin=function(a){s=a;};this.reset=function(){this.RULES=[];m={};this.lastType=this.globalEdge=this.globalSplitter=null;};this.compile=function(a,d){this.addRule("var v = apf.layout.vars");this.globalSplitter=a.splitter;this.globalEdge=a.edgeMargin;if(this.globalSplitter||this.globalEdge){this.setglobals(a);}this.preparse(a);this.parserules(a);if(this.createSplitters){apf.layout.clearSplitters(this);this.parsesplitters(a);}this.RULES=new t().calc(this.RULES);var c=("try{"+this.RULES.join("}catch(e){}\ntry{")+"}catch(e){}\n").replace(/([^=]+\.style[^=]+) = (.*?)\}/g,"$1 = ($2) + 'px'}");if(!apf.hasHtmlIdsInJs){c=c.replace(/q([\w|]+)\.(offset|style)/g,'document.getElementById("q$1").$2');}this.lastRoot=a;if(!d){apf.layout.setRules(this.parentNode,"layout",c,true);apf.layout.queue(this.parentNode);}else{return c;}return false;};this.addRule=function(a){this.RULES.push(a);};this.setglobals=function(d,c){if(!c&&this.globalEdge&&!d.edgeMargin&&(!d.xml||!d.xml.getAttribute("edge"))){if(!d.splitter){d.splitter=this.globalSplitter;}d.edgeMargin=Math.max(this.globalSplitter,this.globalEdge);}if(d.node){return;}for(var a=0;a<d.children.length;a++){this.setglobals(d.children[a],a==d.children.length-1);}};this.preparse=function(J){if(J.node){return;}else{var l=J.vbox?"height":"width";var d=0;var M=0;var T=0;J.childweight=0;J.childminwidth=0;J.childminheight=0;var V=["v."+l+"_"+J.id],j=[];var K=J.children;for(var R=0;R<K.length;R++){if(R<K.length-1){V.push(" - "+K[R].edgeMargin);}var O=K[R]["f"+l];if(O){j.push((O.indexOf("%")>-1)?" - ("+(K[R]["calc"+l]="v.innerspace_"+J.id+" * "+parseFloat(O)/100)+")":" - ("+O+")");}else{J.childweight+=K[R].weight;K[R]["calc"+l]="Math."+(R%2==0?"ceil":"floor")+"(v.restspace_"+J.id+" * ("+K[R].weight+"/v.weight_"+J.id+"))";}var Q=(J.vbox?"width":"height");var c=K[R]["f"+Q];if(!c){K[R]["calc"+Q]=(J.vbox?"v.width_":"v.height_")+J.id;}else{K[R]["calc"+Q]=c.indexOf("%")>-1?"v.innerspace_"+J.id+" * "+parseFloat(c)/100:c;}if(K[R].node&&K[R].xml.visible!==false){K[R].oHtml.style.display="block";}else{this.preparse(K[R]);}if(J.vbox){J.childminheight+=Math.max(K[R].childminheight||0,K[R].minheight||0,10)+K[R].edgeMargin;J.childminwidth=Math.max(J.childminwidth,K[R].minwidth||K[R].childminwidth||10);}else{J.childminwidth+=Math.max(K[R].minwidth||0,K[R].childminwidth||0,10)+K[R].edgeMargin;J.childminheight=Math.max(J.childminheight,K[R].minheight||K[R].childminheight||10);}}J.innerspace=V.join("");J.restspace=J.innerspace+" "+j.join("");if(!J.parent){var U=0,N=0;if(this.parentNode.tagName.toLowerCase()!="body"){var i=apf.getDiff(this.parentNode);N=i[0];U=i[1];}var P=(this.parentNode.tagName.toLowerCase()=="body"?"apf.getWindowWidth()":"document.getElementById('"+this.parentNode.id+"').offsetWidth");var a=(this.parentNode.tagName.toLowerCase()=="body"?"apf.getWindowHeight()":"document.getElementById('"+this.parentNode.id+"').offsetHeight");J.calcwidth="Math.max("+q+", "+P+" - "+(s[1])+" - "+s[3]+" - "+U+")";J.calcheight="Math.max("+o+", "+a+" - "+(s[2])+" - "+s[0]+" - "+N+")";}}};this.parserules=function(F){if(!F.node){this.addRule("v.width_"+F.id+" = Math.max("+F.childminwidth+","+F.minwidth+","+(F.calcwidth||F.fwidth)+")");this.addRule("v.height_"+F.id+" = Math.max("+F.childminheight+","+F.minheight+","+(F.calcheight||F.fheight)+")");this.addRule("v.weight_"+F.id+" = "+F.childweight);this.addRule("v.innerspace_"+F.id+" = "+F.innerspace);this.addRule("v.restspace_"+F.id+" = "+F.restspace);var j=apf.layout.metadata[F.id];j.calcData=F;F.original=j;if(!F.parent){this.addRule("v.left_"+F.id+" = "+s[3]);this.addRule("v.top_"+F.id+" = "+s[0]);for(var a=0;a<F.children.length;a++){this.parserules(F.children[a]);}return;}else{var C=["v.top_"+F.id," = "];var c=["v.left_"+F.id," = "];}}else{var C=[F.id,".style.top = "];var c=[F.id,".style.left = "];if(F.hid){var j=apf.lookup(F.hid).aData;j.calcData=F;F.original=j;}var G=F.oHtml;var D=apf.getDiff(G);var i=D[1];var d=D[0];if(F.calcwidth){this.addRule(F.id+".style.width = -"+d+" + Math.max( "+F.calcwidth+", "+F.minwidth+")");}else{G.style.width=Math.max(0,F.fwidth-d)+"px";}if(F.calcheight){this.addRule(F.id+".style.height = -"+i+" + Math.max( "+F.calcheight+", "+F.minheight+")");}else{G.style.height=Math.max(0,F.fheight-i)+"px";}}var l=F.parent.children[F.stackId-1];var E=F.parent.children[F.stackId+1];if(F.parent.vbox){if(F.parent.isBottom){if(!E){C.push("v.top_",F.parent.id," + v.height_",F.parent.id," - ",F.id,".offsetHeight");}else{if(E.node){C.push(E.id,".offsetTop - ",E.edgeMargin," - ",F.id,".offsetHeight");}else{C.push("v.top_"+E.id," - ",E.edgeMargin," - ",(F.node?F.id+".offsetHeight":"v.height_"+F.id));}}}else{if(!F.stackId){C.push("v.top_"+F.parent.id);}else{if(l){if(l.node){C.push(l.id,".offsetTop + ",l.id,".offsetHeight + ",l.edgeMargin);}else{C.push("v.top_",l.id," + v.height_",l.id," + ",l.edgeMargin);}}}}}else{C.push("v.top_"+F.parent.id);}if(F.parent.hbox){if(F.parent.isRight){if(!E){c.push("v.left_",F.parent.id," + v.width_",F.parent.id," - ",(F.node?F.id+".offsetWidth":"v.width_"+F.id),null);}else{if(E.node){c.push(E.id,".offsetLeft - ",E.edgeMargin," - ",(F.node?F.id+".offsetWidth":"v.width_"+F.id));}else{c.push("v.left_"+E.id," - ",E.edgeMargin," - ",(F.node?F.id+".offsetWidth":"v.width_"+F.id));}}}else{if(!F.stackId){c.push("v.left_"+F.parent.id);}else{if(l){if(l.node){c.push(l.id,".offsetLeft + ",l.id,".offsetWidth + ",l.edgeMargin);}else{c.push("v.left_",l.id," + v.width_",l.id," + ",l.edgeMargin);}}}}}else{c.push("v.left_"+F.parent.id);}if(c.length>2){this.addRule(c.join(""));}if(C.length>2){this.addRule(C.join(""));}if(!F.node){for(var a=0;a<F.children.length;a++){this.parserules(F.children[a]);}}};this.parsesplitters=function(c){if(c.parent&&c.splitter>0){apf.layout.getSplitter(this).init(c.splitter,c.hid,c);}if(!c.node){for(var a=0;a<c.children.length;a++){this.parsesplitters(c.children[a]);}}};function t(){this.parselookup={};this.nRules=[];this.doneRules={};this.maskText=function(c,d,i,a){return d+".offset"+i.toUpperCase();};this.handleVar=function(d,i,j,a){var c="a"+i.replace(/\|/g,"_")+"_style_"+j.toLowerCase();return m[c]?c:d;};this.parseRule=function(i){var z=i.split(" = "),c=z[0].replace(/^([_\w\d\|]+)\.style\.(\w)/,this.maskText),j="a"+z[0].replace(/[\.\|]/g,"_");m[j]=true;var l=z[1].split(/[ \(\)]/),d=[],a;for(var A=0;A<l.length;A++){if(l[A].match(/^([_\w\d\|]+)\.offset(\w+)$/)&&!l[A].match(/PNODE/)){d.push(l[A]);}}if(j.match(/width|height/i)){z[1]=z[1].replace(/^(\s*[\-\d]+[\s\-\+]+)/,"");a=z[0]+" = "+RegExp.$1+j;}else{a=z[0]+" = "+j;}if(i.match(/^v\./)){return{id:c,rule_p1:z[0]+" = ",rule_p2:z[1],ruleb:null,deps:d,processed:false};}return{id:c,rule_p1:"var "+j+" = ",rule_p2:z[1],ruleb:a,deps:d,processed:false};};this.calc=function(j){var l,c,d="";for(l=0;l<j.length;l++){if(j[l].match(/^var/)){this.nRules.push(j[l]);continue;}var i=this.parseRule(j[l],l);this.parselookup[i.id]=i;}for(c in this.parselookup){this.processNode(this.parselookup[c]);}for(c in this.parselookup){var a=this.parselookup[c];this.walkRules(a);}for(c in this.parselookup){this.nRules.push(this.parselookup[c].ruleb);}return this.nRules;};this.walkRules=function(a){if(this.doneRules[a.id]){return;}for(var c=0;c<a.deps.length;c++){if(a.deps[c]&&!a.deps[c].walked&&!this.doneRules[a.deps[c].id]){a.deps[c].walked=true;this.walkRules(a.deps[c]);}}this.doneRules[a.id]=true;this.nRules.push(a.rule_p1+a.rule_p2.replace(/([_\w\d\|]+)\.offset(\w+)/g,this.handleVar));};this.processNode=function(c){for(var d=0;d<c.deps.length;d++){var a=typeof c.deps[d]=="string"?this.parselookup[c.deps[d]]:c.deps[d];if(!a){c.deps[d]=null;continue;}c.deps[d]=a;if(!a.processed){a.processed=true;this.processNode(a);}}};}};apf.language={automatch:false,loaded:false,prefix:"sub.main.",words:{},texts:{},elements:{},bindings:{},count:0,load:function(d,i){if(!d){return;}if(typeof d=="string"){if(d.charAt(0)=="<"){d=apf.getXmlDom(d).documentElement;}else{return this.loadFrom(d);}}this.parseSection(d,i);this.redraw();this.loaded=true;},loadFrom:function(c){apf.getData(c,{callback:function(a){if(!a){return;}apf.language.load(a);}});},parseSection:function(m,l){if(!l){l=m.getAttribute("id")||"";}if(m.tagName=="key"){l+="/"+m.getAttribute("id");this.words[l]=m.firstChild?m.firstChild.nodeValue:"";return;}if(m.tagName=="group"){l+=(l?"/":"")+m.getAttribute("id");}var i=m.childNodes;for(var n=0;n<i.length;n++){if(i[n].nodeType==1){this.parseSection(i[n],l);}}},redraw:function(){var D,A,E,t,z=this.elements,B;for(D in z){t=z[D],B=apf.all[D];for(E in t){A=t[E];try{if(A.asyncs){return A.call(this,B.xmlRoot,function(a){B.setProperty(E,a,true);});}else{var s=A.call(B,B.xmlRoot);}}catch(u){apf.console.warn("[275] Could not execute language update for "+E+"\n\n"+u.message);continue;}B.setProperty(E,s,true);}}var C,B,w=this.bindings;for(D in w){B=apf.all[D];if(B.selection){C=B.getSelection();B.reload();B.selectList(C);}else{B.reload();}}},getWord:function(c){return this.words[c];},addProperty:function(i,j,l){(this.elements[i.$uniqueId]||(this.elements[i.$uniqueId]={}))[j]=l;},removeProperty:function(d,i){delete (this.elements[d.$uniqueId]||false)[i];},addBinding:function(c){this.bindings[c.$uniqueId]=true;},removeBinding:function(c){delete this.bindings[c.$uniqueId];}};apf.saveData=apf.getData=function(D,t){if(!D){return false;}var s,z=D.charAt(0),u=t.callback;var A=function(c,d,i){var a=t.callback;if(d!=apf.SUCCESS){return a(c,d,i||{});}return a(c,d,i||{});};if(!t){t={};}var B=t.fParsed||(D.indexOf("{")>-1||D.indexOf("[")>-1?apf.lm.compile(D,{withopt:true,precall:t._pc==-1?false:t._pc,alwayscb:true,simplexpath:true}):{str:D,type:2});if(B.type==3){if(B.xpaths[0]){return A(apf.nameserver.get("model",B.xpaths[0]).data.selectSingleNode(B.xpaths[1]),apf.SUCCESS,{});}else{return A(t.xmlNode.data.selectSingleNode(B.xpaths[1]),apf.SUCCESS,{});}}if(z=="<"){if(B.type==2){s=B.str;}else{return B(t.xmlNode,A,t);}}else{if((z=="["||z=="{")){return B(t.xmlNode,A,t);}else{if(B.type==1||B.type==3){var w=u;u=t.callback=function(a,c,i){if(t._pc===true){return;}if(c!=apf.SUCCESS){return w.apply(this,arguments);}var d=a.split(" "),j="get";if(d.length>1&&d[0].length<10){j=d.shift();d=d.join(" ");}else{d=a;}u=t.callback=w;apf.oHttp.exec(j,[d],A,t);};B(t.xmlNode,A,t);}else{if(t._pc===true){return;}var C=D.split(" "),E="get";if(C.length>1&&C[0].length<10){E=C.shift();C=C.join(" ");}else{C=D;}apf.oHttp.exec(E,[C],A,t);}}}if(s){if(u){A(s,apf.SUCCESS,{});}else{return s;}}};apf.setModel=function(j,l){if(!j){return;}var m=j.indexOf("{")>-1||j.indexOf("[")>-1?apf.lm.compile(j,{alwayscb:true}):{type:2,str:j};if(j=="@default"||m.type==2){var n=apf.nameserver.get("model",j);if(n){return n.register(l);}else{if(j=="@default"){return;}}if(j.indexOf(".")==-1&&j.indexOf("/")==-1){return;}}if(m.type==3){if(m.models){if(m.xpaths.length==2&&m.xpaths[0]!="#"&&m.xpaths[1]!="#"){apf.nameserver.get("model",m.xpaths[0]).register(l,m.xpaths[1]);return;}}}if(l.clear){l.clear("loading");}apf.getData(j,{parsed:m,callback:function(i,a,d){if(a!=apf.SUCCESS){throw new Error(apf.formatErrorString(0,null,"Loading new data","Could not load data into model.                 \nMessage: "+d.message+"                \nInstruction: '"+j+"'"));}if(!i){return;}if(typeof i=="string"){if(i.charAt(0)=="<"){i=apf.getXml(i);}else{if(i.indexOf("http://")==0){return apf.setModel(i,l);}else{throw new Error("Invalid data from server");}}}var c=apf.xmldb.findModel(i);if(c){c.register(l,apf.xmlToXpath(i,c.data));}else{new apf.model().register(l).load(i);}}});};apf.storage.modules.gears=apf.storage.modules["gears.sql"]={table_name:"STORAGE",initialized:false,$available:null,$db:null,init:function(){this.factory=apf.nameserver.get("google","gears");this.database_name=apf.config.name+".apf.offline.gears";this.$db=this.factory.create("beta.database","1.0");this.$db.open(this.database_name);try{this.$sql("CREATE TABLE IF NOT EXISTS "+this.table_name+"(  namespace TEXT,  key TEXT,  value TEXT )");this.$sql("CREATE UNIQUE INDEX IF NOT EXISTS namespace_key_index ON "+this.table_name+" (namespace, key)");this.initialized=true;}catch(c){apf.console.warn(c.message);return false;}},$sql:function(l,j){var i=this.$db.execute(l,j);return this.$normalizeResults(i);},destroy:function(){this.$db.close();},$normalizeResults:function(o){var s=[];if(!o){return[];}while(o.isValidRow()){var n={};for(var t=0;t<o.fieldCount();t++){var i=o.fieldName(t);var q=o.field(t);n[i]=q;}s.push(n);o.next();}o.close();return s;},isAvailable:function(){return apf.isGears;},put:function(j,m,n){if(!n){n=this.namespace;}m=apf.serialize(m);try{this.$sql("DELETE FROM "+this.table_name+" WHERE namespace = ? AND key = ?",[n,j]);this.$sql("INSERT INTO "+this.table_name+" VALUES (?, ?, ?)",[n,j,m]);}catch(l){return false;}return true;},get:function(l,j){if(!j){j=this.namespace;}var i=this.$sql("SELECT * FROM "+this.table_name+" WHERE namespace = ? AND  key = ?",[j,l]);if(!i.length){return null;}return apf.unserialize(i[0].value);},getNamespaces:function(){var j=[this.namespace];var i=this.$sql("SELECT namespace FROM "+this.table_name+" DESC GROUP BY namespace");for(var l=0;l<i.length;l++){if(i[l].namespace!=this.namespace){j.push(i[l].namespace);}}return j;},getKeys:function(l){if(!l){l=this.namespace;}var i=this.$sql("SELECT key FROM "+this.table_name+" WHERE namespace = ?",[l]);var m=[];for(var n=0;n<i.length;n++){m.push(i[n].key);}return m;},clear:function(c){if(!c){c=this.namespace;}this.$sql("DELETE FROM "+this.table_name+" WHERE namespace = ?",[c]);},remove:function(d,i){if(!i){i=this.namespace;}this.$sql("DELETE FROM "+this.table_name+" WHERE namespace = ? AND key = ?",[i,d]);},putMultiple:function(s,q,t){if(!t){t=this.namespace;}try{this.$sql.open();this.$sql.db.execute("BEGIN TRANSACTION");var i="REPLACE INTO "+this.table_name+" VALUES (?, ?, ?)";for(var w=0;w<s.length;w++){var o=apf.serialize(q[w]);this.$sql.db.execute(i,[t,s[w],o]);}this.$sql.db.execute("COMMIT TRANSACTION");this.$sql.close();}catch(u){return false;}return true;},getMultiple:function(o,q){if(!q){q=this.namespace;}var i="SELECT * FROM "+this.table_name+" WHERE namespace = ? AND  key = ?";var s=[];for(var t=0;t<o.length;t++){var n=this.$sql(i,[q,o[t]]);s[t]=n.length?apf.unserialize(n[0].value):null;}return s;},removeMultiple:function(m,n){if(!n){n=this.namespace;}this.$sql.open();this.$sql.db.execute("BEGIN TRANSACTION");var l="DELETE FROM "+this.table_name+" WHERE namespace = ? AND key = ?";for(var i=0;i<m.length;i++){this.$sql.db.execute(l,[n,m[i]]);}this.$sql.db.execute("COMMIT TRANSACTION");this.$sql.close();},isPermanent:function(){return true;},getMaximumSize:function(){return this.SIZE_NO_LIMIT;},hasSettingsUI:function(){return false;},showSettingsUI:function(){throw new Error(this.declaredClass+" does not support a storage settings user-interface");},hideSettingsUI:function(){throw new Error(this.declaredClass+" does not support a storage settings user-interface");}};apf.storage.modules.air={init:function(){this.ByteArray=window.runtime.flash.utils.ByteArray;this.EncryptedLocalStore=window.runtime.flash.data.EncryptedLocalStore;},isAvailable:function(){return apf.isAIR;},_getItem:function(d){var i=this.EncryptedLocalStore.getItem("__apf_"+d);return i?i.readUTFBytes(i.length):"";},_setItem:function(l,j){var i=new this.ByteArray();i.writeUTFBytes(j);this.EncryptedLocalStore.setItem("__apf_"+l,i);},_removeItem:function(c){this.EncryptedLocalStore.removeItem("__apf_"+c);},put:function(n,o,t){if(!t){t=this.namespace;}try{var q=this._getItem("namespaces")||"";if(q.indexOf("|"+t+"|")==-1){this._setItem("namespaces",q+t+"|");}var s=this._getItem(t+"_keys")||"";if(s.indexOf("|"+n+"|")==-1){this._setItem(t+"_keys",s+n+"|");}this._setItem("_"+t+"_"+n,o);}catch(m){return false;}return true;},get:function(d,i){if(!i){i=this.namespace;}return this._getItem("_"+i+"_"+d);},getNamespaces:function(){var l=[this.namespace];var j=(this._getItem("namespaces")||"").split("|");for(var i=0;i<j.length;i++){if(j[i]&&j[i]!=this.namespace){l.push(j[i]);}}return l;},getKeys:function(m){if(!m){m=this.namespace;}var n=[];var l=(this._getItem(m+"_keys")||"").split("|");for(var i=0;i<l.length;i++){if(l[i]){n.push(l[i]);}}return n;},clear:function(n){if(!n){n=this.namespace;}var l=this._getItem("namespaces")||"";if(l.indexOf("|"+n+"|")!=-1){this._setItem("namespaces",l.replace("|"+n+"|","|"));}var m=(this._getItem(n+"_keys")||"").split("|");for(var i=0;i<m.length;i++){if(m[i].length){this._removeItem(n+"_"+m[i]);}}this._removeItem(n+"_keys");},remove:function(i,l){if(!l){l=this.namespace;}var j=this._getItem(l+"_keys")||"";if(j.indexOf("|"+i+"|")!=-1){this._setItem(l+"_keys",j.replace("|"+i+"|","|"));}this._removeItem("_"+l+"_"+i);},putMultiple:function(n,m,o){if(!o){o=this.namespace;}try{for(var q=0;q<n.length;q++){this.put(n[q],value[q],null,o);}}catch(i){return false;}return true;},getMultiple:function(l,m){if(!m){m=this.namespace;}var n=[];for(var i=0;i<l.length;i++){n[i]=this.get(l[i],m);}return n;},removeMultiple:function(j,l){if(!l){l=this.namespace;}for(var i=0;i<j.length;i++){this.remove(j[i],l);}},isPermanent:function(){return true;},getMaximumSize:function(){return this.SIZE_NO_LIMIT;},hasSettingsUI:function(){return false;},showSettingsUI:function(){throw new Error(this.declaredClass+" does not support a storage settings user-interface");},hideSettingsUI:function(){throw new Error(this.declaredClass+" does not support a storage settings user-interface");}};apf.storage.modules.memory={initialized:true,store:{},isAvailable:function(){return true;},put:function(i,j,l){if(!l){l=this.namespace;}j=apf.serialize(j);if(!this.store[l]){this.store[l]={};}this.store[l][i]=j;},get:function(d,i){if(!i){i=this.namespace;}if(!this.store[i]||!this.store[i][d]){return null;}return apf.unserialize(this.store[i][d]);},getNamespaces:function(){var d=[this.namespace];for(var i in this.store){d.push(i);}return d;},getKeys:function(l){if(!l){l=this.namespace;}var i=[];for(var j in this.store[l]){i.push(j);}return i;},clear:function(c){if(!c){c=this.namespace;}delete this.store[c];},remove:function(d,i){if(!i){i=this.namespace;}if(this.store[i]){delete this.store[i][d];}},putMultiple:function(l,i,m){if(!m){m=this.namespace;}if(!this.store[m]){this.store[m]={};}for(var n=0;n<l.length;n++){this.store[m][l[n]]=apf.serialize(i[n]);}return true;},getMultiple:function(l,m){if(!m){m=this.namespace;}if(!this.store[m]){return[];}var n=[];for(var i=0;i<l.length;i++){if(this.store[m][l[i]]){n.push(apf.unserialize(this.store[m][l[i]]));}}return n;},removeMultiple:function(j,l){if(!l){l=this.namespace;}if(!this.store[l]){return;}for(var i=0;i<j.length;i++){delete this.store[l][j[i]];}},isPermanent:function(){return false;},getMaximumSize:function(){return this.SIZE_NO_LIMIT;},hasSettingsUI:function(){return false;},showSettingsUI:function(){throw new Error(this.declaredClass+" does not support a storage settings user-interface");},hideSettingsUI:function(){throw new Error(this.declaredClass+" does not support a storage settings user-interface");}};apf.storage.modules.flash={initialized:false,asyncInit:true,_available:null,_statusHandler:null,_flashReady:false,_pageReady:false,delayCalls:[],init:function(){this.name="flashStorage";this.id=apf.flash.addPlayer(this);this.STORAGE_SWF=(apf.config.resourcePath||apf.basePath)+"resources/apfStorage.swf?cachebust="+new Date().getTime();var flash=apf.flash.buildContent("src",this.STORAGE_SWF,"width","215","height","138","align","middle","id",this.name,"quality","high","bgcolor","#ffffff","allowFullScreen","true","name",this.name,"flashvars","playerID="+this.id,"allowScriptAccess","always","type","application/x-shockwave-flash","pluginspage","http://www.adobe.com/go/getflashplayer","menu","true");this.container=document.createElement("div");this.container.id=this.name+"_Container";this.container.className="apfVideo";with(this.container.style){width=height="0px";overflow="hidden";}document.body.appendChild(this.container);this.container.innerHTML=flash;this.player=apf.flash.getElement(this.name);this._allNamespaces=this.getNamespaces();this._flashReady=this._pageReady=true;},setVisible:function(visible){if(visible==true){this.container.style.position="absolute";this.container.style.visibility="visible";}else{with(this.container.style){position="absolute";x="-1000px";y="-1000px";visibility="hidden";}}return this;},callMethod:function(){if(!this.initialized||typeof this.player.callMethod!="function"){this.delayCalls.push(arguments);}else{var n=[this.player,"callMethod"],l=apf.flash,m=0,i=arguments.length;for(;m<i;m++){n.push(l.encode(n[m]));}l.remote.apply(null,n);}},delayedCallTimer:null,makeDelayCalls:function(){clearTimeout(this.delayedCallTimer);if(!this.delayCalls.length){if(typeof this["onready"]=="function"){this.onready();}return this;}this.callMethod.apply(this,this.delayCalls[0]);this.delayCalls.splice(0,1);var c=this;this.delayedCallTimer=window.setTimeout(function(){c.makeDelayCalls();},1);return this;},ready:function(c){if(this.initialized){c();}else{this.onready=c;}},event:function(l,j){if(l=="status"){var i=apf.storage;if(statusResult==i.PENDING){this.setVisible(true);}else{this.setVisible(false);}if(i._statusHandler){i._statusHandler.call(null,j.status,j.keyName,j.namespace);}}else{if(l=="loaded"){this.initialized=true;this.setVisible(false).makeDelayCalls();}}},setFlushDelay:function(c){if(c===null||typeof c==="undefined"||isNaN(c)){throw new Error("Invalid argunment: "+c);}this.callMethod("setFlushDelay",String(c));},getFlushDelay:function(){return Number(this.callMethod("getFlushDelay"));},flush:function(c){if(c==null||typeof c=="undefined"){c=apf.storage.namespace;}this.callMethod("flush",c);},isAvailable:function(){return location.protocol!="file:"&&apf.flash.isEightAvailable();},put:function(i,j,l){if(!l){l=this.namespace;}this.callMethod("put",i,apf.serialize(j),l);},putMultiple:function(i,A,t){if(!t){t=this.namespace;}var z=i.join(",");var w=[];for(var u=0;u<A.length;u++){A[u]=apf.unserialize(A[u]);w[u]=A[u].length;}var s=A.join("");var q=w.join(",");this.callMethod("putMultiple",z,s,q,t);},get:function(l,j){if(!j){j=this.namespace;}var i=this.callMethod("get",l,j);if(i==""){return null;}return apf.unserialize(apf.flash.decode(i));},getMultiple:function(keys,namespace){if(!namespace){namespace=this.namespace;}var metaKey=keys.join(",");var metaResults=this.callMethod("getMultiple",metaKey,namespace);if(!metaResults){return null;}var results=eval("("+metaResults.replace(/""([^",\]]+)/g,'"\\"$1').replace(/([^",]+)""/g,'$1\\""')+")");for(var i=0;i<results.length;i++){results[i]=(results[i]=="")?null:apf.unserialize(apf.flash.decode(results[i]));}return results;},_destringify:function(results){if(typeof results=="string"&&(/^string:/.test(results))){results=results.substring("string:".length);}else{results=eval(results);}return results;},getKeys:function(i){if(!i){i=this.namespace;}var d=this.callMethod("getKeys",i);if(d==this||d==null||d=="null"){d="";}d=d.split(",");d.sort();return d;},getNamespaces:function(){var c=this.callMethod("getNamespaces");if(c==this||c==null||c=="null"){c=apf.storage.namespace||"default";}c=c.split(",");c.sort();return c;},clear:function(c){if(!c){c=this.namespace;}this.callMethod("clear",c);},remove:function(d,i){if(!i){i=this.namespace;}this.callMethod("remove",d,i);},removeMultiple:function(l,i){if(!i){i=this.namespace;}var j=l.join(",");this.callMethod("removeMultiple",j,i);},isPermanent:function(){return true;},getMaximumSize:function(){return this.SIZE_NO_LIMIT;},hasSettingsUI:function(){return false;},showSettingsUI:function(){throw new Error(apf.formatErrorString(0,null,this.declaredClass+" does not support a storage settings user-interface"));},hideSettingsUI:function(){throw new Error(apf.formatErrorString(0,null,this.declaredClass+" does not support a storage settings user-interface"));},getResourceList:function(){return[];}};apf.storage.modules.html5={domain:(location.hostname=="localhost")?"localhost.localdomain":location.hostname,initialized:true,isAvailable:function(){try{var i=globalStorage[this.domain];}catch(d){return false;}return true;},put:function(l,o,q){l=this.getFullKey(l,q);o=apf.serialize(o);try{var m=globalStorage[this.domain];m.setItem(l,o);}catch(n){}},get:function(n,m){n=this.getFullKey(n,m);var l=globalStorage[this.domain];var j=l.getItem(n);if(j==null||j==""){return null;}return apf.unserialize(j);},getNamespaces:function(){var t=[this.namespace];var q={};var i=globalStorage[this.domain];var o=/^__([^_]*)_/;for(var w=0;w<i.length;w++){var u=i.key(w);if(o.test(u)==true){var s=u.match(o)[1];if(typeof q[s]=="undefined"){q[s]=true;t.push(s);}}}return t;},getKeys:function(s){if(!s){s=this.namespace;}var i=new RegExp(s==this.namespace?"^([^_]{2}.*)$":"^__"+s+"_(.*)$");var q=globalStorage[this.domain];var o=[];for(var t=0;t<q.length;t++){var n=q.key(t);if(i.test(n)==true){n=n.match(i)[1];o.push(n);}}return o;},clear:function(n){if(!n){n=this.namespace;}var l=new RegExp(n==this.namespace?"^[^_]{2}":"^__"+n+"_");var m=globalStorage[this.domain];for(var i=m.length-1;i>=0;i--){if(l.test(m.key(i))==true){m.removeItem(m.key(i));}}},remove:function(i,l){i=this.getFullKey(i,l);var j=globalStorage[this.domain];j.removeItem(i);},isPermanent:function(){return true;},getMaximumSize:function(){return 0;},hasSettingsUI:function(){return false;},showSettingsUI:function(){throw new Error(apf.formatErrorString(0,null,this.declaredClass+" does not support a storage settings user-interface"));},hideSettingsUI:function(){throw new Error(apf.formatErrorString(0,null,this.declaredClass+" does not support a storage settings user-interface"));},getFullKey:function(d,i){if(!i){i=this.namespace;}return i==this.namespace?d:"__"+i+"_"+d;}};apf.storage.modules["air.file"]={initialized:false,init:function(){this.File=window.runtime.flash.filesystem.File;this.FileStream=window.runtime.flash.filesystem.FileStream;this.FileMode=window.runtime.flash.filesystem.FileMode;this.storagePath="__JPF_"+(apf.config.name?apf.config.name.toUpperCase():"STORAGE")+"/";try{var d=this.File.applicationStorageDirectory.resolvePath(this.storagePath);if(!d.exists){d.createDirectory();}this.initialized=true;}catch(i){apf.console.warn(i.message);return false;}},isAvailable:function(){return apf.isAIR;},put:function(u,s,t){if(!t){t=this.namespace;}try{this.remove(u,t);var q=this.File.applicationStorageDirectory.resolvePath(this.storagePath+t);if(!q.exists){q.createDirectory();}var w=q.resolvePath(u);var n=new this.FileStream();n.open(w,this.FileMode.WRITE);n.writeObject(s);n.close();}catch(o){return false;}return true;},get:function(o,n){if(!n){n=this.namespace;}var q=this.File.applicationStorageDirectory.resolvePath(this.storagePath+n+"/"+o);if(!q.exists||q.isDirectory){return false;}var m=new this.FileStream();m.open(q,this.FileMode.READ);var l=m.readObject();m.close();return l;},getNamespaces:function(){var m=[this.namespace];var i=this.File.applicationStorageDirectory.resolvePath(this.storagePath);var l=i.getDirectoryListing();for(var n=0;n<l.length;n++){if(l[n].isDirectory&&l[n].name!=this.namespace){m.push(l[n].name);}}return m;},getKeys:function(n){if(!n){n=this.namespace;}var o=[];var m=this.File.applicationStorageDirectory.resolvePath(this.storagePath+n);if(m.exists&&m.isDirectory){var i=m.getDirectoryListing();for(var q=0;q<i.length;q++){o.push(i[q].name);}}return o;},clear:function(i){if(!i){i=this.namespace;}var d=this.File.applicationStorageDirectory.resolvePath(this.storagePath+i);if(d.exists&&d.isDirectory){d.deleteDirectory(true);}},remove:function(l,j){if(!j){j=this.namespace;}var i=this.File.applicationStorageDirectory.resolvePath(this.storagePath+j+"/"+l);if(i.exists&&!i.isDirectory){i.deleteFile();}},putMultiple:function(n,m,o){if(!o){o=this.namespace;}try{for(var q=0;q<n.length;q++){this.put(n[q],m[q],null,o);}}catch(i){return false;}return true;},getMultiple:function(l,m){if(!m){m=this.namespace;}var n=[];for(var i=0;i<l.length;i++){n[i]=this.get(l[i],m);}return n;},removeMultiple:function(j,l){if(!l){l=this.namespace;}for(var i=0;i<j.length;i++){this.remove(j[i],l);}},isPermanent:function(){return true;},getMaximumSize:function(){return this.SIZE_NO_LIMIT;},hasSettingsUI:function(){return false;},showSettingsUI:function(){throw new Error(this.declaredClass+" does not support a storage settings user-interface");},hideSettingsUI:function(){throw new Error(this.declaredClass+" does not support a storage settings user-interface");}};apf.storage.modules["air.sql"]={database_file:"apf.db",initialized:false,_db:null,init:function(){this.File=window.runtime.flash.filesystem.File;this.SQLConnection=window.runtime.flash.data.SQLConnection;this.SQLStatement=window.runtime.flash.data.SQLStatement;this.table_name="__JPF_"+(apf.config.name?apf.config.name.toUpperCase():"STORAGE");try{this._db=new this.SQLConnection();this._db.open(this.File.applicationStorageDirectory.resolvePath(this.database_file));this._sql("CREATE TABLE IF NOT EXISTS "+this.table_name+"(namespace TEXT, key TEXT, value TEXT)");this._sql("CREATE UNIQUE INDEX IF NOT EXISTS namespace_key_index ON "+this.table_name+" (namespace, key)");this.initialized=true;}catch(c){apf.console.warn(c.message);return false;}},_sql:function(l,j){var i=new this.SQLStatement();i.sqlConnection=this._db;i.text=l;if(j){apf.extend(i.parameters,j);}i.execute();return i.getResult();},isAvailable:function(){return apf.isAIR;},put:function(j,m,n){if(!n){n=this.namespace;}try{this._sql("DELETE FROM "+this.table_name+" WHERE namespace = :namespace AND key = :key",{":namespace":n,":key":j});this._sql("INSERT INTO "+this.table_name+" VALUES (:namespace, :key, :value)",{":namespace":n,":key":j,":value":m});}catch(l){return false;}return true;},get:function(l,j){if(!j){j=this.namespace;}var i=this._sql("SELECT * FROM "+this.table_name+" WHERE namespace = :namespace AND key = :key",{":namespace":j,":key":l});if(i.data&&i.data.length){return i.data[0].value;}return null;},getNamespaces:function(){var j=[this.namespace];var i=this._sql("SELECT namespace FROM "+this.table_name+" DESC GROUP BY namespace");if(i.data){for(var l=0;l<i.data.length;l++){if(i.data[l].namespace!=this.namespace){j.push(i.data[l].namespace);}}}return j;},getKeys:function(l){if(!l){l=this.namespace;}var m=[];var i=this._sql("SELECT key FROM "+this.table_name+" WHERE namespace = :namespace",{":namespace":l});if(i.data){for(var n=0;n<i.data.length;n++){m.push(i.data[n].key);}}return m;},clear:function(c){if(!c){c=this.namespace;}this._sql("DELETE FROM "+this.table_name+" WHERE namespace = :namespace",{":namespace":c});},remove:function(d,i){if(!i){i=this.namespace;}this._sql("DELETE FROM "+this.table_name+" WHERE namespace = :namespace AND key = :key",{":namespace":i,":key":d});},putMultiple:function(n,m,o){if(!o){o=this.namespace;}try{this._db.begin();for(var q=0;q<n.length;q++){this._sql("DELETE FROM "+this.table_name+" WHERE namespace = :namespace AND key = :key",{":namespace":o,":key":key[q]});this._sql("INSERT INTO "+this.table_name+" VALUES (:namespace, :key, :value)",{":namespace":o,":key":key[q],":value":value});}this._db.commit();}catch(i){return false;}return true;},getMultiple:function(m,n){if(!n){n=this.namespace;}var o=[];for(var q=0;q<m.length;q++){var i=this._sql("SELECT * FROM "+this.table_name+" WHERE namespace = :namespace AND key = :key",{":namespace":n,":key":m[q]});o[q]=i.data&&i.data.length?i.data[0].value:null;}return o;},removeMultiple:function(j,l){if(!l){l=this.namespace;}this._db.begin();for(var i=0;i<j.length;i++){this._sql("DELETE FROM "+this.table_name+" WHERE namespace = namespace = :namespace AND key = :key",{":namespace":l,":key":j[i]});}this._db.commit();},isPermanent:function(){return true;},getMaximumSize:function(){return this.SIZE_NO_LIMIT;},hasSettingsUI:function(){return false;},showSettingsUI:function(){throw new Error(this.declaredClass+" does not support a storage settings user-interface");},hideSettingsUI:function(){throw new Error(this.declaredClass+" does not support a storage settings user-interface");}};apf.http=function(){this.queue=[null];this.callbacks={};this.cache={};this.timeout=this.timeout||10000;this.autoroute=this.autoroute||false;this["route-server"]=this["route-server"]||null;if(!this.$uniqueId){this.$uniqueId=apf.all.push(this)-1;}this.toString=this.toString||function(){return"[Ajax.org Teleport Component : (HTTP)]";};var c=apf.config.name+".apf.http";this.saveCache=function(){var a=apf.serialize(comm.cache);apf.storage.put("cache_"+this.name,a,apf.config.name+".apf.http");};this.loadCache=function(){var a=apf.storage.get("cache_"+this.name,apf.config.name+".apf.http");if(!a){return false;}this.cache=apf.unserialize(a);return true;};this.clearCache=function(){apf.storage.remove("cache_"+this.name,apf.config.name+".apf.http");};this.getXml=function(j,a,l){if(!l){l={};}l.useXML=true;l.callback=a;return this.get(j,l);};this.get=this.$get=function(T,X){if(!X){X={};}var V=this;var N=X.id;var U=(typeof apf.offline!="undefined");if(U&&!apf.offline.onLine&&X.notWhenOffline){return false;}if(U&&!apf.offline.onLine&&!X.ignoreOffline){if(apf.offline.queue.enabled){var a=apf.extend({url:T,callback:X.callback,retry:function(){V.get(this.url,this.options);},$object:[this.name,"apf.oHttp","new apf.http()"],$retry:"this.object.get(this.url, this.options)"},X);apf.offline.queue.add(a);return;}}var R=X.async=(X.async||typeof X.async=="undefined"||apf.isOpera||false);if(apf.isWebkit){T=apf.html_entity_decode(T);}var K=X.data||"";if(apf.isNot(N)){if(this.cache[T]&&this.cache[T][K]){var G={responseText:this.cache[T][K],responseXML:{},status:200,isCaching:true};}else{var G=apf.getHttpReq();}N=this.queue.push({http:G,url:T,callback:X.callback,retries:0,options:X})-1;if(G.isCaching){if(R){return $setTimeout("apf.lookup("+this.$uniqueId+").receive("+N+");",50);}else{return this.receive(N);}}}else{var G=this.queue[N].http;if(G.isCaching){G=apf.getHttpReq();}else{G.abort();}}if(R){if(apf.hasReadyStateBug){this.queue[N].starttime=new Date().getTime();this.queue[N].timer=setInterval(function(){var d=new Date().getTime()-V.queue[N].starttime;if(d>V.timeout){V.$timeout(N);return;}if(V.queue[N].http.readyState==4){clearInterval(V.queue[N].timer);V.receive(N);}},20);}else{G.onreadystatechange=function(){if(!V.queue[N]||G.readyState!=4){return;}V.receive(N);};}}var I=this.autoroute&&apf.isOpera?true:(X.autoroute||this.shouldAutoroute),F=I?this["route-server"]:T;var W=false;try{if(X.nocache){F=apf.getNoCacheUrl(F);}if(apf.config.queryAppend){F+=(F.indexOf("?")==-1?"?":"&")+apf.config.queryAppend;}if(apf.hasHtml5XDomain&&F.match(/^http:\/\//)&&!new apf.url(F).isSameLocation()){throw new Error(apf.formatErrorString(0,this,"Communication error","Url: "+F+"\nReason: Same origin policy in effect"));}G.open(this.method||X.method||"GET",F,R);if(X.username){G.setRequestHeader("Authorization","Basic "+apf.crypto.Base64.encode(X.username+":"+X.password));}if(!apf.isWebkit){G.setRequestHeader("User-Agent","Ajax.org Teleport 3.0");}G.setRequestHeader("X-Requested-With","XMLHttpRequest");if(!X.headers||!X.headers["Content-type"]){G.setRequestHeader("Content-type",this.contentType||(this.useXML||X.useXML?"text/xml":"text/plain"));}if(I){G.setRequestHeader("X-Route-Request",T);G.setRequestHeader("X-Proxy-Request",T);G.setRequestHeader("X-Compress-Response","gzip");}}catch(E){W=E.message;}if(W){var M=false;if(!M&&this.autoroute&&!I){if(!apf.isNot(N)){clearInterval(this.queue[N].timer);}this.shouldAutoroute=true;X.autoroute=true;return this.get(T,X);}if(!M){var O=X.callback?X.callback(null,apf.ERROR,{userdata:X.userdata,http:G,url:T,tpModule:this,id:N,message:"Permission denied accessing remote resource: "+T+"\nMessage: "+W}):false;if(!O){this.clearQueueItem(N);}return;}}if(this.$headerHook){this.$headerHook(G);}if(X.headers){for(var J in X.headers){G.setRequestHeader(J,X.headers[J]);}}function P(){var d=self.navigator.onLine?"File or Resource not available "+T:"Browser is currently working offline";var j=self.navigator&&navigator.onLine?apf.ERROR:apf.TIMEOUT;var i=X.callback?X.callback(null,j,{userdata:X.userdata,http:G,url:T,tpModule:V,id:N,message:d}):false;if(!i){V.clearQueueItem(N);}}function Q(i){var l;if(apf.isIE&&i){var j=window.onerror;window.onerror=function(){if(arguments.caller.callee==Q){window.onerror=j;return true;}else{window.onerror=j;if(j){return j.apply(window,arguments);}}};G.send(K);window.onerror=j;}else{try{G.send(K);}catch(d){l=true;}}if(l){P();return;}}if(!R){Q.call(this);return this.receive(N);}else{if(apf.loadsLocalFilesSync&&location.protocol=="file:"&&T.indexOf("http://")==-1){$setTimeout(function(){Q.call(V,true);});}else{Q.call(V);}return N;}};if(!this.exec){this.exec=function(a,q,n,s){if(!s){s={};}var t=q[0],o="";if(!s.method){s.method=a.toUpperCase();}if(!s.callback){s.callback=n;}this.contentType="application/x-www-form-urlencoded";this.$get(apf.getAbsolutePath(apf.config.baseurl,t),s.method=="GET"?s:apf.extend({data:o},s));};}this.receive=function(E){if(!this.queue[E]){return false;}var A=this.queue[E],a=A.http,G=A.callback;clearInterval(A.timer);if(self.navigator&&navigator.onLine===false&&(location.protocol!="file:"||A.url.indexOf("http://")>-1)){return false;}if(A.async){try{if(a.status){}}catch(w){var u=this;return $setTimeout(function(){u.receive(E);},10);}}var z=[],B={tpModule:this,http:a,url:A.url,callback:G,id:E,retries:A.retries||0,userdata:A.options.userdata};if(a.status>600){return this.$timeout(E);}B.data=a.responseText;if(a.status>=400&&a.status<600||a.status<10&&a.status!=0){if(a.status==401){var C=apf.document.getElementsByTagNameNS(apf.ns.apf,"auth")[0];if(C){var D=A.isAuthDelayed;A.isAuthDelayed=true;if(C.authRequired(B,D)===true){return;}}}z.push("HTTP error ["+E+"]:"+a.status+"\n"+a.responseText);}if(A.options.useXML||this.useXML){if((a.responseText||"").replace(/^[\s\n\r]+|[\s\n\r]+$/g,"")==""){z.push("Received an empty XML document (0 bytes)");}else{try{var F=(a.responseXML&&a.responseXML.documentElement)?apf.xmlParseError(a.responseXML):apf.getXmlDom(a.responseText);if(!apf.supportNamespaces){F.setProperty("SelectionLanguage","XPath");}B.data=F.documentElement;}catch(w){z.push("Received invalid XML\n\n"+w.message);}}}if(z.length){B.message=z.join("\n");if(!G||!G(B.data,apf.ERROR,B)){this.clearQueueItem(E);}return;}if(A.options.caching){if(!this.cache[A.url]){this.cache[A.url]={};}this.cache[A.url][A.options.data]=a.responseText;}if(!G||!G(B.data,apf.SUCCESS,B)){this.clearQueueItem(E);}return B.data;};this.$timeout=function(w){if(!this.queue[w]){return false;}var a=this.queue[w],t=a.http;clearInterval(a.timer);try{if(t.status){}}catch(s){var u=this;return $setTimeout(function(){u.$timeout(w);},10);}var o=a.callback;t.abort();var q=o?o(null,apf.TIMEOUT,{userdata:a.options.userdata,http:t,url:a.url,tpModule:this,id:w,message:"HTTP Call timed out",retries:a.retries||0}):false;if(!q){this.clearQueueItem(w);}};this.retryTimeout=function(q,n,o,a,m){if(n==apf.TIMEOUT&&q.retries<(m||apf.maxHttpRetries)){return q.tpModule.retry(q.id);}a=a||new Error(apf.formatErrorString(0,this,"Communication "+(n==apf.TIMEOUT?"timeout":"error"),"Url: "+q.url+"\nInfo: "+q.message));if((o||apf).dispatchEvent("error",apf.extend({error:a,state:n,bubbles:true},q))===false){return true;}};this.clearQueueItem=function(a){if(!this.queue[a]){return false;}clearInterval(this.queue[a].timer);if(apf.releaseHTTP){apf.releaseHTTP(this.queue[a].http);}this.queue[a]=null;delete this.queue[a];return true;};this.retry=function(a){if(!this.queue[a]){return false;}var i=this.queue[a];clearInterval(i.timer);i.retries++;this.get(i.url,i.options);return true;};this.cancel=function(a){if(a===null){a=this.queue.length-1;}if(!this.queue[a]){return false;}this.clearQueueItem(a);};if(!this.$loadAml&&!this.instantiate&&!this.call){this.$loadAml=function(w){var t=this["receive"];for(var u=0,s=this.childNodes.length;u<s;u++){if(this.childNodes[u].nodeType!=1){continue;}var a=this.childNodes[u].getAttribute("url"),l=self[this.childNodes[u].getAttribute("receive")||t],i={useXML:this.childNodes[u].getAttribute("type")=="XML",async:!apf.isFalse(this.childNodes[u].getAttribute("async"))};this[this.childNodes[u].getAttribute("name")]=function(d,j){i.userdata=j;i.data=d;return this.get(a,i);};}};this.instantiate=function(n){var a=n.getAttribute("src"),l={async:n.getAttribute("async")!="false",nocache:true};this.getURL=function(d,i){l.data=d;l.userdata=i;l.callback=this.callbacks.getURL;return this.get(a,l);};var m="http"+Math.round(Math.random()*100000);apf.setReference(m,this);return m+".getURL()";};this.call=function(a,i){this[a].call(this,i);};}};apf.Init.run("http");apf.USEIFRAME=false;function runTpIframe(){function i(){this.$uniqueId=apf.all.push(this);var q=this;if(apf.USEIFRAME){this.iframe=document.body.appendChild(document.createElement("iframe"));this.iframe.style.width="400px";this.iframe.style.height="300px";this.iframe.style.position="absolute";this.iframe.style.left="0";this.iframe.style.top="0";this.iframe.style.zIndex=1000000000;document.body.style.display="block";}else{var n=document.body.appendChild(document.createElement("xml"));this.xmlDocument=n.XMLDocument;this.xmlDocument.setProperty("SelectionLanguage","XPath");document.body.removeChild(n);}this.readyState=0;this.status=null;this.responseText=null;this.responseXML=null;this.setRequestHeader=function(){};this.send=function(){this.done=false;if(apf.USEIFRAME){this.iframe.src=this.url;}else{this.xmlDocument.load(this.url);}};this.open=function(j,m,l){this.method=j;this.url=m;this.async=l;if(apf.USEIFRAME){if(!l){throw new Error(apf.formatErrorString(1081,null,"Iframe callback","Compatibility mode prevents possibility of non-async calls"));}this.iframe.onload=o;}else{this.xmlDocument.async=l;this.xmlDocument.onreadystatechange=c;}};this.abort=function(){if(apf.USEIFRAME){this.iframe.onreadystatechange=null;this.iframe.src="about:blank";q.done=false;q.readyState="";}else{this.xmlDocument.abort();}};var a=this;function c(){a.receive();}this.receive=function(){this.readyState=this.xmlDocument.readyState;if(this.readyState==4){this.status=200;this.responseText=this.xmlDocument.responseText||this.xmlDocument.xml;this.responseXML=this.xmlDocument;}if(this.onreadystatechange){this.onreadystatechange();}};function o(){if(q.done){return;}q.done=true;q.receiveIframe();}this.receiveIframe=function(){var j=this.iframe.contentWindow.document.body.innerText;j=j.replace(/^- /gm,"");try{this.responseXML=apf.getXmlDom(j);this.responseXML.setProperty("SelectionLanguage","XPath");this.responseXML.loadXML(j);}catch(l){this.responseXML=null;}this.responseText=this.responseXML?this.responseXML.xml:j;this.status=200;this.readyState=4;if(this.onreadystatechange){this.onreadystatechange();}};}function d(a,c){var n=document.body.appendChild(document.createElement("xml"));var m=n.XMLDocument;document.body.removeChild(n);m.setProperty("SelectionLanguage","XPath");if(a){m.loadXML(a);}if(!c){apf.xmlParseError(m);}return m;}}apf.draw.vml={initRoot:function(d){if(!apf.isIE8){apf.importCssString("v\\:fill {behavior: url(#default#VML);display:inline-block} v\\:stroke {behavior: url(#default#VML);} v\\:shape {behavior: url(#default#VML);} v\\:path {behavior: url(#default#VML);}");d.$int.innerHTML="                <div style='z-index:10000;position:absolute;left:0px;width:0px;                            background:url(images/spacer.gif);width:"+d.width+"px;height:"+d.height+"px;'>                </div>                <div style='margin: 0 0 0 0;padding: 0px 0px 0px 0px;                             position:absolute;display:inline-block;left:0;top:0;width:"+d.width+"px;height:"+d.height+"px;overflow:hidden;'>                </div>";d.vmlroot=d.$int.lastChild;}else{d.$int.innerHTML="                <div style='z-index:10000;position:absolute;left:0px;width:0px;                            background:url(images/spacer.gif);width:"+d.width+"px;height:"+d.height+"px;'>                </div>                <iframe style='margin:0 0 0 0;padding:0 0 0 0;background:transparent;                             position:absolute;border:0px;display:inline-block;left:0;top:0;width:"+d.width+"px;height:"+d.height+"px;overflow:hidden;'>                </iframe>";d.vmliframe=d.$int.lastChild;d.vmliframe.allowTransparency=true;var i=d.vmliframe.contentWindow.document;i.open();i.writeln("<head><meta http-equiv='X-UA-Compatible' content='IE=EmulateIE7' /></head>                        <style>v\\:fill {behavior: url(#default#VML);display:inline-block} v\\:stroke {behavior: url(#default#VML);}                        v\\:shape {behavior: url(#default#VML);} v\\:path {behavior: url(#default#VML);}</style>                        <html><body style='margin: 0 0 0 0;padding: 0 0 0 0;border: 0px;background:transparent;'>                        <div style='position:absolute;display:inline-block;'></div></body></html>");i.close();d.vmlroot=i.body.firstChild;}return this;},resizeRoot:function(i){var d=i.vmliframe||i.vmlroot;d.style.width=i.width;d.style.height=i.height;d=d.previousSibling;d.style.width=i.width,d.style.height=i.height;if(i.vmliframe){d=i.vmlroot;d.style.width=i.width;d.style.height=i.height;}},initLayer:function(d,i){d.ds=1;d.dx=0,d.dy=0;d.dw=parseFloat(d.width)*d.ds;d.dh=parseFloat(d.height)*d.ds;d._styles=[];d._htmljoin=[];d._vmlroot=i.vmlroot;},resizeLayer:function(l,B){var t,A,n,D,C;l.dx=0,l.dy=0;l.dw=parseFloat(n=l.width)*l.ds;l.dh=parseFloat(D=l.height)*l.ds;var E=(l.dw+1)+","+(l.dh+1);if(l._vmlgroup){(C=l._vmlgroup).style.left=t=l.left,C.style.top=A=l.top,C.style.width=n,C.style.height=D;for(var z=l._vmlgroup.childNodes,l=z.length,i=0;i<l;i++){(C=z[i]).style.width=n,C.style.height=D;if(C.coordsize){C.coordsize=E;}}}},deinitLayer:function(c){if(c._vmlgroup){c._vmlgroup.removeNode();c._vmlgroup=0;}},beginLayer:function(c){if(c._styles.length){if(c._vmlgroup){c._vmlgroup.innerHTML="";}c._styles=[];c._htmljoin=[];}this.l=c,this.mx="",this.my="",this.last=null;return[this.jssVars,"if(!l._styles)_initStyles();","var _s1,_s2,_s3,_s4,_s5,_s6,_s7,_s8,_s9,_st,_su,_sv,","_x1,_x2,_x3,_x4,_x5,_x6,_x7,_x8,_x9,_x10,","_y1,_y2,_y3,_y4,_y5,_y6,_y7,_y8,_y9,_y10,","_t,_u,_l,_dx,_dy,_tn,_tc,_lc,_s,_p,","_styles = l._styles;"].join("");},clear:function(){return"";},endLayer:function(){var A=this.l;var C=[this.$endDraw()],s,i,E,F;var B=[];var j=0,l=0,D,G=A._styles.length;for(;j<G;j++){D=A._styles[j];if(D._prev===undefined){B.push("_styles[",j,"]={","_domnode:_n=l._vmlgroup.childNodes[",l,"]");if(D.$stylelist){B.push(",",apf.draw.serializeStyleState(D));}if(D.isshape){C.push(this.$finalizeShape(D));B.push(",_vmlfill:_n.lastChild?_n.lastChild.previousSibling:0,_vmlstroke:_n.lastChild");}else{B.push(',_txtused:0,_txtcount:0,_txtnodes:[],_txtdiv:"',D._txtdiv,'"');C.push(this.$finalizeFont(D));}B.push("};");l++;}}C.push(["l._anim = _anim;","function _initStyles(){","l._vmlroot.insertAdjacentHTML('beforeend',[",'"<div style=\'position:absolute;display:inline-block;left:",l.left,"','px;top:",l.top,"px;width:",l.width,"px;height:",l.height,"',"px;overflow:hidden;'>\",",'"',A._htmljoin.join(""),'",',"\"</div>\"].join(''));","l._vmlgroup = l._vmlroot.lastChild;","var _n, _styles = l._styles = [];",B.join(""),"};"].join(""));A._styles=null;this.l=null;return C.join("");},beginShape:function(t){if(!t){return"document.title='beginShape Failed';";}var V=this.l,X=V._htmljoin,O,P,ad=[],l=[],aa=[],ac="",M=[this.$endDraw()];t._path=[];if(t._id===undefined){t._id=V._styles.push(t)-1;}this.style=t;for(O=V._styles.length-2;O>=0;O--){if(!V._styles[O]._prev&&this.$canJoin(P=V._styles[O],t)){t._prev=(P._prev!==undefined)?P._prev:O;break;}}if(t._prev===undefined){M.push("_p=(_s=_styles[",t._id,"])._path=[];");if(typeof t.tile!="undefined"){var W=t.fillopacity;if(this.isDynamic(W)){W="1";M.push("_s._vmlfill.opacity=",t.fillopacity,";");}if(this.isDynamic(t.tile)){M.push("if(_s._vmlimg!=(_t=",t.tile,"))_s._vmlfill.src=_t;");aa.push("<v:fill origin='0,0' position='0,0' opacity='",W,"' src='' type='tile'/>");}else{aa.push("<v:fill origin='0,0' position='0,0' opacity='",W,"'  src='",t.tile,"' type='tile'/>");if(t.tilex||t.tiley){t._img=new Image();t._img.src=t.tile;if(t.tilex){M.push("_s._vmlfill.origin.x=((_t=((",t.tilex,")/(_s._img.width))%1)<0?1+_t:_t);");}if(t.tiley){M.push("_s._vmlfill.origin.y=((_t=((",t.tiley,")/_s._img.height)%1)<0?1+_t:_t);");}}}M.push("_p.push('m',_dx=-_s._img.width*100,' ',_dy=-_s._img.height*100,","',l',_dx,' ',_dy);");}else{if(t.fill!==undefined){var Q=t.fill,W=t.fillopacity,i=t.angle,T=t.gradopacity;if(!Q.sort){Q=[Q];}var N=Q.length;var R="black",Y,s,ab;if(N>2){for(O=1;O<N-1&&!this.isDynamic(Q[O]);O++){}if(O!=N-1){for(P=[],O=1;O<N-1;O++){P.push(O>1?'+",':'"',Math.round((O/(N-1))*100),'% "+',this.getColor(Q[O]));}Y=P.join("");ab=1;}else{for(P=[],O=1;O<N-1;O++){P.push(O>1?",":"",Math.round((O/(N-1))*100),"% ",Q[O]);}Y=P.join("");}}if(N>1){if(this.isDynamic(T)||this.isDynamic(W)){if(T==W){W="_t="+W,T="_t";}if(N>2){P=T,T=W,W=P;}M.push("if(_s._vmldata!=(_t=",'["<v:fill opacity=\'",(',W,"),\"' method='none' ","o:opacity2='\",",T,",\"' color='\",",this.getColor(Q[0]),",\"' color2='\",",this.getColor(Q[N-1]),",\"' type='gradient' angle='\",parseInt(((",i,")*360+180)%360),\"' ",Y?(ab?"colors='\","+Y+",\"'":"colors='"+Y+"'"):"","/>\"].join(''))){","_s._domnode.removeChild(_s._vmlfill);","_s._domnode.insertAdjacentHTML( 'beforeend',_s._vmldata=_t);","_s._vmlfill = _s._domnode.lastChild;};");aa.push("<v:fill opacity='0' color='black' type='fill'/>");}else{if(N>2){P=T,T=W,W=P;}if(this.isDynamic(Q[0])){M.push("_s._vmlfill.color=",this.getColor(Q[0]),";");}else{R=Q[0];}if(this.isDynamic(Q[N-1])){M.push("_s._vmlfill.color2=",this.getColor(Q[N-1]),";");}else{s=Q[N-1];}if(ab){M.push("_s._vmlfill.colors.value=",Y,";");}if(this.isDynamic(i)){i="0";M.push("_s._vmlfill.angle=(((",t.angle,")+180)*360)%360;");}if(this.isDynamic(W)){W="1";M.push("_s._vmlfill.opacity=",t.fillopacity,";");}aa.push("<v:fill opacity='",W,"' method='none' o:opacity2='",T,Y?"' colors='"+Y+"'":"","' color='",R,"' color2='",s,"' type='gradient' angle='",(i*360+180)%360,"'/>");}}else{if(this.isDynamic(W)){W="1";M.push("_s._vmlfill.opacity=",t.fillopacity,";");}if(this.isDynamic(Q[0])){M.push("_s._vmlfill.color=",this.getColor(Q[0]),";");}else{R=Q[0];}aa.push("<v:fill opacity='",W,"' color=",this.getColor(R)," type='fill'/>");}ad.push("fill='t'"),l.push("fillok='t'");}else{ad.push("fill='f'"),l.push("fillok='f'");}}if(t.stroke!==undefined){var U=t.weight,ac=t.strokeopacity,Z=t.stroke;if(this.isDynamic(ac)){ac="1";M.push("_s._vmlstroke.opacity=",t.opacity,";");}if(this.isDynamic(U)){U="1";M.push("_t=",t.weight,";_s._vmlstroke.weight=_t;if(_t<",ac,")_s._vmlstroke.opacity=_t;");}if(this.isDynamic(Z)){Z="black";M.push("_s._vmlstroke.color=",this.getColor(t.stroke),";");}aa.push("<v:stroke opacity='",U<1?(ac<U?ac:U):ac,"' weight='",U,"' color=",this.getColor(Z.dataType==apf.ARRAY?Z[0]:Z),"/>");}else{ad.push("stroke='f'"),l.push("strokeok='f'");}X.push(["<v:shape alignshape='f' ","style='position:absolute;display:inline-block;left:0;top:0;width:",'",l.width,"px;height:",l.height,"px;overflow:hidden;\' ',"coordorigin='0,0' coordsize='\",(l.dw+1),\",\",(l.dh+1),\"'","path='' ",ad.join(" "),"><v:path ",l.join(" "),"/>",aa.join(" "),"</v:shape>"].join(""));}else{if(t._prev!==undefined){if(this.last!==t._prev){M.push("_p=(_s=_styles[",t._prev,"])._path;");}}}return M.join("");},moveTo:function(d,i){return["_p.push('m',__round(",d,")",",' ',__round(",i+"),'l');\n"].join("");},lineTo:function(d,i){return["_p.push(__round(",d,")",",' ',__round("+i+"));\n"].join("");},lineH:function(i,j,l){return["_p.push('m',__round(",i,")",",' ',__round(",j,")",",'r',__round(",l,"),' 0');"].join("");},lineV:function(i,j,l){return["_p.push('m',__round(",i,")",",' ',__round(",j,")",",'r0 ',__round(",l,"));"].join("");},dot:function(d,i){return["_p.push('m',__round(",d,")",",' ',__round(",i,")",",'r0 0');"].join("");},rect:function(q,m,o,n,l){return["_u=",q,";if((_t=__round(",o,"))>0)_p.push('m',__round(_u),' ',__round(",m,")",",'r',_t,' 0r0 ',__round(",n,l?"),'r-'+_t,' 0x');":"),'r-'+_t,' 0xe');"].join("");},ellipse:function(q,w,u,s,t,o,c){if(!t){return["_p.push('at ',(_x1=__round(",q,"))-(_x2=__round(",u,")),' ',(_y1=__round(",w,"))-(_y2=__round(",s,")),' ',","_x1+_x2,' ',_y1+_y2,' 0 0 0 0');"].join("");}else{return["if( (_t=",t,")+0.000001<(_u=",o,")){","_p.push('",c?"wa":"at"," ',(_x1=__round(",q,"))-(_x2=__round(",u,")),' ',(_y1=__round(",w,"))-(_y2=__round(",s,")),' ',_x1+_x2,' ',_y1+_y2,' ',","__round(_x1+__sin(_t)*_x2*4000),' ',","__round(_y1+__cos(_t)*_y2*4000),' ',","__round(_x1+__sin(_u)*_x2*4000),' ',","__round(_y1+__cos(_u)*_y2*4000),'x');}else{","_p.push('l',__round((",q,")+__sin(_t)*(",u,")),' ',__round((",w,")+__cos(_t)*(",s,")),'x');","}",].join("");}},rectInv:function(j,l,n,m){return this.rect(j,l,n,m,1);},close:function(){return"_p.push('xe');";},$endShape:function(){this.mx="",this.my="";this.last=this.style._id;this.style=0;return"";},$finalizeShape:function(c){return["if((_s=_styles[",c._id,"])._pathstr!=(_t=","(_p=_s._path).length?_p.join(' '):'m'))_s._domnode.path=_t;\n"].join("");}};apf.draw.canvas={initRoot:function(i){var d=document.createElement("canvas");d.setAttribute("width",i.canvaswidth=i.width);d.setAttribute("height",i.canvasheight=i.height);d.className="canvas";i.$int.appendChild(d);i.canvaselem=d;i.canvas=d.getContext("2d");i.canvas.translate(0.5,0.5);i.imgcache={};return this;},resizeRoot:function(d){d.canvaselem.setAttribute("width",d.width);d.canvaselem.setAttribute("height",d.height);for(var i=d.canvaselem.nextSibling;i!=null;i=i.nextSibling){i.style.width=d.width+"px",i.style.height=d.height+"px";}},initLayer:function(d,i){d.imgcache=i.imgcache;d.canvas=i.canvas;d.textroot=i.$int;d.dx=d.left;d.dy=d.top;d.dw=d.width;d.dh=d.height;d.ds=1;d._styles=[];d._htmljoin=[];return this;},resizeLayer:function(d,i){d.dx=d.left;d.dy=d.top;d.dw=d.width;d.dh=d.height;},destroyLayer:function(c){},beginLayer:function(j){this.l=j,this.mx="",this.my="",this.last=null;this.tiletrans=0;this.dodraw=0;if(j._styles.length){for(var n=j._styles.length,l=0;l<n;l++){var i=j._styles[l];if(i._txtnode){i._txtnode.removeNode();}}j._styles=[];j._htmljoin=[];}var i=["if(!l._styles)_initStyles();","var _c=l.canvas,_styles=l._styles,","_s1,_s2,_s3,_s4,_s5,_s6,_s7,_s8,_s9,","_x1,_x2,_x3,_x4,_x5,_x6,_x7,_x8,_x9,_x10,","_y1,_y2,_y3,_y4,_y5,_y6,_y7,_y8,_y9,_y10,","_s,_sh,_sp,_sl,_sv,_su,_st,_dx,_dy,_td,_l,_lc,","_tc,_cv,_t,_u,_r,_q,_o,_m,_sr,_cr;"];if(j.dx!=0){i.push("_c.save();_c.beginPath();_c.translate(l.dx,l.dy);","_c.moveTo(0,0);_c.lineTo(l.dw,0);_c.lineTo(l.dw,l.dh);","_c.lineTo(0,l.dh);_c.closePath();_c.clip();\n");}return i.join("");},clear:function(){var d=this.l;var i=["_c.clearRect(l.dx,l.dy,l.dw,l.dh);\n"];return i.join("");},endLayer:function(){var w=this.l;var t=[this.$endDraw()];var l=[];var i=0,s=0,u,j=w._styles.length;for(;i<j;i++){u=w._styles[i];if(u._prev===undefined&&u.isfont){l.push("_styles[",i,"]={","_domnode:_n=l.textroot.childNodes[b+",s,"]",',_txtused:0,_txtcount:0,_txtnodes:[],_txtdiv:"',u._txtdiv,'"');t.push(this.$finalizeFont(u));l.push("};");s++;}else{l.push("_styles[",i,"]={");if(u.$stylelist){l.push(apf.draw.serializeStyleState(u));}l.push("};");}}t.push(["l._anim = _anim;","function _initStyles(){","var _n, _styles = l._styles = [], b=l.textroot.childNodes.length;","l.textroot.insertAdjacentHTML('beforeend', \"",w._htmljoin.join(""),'");',l.join(""),"}"].join(""));if(w.dx!=0){t.push("_c.restore();");}w._styles=null;this.l=null;return t.join("");},beginShape:function(u,o,W,V,ad){var Z=(this.style&&this.style.isshape)?this.style:{fill:"-",gradient:"-",angle:"-",stroke:"-",fillopacity:"-",strokeopacity:"-",weight:"-"};var X=[this.$endDraw(),"_c.beginPath();"],U=this.l;this.style=u;if(u._id===undefined){u._id=U._styles.push(u)-1;}X.push("_s=_styles[",u._id,"];");if(o!==undefined&&o!=""){this._clip=1;X.push("_c.save();_c.moveTo(",o,",",W,");_c.lineTo(l.dw-",V,",",W,");_c.lineTo(l.dw-",V,",l.dh-",ad,");","_c.lineTo(",W,",l.dh-",ad,");_c.closePath();_c.clip();","_c.beginPath();\n");}else{this._clip=0;}var i,t,R,s=0,T=u.fill;if(u.tile!==undefined){var ac="";if(u.tilex||u.tiley){ac=["_dx=__round(",(u.tilex||"0"),")%((_s._img&&_s._img.width)?_s._img.width:1),","_dy=__round(",(u.tiley||"0"),")%((_s._img&&_s._img.height)?_s._img.height:1);","_c.save();_c.translate(-_dx,-_dy);"].join("");this.tiletrans=1,this.mx="+_dx",this.my="+_dy";}s|=1;if(this.isDynamic(u.tile)){if(apf.isGecko&&u.fillopacity!=1){if(this.isDynamic(u.fillopacity)){X.push("if(!(_u=l.imgcache[_t=",u.tile,"])){","l.imgcache[_t]=_u=new Image();","_u.onload=function(){","_u._canvas = document.createElement('canvas');","_u._canvas.setAttribute('width', _u.width);","_u._canvas.setAttribute('height', _u.height);","_u._ctx = _u._canvas.getContext('2d');","_u.onload=null;","};","_u.src=_t;","}","if(_u && !_u.onload && _u._opacity !== (_q=",u.fillopacity,")){","_u._ctx.clearRect(0,0,_u.width,_u.height);","_u._ctx.globalAlpha=_u._opacity=_q;","_u._ctx.drawImage(_u,0,0);","_s._pattern=l.canvas.createPattern(_u._canvas,","'repeat');","}","if(_t=_s._pattern)_c.fillStyle=_t;\n",ac);}else{X.push("if(!(_u=l.imgcache[_t=",u.tile,"])){","l.imgcache[_t]=_u=new Image();","_u.onload=function(){","_u._canvas = document.createElement('canvas');","_u._canvas.setAttribute('width', _u.width);","_u._canvas.setAttribute('height', _u.height);","_u._ctx = _s._canvas.getContext('2d');","_u._ctx.globalAlpha="+u.fillopacity+";_u._ctx.drawImage(_u,0,0);","_u._pattern=l.canvas.createPattern(_u._canvas,'repeat');","_u.onload=null;","};","_u.src=_t;","}","if(_u && !_u.onload && _u!=_s._img){","_s._img=_u,_s.pattern=_u._pattern;","}","if(_t=_s._pattern)_c.fillStyle=_t;\n",ac);}}else{X.push("if(!(_u=l.imgcache[_t=",u.tile,"])){","l.imgcache[_t]=_u=new Image();","_u.onload=function(){","_u.onload=null;","_u._pattern=l.canvas.createPattern(_u,'repeat');","};","_u.src=_t;","}","if(_u && !_u.onload && _u!=_s._img){","_s._img=_u,_s.pattern=_u._pattern;","}","if(_t=_s._pattern)_c.fillStyle=_t;\n",ac);}}else{if(U.imgcache[u.tile]){u._pattern=U.canvas.createPattern(U.imgcache[u.tile],"repeat");}else{var a=new Image();a.onload=function(){u._img=a;if(apf.isGecko&&u.fillopacity!=1){u._canvas=document.createElement("canvas");u._canvas.setAttribute("width",a.width);u._canvas.setAttribute("height",a.height);u._ctx=u._canvas.getContext("2d");if(!apf.draw.isDynamic(u.fillopacity)){u._ctx.globalAlpha=u.fillopacity;u._ctx.drawImage(a,0,0);}u._pattern=U.canvas.createPattern(u._canvas,"repeat");}else{u._pattern=U.canvas.createPattern(u._img=this,"repeat");}};if(apf.isGecko&&this.isDynamic(u.fillopacity)){X.push("if(_s._ctx){","_s._ctx.clearRect(0,0,_s._img.width,_s._img.height);","_s._ctx.globalAlpha=",u.fillopacity,";","_s._ctx.drawImage(_s._img,0,0);","_s._pattern=l.canvas.createPattern(_s._canvas,","'repeat');}\n");}a.src=u.tile;}X.push("if(_t=(_s._pattern))_c.fillStyle=_t;",ac);}}else{if(T!==undefined){s|=1;if(T.sort&&T.length<=1){T=T.length&&T[0]?T[0]:"black";}if(T.sort){var l=T,Q=l.length;for(R=0;R<Q&&!this.isDynamic(T[R]);R++){}if(R!=Q||this.isDynamic(u.angle)||this.isDynamic(u.fillopacity)){X.push("_o=",u.fillopacity,",_r=",u.gradopacity,",_t=_s._colors,_m=0;");for(R=0;R<Q;R++){if(this.isDynamic(T[Q-R-1])){X.push("if(_t[",R,"]!=(_l=[","'rgba(',(((_q=parseInt((",this.getColor(T[Q-R-1]),").slice(1),16))>>16)&0xff),","',',((_q>>8)&0xff),',',(_q&0xff),',',","(",R/(Q-1),"*_o+",1-(R/(Q-1)),"*_r)",",')'].join(''))",")_t[",R,"]=_l,_m=1;");}else{var aa=parseInt((this.colors[T[Q-R-1].toLowerCase()]||T[Q-R-1]).slice(1),16);X.push("if(_t[",R,"]!=(_l=","['rgba(",(aa>>16)&255,",",(aa>>8)&255,",",aa&255,",',","(",R/(Q-1),"*_o+",1-(R/(Q-1)),"*_r),')'].join(''))",")_t[",R,"]=_l,_m=1;");}}X.push("if(_s._angle!=(_u=(",u.angle,")*2*p) || _m){","_s._grad=_q=_c.createLinearGradient(","dtx+(__sin(_s._angle=_u)*0.5+0.5)*dw,","dty+(__cos(_u)*0.5+0.5)*dh,","dtx+(__sin(p+_u)*0.5+0.5)*dw,","dty+(__cos(p+_u)*0.5+0.5)*dh);");for(R=0;R<Q;R++){X.push("_q.addColorStop(",R/(Q-1),",_t[",R,"]);");}X.push("_c.fillStyle=_q;}else _c.fillStyle=_s._grad;\n");u._colors=[];}else{var t=U.canvas.createLinearGradient((Math.sin(u.angle)*0.5+0.5)*U.dw,(Math.cos(u.angle)*0.5+0.5)*U.dh,(Math.sin(Math.PI+u.angle)*0.5+0.5)*U.dw,(Math.cos(Math.PI+u.angle)*0.5+0.5)*U.dh);var ab,Y=u.fillopacity,P=u.gradopacity;for(R=0;R<Q;R++){i=this.colors[i=T[Q-R-1].toLowerCase()]||T[Q-R-1];t.addColorStop(ab=R/(Q-1),"rgba("+(((i=parseInt(i.slice(1),16))>>16)&255)+","+((i>>8)&255)+","+((i)&255)+","+(ab*Y+(1-ab)*P)+")");}u._gradient=t;X.push("_c.fillStyle=_styles[",u._id,"]._gradient;");}}else{if(this.isDynamic(T)||Z.fill!=T){X.push("_c.fillStyle=",this.getColor(T),";");}}}}if(u.stroke!==undefined){s|=2;if(this.isDynamic(u.stroke)||Z.stroke!=u.stroke){X.push("_c.strokeStyle=",this.getColor(u.stroke),";");}if(this.isDynamic(u.weight)||Z.weight!=u.weight){X.push("_c.lineWidth=",u.weight,";");}}this.fillopacity="";this.strokeopacity="";this.fillmode=s;switch(s){case 3:if(u.fillopacity!=u.strokeopacity){this.fillopacity="_c.globalAlpha="+u.fillopacity+";";this.strokeopacity="_c.globalAlpha="+u.strokeopacity+";";}else{if(this.isDynamic(u.fillopacity)||u.fillopacity!=Z.fillopacity){X.push("_c.globalAlpha=",u.fillopacity,";");}}break;case 2:if(this.isDynamic(u.strokeopacity)||u.strokeopacity!=Z.strokeopacity){X.push("_c.globalAlpha=",u.strokeopacity,";");}break;case 1:if(this.isDynamic(u.fillopacity)||u.fillopacity!=Z.fillopacity){X.push("_c.globalAlpha=",u.fillopacity,";");}break;}return X.join("");},moveTo:function(d,i){return"_c.moveTo("+d+this.mx+","+i+this.my+");\n";},lineTo:function(d,i){this.dodraw=1;return"_c.lineTo("+d+this.mx+","+i+this.my+");\n";},lineH:function(i,j,l){this.dodraw=1;return["_c.moveTo(",i,this.mx,",",j,this.my,");","_c.lineTo(",i,this.mx,"+",l,",",j,this.my,");\n"].join("");},lineV:function(i,j,l){this.dodraw=1;return["_c.moveTo(",i,this.mx,",",j,this.my,");","_c.lineTo(",i,this.mx,",",j,this.my,"+",l,");\n"].join("");},dot:function(d,i){this.dodraw=1;return["_c.moveTo(",d,this.mx,",",i,this.my,");","_c.lineTo(",d,this.mx,",",i,this.my,");\n"].join("");},circle:function(o,c,s,t,q,n){this.dodraw=1;if(!t){t="0";}if(!q){q="p";}n=n?1:0;return["_c.arc(",o,",",c,",",s,",",t,",",q,",",n,");"].join("");},ellipse:function(q,w,u,s,t,o,c){this.dodraw=1;if(!t){t="0";}if(!o){o="p2";}c=c?1:0;return["if((_x2=(",u,"))!=0 && (_y2=-(",s,"))!=0){_c.translate(_x1=(",q,"),_y1=(",w,"));_c.scale(_x2,_y2);","_c.arc(0,0,1,(",t,")-1.5707965,(",o,")-1.5707965,",!c,");_c.scale(1/_x2,1/_y2);_c.translate(-_x1,-_y1);}"].join("");},rect:function(j,l,n,m){switch(this.fillmode){case 3:return this.fillopacity+"_c.fillRect(_x1="+j+this.mx+",_y1="+l+this.my+",_x2="+n+",_y2="+m+");"+this.strokeopacity+"_c.strokeRect(_x1,_y1,_x2,_y2);";case 2:return"_c.strokeRect("+j+this.mx+","+l+this.my+","+n+","+m+");\n";case 1:return"_c.fillRect("+j+this.mx+","+l+this.my+","+n+","+m+");\n";}},close:function(){return["_c.closePath();",this.$dodraw()].join("");},$dodraw:function(){this.dodraw=0;switch(this.fillmode){case 3:return this.fillopacity+"_c.fill();"+this.strokeopacity+"_c.stroke();_c.beginPath();\n";case 2:return"_c.stroke();_c.beginPath();\n";case 1:return"_c.fill();_c.beginPath();\n";}},$endShape:function(){var c=this.dodraw?[this.$dodraw()]:[];this.mx="",this.my="";this.last=this.style._id;this.style=0;if(this.tiletrans){c.push("_c.restore();");}this.tiletrans=0;if(this._clip){c.push("_c.restore();");}this._clip=0;return c.join("");},$finalizeShape:function(){return"";}};apf.chart_draw={_axis2D:{margin:{left:30,top:30,right:30,bottom:30,$:1},layout:{pow:10,step:4,onsidex:0,onaxisx:0,onsidey:1,onaxisy:0,$:1},plane:{inherit:"shape",stroke:"#cfcfcf",fill:"#e6f1f8",$:1},plane2:{inherit:"shape",$:1},label:{inherit:"font",join:"label",left:0,top:0,format:"fixed(v,1)",$:0},labelx:{inherit:"label",width:40,top:5,left:-19,side:0,axis:0,edgeclip:2,align:"center",$:1},labely:{inherit:"label",left:-110,top:-6,width:100,side:1,edgeclip:0,align:1?"right":"left",$:1},grid:{inherit:"shape",join:"grid",extend:0,$:0},hgrid:{inherit:"grid",$:1},vgrid:{inherit:"grid",$:1},tiles:{inherit:"shape",join:"tiles",fill:"#dfe7f5",$:1},bar:{inherit:"shape",join:"bar",$:0},hbar:{inherit:"bar",$:1},vbar:{inherit:"bar",$:1},axis:{inherit:"shape",join:"grid",stroke:"black",weight:1,extend:2,$:0},axisx:{inherit:"axis",$:1},axisy:{inherit:"axis",$:1},tick:{inherit:"shape",join:"grid",steps:5,left:0,top:0,size:4,stroke:"#000000",$:0},tickx:{inherit:"tick",$:1},ticky:{inherit:"tick",$:1},tickgx:{inherit:"tick",weight:2,size:6,$:1},tickgy:{inherit:"tick",weight:2,size:6,$:1}},axis2D:function(z,C){var u=apf.draw;if(!C.margin||!C.layout){return new Function("");}var w=C.margin.left*z.ds,B=C.margin.top*z.ds,A=C.margin.right*z.ds,c=C.margin.bottom*z.ds;var s=u.optimize([u.beginLayer(z),u.vars(w,B,A,c),u.clear(),"var v,d,u,h,","vcx = 0.5*__pow(",C.layout.pow,", __round(__log(__abs(vw)/",C.layout.pow,")/__log(",C.layout.pow,")))*",C.layout.step,",","vcy = 0.5*__pow(",C.layout.pow,", __round(__log(__abs(vh)/",C.layout.pow,")/__log(",C.layout.pow,")))*",C.layout.step,",","vbx = __ceil(vx1/vcx) * vcx,","vby = __ceil(vy1/vcy) * vcy,","vex = __floor(vx2/vcx) * vcx,","vey = __floor(vy2/vcy) * vcy,","dcx = vcx*tw, dcy = vcy*th,","dbx = vbx*tw+tx, dby = vby*th+ty,","dex = vex*tw+tx, dey = vey*th+ty,","dcx2 = dcx*2, dcy2 = dcy*2,","dbx2 = __ceil(vx1/(2*vcx))*2*vcx*tw+tx,","dex2 = __floor(vx2/(2*vcx))*2*vcx*tw+tx,","dby2 = __floor(vy1/(2*vcy))*2*vcy*th+ty,","dey2 = __floor(vy2/(2*vcy))*2*vcy*th+ty;","var xmaxstep = __ceil( (dex-dbx)/dcx )+4,","ymaxstep = __ceil( (dey-dby)/dcy )+4;",C.plane?[u.beginShape(C.plane),u.rect(w,B,"dw","dh")].join(""):"",C.tiles?[u.rectInv?[u.beginShape(C.tiles),"if((u=dbx2-dcx-",w,")>0){",u.rectInv(w,B,"u","dh"),"}","for( v = dbx2, u  = dex-dcx; v < u; v += dcx2){",u.rectInv("v",B,"dcx","dh"),"};","if((u=dr-v)>0){",u.rectInv("v",B,"__min(dcx,u)","dh"),"}","if((u=dey2+dcy-",B,")>0){",u.rectInv(w,B,"dw","u"),"}","for( v = dey2,u = dby+dcy; v < u; v -= dcy2){",u.rectInv(w,"v","dw","-dcy"),"};","if((u=db-v)>0){",u.rectInv(w,"v","dw","__min(-dcy,u)"),"}"].join(""):[u.beginShape(C.tiles,w,B,A,c),"for( u = dey2+dcy2, t = dby2-dcy2; u <= t; u -= dcy2){","for( v = dbx2-dcx2, d = dex2+dcx2; v <= d; v += dcx2){",u.rect("v+dcx","u","dcx","-dcy"),u.rect("v","u-dcy","dcx","-dcy"),"};","}"].join("")].join(""):"",C.vbar?[u.beginShape(C.vbar),"if((u=dbx2-dcx-",w,")>0){",u.rect(w,B,"u","dh"),"}","for( v = dbx2, u  = dex-dcx; v < u; v += dcx2){",u.rect("v",B,"dcx","dh"),"};","if((u=dr-v)>0){",u.rect("v",B,"__min(dcx,u)","dh"),"}"].join(""):"",C.hbar?[u.beginShape(C.hbar),"if((u=dey2+dcy-",B,")>0){",u.rect(w,B,"dw","u"),"}","for( v = dey2, u = dby+dcy; v < u; v -= dcy2){",u.rect(w,"v","dw","-dcy"),"};","if((u=db-v)>0){",u.rect(w,"v","dw","__min(-dcy,u)"),"}"].join(""):"",C.tickx?[u.beginShape(C.tickx),"u = ",C.layout.onaxisx?("ty+"+(C.tickx.top*z.ds)):(C.layout.onsidex?C.tickx.size*-z.ds+w:("db")),";","t = dcx/",C.tickx.steps,";","h = ",C.tickx.size*z.ds,";",C.layout.onaxisx?["if(u+h>",B," && u<dh+",c,"){","if(u<dy)h=h-(dy-u),u=dy;","if(u+h>db)h=db-u;"].join(""):"","x = dbx-dcx;while(x<dx)x+=t;","for(; x < dr; x += t){",u.lineV("x","u","h"),"};",C.layout.onaxisx?"}":"",].join(""):"",C.ticky?[u.beginShape(C.ticky),"t = dcy/",C.ticky.steps,";","u = ",C.layout.onaxisy?("tx+"+C.ticky.left*z.ds):(C.layout.onsidey?C.ticky.size*-z.ds+B:"dr"),";","h = ",C.ticky.size*z.ds,";",C.layout.onaxisy?["if(u+h>dx && u<dr){","if(u<dx)h=h-(dx-u),u=dx;","if(u+h>dr)h=dr-u;"].join(""):"","y = dey+dcy;while(y<dy)y-=t;","for(; y < db; y -= t){",u.lineH("u","y","h"),"};",C.layout.onaxisy?"}":"",].join(""):"",C.hgrid?[u.beginShape(C.hgrid),"t=dw+",C.hgrid.extend*z.ds,";","u=",(C.hgrid.extend*z.ds*-C.layout.onsidey)+w,";","for(y = dby; y >= dy; y += dcy){",u.lineH("u","y","t"),"};"].join(""):"",C.vgrid?[u.beginShape(C.vgrid),"t=dh+",C.vgrid.extend*z.ds,";","u=",(C.vgrid.extend*z.ds*-C.layout.onsidex)+B,";","for(x = dbx; x <= dr; x += dcx){",u.lineV("x","u","t"),"};"].join(""):"",C.tickgx?[u.beginShape(C.tickgx),"u = ",C.layout.onaxisx?("ty+"+C.tickgx.top*z.ds):(C.layout.onsidex?C.tickgx.size*-z.ds+w:("db")),";","h = ",C.tickgx.size*z.ds,";",C.layout.onaxisx?["if(u+h>dy && u<db){","if(u<dy)h=h-(dy-u),u=dy;","if(u+h>db)h=db-u;"].join(""):"","for(v=dbx; v <= dr; v += dcx){",u.lineV("v","u","h"),"};",C.layout.onaxisx?"}":"",].join(""):"",C.tickgy?[u.beginShape(C.tickgy),"u = ",C.layout.onaxisy?("tx+"+C.tickgy.left*z.ds):(C.layout.onsidey?C.tickgy.size*-z.ds+B:"dr"),";","h = ",C.tickgy.size*z.ds,";",C.layout.onaxisy?["if(u+h>dx && u<dr){","if(u<dx)h=h-(dx-u),u=dx;","if(u+h>dr)h=dr-u;"].join(""):"","for(v=dby; v >= dy; v += dcy){",u.lineH("u","v","h"),"};",C.layout.onaxisy?"}":"",].join(""):"",C.axisx?[u.beginShape(C.axisx),"if(ty>=dy && ty<=dy+dh){","t=dw+",C.axisx.extend*z.ds,";","u=dx+",(C.axisx.extend*z.ds*-C.layout.onsidey),";",u.lineH("u","ty","t"),"}"].join(""):"",C.axisy?[u.beginShape(C.axisy),"if(tx>=dx && tx<=dx+dw){","t=dh+",C.axisy.extend*z.ds,";","u=dy+",(C.axisy.extend*z.ds*-C.layout.onsidex),";",u.lineV("tx","u","t"),"}"].join(""):"",C.plane2?[u.beginShape(C.plane2),u.rect(w,B,"dw","dh")].join(""):"",C.labelx?[C.layout.onaxisx?u.beginFont(C.labelx,"xmaxstep",w,B,A,c):u.beginFont(C.labelx,"xmaxstep",w-C.labelx.edgeclip*z.ds,0,A-C.labelx.edgeclip*z.ds,0),"for( v = vbx, u = vex,d = dbx; v <= u; v+= vcx, d+= dcx ){",u.text("d",C.layout.onaxisx?"ty":(C.layout.onsidex?"dy":"db"),C.labelx.format),"}"].join(""):"",C.labely?[C.layout.onaxisy?u.beginFont(C.labely,"ymaxstep",w,B,A,c):u.beginFont(C.labely,"ymaxstep",0,B-C.labely.edgeclip*z.ds,0,c-C.labely.edgeclip*z.ds),"for( v = vby, u = vey,d = dby;v<= u; v+= vcy, d+= dcy ){;",u.text(C.layout.onaxisy?"tx":(C.layout.onsidey?"dx":"dr"),"d",C.labelx.format),"}"].join(""):"",u.endLayer()]);try{return new Function("l","v","m",s);}catch(l){alert("Failed to compile:\n"+l.message+"\n"+s);return 0;}},_axis3D:{layout:{pow:10,step:4,$:1},plane:{inherit:"shape",side:1,oneside:0,fill:"#e6f1f8",$:0},plane2:{inherit:"shape",$:1},planexy:{inherit:"plane",$:1},planexz:{inherit:"plane",$:1},planeyz:{inherit:"plane",$:1},bar:{inherit:"shape",join:"bar",oneside:0,$:0},hbar:{side:1,inherit:"bar",stroke:"#cfcfcf",$:0},vbar:{side:1,inherit:"bar",stroke:"#cfcfcf",fill:"blue",opacity:0.25,$:0},hbarxy:{inherit:"hbar",$:1},vbarxy:{inherit:"vbar",$:1},hbarxz:{inherit:"hbar",stroke:"black",opacity:0.25,$:1},vbarxz:{inherit:"vbar",fill:"#e6f1f8",stroke:"black",$:1},hbaryz:{inherit:"hbar",fill:"#blue",opacity:0.25,$:1},vbaryz:{inherit:"vbar",stroke:"black",opacity:0.25,fill:null,$:1},axis:{inherit:"shape",join:"grid",stroke:"black",opacity:0.5,weight:3,$:0},axisx:{inherit:"axis",$:1},axisy:{inherit:"axis",$:1},axisz:{inherit:"axis",$:1},tick:{inherit:"shape",join:"grid",steps:5,size:4,scale:0.1,angle:"ang(180)",stroke:"#000000",$:0},tickx:{inherit:"tick",angle:"ang(90+f1*90)",$:1},ticky:{inherit:"tick",angle:"ang(90+f2*90)",$:1},tickz:{inherit:"tick",$:1},label:{inherit:"font",join:"label",width:40,height:40,left:-20,top:"fontz(-5,200)",size:"fontz(10,200)",scale:0.2,stroke:null,angle:"ang(180)",format:"fixed(v,1)",$:0},labelx:{inherit:"label",angle:"ang(90+f1*90)",align:"center",$:1},labely:{inherit:"label",angle:"ang(90+f2*90)",align:"center",$:1},labelz:{inherit:"label",align:"center",$:1},$:0},chartView3D:function(d,i){return["var s3x=v.x3d/vw,s3xi=1/s3x,s3y=v.y3d/vh,s3yi=1/s3y,s3z=v.z3d/vd,s3zi=1/s3z;",i.sincos3("_m","v.rx","v.ry","v.rz"),i.setMatrix3D(i.matrixMul(i.matrix4T("(-0.5*vx1-0.5*vx2)","(-0.5*vy1-0.5*vy2)","(-0.5*vz1-0.5*vz2)"),i.matrix4S("s3x","s3y","s3z"),i.matrix4RP("_m"),i.matrix4T("v.tx","v.ty","v.tz")))].join("");},axis3D:function(B,D){if(!D.layout){return new Function("");}var w=apf.draw;var C=(new Date()).getTime();var s=-0.01;function A(d,t,m,n,ah,ae,aj,Z,ag,i,ac,u,af,q,X,ai,W,a,j,Y,o){function ad(F){return w.poly3DClip([0,1,2,3],[[ae,q,F],[ae,X,F],[aj,X,F],[aj,q,F]],t,s);}function ab(F){return["if((u=(",i,"-",u,")-",ae,")<",u," && u>0){",w.poly3DClip([0,1,2,3],[[ae,q,F],["("+ae+"+u)",q,F],["("+ae+"+u)",X,F],[ae,X,F]],t,s),"}","for( v = ",i,", u  = ",ac,"-0.000001; v < u; v += ",af,"){",w.poly3DClip([0,1,2,3],[["v",q,F],["(v+"+u+")",q,F],["(v+"+u+")",X,F],["v",X,F]],t,s),"};","if( v<",aj," ){",w.poly3DClip([0,1,2,3],[["v",q,F],["(u="+w.min("v+"+u,aj)+")",q,F],["u",X,F],["v",X,F]],t,s),"}"].join("");}function aa(F){return["if((u=(",a,"-",Y,")-",q,")<",Y," && u>0){",w.poly3DClip([0,1,2,3],[[ae,q,F],[ae,"("+q+"+u)",F],[aj,"("+q+"+u)",F],[aj,q,F]],t,s),"}","for( v = ",a,", u  = ",j,"-0.000001; v < u; v += ",o,"){",w.poly3DClip([0,1,2,3],[[ae,"v",F],[ae,"(v+"+Y+")",F],[aj,"(v+"+Y+")",F],[aj,"v",F]],t,s),"};","if( v<",X," ){",w.poly3DClip([0,1,2,3],[[ae,"v",F],[ae,"(u="+w.min("v+"+Y,X)+")",F],[aj,"u",F],[aj,"v",F]],t,s),"}"].join("");}return["s1=-(",w.backface3D([[ae,q,m],[ae,X,m],[aj,q,m]],t),");","s2=",w.backface3D([[ae,q,n],[ae,X,n],[aj,q,n]],t),";","s",d,"=s1*",ah,">=s2*",ah,";",D["plane"+d]?[w.beginShape(D["plane"+d]),"sa = s1*",w.style.side*ah,";","sb = s2*",w.style.side*ah,";",w.style.oneside?"if(sa>=sb)sb = -1;if(sb>=sa)sa = -1;":"","for(i=1;i>=0;i--){if((i?sa:sb)>=0){z=i?",m,":",n,";",ad("z"),"}};",].join(""):"",D["hbar"+d]?[w.beginShape(D["hbar"+d]),"sa = s1*",w.style.side*ah,";","sb = s2*",w.style.side*ah,";",w.style.oneside?"if(sa>=sb)sb = -1;if(sb>=sa)sa = -1;":"","for(i=1;i>=0;i--){if((i?sa:sb)>=0){z=i?",m,":",n,";",ab("z"),"}};"].join(""):"",D["vbar"+d]?[w.beginShape(D["vbar"+d]),"sa = s1*",w.style.side*ah,";","sb = s2*",w.style.side*ah,";",w.style.oneside?"if(sa>=sb)sb = -1;if(sb>=sa)sa = -1;":"","for(i=1;i>=0;i--){if((i?sa:sb)>=0){z=i?",m,":",n,";",aa("z"),"}};"].join(""):"",D["plane2"+d]?[w.beginShape(D["plane2"+d]),w.poly3DClip([0,1,2,3],[[ae,q,m],[aj,q,m],[aj,X,m],[ae,X,m]],t,s),].join(""):""].join("");}function E(d,q,m,n,ae,ag,ad,af,aj,ap,ai,ao,an,i,ah,t,ak,u,ab,am,aq,au,j,ac,o){var al=-1,a,at;if(D["axis"+d]){if((at=D["axis"+d].side1)!==undefined){ae=at;}if((at=D["axis"+d].side2)!==undefined){ag=at;}}var ar=["for(i=0;i<4;i++)if((i&2?(",ag,"?((f1=0,c=1,y=",u,"),1):0):(",ag,"?0:((f1=1,c=-1,y=",ab,"),1)))&&","(i&1?(",ae,"?((f2=0,d=1,z=",m,"),1):0):(",ae,"?0:((f2=1,d=-1,z=",n,"),1))))"].join("");return[D["axis"+d]?[w.beginShape(D["axis"+d]),ar,"{",w.poly3DClip([0,1],[[ap,"y","z"],[ai,"y","z"]],q,al,true),"};"].join(""):"",D["tick"+d]?[w.beginShape(D["tick"+d]),ar,"{",";u=y+",ad,"*__sin(f=(",w.style.angle,")*",aj,")*(",w.style.scale,")*c;w=z+",af,"*__cos(f)*(",w.style.scale,")*d;","for(v=",ao,";v<=",an,";v+=",t,"){",w.poly3DClip([0,1],[["v","y","z"],["v","u","w"]],q,al,true),"};","};"].join(""):"",D["label"+d]?[w.beginFont(D["label"+d],["__ceil(((",an,")-(",ao,"))/(",t,"))*2"].join("")),ar,"{",";u=y+",ad,"*__sin(f=(",w.style.angle,")*",aj,")*(",w.style.scale,")*c;w=z+",af,"*__cos(f)*(",w.style.scale,")*d;","for(v=",ao,";v<=",an,";v+=",t,"){",w.text3D(["v","u","w"],q,al,w.style.format),"}","}"].join(""):"",].join("");}var l=w.optimize([w.beginLayer(B),w.vars(),this.chartView3D(B,w),w.defCamVec(),w.clear(),"var v,d,c,u,h,w,f1,f2,","vcx = 0.5*__pow(",D.layout.pow,", __round(__log(__abs(vw)/",D.layout.pow,")/__log(",D.layout.pow,")))*",D.layout.step,",","vcy = 0.5*__pow(",D.layout.pow,", __round(__log(__abs(vh)/",D.layout.pow,")/__log(",D.layout.pow,")))*",D.layout.step,",","vcz = 0.5*__pow(",D.layout.pow,", __round(__log(__abs(vd)/",D.layout.pow,")/__log(",D.layout.pow,")))*",D.layout.step,",","vbx = __ceil(vx1/vcx) * vcx,","vby = __ceil(vy1/vcy) * vcy,","vbz = __ceil(vz1/vcz) * vcz,","vex = __floor(vx2/vcx) * vcx,","vey = __floor(vy2/vcy) * vcy,","vez = __floor(vz2/vcz) * vcz,","vcx2 = vcx*2, vcy2 = vcy*2, vcz2 = vcz*2,","vbx2 = __ceil(vx1/vcx2)*vcx2,","vex2 = __floor(vx2/vcx2)*vcx2,","vby2 = __ceil(vy1/vcy2)*vcy2,","vey2 = __floor(vy2/vcy2)*vcy2,","vbz2 = __ceil(vz1/vcz2)*vcz2,","vez2 = __floor(vz2/vcz2)*vcz2,","s1, s2, sa, sb, sxy, sxz, syz;","var xmaxstep = __ceil( (vex-vbx)/vcx )+4,","ymaxstep = __ceil( (vey-vby)/vcy )+4,","zmaxstep = __ceil( (vez-vbz)/vcz )+4;",A("xy",[0,1,2],"vz1","vz2",1,"vx1","vx2","vbx","vex","vbx2","vex2","vcx","vcx2","vy1","vy2","vby","vey","vby2","vey2","vcy","vcy2"),A("xz",[0,2,1],"vy1","vy2",-1,"vx1","vx2","vbx","vex","vbx2","vex2","vcx","vcx2","vz1","vz2","vbz","vez","vbz2","vez2","vcz","vcz2"),A("yz",[2,0,1],"vx1","vx2",1,"vy1","vy2","vby","vey","vby2","vey2","vcy","vcy2","vz1","vz2","vbz","vez","vbz2","vez2","vcz","vcz2"),E("x",[0,1,2],"vz1","vz2","sxy","sxz","s3yi","s3zi",1,"vx1","vx2","vbx","vex","vbx2","vex2","vcx","vcx2","vy1","vy2","vby","vey","vby2","vey2","vcy","vcy2"),E("y",[1,0,2],"vz1","vz2","sxy","syz","s3xi","s3zi",-1,"vy1","vy2","vby","vey","vby2","vey2","vcy","vcy2","vx1","vx2","vbx","vex","vbx2","vex2","vcx","vcx2"),E("z",[2,1,0],"vx1","vx2","syz","sxz","s3yi","s3xi",1,"vz1","vz2","vbz","vez","vbz2","vez2","vcz","vcz2","vy1","vy2","vby","vey","vby2","vey2","vcy","vcy2"),w.endLayer()]);try{var z=new Function("l","v","m",l);return z;}catch(c){alert("Failed to compile:\n"+c.message+"\n"+l);return 0;}},_line2D:{graph:{inherit:"shape",stroke:"#000000",weight:1,$:1}},line2D:function(u,w,c){if(!c.graph){return new Function("");}var l=c.graph.weight*8,z=apf.draw;var A=c.graph.fillout?"db":"ty";var s=z.optimize([z.vars(),"if(m){","return -1;","}",z.beginLayer(u),w.vars,w.stats,z.beginShape(c.graph),"var x1=",w.x1,",x2=",w.x2,",xs=",w.xs,",x = x1,xw=x2-x1,idx=xw/xs;",w.begin,"var xfirst = x,dx=-vx1*tw,dy=-vy1*th;",w.seek,w.ifdraw,"{",c.graph.fill?[z.moveTo(w.x+"*tw+tx",A),z.lineTo(w.x+"*tw+tx",w.y+"*th+ty"),].join(""):z.moveTo(w.x+"*tw+tx",w.y+"*th+ty"),"for(x+=idx;x<x2",w.forx,";x+=idx",w.incx,")",w.ifx,"{",z.lineTo(w.x+"*tw+tx",w.y+"*th+ty"),"}",c.graph.fill?["x-=idx;",z.lineTo(w.x+"*tw+tx",A)].join(""):"","}",z.endLayer()].join(""));try{return new Function("l","v","m",s);}catch(d){alert("Failed to compile:\n"+s);return 0;}},_line3D:{graph:{inherit:"shape",steps:50,zpos:0,depth:0.5,stroke:"black",fill:"red",opacity:0.3,$:1}},line3D:function(s,u,c){if(!c.graph){return new Function("");}var w=apf.draw,l=c.graph.weight*4;var t=w.optimize([w.vars(),"if(m){","return -1;","}",w.beginLayer(s),this.chartView3D(s,w),u.vars,u.stats,"var x1=",u.x1,",x2=",u.x2,",xs=",u.xs,",x=x1,xw=x2-x1,idx=xw/xs,","k = 0, xi, yi, xa, ya, xb, yb, xc, yc, xd, yd;",u.seek,w.beginShape(c.graph),u.ifdraw,"{",w.moveTo3D("xb="+u.x,"yb="+u.y,c.graph.zpos),"for(x+=idx,i=0;x<x2",u.forx,";x+=idx",u.incx,")",u.ifx,"{","xa = ",u.x,",ya=",u.y,";",w.lineTo3D("xa","ya",c.graph.zpos,"xi=","yi="),w.lineTo3D("xa","ya",c.graph.zpos+"+"+c.graph.depth,"xc=","yc="),"if(!i){i++;",w.lineTo3D("xb","yb",c.graph.zpos+"+"+c.graph.depth),"} else {",w.lineTo("xd","yd"),"}",w.close(),w.moveTo("xi","yi"),"xd=xc, yd=yc, xb = xa, yb = ya;","}","}",w.endLayer()]);try{return new Function("l","v","m",t);}catch(d){alert("Failed to compile:\n"+t);return 0;}},_bar3D:{graph:{inherit:"shape",stroke:"#000000",weight:1,fill:"red",$:1}},bar3D:function(s,u,l){if(!l.graph){return new Function("");}var w=apf.draw,c=apf.visualize;var t=w.optimize(["if(m){return -1;}",w.beginLayer(s),w.vars(),this.chartView3D(s,w),w.defCamVec(),u.vars,"var x1=",u.x1,",x2=",u.x2,",xs=",u.xs,",x,xw=x2-x1,idx=xw/xs,","wx = idx*tw,wy,cx1,cx2,cy1,cy2;",u.seek,w.beginState(l.graph,w,w.shapedRect,4),u.ifdraw,"{","for(x=x1;x<x2",u.forx,";x+=idx",u.incx,")",u.ifx,"{","cx1=",u.x,",cy1=",u.y,",cx2=cx1+idx,cy2=0;",w.poly3DClip([0,1,2,3],[["cx1","cy1",0],["cx2","cy1",0],["cx2","cy2",0],["cx1","cy2",0]],[0,1,2],-1),"};","}",w.endLayer()]);try{return new Function("l","v","m",t);}catch(d){alert(d.message+"\nFailed to compile:\n"+t);return 0;}},_height3D:{graph:{inherit:"shape",steps:50,zpos:0,depth:0.5,stroke:"black",fill:"red",opacity:0.3,$:1}},height3D:function(q,t,l){if(!l.graph){return new Function("");}var c=apf.draw;var s=c.optimize([c.vars(),"if(m){","return -1;","}",c.beginLayer(q),this.chartView3D(q,c),t.vars,t.stats,"var x1=",t.x1,",x2=",t.x2,",xs=",t.xs,",x=x1,xw=x2-x1,idx=xw/xs,","z1=",t.z1,",z2=",t.z2,",zs=",t.zs,",z=z1,zw=z2-z1,idz=zw/zs,","k = 0, xi, yi, xa, ya, xb, yb, xc, yc, xd, yd;",t.seek,c.beginShape(l.graph),t.ifdraw,"{",(l.graph.fill)?["var ar1=[], ar2=[];","for(x=x1,i=0;x<x2",t.forx,";x+=idx",t.incx,")",t.ifx,"{",c.store3D(t.x,t.y,t.z,"ar1[i++]=","ar1[i++]="),"};","for(z+=idz;z<z2",t.forz,";z+=idz",t.incz,")",t.ifz,"{","x=x1, i=0, j=0;",c.store3D(t.x,t.y,t.z,"ar2[i++]=","ar2[i++]="),"for(x+=idx;x<x2",t.forx,";x+=idx,j+=2",t.incx,")",t.ifx,"{",c.moveTo("ar1[j]","ar1[j+1]"),c.lineTo("ar1[j+2]","ar1[j+3]"),c.lineTo3D(t.x,t.y,t.z,"ar2[i++]=","ar2[i++]="),c.lineTo("ar2[j]","ar2[j+1]"),c.close(),"}","ar1=ar2,ar2=[];","}"].join(""):["for(;z<z2",t.forz,";z+=idz",t.incz,")",t.ifz,"{","x=x1;",c.moveTo3D(t.x,t.y,t.z),"for(x+=idx;x<x2",t.forx,";x+=idx",t.incx,")",t.ifx,"{",c.lineTo3D(t.x,t.y,t.z),"}","}",(l.graph.single>0)?"":["for(x=x1;x<x2",t.forx,";x+=idx",t.incx,")",t.ifx,"{","z=z1;",c.moveTo3D(t.x,t.y,t.z),"for(z+=idz;z<z2",t.forz,";z+=idz",t.incz,")",t.ifz,"{",c.lineTo3D(t.x,t.y,t.z),"}","}"].join(""),].join(""),"}",c.endLayer()]);try{return new Function("l","v","m",s);}catch(d){alert("Failed to compile:\n"+s);return 0;}},_bar2D:{graph:{inherit:"shape",shape:"rect",stroke:"#000000",weight:1,fill:"red",$:1}},bar2D:function(s,u,l){var w=apf.draw,c=apf.visualize;if(!l.graph){return new Function("");}var t=w.optimize([w.vars(),u.vars,"var x1=",u.x1,",x2=",u.x2,",xs=",u.xs,",x,xw=x2-x1,idx=xw/xs,","wx = idx*tw,wy;",u.seek,"\n\n/*------ bar2D Mousecode ------ */\n","if(m){",w.beginMouseState(l.graph,w,w.shapedRect,4),"for(x=x1;x<x2",u.forx,";x+=idx",u.incx,")",u.ifx,"{",w.checkMouseState(u.state,u.time,"("+u.x+")*tw+tx","wy=("+u.y+")*th+ty","wx","ty-wy"),"};","return -1;","}","\n\n/*------ bar2D Drawcode ------ */\n",w.beginLayer(s),w.beginState(l.graph,w,w.shapedRect,4),u.ifdraw,"{","for(x=x1;x<x2",u.forx,";x+=idx",u.incx,")",u.ifx,"{",w.drawState(u.state,u.time,"("+u.x+")*tw+tx","wy=("+u.y+")*th+ty","wx","ty-wy"),"};","}",w.endLayer()]);try{return new Function("l","v","m",t);}catch(d){alert(d.message+"\nFailed to compile:\n"+t);return 0;}},_shape2D:{graph:{inherit:"shape",stroke:"#000000",weight:1,left:-1.5,top:-1.5,height:3,width:4,fill:"red",$:1}},shape2D:function(s,u,l){if(!l.graph){return new Function("");}var w=apf.draw,c=apf.visualize;var t=w.optimize(["if(m){return -1;}",w.beginLayer(s),w.vars(),u.vars,"var x1=",u.x1,",x2=",u.x2,",xs=",u.xs,",x,xw=x2-x1,idx=xw/xs,","wx = idx*tw,wy;","tx += ",l.graph.left*s.ds,";","ty += ",l.graph.top*s.ds,";",u.seek,w.beginState(l.graph,w,w.draw2D,4),u.ifdraw,"{","for(x=x1;x<x2",u.forx,";x+=idx",u.incx,")",u.ifx,"{",w.drawState(u.state,u.time,"("+u.x+")*tw+tx","wy=("+u.y+")*th+ty",l.graph.width*s.ds,l.graph.height*s.ds),"};","}",w.endLayer()]);try{return new Function("l","v","m",t);}catch(d){alert(d.message+"\nFailed to compile:\n"+t);return 0;}},_pie2D:{margin:{left:0,top:0,width:1,height:1,$:1},graph:{inherit:"shape",stroke:"#000000",weight:1,fill:"red",$:1}},pie2D:function(s,u,l){if(!l.graph){return new Function("");}var w=apf.draw,c=apf.visualize;var t=w.optimize(["/*------ pie2D Init ------*/\n",w.vars(),u.vars,u.stats,"var x1=",u.vx1,",x2=",u.vx2,",xw=x2-x1,","idx=1,sum=1/(",u.sum,"),rx=0,","xp=(",l.margin.left,")*tw+tx,","yp=(",l.margin.top,")*th+ty,","wp=(",l.margin.width,")*tw,","hp=(",l.margin.height,")*th,","wq=0.5*wp, hq = 0.5*hp,","xc=xp+wq, yc=yp+hq, piesize;",u.seek,"\n\n/*------ pie2D Mousecode ------ */\n","if(m){",w.beginMouseState(l.graph,w,w.shapedPart,6,["piesize"]),"for(rx=0,x=x1;x<x2",u.forx,";x+=idx",u.incx,")",u.ifx,"{",w.checkMouseState(u.state,u.time,"xc","yc","wq","hq","rx","-rx+(rx+=("+u.y+")*sum)"),"};","return -1;","}","\n\n/*------ pie2D Drawcode ------ */\n",w.beginLayer(s),w.beginState(l.graph,w,w.shapedPart,6,["piesize"]),"for(rx=0,x=x1;x<x2",u.forx,";x+=idx",u.incx,")",u.ifx,"{","piesize = ("+u.y+")*sum;",w.drawState(u.state,u.time,"xc","yc","wq","hq","rx","-rx+(rx+=piesize)"),"};","\n\n/*------ pie2D End ------ */\n",w.endLayer()]);try{return new Function("l","v","m",t);}catch(d){alert(d.message+"\nFailed to compile:\n"+t);return 0;}},dt_math1X:function(c){return{type:"math1X",vars:"var _stp= l.step&&(vx2-vx1)/l.step<l.steps?l.step:(vx2-vx1)/l.steps;",vx1:0,vx2:1,vy1:0,vy2:1,vz1:0,vz2:1,x1:"__floor(vx1/_stp)*_stp",x2:"__ceil(vx2/_stp+1)*_stp",xs:"(x2-x1)/_stp",stats:"",seek:"",forx:"",ifx:"",incx:"",ifdraw:"",x:"x",y:"("+apf.draw.getXYWH(c.pformula,"x")+")"};},dt_math2X:function(c){return{type:"math2X",vars:"var _stp= l.step&&(vx2-vx1)/l.step<l.steps?l.step:(vx2-vx1)/l.steps;",vx1:-1,vx2:1,vy1:-1,vy2:1,vz1:0,vz2:1,x1:"__floor(vx1/_stp)*_stp",x2:"__ceil(vx2/_stp+1)*_stp",xs:"(x2-x1)/_stp",stats:"",seek:"",forx:"",ifx:"",incx:"",ifdraw:"",x:"("+apf.draw.getXYWH(c.pformula,"x")+")",y:"("+apf.draw.getXYWH(c.pformula,"y")+")"};},dt_math1XZ:function(c){return{type:"math1XY",vars:"var _stpx= l.step&&(vx2-vx1)/l.step<l.steps?l.step:(vx2-vx1)/l.steps,_stpz=l.step&&(vz2-vz1)/l.step<l.steps?l.step:(vz2-vz1)/l.steps;",vx1:-1,vx2:1,vy1:-1,vy2:1,vz1:0,vz2:1,x1:"vx1",x2:"vx2",xs:"(x2-x1)/_stpx",z1:"vz1",z2:"vz2",zs:"(z2-z1)/_stpz",stats:"",seek:"",forx:"",ifx:"",incx:"",ifdraw:"",forz:"",ifz:"",incz:"",ifdraw:"",x:"x",z:"z",y:"("+apf.draw.getXYWH(c.pformula,"x")+")"};},dt_math1R:function(d){var i=d.formula.split(";");return{type:"math1R",vx1:-1,vx2:1,vy1:-1,vy2:1,vz1:0,vz2:1,x1:0,x2:"Math.PI*2+(Math.PI*2/(l.style.steps-1))",xs:"l.style.steps",x:"__sin(_p="+apf.visualize.mathParse(i[0])+")*(_r="+apf.visualize.mathParse(i[1])+")",y:"__cos(_p)*_r"};},dt_series1XM:function(c){return{type:"series1XM",vars:"var _mf = __min(__ceil(vx2)+1,l.v_yvalmip[0].length)-__max(__floor(vx1),0);var _ms = l.mipstep, _mt = 1;while(_mf>l.mipthres && _mt<l.v_yvalmip.length){_mf = _mf / _ms;_mt++;}var _div = __pow(_ms,_mt-1);var _off = _mt>1?__pow(_ms,_mt-2):0;var _yv = l.v_yvalmip[_mt-1],_i;",vx1:0,vx2:"_yv.length",vy1:-1,vy2:1,vz1:0,vz2:1,state:"0",time:"0",sum:"l.v_sum",min:"l.v_min",max:"l.v_max",avg:"l.v_avg",seek:"",stats:"",ifdraw:"if((!l.mipmin || _mt>l.mipmin) && (!l.mipmax || _mt<l.mipmax))",forx:"",ifx:"",incx:"",x1:"__max(__floor(vx1/_div-1),0)",x2:"__min((__ceil(vx2/_div)+1),_yv.length)",xs:"x2-x1",x:"(x*_div+_off)",y:"_yv[x]"};},dt_series1X:function(c){return{type:"series1X",vars:"var _yv = l.v_yval,_sv = l.v_state, _tv = l.v_time,_i,_mi,_ma;",vx1:0,vx2:"_yv.length",vy1:-1,vy2:1,vz1:0,vz2:1,state:"_sv[x]",time:"_tv[x]",sum:"l.v_sum",min:"l.v_min",max:"l.v_max",avg:"l.v_avg",forx:"",ifx:"",incx:"",stats:"if(!l.v_sum){for(i=_yv.length-1,j=0,_mi=10000000,_ma=-10000000;i>=0;--i)j+=((m=_yv[i])<_mi?_mi=m:m)>_ma?_ma=m:m;l.v_avg=(l.v_sum=j)/_yv.length;l.v_min=_mi;l.v_max=_ma;}",x1:"__max(__floor(vx1),0)",x2:"__min(__ceil(vx2)+1,_yv.length)",x1c:"__max(__floor(vx1),0)",x2c:"__min(__ceil(vx2)+1,_yv.length)",xs:"x2-x1",x:"x",y:"_yv[x]"};},dt_series2X:function(i){var d=i.yvalue.length;return{type:"series2X",vx1:0,vx2:d,vy1:-1,vy2:1,vz1:0,vz2:1,vars:"var _vx = l.xvalue, _vy = l.yvalue, _len = _vy.length;",x1:0,x2:"_len",xs:"_len",x:"_vx[x]",y:"_vy[x]"};},$:0};apf.chart_draw.height2D=apf.chart_draw.line2D;apf.chart_draw._height2D=apf.chart_draw._line2D;apf.DOMParser=function(){};apf.DOMParser.prototype=new (function(){this.caseInsensitive=true;this.preserveWhiteSpace=true;this.$shouldWait=0;var n=[/\<\!(DOCTYPE|doctype)[^>]*>/,/&nbsp;/g,/<\s*\/?\s*(?:\w+:\s*)[\w-]*[\s>\/]/g],q="//@*[not(contains(local-name(), '.')) and not(translate(local-name(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = local-name())]",m="DOMNodeInsertedIntoDocument",o="@default",l="id";this.parseFromString=function(i,c,A){var j;if(this.caseInsensitive){var d=i.replace(n[0],"").replace(n[1]," ").replace(n[2],function(s){return s.toLowerCase();});if(!this.supportNamespaces){d=d.replace(/xmlns\=\"[^"]*\"/g,"");}j=apf.getXmlDom(d,null,this.preserveWhiteSpace||apf.debug).documentElement;var z,a,B=j.selectNodes(q);for(z=0,a=B.length;z<a;z++){(B[z].ownerElement||B[z].selectSingleNode("..")).setAttribute(B[z].nodeName.toLowerCase(),B[z].nodeValue);}}else{j=apf.getXmlDom(i,null,this.preserveWhiteSpace||apf.debug).documentElement;}return this.parseFromXml(j,A);};this.parseFromXml=function(i,P){var F,d;if(!P){P={};}if(!P.delayedRender){if(P.doc){F=P.doc;d=P.docFrag||F.createDocumentFragment();}else{F=new apf.AmlDocument();F.$aml=i;F.$domParser=this;}var j=this.$createNode(F,i.nodeType,i);(d||F).appendChild(j);if(P.htmlNode){j.$int=P.htmlNode;}}else{var j=P.amlNode;var F=P.doc;}this.$parseContext=[j,P];var I,a={},J=[],K=this;(function M(A,D){var z,s,B,t,C=A.childNodes,u=0,w=D.length;for(;u<w;u++){s=K.$createNode(F,(B=D[u]).nodeType,B);if(!s){continue;}C[z=C.length]=s;s.parentNode=A;if(z>0){(s.previousSibling=C[z-1]).nextSibling=s;}if(!s.render&&s.canHaveChildren&&(t=B.childNodes).length){M(s,t);}if(s.$parsePrio){if(s.$parsePrio=="001"){s.dispatchEvent(m);continue;}(a[s.$parsePrio]||(J.push(s.$parsePrio)&&(a[s.$parsePrio]=[]))).push(s);}}A.firstChild=C[0];A.lastChild=C[w-1];})(j,i.childNodes);if(P.delay){j.$parseOptions={prios:J,nodelist:a};return(d||F);}J.sort();var N,O,c,G;for(N=0,c=J.length;N<c;N++){I=a[J[N]];for(O=0,G=I.length;O<G;O++){I[O].dispatchEvent(m);}}if(this.$shouldWait){return(d||F);}if(P.timeout){$setTimeout(function(){K.$continueParsing(j,P);});}else{this.$continueParsing(j,P);}return(d||F);};this.$callCount=0;this.$continueParsing=function(i,d){if(this.$shouldWait&&--this.$shouldWait!=0){return;}if(!d){d={};}this.$callCount++;if(i.$parseOptions){var D=i.$parseOptions.prios,B=i.$parseOptions.nodelist,E,F,a,c,j;delete i.$parseOptions;D.sort();for(E=0,a=D.length;E<a;E++){nodes=B[D[E]];for(F=0,c=nodes.length;F<c;F++){if(!(j=nodes[F]).parentNode||j.$amlLoaded){continue;}nodes[F].dispatchEvent(m);}}}if(!d.ignoreSelf&&!i.$amlLoaded){i.dispatchEvent(m);}(function C(w){var t,s;for(var u=0,z=w.length;u<z;u++){if(!(t=w[u]).$parsePrio&&!t.$amlLoaded){t.dispatchEvent(m);}if(!t.render&&(s=t.childNodes).length){C(s);}}})(i.childNodes);if(!this.$callCount&&!d.delay){apf.queue.empty();}if(d.callback){d.callback.call(i.ownerDocument);}delete this.$parseContext;};this.$createNode=function(P,M,N,W,R,c){var d;switch(M){case 1:var K,i;if(N){if((W=N.namespaceURI||apf.ns.xhtml)&&!(i=P.$prefixes[W])){P.$prefixes[i=N.prefix||N.scopeName||""]=W;P.$namespaceURIs[W]=i;if(!P.namespaceURI&&!i){P.namespaceURI=W;P.prefix=i;}}R=N.baseName||N.localName||N.tagName.split(":").pop();}else{i=P.$prefixes[W]||"";}var O=apf.namespaces[W].elements;d=new (O[R]||O[o])(null,R);d.prefix=i||"";d.namespaceURI=W;d.tagName=i?i+":"+R:R;if(N){if(K=N.getAttribute(l)){d.$propHandlers[l].call(d,d.id=K);}var V=N.attributes,U;for(var T,j=0,Q=V.length;j<Q;j++){d.attributes.push(new apf.AmlAttr(d,(U=(T=V[j]).nodeName),T.nodeValue));if(U=="render"){d.render=true;}}}break;case 2:d=new apf.AmlAttr();d.name=d.nodeName=R;if(c||(c=N&&N.nodeValue)){d.value=d.nodeValue=c;}if(N){if(N.namespaceURI&&!(d.prefix=P.$namespaceURIs[d.namespaceURI=N.namespaceURI])){P.$prefixes[d.prefix=N.prefix||N.scopeName]=d.namespaceURI;}}else{d.prefix=P.$prefixes[W];}break;case 3:if(N){c=N&&N.nodeValue;}if(!this.preserveWhitespace&&!(c||"").trim()){return;}d=new apf.AmlText();d.nodeValue=c||N&&N.nodeValue;break;case 7:var a=R||N&&N.nodeName;d=new apf.aml.processingInstructions[a]();d.target=d.nodeName=a;d.data=d.nodeValue=c||N&&N.nodeValue;break;case 4:d=new apf.AmlCDATASection();d.nodeValue=c||N&&N.nodeValue;break;case 5:d=new apf.AmlNode();d.nodeType=M;break;case 6:d=new apf.AmlNode();d.nodeType=M;break;case 8:d=new apf.AmlComment();d.nodeValue=c||N&&N.nodeValue;break;case 9:d=new apf.AmlDocument();d.$domParser=this;break;case 10:d=new apf.AmlNode();d.nodeType=M;break;case 11:d=new apf.AmlDocumentFragment();break;}d.$aml=N;d.ownerDocument=P;return d;};})();apf.AmlNamespace=function(){this.elements={};this.processingInstructions={};};apf.AmlNamespace.prototype={setElement:function(d,i){return this.elements[d]=i;},setProcessingInstruction:function(i,d){this.processingInstructions[i]=d;}};apf.aml=new apf.AmlNamespace();apf.setNamespace("http://ajax.org/2005/aml",apf.aml);apf.__AMLNODE__=1<<14;apf.AmlNode=function(){this.$init(function(){this.childNodes=[];});};(function(){this.$regbase=this.$regbase|apf.__AMLNODE__;this.NODE_ELEMENT=1;this.NODE_ATTRIBUTE=2;this.NODE_TEXT=3;this.NODE_CDATA_SECTION=4;this.NODE_ENTITY_REFERENCE=5;this.NODE_ENTITY=6;this.NODE_PROCESSING_INSTRUCTION=7;this.NODE_COMMENT=8;this.NODE_DOCUMENT=9;this.NODE_DOCUMENT_TYPE=10;this.NODE_DOCUMENT_FRAGMENT=11;this.NODE_NOTATION=12;this.ownerDocument=null;this.nodeValue="";this.namespaceURI="";this.appendChild=this.insertBefore=function(C,K,D){if(this.nodeType==this.NODE_DOCUMENT){if(this.childNodes.length){throw new Error(apf.formatErrorString(0,this,"Insertbefore DOM operation","Only one top level element is allowed in an AML document."));}else{this.documentElement=C;}}if(C.nodeType==this.NODE_DOCUMENT_FRAGMENT){var G=C.childNodes.slice(0);for(var A=0,B=G.length;A<B;A++){this.insertBefore(G[A],K);}return C;}var F=C.parentNode==this,i=C.$pHtmlNode,I=C.parentNode,l=-1,M=this;if(K){l=this.childNodes.indexOf(K);if(l<0){return false;}}if(!C.ownerDocument){C.ownerDocument=this.ownerDocument||apf.ownerDocument;}if(C.parentNode){C.removeNode(F,D);}C.parentNode=this;if(K){C.nextSibling=K;C.previousSibling=K.previousSibling;K.previousSibling=C;if(C.previousSibling){C.previousSibling.nextSibling=C;}}if(l>=0){this.childNodes=this.childNodes.slice(0,l).concat(C,this.childNodes.slice(l));}else{l=this.childNodes.push(C)-1;C.nextSibling=null;if(l>0){C.previousSibling=this.childNodes[l-1];C.previousSibling.nextSibling=C;}else{C.previousSibling=null;}}this.firstChild=this.childNodes[0];this.lastChild=this.childNodes[this.childNodes.length-1];function E(){C.$pHtmlNode=M.canHaveChildren?M.$int:document.body;C.dispatchEvent("DOMNodeInserted",{$beforeNode:K,relatedNode:M,$isMoveWithinParent:F,$oldParentHtmlNode:i,$oldParent:I,bubbles:true});var c;var a=(C.$ext&&C.$ext.nodeType==1&&(c=C.$ext.getElementsByTagName("iframe")).length>0&&apf.findHost(c[0].parentNode)==C);if(!D&&C.$ext&&!a){C.$pHtmlNode.insertBefore(C.$ext,K&&K.$ext||null);}}var J=this.nodeType==this.NODE_DOCUMENT?this:this.ownerDocument;if(!J||J.$domParser.$shouldWait){return C;}if(this.nodeType==this.NODE_DOCUMENT_FRAGMENT){return;}if(!C.$amlLoaded){(this.ownerDocument||this).$domParser.$continueParsing(C,{delay:true});}E();return C;};this.removeNode=function(i,d){if(!this.parentNode||!this.parentNode.childNodes){return this;}this.parentNode.childNodes.remove(this);if(this.$amlLoaded&&!apf.isDestroying){if(!d&&this.$ext&&this.$ext.parentNode){this.$ext.parentNode.removeChild(this.$ext);}this.dispatchEvent("DOMNodeRemoved",{relatedNode:this.parentNode,bubbles:true,$doOnlyAdmin:i});}if(this.parentNode.firstChild==this){this.parentNode.firstChild=this.nextSibling;}if(this.parentNode.lastChild==this){this.parentNode.lastChild=this.previousSibling;}if(this.nextSibling){this.nextSibling.previousSibling=this.previousSibling;}if(this.previousSibling){this.previousSibling.nextSibling=this.nextSibling;}this.$pHtmlNode=this.parentNode=this.previousSibling=this.nextSibling=null;return this;};this.removeChild=function(c){c.removeNode();return this;};this.replaceChild=function(){};this.cloneNode=function(c){if(c&&this.nodeType==1){return this.ownerDocument.$domParser.parseFromXml(this,{doc:this.ownerDocument,delay:true}).childNodes[0];}else{return this.ownerDocument.$domParser.$createNode(this.ownerDocument,this.nodeType,this);}};this.canDispatch=function(d,i){};this.compareDocumentPosition=function(c){};this.hasAttributes=function(){return this.attributes&&this.attributes.length;};this.hasChildNodes=function(){return this.childNodes&&this.childNodes.length;};this.isDefaultNamespace=function(d){if(i.nodeType==1){if(!this.prefix){return this.namespaceURI==d;}}var i=this.parentNode||this.ownerElement;return i&&i.isDefaultNamespace(d);};this.lookupNamespaceURI=function(i){if(d.nodeType==1){if(this.namespaceURI&&i==this.prefix){return this.namespaceURI;}}var d=this.parentNode||this.ownerElement;return d&&d.lookupNamespaceURI(i);};this.lookupPrefix=function(d){if(this.nodeType==1){if(d==this.namespaceURI&&this.prefix){return this.prefix;}}var i=this.parentNode||this.ownerElement;return i&&i.lookupPrefix(d);};this.normalize=function(){};this.selectNodes=function(i,d){if(!apf.XPath){apf.runXpath();}return apf.XPath.selectNodes(i,d||(this.nodeType==9?this.documentElement:this));};this.selectSingleNode=function(i,d){if(!apf.XPath){apf.runXpath();}return apf.XPath.selectNodes(i,d||(this.nodeType==9?this.documentElement:this))[0];};}).call(apf.AmlNode.prototype=new apf.Class());apf.AmlElement=function(j,i){var l=this.$init;this.$init=function(d,q,t){this.$supportedProperties=this.$supportedProperties.slice();var s,a,c;a=this.$propHandlers;c=this.$propHandlers={};for(s in a){c[s]=a[s];}a=this.$booleanProperties;c=this.$booleanProperties={};for(s in a){c[s]=a[s];}l.call(this,d,q,t);};this.$init(function(w,A,u){this.$events={};this.$inheritProperties={};this.attributes=new apf.AmlNamedNodeMap(this);this.nodeFunc=A;this.localName=w;if(u){var a,d,z,c;if(u.childNodes){a=u.childNodes;delete u.childNodes;}for(d in u){if(d=="htmlNode"){continue;}this.attributes.push(new apf.AmlAttr(this,d,u[d]));}if(!this.ownerDocument){this.ownerDocument=apf.document;this.prefix="";this.namespaceURI=null;this.tagName=w;}if(a){this.childNodes=a;for(z=0,c=a.length;z<c;z++){a[z].nextSibling=a[z+1]||null;a[z].previousSibling=a[z-1]||null;a[z].parentNode=this;}this.firstChild=a[0]||null;this.lastChild=a[a.length-1]||null;}this.$aml=apf.$emptyNode||(apf.$emptyNode=apf.getXml("<empty />"));}});if(i){l.call(this,i,apf.NODE_HIDDEN,j);}};(function(){this.nodeType=this.NODE_ELEMENT;this.canHaveChildren=true;this.$propHandlers={id:function(i){if(this.name==i){return;}if(self[this.name]==this){self[this.name]=null;}if(!self[i]||!self[i].hasFeature){try{self[i]=this;}catch(d){}}apf.nameserver.register(this.localName,i,this);this.name=i;}};this.$booleanProperties={};this.$inheritProperties={};this.$supportedProperties=[];this.getElementsByTagName=function(i,t){i=i.toLowerCase();var w,q,u,s=this.childNodes,l=[];for(q=0,u=s.length;q<u;q++){if((w=s[q]).nodeType!=1){continue;}if(w.tagName==i||i=="*"){l.push(w);}if(!t&&w.nodeType==1){l=l.concat(w.getElementsByTagName(i));}}return l;};this.getElementsByTagNameNS=function(i,s,t){s=s.toLowerCase();var w,A,z,u=this.childNodes,l=[];for(A=0,z=u.length;A<z;A++){if((w=u[A]).nodeType!=1){continue;}if(w.namespaceURI==i&&(w.localName==s||s=="*")){l.push(w);}if(!t&&w.nodeType==1){l=l.concat(w.getElementsByTagNameNS(i,s));}}return l;};this.setAttribute=function(m,a,l){m=m.toLowerCase();var n=this.attributes.getNamedItem(m);if(!n){this.attributes.push(n=new apf.AmlAttr(this,m,a));if(!this.$amlLoaded){return;}if(l){n.$setValue(a);}else{n.dispatchEvent("DOMNodeInsertedIntoDocument",{relatedNode:this});n.dispatchEvent("DOMNodeInserted",{relatedNode:this,bubbles:true});}return;}n.$setValue(a);if(l||!this.$amlLoaded){return;}n.$triggerUpdate();};this.setAttributeNode=function(c){this.attributes.setNamedItem(c);};this.setAttributeNS=function(l,i,j){return this.setAttribute(i,j);};this.hasAttribute=function(c){return this.getAttributeNode(c)?true:false;};this.hasAttributeNS=function(i,d){return this.hasAttribute(d);};this.removeAttribute=function(c){this.attributes.removeNamedItem(c);return this;};this.removeAttributeNS=function(i,d){return this.removeAttribute(d);};this.removeAttributeNode=function(c){this.attributes.removeNamedItem(c.name);};this.getAttribute=function(l,i){var j=this.attributes.getNamedItem(l);return j?(i?j.inheritedValue||j.nodeValue:j.nodeValue):null;};this.getAttributeNode=function(c){return this.attributes.getNamedItem(c);};this.getBoundingClientRect=function(){return new apf.AmlTextRectangle(this);};this.querySelector=function(){};this.querySelectorAll=function(){};this.scrollIntoView=function(){};this.replaceMarkup=function(i,n){if(!n){n={};}if(!n.$intAML){n.$intAML=this.$aml;}if(!n.$int){n.$int=this.$int;}n.clear=true;for(var m=this.childNodes.length-1;m>=0;m--){var l=this.childNodes[m];if(l.destroy){l.destroy(true);}if(l.$ext!=this.$int){apf.destroyHtmlNode(l.$ext);}}this.childNodes.length=0;this.$int.innerHTML="<div class='loading'>loading...</div>";this.insertMarkup(i,n);};this.insertMarkup=function(l,j){if(typeof apf.offline!="undefined"&&!apf.offline.onLine){return false;}var i=new apf.XiInclude();i.setAttribute("href",l);if(j&&j.clear){i.setAttribute("clear",true);}i.options=j;i.callback=j&&j.callback;this.appendChild(i);};this.serialize=function(l){if(l||!this.firstChild){return"<"+(this.prefix?this.prefix+":"+this.localName+" xmlns:"+this.prefix+'="'+this.namespaceURI+'"':this.localName)+(this.attributes.length?" ":"")+this.attributes.join(" ")+"/>";}else{var j=["<"+(this.prefix?this.prefix+":"+this.localName+" xmlns:"+this.prefix+'="'+this.namespaceURI+'"':this.localName)+(this.attributes.length?" ":"")+this.attributes.join(" ")+">"];for(var i=this.firstChild;i;i=i.nextSibling){j.push(i.serialize());}return j.join("")+"</"+(this.prefix?this.prefix+":"+this.localName:this.localName)+">";}};this.$setInheritedAttribute=function(j){var l,i=this;l=i.getAttribute(j);if(!l){i=i.parentNode;while(i&&i.nodeType==1&&!(l=i.getAttribute(j,true))){i=i.parentNode;}}if(!l&&apf.config&&j){l=apf.config[j];}if(l){this.$clearDynamicProperty(j);if(typeof l=="string"&&(l.indexOf("{")>-1||l.indexOf("[")>-1)){this.$setDynamicProperty(j,l);this.$inheritProperties[j]=2;}else{this.setProperty(j,l,false,false,2);}}return l;};this.$handlePropSet=function(l,m,n){if(m&&this.$booleanProperties[l]){m=apf.isTrue(m);}this[l]=m;var j;return(j=this.$propHandlers&&this.$propHandlers[l]||this.nodeFunc==apf.NODE_VISIBLE&&apf.GuiElement&&apf.GuiElement.propHandlers[l]||null)&&j.call(this,m,l,n);};this.addEventListener("DOMNodeInsertedIntoDocument",function(G){var C,a,B,F=this.attributes;if(typeof apf.offline!="undefined"&&apf.offline.state.enabled){var i=apf.offline.state.getAll(this);for(a in i){C=F.getNamedItem(a);if(C){C.$setValue(i[a]);}else{this.attributes.push(new apf.AmlAttr(this,a,i[a]));}}}var j=apf.nameserver.getAll("defaults_"+this.localName);if(j.length){for(var l=0,d=j.length;l<d;l++){var D=j[l].attributes,E;for(a=0,B=D.length;a<B;a++){C=F.getNamedItem((E=D[a]).nodeName);if(C){if(C.value){continue;}C.$setValue(E.nodeValue);this.$inheritProperties[E.nodeName]=2;}else{this.attributes.push(new apf.AmlAttr(this,E.nodeName,E.nodeValue));this.$inheritProperties[E.nodeName]=2;}}}}for(a=0,B=F.length;a<B;a++){F[a].dispatchEvent("DOMNodeInsertedIntoDocument");}this.$amlLoaded=true;},true);}).call(apf.AmlElement.prototype=new apf.AmlNode());apf.AmlCharacterData=function(){this.data="";this.length=0;this.$init(true);this.appendData=function(c){this.dispatchEvent("DOMCharacterDataModified",{value:c});};this.deleteData=function(i,d){this.dispatchEvent("DOMCharacterDataModified",{offset:i,count:d});};this.insertData=function(i,d){this.dispatchEvent("DOMCharacterDataModified",{offset:i,count:d});};this.replaceData=function(j,i,l){this.dispatchEvent("DOMCharacterDataModified",{offset:j,count:i,value:l});};this.substringData=function(i,d){};};apf.AmlCharacterData.prototype=new apf.AmlNode();apf.AmlText=function(c){this.$init(c);};(function(){this.nodeType=this.NODE_TEXT;this.nodeName="#text";this.serialize=function(){return apf.xmlentities(this.nodeValue).replace(/</g,"&lt;").replace(/>/g,"&gt;");};this.$handlePropSet=function(j,l,i){this[j]=l;if(j=="data"){this.$clearDynamicProperty("calcdata");this.$setDynamicProperty(j,l);}else{if(this.$propHandlers[j]){this.$propHandlers[j].call(this,l,j);}}};this.$attrExcludePropBind={data:0};this.getAttribute=function(){};this.mainBind="data";this.$setValue=function(c){this.dispatchEvent("DOMCharacterDataModified",{bubbles:true,prevValue:this.nodeValue,newValue:this.nodeValue=c});if(this.$amlLoaded){this.$ext.nodeValue=c;}};this.addEventListener("DOMNodeInsertedIntoDocument",function(l){var j;if(!(j=this.parentNode.$int)){return;}this.$amlLoaded=true;var i=this.nodeValue;if(apf.config.liveText&&!this.parentNode.hasFeature(apf.__CHILDVALUE__)&&(i.indexOf("{")>-1||i.indexOf("[")>-1)){this.$supportedProperties=[];this.$propHandlers={};this.$booleanProperties={};this.$inheritProperties={};this.$propHandlers.calcdata=apf.LiveMarkupPi.prototype.$propHandlers.calcdata;this.$setInheritedAttribute=apf.AmlElement.prototype.$setInheritedAttribute;this.implement(apf.StandardBinding);j.appendChild(this.$ext=this.$int=document.createElement("span"));this.$setDynamicProperty("calcdata",this.nodeValue);return;}if(apf.hasTextNodeWhiteSpaceBug){var i=i.replace(/[\t\n\r ]+/g," ");if(i&&i!=" "){this.$ext=j.appendChild(j.ownerDocument.createTextNode(i));}}else{this.$ext=j.appendChild(j.ownerDocument.createTextNode(i));}},true);}).call(apf.AmlText.prototype=new apf.AmlCharacterData());apf.AmlTextRectangle=function(j){var i=this;function l(){var a=i.getAbsolutePosition(i.$ext);i.setProperty("left",a[0]);i.setProperty("top",a[1]);i.setProperty("right",document.documentElement.offsetWidth-a[0]);i.setProperty("bottom",document.documentElement.offsetWidth-a[1]);}j.addEventListener("prop.width",l);j.addEventListener("prop.height",l);j.addEventListener("prop.left",l);j.addEventListener("prop.top",l);l.call(j);};apf.AmlTextRectangle.prototype=new apf.Class();apf.AmlProcessingInstruction=function(c){this.$init(c);this.$supportedProperties=[];this.$propHandlers={};this.$booleanProperties={};this.$inheritProperties={};};(function(){this.nodeType=this.NODE_PROCESSING_INSTRUCTION;this.data=null;this.target=null;this.serialize=function(){return"<?"+this.target+"\n"+apf.xmlentities(this.nodeValue)+"\n?>";};this.$attrExcludePropBind=apf.extend({calcdata:0},this.$attrExcludePropBind);this.getAttribute=function(){};this.$setInheritedAttribute=apf.AmlElement.prototype.$setInheritedAttribute;this.$handlePropSet=function(j,l,i){this[j]=l;if(j=="data"){this.$clearDynamicProperty("calcdata");this.$setDynamicProperty("calcdata",l);}else{if(j=="target"){}else{if(this.$propHandlers[j]){this.$propHandlers[j].call(this,l,j);}}}};this.addEventListener("DOMNodeInsertedIntoDocument",function(d){var i;if(this.parentNode.$bindingRule||!(i=this.parentNode.$int)){return;}i.appendChild(this.$ext=this.$int=document.createElement("span"));this.$ext.host=this;this.$setDynamicProperty("calcdata",this.data);},true);this.addEventListener("DOMNodeRemovedFromDocument",function(c){this.$clearDynamicProperty("calcdata");});}).call(apf.AmlProcessingInstruction.prototype=new apf.AmlNode());apf.AmlDocument=function(){this.$prefixes={};this.$namespaceURIs={};this.domConfig=new apf.AmlConfiguration();this.$init();};(function(){this.nodeType=this.NODE_DOCUMENT;this.nodeFunc=apf.NODE_HIDDEN;this.nodeName="#document";this.$amlLoaded=true;this.activeElement=null;this.doctype=null;this.domConfig=null;this.implementation=null;this.characterSet=apf.characterSet;this.documentElement=null;this.getElementById=function(c){return self[c];};this.getElementsByTagName=function(l){var j,i=(j=this.documentElement).getElementsByTagName(l);if(j.tagName==l){i.push(j);}return i;};this.getElementsByTagNameNS=function(m,n){var l,j=(l=this.documentElement).getElementsByTagNameNS(m,n);if(l.tagName==n&&l.namespaceURI==m){j.push(l);}return j;};this.createElement=function(c){return this.$domParser.$createNode(this,this.NODE_ELEMENT,null,this.namespaceURI,c);};this.createElementNS=function(d,i){return this.$domParser.$createNode(this,this.NODE_ELEMENT,null,d,i);};this.importNode=function(i,d){if(d&&i.nodeType==1){return this.$domParser.parseFromXml(i,{doc:this,delay:true}).childNodes[0];}else{return this.$domParser.$createNode(this,i.nodeType,i);}};this.createAttribute=function(c){return this.$domParser.$createNode(this,this.NODE_ATTRIBUTE,null,this.nameSpaceURI,c);};this.createAttributeNS=function(d,i){return this.$domParser.$createNode(this,this.NODE_ATTRIBUTE,null,d,i);};this.createEvent=function(){return new apf.AmlEvent();};this.createComment=function(c){return this.$domParser.$createNode(this,this.NODE_COMMENT,null,null,null,c);};this.createProcessingInstruction=function(c){return this.$domParser.$createNode(this,this.NODE_PROCESSING_INSTRUCTION,null,null,null,c);};this.createCDATASection=function(c){return this.$domParser.$createNode(this,this.NODE_CDATA_SECTION,null,null,null,c);};this.createTextNode=function(c){return this.$domParser.$createNode(this,this.NODE_TEXT,null,null,null,c);};this.createDocumentFragment=function(){return this.$domParser.$createNode(this,this.NODE_DOCUMENT_FRAGMENT);};this.querySelector=function(){};this.querySelectorAll=function(){};this.evaluate=function(o,q,s,n,t){var m=apf.XPath.selectNodes(o,q||this.documentElement);return{snapshotLength:m.length,snapshotItem:function(a){return m[a];}};};this.createNSResolver=function(c){return{};};this.queryCommandState=function(c){if(!apf.document.activeElement||!apf.document.activeElement.$queryCommandState){return;}apf.document.activeElement.$queryCommandState(c);};this.queryCommandValue=function(c){if(!apf.document.activeElement||!apf.document.activeElement.$queryCommandValue){return;}apf.document.activeElement.$queryCommandValue(c);};this.execCommand=function(l,i,j){if(!apf.document.activeElement||!apf.document.activeElement.$execCommand){return;}apf.document.activeElement.$execCommand(l,j);};}).call(apf.AmlDocument.prototype=new apf.AmlNode());apf.AmlComment=function(c){this.nodeType=this.NODE_COMMENT;this.nodeName="#comment";this.$init(c);};(function(){this.serialize=function(){return"<!--"+this.nodeValue+"-->";};this.$setValue=function(c){this.dispatchEvent("DOMCharacterDataModified",{bubbles:true,newValue:c,prevValue:this.nodeValue});};}).call(apf.AmlComment.prototype=new apf.AmlCharacterData());apf.AmlNamedNodeMap=function(c){this.$host=c;};(function(){this.getNamedItem=function(d){for(var i=0;i<this.length;i++){if(this[i].name==d){return this[i];}}return false;};this.setNamedItem=function(l){var i=l.name;for(var m,n=this.length-1;n>=0;n--){if(this[n].name==i){this[n].ownerElement=null;this.splice(n,1);break;}}this.push(l);l.ownerElement=this.$host;l.$triggerUpdate();};this.removeNamedItem=function(i){for(var j,l=this.length-1;l>=0;l--){if(this[l].name==i){j=this[l];this.splice(l,1);break;}}if(!j){return false;}j.ownerElement.setProperty(i,"");j.ownerElement=null;return j;};this.item=function(c){return this[c];};this.length=0;this.splice=function(l,m){for(var n=l,i=this.length-m;n<i;n++){this[n]=this[n+1];}delete this[n];this.length-=m;};this.push=function(c){this[this.length++]=c;return this.length;};this.join=function(t){var s=[];for(var q,i,a=0,l=this.length;a<l;a++){if((q=(i=this[a]).ownerElement)&&!q.$inheritProperties[i.nodeName]){s.push(this[a]);}}return s.join(t);};}).call(apf.AmlNamedNodeMap.prototype={});apf.AmlEvent=function(i,l){this.name=i;var j;for(j in l){this[j]=l[j];}};apf.AmlEvent.prototype={bubbles:false,cancelBubble:false,preventDefault:function(){this.returnValue=false;},stopPropagation:function(){this.cancelBubble=true;},stop:function(){this.returnValue=false;this.cancelBubble=true;}};apf.AmlAttr=function(j,i,l){this.$init();this.ownerElement=j;this.ownerDocument=j.ownerDocument;this.nodeName=this.name=i;this.nodeValue=this.value=l;};(function(){this.nodeType=this.NODE_ATTRIBUTE;this.MODIFICATION=1;this.ADDITION=2;this.REMOVAL=3;this.serialize=this.toString=function(){return this.name+'="'+apf.xmlentities(String(this.value)).replace(/</g,"&lt;").replace(/>/g,"&gt;")+'"';};this.$setValue=function(c){this.nodeValue=this.value=c;this.specified=true;};this.$triggerUpdate=function(l){var j=this.name,m=this.value,n=this.ownerElement;if(j=="id"&&!this.specified&&n.id){this.specified=true;return;}if(j.substr(0,2)=="on"){if(n.$events[j]){n.removeEventListener(j.replace(/^on/,""),n.$events[j]);}if(m){n.addEventListener(j,(n.$events[j]=(typeof m=="string"?apf.lm.compile(m,{event:true,parsecode:true}):m)));}return;}else{if(this.specified){n.$clearDynamicProperty(j);}if(typeof m=="string"&&(n.$attrExcludePropBind[j]||(m.indexOf("{")>-1||m.indexOf("[")>-1))){n.$setDynamicProperty(j,m);return;}}n.setProperty(j,m);if(this.specified){n.dispatchEvent("DOMAttrModified",{relatedNode:this,attrChange:this.MODIFICATION,attrName:j,newValue:m,prevValue:null,bubble:true});}else{this.specified=true;}};this.addEventListener("DOMNodeInsertedIntoDocument",this.$triggerUpdate);}).call(apf.AmlAttr.prototype=new apf.AmlNode());apf.AmlCDATASection=function(c){this.nodeType=this.NODE_CDATA_SECTION;this.nodeName="#cdata-section";this.$init(c);};apf.AmlCDATASection.prototype=new apf.AmlText(true);apf.AmlCDATASection.prototype.serialize=function(){return"<![CDATA["+this.nodeValue+"]]>";};apf.AmlConfiguration=function(c){this.parameterNames=[];this.$init(c);};(function(){this.setParameter=this.setProperty;this.getParameter=this.getProperty;this.canSetParameter=function(d,i){return this.parameterNames.indexOf(d)>-1;};}).call(apf.AmlConfiguration.prototype=new apf.Class());apf.AmlDocumentFragment=function(c){this.$init(c);};apf.AmlDocumentFragment.prototype=new apf.AmlNode();apf.AmlDocumentFragment.prototype.nodeName="#document-fragment";apf.AmlDocumentFragment.prototype.nodeType=apf.AmlDocumentFragment.prototype.NODE_DOCUMENT_FRAGMENT;apf.xhtml=new apf.AmlNamespace();apf.setNamespace("http://www.w3.org/1999/xhtml",apf.xhtml);apf.XhtmlElement=function(j,l){this.$init(l||true,apf.NODE_VISIBLE,j);this.$xoe=this.addEventListener;this.addEventListener=this.$xae;this.removeEventListener=this.$xre;var i=this;this.$de=function(a){i.dispatchEvent(a.type,a);};};(function(){this.$xae=function(i,d){if(!this.$ext){return;}apf.addListener(this.$ext,i,this.$de);this.$xoe.apply(this,arguments);};this.$xre=function(i,d){if(!this.$ext){return;}apf.removeListener(this.$ext,i,this.$de);apf.AmlElement.prototype.removeEventListener.apply(this,arguments);};this.$handlePropSet=function(j,l,m){if(this.$booleanProperties[j]){l=apf.isTrue(l);}this[j]=l;var n=this.$propHandlers&&this.$propHandlers[j]||apf.GuiElement.propHandlers[j];if(n){n.call(this,l,null,j);}else{if(this.$int){this.$int.setAttribute(apf.isIE&&j=="class"?"className":j,l);}}};this.addEventListener("DOMNodeInsertedIntoDocument",function(d){var i;if(!(i=this.parentNode.$int)){return;}if(this.$aml){this.$ext=this.$int=apf.insertHtmlNode(this.$aml.serialize?this.$aml:this.$aml.cloneNode(false),i);}else{this.$ext=this.$int=i.appendChild(document.createElement(this.localName));}},true);}).call(apf.XhtmlElement.prototype=new apf.AmlElement());apf.xhtml.setElement("@default",apf.XhtmlElement);apf.XhtmlOptionElement=function(i,d){this.$init(d||"option",apf.NODE_VISIBLE,i);};(function(){this.addEventListener("DOMNodeInsertedIntoDocument",function(c){this.$ext=this.$int=this.parentNode.$int.appendChild(this.parentNode.$int.ownerDocument.createElement("option"));if(this.value){this.$int.setAttribute("value",this.value);}},true);}).call(apf.XhtmlOptionElement.prototype=new apf.AmlElement());apf.xhtml.setElement("option",apf.XhtmlOptionElement);apf.XhtmlHtmlElement=function(i,d){this.$init(d||"html",apf.NODE_VISIBLE,i);this.$int=document.body;this.$tabList=[];this.$focussable=apf.KEYBOARD;this.focussable=true;this.visible=true;this.$isWindowContainer=true;this.focus=function(){this.dispatchEvent("focus");};this.blur=function(){this.dispatchEvent("blur");};apf.window.$addFocus(this);this.addEventListener("DOMNodeInsertedIntoDocument",function(w){var B,a,l,c,n,A=this.attributes,z=this.ownerDocument;for(B=0,a=A.length;B<a;B++){l=(c=A[B]).nodeName.split(":");if(l[0]=="xmlns"){if(n=l[1]){z.$prefixes[n]=c.nodeValue;z.$namespaceURIs[c.nodeValue]=n;}else{z.namespaceURI=c.nodeValue;}}}if(!z.namespaceURI){z.namespaceURI=apf.ns.xhtml;}});};apf.XhtmlHtmlElement.prototype=new apf.XhtmlElement();apf.xhtml.setElement("html",apf.XhtmlHtmlElement);apf.XhtmlSkipChildrenElement=function(i,d){this.$init(d,apf.NODE_VISIBLE,i);};(function(){this.canHaveChildren=false;this.$redraw=function(){var c=this;apf.queue.add("redraw"+this.$uniqueId,function(){var a=c.$ext.parentNode;var i=c.$ext.nextSibling;a.removeChild(c.$ext);c.$ext=apf.insertHtmlNode(null,a,i,c.$aml?(c.$aml.serialize?c.$aml.serialize():c.$aml.xml):c.serialize());});};this.addEventListener("DOMNodeInsertedIntoDocument",function(d){var i;if(!(i=this.parentNode.$int)){return;}this.$ext=apf.insertHtmlNode(null,i,null,this.$aml?(this.$aml.serialize?this.$aml.serialize():this.$aml.xml):this.serialize());},true);}).call(apf.XhtmlSkipChildrenElement.prototype=new apf.AmlElement());apf.xhtml.setElement("object",apf.XhtmlSkipChildrenElement);apf.xhtml.setElement("embed",apf.XhtmlSkipChildrenElement);apf.xhtml.setElement("table",apf.XhtmlSkipChildrenElement);apf.xhtml.setElement("pre",apf.XhtmlSkipChildrenElement);apf.XhtmlBodyElement=function(i,d){this.$init(d||"body",apf.NODE_VISIBLE,i);};(function(){this.addEventListener("DOMNodeInsertedIntoDocument",function(c){if(!this.ownerDocument.body){this.ownerDocument.body=this;}this.$ext=this.$int=document.body;},true);}).call(apf.XhtmlBodyElement.prototype=new apf.AmlElement());apf.xhtml.setElement("body",apf.XhtmlBodyElement);apf.XhtmlIgnoreElement=function(i,d){this.$init(d,apf.NODE_VISIBLE,i);};apf.XhtmlIgnoreElement.prototype=new apf.AmlElement();apf.xhtml.setElement("script",apf.XhtmlIgnoreElement);apf.xhtml.setElement("noscript",apf.XhtmlIgnoreElement);apf.xhtml.setElement("head",apf.XhtmlIgnoreElement);apf.xhtml.setElement("meta",apf.XhtmlIgnoreElement);apf.xsd=new apf.AmlNamespace();apf.setNamespace("http://www.w3.org/2001/XMLSchema",apf.xsd);apf.xsd.typeHandlers={"http://www.w3.org/2001/XMLSchema":{dateTime:function(i){i=i.replace(/-/g,"/");i.match(/^(\d{2})\/(\d{2})\/(\d{4}) (\d{2}):(\d{2}):(\d{2})$/);if(!RegExp.$3||RegExp.$3.length<4){return false;}var d=new Date(i);if(d.getFullYear()!=parseFloat(RegExp.$3)){return false;}if(d.getMonth()!=parseFloat(RegExp.$2)-1){return false;}if(d.getDate()!=parseFloat(RegExp.$1)){return false;}if(d.getHours()!=parseFloat(RegExp.$4)){return false;}if(d.getMinutes()!=parseFloat(RegExp.$5)){return false;}if(d.getSeconds()!=parseFloat(RegExp.$5)){return false;}return true;},time:function(i){i.match(/^(\d{2}):(\d{2}):(\d{2})$/);var d=new Date("21/06/1980 "+i);if(d.getHours()!=parseFloat(RegExp.$1)){return false;}if(d.getMinutes()!=parseFloat(RegExp.$2)){return false;}if(d.getSeconds()!=parseFloat(RegExp.$3)){return false;}return true;},date:function(i){i=i.replace(/-/g,"/");i.match(/^(\d{2})\/(\d{2})\/(\d{4})$/);if(!RegExp.$3||RegExp.$3.length<4){return false;}var d=new Date(RegExp.$2+"/"+RegExp.$1+"/"+RegExp.$3);if(d.getFullYear()!=parseFloat(RegExp.$3)){return false;}if(d.getMonth()!=parseFloat(RegExp.$2)-1){return false;}if(d.getDate()!=parseFloat(RegExp.$1)){return false;}return true;},gYearMonth:function(i){i=i.replace(/-/g,"/");i.match(/^\/?(\d{4})(?:\d\d)?\/(\d{2})(?:\w|[\+\-]\d{2}:\d{2})?$/);if(!RegExp.$1||RegExp.$1.length<4){return false;}var d=new Date(i);if(d.getFullYear()!=parseFloat(RegExp.$)){return false;}if(d.getMonth()!=parseFloat(RegExp.$2)-1){return false;}return true;},gYear:function(i){i.match(/^\/?(\d{4})(?:\d\d)?(?:\w|[\+\-]\d{2}:\d{2})?$/);if(!RegExp.$1||RegExp.$1.length<4){return false;}var d=new Date(i);if(d.getFullYear()!=parseFloat(RegExp.$1)){return false;}return true;},gMonthDay:function(i){i=i.replace(/-/g,"/");i.match(/^\/\/(\d{2})\/(\d{2})(?:\w|[\+\-]\d{2}:\d{2})?$/);var d=new Date(i);if(d.getMonth()!=parseFloat(RegExp.$1)-1){return false;}if(d.getDate()!=parseFloat(RegExp.$2)){return false;}return true;},gDay:function(i){i=i.replace(/-/g,"/");i.match(/^\/{3}(\d{2})(?:\w|[\+\-]\d{2}:\d{2})?$/);var d=new Date(i);if(d.getDate()!=parseFloat(RegExp.$1)){return false;}return true;},gMonth:function(i){i=i.replace(/-/g,"/");i.match(/^\/{2}(\d{2})(?:\w|[\+\-]\d{2}:\d{2})?$/);var d=new Date(i);if(d.getMonth()!=parseFloat(RegExp.$1)-1){return false;}return true;},string:function(c){return typeof c=="string";},"boolean":function(c){return/^(true|false)$/i.test(c);},base64Binary:function(c){return true;},hexBinary:function(c){return/^(?:0x|x|#)?[A-F0-9]{0,8}$/i.test(c);},"float":function(c){return parseFloat(c)==c;},decimal:function(c){return/^[0-9\.\-,]+$/.test(c);},"double":function(c){return parseFloat(c)==c;},anyURI:function(c){return/^(?:\w+:\/\/)?(?:(?:[\w\-]+\.)+(?:[a-z]+)|(?:(?:1?\d?\d?|2[0-4]9|25[0-5])\.){3}(?:1?\d\d|2[0-4]9|25[0-5]))(?:\:\d+)?(?:\/([^\s\\\%]+|%[\da-f]{2})*)?$/i.test(c);},QName:function(c){return true;},normalizedString:function(c){return true;},token:function(c){return true;},language:function(c){return true;},Name:function(c){return true;},NCName:function(c){return true;},ID:function(c){return true;},IDREF:function(c){return true;},IDREFS:function(c){return true;},NMTOKEN:function(c){return true;},NMTOKENS:function(c){return true;},integer:function(c){return parseInt(c)==c;},nonPositiveInteger:function(c){return parseInt(c)==c&&c<=0;},negativeInteger:function(c){return parseInt(c)==c&&c<0;},"long":function(c){return parseInt(c)==c&&c>=-2147483648&&c<=2147483647;},"int":function(c){return parseInt(c)==c;},"short":function(c){return parseInt(c)==c&&c>=-32768&&c<=32767;},"byte":function(c){return parseInt(c)==c&&c>=-128&&c<=127;},nonNegativeInteger:function(c){return parseInt(c)==c&&c>=0;},unsignedLong:function(c){return parseInt(c)==c&&c>=0&&c<=4294967295;},unsignedInt:function(c){return parseInt(c)==c&&c>=0;},unsignedShort:function(c){return parseInt(c)==c&&c>=0&&c<=65535;},unsignedByte:function(c){return parseInt(c)==c&&c>=0&&c<=255;},positiveInteger:function(c){return parseInt(c)==c&&c>0;}},"http://ajax.org/2005/aml":{url:function(c){return/\b(https?|ftp):\/\/([\-A-Z0-9.]+)(\/[\-A-Z0-9+&@#\/%=~_|!:,.;]*)?(\?[\-A-Z0-9+&@#\/%=~_|!:,.;]*)?/i.test(c.trim());},website:function(c){return/^(?:http:\/\/)?([\w-]+\.)+\w{2,4}$/.test(c.trim());},email:function(c){return/^[A-Z0-9\.\_\%\-]+@(?:[A-Z0-9\-]+\.)+[A-Z]{2,4}$/i.test(c.trim());},creditcard:function(l){l=l.replace(/ /g,"");l=l.pad(21,"0",apf.PAD_LEFT);for(var m=0,n,i=l.length;i>=0;i--){n=l.substr(i,1)*(i%2+1);m+=n>9?n-9:n;}return m%10===0;},expdate:function(i){i=i.replace(/-/g,"/");i=i.split("/");var d=new Date(i[0]+"/01/"+i[1]);if(d.getYear()!=parseFloat(i[1])){return false;}if(d.getMonth()!=parseFloat(i[0])-1){return false;}return true;},wechars:function(c){return/^[0-9A-Za-z\xC0-\xCF\xD1-\xD6\xD8-\xDD\xDF-\xF6\xF8-\xFF -\.',]+$/.test(c);},phonenumber:function(c){return/^[\d\+\- \(\)]+$/.test(c);},faxnumber:function(c){return/^[\d\+\- \(\)]+$/.test(c);},mobile:function(c){return/^[\d\+\- \(\)]+$/.test(c);}}};apf.xsd.custumTypeHandlers={};apf.xsd.matchType=function(q,t){var o=t.split(":"),s=o[0],c=apf.document,u=c.$prefixes[s];t=o[1];if(s=="xsd"){u="http://www.w3.org/2001/XMLSchema";}if(!u){u=c.namespaceURI||apf.ns.xhtml;}var w=this.typeHandlers[u];if(w&&w[t]){return w[t](q);}throw new Error(apf.formatErrorString(0,null,"Validating XSD Type","Could not find type: "+t));return true;};apf.xsd.checkType=function(z,c){var s=typeof c=="object"?apf.queryValue(c):c;if(z.indexOf(":")>-1){var w=z.split(":"),B=w[0],C=w[1],t=apf.document,u=t.$prefixes[B];if(B=="xsd"){u="http://www.w3.org/2001/XMLSchema";}if(!u){u=t.namespaceURI||apf.ns.xhtml;}var A=this.typeHandlers[u];if(A&&A[C]){return A[C](s);}}if(this.custumTypeHandlers[z]){return this.custumTypeHandlers[z](s);}else{}};apf.XsdElement=function(i,d){this.$init(true);this.addEventListener("DOMNodeInserted",function(){if(!this.parentNode.$compile){this.$compile();}});this.addEventListener("DOMNodeRemoved",function(){if(!this.parentNode.$compile){this.$compile();}});this.addEventListener("DOMNodeInsertedIntoDocument",function(a){if(this.parentNode.$compile){return;}var c=this;apf.queue.add("compile"+this.$uniqueId,function(){c.$compile();});});};apf.XsdElement.prototype=new apf.AmlElement();apf.XsdElement.prototype.$recompile=function(c){if(!this.$amlLoaded){return;}if(this.parentNode.$recompile){this.parentNode.$recompile();}else{this.$compile();}};apf.XsdMaxInclusive=function(i,d){this.$init(d||"maxinclusive",apf.NODE_HIDDEN,i);};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile();};this.$compile=function(c){c.push("if (parseFloat(value) > "+this.value+") return false;");};}).call(apf.XsdMaxInclusive.prototype=new apf.XsdElement());apf.xsd.setElement("maxinclusive",apf.XsdMaxInclusive);apf.XsdEnumeration=function(i,d){this.$init(d||"enumeration",apf.NODE_HIDDEN,i);};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile();};this.$compile=function(l){if(l.enumDone){return;}l.enumDone=true;var n,q,m=[],o=this.parentNode.getElementsByTagNameNS(this.namespaceURI,"enumeration");for(n=0,q=o.length;n<q;n++){m.push(o[n].value);}l.push("if (!/^(?:"+m.join("|")+")$/.test(value)) return false;");};}).call(apf.XsdEnumeration.prototype=new apf.XsdElement());apf.xsd.setElement("enumeration",apf.XsdEnumeration);apf.XsdMaxScale=function(i,d){this.$init(d||"maxscale",apf.NODE_HIDDEN,i);};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile();};this.$compile=function(c){};}).call(apf.XsdMaxScale.prototype=new apf.XsdElement());apf.xsd.setElement("maxscale",apf.XsdMaxScale);apf.XsdLength=function(i,d){this.$init(d||"length",apf.NODE_HIDDEN,i);};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile();};this.$compile=function(c){c.push("if (value.length != "+this.value+") return false;");};}).call(apf.XsdLength.prototype=new apf.XsdElement());apf.xsd.setElement("length",apf.XsdLength);apf.XsdList=function(i,d){this.$init(d||"list",apf.NODE_HIDDEN,i);};(function(){this.$compile=function(c){};}).call(apf.XsdList.prototype=new apf.XsdElement());apf.xsd.setElement("list",apf.XsdList);apf.XsdPattern=function(i,d){this.$init(d||"pattern",apf.NODE_HIDDEN,i);};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile();};this.$compile=function(c){c.push("if (!/^"+this.value.replace(/(\/|\^|\$)/g,"\\$1")+"$/.test(value)) return false;");};}).call(apf.XsdPattern.prototype=new apf.XsdElement());apf.xsd.setElement("pattern",apf.XsdPattern);apf.XsdTotalDigits=function(i,d){this.$init(d||"totaldigits",apf.NODE_HIDDEN,i);};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile();};this.$compile=function(c){c.push("if (new String(parseFloat(value)).length == "+this.value+") return false;");};}).call(apf.XsdTotalDigits.prototype=new apf.XsdElement());apf.xsd.setElement("totaldigits",apf.XsdTotalDigits);apf.XsdMaxLength=function(i,d){this.$init(d||"maxlength",apf.NODE_HIDDEN,i);};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile();};this.$compile=function(c){c.push("if (value.length > "+this.value+") return false;");};}).call(apf.XsdMaxLength.prototype=new apf.XsdElement());apf.xsd.setElement("maxlength",apf.XsdMaxLength);apf.XsdUnion=function(i,d){this.$init(d||"union",apf.NODE_HIDDEN,i);};(function(){this.$propHandlers.memberTypes=function(c){this.$memberTypes=c.splitSafe(" ");this.parentNode.$recompile();};this.$compile=function(l){var n,q,i,o=this.childNodes;for(n=0,q=this.$memberTypes.length;n<q;n++){l.push("if (apf.xsd.checkType('"+this.$memberTypes[n]+"', value)) return true;");}for(n=0,q=o.length;n<q;n++){(i=o[n]).$compile&&i.$compile(l);}};}).call(apf.XsdUnion.prototype=new apf.XsdElement());apf.xsd.setElement("union",apf.XsdUnion);apf.XsdMinScale=function(i,d){this.$init(d||"minscale",apf.NODE_HIDDEN,i);};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile();};this.$compile=function(c){};}).call(apf.XsdMinScale.prototype=new apf.XsdElement());apf.xsd.setElement("minscale",apf.XsdMinScale);apf.XsdRestriction=function(i,d){this.$init(d||"restriction",apf.NODE_HIDDEN,i);};(function(){this.$propHandlers.base=function(){this.parentNode.$recompile();};this.$compile=function(l){l.push("if (!apf.xsd.matchType(value, '"+this.base+"')) return false;");var n,q,i,o=this.childNodes;for(n=0,q=o.length;n<q;n++){(i=o[n]).$compile&&i.$compile(l);}};}).call(apf.XsdRestriction.prototype=new apf.XsdElement());apf.xsd.setElement("restriction",apf.XsdRestriction);apf.XsdSimpleType=function(j,l){this.$init(l||"simpletype",apf.NODE_HIDDEN,j);var i;this.$propHandlers.name=function(a){if(i){apf.xsd.custumTypeHandlers[a]=apf.xsd.custumTypeHandlers[i];apf.xsd.custumTypeHandlers[i]=null;}i=a;};};(function(){this.$compile=function(l){var n,q,o,i;if(!this.parentNode.$compile){l=[];o=this.childNodes;for(n=0,q=o.length;n<q;n++){(i=o[n]).$compile&&i.$compile(l);}l.push("return true;");apf.xsd.custumTypeHandlers[this.name]=new Function("value",l.join("\n"));}else{o=this.childNodes;for(n=0,q=o.length;n<q;n++){(i=o[n]).$compile&&i.$compile(l);}}};}).call(apf.XsdSimpleType.prototype=new apf.XsdElement());apf.xsd.setElement("simpletype",apf.XsdSimpleType);apf.XsdMinLength=function(i,d){this.$init(d||"minlength",apf.NODE_HIDDEN,i);};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile();};this.$compile=function(c){c.push("if (value.length < "+this.value+") return false;");};}).call(apf.XsdMinLength.prototype=new apf.XsdElement());apf.xsd.setElement("minlength",apf.XsdMinLength);apf.XsdSchema=function(i,d){this.$init(true);};apf.XsdSchema.prototype=new apf.XsdElement();apf.xsd.setElement("schema",apf.XsdSchema);apf.XsdMinInclusive=function(i,d){this.$init(d||"mininclusive",apf.NODE_HIDDEN,i);};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile();};this.$compile=function(c){c.push("if (parseFloat(value) < "+this.value+") return false;");};}).call(apf.XsdMinInclusive.prototype=new apf.XsdElement());apf.xsd.setElement("mininclusive",apf.XsdMinInclusive);apf.XsdMinExclusive=function(i,d){this.$init(d||"minexclusive",apf.NODE_HIDDEN,i);};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile();};this.$compile=function(c){c.push("if (parseFloat(value) => "+this.value+") return false;");};}).call(apf.XsdMinExclusive.prototype=new apf.XsdElement());apf.xsd.setElement("minexclusive",apf.XsdMinExclusive);apf.XsdFractionDigits=function(i,d){this.$init(d||"maxinclusive",apf.NODE_HIDDEN,i);};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile();};this.$compile=function(c){c.push("if (parseFloat(value) == value && value.split('.')[1].length != "+this.value+") return false;");};}).call(apf.XsdFractionDigits.prototype=new apf.XsdElement());apf.xsd.setElement("maxinclusive",apf.XsdFractionDigits);apf.XsdMaxExclusive=function(i,d){this.$init(d||"maxexclusive",apf.NODE_HIDDEN,i);};(function(){this.$propHandlers.value=function(){this.parentNode.$recompile();};this.$compile=function(c){c.push("if (parseFloat(value) =< "+this.value+") return false;");};}).call(apf.XsdMaxExclusive.prototype=new apf.XsdElement());apf.xsd.setElement("maxexclusive",apf.XsdMaxExclusive);apf.xinclude=new apf.AmlNamespace();apf.setNamespace("http://www.w3.org/2001/XInclude",apf.xinclude);apf.html5=new apf.AmlNamespace();apf.setNamespace("",apf.html5);apf.HTML5INPUT={email:"textbox",url:"textbox",password:"textbox",datetime:"spinner",date:"calendar",month:"spinner",week:"spinner",time:"spinner",number:"spinner",range:"slider",checkbox:"checkbox",radio:"radiobutton",file:"upload",submit:"submit",image:"submit",reset:"button"};apf.runXslt=function(){apf.XSLTProcessor=function(){this.templates={};this.p={"value-of":function(s,n,o,m){var q,t=apf.XPath.selectNodes(n.getAttribute("select"),s)[0];if(!t){q="";}else{if(t.nodeType==1){q=t.firstChild?t.firstChild.nodeValue:"";}else{q=typeof t=="object"?t.nodeValue:t;}}m.appendChild(this.xmlDoc.createTextNode(q));},"copy-of":function(o,m,n,l){var q=apf.XPath.selectNodes(m.getAttribute("select"),o)[0];if(q){l.appendChild(apf.canImportNode?l.ownerDocument.importNode(q,true):q.cloneNode(true));}},"if":function(n,l,m,j){if(apf.XPath.selectNodes(l.getAttribute("test"),n)[0]){this.parseChildren(n,l,m,j);}},"for-each":function(i,t,w,l){var q,u,s=apf.XPath.selectNodes(t.getAttribute("select"),i);for(q=0,u=s.length;q<u;q++){this.parseChildren(s[q],t,w,l);}},choose:function(i,t,w,l){var q,u,s=t.childNodes;for(q=0,u=s.length;q<u;q++){if(!s[q].tagName){continue;}if(s[q][apf.TAGNAME]=="otherwise"||s[q][apf.TAGNAME]=="when"&&apf.XPath.selectNodes(s[q].getAttribute("test"),i)[0]){return this.parseChildren(i,s[q],w[q][2],l);}}},output:function(n,l,m,j){},param:function(n,l,m,j){},attribute:function(o,m,n,l){var q=this.xmlDoc.createDocumentFragment();this.parseChildren(o,m,n,q);l.setAttribute(m.getAttribute("name"),q.xml);},"apply-templates":function(K,i,j,Q){var U,n,l,O;if(!i){U=this.templates["/"]||this.templates[K.tagName];if(U){this.parseChildren(U==this.templates["/"]?K.ownerDocument:K,U[0],U[1],Q);}}else{if(i.getAttribute("select")){U=this.templates[i.getAttribute("select")];if(U){if(i.getAttribute("select")=="/"){return alert("Something went wrong. The / template was executed as a normal template");}O=K.selectNodes(i.getAttribute("select"));for(n=0,l=O.length;n<l;n++){this.parseChildren(O[n],U[0],U[1],Q);}}}else{if(i.getAttribute("name")){U=this.templates[i.getAttribute("name")];if(U){this.parseChildren(K,U[0],U[1],Q);}}else{var t=K.cloneNode(true),V=this.xmlDoc.createDocumentFragment(),N,M,P;O=t.childNodes;for(n=O.length-1;n>=0;n--){if(O[n].nodeType==3||O[n].nodeType==4){continue;}if(!O[n].nodeType==1){continue;}var J=O[n];for(N in this.templates){if(N=="/"){continue;}U=this.templates[N];var T=J.selectNodes("self::"+N);for(var s=T.length-1;s>=0;s--){var R=T[s];M=R.parentNode;this.parseChildren(R,U[0],U[1],V);if(V.childNodes){for(P=V.childNodes.length-1;P>=0;P--){M.insertBefore(V.childNodes[P],R);}}M.removeChild(R);}}if(J.parentNode){M=J.parentNode;this.p["apply-templates"].call(this,J,i,j,V);if(V.childNodes){for(P=V.childNodes.length-1;P>=0;P--){M.insertBefore(V.childNodes[P],J);}}M.removeChild(J);}}for(n=t.childNodes.length-1;n>=0;n--){Q.insertBefore(t.childNodes[n],Q.firstChild);}}}}},cache:{},"import":function(s,n,o,m){var t=n.getAttribute("href");if(!this.cache[t]){var q=apf.oHttp.get(t);this.cache[t]=q;}},include:function(n,l,m,j){},when:function(){},otherwise:function(){},"copy-clone":function(i,t,w,l){l=l.appendChild(apf.canImportNode?l.ownerDocument.importNode(t,false):t.cloneNode(false));if(l.nodeType==1){for(var A,s=0,u=l.attributes.length;s<u;s++){var z=l.attributes[s].nodeValue;if(!apf.isSafariOld&&l.attributes[s].nodeName.match(/^xmlns/)){continue;}l.attributes[s].nodeValue=l.attributes[s].nodeValue.replace(/\{([^\}]+)\}/g,function(c,a){var d=apf.XPath.selectNodes(a,i)[0];if(!d){A="";}else{if(d.nodeType==1){A=d.firstChild?d.firstChild.nodeValue:"";}else{A=typeof d=="object"?d.nodeValue:d;}}return A;});l.attributes[s].nodeValue;}}this.parseChildren(i,t,w,l);}};this.parseChildren=function(o,t,i,l){if(!i){return;}for(var q=0,s=i.length;q<s;q++){i[q][0].call(this,o,i[q][1],i[q][2],l);}};this.compile=function(t){var q=t.childNodes;for(var l=[],o=0,s=q.length;o<s;o++){if(q[o].nodeType!=1&&q[o].nodeType!=3&&q[o].nodeType!=4){continue;}if(q[o][apf.TAGNAME]=="template"){this.templates[q[o].getAttribute("match")||q[o].getAttribute("name")]=[q[o],this.compile(q[o])];}else{if(q[o][apf.TAGNAME]=="stylesheet"){this.compile(q[o]);}else{if(q[o].prefix=="xsl"){var i=this.p[q[o][apf.TAGNAME]];if(!i){alert("xsl:"+q[o][apf.TAGNAME]+" is not supported at this time on this platform");}else{l.push([i,q[o],this.compile(q[o])]);}}else{l.push([this.p["copy-clone"],q[o],this.compile(q[o])]);}}}}return l;};this.importStylesheet=function(i){this.xslDoc=i.nodeType==9?i.documentElement:i;var d=this.compile(i);this.xslStack=[[this.p["apply-templates"],null]];};this.transformToFragment=function(l,n){this.xmlDoc=n.nodeType!=9?n.ownerDocument:n;var m=this.xmlDoc.createDocumentFragment();if(!apf.isSafariOld&&l.nodeType==9){l=l.documentElement;}var j=this.parseChildren(l,this.xslDoc,this.xslStack,m);return m;};};self.XSLTProcessor=apf.XSLTProcessor;};apf.XiInclude=function(i,d){this.$init(d||"include",apf.NODE_HIDDEN,i);};apf.xinclude.setElement("include",apf.XiInclude);apf.aml.setElement("include",apf.XiInclude);(function(){this.$parsePrio="002";this.$propHandlers.href=this.$propHandlers.src=function(c){if(typeof c!="string"){return d.call(this,c);}this.$path=c.charAt(0)=="{"?c:apf.getAbsolutePath(apf.hostPath,c);var a=this.ownerDocument.$domParser;if(!this.defer){a.$shouldWait++;this.$parseContext=a.$callCount<2&&a.$parseContext||[this.parentNode];}i.call(this,this.$path);};function d(w){var l=this.ownerDocument.$domParser;if(this.clear){this.parentNode.$int.innerHTML="";}if(w){var c=l.parseFromXml(w,{doc:this.ownerDocument}).firstChild.childNodes,z=this.parentNode,t,a,u;for(t,a=0,u=c.length;a<u;a++){(t=c[a]).parentNode=null;z.insertBefore(t,this);}}if(!this.defer){l.$continueParsing.apply(l,this.$parseContext);}if(this.callback){this.callback({xmlNode:w,amlNode:this.parentNode});}this.parentNode.removeChild(this);}function i(a){var c=this;apf.getData(a,apf.extend(this.options||{},{callback:function(w,q,t){if(q!=apf.SUCCESS){var u=new Error(apf.formatErrorString(1007,c,"Loading Includes","Could not load Include file '"+(a||c.src)+"'\nReason: "+t.message));if(t.tpModule.retryTimeout(t,q,null,u)===true){return true;}apf.console.error(u.message);d.call(c,null);return;}w=w.replace(/\<\!DOCTYPE[^>]*>/,"").replace(/&nbsp;/g," ").replace(/^[\r\n\s]*/,"");if(!apf.supportNamespaces){w=w.replace(/xmlns\=\"[^"]*\"/g,"");}if(w.indexOf("<a:application")==-1){w="<a:application xmlns:a='"+apf.ns.aml+"'>"+w+"</a:application>";}var s=apf.getXml(w,null,true);if(!s){throw new Error(apf.formatErrorString(0,null,"Loading skin","Could not parse include file. Maybe the file does not exist?",s));}s.setAttribute("filename",t.url);d.call(c,s);},async:true,ignoreOffline:true}));}}).call(apf.XiInclude.prototype=new apf.AmlElement());apf.XiFallback=function(i,d){this.$init(d||"fallback",apf.NODE_HIDDEN,i);};apf.XiFallback.prototype=new apf.AmlElement();apf.XiFallback.prototype.$parsePrio="002";apf.xinclude.setElement("fallback",apf.XiFallback);apf.aml.setElement("fallback",apf.XiFallback);apf.__ANCHORING__=1<<13;apf.Anchoring=function(){this.$regbase=this.$regbase|apf.__ANCHORING__;this.$anchors=[];var u=1;var A=2;this.$updateQueue=0;this.$inited=this.$parsed=this.$anchoringEnabled=false;this.$hordiff=this.$verdiff=0;this.$rule_v=this.$rule_h=this.$rule_header="";var z=apf.layout;this.$supportedProperties.push("anchors");var B={right:function(a,c){if(!this.$anchoringEnabled&&!this.$setLayout("anchoring")){return;}if(!a){this.$ext.style[c]="";}if(!this.$updateQueue){z.queue(this.$pHtmlNode,this);}this.$updateQueue=this.$updateQueue|A;},bottom:function(a,c){if(!this.$anchoringEnabled&&!this.$setLayout("anchoring")){return;}if(!a){this.$ext.style[c]="";}if(!this.$updateQueue){z.queue(this.$pHtmlNode,this);}this.$updateQueue=this.$updateQueue|u;}};B.left=B.width=B.right;B.top=B.height=B.bottom;this.$propHandlers.anchors=function(a){this.$anchors=a?a.splitSafe("(?:, *| )"):[];if(!this.$anchoringEnabled&&!this.$setLayout("anchoring")){return;}if(!this.$updateQueue&&apf.loaded){z.queue(this.$pHtmlNode,this);}this.$updateQueue=this.$updateQueue|A|u;};this.$disableAnchoring=function(a){if(!this.$inited||!this.$anchoringEnabled||!this.$pHtmlNode){return;}z.removeRule(this.$pHtmlNode,this.$uniqueId+"_anchors");if(z.queue){z.queue(this.$pHtmlNode);}for(var c in B){delete this.$propHandlers[c];}this.removeEventListener("DOMNodeRemoved",t);this.removeEventListener("DOMNodeInserted",C);if(this.right){this.$ext.style.left=this.$ext.offsetLeft;}if(this.bottom){this.$ext.style.top=this.$ext.offsetTop;}this.removeEventListener("prop.visible",w);this.$inited=false;this.$anchoringEnabled=false;};this.$enableAnchoring=function(){if(this.$inited){return;}apf.extend(this.$propHandlers,B);this.addEventListener("DOMNodeRemoved",t);this.addEventListener("DOMNodeInserted",C);this.addEventListener("prop.visible",w);this.$updateQueue=0|((this.left||this.width||this.right||this.anchors)&&A)|((this.top||this.height||this.bottom||this.anchors)&&u);if(this.$updateQueue){z.queue(this.$pHtmlNode,this);}this.$inited=true;this.$anchoringEnabled=true;};function w(a){if(!(this.$rule_header||this.$rule_v||this.$rule_h)){return;}if(a.value){if(this.$rule_v||this.$rule_h){var c=this.$rule_header+"\n"+this.$rule_v+"\n"+this.$rule_h;z.setRules(this.$pHtmlNode,this.$uniqueId+"_anchors",c);z.queue(this.$pHtmlNode,this);}z.processQueue();}else{z.removeRule(this.$pHtmlNode,this.$uniqueId+"_anchors");z.queue(this.$pHtmlNode);}}function t(a){if(a&&(a.$doOnlyAdmin||a.currentTarget==this)){return;}if(z.queue&&this.$pHtmlNode){z.removeRule(this.$pHtmlNode,this.$uniqueId+"_anchors");z.queue(this.$pHtmlNode);}}function C(a){if(!this.$amlLoaded||a.currentTarget!=this){return;}if(!a.$moveWithinParent&&this.$parsed){this.$moveAnchoringRules(a.$oldParentHtmlNode);}}this.$moveAnchoringRules=function(a,d){var c=a&&z.removeRule(a,this.$uniqueId+"_anchors");if(c){z.queue(a);}if(!this.$rule_v&&!this.$rule_h){return;}this.$rule_header=l.call(this);c=this.$rule_header+"\n"+this.$rule_v+"\n"+this.$rule_h;this.$ext.style.display="none";z.setRules(this.$pHtmlNode,this.$uniqueId+"_anchors",c);z.queue(this.$pHtmlNode,this);};this.$hasAnchorRules=function(){return this.$rule_v||this.$rule_h?true:false;};function l(){return"try{            var oHtml = "+(apf.hasHtmlIdsInJs?this.$ext.getAttribute("id"):"document.getElementById('"+this.$ext.getAttribute("id")+"')")+";                        var pWidth = "+(this.$pHtmlNode==this.$pHtmlDoc.body?"apf.getWindowWidth()":"oHtml.parentNode.offsetWidth")+";                        var pHeight = "+(this.$pHtmlNode==this.$pHtmlDoc.body?"apf.getWindowHeight()":"oHtml.parentNode.offsetHeight")+";            }catch(e){            }";}function s(c,a){return String(c).replace(apf.percentageMatch,"(("+a+" * $1)/100)");}this.$recalcAnchoring=function(a){var c=apf.getDiff(this.$ext);this.$hordiff=c[0];this.$verdiff=c[1];this.$updateQueue=this.$updateQueue|A|u;this.$updateLayout();z.queue(this.$pHtmlNode,this);if(!a){z.processQueue();}};this.$updateLayout=function(){if(!this.$ext.offsetHeight&&!this.$ext.offsetWidth){var m=this;var o=function(K,M,E){if(m.$updateQueue&&apf.isTrue(E)&&(m.$ext.offsetWidth||m.$ext.offsetHeight)){m.$updateLayout();apf.layout.activateRules(m.$ext.parentNode);var D=m;while(D){D.unwatch("visible",o);D=D.parentNode;}m.$isWaitingOnDisplay=false;}};this.$isWaitingOnDisplay=true;this.watch("visible",o);var G=this.parentNode;while(G){G.watch("visible",o);G=G.parentNode;}return;}if(!this.$parsed){if(!this.$ext.getAttribute("id")){apf.setUniqueHtmlId(this.$ext);}var d=apf.getDiff(this.$ext);this.$hordiff=d[0];this.$verdiff=d[1];if(this.$getOption){this.$minheight=Math.max(parseInt(this.$getOption("main","minheight"))||0,parseInt(this.getAttribute("minheight"))||0)||0;this.$maxheight=Math.min(parseInt(this.$getOption("main","maxheight"))||0,parseInt(this.getAttribute("maxheight"))||100000)||100000;this.$minwidth=Math.max(parseInt(this.$getOption("main","minwidth"))||0,parseInt(this.getAttribute("minwidth"))||0)||0;this.$maxwidth=Math.min(parseInt(this.$getOption("main","maxwidth"))||0,parseInt(this.getAttribute("maxwidth"))||100000)||100000;}else{this.$minheight=0;this.$maxheight=100000;this.$minwidth=0;this.$maxwidth=100000;}this.$rule_header=l.call(this);this.$parsed=true;}if(!this.$updateQueue){if(this.visible){this.$ext.style.display="";}return;}if(this.draggable=="relative"){if("absolute|fixed|relative".indexOf(apf.getStyle(this.$ext,"position"))==-1){this.$ext.style.position="absolute";}}else{if(this.left||this.top||this.right||this.bottom||this.$anchors.length){if("absolute|fixed".indexOf(apf.getStyle(this.$ext,"position"))==-1){this.$ext.style.position="absolute";}}}var F;if(this.$updateQueue&A){F=[];var n=this.left||this.$anchors[3],c=this.right||this.$anchors[1],q=this.width;if(c&&typeof c=="string"){c=s(c,"pWidth");}if(n){if(parseInt(n)!=n){n=s(n,"pWidth");F.push("oHtml.style.left = ("+n+") + 'px'");}else{this.$ext.style.left=n+"px";}}if(!n&&c){if(parseInt(c)!=c){c=s(c,"pWidth");F.push("oHtml.style.right = ("+c+") + 'px'");}else{this.$ext.style.right=c+"px";}}if(q){if(parseInt(q)!=q){q=s(q,"pWidth");F.push("oHtml.style.width = Math.max("+this.$minwidth+", Math.min("+this.$maxwidth+", "+q+" - "+this.$hordiff+")) + 'px'");}else{this.$ext.style.width=(q>this.$hordiff+this.$minwidth?(q<this.$hordiff+this.$maxwidth?q-this.$hordiff:this.$maxwidth):this.$minwidth)+"px";}}if(c!=null&&n!=null){F.push("oHtml.style.width = (pWidth - ("+c+") - ("+n+") - "+this.$hordiff+") + 'px'");}this.$rule_h=(F.length?"try{"+F.join(";}catch(e){};try{")+";}catch(e){};":"");}if(this.$updateQueue&u){F=[];var i=this.top||this.$anchors[0],j=this.bottom||this.$anchors[2],a=this.height;if(j&&typeof j=="string"){j=s(j,"pHeight");}if(i){if(parseInt(i)!=i){i=s(i,"pHeight");F.push("oHtml.style.top = ("+i+") + 'px'");}else{this.$ext.style.top=i+"px";}}if(!i&&j){if(parseInt(j)!=j){F.push("oHtml.style.bottom = ("+j+") + 'px'");}else{this.$ext.style.bottom=j+"px";}}if(a){if(parseInt(a)!=a){a=s(a,"pHeight");F.push("oHtml.style.height = Math.max("+this.$minheight+", Math.min("+this.$maxheight+", "+a+" - "+this.$verdiff+")) + 'px'");}else{this.$ext.style.height=(a>this.$verdiff+this.$minheight?(a<this.$verdiff+this.$maxheight?a-this.$verdiff:this.$maxheight):this.$minheight)+"px";}}if(j!=null&&i!=null){F.push("oHtml.style.height = (pHeight - ("+j+") - ("+i+") - "+this.$verdiff+") + 'px'");}this.$rule_v=(F.length?"try{"+F.join(";}catch(e){};try{")+";}catch(e){};":"");}if(this.$rule_v||this.$rule_h){z.setRules(this.$pHtmlNode,this.$uniqueId+"_anchors",this.$rule_header+"\n"+this.$rule_v+"\n"+this.$rule_h,true);}else{z.removeRule(this.$pHtmlNode,this.$uniqueId+"_anchors");}this.$updateQueue=0;};this.addEventListener("DOMNodeInsertedIntoDocument",function(a){});this.addEventListener("DOMNodeRemovedFromDocument",function(a){this.$disableAnchoring();});};apf.__ALIGNMENT__=1<<12;apf.Alignment=function(){this.$regbase=this.$regbase|apf.__ALIGNMENT__;var l=apf.layout;if(typeof this.dock=="undefined"){this.dock=false;}if(typeof this.dockable=="undefined"){this.dockable=false;}this.$booleanProperties.dock=true;this.$booleanProperties.dockable=true;this.$supportedProperties.push("dock","dockable","align","lean","edge","weight","splitter","minwidth","minheight");this.$disableAlignment=function(purge){if(!this.aData||!this.$alignmentEnabled){return;}for(var prop in propHandlers){delete this.$propHandlers[prop];}this.removeEventListener("DOMNodeRemoved",remove);this.removeEventListener("DOMNodeInserted",reparent);this.removeEventListener("prop.visible",visibleHandler);remove.call(this);};this.$enableAlignment=function(purge){this.$alignmentEnabled=true;var buildParent="vbox|hbox".indexOf(this.parentNode.tagName)==-1&&!this.parentNode.pData;apf.extend(this.$propHandlers,propHandlers);this.addEventListener("DOMNodeRemoved",remove);this.addEventListener("DOMNodeInserted",reparent);this.addEventListener("prop.visible",visibleHandler);var layout=l.get(this.$pHtmlNode,buildParent?apf.getBox(this.parentNode.margin||this.$pHtmlNode.getAttribute("margin")||""):null);if(buildParent){this.parentNode.pData=l.parseXml(this.parentNode||apf.getXml("<vbox />"),layout,"vbox",true);layout.root=this.parentNode.pData;}if(!this.aData){this.aData=l.parseXml(this,layout,this,true);}if(this.align){l.addAlignNode(this,layout.root);if(this.aData.hidden||this.visible===false){this.aData.prehide(true);}this.$purgeAlignment();}else{var pData=this.parentNode.aData||this.parentNode.pData;this.aData.stackId=pData.children.push(this.aData)-1;this.aData.parent=pData;}};function visibleHandler(e){if(!this.aData){return;}if(!this.aData.hidden==e.value){return;}if(e.value){if(this.aData.preshow()!==false){this.$ext.style.display="none";}this.$purgeAlignment();}else{this.$ext.style.display="block";this.aData.prehide();this.$purgeAlignment();}apf.layout.processQueue();}this.$purgeAlignment=function(){var layout=l.get(this.$pHtmlNode);if(this.$ext&&this.$ext.style.display=="block"&&!this.$ext.offsetHeight&&!this.$ext.offsetWidth){var _self=this;var propChange=function(name,old,value){if(_self.$ext.offsetWidth||_self.$ext.offsetHeight){l.queue(_self.$pHtmlNode,null,layout.root);var p=_self;while(p){p.unwatch("visible",propChange);p=p.parentNode;}_self.$isWaitingOnDisplay=false;}};this.$isWaitingOnDisplay=true;this.watch("visible",propChange);var p=this.parentNode;while(p){p.watch("visible",propChange);p=p.parentNode;}return;}l.queue(this.$pHtmlNode,null,layout.root);};function remove(e){if(e&&(e.$doOnlyAdmin||e.currentTarget!=this)){return;}if(this.aData){this.aData.remove();this.$purgeAlignment();if(this.parentNode.pData&&!this.parentNode.pData.children.length){l.removeAll(this.parentNode.pData);this.parentNode.pData=null;}if(this.$ext){this.$ext.style.display="none";}}}function reparent(e){if(!this.$amlLoaded||e.currentTarget!=this){return;}if(!e.$moveWithinParent&&this.aData&&this.aData.pHtml!=this.$pHtmlNode){this.aData.pHtml=this.$pHtmlNode;this.$enableAlignment();}}var propHandlers={align:function(value){this.aData.remove();this.aData.template=value;this.splitter=undefined;this.aData.edgeMargin=this.edge||0;this.$enableAlignment();},lean:function(value){this.aData.isBottom=(value||"").indexOf("bottom")>-1;this.aData.isRight=(value||"").indexOf("right")>-1;this.$purgeAlignment();},edge:function(value){this.aData.edgeMargin=Math.max(this.aData.splitter||0,value!="splitter"?value:0);this.aData.splitter=value=="splitter"?5:false;this.$purgeAlignment();},weight:function(value){this.aData.weight=parseFloat(value);this.$purgeAlignment();},splitter:function(value){this.aData.splitter=value?5:false;this.aData.edgeMargin=Math.max(this.aData.splitter||0,this.edge||0);if(!value&&this.align&&this.align.indexOf("-splitter")){this.align=this.aData.template=this.align.replace("-splitter","");}this.$purgeAlignment();},width:function(value){this.width=null;this.aData.fwidth=value||false;if(this.aData.fwidth&&this.aData.fwidth.indexOf("/")>-1){this.aData.fwidth=eval(this.aData.fwidth);if(this.aData.fwidth<=1){this.aData.fwidth=(this.aData.fwidth*100)+"%";}}this.$purgeAlignment();},height:function(value){this.height=null;this.aData.fheight=String(value)||false;if(this.aData.fheight&&this.aData.fheight.indexOf("/")>-1){this.aData.fheight=eval(this.aData.fheight);if(this.aData.fheight<=1){this.aData.fheight=(this.aData.fheight*100)+"%";}}this.$purgeAlignment();},minwidth:function(value){this.aData.minwidth=value;this.$purgeAlignment();},minheight:function(value){this.aData.minheight=value;this.$purgeAlignment();}};this.addEventListener("DOMNodeRemovedFromDocument",function(e){this.$disableAlignment();this.aData=null;});};apf.__GUIELEMENT__=1<<15;apf.__VALIDATION__=1<<6;apf.GuiElement=function(){this.$init(true);};(function(){this.$regbase=this.$regbase|apf.__GUIELEMENT__;this.$focussable=apf.KEYBOARD_MOUSE;this.visible=true;this.$booleanProperties["disable-keyboard"]=true;this.$booleanProperties.visible=true;this.$booleanProperties.focussable=true;this.$supportedProperties.push("draggable","resizable");this.$supportedProperties.push("focussable","zindex","disabled","tabindex","disable-keyboard","contextmenu","visible","autosize","loadaml","actiontracker","alias","width","left","top","height");this.$setLayout=function(a){if(!this.$drawn||!this.$pHtmlNode){return false;}if(this.parentNode){if(this.parentNode.localName=="table"){this.parentNode.register(this);this.$disableCurrentLayout=null;return a=="table";}else{if(this.aData||this.align||"vbox|hbox".indexOf(this.parentNode.localName)>-1){if(!this.$alignmentEnabled){if(this.$disableCurrentLayout){this.$disableCurrentLayout();}this.$enableAlignment();this.$disableCurrentLayout=this.$disableAlignment;}return a=="alignment";}}}if(!this.$anchoringEnabled){if(this.$disableCurrentLayout){this.$disableCurrentLayout();}this.$enableAnchoring();this.$disableCurrentLayout=this.$disableAnchoring;}return a=="anchoring";};this.implement(apf.Anchoring,apf.Alignment);this.setWidth=function(a){this.setProperty("width",a,false,true);return this;};this.setHeight=function(a){this.setProperty("height",a,false,true);return this;};this.setLeft=function(a){this.setProperty("left",a,false,true);return this;};this.setTop=function(a){this.setProperty("top",a,false,true);return this;};if(!this.show){this.show=function(){this.setProperty("visible",true,false,true);return this;};}if(!this.hide){this.hide=function(){this.setProperty("visible",false,false,true);return this;};}this.getWidth=function(){return(this.$ext||{}).offsetWidth;};this.getHeight=function(){return(this.$ext||{}).offsetHeight;};this.getLeft=function(){return(this.$ext||{}).offsetLeft;};this.getTop=function(){return(this.$ext||{}).offsetTop;};this.enable=function(){this.setProperty("disabled",false,false,true);return this;};this.disable=function(){this.setProperty("disabled",true,false,true);return this;};this.sendToBack=function(){this.setProperty("zindex",0,false,true);return this;};this.bringToFront=function(){this.setProperty("zindex",apf.all.length+1,false,true);return this;};this.sendBackwards=function(){this.setProperty("zindex",this.zindex-1,false,true);return this;};this.bringForward=function(){this.setProperty("zindex",this.zindex+1,false,true);return this;};this.hasFocus=function(){};this.addEventListener("DOMNodeInsertedIntoDocument",function(a){var i=this.$aml;if(this.parentNode&&this.parentNode.$int!=this.$pHtmlNode){this.$pHtmlNode=this.parentNode.$int;}if(!this.$pHtmlNode){return;}this.$pHtmlDoc=this.$pHtmlNode.ownerDocument||document;if(this.$initSkin){this.$initSkin(i);}if(this.$draw){this.$draw();}if(a.id){this.$ext.setAttribute("id",a.id);}if(typeof this.visible=="undefined"){this.visible=true;}if(this.$focussable&&typeof this.focussable=="undefined"){apf.GuiElement.propHandlers.focussable.call(this);}this.$drawn=true;},true);this.addEventListener("DOMNodeInsertedIntoDocument",function(a){if(!this.$pHtmlNode){return;}this.$setLayout();if(this.$loadAml){this.$loadAml(this.$aml);}});var c;this.addEventListener("$event.resize",c=function(a){apf.layout.setRules(this.$ext,"resize","var o = apf.all["+this.$uniqueId+"];            if (o) o.dispatchEvent('resize');",true);apf.layout.queue(this.$ext);this.removeEventListener("$event.resize",c);});this.addEventListener("contextmenu",function(G){if(!this.contextmenus){return;}if(this.hasFeature(apf.__DATABINDING__)){var C;var D=this.hasFeature(apf.__MULTISELECT__)?this.selected:this.xmlRoot;var a,i,l,A,m,F,E,B;for(a=0,i=this.contextmenus.length;a<i;a++){A=(typeof(E=this.contextmenus[a])=="string");B=null;if(!A&&E.match&&D){B=(E.cmatch||(E.cmatch=apf.lm.compile(E.match,{xpathmode:3,injectself:true})))(D);}if(A||D&&B||!E.match){F=A?E:E.menu;if(!self[F]){return;}self[F].display(G.x,G.y,null,this,D);G.returnValue=false;G.cancelBubble=true;break;}}}else{F=typeof this.contextmenus[0]=="string"?this.contextmenus[0]:this.contextmenus[0].getAttribute("menu");if(!self[F]){return;}self[F].display(G.x,G.y,null,this);G.returnValue=false;G.cancelBubble=true;}});}).call(apf.GuiElement.prototype=new apf.AmlElement());apf.GuiElement.propHandlers={focussable:function(c){if(typeof c=="undefined"){this.focussable=true;}if(!this.hasFeature(apf.__FOCUSSABLE__)){this.implement(apf.Focussable);}if(this.focussable){apf.window.$addFocus(this,this.tabindex);}else{apf.window.$removeFocus(this);}},zindex:function(c){this.$ext.style.zIndex=c;},visible:function(c){if(apf.isFalse(c)||typeof c=="undefined"){this.$ext.style.display="none";if(apf.document.activeElement==this||this.canHaveChildren&&apf.isChildOf(this,apf.document.activeElement,false)){if(apf.config.allowBlur&&this.hasFeature(apf.__FOCUSSABLE__)){this.blur();}else{apf.window.moveNext();}}this.visible=false;}else{this.$ext.style.display="block";if(apf.layout&&this.$int){apf.layout.forceResize(this.$int);}this.visible=true;}},disabled:function(t){if(!this.$drawn){var l=this;this.disabled=false;apf.queue.add("disable"+this.$uniqueId,function(a){l.disabled=t;apf.GuiElement.propHandlers.disabled.call(l,t);});return;}if(this.canHaveChildren){if(t!=-1){t=this.disabled=apf.isTrue(t);}var q=this.childNodes;for(var i,o=0,s=q.length;o<s;o++){i=q[o];if(i.nodeFunc==apf.NODE_VISIBLE){if(t&&i.disabled!=-1){i.$disabled=i.disabled||false;}i.setProperty("disabled",t?-1:false);}}if(this.$isWindowContainer){return;}}if(t==-1||t==false){}else{if(typeof this.$disabled=="boolean"){if(t===null){t=this.$disabled;this.$disabled=null;}else{this.$disabled=t||false;return;}}}if(apf.isTrue(t)||t==-1){this.disabled=false;if(apf.document.activeElement==this){apf.window.moveNext(true);if(apf.document.activeElement==this){this.$blur();}}if(this.hasFeature(apf.__PRESENTATION__)){this.$setStyleClass(this.$ext,this.$baseCSSname+"Disabled");}if(this.$disable){this.$disable();}this.disabled=t;}else{if(this.hasFeature(apf.__DATABINDING__)&&apf.config.autoDisable&&!(!this.$bindings||this.xmlRoot)){return false;}this.disabled=false;if(apf.document.activeElement==this){this.$focus();}if(this.hasFeature(apf.__PRESENTATION__)){this.$setStyleClass(this.$ext,null,[this.$baseCSSname+"Disabled"]);}if(this.$enable){this.$enable();}}},enabled:function(c){this.setProperty("disabled",!c);},"disable-keyboard":function(c){this.disableKeyboard=apf.isTrue(c);},contextmenu:function(c){this.contextmenus=[c];},actiontracker:function(c){if(!c){this.$at=null;}else{if(c.tagName=="actiontracker"){this.$at=c;}else{this.$at=typeof c=="string"&&self[c]?apf.nameserver.get("actiontracker",c)||self[c].getActionTracker():apf.setReference(c,apf.nameserver.register("actiontracker",c,new apf.actiontracker()));if(!this.$at.name){this.$at.name=c;}}}},aml:function(c){this.insertMarkup(c);},editable:function(c){this.implement(apf.ContentEditable2);this.$propHandlers.editable.apply(this,arguments);},contenteditable:function(c){this.implement(apf.ContentEditable);if(!this.hasFeature(apf.__VALIDATION__)){this.implement(apf.Validation);}this.$propHandlers.contenteditable.apply(this,arguments);}};apf.__PRESENTATION__=1<<9;apf.Presentation=function(){this.$init(true);};(function(){this.$regbase=this.$regbase|apf.__PRESENTATION__;this.$supportedProperties.push("skin");this.$propHandlers.skinset=this.$propHandlers.skin=function(a){if(!this.$amlLoaded){return;}if(!this.$skinTimer){var c=this;clearTimeout(this.$skinTimer);this.$skinTimer=$setTimeout(function(){i.call(c,a);delete c.$skinTimer;});}};this.$propHandlers.style=function(a){if(!this.styleAttrIsObj&&this.$amlLoaded){this.$ext.setAttribute("style",a);}};var l;this.$propHandlers["class"]=function(a){this.$setStyleClass(this.$ext,a,[l||""]);};this.$forceSkinChange=function(a,c){i.call(this,a,c);};function i(R,M){clearTimeout(this.$skinTimer);if(this.selectable){var T=this.getSelection();}var V=this.$ext,I=this.$int,X=V.nextSibling,K=this.$ext.getAttribute("id"),d=this.$baseCSSname;if(V.parentNode){V.parentNode.removeChild(V);}if(this.$destroy){this.$destroy(true);}this.skin=R;this.$loadSkin(M?M+":"+R:null);if(this.$draw){this.$draw(true);}if(K){this.$ext.setAttribute("id",K);}if(X){this.$ext.parentNode.insertBefore(this.$ext,X);}var J,P,c=[],Q=(V.className||"").splitSafe("s+");for(J=0;J<Q;J++){if(Q[J]&&Q[J]!=d){c.push(Q[J].replace(d,this.$baseCSSname));}}apf.setStyleClass(this.$ext,c.join(" "));var N,a=apf.skins.events;for(J=0,P=a.length;J<P;J++){N=a[J];if(typeof V[N]=="function"&&!this.$ext[N]){this.$ext[N]=V[N];}}this.$ext.style.left=V.style.left;this.$ext.style.top=V.style.top;this.$ext.style.width=V.style.width;this.$ext.style.height=V.style.height;this.$ext.style.right=V.style.right;this.$ext.style.bottom=V.style.bottom;this.$ext.style.zIndex=V.style.zIndex;this.$ext.style.position=V.style.position;this.$ext.style.display=V.style.display;if(this.$loadAml){this.$loadAml(this.$aml);}if(this.$int&&this.$int!=I){var W,U=this.$int,O=I.childNodes;for(var J=O.length-1;J>=0;J--){if((W=O[J]).host){W.host.$pHtmlNode=U;if(W.host.$isLeechingSkin){j.call(W.host);}}U.insertBefore(W,U.firstChild);}this.$int.onresize=I.onresize;}if(this.hasFeature(apf.__DRAGDROP__)){if(document.elementFromPointAdd){document.elementFromPointRemove(V);document.elementFromPointAdd(this.$ext);}}if(this.disabled){this.$disable();}if(this.$focussable&&apf.document.activeElement==this){this.$focus();}if(this.hasFeature(apf.__DATABINDING__)&&this.xmlRoot){this.reload();}else{if(this.value){this.$propHandlers.value.call(this,this.value);}}this.dispatchEvent("$skinchange");if(this.hasFeature(apf.__MULTISELECT__)){if(this.selectable){this.selectList(T,true);}}if(this.hasFeature(apf.__ANCHORING__)){this.$recalcAnchoring();}if(this.hasFeature(apf.__ALIGNMENT__)){if(this.aData){this.aData.oHtml=this.$ext;}if(this.pData){this.pData.oHtml=this.$ext;this.pData.pHtml=this.$int;var O=this.pData.childNodes;for(J=0;J<O.length;J++){O[J].pHtml=this.$int;}}}if(this.draggable&&this.$propHandlers.draggable){this.$propHandlers.draggable.call(this,this.draggable);}if(this.resizable&&this.$propHandlers.resizable){this.$propHandlers.resizable.call(this,this.resizable);}apf.layout.forceResize(this.$ext);}this.$setStyleClass=apf.setStyleClass;function j(s){if(!this.$amlLoaded||s&&(s.$moveWithinParent||s.currentTarget!=this)){return;}this.$setInheritedAttribute(this,"skinset");if(this.attributes.getNamedItem("skin")){return;}var q,c=this.parentNode,d;if((q=this.$canLeechSkin.dataType==apf.STRING?this.$canLeechSkin:this.localName)&&c.$originalNodes&&(d=c.$originalNodes[q])&&d.getAttribute("inherit")){var a=d.getAttribute("link");this.$isLeechingSkin=true;if(a){this.$forceSkinChange(a);}else{var t=c.skinName.split(":");this.$forceSkinChange(t[1],t[0]);}}else{if(this.$isLeechingSkin){delete this.kin;this.$forceSkinChange();}}}this.$initSkin=function(o){if(this.$canLeechSkin){this.addEventListener("DOMNodeInserted",j);}if(!this.skin){this.skin=this.getAttribute("skin");}var d,a=this.parentNode,c;if(this.$canLeechSkin&&!this.skin&&(d=this.$canLeechSkin.dataType==apf.STRING?this.$canLeechSkin:this.localName)&&a.$originalNodes&&(c=a.$originalNodes[d])&&c.getAttribute("inherit")){var q=c.getAttribute("link");this.$isLeechingSkin=true;if(q){this.skin=q;this.$loadSkin();}else{this.$loadSkin(a.skinName);}}else{if(!this.skinset){this.skinset=this.getAttribute("skinset");}this.$loadSkin(null,this.$canLeechSkin);}};this.$loadSkin=function(c,d){this.baseSkin=c||(this.skinset||this.$setInheritedAttribute("skinset"))+":"+(this.skin||this.localName);clearTimeout(this.$skinTimer);if(this.skinName){this.$blur();this.$baseCSSname=null;}this.skinName=this.baseSkin;this.$pNodes={};this.$originalNodes=apf.skins.getTemplate(this.skinName,true);if(!this.$originalNodes){var a=this.skin;if(a){var n=this.skinName.split(":")[0];this.baseName=this.skinName="default:"+a;this.$originalNodes=apf.skins.getTemplate(this.skinName);if(!this.$originalNodes&&n!="default"){this.baseName=this.skinName=n+":"+this.localName;this.$originalNodes=apf.skins.getTemplate(this.skinName,true);}}if(!this.$originalNodes){this.baseName=this.skinName="default:"+this.localName;this.$originalNodes=apf.skins.getTemplate(this.skinName);}if(!this.$originalNodes){if(d){return(this.baseName=this.skinName=this.originalNode=null);}throw new Error(apf.formatErrorString(1077,this,"Presentation","Could not load skin: "+this.baseSkin));}}if(this.$originalNodes){apf.skins.setSkinPaths(this.skinName,this);}};this.$getNewContext=function(a,c){this.$pNodes[a]=this.$originalNodes[a].cloneNode(true);};this.$hasLayoutNode=function(a){return this.$originalNodes[a]?true:false;};this.$getLayoutNode=function(o,a,c){var d=this.$pNodes[o]||this.$originalNodes[o];if(!d){return false;}if(!a){return apf.getFirstElement(d);}var q=d.selectSingleNode("@"+a);if(!q){return null;}return(c?apf.queryNode(q.nodeValue,c):apf.getFirstElement(d).selectSingleNode(q.nodeValue));};this.$getOption=function(d,a){d=d.toLowerCase();var c=this.$pNodes[d]||this.$originalNodes[d];if(!a||!c){return c;}var n=c.selectSingleNode("@"+a);return n?n.nodeValue:"";};this.$getExternal=function(q,d,a,t){if(!d){d=this.$pHtmlNode;}if(!q){q="main";}q=q.toLowerCase();this.$getNewContext(q);var s=this.$getLayoutNode(q);var c;if(c=(t||this).getAttributeNode("style")){s.setAttribute("style",c.nodeValue);}if(c=(t||this).getAttributeNode("class")){this.$setStyleClass(s,(l=c.nodeValue));}if(a){a.call(this,s);}s=apf.insertHtmlNode(s,d);s.host=this;if(c=(t||this).getAttributeNode("bgimage")){s.style.backgroundImage="url("+apf.getAbsolutePath(this.mediaPath,c.nodeValue)+")";}if(!this.$baseCSSname){this.$baseCSSname=s.className.trim().split(" ")[0];}return s;};this.$focus=function(){if(!this.$ext){return;}this.$setStyleClass(this.oFocus||this.$ext,this.$baseCSSname+"Focus");};this.$blur=function(){if(this.renaming){this.stopRename(null,true);}if(!this.$ext){return;}this.$setStyleClass(this.oFocus||this.$ext,"",[this.$baseCSSname+"Focus"]);};this.$fixScrollBug=function(){if(this.$int!=this.$ext){this.oFocus=this.$int;}else{this.oFocus=this.$int=this.$ext.appendChild(document.createElement("div"));this.$int.style.height="100%";this.$int.className="focusbug";}};}).call(apf.Presentation.prototype=new apf.GuiElement());apf.config.$inheritProperties.skinset=1;apf.__VALIDATION__=1<<6;apf.validator={macro:{datatype:"apf.xsd.matchType(value, '",datatype_:"')",pattern:"value.match(",pattern_:")",custom:"(",custom_:")",min:"parseInt(value) >= ",max:"parseInt(value) <= ",maxlength:"value.toString().length <= ",minlength:"value.toString().length >= ",notnull:"value.toString().length > 0",checkequal:"!(temp = ",checkequal_:").isValid() || temp.getValue() == value"},compile:function(l){var i=this.macro,j=["var temp, valid = true;             if (!validityState)                 validityState = new apf.validator.validityState(); "];if(l.required){j.push("if (checkRequired && (!value || value.toString().trim().length == 0)) {                validityState.$reset();                validityState.valueMissing = true;                valid = false;            }");}j.push("validityState.$reset();            if (value) {");for(prop in l){if(!i[prop]){continue;}j.push("if (!(",i[prop],l[prop],i[prop+"_"]||"",")){                validityState.$set('",prop,"');                valid = false;            }");}j.push("};validityState.valid = valid; return validityState;");return new Function("value","checkRequired","validityState",j.join(""));}};apf.validator.validityState=function(){this.valueMissing=false,this.typeMismatch=false,this.patternMismatch=false,this.tooLong=false,this.rangeUnderflow=false,this.rangeOverflow=false,this.stepMismatch=false,this.customError=false,this.valid=true,this.$reset=function(){for(var c in this){if(c.substr(0,1)=="$"){continue;}this[c]=false;}this.valid=true;},this.$set=function(c){switch(c){case"min":this.rangeUnderflow=true;break;case"max":this.rangeOverflow=true;break;case"minlength":this.tooShort=true;break;case"maxlength":this.tooLong=true;break;case"pattern":this.patternMismatch=true;break;case"datatype":this.typeMismatch=true;break;case"notnull":this.typeMismatch=true;break;case"checkequal":this.typeMismatch=true;break;}};};apf.Validation=function(){this.$regbase=this.$regbase|apf.__VALIDATION__;this.isValid=function(i){if(!this.$vOptions){return true;}(this.$vOptions.isValid||(this.$vOptions.isValid=apf.validator.compile(this.$vOptions))).call(this,typeof this.getValue=="function"?this.getValue(null,true):null,i,this.validityState||(this.validityState=new apf.validator.validityState()));var d=this.validityState.valid;if(!d){this.dispatchEvent("invalid",this.validityState);}return d;};this.setCustomValidity=function(c){};this.showMe=function(){var c=this.parentNode;while(c){if(c.show){c.show();}c=c.parentNode;}};this.checkValidity=this.validate=function(i,j,l){if(l||!this.isValid(!i)&&!j){this.setError();return false;}else{this.clearError();return true;}};this.setError=function(i){if(!this.$validgroup){this.$propHandlers.validgroup.call(this,"vg"+this.parentNode.$uniqueId);}var d=this.$validgroup.getErrorBox(this);if(!this.$validgroup.allowMultipleErrors){this.$validgroup.hideAllErrors();}d.setMessage(this.invalidmsg);apf.setStyleClass(this.$ext,this.$baseCSSname+"Error");this.showMe();d.display(this);if(this.hasFeature(apf.__MULTISELECT__)&&this.validityState.$errorXml){this.select(this.validityState.$errorXml);}if(apf.document.activeElement&&apf.document.activeElement!=this){this.focus(null,{mouse:true});}};this.clearError=function(i){if(this.$setStyleClass){this.$setStyleClass(this.$ext,"",[this.$baseCSSname+"Error"]);}if(this.$validgroup){var d=this.$validgroup.getErrorBox(null,true);if(!d||d.host!=this){return;}d.hide();}};this.addEventListener("DOMNodeRemovedFromDocument",function(c){if(this.$validgroup){this.$validgroup.unregister(this);}});this.addEventListener("DOMNodeInsertedIntoDocument",function(c){if(!this.validgroup){this.$setInheritedAttribute("validgroup");}});this.$attrExcludePropBind=apf.extend({pattern:1,validtest:3},this.$attrExcludePropBind);this.$booleanProperties.required=true;this.$supportedProperties.push("validgroup","required","datatype","pattern","min","max","maxlength","minlength","validtest","notnull","checkequal","invalidmsg","requiredmsg");this.$fValidate=function(){if(this.contenteditable){return;}if(!this.$validgroup){this.validate(true);}else{var c=this.$validgroup.getErrorBox(this);if(!c.visible||c.host!=this){this.validate(true);}}};this.addEventListener("blur",this.$fValidate);this.$propHandlers.validgroup=function(i){if(i){var d;if(typeof i!="string"){this.$validgroup=i.name;d=i;}else{d=apf.nameserver.get("validgroup",i);}this.$validgroup=d||new apf.ValidationGroup(i);this.$validgroup.register(this);}else{this.$validgroup.unregister(this);this.$validgroup=null;}};this.$propHandlers.pattern=function(d,i){if(d.substr(0,1)!="/"){d="/"+d+"/";}(this.$vOptions||(this.$vOptions={}))[i]=d;delete this.$vOptions.isValid;};this.$propHandlers.datatype=this.$propHandlers.required=this.$propHandlers.custom=this.$propHandlers.min=this.$propHandlers.max=this.$propHandlers.maxlength=this.$propHandlers.minlength=this.$propHandlers.notnull=this.$propHandlers.checkequal=function(d,i){(this.$vOptions||(this.$vOptions={}))[i]=d;delete this.$vOptions.isValid;};this.$propHandlers.validtest=function(j){var i=this,l={};this.removeValidationCache=function(){l={};};this.$checkRemoteValidation=function(){var a=this.getValue();if(typeof l[a]=="boolean"){return l[a];}if(l[a]==-1){return true;}l[a]=-1;apf.getData(this.validtest,{xmlNode:this.xmlRoot,value:this.getValue(),callback:function(q,c,o){if(c!=apf.SUCCESS){if(c==apf.TIMEOUT&&o.retries<apf.maxHttpRetries){return o.tpModule.retry(o.id);}else{var d=new Error(apf.formatErrorString(0,i,"Validating entry at remote source","Communication error: \n\n"+o.message));if(i.dispatchEvent("error",apf.extend({error:d,state:status},o))!==false){throw d;}return;}}l[a]=apf.isTrue(q);if(!l[a]){if(!i.hasFocus()){i.setError();}}else{i.clearError();}}});return true;};(this.$vOptions||(this.$vOptions={})).custom="apf.lookup("+this.$uniqueId+").$checkRemoteValidation()";delete this.$vOptions.isValid;};};apf.GuiElement.propHandlers.datatype=apf.GuiElement.propHandlers.required=apf.GuiElement.propHandlers.pattern=apf.GuiElement.propHandlers.min=apf.GuiElement.propHandlers.max=apf.GuiElement.propHandlers.maxlength=apf.GuiElement.propHandlers.minlength=apf.GuiElement.propHandlers.notnull=apf.GuiElement.propHandlers.checkequal=apf.GuiElement.propHandlers.validtest=function(d,i){this.implement(apf.Validation);this.$propHandlers[i].call(this,d,i);};apf.ValidationGroup=function(c){this.$init();this.childNodes=[];if(c){apf.setReference(c,this);}this.name=c||"validgroup"+this.$uniqueId;apf.nameserver.register("validgroup",this.name,this);};(function(){this.validateVisibleOnly=false;this.allowMultipleErrors=false;this.register=function(o){if(o.hasFeature(apf.__VALIDATION__)){this.childNodes.push(o);}};this.unregister=function(o){this.childNodes.remove(o);};this.toString=function(){return"[APF Validation Group]";};var errbox;this.getErrorBox=function(o,no_create){if(this.allowMultipleErrors||!errbox&&!no_create){errbox=new apf.errorbox();errbox.$pHtmlNode=o.$ext.parentNode;errbox.skinset=apf.getInheritedAttribute(o.parentNode,"skinset");errbox.dispatchEvent("DOMNodeInsertedIntoDocument");}return errbox;};this.hideAllErrors=function(){if(errbox&&errbox.host){errbox.host.clearError();}};function checkValidChildren(oParent,ignoreReq,nosetError){var found;for(var v,i=0;i<oParent.childNodes.length;i++){var oEl=oParent.childNodes[i];if(!oEl){continue;}if(!oEl.disabled&&(!this.validateVisibleOnly&&oEl.visible||!oEl.$ext||oEl.$ext.offsetHeight)&&(oEl.hasFeature(apf.__VALIDATION__)&&oEl.isValid&&!oEl.isValid(!ignoreReq))){if(!nosetError){if(!found){oEl.validate(true,null,true);found=true;if(!this.allowMultipleErrors){return true;}}else{if(oEl.errBox&&oEl.errBox.host==oEl){oEl.errBox.hide();}}}else{if(!this.allowMultipleErrors){return true;}}}if(oEl.canHaveChildren&&oEl.childNodes.length){found=checkValidChildren.call(this,oEl,ignoreReq,nosetError)||found;if(found&&!this.allowMultipleErrors){return true;}}}return found;}this.checkValidity=this.validate=this.isValid=function(ignoreReq,nosetError,page){var found=checkValidChildren.call(this,page||this,ignoreReq,nosetError);if(page){if(page.validation&&!eval(page.validation)){alert(page.invalidmsg);found=true;}}return !found;};}).call(apf.ValidationGroup.prototype=new apf.Class());apf.config.$inheritProperties.validgroup=1;apf.__DATABINDING__=1<<1;apf.DataBinding=function(){this.$init(true);this.$loadqueue=this.$dbTimer=null;this.$regbase=this.$regbase|apf.__DATABINDING__;this.$mainBind="value";this.$bindings=this.$cbindings=this.$attrBindings=false;this.$attrExcludePropBind=apf.extend({model:1,taverse:1,valuerule:1},this.$attrExcludePropBind);this.setQueryValue=function(n,a,d){var c=apf.createNodeFromXpath(this[d||"xmlRoot"],n);if(!c){return null;}apf.setNodeValue(c,a,true);return c;};this.queryValue=function(c,a){return apf.queryValue(this[a||"xmlRoot"],c);};this.queryValues=function(c,a){return apf.queryValues(this[a||"xmlRoot"],c);};this.queryNode=function(d,c){var a=this[c||"xmlRoot"];return a?a.selectSingleNode(d):null;};this.queryNodes=function(d,c){var a=this[c||"xmlRoot"];return a?a.selectNodes(d):[];};this.$checkLoadQueue=function(){if(this.$loadqueue){this.xmlRoot=null;var a=this.load(this.$loadqueue[0],{cacheId:this.$loadqueue[1]});if(!a||a.dataType!=apf.ARRAY||a!=this.$loadqueue){this.$loadqueue=null;}}};this.$execProperty=function(s,c){var d=this.$attrBindings[s];apf.$lm_has_lang=false;try{if(d.cvalue.asyncs){var q=this;return d.cvalue.call(this,c,function(m){q.setProperty(s,m,true);if(apf.$lm_has_lang){apf.language.addProperty(this,s,d.cvalue);}});}else{var a=d.cvalue.call(this,c);}}catch(t){apf.console.warn("[400] Could not execute binding for property "+s+"\n\n"+t.message);return;}this.setProperty(s,a,true);if(apf.$lm_has_lang){apf.language.addProperty(this,s,d.cvalue);}};this.$applyBindRule=function(d,c,o,q){var a=this.$attrBindings[d]&&this.$attrBindings[d].cvalue||this.$cbindings[d];return a?a.call(this,c,q):o||"";};this.$hasBindRule=function(a){return this.$attrBindings[a]||this.$bindings&&this.$bindings[a];};this.$getBindRule=function(c,a){return this.$attrBindings[c]||this.$bindings&&this.$bindings.getRule(c,a);};var l={drag:1,drop:1,dragcopy:1};this.$getDataNode=function(c,a,u,d,t){var z,w=this.$attrBindings[c];if(w){if(w.cvalue.type!=3){return false;}var A=w.cvalue2||w.compile("value",{xpathmode:t?4:3,parsecode:1,injectself:l[c]});if(A&&(z=A(a,u))){if(d){d.push(w);}return z;}return false;}return this.$bindings&&this.$bindings.getDataNode(c,a,u,d,t);};this.setModel=function(a){this.setAttribute("model",a,false,true);};this.getModel=function(a){if(a&&!this.$model){return this.dataParent?this.dataParent.parent.getModel(true):null;}return this.$model;};this.reload=function(){this.load(this.xmlRoot,{cacheId:this.cacheId,force:true});};this.load=function(d,q){if(q){var t=q.cacheId,a=q.force,s=q.noClearMsg;}if(t&&t==this.cacheId&&!a){return;}if(apf.popup.isShowing(this.$uniqueId)){apf.popup.forceHide();}if(d){if(typeof d=="string"){if(d.charAt(0)=="<"){d=apf.getXmlDom(d).documentElement;}else{return apf.model.prototype.$loadFrom.call(this,d,q);}}else{if(d.nodeType==9){d=d.documentElement;}else{if(d.nodeType==3||d.nodeType==4){d=d.parentNode;}else{if(d.nodeType==2){d=d.ownerElement||d.parentNode||d.selectSingleNode("..");}}}}}if(this.$preventDataLoad||!this.$canLoadData&&((!this.$bindings&&!this.$canLoadDataAttr)||!this.$amlLoaded)&&(!this.hasFeature(apf.__MULTISELECT__)||!(this.each||this.$template))||this.$canLoadData&&!this.$canLoadData()){this.xmlRoot=d;return this.$loadqueue=[d,t];}if(this.dataParent&&this.dataParent.xpath){this.dataParent.parent.signalXmlUpdate[this.$uniqueId]=!d;}if(!d&&(!t||!this.$isCached||!this.$isCached(t))){this.clear(s);if(apf.config.autoDisable&&this.$createModel===false){this.setProperty("disabled",true);}return;}var c=this.disabled;this.disabled=false;if(this.dispatchEvent("beforeload",{xmlNode:d})===false){return false;}if(this.caching&&!a&&d&&d==this.xmlRoot){return;}this.clear(true,true);this.cacheId=t;if(this.dispatchEvent("$load",{forceNoCache:a,xmlNode:d})===false){delete this.cacheId;return;}this.documentId=apf.xmldb.getXmlDocId(d);this.xmlRoot=d;this.setProperty("root",this.xmlRoot);apf.$lm_has_lang=false;this.$load(d);if(apf.$lm_has_lang){apf.language.addBinding(this);}else{apf.language.removeBinding(this);}this.$loadSubData(d);if(this.$createModel===false){this.disabled=true;this.setProperty("disabled",false);}else{this.disabled=c;}this.dispatchEvent("afterload",{xmlNode:d});};this.$loadSubData=function(o){if(this.$hasLoadStatus(o)){return;}var q,a=this.$getBindRule("load",o);if(a&&(!a[1]||a[1](o))){if(typeof apf.offline!="undefined"&&!apf.offline.onLine){apf.offline.transactions.actionNotAllowed();this.$loadedWhenOffline=true;if(this.$setClearMessage&&!this.getTraverseNodes().length){this.$setClearMessage(this["offline-message"],"offline");}return;}this.$setLoadStatus(o,"loading");if(this.$setClearMessage){this.$setClearMessage(this["loading-message"],"loading");}var c=this.getModel(true);var d=this;if(c.$insertFrom(a.getAttribute("get"),{xmlNode:q,insertPoint:o,amlNode:this,callback:function(){d.setProperty(d.hasFeature(apf.__MULTISELECT__)?"selected":"root",o);}})===false){this.clear(true);if(apf.config.autoDisable){this.setProperty("disabled",true);}}}};this.clear=function(c,q,d){if(!this.$int){return;}if(this.clearSelection){this.clearSelection(!q);}var a=this.$int.offsetHeight;if(this.dispatchEvent("$clear")!==false){this.$int.innerHTML="";}if(typeof c=="string"){var o=c;c=false;if(!this[o+"-message"]){this.$setInheritedAttribute(o+"-message");}}this.$lastClearType=o||null;if(!c&&this.$setClearMessage){this.$setClearMessage(o?this[o+"-message"]:this["empty-message"],o||"empty",a);}else{if(this.$removeClearMessage){this.$removeClearMessage();}}if(!d){this.documentId=this.xmlRoot=this.cacheId=null;}if(!c){if(this.hasFeature(apf.__MULTISELECT__)){this.setProperty("length",0);}}};this.clearMessage=function(a){this.customMsg=a;this.clear("custom");};this.$setLoadStatus=function(d,a,n){var c=d.getAttribute("a_loaded");c=c?c.replace(new RegExp("\\|\\w+\\:"+this.$uniqueId+"\\|","g"),""):"";if(!n){c+="|"+a+":"+this.$uniqueId+"|";}d.setAttribute("a_loaded",c);};this.$removeLoadStatus=function(a){this.$setLoadStatus(a,null,true);};this.$hasLoadStatus=function(d,a){var c=d.getAttribute("a_loaded");if(!c){return false;}return(c.indexOf((a||"")+":"+this.$uniqueId+"|")!=-1);};this.insert=function(c,n){if(typeof c=="string"){if(c.charAt(0)=="<"){c=apf.getXmlDom(c).documentElement;}else{if(!n.insertPoint){n.insertPoint=this.xmlRoot;}return apf.model.prototype.$insertFrom.call(this,c,n);}}var a=n.insertPoint||this.xmlRoot;if(this.dispatchEvent("beforeinsert",{xmlParentNode:a})===false){return false;}if(typeof n.copyAttributes=="undefined"){n.copyAttributes=true;}var d=apf.mergeXml(c,a,n);apf.xmldb.applyChanges("insert",a);if(this.selectable&&this.autoselect){if(this.xmlNode==d){this.$selectDefault(this.xmlNode);}}else{if(this.xmlNode==d){this.setProperty("root",this.xmlNode);}}if(this.$hasLoadStatus(a,"loading")){this.$setLoadStatus(a,"loaded");}this.dispatchEvent("afterinsert");};this.$booleanProperties["render-root"]=true;this.$supportedProperties.push("empty-message","loading-message","offline-message","render-root","smartbinding","bindings","actions");this.$propHandlers["render-root"]=function(a){this.renderRoot=a;};this.$propHandlers["empty-message"]=function(a){this["empty-message"]=a;if(this.$updateClearMessage){this.$updateClearMessage(this["empty-message"],"empty");}};this.$propHandlers["loading-message"]=function(a){this["loading-message"]=a;if(this.$updateClearMessage){this.$updateClearMessage(this["loading-message"],"loading");}};this.$propHandlers["offline-message"]=function(a){this["offline-message"]=a;if(this.$updateClearMessage){this.$updateClearMessage(this["offline-message"],"offline");}};this.$propHandlers.smartbinding=this.$propHandlers.actions=this.$propHandlers.bindings=function(c,a){var d="$"+a;if(this[d]){this[d].unregister(this);}if(!c){return;}apf.nameserver.get(a,c).register(this);if(a!="actions"){this.$checkLoadQueue();}};var j={caption:1,icon:1,select:1,css:1,sort:1,drop:2,drag:2,dragcopy:2,eachvalue:1};this.$addAttrBind=function(C,m,F){if(m.models){if(this.hasFeature(apf.__MULTISELECT__)){}}var c,I,D,a,d=m.xpaths,G={};for(c=0;c<d.length;c+=2){if(!G[(D=d[c])]){G[D]=1;}else{G[D]++;}}if(!this.$propsUsingMainModel){this.$propsUsingMainModel={};}var E=(this.$attrBindings||(this.$attrBindings={}))[C]={cvalue:m,value:F,compile:apf.BindingRule.prototype.$compile,models:[]};delete this.$propsUsingMainModel[C];for(I,c=0;c<d.length;c+=2){D=d[c];if(G[D]==-1){continue;}I=d[c+1];if(D=="#"||I=="#"){var B=(E.cvalue3||(E.cvalue3=apf.lm.compile(E.value,{xpathmode:5})))(this.xmlRoot);if(typeof B!="string"){a=B.model&&B.model.nodeFunc&&B.model;if(a){I=B.xpath;}else{a=apf.xmldb.findModel(B.model);I=apf.xmlToXpath(B.model,a.data)+(B.xpath?"/"+B.xpath:"");}}else{a=null;}}else{a=null;}if(!a){if(D){a=apf.nameserver.get("model",D)||apf.setReference(D,apf.nameserver.register("model",D,new apf.model()));}else{if(!this.$model&&!this.$initingModel){i.call(this);}a=this.$model;this.$propsUsingMainModel[C]={xpath:I,optimize:G[D]==1};}}if(a&&(!this.hasFeature(apf.__MULTISELECT__)&&j[C]!=2||!j[C])){a.$bindXmlProperty(this,C,I,G[D]==1,F.indexOf("*[")>-1);E.models.push(a);}G[D]=-1;}E.xpath=I;this.$canLoadDataAttr=j[C]==1;this.$checkLoadQueue();};this.$removeAttrBind=function(o){var c=this.$attrBindings[o];if(!c){return;}delete this.$attrBindings[o];var a=c.models;for(var d=0;d<a.length;d++){a[d].$unbindXmlProperty(this,o);}};this.$initingModel;function i(){this.$initingModel=true;this.$setInheritedAttribute("model");}this.addEventListener("DOMNodeInsertedIntoDocument",function(a){if(!this.model&&this.$setClearMessage&&!this.value){this.$setClearMessage(this["empty-message"],"empty");}this.$amlLoaded=true;this.$checkLoadQueue();});this.addEventListener("DOMNodeRemovedFromDocument",function(a){apf.language.removeBinding(this);});this.$propHandlers.model=function(u){if(!u&&!this.$modelParsed){if(this.$model){this.clear();this.$model.unregister(this);this.$model=null;this.lastModelId="";}else{if(this.dataParent){this.dataParent.parent=null;}}return;}this.$initingModel=true;var c;if((c=this.$modelParsed)&&c.type!=2){var w,a=c.props;if(this.dataParent){this.dataParent=null;}for(var t in a){if(typeof a[t]=="function"){continue;}this.dataParent={parent:self[t.split(".")[0]],xpath:null,model:this.$modelParsed.instruction};w=true;break;}if(w){if(this.dataParent&&!this.dataParent.signalXmlUpdate){this.dataParent.signalXmlUpdate={};}}this.$modelParsed=null;}var d;if(typeof u=="object"){if(u.dataType==apf.ARRAY){d=apf.nameserver.get("model",u[0]);d.register(this,u[1]);return;}else{if(u.nodeFunc){d=u;u=this.model=d.name;if(!u){d.setProperty("id",u=this.model="model"+d.$uniqueId);}}else{if(this.dataParent){this.model=this.dataParent.model;d=apf.xmldb.findModel(u);var s=apf.xmlToXpath(u,d.data,true)||".";d.register(this,s);return;}else{}}}}apf.setModel(u,this);};this.$propHandlers.viewport=function(a){if(a!="virtual"){return;}this.implement(apf.VirtualViewport);};};apf.DataBinding.prototype=apf.Presentation?new apf.Presentation():new apf.AmlElement();apf.config.$inheritProperties.model=1;apf.config.$inheritProperties["empty-message"]=1;apf.config.$inheritProperties["loading-message"]=1;apf.config.$inheritProperties["offline-message"]=1;apf.config.$inheritProperties.noloading=1;apf.Init.run("databinding");apf.MultiselectBinding=function(){if(!this.setQueryValue){this.implement(apf.DataBinding);}this.$init(function(){this.$selectTimer={};});};(function(){this.length=0;this.$attrExcludePropBind=apf.extend({caption:2,icon:2,eachvalue:2,select:2,css:2,sort:2,drag:2,drop:2,dragcopy:2,selected:2,each:1,selection:3,"selection-unique":3,"selection-constructor":3},this.$attrExcludePropBind);this.resort=function(m,o,n){if(!this.$sort){this.$sort=new apf.Sort();}this.$sort.set(m,o);if(this.clearAllCache){this.clearAllCache();}if(n){return;}var q=this;(function a(u,i){var l=q.$sort.apply(apf.getArrayFromNodelist(u.selectNodes(q.each)));for(var w=0;w<l.length;w++){if(q.$isTreeArch||q.$withContainer){var j=apf.xmldb.findHtmlNode(l[w],q);var d=q.$findContainer(j);i.appendChild(j);if(!apf.isChildOf(j,d,true)){i.appendChild(d);}a(l[w],d);}else{i.appendChild(apf.xmldb.findHtmlNode(l[w],q));}}})(this.xmlRoot,this.$int);return m;};this.toggleSortOrder=function(){return this.resort({ascending:!this.$sort.get().ascending}).ascending;};this.getSortSettings=function(){return this.$sort.get();};this.getTraverseNodes=function(a){if(this.$sort){var i=apf.getArrayFromNodelist((a||this.xmlRoot).selectNodes(this.each));return this.$sort.apply(i);}return(a||this.xmlRoot).selectNodes(this.each);};this.getFirstTraverseNode=function(a){if(this.$sort){var i=(a||this.xmlRoot).selectNodes(this.each);return this.$sort.apply(i)[0];}return(a||this.xmlRoot).selectSingleNode(this.each);};this.getLastTraverseNode=function(a){var i=this.getTraverseNodes(a||this.xmlRoot);return i[i.length-1];};this.isTraverseNode=function(a){var l=this.getTraverseNodes(this.getTraverseParent(a)||this.xmlRoot);for(var i=0;i<l.length;i++){if(l[i]==a){return true;}}return false;};this.getNextTraverseSelected=function(i,t,s){if(!i){i=this.selected;}if(!s){s=1;}var o=0;var q=this.getTraverseNodes(this.getTraverseParent(i)||this.xmlRoot);while(q[o]&&q[o]!=i){o++;}var a=(t==null)?q[o+s]||q[o-s]:(t?q[o+s]:q[o-s]);return a||s&&(o<s||(o+1)>Math.floor(q.length/s)*s)?a:(t?q[q.length-1]:q[0]);};this.getNextTraverse=function(i,q,a){if(!a){a=1;}if(!i){i=this.selected;}var n=0;var o=this.getTraverseNodes(this.getTraverseParent(i)||this.xmlRoot);while(o[n]&&o[n]!=i){n++;}return o[n+(q?-1*a:a)];};this.getTraverseParent=function(j){if(!j.parentNode||j==this.xmlRoot){return false;}var l,a=j.getAttribute(apf.xmldb.xmlIdTag);if(!a){j.setAttribute(apf.xmldb.xmlIdTag,"temp");a="temp";}l=j.selectSingleNode("ancestor::node()[(("+this.each+")/@"+apf.xmldb.xmlIdTag+")='"+a+"']");if(a=="temp"){j.removeAttribute(apf.xmldb.xmlIdTag);}return l;};if(!this.$findHtmlNode){this.$findHtmlNode=function(a){return this.$pHtmlDoc.getElementById(a);};}this.$setClearMessage=function(a,o,m){if(!this.$empty){if(!this.$hasLayoutNode("empty")){return;}this.$getNewContext("empty");var q=this.$getLayoutNode("empty");if(!q){return;}this.$empty=apf.insertHtmlNode(q,this.$int);}else{this.$int.appendChild(this.$empty);}var n=this.$getLayoutNode("empty","caption",this.$empty);if(n){apf.setNodeValue(n,a||"");}this.$empty.setAttribute("id","empty"+this.$uniqueId);apf.setStyleClass(this.$empty,o,["loading","empty","offline"]);this.$empty.style.height=(m&&!apf.getStyle(this.$ext,"height")&&o!="empty")?(Math.max(10,(m-apf.getHeightDiff(this.$empty)-apf.getHeightDiff(this.$ext)))+"px"):"";};this.$updateClearMessage=function(a,l){if(!this.$empty||this.$empty.parentNode!=this.$int||this.$empty.className.indexOf(l)==-1){return;}var j=this.$getLayoutNode("empty","caption",this.$empty);if(j){apf.setNodeValue(j,a||"");}};this.$removeClearMessage=function(){if(!this.$empty){this.$empty=document.getElementById("empty"+this.$uniqueId);}if(this.$empty&&this.$empty.parentNode){this.$empty.parentNode.removeChild(this.$empty);}};this.$load=function(a){apf.xmldb.addNodeListener(a,this);var z=this.getTraverseNodes(a).length;if(!this.renderRoot&&!z){return this.clear(null,null,true);}var B=this.$addNodes(a,null,null,this.renderRoot);this.$fill(B);if(this.selectable){var A,i=(typeof apf.offline!="undefined");if(!this.firstLoad&&i&&apf.offline.state.enabled&&apf.offline.state.realtime){A=apf.offline.state.get(this,"selection");this.firstLoad=true;}if(A){var w=apf.offline.state.get(this,"selstate");if(A.length==0){this.clearSelection();}else{for(var t=0;t<A.length;t++){A[t]=apf.xpathToXml(A[t],this.xmlRoot);}if(w[1]){var u=apf.remote.xpathToXml(w[1],this.xmlRoot);}this.selectList(A,null,u);}if(w[0]){this.setCaret(apf.remote.xpathToXml(w[0],this.xmlRoot));}}else{if(this.autoselect){if(!this.selected){if(this.renderRoot){this.select(a,null,null,null,true);}else{if(B.length){this.$selectDefault(a);}}}}else{this.clearSelection(true);var C=this.renderRoot?this.xmlRoot:this.getFirstTraverseNode();if(C){this.setCaret(C);}if(this.selected){this.setProperty("selected",null);}if(this.choosen){this.setProperty("choosen",null);}}}}if(this.focussable){apf.document.activeElement==this?this.$focus():this.$blur();}if(z!=this.length){this.setProperty("length",z);}};var c={insert:127,add:123,remove:46,"redo-remove":79,synchronize:127,"move-away":105,move:77};this.$xmlUpdate=function(O,aa,Q,W,R){if(!this.xmlRoot){return;}var J,Y,ad,P,o=aa;if(!Q){Q=this.xmlRoot;}if(O=="redo-remove"){R.appendChild(aa);var K=this.isTraverseNode(aa);R.removeChild(aa);if(!K){aa=R;}}do{if(O=="add"&&this.isTraverseNode(aa)&&o==aa){break;}if(aa.getAttribute(apf.xmldb.xmlIdTag)){P=this.$findHtmlNode(aa.getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId);if(P&&(o!=aa||aa==this.xmlRoot)&&c[O]&1){O="update";}if(aa==Q){if(aa==this.xmlRoot&&O!="insert"){this.dispatchEvent("xmlupdate",{action:O,xmlNode:aa,UndoObj:W});return;}break;}if(P&&c[O]&2&&!this.isTraverseNode(aa)){O="remove";}if(!P&&c[O]&4&&this.isTraverseNode(aa)){O="add";break;}if(P||O=="move"){break;}}else{if(c[O]&8&&this.isTraverseNode(aa)){O="add";break;}}if(aa==Q){break;}aa=aa.parentNode;}while(aa&&aa.nodeType!=9);apf.$lm_has_lang=false;if(this.hasFeature(apf.__VIRTUALVIEWPORT__)){if(!this.$isInViewport(aa)){return;}}var ab=aa;if(aa&&aa.nodeType==9){aa=o;}if(O=="replacechild"&&(W?W.args[0]==this.xmlRoot:!this.xmlRoot.parentNode)){return this.load(W?W.args[1]:Q);}if(W&&aa&&!W.xmlNode){W.xmlNode=aa;}if(O=="move"&&ab==o){var a=apf.isChildOf(this.xmlRoot,aa.parentNode,true);var V=apf.isChildOf(this.xmlRoot,W.extra.parent,true);if(a&&V){this.$moveNode(aa,P);}else{if(a){O="add";}else{if(V){O="remove";}}}}else{if(O=="move-away"){var U=apf.isChildOf(this.xmlRoot,W.extra.parent,true);if(!U){O="remove";}}}if(this.$removeClearMessage&&this.$setClearMessage){if(this.getFirstTraverseNode()){this.$removeClearMessage();}else{this.$setClearMessage(this["empty-message"],"empty");}}if(O=="insert"&&(this.$isTreeArch||aa==this.xmlRoot)){if(!aa){return;}if(this.$hasLoadStatus(aa)&&this.$removeLoading){this.$removeLoading(P);}if(this.$int.firstChild&&!apf.xmldb.getNode(this.$int.firstChild)){this.$int.innerHTML="";if(!this.renderRoot){Y=this.getTraverseNodes().length;if(!Y){this.clear();}}}J=this.$addNodes(aa,(this.$getParentNode?this.$getParentNode(P):P),true,false);this.$fill(J);if(this.selectable&&(Y===0||!this.xmlRoot.selectSingleNode(this.each))){return;}}else{if(O=="add"){var N;ad=this.getTraverseParent(aa);if(ad==this.xmlRoot){N=this.$int;}if(!N&&this.$isTreeArch){N=this.$findHtmlNode(ad.getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId);}if(!N&&this.getCacheItem){N=this.getCacheItem(ad.getAttribute(apf.xmldb.xmlIdTag)||(ad.getAttribute(apf.xmldb.xmlDocTag)?"doc"+ad.getAttribute(apf.xmldb.xmlDocTag):false));}if(N||this.$isTreeArch&&apf.isChildOf(this.xmlRoot,aa)){N=(this.$findContainer&&N?this.$findContainer(N):N)||this.$int;J=this.$addNodes(aa,N,true,true,apf.xmldb.getHtmlNode(this.getNextTraverse(aa),this));if(N){this.$fill(J);}}}else{if(O=="remove"){if(!aa||o!=aa){return;}if(P){this.$deInitNode(aa,P);}else{if(aa==this.xmlRoot){return this.load({noClearMsg:!this.dataParent||!this.dataParent.autoselect});}}}else{if(P){this.$updateNode(aa,P);if(O=="replacechild"&&this.hasFeature(apf.__MULTISELECT__)&&this.selected&&aa.getAttribute(apf.xmldb.xmlIdTag)==this.selected.getAttribute(apf.xmldb.xmlIdTag)){this.selected=aa;}}else{if(O=="redo-remove"){var ac=this.xmlRoot;while(ac&&ac.nodeType!=9){ac=ac.parentNode;}if(!ac){var Z=this.getModel(true);return Z.$waitForXml(this);}}}}}}if(apf.$lm_has_lang){apf.language.addBinding(this);}ad=aa?aa.parentNode:R;if(this.$isTreeArch&&ad&&ad.nodeType==1){do{P=this.$findHtmlNode(ad.getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId);if(P){this.$updateNode(ad,P);}}while((ad=this.getTraverseParent(ad))&&ad.nodeType==1);}if(c[O]&32&&this.selectable&&o==aa&&(O!="insert"||aa==this.xmlRoot)){clearTimeout(this.$selectTimer.timer);if(O=="remove"&&apf.isChildOf(aa,this.selected,true)||aa==this.$selectTimer.nextNode){this.$selectTimer.nextNode=this.getDefaultNext(aa,this.$isTreeArch);}var X=this;this.$selectTimer.timer=$setTimeout(function(){X.$checkSelection(X.$selectTimer.nextNode);X.$selectTimer.nextNode=null;});}if(c[O]&64){if(!Y){Y=this.xmlRoot.selectNodes(this.each).length;}if(Y!=this.length){this.setProperty("length",Y);}}if(this.signalXmlUpdate&&c[O]&16){var M;for(M in this.signalXmlUpdate){if(parseInt(M)!=M){continue;}var T=apf.lookup(M);if(!this.selected){continue;}aa=this.selected.selectSingleNode(T.dataParent.xpath);if(!aa){continue;}T.load(aa);}}this.dispatchEvent("xmlupdate",{action:O,xmlNode:aa,result:J,UndoObj:W});};this.$addNodes=function(F,G,B,C,i){var I,E;C=(C&&(this.renderRoot&&F==this.xmlRoot||this.isTraverseNode(F)));var D=C?[F]:this.getTraverseNodes(F);for(var A=0;A<D.length;A++){if(D[A].nodeType!=1){continue;}if(B){I=this.$findHtmlNode(D[A].getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId);}if(!I){var a=apf.xmldb.nodeConnect(this.documentId,D[A],null,this);var J=C?i:(E?E.nextSibling:null),z=this.$add(D[A],a,C?F.parentNode:F,J?G||this.$int:G,J,(!J&&A==D.length-1));if(z===false){break;}}if(B){E=I;}}return D;};this.$handleBindingRule=function(j,a){if(!j){this[a]=null;}if(a=="each"){if(j.indexOf("::")>-1){j=j.replace(/^\[|\]$/g,"").split("::");this.setProperty("model",j[0]);this.each=j[1];}else{this.each=j.replace(/^\[|\]$/g,"");}}if(false&&this.xmlRoot&&!this.$bindRuleTimer&&this.$amlLoaded){var l=this;apf.queue.add("reload"+this.$uniqueId,function(){l.reload();});}};this.$select=function(a){if(this.renaming){this.stopRename(null,true);}if(!a||!a.style){return;}return this.$setStyleClass(a,"selected");};this.$deselect=function(a){if(this.renaming){this.stopRename(null,true);if(this.ctrlselect){return false;}}if(!a){return;}return this.$setStyleClass(a,"",["selected","indicate"]);};this.$indicate=function(a){if(this.renaming){this.stopRename(null,true);}if(!a){return;}return this.$setStyleClass(a,"indicate");};this.$deindicate=function(a){if(this.renaming){this.stopRename(null,true);}if(!a){return;}return this.$setStyleClass(a,"",["indicate"]);};this.$propHandlers.each=this.$propHandlers.caption=this.$propHandlers.eachvalue=this.$propHandlers.icon=this.$propHandlers.tooltip=this.$handleBindingRule;this.$propHandlers.sort=function(a){if(a){this.$sort=new apf.Sort();this.$sort.set({getValue:apf.lm.compile(a)});}else{this.$sort=null;}};}).call(apf.MultiselectBinding.prototype=new apf.DataBinding());apf.StandardBinding=function(){this.$init(true);if(apf.Validation){this.implement(apf.Validation);}if(!this.setQueryValue){this.implement(apf.DataBinding);}if(!this.defaultValue){this.defaultValue="";}this.$load=function(w){apf.xmldb.addNodeListener(w,this);var q,s,o,t,n,u;if(q=this.$bindings){for(o in q){s=o.toLowerCase();if(this.$supportedProperties.indexOf(s)>-1){n=(t=q[s]).length==1?t[0]:this.$getBindRule(s,w);u=n.value||n.match;this.$clearDynamicProperty(s);if(u.indexOf("{")>-1||u.indexOf("[")>-1){this.$setDynamicProperty(s,u);}else{if(this.setProperty){this.setProperty(s,u,true);}}}}}if(this.errBox&&this.isValid&&this.isValid()){this.clearError();}};this.$xmlUpdate=function(E,J,I,A){if(E=="redo-remove"){var G=false,D=this.getModel(true);if(D){var B=D.getXpathByAmlNode(this);if(B){J=D.data.selectSingleNode(B);if(J!=this.xmlRoot){G=true;}}}if(G||this.xmlRoot==J){return D.$waitForXml(this);}}if(A&&!A.xmlNode){A.xmlNode=this.xmlRoot;}var w,F,z,M,C,K;if(w=this.$bindings){for(z in w){F=z.toLowerCase();if(this.$supportedProperties.indexOf(F)>-1){C=(M=w[F]).length==1?M[0]:this.$getBindRule(F,J);K=C.value||C.match;this.$clearDynamicProperty(F);if(K.indexOf("{")>-1||K.indexOf("[")>-1){this.$setDynamicProperty(F,K);}else{if(this.setProperty){this.setProperty(F,K);}}}}}if(this.errBox&&this.isValid&&this.isValid()){this.clearError();}this.dispatchEvent("xmlupdate",{action:E,xmlNode:J,UndoObj:A});};this.addEventListener("$clear",function(i,d){if(this.$propHandlers&&this.$propHandlers.value){this.value=-99999;this.$propHandlers.value.call(this,"");}});};apf.StandardBinding.prototype=new apf.DataBinding();apf.Init.run("standardbinding");apf.__MULTISELECT__=1<<8;apf.MultiSelect=function(){this.$init(function(){this.$valueList=[];this.$selectedList=[];});};(function(){this.$regbase=this.$regbase|apf.__MULTISELECT__;this.sellength=0;this.selected=null;this.$selected=null;this.caret=null;this.$caret=null;this.useindicator=true;this.remove=function(m){if(!m){m=this.$valueList;}if(m.nodeType){m=[m];}if(!m||!m.length){return;}var a=[];for(var c=0;c<m.length;c++){a.push({func:"removeNode",args:[m[c]]});}if(this.$actions.removegroup){return this.$executeAction("multicall",a,"removegroup",m[0]);}else{return this.$executeAction("multicall",a,"remove",m[0],null,null,m.length>1?m:null);}};this.add=function(I,G,J,E){var K;if(this.$actions){if(I&&I.nodeType){K=this.$actions.getRule("add",I);}else{if(typeof I=="string"){if(I.trim().charAt(0)=="<"){I=apf.getXml(I);K=this.$actions.getRule("add",I);}else{var l=this.$actions.add;for(var B=0,C=l.length;B<C;B++){if(l[B][2].getAttribute("type")==I){I=null;K=l[B];break;}}}}}if(!K){K=(this.$actions.add||{})[0];}}else{K=null;}var a=(typeof apf.offline!="undefined");if(a&&!apf.offline.canTransact()){return false;}if(a&&!apf.offline.onLine&&(!I||!K.get)){return false;}var c=this.$isTreeArch?this.selected||this.xmlRoot:this.xmlRoot,D=this,F=function(q,o,m){if(o!=apf.SUCCESS){var n;n=new Error(apf.formatErrorString(1032,D,"Loading xml data","Could not add data for control "+D.name+"["+D.tagName+"] \nUrl: "+m.url+"\nInfo: "+m.message+"\n\n"+I));if(m.tpModule.retryTimeout(m,o,D,n)===true){return true;}throw n;}if(typeof q!="object"){q=apf.getXmlDom(q).documentElement;}if(q.getAttribute(apf.xmldb.xmlIdTag)){q.setAttribute(apf.xmldb.xmlIdTag,"");}var j=D.$actions&&D.$actions.getRule("add",D.$isTreeArch?D.selected:D.xmlRoot);if(!G){if(j&&j.parent){G=(j.cparent||j.compile("parent",{xpathmode:2,injectself:true}))(D.$isTreeArch?D.selected||D.xmlRoot:D.xmlRoot);}else{G=D.$isTreeArch?D.selected||D.xmlRoot:D.xmlRoot;}}if(!G){G=D.xmlRoot;}if(apf.isWebkit&&G.ownerDocument!=q.ownerDocument){q=G.ownerDocument.importNode(q,true);}if(D.$executeAction("appendChild",[G,q,J],"add",q)!==false&&D.autoselect){D.select(q);}if(E){E.call(D,q);}return q;};if(I){return F(I,apf.SUCCESS);}else{if(K.get){return apf.getData(K.get,{xmlNode:c,callback:F});}else{}}return addXmlNode;};if(!this.setValue){this.setValue=function(a,c){noEvent=c;this.setProperty("value",a,false,true);noEvent=false;};}this.findXmlNodeByValue=function(a){var n=this.getTraverseNodes(),o=this.$attrBindings.eachvalue&&"eachvalue"||this.$bindings.value&&"value"||this.$hasBindRule("caption")&&"caption";if(!o){return false;}for(var c=0;c<n.length;c++){if(this.$applyBindRule(o,n[c])==a){return n[c];}}};if(!this.getValue){this.getValue=function(a,c){return this.value;};}this.reselect=function(){if(this.selected){this.select(this.selected,null,this.ctrlselect,null,true);}};this.select=function(G,E,J,B,D,c){if(!this.selectable||this.disabled){return;}if(this.$skipSelect){this.$skipSelect=false;return;}if(this.ctrlselect&&!J){E=true;}if(!this.multiselect){E=J=false;}if(!this.xmlRoot){if(!this.$buffered){var a;this.addEventListener("afterload",a=function(){this.select.apply(this,this.$buffered);this.removeEventListener("afterload",a);delete this.$buffered;});}this.$buffered=Array.prototype.slice.call(arguments);return;}var I;if(!G){return false;}if(typeof G!="object"){var K=G;G=null;if(typeof G=="string"){G=apf.xmldb.getNodeById(K);}if(!G){G=this.findXmlNodeByValue(K);if(!G){this.clearSelection(c);return;}}}if(!G.style){I=this.$findHtmlNode(G.getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId);}else{var F=(I=G).getAttribute(apf.xmldb.htmlIdTag);while(!F&&I.parentNode){F=(I=I.parentNode).getAttribute(apf.xmldb.htmlIdTag);}G=apf.xmldb.getNodeById(F);}if(this.dispatchEvent("beforeselect",{selected:G,htmlNode:I,ctrlKey:E,shiftKey:J,force:D,captureOnly:c})===false){return false;}var C=this.caret;this.caret=G;if(J){var A=this.$calcSelectRange(this.$valueList[0]||C,G);if(this.$caret){this.$deindicate(this.$caret);}this.selectList(A);this.$selected=this.$caret=this.$indicate(I);}else{if(E){if(this.$valueList.contains(G)){if(this.selected==G){this.$deselect(this.$findHtmlNode(this.selected.getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId));this.$deindicate(this.$caret);if(this.$valueList.length&&!B){this.selected=this.$valueList[0];}}else{this.$deselect(I,G);}if(!B){this.$selectedList.remove(I);this.$valueList.remove(G);}if(I!=this.$caret){this.$deindicate(this.$caret);}this.$selected=this.$caret=this.$indicate(I);}else{if(this.$caret){this.$deindicate(this.$caret);}this.$caret=this.$indicate(I,G);this.$selected=this.$select(I,G);this.selected=G;if(!B){this.$selectedList.push(I);this.$valueList.push(G);}}}else{if(B&&I&&this.$selectedList.contains(I)){return;}else{if(!D&&!this.reselectable&&this.$valueList.length<=1&&this.$valueList.indexOf(G)>-1){return;}if(this.$selected){this.$deselect(this.$selected);}if(this.$caret){this.$deindicate(this.$caret);}if(this.selected){this.clearSelection(true);}this.$caret=this.$indicate(I,G);this.$selected=this.$select(I,G);this.selected=G;this.$selectedList.push(I);this.$valueList.push(G);}}}if(this.delayedselect&&(typeof E=="boolean")){var M=this;$setTimeout(function(){M.dispatchEvent("afterselect",{selection:M.$valueList,selected:G,caret:M.caret,captureOnly:c});},10);}else{this.dispatchEvent("afterselect",{selection:this.$valueList,selected:G,caret:this.caret,captureOnly:c});}return true;};this.choose=function(a){if(!this.selectable||this.disabled){return;}if(this.dispatchEvent("beforechoose",{xmlNode:a})===false){return false;}if(a&&!a.style){this.select(a);}if(this.hasFeature(apf.__DATABINDING__)&&this.dispatchEvent("afterchoose",{xmlNode:this.selected})!==false){this.setProperty("chosen",this.selected);}};this.clearSelection=function(c){if(!this.selectable||this.disabled||!this.$valueList.length){return;}if(!c){if(this.dispatchEvent("beforeselect",{selection:[],selected:null,caret:this.caret})===false){return false;}}var a;for(var m=this.$valueList.length-1;m>=0;m--){a=this.$findHtmlNode(this.$valueList[m].getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId);this.$deselect(a);}this.$selectedList.length=0;this.$valueList.length=0;this.$selected=this.selected=null;if(this.caret){a=this.$findHtmlNode(this.caret.getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId);this.$caret=this.$indicate(a);}if(!c){this.dispatchEvent("afterselect",{selection:this.$valueList,selected:null,caret:this.caret});}};this.selectList=function(w,a,z){if(!this.selectable||this.disabled){return;}if(this.dispatchEvent("beforeselect",{selection:w,selected:z||w[0],caret:this.caret,captureOnly:a})===false){return false;}this.clearSelection(true);for(var t,c=0;c<w.length;c++){if(!w[c]||w[c].nodeType!=1){continue;}var u,s=w[c];if(typeof s!="object"){s=apf.xmldb.getNodeById(s);}if(!s.style){u=this.$pHtmlDoc.getElementById(s.getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId);}else{u=s;s=apf.xmldb.getNodeById(u.getAttribute(apf.xmldb.htmlIdTag));}if(!s){continue;}if(u){if(!t&&z==u){t=u;}this.$select(u,s);this.$selectedList.push(u);}this.$valueList.push(s);}this.$selected=t||this.$selectedList[0];this.selected=z||this.$valueList[0];this.dispatchEvent("afterselect",{selection:this.$valueList,selected:this.selected,caret:this.caret,captureOnly:a});};this.setCaret=function(l){if(!l){if(this.$caret){this.$deindicate(this.$caret);}this.caret=this.$caret=null;return;}var c;if(typeof l!="object"){l=apf.xmldb.getNodeById(l);}if(!l.style){c=this.$findHtmlNode(l.getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId);}else{var a=(c=l).getAttribute(apf.xmldb.htmlIdTag);while(!a&&c.parentNode){a=(c=c.parentNode).getAttribute(apf.xmldb.htmlIdTag);}l=apf.xmldb.getNodeById(a);}if(this.$caret){this.$deindicate(this.$caret);}this.$caret=this.$indicate(c);this.setProperty("caret",this.caret=l);};this.$setTempSelected=function(o,c,q,t){clearTimeout(this.timer);if(this.$bindings.selectable){while(o&&!this.$getDataNode("selectable",o)){o=this.getNextTraverseSelected(o,!t);}if(!o){return;}}if(!this.multiselect){c=q=false;}if(c||this.ctrlselect){if(this.$tempsel){this.select(this.$tempsel);this.$tempsel=null;}this.setCaret(o);}else{if(q){if(this.$tempsel){this.$selectTemp();this.$deselect(this.$tempsel);this.$tempsel=null;}this.select(o,null,q);}else{if(!this.bufferselect||this.$valueList.length>1){this.select(o);}else{var a=apf.xmldb.getID(o,this);this.$deselect(this.$tempsel||this.$selected);this.$deindicate(this.$tempsel||this.$caret);this.$tempsel=this.$indicate(document.getElementById(a));this.$select(this.$tempsel);var s=this;this.timer=$setTimeout(function(){s.$selectTemp();},400);}}}};this.$selectTemp=function(){if(!this.$tempsel){return;}clearTimeout(this.timer);this.select(this.$tempsel);this.$tempsel=null;this.timer=null;};this.selectAll=function(){if(!this.multiselect||!this.selectable||this.disabled||!this.xmlRoot){return;}var a=this.$isTreeArch?this.xmlRoot.selectNodes(".//"+this.each.split("|").join("|.//")):this.xmlRoot.selectNodes(this.each);this.selectList(a);};this.getSelection=function(m){var c,a;if(m){a=this.xmlRoot?this.xmlRoot.ownerDocument.createDocumentFragment():apf.getXmlDom().createDocumentFragment();for(c=0;c<this.$valueList.length;c++){apf.xmldb.cleanNode(a.appendChild(this.$valueList[c].cloneNode(true)));}}else{for(a=[],c=0;c<this.$valueList.length;c++){a.push(this.$valueList[c]);}}return a;};this.$getSelection=function(a){return a?this.$selectedList:this.$valueList;};this.defaultSelectNext=function(c,l){var a=this.getNextTraverseSelected(c);if(a||!l){this.select(a?a:this.getTraverseParent(c));}else{this.clearSelection(true);}};this.selectNext=function(){var a=this.getNextTraverse();if(a){this.select(a);}};this.selectPrevious=function(){var a=this.getNextTraverse(null,-1);if(a){this.select(a);}};this.getDefaultNext=function(c,l){var a=this.getNextTraverseSelected(c);return(a&&a!=c)?a:(l?this.getTraverseParent(c):null);};this.isSelected=function(a){if(!a){return false;}for(var c=0;c<this.$valueList.length;c++){if(this.$valueList[c]==a){return this.$valueList.length;}}return false;};this.$checkSelection=function(c){if(this.$valueList.length>1){for(var l=[],o=0,a=this.$valueList.length;o<a;o++){if(apf.isChildOf(this.xmlRoot,this.$valueList[o])){l.push(this.$valueList[o]);}}if(l.length>1){this.selectList(l);if(this.caret&&!apf.isChildOf(this.xmlRoot,this.caret)){this.setCaret(c||this.selected);}return;}else{if(l.length){c=l[0];}}}if(!c){if(this.selected&&!apf.isChildOf(this.xmlRoot,this.selected)){c=this.getFirstTraverseNode();}else{if(this.selected&&this.caret&&!apf.isChildOf(this.xmlRoot,this.caret)){this.setCaret(this.selected);}else{if(!this.selected){c=this.xmlRoot?this.getFirstTraverseNode():null;}else{return;}}}}if(c){if(this.autoselect){this.select(c);}else{if(!this.multiselect){this.clearSelection();}this.setCaret(c);}}else{this.clearSelection();}};this.selectable=true;if(typeof this.ctrlselect=="undefined"){this.ctrlselect=false;}if(typeof this.multiselect=="undefined"){this.multiselect=true;}if(typeof this.autoselect=="undefined"){this.autoselect=true;}if(typeof this.delayedselect=="undefined"){this.delayedselect=true;}if(typeof this.allowdeselect=="undefined"){this.allowdeselect=true;}this.reselectable=false;this.$booleanProperties.selectable=true;this.$booleanProperties.multiselect=true;this.$booleanProperties.autoselect=true;this.$booleanProperties.delayedselect=true;this.$booleanProperties.allowdeselect=true;this.$booleanProperties.reselectable=true;this.$supportedProperties.push("selectable","ctrlselect","multiselect","autoselect","delayedselect","allowdeselect","reselectable","selection","selected","default","value","caret");this.$propHandlers.value=function(a){if(this.$lastValue==a){delete this.$lastValue;return;}if(a||a===0||this["default"]){this.select(String(a)||this["default"]);}};this.$propHandlers.caret=function(c,a){if(c){this.setCaret(c);}};this.$propHandlers.selection=this.$propHandlers.selected=function(W,O){if(!W){W=this[O]=null;}if(O=="selected"&&typeof W!="string"&&W==this.selected){this.selected=null;return;}if(this.$isSelecting){this.selection=this.$valueList;return false;}var N,P,X,T,j,c,I;if(O=="selection"){if(typeof W=="object"&&W==this.$valueList){var V;if((c=this.$attrBindings[O])&&c.cvalue.models){this.$isSelecting=true;P=this.$attrBindings.eachvalue&&"eachvalue"||this.$bindings.value&&"value"||this.$hasBindRule("caption")&&"caption";if(!P){throw new Error("Missing bind rule set: eachvalue, value or caption");}var M=this.$getDataNode(O,this.xmlRoot);N=W;X=(I=this.$attrBindings["selection-unique"])&&I.cvalue;if(M.length){V=M[0].parentNode;}else{var Q=apf.nameserver.get("model",c.cvalue.xpaths[0]),R=c.cvalue.xpaths[1];if(!Q.data){this.$isSelecting=false;return false;}V=Q.queryNode(R.replace(/\/[^\/]+$|^[^\/]*$/,"")||".");if(!V){throw new Error("Missing parent node");}}remove_loop:for(T=0;T<M.length;T++){W=X?X(M[T]):this.$applyBindRule(P,M[T]);for(j=0;j<N.length;j++){if(this.$applyBindRule(P,N[j])==W){continue remove_loop;}}apf.xmldb.removeNode(M[T]);}add_loop:for(T=0;T<N.length;T++){W=this.$applyBindRule(P,N[T]);for(j=0;j<M.length;j++){if(X?X(M[j]):this.$applyBindRule(P,M[j])==W){continue add_loop;}}var K=this.$attrBindings["selection-constructor"]&&this.$getDataNode("selection-constructor",N[T])||apf.getCleanCopy(N[T]);apf.xmldb.appendChild(V,K);}this.$isSelecting=false;}return;}this.selection=this.$valueList;}else{this.selected=null;}if(!this.xmlRoot){if(!this.$buffered){var J;this.addEventListener("afterload",J=function(){this.removeEventListener("afterload",J);this.$propHandlers.selected.call(this,W,O);delete this.$buffered;});this.$buffered=true;}this[O]=null;return false;}if(!W||typeof W!="object"){if(this.$attrBindings[O]){N=this.$getDataNode(O,this.xmlRoot);if(N){this.setProperty("selection",N);}}else{if(!W){this.clearSelection();}else{this.select(W);}}return false;}else{if(typeof W.length=="number"){N=W;if(!N.length){this.selected=null;if(this.$valueList.length){this.clearSelection();return false;}else{return;}}if(this.isTraverseNode(N[0])&&apf.isChildOf(this.xmlRoot,N[0])){if(!this.multiselect){this.select(N[0]);}else{this.selectList(N);}return false;}if(this.$attrBindings[O]){P=this.$attrBindings.eachvalue&&"eachvalue"||this.$bindings.value&&"value"||this.$hasBindRule("caption")&&"caption";if(!P){throw new Error("Missing bind rule set: eachvalue, value or caption");}var U=!this.each?this.getTraverseNodes():this.xmlRoot.selectNodes("//"+this.each.split("|").join("|//"));X=(c=this.$attrBindings["selection-unique"])&&c.cvalue;var a=[];for(T=0;T<N.length;T++){W=X?X(N[T]):this.$applyBindRule(P,N[T]);for(j=0;j<U.length;j++){if(this.$applyBindRule(P,U[j])==W){a.push(U[j]);}}}this.selectList(a);return false;}throw new Error("Show me which case this is");}else{if(this.$valueList.indexOf(W)==-1){this.select(W);}}}};this.$propHandlers.allowdeselect=function(a){if(a){var c=this;this.$int.onmousedown=function(m){if(!m){m=event;}if(m.ctrlKey||m.shiftKey){return;}var n=m.srcElement||m.target;if(c.allowdeselect&&(n==this||n.getAttribute(apf.xmldb.htmlIdTag))){c.clearSelection();}};}else{this.$int.onmousedown=null;}};this.$propHandlers.ctrlselect=function(a){if(a!="enter"){this.ctrlselect=apf.isTrue(a);}};function i(){this.selectAll();}this.$propHandlers.autoselect=function(a){if(a=="all"&&this.multiselect){this.addEventListener("afterload",i);}else{this.removeEventListener("afterload",i);}};this.$propHandlers.multiselect=function(a){if(!a&&this.$valueList.length>1){this.select(this.selected);}};this.addEventListener("beforeselect",function(a){if(this.$bindings.selectable&&!this.$getDataNode("selectable",a.selected)){return false;}},true);this.addEventListener("afterselect",function(t){var u=null;this.setProperty("caret",t.caret);if(this.sellength!=t.selection.length){this.setProperty("sellength",t.selection.length);}delete this.selection;this.setProperty("selection",t.selection);if(!t.selection.length){this.setProperty("selected",t.selected);if(this.value){this.setProperty("value","");}}else{this.$chained=true;if(!t.force&&(!this.dataParent||!this.dataParent.parent.$chained)){var s=this;$setTimeout(function(){s.setProperty("selected",u||t.selected);delete s.$chained;},10);}else{this.setProperty("selected",u||t.selected);delete this.$chained;}var q=this.$attrBindings.eachvalue&&"eachvalue"||this.$bindings.value&&"value"||this.$hasBindRule("caption")&&"caption";if(q){this.$lastValue=this.$applyBindRule(q,t.selected);if(this.$lastValue!=(q!="value"&&(this.xmlRoot&&this.$applyBindRule("value",this.xmlRoot,null,true))||this.value)){if(q=="eachvalue"||this.xmlRoot!=this){this.change(this.$lastValue);}else{this.setProperty("value",this.$lastValue);}}delete this.$lastValue;}}if(typeof apf.offline!="undefined"&&apf.offline.state.enabled&&apf.offline.state.realtime){for(var a=[],c=0;c<t.selection.length;c++){a.push(apf.xmlToXpath(t.selection[c],null,true));}apf.offline.state.set(this,"selection",a);d.call(this);}},true);function d(){if(typeof apf.offline!="undefined"&&apf.offline.state.enabled&&apf.offline.state.realtime){apf.offline.state.set(this,"selstate",[this.caret?apf.xmlToXpath(this.caret,null,true):"",this.selected?apf.xmlToXpath(this.selected,null,true):""]);}}this.addEventListener("prop.caret",d);}).call(apf.MultiSelect.prototype=new apf.MultiselectBinding());apf.__CONTENTEDITABLE__=1<<23;apf.ContentEditable=function(){this.$regbase=this.$regbase|apf.__CONTENTEDITABLE__;this.implement(apf.DataAction);this.$activeDocument=document;this.$state=apf.ON;this.$selection=null;this.$buttons=["Bold","Italic","Underline"];this.$classToolbar="editor_Toolbar";this.$plugins={};this.$pluginsHooks={};this.$pluginsTypes={};this.$pluginsKeys=[];this.$pluginsActive=null;this.$pluginsOn=["pasteword","tablewizard"];this.$nativeCommands=["bold","italic","underline","strikethrough","justifyleft","justifycenter","justifyright","justifyfull","removeformat","cut","copy","paste","outdent","indent","undo","redo"];this.$supportedProperties.push("contenteditable","state","plugins","realtime","language");this.$booleanProperties.contenteditable=true;this.$booleanProperties.realtime=true;this.$propHandlers.contenteditable=function(c){var a=this.$edVars;if(apf.isTrue(c)){var d=this;apf.addListener(d.$ext,"mouseover",a.mouseOver=function(i){var j=i.srcElement||i.target;if(!j){return;}while(j&&(!j.className||j.className.indexOf("contentEditable")==-1)&&j!=d.$ext){j=j.parentNode;}if(!j||j==d.$ext||j==a.activeNode){return;}apf.setStyleClass(j,"contentEditable_over");});apf.addListener(d.$ext,"mouseout",a.mouseOut=function(i){var j=i.srcElement||i.target;if(!j){return;}while(j&&(!j.className||j.className.indexOf("contentEditable")==-1)&&j!=d.$ext){j=j.parentNode;}if(!j||j==d.$ext||j==a.activeNode){return;}apf.setStyleClass(j,null,["contentEditable_over"]);});apf.addListener(d.$ext,"mousedown",a.mouseDown=function(i){var j=i.srcElement||i.target;if(!j){return;}if(a.activeNode&&d.$selection&&apf.isChildOf(a.activeNode,j,true)){d.$selection.cache();}while(j&&(!j.className||j.className.indexOf("contentEditable")==-1)&&j!=d.$ext){j=j.parentNode;}if(!j||j==d.$ext){if(a.activeNode){u(a.activeNode,true);}return;}q(j);if(!a.lastTemplate){i.cancelBubble=true;apf.window.$mousedown({srcElement:a.activeNode});$setTimeout(function(){d.$selection.set();if(a.activeNode){a.activeNode.focus();}},10);}else{$setTimeout(function(){a.lastTemplate.childNodes[0].focus();},100);a.lastTemplate.childNodes[0].slideDown();}return false;});apf.addListener(d.$ext,"mouseup",a.mouseUp=function(i){var j=i.srcElement||i.target;if(a.activeNode&&d.$selection&&apf.isChildOf(a.activeNode,j,true)){d.$selection.cache();}});a.wasFocussable=[this.$focussable,typeof this.focussable=="undefined"?true:this.focussable];this.$focussable=true;this.setProperty("focussable",true);}else{apf.removeListener(this.$ext,"mouseover",a.mouseOver);apf.removeListener(this.$ext,"mouseout",a.mouseOut);apf.removeListener(this.$ext,"mousedown",a.mouseDown);apf.removeListener(this.$ext,"mouseup",a.mouseUp);if(a.docklet){a.docklet.hide();}a.activeNode=null;a.lastActiveNode=null;this.$focussable=a.wasFocussable[0];this.setProperty("focussable",a.wasFocussable[1]);}a.tabStack=null;this.reload();};this.$propHandlers.state=function(a){this.state=parseInt(a);var c=this;$setTimeout(function(){c.$notifyAllButtons(a);if(c.$pluginsActive=="code"){c.$notifyButton("code",apf.SELECTED);}});};this.$propHandlers.plugins=function(a){this.$pluginsOn=a&&a.splitSafe(a)||null;if(this.$pluginsOn&&this.$pluginsOn.length){for(var c=0,d=this.$pluginsOn.length;c<d;c++){this.$addPlugin(this.$pluginsOn[c]);}}};this.$propHandlers.language=function(a){};this.addEventListener("DOMNodeInsertedIntoDocument",function(a){if(typeof this.realtime=="undefined"){this.$setInheritedAttribute("realtime");}});this.$edVars={lastActiveNode:null,wasFocussable:null,skipFocusOnce:null,lastTemplate:null,lastValue:null,mouseOver:null,mouseOut:null,mouseDown:null,mouseUp:null,docklet:null,objectHandles:false,tableHandles:false,bStandalone:false,lastPos:0,activeNode:null,tabStack:null,changeTimer:null,keyupTimer:null,oButtons:{}};this.addEventListener("focus",function(c){var a=this.$edVars;if(!this.contenteditable||a.skipFocusOnce&&!(a.skipFocusOnce=false)){a.lastActiveNode=null;return;}this.setProperty("state",(this.$pluginsActive=="code")?apf.DISABLED:apf.OFF);if(a.lastActiveNode&&a.lastActiveNode.parentNode||typeof c.shiftKey=="boolean"){q(a.lastActiveNode||(a.tabStack||w())[c.shiftKey?a.tabStack.length-1:0]);if(a.lastActiveNode&&!a.lastTemplate){a.lastActiveNode.focus();}}a.lastActiveNode=null;if(a.lastTemplate){a.lastTemplate.childNodes[0].focus();}else{if(a.activeNode){var d=a.activeNode;$setTimeout(function(){this.$selection.set();if(d.parentNode){d.focus();}},10);}}});this.addEventListener("blur",function(c){if(!this.contenteditable){return;}var a=this.$edVars;a.lastActiveNode=a.activeNode||a.lastActiveNode;if(c.toElement&&(c.toElement==a.docklet||c.toElement.parentNode==a.lastTemplate)){return;}var d=apf.popup.last&&apf.lookup(apf.popup.last);if(d&&d.editor==this){apf.popup.forceHide();}if(this.$selection){this.$selection.cache();}u(a.activeNode,true);this.setProperty("state",apf.DISABLED);});this.addEventListener("load",function(){if(!this.contenteditable){return;}q(w()[0]);});this.addEventListener("xmlupdate",function(){this.$edVars.tabStack=null;});this.addEventListener("keydown",function(j){var o=this.$edVars;if(!this.contenteditable&&!o.bStandalone){return;}j=j||window.event;var I,n,J=j.which||j.keyCode;if(!o.activeNode&&!o.bStandalone){if(J==113){var K;if(this.$selected){var M=this.$selected.getElementsByTagName("*");for(var m=M.length-1;m>=0;m--){if((M[m].className||"").indexOf("contentEditable")>-1){K=M[m];break;}}}q(K||(o.tabStack||w())[0]);if(o.activeNode){o.activeNode.focus();this.$selection.selectNode(o.activeNode);this.$selection.collapse();try{this.$activeDocument.execCommand("SelectAll",false,true);}catch(j){}}}return;}if(apf.isIE){switch(J){case 66:case 98:case 105:case 73:case 117:case 85:if((j.ctrlKey||(apf.isMac&&j.metaKey))&&!j.shiftKey&&!j.altKey&&this.realtime){this.change(this.getValue());}break;case 8:n=false;if(this.$selection.getType()=="Control"){this.$selection.remove();n=true;}z.call(this,j,true);if(n){return false;}break;case 46:z.call(this,j,true);break;case 9:if(z.call(this,j)){return false;}break;}}else{this.$visualFocus();if((j.ctrlKey||(apf.isMac&&j.metaKey))&&!j.shiftKey&&!j.altKey){n=false;switch(J){case 66:case 98:this.$execCommand("Bold");n=true;break;case 105:case 73:this.$execCommand("Italic");n=true;break;case 117:case 85:this.$execCommand("Underline");n=true;break;case 86:case 118:if(!apf.isGecko){onPaste.call(this);}break;case 37:case 39:n=true;}if(n){apf.AbstractEvent.stop(j.htmlEvent||j);if(this.realtime){this.change(this.getValue());}}}}if(!o.bStandalone&&J==13){I=j.ctrlKey||(apf.isMac&&j.metaKey);if(!I){var l=this.getModel(true),a=this.xmlRoot.ownerDocument.selectSingleNode(o.activeNode.getAttribute("xpath")),d=l&&l.$validation&&l.$validation.getRule(a)||{multiline:false};I=!apf.isTrue(d.multiline);}j.returnValue=true;}this.$visualFocus();if(j.metaKey||j.ctrlKey||j.altKey||j.shiftKey){n=this.$notifyKeyBindings({code:J,control:j.ctrlKey,alt:j.altKey,shift:j.shiftKey,meta:j.metaKey});}if(J==9||I){if(o.bStandalone){if(z.call(this,j.htmlEvent||j)){apf.AbstractEvent.stop(j.htmlEvent||j);return false;}}else{var c=j.shiftKey,i=(o.tabStack||w()).indexOf(o.activeNode),K=u(o.activeNode,true)||w()[i];K=o.tabStack[o.tabStack.indexOf(K)+(c?-1:1)];if(K){q(K);if(o.lastTemplate){o.lastTemplate.childNodes[0].focus();}else{if(K.parentNode){K.focus();this.$selection.selectNode(K);this.$selection.collapse();try{this.$activeDocument.execCommand("SelectAll",false,true);}catch(j){}}}n=true;}}}else{if(!o.bStandalone&&J==27){u(o.activeNode);n=true;}else{if(J==8||J==46){z.call(this,j.htmlEvent||j,true);}}}if(!j.ctrlKey&&!j.altKey&&(J<112||J>122)&&(J<33&&J>31||J>42||J==8||J==13)){C();}if(n){if(j.preventDefault){j.preventDefault();}if(j.stopPropagation){j.stopPropagation();}j.returnValue=false;return false;}else{if(o.activeNode){j.returnValue=-1;}}},true);this.addEventListener("keyup",function(c){var i=this,a=this.$edVars;if(!this.contenteditable&&!a.bStandalone){return;}if(this.$selection){this.$selection.cache();}if(a.keyupTimer!=null){return;}c=c||window.event;function d(){clearTimeout(a.keyupTimer);if(i.state==apf.DISABLED){return;}i.$notifyAllButtons();i.dispatchEvent("typing",{editor:i,event:c});i.$notifyAllPlugins("typing",c.code);a.keyupTimer=null;}a.keyupTimer=window.setTimeout(d,200);},true);function q(G){var o=this.$edVars;if(!G||G.nodeType!=1||o.activeNode==G){return;}if(!this.$selection){this.$selection=new apf.selection(window,document);}if(o.activeNode){var i=w().indexOf(G);u(o.activeNode,true);G=w()[i];$setTimeout(function(){G.focus();},10);}var l=this;if(this.validityState&&!this.validityState.valid){G=w()[this.validityState.$lastPos];$setTimeout(function(){G.focus();l.$selection.selectNode(G);l.$selection.collapse();try{l.$activeDocument.execCommand("SelectAll",false,true);}catch(D){}l.getModel(true).validate(c,false,l.validityState,l);},10);}var c=apf.createNodeFromXpath(this.xmlRoot.ownerDocument,G.getAttribute("xpath")),a,j;if(a=this.getModel(true).$validation){j=a.getRule(c);}if(!this.hasFocus()){o.skipFocusOnce=true;}o.activeNode=G;apf.setStyleClass(G,"contentEditable_active",["contentEditable_over"]);if(j&&apf.isTrue(j.richtext)){o.lastValue=[];G.innerHTML=o.lastValue[0]=apf.htmlCleaner.prepare((o.lastValue[1]=G.innerHTML).replace(/<p[^>]*>/gi,"").replace(/<\/p>/gi,"<br _apf_marker='1' /><br _apf_marker='1' />"));this.$controlAgentBehavior(G);}else{o.lastValue=G.innerHTML;}if(j&&j.type=="custom"){if(!j.$template){var d=j.node.childNodes;j.$template=apf.document.appendChild(apf.document.createElement("template"));for(var m=0,n=d.length;m<n;m++){if(d[m].nodeType!=1){continue;}j.$template.appendChild(apf.document.createElement(d[m]));}}j.$lastHeight=G.style.height;j.$template.attach(G,null,true);G.style.height=(G.scrollHeight-apf.getHeightDiff(G)+2)+"px";j.$template.childNodes[0].onblur=function(D){if(D.toElement&&D.toElement!=l){l.dispatchEvent("blur");}else{if(D.toElement){o.skipFocusOnce=true;}else{l.dispatchEvent("blur");}l.focus(null,null,true);}};j.$template.childNodes[0].onafterchange=function(){};j.$template.childNodes[0].onkeydown=function(D){if(D.keyCode==9){D.currentTarget=null;l.dispatchEvent("keydown",D,true);return false;}};j.$template.childNodes[0].setValue(apf.queryValue(c));o.lastTemplate=j.$template;return;}if(apf.hasContentEditable){G.contentEditable=true;}else{document.body.setAttribute("spellcheck","false");document.designMode="on";}if(apf.isGecko){document.execCommand("insertBrOnReturn",false,true);document.execCommand("enableObjectResizing",false,o.objectHandles);document.execCommand("enableInlineTableEditing",false,o.tableHandles);}if(apf.hasFocusBug){apf.sanitizeTextbox(G);G.onselectstart=function(D){D=D||window.event;D.cancelBubble=true;};}var F=j&&apf.isTrue(j.richtext);if(F&&!o.docklet){this.$editable();}if(o.docklet){o.docklet.setProperty("visible",F);}this.setProperty("state",apf.OFF);}function u(a,E,c){var d=this.$edVars;if(!a){a=d.activeNode;}if(!a||a.nodeType!=1){return false;}var o=this.getModel(true),n=a.getAttribute("xpath"),j=this.xmlRoot.ownerDocument.selectSingleNode(n),i,l;if(i=o.$validation){l=i.getRule(j);}if(d.lastTemplate){if(d.lastTemplate.childNodes.indexOf(apf.document.activeElement)>-1){this.focus();}d.lastTemplate.detach();a.innerHTML=d.lastTemplate.childNodes[0].getValue();d.lastTemplate=null;a.style.height=l.$lastHeight;}else{this.$selection.collapse(true);if(apf.hasContentEditable){a.contentEditable=false;}else{document.designMode="off";}}d.activeNode=null;apf.setStyleClass(a,null,["contentEditable_over","contentEditable_active"]);if(d.docklet){d.docklet.setProperty("visible",false);}if(!E||d.lastValue&&a.innerHTML.toLowerCase().replace(/[\r\n]/g,"")==(d.lastValue.dataType==apf.ARRAY?d.lastValue[0]:d.lastValue).toLowerCase().replace(/[\r\n]/g,"")){a.innerHTML=d.lastValue.dataType==apf.ARRAY?d.lastValue[1]:d.lastValue;return false;}if(this.validityState){this.validityState.$reset();}if(apf.queryValue(this.xmlRoot.ownerDocument,n)!=a.innerHTML){var m=(d.tabStack||w()).indexOf(a);this.edit(j,l&&apf.isTrue(l.richtext)?apf.htmlCleaner.parse(a.innerHTML):a.innerHTML);if(i){(this.validityState||(this.validityState=new apf.validator.validityState())).$errorHtml=(d.tabStack||w())[m];this.validityState.$lastPos=m;if(l){this.invalidmsg=l.invalidmsg;}o.validate(j,false,this.validityState,this);}}if(c){$setTimeout(c);}}function w(){var a=this.$edVars;a.tabStack=[];var d=this.$ext.getElementsByTagName("*");for(var c=0,i=d.length;c<i&&d[c].nodeType==1;c++){if(d[c].className&&d[c].className.indexOf("contentEditable")!=-1){a.tabStack.push(d[c]);}}return a.tabStack;}function B(a){return(a.meta?2048:0)|(a.control?1024:0)|(a.alt?512:0)|(a.shift?256:0)|(a.key||"").charCodeAt(0);}function A(){apf.setStyleClass(this,"editor_enabled",["editor_selected","editor_disabled"]);this.disabled=false;}function s(){apf.setStyleClass(this,"editor_disabled",["editor_selected","editor_enabled"]);this.disabled=true;}function t(a,d){if(d){var c=this.$plugins[a];if(this.state==apf.DISABLED&&!c.noDisable){return apf.DISABLED;}return c.queryState?c.queryState(this):this.state;}if(this.state==apf.DISABLED){return apf.DISABLED;}return this.$queryCommandState(a);}function z(c,a){if(!this.$plugins.bullist||!this.$plugins.numlist){return false;}if(typeof c.shift!="undefined"){c.shiftKey=c.shift;}var d=this.$plugins.bullist.queryState(this)==apf.ON?this.$plugins.bullist:this.$plugins.numlist.queryState(this)==apf.ON?this.$plugins.numlist:null;if(!d){return false;}if(a===true){d.correctLists(this);}else{d.correctIndentation(this,c.shiftKey?"outdent":"indent");}return true;}function C(){var a=this.$edVars;if(!this.realtime||a.changeTimer!==null){return;}a.changeTimer=$setTimeout(function(){clearTimeout(a.changeTimer);this.change(this.getValue());a.changeTimer=null;},200);}this.$queryCommandState=function(c){if(apf.isGecko&&(c=="paste"||c=="copy"||c=="cut")){return apf.DISABLED;}try{if(!this.$activeDocument.queryCommandEnabled(c)){return apf.DISABLED;}else{return this.$activeDocument.queryCommandState(c)?apf.ON:apf.OFF;}}catch(a){return apf.OFF;}};this.$queryCommandValue=function(d){var a;if(typeof this.$activeDocument.queryCommand!="function"){return null;}try{a=this.$activeDocument.queryCommand(d);}catch(c){}return a||null;};this.$execCommand=function(E,n){if(this.$plugins[E]||this.state==apf.DISABLED){return;}this.$selection.set();this.$visualFocus();if(E.toLowerCase()=="removeformat"){var j=this.$selection.getContent(),i={FONT:1,SPAN:1,H1:1,H2:1,H3:1,H4:1,H5:1,H6:1,PRE:1,ADDRESS:1,BLOCKQUOTE:1,STRONG:1,B:1,U:1,I:1,EM:1,LI:1,OL:1,UL:1,DD:1,DL:1,DT:1};j=j.replace(/<\/?(\w+)(?:\s.*?|)>/g,function(D,G){return !i[G]?D:"";});if(apf.isIE){var d=this.$selection.setContent("<div>"+j+"</div>");this.$selection.selectNode(d);d.removeNode(false);return;}else{this.$selection.setContent(j);}}this.$activeDocument.execCommand(E,false,n);E=E.toLowerCase();var m=(E=="selectall");if(apf.isIE){if((E=="insertunorderedlist"||E=="insertorderedlist")&&this.$queryCommandState(E)==apf.OFF){m=true;}else{if(E=="outdent"){m=true;if(this.$plugins.bullist&&this.$plugins.numlist){if(this.$plugins.bullist.queryState(this)!=apf.OFF&&this.$plugins.numlist.queryState(this)!=apf.OFF){m=false;}}var a=this.$selection.getSelectedNode();if(m&&a&&a.tagName=="BLOCKQUOTE"){m=false;}}}if(m){var o=this.$edVars.bStandalone?this.$activeDocument.body:this.$edVars.activeNode;o.innerHTML=apf.htmlCleaner.prepare(o.innerHTML);this.$controlAgentBehavior(o);}var c=this.$selection.getRange();if(c){c.scrollIntoView();}}this.$notifyAllButtons();this.change(this.getValue());var l=this;$setTimeout(function(){if(!m){l.$selection.set();}l.$visualFocus();});};this.$addPlugin=function(a){if(this.$plugins[a]){return this.$plugins[a];}if(!apf.ContentEditable.plugin[a]){return null;}var c=new apf.ContentEditable.plugin[a](a);this.$plugins[c.name]=c;if(c.type){if(!this.$pluginsTypes[c.type]){this.$pluginsTypes[c.type]=[];}this.$pluginsTypes[c.type].push(c);}if(c.subType){if(!this.$pluginsTypes[c.subType]){this.$pluginsTypes[c.subType]=[];}this.$pluginsTypes[c.subType].push(c);}if(c.hook){c.hook=c.hook.toLowerCase();if(!this.$pluginsHooks[c.hook]){this.$pluginsHooks[c.hook]=[];}this.$pluginsHooks[c.hook].push(c);}if(typeof c.keyBinding=="string"){c.keyBinding={meta:(c.keyBinding.indexOf("meta")>-1),control:(c.keyBinding.indexOf("ctrl")>-1),alt:(c.keyBinding.indexOf("alt")>-1),shift:(c.keyBinding.indexOf("shift")>-1),key:c.keyBinding.charAt(c.keyBinding.length-1).toLowerCase()};c.keyHash=B(c.keyBinding);if(!this.$pluginsKeys[c.keyHash]){this.$pluginsKeys[c.keyHash]=[];}this.$pluginsKeys[c.keyHash].push(c);}return c;};this.$notifyPlugin=function(d,a){var c=this.$plugins[d];if(c&&c.hook==a&&!c.busy){return c.execute(this,arguments);}return null;};this.$notifyAllPlugins=function(c,a){var d=[];if(!this.$pluginsHooks){return d;}var i=this.$pluginsHooks[c];for(var j in i){if(!i[j].busy&&i[j].execute){d.push(i[j].execute(this,a));}}return d;};this.$notifyKeyBindings=function(a){var c=B(a);if(!this.$pluginsKeys[c]||!this.$pluginsKeys[c].length){return false;}var d=this.$pluginsKeys[c];for(var i=0,j=d.length;i<j;i++){d[i].execute(this,arguments);}return true;};this.$notifyButton=function(j,d){if(!this.$plugins){return;}var i=this.$edVars.oButtons[j];if(!i){return;}var a=this.$plugins[j];if(typeof d=="undefined"||d===null){if(a&&a.queryState){d=a.queryState(this);}else{d=this.$queryCommandState(j);}}if(i.state===d){return;}i.state=d;if(d==apf.DISABLED){s.call(i);}else{if(d==apf.HIDDEN){i.style.display="none";}else{if(d==apf.VISIBLE){i.style.display="";}else{if(i.style.display=="none"){i.style.display="";}if(i.disabled){A.call(i);}var c=(i.selected)?apf.ON:apf.OFF;if(d!=c){this.$buttonClick({state:d,isPlugin:a?true:false,_bogus:true},i);}}}}};this.$notifyAllButtons=function(c){var d,a=this.$edVars.oButtons;for(d in a){this.$notifyButton(d,c);}};this.$visualFocus=function(i){var c=(this.$pluginsActive=="code"),a=this.$edVars;if(a.bStandalone&&apf.document.activeElement==this&&!c){try{this.$oWin.focus();}catch(d){}}else{if(!a.bStandalone&&a.activeNode){a.activeNode.focus();}}if(c){this.$notifyAllButtons(apf.DISABLED);this.$notifyButton("code",apf.SELECTED);}else{if(i){this.$notifyAllButtons();}}};this.$buttonClick=function(a,c){if(this.$selection){this.$selection.cache();}apf.setStyleClass(c,"active");var d=c.getAttribute("type");if(!a._bogus){a.isPlugin=this.$plugins[d]?true:false;a.state=t.call(this,d,a.isPlugin);}if(a.state==apf.DISABLED){s.call(c);}else{if(this.disabled){A.call(c);}if(a.state==apf.ON){apf.setStyleClass(c,"editor_selected");c.selected=true;}else{apf.setStyleClass(c,"",["editor_selected"]);c.selected=false;}if(!a._bogus){if(a.isPlugin){this.$plugins[(this.$pluginsActive=d)].execute(this);}else{this.$execCommand(d);}a.state=t.call(this,d,a.isPlugin);}}apf.setStyleClass(c,"",["active"]);};this.$drawToolbars=function(l,ad,aa,X){var ab,n,m,i,j,ae,Z,o,d,c,a,ah,ac,ai,W=this.$edVars,ag=W.bStandalone?"button":"toolbarbutton",af=W.docklet.$getOption("toolbars"),Y=this.$plugins;if(!ad){ad="toolbar";}for(i=0,n=af.childNodes.length;i<n;i++){o=af.childNodes[i];if(o.nodeType!=1||o[apf.TAGNAME]!=ad){continue;}for(j=0,m=o.childNodes.length;j<m;j++){ah=o.childNodes[j];d=ah.nodeValue.splitSafe(",",-1,true);}if(!d||!d.length){continue;}W.docklet.$getNewContext("toolbar");ab=X?apf.insertHtmlNode(W.docklet.$getLayoutNode("toolbar"),l):l.appendChild(W.docklet.$getLayoutNode("toolbar"));for(ae=0,Z=d.length;ae<Z;ae++){a=d[ae];if(a=="|"){W.docklet.$getNewContext("divider");if(X){apf.insertHtmlNode(W.docklet.$getLayoutNode("divider"),ab);}else{ab.appendChild(W.docklet.$getLayoutNode("divider"));}}else{W.docklet.$getNewContext(ag);ai=X?ai=apf.insertHtmlNode(W.docklet.$getLayoutNode(ag),ab):ai=ab.appendChild(W.docklet.$getLayoutNode(ag));c=false;if(ad=="toolbar"&&!this.$nativeCommands.contains(a)){ac=this.$addPlugin(a);c=true;}if(c){ac=ac||Y[a];if(!ac){continue;}if(!(ac.type&apf.TOOLBARITEM)){continue;}W.docklet.$getLayoutNode(ag,"label",ai).setAttribute("class","editor_icon editor_"+ac.icon);ai.setAttribute("title",this.$translate(ac.name));}else{W.docklet.$getLayoutNode(ag,"label",ai).setAttribute("class","editor_icon editor_"+a);ai.setAttribute("title",this.$translate(a));}ai.setAttribute("onmousedown",aa||"apf.all["+this.$uniqueId+"].$buttonClick(event, this);");ai.setAttribute("onmouseover","apf.setStyleClass(this, 'hover');");ai.setAttribute("onmouseout","apf.setStyleClass(this, '', ['hover']);");ai.setAttribute("type",a);}}d=null;}if(apf.isIE){var V=l.getElementsByTagName("*");for(i=V.length-1;i>=0;i--){V[i].setAttribute("unselectable","On");}}};this.$editable=function(a){if(this.getAttribute("plugins")){this.$propHandlers.plugins.call(this,this.getAttribute("plugins"));}if(this.getAttribute("language")){this.$propHandlers.language.call(this,this.getAttribute("language"));}var d=this.$edVars;if(!this.$ext){d.docklet=this;d.bStandalone=true;this.$ext=this.$getExternal("main",null,function(D){var E=this.$getLayoutNode("main","toolbar");this.$drawToolbars(E);});this.oToolbar=this.$getLayoutNode("main","toolbar",this.$ext);}else{if(!d.docklet&&!(apf.ContentEditable.toolwin=d.docklet)){d.docklet=apf.ContentEditable.toolwin=new apf.modalwindow("toolwindow",document.body,null,true);d.docklet.parentNode=apf.document.documentElement;d.docklet.implement(apf.AmlNode);d.docklet.$aml=apf.getXml("<toolwindow />");d.docklet.$loadSkin();d.docklet.$draw();d.docklet.setProperty("buttons","");d.docklet.setProperty("title","Formatting");d.docklet.setProperty("icon","application.png");d.docklet.setProperty("resizable","horizontal");d.docklet.setProperty("draggable",true);d.docklet.setProperty("focussable",true);var c=this;d.docklet.onfocus=function(){c.focus();};apf.AmlParser.parseLastPass();d.docklet.setProperty("left",500);d.docklet.setProperty("top",100);d.docklet.setProperty("width",400);d.docklet.setProperty("zindex",100000);var j,i=d.docklet.$ext.getElementsByTagName("div");for(var n=0,G=i.length;n<G&&!j;n++){if(i[n].className.indexOf("content")!=-1){j=i[n];}}this.$drawToolbars(this.oToolbar=j,"toolbar",null,true);this.oToolbar.innerHTML=this.oToolbar.innerHTML;}}if(a){a.call(this);}if(this.oToolbar){var o=this.oToolbar.getElementsByTagName("div");for(var F,l,m=o.length-1;m>=0;m--){F=o[m].getAttribute("type");if(!F){continue;}d.oButtons[F]=o[m];l=this.$plugins[F];if(!l){continue;}l.buttonNode=o[m];if(l.init){l.init(this);}}}};this.$getPluginOption=function(a){return this.$edVars.docklet.$getOption(a);};this.$showPopup=function(a,i,l,j,c){if(apf.popup.last&&apf.popup.last!=i){var d=apf.lookup(apf.popup.last);if(d){d.state=apf.OFF;this.$notifyPlugin(d.name,d.state);}}this.$selection.set();if(this.$visualFocus){this.$visualFocus();}a.state=apf.ON;this.$notifyPlugin(a.name,apf.ON);if(apf.popup.isShowing(i)){return;}$setTimeout(function(){apf.popup.show(i,{x:0,y:22,animate:false,ref:l,width:j,height:c,callback:function(m){if(m.onkeydown){return;}m.onkeydown=function(n){n=n||window.event;var o=n.which||n.keyCode;if(o==13&&typeof a.submit=="function"){return a.submit(new apf.AbstractEvent(n));}};}});});};this.$translate=function(a,c){return c?apf.ContentEditable.i18n[this.language]["plugins"][a]:apf.ContentEditable.i18n[this.language][a];};this.$insertHtml=function(c,d,a){if(!a){this.$selection.set();}this.$visualFocus(true);c=d?c:apf.htmlCleaner.prepare(c);this.$selection.setContent(c,true);this.change(this.getValue());if(a){return;}var i=this;$setTimeout(function(){i.$selection.set();i.$visualFocus();});};this.$controlAgentBehavior=function(l){if(apf.isGecko){var a;while(l.childNodes.length){a=l.firstChild;if(a.nodeType==1){if(a.nodeName=="BR"&&a.getAttribute("_moz_editor_bogus_node")=="TRUE"){this.$selection.selectNode(a);this.$selection.remove();this.$selection.collapse(false);break;}}l=a;}}else{if(apf.isWebkit){this.$activeDocument.designMode="on";}else{if(apf.isIE){var c,j=l.getElementsByTagName("a");for(var d=0,i=j.length;d<i;d++){c=j[d].getAttribute("_apf_href");if(c){j[d].href=(c.indexOf("http://")==-1?"http://":"")+c;}}}}}};this.language="en_GB";this.state=apf.OFF;this.edit=function(c,a){this.$executeSingleValue("edit","edit",c,a);};};apf.ON=1;apf.OFF=0;apf.DISABLED=-1;apf.VISIBLE=2;apf.HIDDEN=3;apf.SELECTED=4;apf.ContentEditable.i18n={en_GB:{cancel:"Cancel",insert:"Insert",bold:"Bold",italic:"Italic",underline:"Underline",strikethrough:"Strikethrough",justifyleft:"Align text left",justifycenter:"Center",justifyright:"Align text right",justifyfull:"Justify",removeformat:"Clear formatting",cut:"Cut",copy:"Copy",paste:"Paste",outdent:"Decrease indent",indent:"Increase indent",undo:"Undo",redo:"Redo",anchor:"Insert anchor",blockquote:"Blockquote",charmap:"Character map",code:"HTML source view",listitem:"List item",nbsp:"Non-breaking space","break":"Linebreak",paragraph:"Paragraph",forecolor:"Font color",backcolor:"Highlight color",insertdate:"Insert current date",inserttime:"Insert current time",rtl:"Change text direction to right-to-left",ltr:"Change text direction to left-to-right",emotions:"Insert emotion",fonts:"Font",fontsize:"Font size",fontstyle:"Font style",blockformat:"Paragraph style",help:"Help",hr:"Insert horizontal rule",image:"Insert image",imagespecial:"Choose an image to insert",link:"Insert hyperlink",unlink:"Remove hyperlink",bullist:"Bullets",numlist:"Numbering",media:"Insert medium",pasteworddialog:"Paste from Word",pastetext:"Paste plaintext",paste_keyboardmsg:"Use %s on your keyboard to paste the text into the window.",print:"Print document",preview:"Preview document",scayt:"Turn spellcheck on/ off",search:"Search",replace:"Search and Replace",findnext:"Find next",doreplace:"Replace",replaceall:"Replace all",sub:"Subscript",sup:"Superscript",table:"Insert table",table_noun:"Table",visualaid:"Toggle visual aid on/ off"},nl_NL:{cancel:"Annuleren",insert:"Invoegen",bold:"Vet",italic:"Schuingedrukt",underline:"Onderstreept",strikethrough:"Doorgestreept",justifyleft:"Recht uitlijnen",justifycenter:"Centreren",justifyright:"Rechts uitlijnen",justifyfull:"Justify",removeformat:"Stijlen verwijderen",cut:"Knippen",copy:"Kopieren",paste:"Plakken",outdent:"Inspringen verkleinen",indent:"Inspringen vergroten",undo:"Ongedaan maken",redo:"Opnieuw",anchor:"Anchor invoegen",blockquote:"Blockquote",charmap:"Speciale tekens",code:"HTML broncode",listitem:"Lijst item",nbsp:"Niet-brekende spatie","break":"Regelafbreuk",paragraph:"Paragraaf",forecolor:"Tekstkleur",backcolor:"Markeerkleur",insertdate:"Huidige datum invoegen",inserttime:"Huidige tijd invoegen",rtl:"Verander tekstrichting naar rechts-naar-links",ltr:"Verander tekstrichting naar links-naar-rechts",emotions:"Emoticon invoegen",fonts:"Lettertype",fontsize:"Letter grootte",fontstyle:"Tekststijl",blockformat:"Paragraafstijl",help:"Hulp",hr:"Horizontale lijn invoegen",image:"Afbeelding invoegen",imagespecial:"Afbeelding kiezen",link:"Link invoegen",unlink:"Link verwijderen",bullist:"Ongenummerd",numlist:"Genummerd",media:"Medium invoegen",pasteworddialog:"Word Tekst Plakken",pastetext:"Tekst Plakken",paste_keyboardmsg:"Gebruik %s op uw toetsenbord om tekst in dit scherm te plakken.",print:"Printen",preview:"Voorbeeldvertoning",scayt:"Spellingscontrole aan/ uit",search:"Zoeken",replace:"Zoeken en vervangen",findnext:"Volgende",doreplace:"Vervangen",replaceall:"Vervang alle",sub:"Subscript",sup:"Superscript",table:"Tabel invoegen",table_noun:"Tabel",visualaid:"Visuele hulp aan/ uit"}};apf.TOOLBARITEM=1;apf.TOOLBARBUTTON=2;apf.TOOLBARPANEL=4;apf.TEXTMACRO=8;apf.CMDMACRO=16;apf.ContentEditable.plugin=function(i,d){apf.ContentEditable.plugin[i]=function(){this.$uniqueId=apf.all.push(this)-1;this.appendAmlNode=function(q,n){if(!q){return null;}var a=new apf.DOMParser(),o=this.editor.ownerDocument.createDocumentFragment();o.$int=n;var c=a.parseFromString(q,"text/xml",{doc:this.editor.ownerDocument,docFrag:o});return c.firstChild;};this.dispatchEvent=function(){var a=this;window.setTimeout(function(){if(a.type==apf.editor.CONTEXTPANEL&&a.queryState(a.editor)==apf.editor.ON){return;}a.state=apf.editor.OFF;if(a.editor){a.editor.$notifyButton(a.name,a.state);}apf.popup.hide();apf.popup.last=null;});return false;};this.$destroy=function(){apf.popup.forceHide();this.buttonNode=this.editor=null;delete this.buttonNode;delete this.editor;if(this.destroy){this.destroy();}};d.apply(this,arguments);};};apf.GuiElement.propHandlers.contenteditable=function(c){this.implement(apf.ContentEditable);if(!this.hasFeature(apf.__VALIDATION__)){this.implement(apf.Validation);}this.$propHandlers.contenteditable.apply(this,arguments);};apf.ContentEditable.plugin("link",function(){this.name="link";this.icon="link";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.keyBinding="ctrl+shift+l";this.state=apf.OFF;var c;this.init=function(a,j){this.buttonNode.className=this.buttonNode.className+" dropdown_small";var l=this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]);l.className="selectarrow";};this.execute=function(a){if(!c){this.editor=a;apf.popup.setContent(this.$uniqueId,this.createPanelBody());}a.dispatchEvent("pluginexecute",{name:this.name,plugin:this});this.oUrl.value="http://";this.editor.$showPopup(this,this.$uniqueId,this.buttonNode,218,95);if(c.style.visibility=="hidden"){c.style.visibility="visible";}var i=this;$setTimeout(function(){i.oUrl.focus();});return{id:this.name,action:null};};this.queryState=function(a){if(a.$selection.isCollapsed()||a.$selection.getSelectedNode().tagName=="A"){return apf.DISABLED;}return this.state;};this.submit=function(n){apf.popup.forceHide();if(!this.oUrl.value.replace("http://","")){return;}this.editor.$execCommand("CreateLink","javascript:apftmp(0);");var a,q=this.editor.$activeDocument.getElementsByTagName("a");for(var o=0;o<q.length&&!a;o++){if(q[o].href=="javascript:apftmp(0);"){a=q[o];}}if(a){var i=this.oUrl.value;a.href=(i.indexOf("http://")==-1?"http://":"")+i;a.target=this.oTarget.value;a.title=this.oTitle.value;}this.editor.$selection.collapse(false);this.editor.change(this.editor.getValue());if(n.stop){n.stop();}return false;};this.createPanelBody=function(){c=document.body.appendChild(document.createElement("div"));c.className="editor_popup";c.style.display="none";var a="editor_"+this.$uniqueId+"_link_url";var l="editor_"+this.$uniqueId+"_link_target";var n="editor_"+this.$uniqueId+"_link_title";var m="editor_"+this.$uniqueId+"_link_btns";c.innerHTML='<div class="editor_panelrow editor_panelrowinput">                <label for="'+a+'">Link URL</label>                <input type="text" id="'+a+'" name="'+a+'" class="editor_input" value="" />            </div>            <div class="editor_panelrow editor_panelrowinput">                <label for="'+l+'">Target</label>                <select id="'+l+'" name="'+l+'">                    <option value="_self">Open in this window/ frame</option>                    <option value="_blank">Open in new window (_blank)</option>                    <option value="_parent">Open in parent window/ frame (_parent)</option>                    <option value="_top">Open in top frame (replaces all frames) (_top)</option>                </select>            </div>            <div class="editor_panelrow editor_panelrowinput">                <label for="'+n+'">Title</label>                <input type="text" id="'+n+'" name="'+n+'" class="editor_input" value="" />            </div>            <div id="'+m+'" class="editor_panelrow editor_panelrowbtns"></div>';this.oUrl=document.getElementById(a);this.oTarget=document.getElementById(l);this.oTitle=document.getElementById(n);if(apf.hasFocusBug){apf.sanitizeTextbox(this.oUrl);apf.sanitizeTextbox(this.oTarget);apf.sanitizeTextbox(this.oTitle);this.oUrl.onselectstart=this.oTarget.onselectstart=this.oTitle.onselectstart=function(d){d=d||window.event;d.cancelBubble=true;};}new apf.toolbar({htmlNode:document.getElementById(m),skinset:apf.getInheritedAttribute(this.editor.parentNode,"skinset"),childNodes:[new apf.bar({childNodes:[new apf.button({caption:this.editor.$translate("insert"),onclick:"apf.lookup("+this.$uniqueId+").submit(event)"})]})]});return c;};this.destroy=function(){c=this.oUrl=this.oTarget=this.oTitle=null;delete c;delete this.oUrl;delete this.oTarget;delete this.oTitle;};});apf.ContentEditable.plugin("unlink",function(){this.name="unlink";this.icon="unlink";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding="ctrl+shift+l";this.state=apf.OFF;this.execute=function(n){if(this.queryState(n)==apf.DISABLED){return;}if(apf.isIE){n.$execCommand("Unlink");}else{var m=n.$selection;m.set();var l=m.getSelectedNode();if(l.tagName=="A"){var j=l.innerHTML;m.selectNode(l);m.remove();m.collapse();n.$insertHtml(j);}}};this.queryState=function(c){if(!c.$selection){console.dir(c);}if(c.$selection.getSelectedNode().tagName=="A"){return apf.OFF;}return apf.DISABLED;};});apf.ContentEditable.subSupCommand=function(c){this.name=c;this.icon=c;this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding=c=="sub"?"ctrl+alt+s":"ctrl+shift+s";this.state=apf.OFF;this.execute=function(a){var i=this.name=="sub"?"Superscript":"Subscript";if(a.$queryCommandState(i)==apf.ON){a.$execCommand(i);}a.$execCommand(this.name=="sub"?"Subscript":"Superscript");a.dispatchEvent("pluginexecute",{name:this.name,plugin:this});};this.queryState=function(a){return a.$queryCommandState(this.name=="sub"?"Subscript":"Superscript");};};apf.ContentEditable.plugin("sub",apf.ContentEditable.subSupCommand);apf.ContentEditable.plugin("sup",apf.ContentEditable.subSupCommand);apf.ContentEditable.plugin("fonts",function(){this.name="fonts";this.icon="fonts";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.buttonNode=null;this.state=apf.OFF;this.colspan=1;this.fontNames={};var c;this.init=function(A){this.buttonNode.className=this.buttonNode.className+" fontpicker";this.fontPreview=this.buttonNode.getElementsByTagName("span")[0];this.fontPreview.className+=" fontpreview";var z=this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]);z.className="selectarrow";this.editor=A;var w,a,j,l,u;var t=A.$getPluginOption("fonts").childNodes[0];while(t){l=t.nodeValue.splitSafe("(?:;|=)");if(l[0]){for(a=0,w=l.length;a<w;a++){this.fontNames[l[a]]=l[++a];}break;}t=t.nextSibling;}this.queryState(A);};this.execute=function(){if(!c){apf.popup.setContent(this.$uniqueId,this.createPanelBody());}this.editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this});this.editor.$showPopup(this,this.$uniqueId,this.buttonNode,120);return{id:this.name,action:null};};this.queryState=function(a){this.state=a.$queryCommandState("FontName");var i=a.$queryCommandValue("FontName");if(!i||(this.fontNames[i]&&this.fontPreview.innerHTML!=i)){this.fontPreview.innerHTML=i?i:"Font";}};this.submit=function(a){a=new apf.AbstractEvent(a||window.event);while(a.target.tagName.toLowerCase()!="a"&&a.target.className!="editor_popup"){a.target=a.target.parentNode;}var j=a.target.getAttribute("rel");if(j){apf.popup.forceHide();if(apf.isIE){this.editor.$selection.set();if(this.editor.$selection.isCollapsed()){this.editor.$visualFocus();var l=this.editor.$selection.getRange();l.moveStart("character",-1);l.select();}}this.editor.$execCommand("FontName",j);if(apf.isIE){this.editor.$selection.collapse(false);}}};this.createPanelBody=function(){c=document.body.appendChild(document.createElement("div"));c.className="editor_popup";c.style.display="none";var i=[];for(var a in this.fontNames){i.push('<a class="editor_panelcell editor_font" style="font-family:',this.fontNames[a],';" rel="',a,'" href="javascript:;" onmouseup="apf.lookup(',this.$uniqueId,').submit(event);">',a,"</a>");}c.innerHTML=i.join("");return c;};this.destroy=function(){c=this.fontPreview=null;delete c;delete this.fontPreview;};});apf.ContentEditable.plugin("fontsize",function(){this.name="fontsize";this.icon="fontsize";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.buttonNode=null;this.state=apf.OFF;var i;var d={"1":"8","2":"10","3":"12","4":"14","5":"18","6":"24","7":"36"};this.init=function(c){this.buttonNode.className=this.buttonNode.className+" fontsizepicker";this.sizePreview=this.buttonNode.getElementsByTagName("span")[0];this.sizePreview.className+=" fontsizepreview";var a=this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]);a.className="selectarrow";this.queryState(c);};this.execute=function(n){if(!i){this.editor=n;var o,c,a=n.$getPluginOption("fontsizes");for(o=0;o<a.childNodes.length;o++){c=a.childNodes[o];if(c.nodeType==3||c.nodeType==4){this.fontSizes=c.nodeValue.splitSafe(",");}}apf.popup.setContent(this.$uniqueId,this.createPanelBody());}this.editor.$showPopup(this,this.$uniqueId,this.buttonNode,203);return{id:this.name,action:null};};this.queryState=function(a){this.state=a.$queryCommandState("FontSize");var c=a.$queryCommandValue("FontSize");if(!c||this.sizePreview.innerHTML!=c){this.sizePreview.innerHTML=c?c:"Size";}};this.submit=function(c){c=new apf.AbstractEvent(c||window.event);while(c.target.tagName.toLowerCase()!="a"&&c.target.className!="editor_popup"){c.target=c.target.parentNode;}var a=c.target.getAttribute("rel");if(a){apf.popup.forceHide();if(apf.isIE){this.editor.$selection.set();if(this.editor.$selection.isCollapsed()){this.editor.$visualFocus();var l=this.editor.$selection.getRange();l.moveStart("character",-1);l.select();}}this.editor.$execCommand("FontSize",a);if(apf.isIE){this.editor.$selection.collapse(false);}}c.stop();return false;};this.createPanelBody=function(){i=document.body.appendChild(document.createElement("div"));i.className="editor_popup";i.style.display="none";var m=[];var a=this.fontSizes;for(var c=0;c<a.length;c++){m.push('<a class="editor_panelcell editor_fontsize" style="font-size:',d[a[c]],"pt;height:",d[a[c]],"pt;line-height:",d[a[c]],'pt;" rel="',a[c],'" href="javascript:;" onmouseup="apf.lookup(',this.$uniqueId,').submit(event);">',a[c]," (",d[a[c]],"pt)</a>");}i.innerHTML=m.join("");return i;};this.destroy=function(){i=this.sizePreview=null;delete i;delete this.sizePreview;};});apf.ContentEditable.plugin("media",function(){this.name="media";this.icon="media";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding="ctrl+m";this.state=apf.OFF;this.execute=function(c){c.dispatchEvent("pluginexecute",{name:this.name,plugin:this});};this.queryState=function(c){return this.state;};});apf.ContentEditable.listPlugin=function(l){this.name=l;this.icon=l;this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding=l=="bullist"?"ctrl+shift+u":"ctrl+shift+o";this.state=apf.OFF;var n=apf.isIE?/^(&nbsp;)?<DIV[^>]*_apf_placeholder(="1">&nbsp;)?<\/DIV>$/gi:/^(&nbsp;)?<BR\/?>$/gi;this.execute=function(a){a.$execCommand(this.name=="bullist"?"InsertUnorderedList":"InsertOrderedList");this.correctLists(a);a.$visualFocus();a.dispatchEvent("pluginexecute",{name:this.name,plugin:this});};function m(i,s){var d,t,a,c=(this.name=="bullist")?"OL":"UL";for(d=i.childNodes.length;d>=0;d--){t=i.childNodes[d];if(!t){continue;}if(t.tagName==c){break;}if(!a){s.appendChild(t);}else{s.insertBefore(t,a);}a=t;}i.parentNode.removeChild(i);}function j(i){if(!i||i.nodeType!=1){return;}var d,c=i.getElementsByTagName("li");for(var s=0,a=c.length;s<a;s++){d=c[s].innerHTML.trim();if(d==""||d=="&nbsp;"||d.match(n)){return c[s];}}return null;}this.correctLists=function(a){a.$selection.set();var i=a.$selection.getSelectedNode();if(i.tagName!="LI"){i=j(i);if(!i||i.tagName!="LI"){return false;}}var s=i.parentNode,d=i.parentNode.previousSibling,t=null;if(!d){return false;}if(d&&d.tagName=="BR"){t=d;d=d.previousSibling;}var c=(d&&d.tagName==s.tagName)?d:null;if(!c){return;}if(t){s.removeChild(t);}m(s,c);a.$selection.selectNode(i);if(!apf.isIE){a.$selection.getRange().setStart(i,0);}a.$selection.collapse(!apf.isIE);a.$visualFocus();return true;};this.correctIndentation=function(a,c){a.$execCommand(c);this.correctLists(a);};this.queryState=function(c){var a=c.$queryCommandState(this.name=="bullist"?"InsertUnorderedList":"InsertOrderedList");if(a==apf.DISABLED){return apf.OFF;}return a;};};apf.ContentEditable.plugin("bullist",apf.ContentEditable.listPlugin);apf.ContentEditable.plugin("numlist",apf.ContentEditable.listPlugin);apf.ContentEditable.plugin("fontstyle",function(){this.name="fontstyle";this.icon="fontstyle";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.buttonNode=null;this.state=apf.OFF;var n,l=null,m=null;function o(B){if(!l){var d,c,z,A=B.$getPluginOption("fontstyles");for(var C=0,a=A.childNodes.length;C<a&&!l;C++){d=A.childNodes[C];if(d.nodeType==3||d.nodeType==4){l={};c=[];z=[];d.nodeValue.replace(/([\w ]+)\s*=\s*(([^\{]+?)\s*\{[\s\S]*?\})\s*/g,function(u,s,w,t){if(w.charAt(0)!="."){w="."+w;}w=w.trim().replace(/[\s]+/g,"");t=t.trim().replace(/\./,"");l[t]={caption:s.trim(),cname:t,css:w,node:null};c.push(w);z.push(".editor_fontstyle "+w);});}}if(c.length){apf.importCssString(z.join(""));apf.importCssString(c.join(""),B.$activeDocument);if(apf.isIE){var j=B.$activeDocument.getElementsByTagName("head")[0].childNodes,i=j.length-1;while(i){if(j[i].nodeType==3){j[i].parentNode.removeChild(j[i]);}i--;}}}}return l;}this.init=function(a){m=a;this.buttonNode.className=this.buttonNode.className+" fontstylepicker";this.stylePreview=this.buttonNode.getElementsByTagName("span")[0];this.stylePreview.className+=" fontstylepreview";var c=this.buttonNode.appendChild(document.createElement("span"));c.className="selectarrow";this.queryState(a);};this.execute=function(a){if(!n){m=a;apf.popup.setContent(this.$uniqueId,this.createPanelBody(a));}a.dispatchEvent("pluginexecute",{name:this.name,plugin:this});m.$showPopup(this,this.$uniqueId,this.buttonNode,203);return{id:this.name,action:null};};function q(){o(m);var d=m.$selection.getSelectedNode();while(d&&d.nodeType!=1){d=d.parentNode;}var i;while(!i&&d&&d.tagName!="BODY"){var a=d.className;for(var c in l){if(a.indexOf(c)>-1){i=l[c];i.node=d;}}d=d.parentNode;}return i;}this.submit=function(i,F){if(!F){i=new apf.AbstractEvent(i||window.event);while(i.target.tagName.toLowerCase()!="a"&&i.target.className!="editor_popup"){i.target=i.target.parentNode;}F=i.target.getAttribute("rel");}if(F){apf.popup.forceHide();var K=m.$selection;K.set();m.$visualFocus();var d=q(m);if(d&&F=="normal"){var J=d.node.childNodes,s=d.node.parentNode;while(J.length){s.insertBefore(J[0],d.node);}s.removeChild(d.node);this.queryState(m);}else{if(d&&(K.isCollapsed()||K.getContent("text")==d.node.innerHTML)&&apf.isChildOf(d.node,K.getSelectedNode(),true)){if(d.cname==F){return;}apf.setStyleClass(d.node,F,[d.cname]);}else{if(K.isCollapsed()){if(apf.isIE){var a=K.getRange().parentElement();var s=m.$activeDocument.createElement("span");s.className=F;s.innerHTML=a.innerHTML;if(a.tagName=="BODY"){a.innerHTML="";a.appendChild(s);}else{a.parentNode.insertBefore(s,a);a.parentNode.removeChild(a);}K.selectNode(s);}else{var I=K.getRange();var G=I.commonAncestorContainer;I.setStartBefore(G);I.setEndAfter(G);K.setRange(I);var c=K.setContent('<span class="'+F+'">'+K.getContent()+"</span>");K.selectNode(c);}}else{var M=K.getContent().trim();var j=M.substr(0,5)=="<SPAN";M=M.replace(/<SPAN class=.*?>|<\/SPAN>/gi,"");if(M.charAt(0)=="<"){M=M.replace(/<(normal|pre|p|address|h1|h2|h3|h4|h5|h6)(?:\s.*?|)>(.+?)<\/(normal|pre|p|address|h1|h2|h3|h4|h5|h6)>/gi,'<$1><span class="'+F+'">$2</span></$3>').replace(/^([\s\S]*?)(<(?:normal|pre|p|address|h1|h2|h3|h4|h5|h6)[\s\S]*<\/(?:normal|pre|p|address|h1|h2|h3|h4|h5|h6)>)([\s\S]*?)$/gi,function(z,u,t,w){return(u?'<span class="'+F+'">'+u+"</span>":"")+t+(w?'<span class="'+F+'">'+w+"</span>":"");}).replace(/^\s*<(?:normal|pre|p|address|h1|h2|h3|h4|h5|h6)(?:\s.*?|)>|<\/(?:normal|pre|p|address|h1|h2|h3|h4|h5|h6)>\s*$/gi,"");if(apf.isIE){M=M.replace(/<\/P>/,"");}}else{M='<span class="'+F+'">'+M+"</span>";}if(j){M="</SPAN>"+M.replace(/<\/SPAN>$/i,"");}var c=K.setContent(M,true);K.selectNode(c);}}}m.change(m.getValue());}};this.queryState=function(){var a=q();if(a){if(this.stylePreview.innerHTML!=a.caption){this.stylePreview.innerHTML=a.caption;}this.state=apf.ON;}else{this.stylePreview.innerHTML="Style";this.state=apf.OFF;}return this.state;};this.createPanelBody=function(d){n=document.body.appendChild(document.createElement("div"));n.className="editor_popup";n.style.display="none";o(d);var c=['<a class="editor_panelcell editor_fontstyle" rel="normal"             href="javascript:;" onmouseup="apf.lookup(',this.$uniqueId,').submit(event);"><span>Normal</span></a>'];for(var a in l){c.push('<a class="editor_panelcell editor_fontstyle" rel="',a,'" href="javascript:;" onmouseup="apf.lookup(',this.$uniqueId,').submit(event);"><span class="',a,'">',l[a].caption,"</span></a>");}n.innerHTML=c.join("");return n;};this.destroy=function(){n=this.stylePreview=m=null;delete n;delete this.stylePreview;delete m;};});apf.ContentEditable.plugin("blockformat",function(){this.name="blockformat";this.icon="blockformat";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.buttonNode=null;this.state=apf.OFF;this.node=null;var B,w,A={normal:"Normal",p:"Paragraph",pre:"Preformatted",address:"Address",h1:"Header 1",h2:"Header 2",h3:"Header 3",h4:"Header 4",h5:"Header 5",h6:"Header 6"},s,q,t,u,C;function z(c){if(!C){var d,i,a,l=c.$getPluginOption("blockformats");for(d=0,i=l.childNodes.length;d<i;d++){a=l.childNodes[d];if(a.nodeType==3||a.nodeType==4){C=a.nodeValue.splitSafe(",");}}var j="("+C.join("|")+")";s=new RegExp("^"+j+"$","gi");q=new RegExp("<\\/?"+j+">","gi");t=new RegExp("<\\/?("+C.join("|")+"|p)>","gi");u=new RegExp("^("+C.join("|")+"|p)$","gi");}return C;}this.init=function(c){w=c;this.buttonNode.className=this.buttonNode.className+" blockformatpicker";this.blockPreview=this.buttonNode.getElementsByTagName("span")[0];this.blockPreview.className+=" blockformatpreview";var a=this.buttonNode.appendChild(document.createElement("span"));a.className="selectarrow";this.queryState(c);};this.execute=function(a){if(!B){w=a;apf.popup.setContent(this.$uniqueId,this.createPanelBody(a));}w.$showPopup(this,this.$uniqueId,this.buttonNode,203);return{id:this.name,action:null};};this.queryState=function(){var a=w.$selection.getSelectedNode(),c=z(w),d=a.nodeType==1?a.tagName.toLowerCase():"";while(d&&!d.match(s)&&d!="body"){a=a.parentNode;d=(a.tagName||"").toLowerCase();}if(d.match(s)){var i=A[d];if(this.blockPreview.innerHTML!=i){this.blockPreview.innerHTML=i;}this.state=apf.ON;this.node=a;}else{this.blockPreview.innerHTML="Normal";this.state=apf.OFF;this.node=null;}return this.state;};this.submit=function(c,i){if(!i){c=new apf.AbstractEvent(c||window.event);while(c.target.tagName.toLowerCase()!="a"&&c.target.className!="editor_popup"){c.target=c.target.parentNode;}i=c.target.getAttribute("rel");}if(i){apf.popup.forceHide();var j,m=w.$selection;m.set();w.$visualFocus();var V=m.getContent();if(i=="normal"&&this.queryState(w)==apf.ON){var P=this.node.childNodes,R=this.node.parentNode;if(apf.isIE){var o=R.insertBefore(R.ownerDocument.createElement("p"),this.node);while(P.length){o.insertBefore(P[0],o.firstChild);}R.removeChild(this.node);m.selectNode(o);if(o.previousSibling&&o.previousSibling.tagName=="P"){if(o.previousSibling.innerHTML==""){o.parentNode.removeChild(o.previousSibling);}}}else{while(P.length){R.insertBefore(P[0],this.node);}R.removeChild(this.node);}this.state=apf.OFF;this.node=null;this.blockPreview.innerHTML="Normal";}else{if(m.isCollapsed()||V.trim()==""){if(apf.isIE){var a,j;j=a=m.getRange().parentElement();while(!j.tagName.match(u)&&j.tagName!="BODY"){j=j.parentNode;}if(j&&j.tagName=="BODY"){if(a!=j){j=a;}else{}}var R=w.$activeDocument.createElement(i);R.innerHTML=j.innerHTML;if(j.tagName=="BODY"){j.innerHTML="";j.appendChild(R);}else{j.parentNode.insertBefore(R,j);j.parentNode.removeChild(j);}m.selectNode(R);}else{w.$execCommand("FormatBlock",i);}this.blockPreview.innerHTML=A[i];}else{j=m.getSelectedNode();while(j.nodeType!=1){j=j.parentNode;}if(j.tagName.match(u)&&V.length==j[apf.hasInnerText?"innerText":"textContent"].length){var R=w.$activeDocument.createElement(i);R.innerHTML=j.innerHTML;j.parentNode.insertBefore(R,j);j.parentNode.removeChild(j);m.selectNode(R);}else{while(!j.tagName.match(u)&&j.tagName!="BODY"){j=j.parentNode;}if(j&&j.tagName!="BODY"){var X;if(j.tagName=="P"&&apf.isIE){X="<"+i+">"+V.trim().replace(t,"")+"</"+i+">";T=m.setContent(X);}else{X='<P __apf_placeholder="true">'+V+"</P>";m.setContent(X);var Q=j.tagName;var W=[],n,Y;var d=j.innerHTML.replace(X,function(D,E){return(E!=0?(n=true)&&"</"+Q+">":"")+"<"+i+' __apf_placeholder="true">'+V.replace(t,"")+"</"+i+">"+(E<j.innerHTML.length-V.length?(Y=true)&&"<"+Q+">":"");});if(n){W.push("<"+Q+">");}W.push(d);if(Y){W.push("</"+Q+">");}j.innerHTML=W.join("");var T,P=j.getElementsByTagName(i);for(var l=0;l<P.length;l++){if(P[l].getAttribute("__apf_placeholder")){P[l].removeAttribute("__apf_placeholder");T=P[l];break;}}P=j.childNodes,R=j.parentNode;while(P.length){R.insertBefore(P[0],j);}R.removeChild(j);}if(T){if(apf.isIE){var U=T.previousSibling;if(U&&U.tagName=="P"&&U.innerHTML=="&nbsp;"){U.parentNode.removeChild(U);}}m.selectNode(T);}}else{var T=m.setContent("<"+i+">"+V.replace(/<p>(.*?)<\/p>(.)/gi,"$1<br />$2").replace(t,"")+"</"+i+">");if(apf.isIE){var U=T.previousSibling;if(U&&U.tagName=="P"&&U.innerHTML=="&nbsp;"){U.parentNode.removeChild(U);}}m.selectNode(T);}}this.blockPreview.innerHTML=A[i];}}w.change(w.getValue());}};this.createPanelBody=function(c){B=document.body.appendChild(document.createElement("div"));B.className="editor_popup";B.style.display="none";var j=[],a=z(c);for(var d=0,i=a.length;d<i;d++){j.push('<a class="editor_panelcell editor_blockformat" rel="',a[d],'" href="javascript:;" onmouseup="apf.lookup(',this.$uniqueId,').submit(event);"><',a[d],">",A[a[d]],"</",a[d],"></a>");}B.innerHTML=j.join("");return B;};this.destroy=function(){B=w=this.blockPreview=this.node=null;delete B;delete w;delete this.blockPreview;delete this.node;};});apf.ContentEditable.plugin("hr",function(){this.name="hr";this.icon="hr";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding="ctrl+h";this.state=apf.OFF;this.execute=function(c){if(apf.isGecko||apf.isIE){c.$insertHtml("<hr />",true);}else{c.$execCommand("InsertHorizontalRule");}c.dispatchEvent("pluginexecute",{name:this.name,plugin:this});};this.queryState=function(c){return this.state;};});apf.ContentEditable.plugin("table",function(){this.name="table";this.icon="table";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.keyBinding="ctrl+alt+shift+t";this.state=apf.OFF;var Q,X,U,T,P,Y,R,Z=0,aa=0,ad=this;this.init=function(a,c){this.buttonNode.className=this.buttonNode.className+" dropdown_small";var d=this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]);d.className="selectarrow";};this.execute=function(a){if(!Q){this.editor=a;R=a.useIframe?document:a.$activeDocument;apf.popup.setContent(this.$uniqueId,this.createPanelBody());}else{W();}a.dispatchEvent("pluginexecute",{name:this.name,plugin:this});this.editor.$showPopup(this,this.$uniqueId,this.buttonNode);window.setTimeout(function(){Q.style.width=(X.offsetWidth+8)+"px";Q.style.height=(X.offsetWidth+20)+"px";Y=apf.getAbsolutePosition(T);});};this.queryState=function(a){return this.state;};this.submit=function(i){apf.popup.forceHide();if(i[0]<0||i[1]<0){return;}var l,a,c,d,j=['<table border="0" width="50%">'];for(l=0,a=i[0];l<a;l++){j.push("<tr>");for(c=0,d=i[1];c<d;c++){j.push("<td>",(apf.isIE?"":'&nbsp;<br _apf_placeholder="1" />'),"</td>");}j.push("</tr>");}j.push("</table>");this.editor.$insertHtml(j.join(""),true);this.editor.$selection.collapse(false);this.editor.$visualFocus();};var M=false,af,V,N;function K(a){M=true;af=a.client;V=N=0;document.onmousemove=function(c){if(!M){return;}c=new apf.AbstractEvent(c||window.event);if(c.client.x>Y[0]+T.offsetWidth||c.client.y>Y[1]+T.offsetHeight){J(c);}c.stop();return false;};document.onmouseup=function(c){c=new apf.AbstractEvent(c||window.event);O.call(ad,c);c.stop();return false;};return false;}function O(a){if(M){M=false;af=document.onmousemove=document.onmouseup=null;V=N=0;}ab.call(this,a);if(Z>0&&aa>0){this.submit([aa,Z]);}a.stop();return false;}function J(a){af=a.client;V=(Math.floor((af.x-Y[0])/23)*23)+23;if(V>T.offsetWidth){Q.style.width=(V+10)+"px";X.style.width=(V+4)+"px";T.style.width=(V)+"px";U.style.width=(V)+"px";}N=(Math.floor((af.y-Y[1])/23)*23)+23;if(N>T.offsetHeight){Q.style.height=(N+20)+"px";X.style.height=(N+4)+"px";T.style.height=(N)+"px";U.style.height=(N)+"px";}}function W(){X.style.width=X.style.height="164px";U.style.width=U.style.height="0px";T.style.width=T.style.height="160px";}var ae="";function ab(a){if(typeof Y=="undefined"){return;}Z=Math.ceil((a.page.x-Y[0])/23);aa=Math.ceil((a.page.y-Y[1])/23);if(Z>0&&aa>0){U.style.width=Math.min((Z*23),T.offsetWidth)+"px";U.style.height=Math.min((aa*23),T.offsetHeight)+"px";var c=aa+" x "+Z+" "+ad.editor.$translate("table_noun");if(ae!=c){P.innerHTML=ae=c;}}else{Z=aa=0;}}function ac(a){if(M){return;}U.style.width=U.style.height="0px";Z=aa=0;P.innerHTML=ae=ad.editor.$translate("cancel");}function I(a){ac.call(this,a);apf.popup.forceHide();}this.createPanelBody=function(){Q=document.body.appendChild(document.createElement("div"));Q.className="editor_popup editor_tablepopup";Q.style.display="none";var i="editor_"+this.$uniqueId+"_tablecont";var a="editor_"+this.$uniqueId+"_tablesel";var c="editor_"+this.$uniqueId+"_table";var d="editor_"+this.$uniqueId+"_table_status";Q.innerHTML='<div id="'+i+'" class="editor_paneltable_cont">                <div id="'+a+'" class="editor_paneltable_sel"></div>                <div id="'+c+'" class="editor_paneltable"></div>            </div>            <div id="'+d+'" class="editor_paneltablecancel">'+this.editor.$translate("cancel")+"</div>";X=document.getElementById(i);U=document.getElementById(a);T=document.getElementById(c);T.onmousedown=K.bindWithEvent(this);T.onmouseup=O.bindWithEvent(this);T.onmousemove=ab.bindWithEvent(this);T.onmouseout=ac.bindWithEvent(this);P=document.getElementById(d);P.onmousedown=I.bindWithEvent(this);Q.onselectstart=function(){return false;};W();return Q;};this.destroy=function(){Q=X=U=T=P=Y=R=null;delete Q;delete X;delete U;delete T;delete P;delete Y;delete R;};});apf.ContentEditable.plugin("tablewizard",function(){this.name="tablewizard";this.icon="tablewizard";this.type=apf.CONTEXTPANEL;this.hook="context";this.state=apf.OFF;this.oTable=null;this.oRow=null;this.oCell=null;var u,s,w=this;this.execute=function(d,c){if(this.queryState(d)!=apf.ON){return;}this.oTable=this.oRow=this.oCell=null;while(u.tagName!="TABLE"){if(u.tagName=="TD"){this.oCell=u;}else{if(u.tagName=="TR"){this.oRow=u;}}u=u.parentNode;}this.oTable=u;if(!this.editor){this.editor=d;}if(!apf.editor.oMenu){this.createContextMenu();}if(!s){s=d.useIframe?document:d.$activeDocument;}apf.editor.oMenu.tablePlugin=this;var a=apf.getAbsolutePosition(d.iframe);if(!c.client){c=new apf.AbstractEvent(c);}apf.editor.oMenu.display(c.client.x+a[0],c.client.y+a[1],true);c.stop();d.dispatchEvent("pluginexecute",{name:this.name,plugin:this});return false;};this.queryState=function(c){var a=c.$selection.getSelectedNode();while(a.nodeType!=1||a.tagName!="BODY"){if(a.tagName=="TABLE"||a.tagName=="TBODY"||a.tagName=="TR"||a.tagName=="TD"){u=a;return apf.ON;}a=a.parentNode;}return apf.OFF;};function q(d,l,a){d.rowSpan=1;var j=A(l,["TR"]);for(var c=1;c<a&&j;c++){var i=s.createElement("td");if(!apf.isIE){i.innerHTML='<br mce_bogus="1"/>';}if(apf.isIE){j.insertBefore(i,j.cells(d.cellIndex));}else{j.insertBefore(i,j.cells[d.cellIndex]);}j=A(j,["TR"]);}}function C(a){var c=a.getAttribute("colspan")||"";var d=a.getAttribute("rowspan")||"";return{colspan:c==""?1:parseInt(c),rowspan:d==""?1:parseInt(d)};}function B(c){var d=[],a=c.rows,j,l,o,n,i,E,m;for(l=0;l<a.length;l++){for(j=0;j<a[l].cells.length;j++){o=a[l].cells[j];n=C(o);for(i=j;d[l]&&d[l][i];i++){}for(m=l;m<l+n.rowspan;m++){if(!d[m]){d[m]=[];}for(E=i;E<i+n.colspan;E++){d[m][E]=o;}}}}return d;}function z(c,a){for(var d=0;d<c.length;d++){for(var i=0;i<c[d].length;i++){if(c[d][i]==a){return{cellindex:i,rowindex:d};}}}return null;}function t(c,a,d){if(c[a]&&c[a][d]){return c[a][d];}return null;}function A(c,a){while((c=c.nextSibling)!=null){for(var d=0;d<a.length;d++){if(c.nodeName.toLowerCase()==a[d].toLowerCase()){return c;}}}return null;}this.createContextMenu=function(){var a="editor_"+this.$uniqueId+"_menu";this.appendAmlNode('            <a:menu xmlns:a="'+apf.ns.aml+'" id="'+a+'">                <a:item value="rowbefore">Insert row before</a:item>                <a:item value="rowbefore">Insert row after</a:item>                <a:item value="deleterow">Delete row</a:item>                <a:divider />                <a:item value="colbefore">Insert column before</a:item>                <a:item value="colafter">Insert column after</a:item>                <a:item value="deletecol">Delete column</a:item>                <a:divider />                <a:item value="splitcells">Split merged table cells</a:item>                <a:item value="mergecells">Merge table cells</a:item>            </a:menu>',document.body);var c=apf.editor.oMenu=self[a];c.addEventListener("onitemclick",function(aA){if(this.tablePlugin!=w){return;}var o,aE,aG,ax=0;if(w.oCell){for(aE=0,aG=w.oRow.cells.length;aE<aG;aE++){if(w.oRow.cells[aE]==w.oCell){ax=aE;}}}w.editor.$selection.set();switch(aA.value){case"rowbefore":o=s.createElement("tr");w.oRow.parentNode.insertBefore(o,w.oRow);for(aE=0,aG=w.oRow.cells.length;aE<aG;aE++){o.insertCell(0);}break;case"rowafter":o=s.createElement("tr");w.oRow.parentNode.insertBefore(o,w.oRow.nextSibling);for(aE=0,aG=w.oRow.cells.length;aE<aG;aE++){o.insertCell(0);}break;case"deleterow":if(!w.oRow||!w.oRow.parentNode){return;}w.oRow.parentNode.removeChild(w.oRow);break;case"colbefore":if(!w.oCell){return;}for(aE=0,aG=w.oTable.rows.length;aE<aG;aE++){w.oTable.rows[aE].insertCell(ax);}break;case"colafter":if(!w.oCell){return;}ax+=1;for(aE=0,aG=w.oTable.rows.length;aE<aG;aE++){w.oTable.rows[aE].insertCell(ax);}break;case"deletecol":if(!w.oCell||w.oTable.rows[0].cells.length==1){return;}for(aE=0,aG=w.oTable.rows.length;aE<aG;aE++){if(w.oTable.rows[aE].cells[ax]){w.oTable.rows[aE].deleteCell(ax);}}break;case"splitcells":if(!w.oRow||!w.oCell){return true;}var aQ=C(w.oCell);var aD=aQ.colspan;var ay=aQ.rowspan;if(aD>1||ay>1){w.oCol.colSpan=1;for(aE=1;aE<aD;aE++){var aw=s.createElement("td");if(!apf.isIE){aw.innerHTML='<br _apf_placeholder="1"/>';}w.oRow.insertBefore(aw,A(w.oCell,["TD","TH"]));if(ay>1){q(aw,w.oRow,ay);}}q(w.oCell,w.oRow,ay);}break;case"mergecells":var aC=[],aF=[],aK=w.editor.$selection.get(),d=B(w.oTable),aR,aP,n,i,l,aI;if(apf.isIE||aK.rangeCount==1){var m=1;var aS=1;aR=z(d,w.oCell);aP=w.oTable.rows;for(aE=aR.rowindex;aE<d.length;aE++){n=[];for(aG=aR.cellindex;aG<d[aE].length;aG++){l=t(d,aE,aG);if(l&&!aC.contains(l)&&!n.contains(l)){var ap=z(d,l);if(ap.cellindex<aR.cellindex+aS&&ap.rowindex<aR.rowindex+m){n[n.length]=l;}}}if(n.length>0){aC[aC.length]=n;}l=t(d,aR.rowindex,aR.cellindex);i=l.getElementsByTagName("br");if(i.length>1){for(aG=i.length;aG>=1;aG--){if(i[aG].getAttribute("_apf_placeholder")){i[aG].parentNode.removeChild(i[aG]);}}}}}else{var aH=-1,at=-1,aJ,av;if(aK.rangeCount<2){return true;}for(aE=0;aE<aK.rangeCount;aE++){var aM=aK.getRangeAt(aE);w.oCell=aM.startContainer.childNodes[aM.startOffset];if(!w.oCell){break;}if(w.oCell.nodeName=="TD"||w.oCell.nodeName=="TH"){aF.push(w.oCell);}}aP=w.oTable.rows;for(aE=0;aE<aP.length;aE++){n=[];for(aG=0;aG<aP[aE].cells.length;aG++){l=aP[aE].cells[aG];for(aI=0;aI<aF.length;aI++){if(l!=aF[aI]){continue;}n.push(l);}}if(n.length>0){aC.push(n);}}for(aE=0;aE<d.length;aE++){for(aG=0;aG<d[aE].length;aG++){d[aE][aG]._selected=false;for(aI=0;aI<aF.length;aI++){if(d[aE][aG]!=aF[aI]){continue;}if(aH==-1){aH=aG;at=aE;}aJ=aG;av=aE;d[aE][aG]._selected=true;}}}for(aE=at;aE<=av;aE++){for(aG=aH;aG<=aJ;aG++){if(!d[aE][aG]._selected){alert("Invalid selection for merge.");return true;}}}}var aL=1,aN=1;var aB,am=-1;for(aE=0;aE<aC.length;aE++){var au=0;for(aG=0,aI=aC[aE].length;aG<aI;aG++){aB=C(aC[aE][aG]);au+=aB.colspan;if(am!=-1&&aB.rowspan!=am){alert("Invalid selection for merge.");return true;}am=aB.rowspan;}if(au>aN){aN=au;}am=-1;}var an=-1;for(aG=0;aG<aC[0].length;aG++){var aq=0;for(aE=0;aE<aC.length;aE++){aB=C(aC[aE][aG]);aq+=aB.rowspan;if(an!=-1&&aB.colspan!=an){alert("Invalid selection for merge.");return true;}an=aB.colspan;}if(aq>aL){aL=aq;}an=-1;}w.oCell=aC[0][0];w.oCell.rowSpan=aL;w.oCell.colSpan=aN;for(aE=0;aE<aC.length;aE++){for(aG=0;aG<aC[aE].length;aG++){var ao=aC[aE][aG].innerHTML;var ar=ao.replace(/[ \t\r\n]/g,"");if(ar!="<br/>"&&ar!='<br _apf_placeholder="1"/>'&&(aG+aE>0)){w.oCell.innerHTML+=ao;}if(aC[aE][aG]==w.oCell&&aC[aE][aG]._deleted){continue;}aR=z(d,aC[aE][aG]);var az=aC[aE][aG].parentNode;az.removeChild(aC[aE][aG]);aC[aE][aG]._deleted=true;if(az.hasChildNodes()){continue;}az.parentNode.removeChild(az);var aO,j=null;for(aI=0;aO=t(d,aR.rowindex,aI);aI++){if(aO!=j&&aO.rowSpan>1){aO.rowSpan--;}j=aO;}if(w.oCell.rowSpan>1){w.oCell.rowSpan--;}}}i=w.oCell.getElementsByTagName("br");if(i.length>1){for(aE=i.length;aE>=1;aE--){if(i[aE]&&i[aE].getAttribute("_apf_placeholder")){i[aE].parentNode.removeChild(i[aE]);}}}break;}w.editor.change(w.editor.getValue());});};});apf.ContentEditable.plugin("help",function(){this.name="help";this.icon="help";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding="ctrl+h";this.state=apf.OFF;this.execute=function(c){c.dispatchEvent("pluginexecute",{name:this.name,plugin:this});};this.queryState=function(c){return this.state;};});apf.ContentEditable.plugin("charmap",function(){this.name="charmap";this.icon="charmap";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.buttonNode=null;this.state=apf.OFF;this.colspan=20;var i;this.init=function(a,c){this.buttonNode.className=this.buttonNode.className+" dropdown_small";var l=this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]);l.className="selectarrow";};this.execute=function(a){if(!i){this.editor=a;apf.popup.setContent(this.$uniqueId,this.createPanelBody());}a.dispatchEvent("pluginexecute",{name:this.name,plugin:this});this.editor.$showPopup(this,this.$uniqueId,this.buttonNode,apf.isIE6?469:466,318);return{id:this.name,action:null};};this.queryState=function(){return this.state;};var d=["!","&#34;","#","$","%","&#38;","\\'","(",")","*","+","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","&#60;","=","&#62;","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","&#161;","&#162;","&#163;","&#164;","&#165;","&#166;","&#167;","&#168;","&#169;","&#170;","&#171;","&#172;","&#174;","&#175;","&#176;","&#177;","&#178;","&#179;","&#180;","&#181;","&#182;","&#183;","&#184;","&#185;","&#186;","&#187;","&#188;","&#189;","&#190;","&#191;","&#192;","&#193;","&#194;","&#195;","&#196;","&#197;","&#198;","&#199;","&#200;","&#201;","&#202;","&#203;","&#204;","&#205;","&#206;","&#207;","&#208;","&#209;","&#210;","&#211;","&#212;","&#213;","&#214;","&#215;","&#216;","&#217;","&#218;","&#219;","&#220;","&#221;","&#222;","&#223;","&#224;","&#225;","&#226;","&#227;","&#228;","&#229;","&#230;","&#231;","&#232;","&#233;","&#234;","&#235;","&#236;","&#237;","&#238;","&#239;","&#241;","&#242;","&#243;","&#244;","&#245;","&#246;","&#247;","&#248;","&#249;","&#250;","&#251;","&#252;","&#253;","&#254;","&#255;","&#338;","&#339;","&#352;","&#353;","&#376;","&#402;","&#710;","&#732;","&#913;","&#914;","&#915;","&#916;","&#917;","&#918;","&#919;","&#920;","&#921;","&#922;","&#923;","&#924;","&#925;","&#926;","&#927;","&#928;","&#929;","&#931;","&#932;","&#933;","&#934;","&#935;","&#936;","&#937;","&#945;","&#946;","&#947;","&#948;","&#949;","&#950;","&#951;","&#952;","&#953;","&#954;","&#955;","&#956;","&#957;","&#958;","&#959;","&#960;","&#961;","&#962;","&#963;","&#964;","&#965;","&#966;","&#967;","&#968;","&#969;","&#977;","&#978;","&#982;","&#8201;","&#8211;","&#8212;","&#8216;","&#8217;","&#8218;","&#8220;","&#8221;","&#8222;","&#8224;","&#8225;","&#8226;","&#8230;","&#8240;","&#8242;","&#8243;","&#8249;","&#8250;","&#8254;","&#8260;","&#8364;","&#8465;","&#8472;","&#8476;","&#8482;","&#8501;","&#8592;","&#8593;","&#8594;","&#8595;","&#8596;","&#8629;","&#8656;","&#8657;","&#8658;","&#8659;","&#8660;","&#8704;","&#8706;","&#8707;","&#8709;","&#8711;","&#8712;","&#8713;","&#8715;","&#8719;","&#8721;","&#8722;","&#8727;","&#8730;","&#8733;","&#8734;","&#8736;","&#8743;","&#8744;","&#8745;","&#8746;","&#8747;","&#8756;","&#8764;","&#8773;","&#8776;","&#8800;","&#8801;","&#8804;","&#8805;","&#8834;","&#8835;","&#8836;","&#8838;","&#8839;","&#8853;","&#8855;","&#8869;","&#8901;","&#8968;","&#8969;","&#8970;","&#8971;","&#9001;","&#9002;","&#9674;","&#9824;","&#9827;","&#9829;","&#9830;"];this.submit=function(a){a=new apf.AbstractEvent(a||window.event);while(a.target.tagName.toLowerCase()!="a"&&a.target.className!="editor_popup"){a.target=a.target.parentNode;}var c=a.target.getAttribute("rel");if(c){apf.popup.forceHide();this.editor.$insertHtml(c,true);var l=this;$setTimeout(function(){l.editor.change(l.editor.getValue());});}};this.createPanelBody=function(){i=document.body.appendChild(document.createElement("div"));i.className="editor_popup";i.style.display="none";var m=[];var a=this.colspan-1;for(var c=0;c<d.length;c++){if(c%this.colspan==0){m.push('<div class="editor_panelrow">');}m.push('<a class="editor_panelcell editor_largecell" style="background-color:#',d[c],';" rel="',d[c],'" href="javascript:;" onmousedown="apf.lookup(',this.$uniqueId,').submit(event);">                <span>',d[c],"</span>                </a>");if(c%this.colspan==a){m.push("</div>");}}i.innerHTML=m.join("");return i;};this.destroy=function(){i=null;delete i;};});apf.ContentEditable.plugin("blockquote",function(){this.name="blockquote";this.icon="blockquote";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding="ctrl+shift+b";this.buttonBuilt=false;this.state=apf.OFF;this.execute=function(c){c.$execCommand("FormatBlock","BLOCKQUOTE");c.dispatchEvent("pluginexecute",{name:this.name,plugin:this});};this.queryState=function(c){return c.$queryCommandState("FormatBlock");};});apf.ContentEditable.pasteDialog=function(i){this.name=i;this.icon=i=="pasteworddialog"?"pasteword":i;this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.keyBinding=i=="pastetext"?"ctrl+shift+v":"ctrl+shift+w";this.state=apf.OFF;var d;this.init=function(){this.buttonNode.className=this.buttonNode.className+" dropdown_small";this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]).className="selectarrow";};this.execute=function(a){if(!d){this.editor=a;apf.popup.setContent(this.$uniqueId,this.createPanelBody());}a.dispatchEvent("pluginexecute",{name:this.name,plugin:this});this.editor.$showPopup(this,this.$uniqueId,this.buttonNode,300,270);if(d.style.visibility=="hidden"){d.style.visibility="visible";}var c=this;$setTimeout(function(){c.oArea.focus();},100);return{id:this.name,action:null};};this.queryState=function(a){return this.state;};this.submit=function(c){apf.popup.forceHide();var l=this.oArea.value;if(!l||l.length==0){return;}if(this.name=="pastetext"){var a=["\u2122","<sup>TM</sup>","\u2026","...","\u201c|\u201d",'"',"\u2019,'","\u2013|\u2014|\u2015|\u2212","-"];l=l.replace(/\u2122/gi,"<sup>TM</sup>").replace(/\u2026/gi,"...").replace(/\u201c|\u201d/gi,'"').replace(/\u2019,'/gi,"'").replace(/\u2013|\u2014|\u2015|\u2212/gi,"-").replace(/\r\n/g,"<br />").replace(/\r/g,"<br />").replace(/\n/g,"<br />");}else{l=this.editor.$plugins.pasteword.parse(l);}this.editor.$insertHtml(l);if(c.stop){c.stop();}else{c.cancelBubble=true;}return false;};this.createPanelBody=function(){d=document.body.appendChild(document.createElement("div"));d.className="editor_popup";d.style.display="none";var a="editor_"+this.$uniqueId+"_input",c="editor_"+this.$uniqueId+"_btns";d.innerHTML='<label for="'+a+'">'+this.editor.$translate("paste_keyboardmsg").sprintf(apf.isMac?"CMD+V":"CTRL+V")+'</label>            <textarea id="'+a+'" name="'+a+'"  wrap="soft" dir="ltr"               cols="60" rows="10" class="editor_textarea"></textarea>            <div class="editor_panelrow" style="position:absolute;bottom:0;width:100%" id="'+c+'"></div>';this.oArea=document.getElementById(a);apf.sanitizeTextbox(this.oArea);if(apf.isIE){this.oArea.onselectstart=this.oArea.onpaste=function(l){l=l||window.event;l.cancelBubble=true;};}new apf.toolbar({htmlNode:document.getElementById(c),skinset:apf.getInheritedAttribute(this.editor.parentNode,"skinset"),childNodes:[new apf.bar({childNodes:[new apf.button({caption:this.editor.$translate("insert"),onclick:"apf.lookup("+this.$uniqueId+").submit(event)"})]})]});return d;};this.destroy=function(){d=this.oArea=null;delete d;delete this.oArea;};};apf.ContentEditable.plugin("pasteworddialog",apf.ContentEditable.pasteDialog);apf.ContentEditable.plugin("pastetext",apf.ContentEditable.pasteDialog);apf.ContentEditable.plugin("pasteword",function(){this.name="pasteword";this.icon="pasteword";this.type=apf.CMDMACRO;this.hook="onpaste";this.keyBinding="ctrl+shift+v";this.state=apf.OFF;this.parse=function(j){var m=String.fromCharCode(8226),n=String.fromCharCode(183);j=j.replace(new RegExp("<p class=MsoHeading.*?>(.*?)</p>","gi"),"<p><b>$1</b></p>").replace(new RegExp('tab-stops: list [0-9]+.0pt">',"gi"),'">--list--').replace(new RegExp(m+"(.*?)<BR>","gi"),"<p>"+n+"$1</p>").replace(new RegExp('<SPAN style="mso-list: Ignore">',"gi"),"<span>"+m).replace(new RegExp('<br style="page-break-before: always;.*>',"gi"),"-- page break --").replace(/<o:p>\s*<\/o:p>/g,"").replace(/<o:p>[\s\S]*?<\/o:p>/g,"&nbsp;").replace(/\s*mso-[^:]+:[^;"]+;?/gi,"").replace(/\s*MARGIN: 0(?:cm|in) 0(?:cm|in) 0pt\s*;/gi,"").replace(/\s*MARGIN: 0(?:cm|in) 0(?:cm|in) 0pt\s*"/gi,'"').replace(/\s*TEXT-INDENT: 0cm\s*;/gi,"").replace(/\s*TEXT-INDENT: 0cm\s*"/gi,'"').replace(/\s*TEXT-ALIGN: [^\s;]+;?"/gi,'"').replace(/\s*PAGE-BREAK-BEFORE: [^\s;]+;?"/gi,'"').replace(/\s*FONT-VARIANT: [^\s;]+;?"/gi,'"').replace(/\s*tab-stops:[^;"]*;?/gi,"").replace(/\s*tab-stops:[^"]*/gi,"").replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3").replace(/-- page break --\s*<p>&nbsp;<\/p>/gi,"").replace(/-- page break --/gi,"").replace(/<\/p>/gi,"<br /><br />").replace(/<TABLE[^>]*cellPadding=[^>]*>/gi,'<table border="0">').replace(/<td[^>]*vAlign=[^>]*>/gi,"<td>");if(true){j=j.replace(/\s*face="[^"]*"/gi,"").replace(/\s*face=[^ >]*/gi,"").replace(/\s*FONT-FAMILY:[^;"]*;?/gi,"");}if(true){j=j.replace(/<(\w[^>]*) style="([^\"]*)"([^>]*)/gi,"<$1$3");}j=j.replace(/<STYLE[^>]*>[\s\S]*?<\/STYLE[^>]*>/gi,"").replace(/<(?:META|LINK)[^>]*>\s*/gi,"").replace(/\s*style="\s*"/gi,"").replace(/<SPAN\s*[^>]*>\s*&nbsp;\s*<\/SPAN>/gi,"&nbsp;").replace(/<SPAN\s*[^>]*><\/SPAN>/gi,"").replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3").replace(/<SPAN\s*>([\s\S]*?)<\/SPAN>/gi,"$1").replace(/<FONT\s*>([\s\S]*?)<\/FONT>/gi,"$1").replace(/<\\?\?xml[^>]*>/gi,"").replace(/<w:[^>]*>[\s\S]*?<\/w:[^>]*>/gi,"").replace(/<\/?\w+:[^>]*>/gi,"").replace(/<(U|I|STRIKE)>&nbsp;<\/\1>/g,"&nbsp;").replace(/<H\d>\s*<\/H\d>/gi,"").replace(/<(\w+)[^>]*\sstyle="[^"]*DISPLAY\s?:\s?none[\s\S]*?<\/\1>/ig,"").replace(/<(\w[^>]*) language=([^ |>]*)([^>]*)/gi,"<$1$3").replace(/<(\w[^>]*) onmouseover="([^\"]*)"([^>]*)/gi,"<$1$3").replace(/<(\w[^>]*) onmouseout="([^\"]*)"([^>]*)/gi,"<$1$3").replace(/<H(\d)([^>]*)>/gi,"<h$1>").replace(/<(H\d)><FONT[^>]*>([\s\S]*?)<\/FONT><\/\1>/gi,"<$1>$2</$1>").replace(/<(H\d)><EM>([\s\S]*?)<\/EM><\/\1>/gi,"<$1>$2</$1>");var l=document.createElement("div");l.innerHTML=j;while(this._convertMiddots(l,"--list--")){}while(this._convertMiddots(l,n,"unIndentedList")){}while(this._convertMiddots(l,m)){}j=l.innerHTML;return j.replace(/--list--/gi,"");};this._convertMiddots=function(G,I,C){var i=String.fromCharCode(183),z=String.fromCharCode(8226),F,D,B,E,A,J,K,M;F=G.getElementsByTagName("p");for(B=0;B<F.length;B++){E=F[B];if(E.innerHTML.indexOf(I)!=0){continue;}A=document.createElement("ul");if(C){A.className=C;}J=document.createElement("li");J.innerHTML=E.innerHTML.replace(new RegExp(""+i+"|"+z+"|--list--|&nbsp;","gi"),"");A.appendChild(J);K=E.nextSibling;while(K){if(K.nodeType==3&&new RegExp("^\\s$","m").test(K.nodeValue)){K=K.nextSibling;continue;}if(I==i){if(K.nodeType==1&&new RegExp("^o(\\s+|&nbsp;)").test(K.innerHTML)){if(!D){D=A;A=document.createElement("ul");D.appendChild(A);}K.innerHTML=K.innerHTML.replace(/^o/,"");}else{if(D){A=D;D=null;}if(K.nodeType!=1||K.innerHTML.indexOf(I)!=0){break;}}}else{if(K.nodeType!=1||K.innerHTML.indexOf(I)!=0){break;}}M=K.nextSibling;J=document.createElement("li");J.innerHTML=K.innerHTML.replace(new RegExp(""+i+"|"+z+"|--list--|&nbsp;","gi"),"");K.parentNode.removeChild(K);A.appendChild(J);K=M;}E.parentNode.replaceChild(A,E);return true;}return false;};});apf.ContentEditable.dateTimePlugin=function(c){this.name=c;this.icon=c;this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding=c=="insertdate"?"ctrl+shift+d":"ctrl+shift+t";this.state=apf.OFF;this.i18n={date_format:"%Y-%m-%d",time_format:"%H:%M:%S",months_long:"January,February,March,April,May,June,July,August,September,October,November,December",months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",days_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",days_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"};this.execute=function(d){if(typeof this.i18n.months_long=="string"){this.i18n.months_long=this.i18n.months_long.split(",");this.i18n.months_short=this.i18n.months_short.split(",");this.i18n.days_long=this.i18n.days_long.split(",");this.i18n.days_short=this.i18n.days_short.split(",");}var a=new Date();var l=(this.name=="insertdate")?this.i18n.date_format:this.i18n.time_format;l=l.replace("%D","%m/%d/%y").replace("%r","%I:%M:%S %p").replace("%Y",""+a.getFullYear()).replace("%y",""+a.getYear()).replace("%m",(""+a.getMonth()+1).pad(2,"0")).replace("%d",(""+a.getDate()).pad(2,"0")).replace("%H",(""+a.getHours()).pad(2,"0")).replace("%M",(""+a.getMinutes()).pad(2,"0")).replace("%S",(""+a.getSeconds()).pad(2,"0")).replace("%I",""+(a.getHours()+11)%12+1).replace("%p",""+(a.getHours()<12?"AM":"PM")).replace("%B",""+this.i18n.months_long[a.getMonth()]).replace("%b",""+this.i18n.months_short[a.getMonth()]).replace("%A",""+this.i18n.days_long[a.getDay()]).replace("%a",""+this.i18n.days_short[a.getDay()]).replace("%%","%");d.$insertHtml(l,true);d.dispatchEvent("pluginexecute",{name:this.name,plugin:this});};this.queryState=function(){return this.state;};};apf.ContentEditable.plugin("insertdate",apf.ContentEditable.dateTimePlugin);apf.ContentEditable.plugin("inserttime",apf.ContentEditable.dateTimePlugin);apf.ContentEditable.plugin("code",function(){this.name="code";this.icon="code";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding="ctrl+shift+h";this.state=apf.OFF;this.noDisable=true;this.regex=null;var R,B,I={},E,D,J,Q=this;this.execute=function(a){if(!E){this.drawPreview(a);}if(R.style.display=="none"){a.$selection.cache();this.update(a);a.$pluginsActive=this.name;a.setProperty("state",apf.DISABLED);this.setSize(a);R.style.display="";E.focus();}else{a.$pluginsActive=null;R.style.display="none";a.setProperty("state",apf.OFF);K();$setTimeout(function(){a.$selection.set();a.$visualFocus();});}a.$notifyButton("code",this.queryState(a));a.dispatchEvent("pluginexecute",{name:this.name,plugin:this});};this.update=function(c,a){if(N){J=a;return;}E.value=P.call(this,a?apf.htmlCleaner.parse(a):(J=c.getValue()));};this.getValue=function(){return E.value;};function K(){var c=apf.htmlCleaner.parse(E.value.replace(/<\/p>/gi,"</p><p></p>").replace(/\n/g,""));try{apf.getXml("<source>"+c.replace(/&.{3,5};/g,"")+"</source>");}catch(a){if(confirm("Er zit een fout in de html. Klik op OK om deze                          te corrigeren, of op Cancel om door te gaan")){return false;}}if(J==E.value||Q.editor.$value.replace(/[\r\n]/g,"")==c.replace(/[\r\n]/g,"")){Q.editor.$value="";Q.editor.$propHandlers.value.call(Q.editor,c);}else{Q.editor.change(c);}return true;}var N=null;function M(){if(!Q.editor.realtime||N!==null){return;}N=$setTimeout(function(){clearTimeout(N);Q.editor.change(E.value);N=null;},200);}function F(a){a=a||window.event;var c=a.which||a.keyCode;if(!a.ctrlKey&&!a.altKey&&(c<112||c>122)&&(c==32||c>42||c==8||c==13)){M();}}this.drawPreview=function(d){this.editor=d;R=d.$getExternal("code",d.$ext);B=R.getElementsByTagName("div")[0];this.editor.$drawToolbars(B,"codetoolbar","apf.all["+this.$uniqueId+"].$buttonClick(event, this);",true);B.innerHTML=B.innerHTML;var a=B.getElementsByTagName("div");for(var c,i=a.length-1;i>=0;i--){c=a[i].getAttribute("type");if(!c){continue;}I[c]=a[i];apf.setStyleClass(a[i],"editor_enabled",["editor_selected","editor_disabled"]);a[i].disabled=false;}E=R.getElementsByTagName("textarea")[0];if(apf.isIE){E.onselectstart=function(j){j=j||window.event;j.cancelBubble=true;};}E.onkeydown=F;this.setSize(d);R.style.display="none";apf.sanitizeTextbox(E);};this.setSize=function(a){if(!E||!a){return;}var d=a.$ext.offsetWidth-2;var c=a.$ext.offsetHeight-a.oToolbar.offsetHeight-4;R.style.top=a.oToolbar.offsetHeight+"px";R.style.width=B.style.width=d+"px";E.style.width=d-(apf.isIE?2:0)+"px";R.style.height=c+(apf.isIE?2:3)+"px";E.style.height=c-(apf.isIE?26:24)+"px";};var O={bullist:["<ul>","</ul>"],numlist:["<ol>","</ol>"],listitem:["<li>","</li>"],nbsp:["&nbsp;",null],"break":["<br />",null],paragraph:["<p>","</p>"]};this.$buttonClick=function(a,c){apf.setStyleClass(c,"active");var d=c.getAttribute("type");if(O[d]){T.apply(this,O[d]);}this.editor.$visualFocus();E.focus();apf.setStyleClass(c,"",["active"]);};function T(i,d){if(!i){return;}var j,c,l;if(!d){if(apf.hasMsRangeObject){j=document.selection.createRange();j.collapse();j.text=i;j.moveEnd("character",i.length);j.collapse();if(apf.document.activeElement==this.editor){j.select();}}else{c=E.value;l=E.selectionEnd;E.selectionStart=l;E.value=c.substr(0,l)+i+c.substr(l);E.selectionStart=E.selectionEnd=l+i.length;}}else{if(apf.hasMsRangeObject){j=document.selection.createRange();c=j.text;j.text=i+c+d;j.moveStart("character",-(c.length+d.length));j.moveEnd("character",-d.length);if(apf.document.activeElement==this.editor){j.select();}}else{var a=E.selectionStart;c=E.value;l=E.selectionEnd;E.value=c.substr(0,a)+i+c.substr(a,l-a)+d+c.substr(l);E.selectionStart=a+i.length;E.selectionEnd=l+d.length-1;}}}function G(i,d,c,a){return d+"apf.___JPFpd___"+D.push(c)+a;}function P(c){if(!this.regex){C.call(this);}D=[];var i=c.replace(this.regex.protectedTags,G);i=i.replace(this.regex.blocksOpener,"\n$&").replace(this.regex.blocksCloser,"$&\n").replace(this.regex.newLineTags,"$&\n").replace(this.regex.mainTags,"\n$&\n");var j,l,d="",m=i.split(this.regex.lineSplitter);i="";for(j=0,l=m.length;j<l;j++){var a=m[j];if(a.length==0){continue;}if(this.regex.decreaseIndent.test(a)){d=d.replace(this.regex.formatIndentatorRemove,"");}i+=d+a+"\n";if(this.regex.increaseIndent.test(a)){d+="    ";}}for(j=0,l=D.length;j<l;j++){var n=new RegExp("apf.___JPFpd___"+j);i=i.replace(n,D[j].replace(/\$/g,"$$$$"));}return i.trim();}function C(){this.regex={blocksOpener:/\<(P|DIV|H1|H2|H3|H4|H5|H6|ADDRESS|PRE|OL|UL|LI|TITLE|META|LINK|BASE|SCRIPT|LINK|TD|TH|AREA|OPTION)[^\>]*\>/gi,blocksCloser:/\<\/(P|DIV|H1|H2|H3|H4|H5|H6|ADDRESS|PRE|OL|UL|LI|TITLE|META|LINK|BASE|SCRIPT|LINK|TD|TH|AREA|OPTION)[^\>]*\>/gi,newLineTags:/\<(BR|HR)[^\>]*\>/gi,mainTags:/\<\/?(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR)[^\>]*\>/gi,lineSplitter:/\s*\n+\s*/g,increaseIndent:/^\<(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR|UL|OL)[ \/\>]/i,decreaseIndent:/^\<\/(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR|UL|OL)[ \>]/i,protectedTags:/(<PRE[^>]*>)([\s\S]*?)(<\/PRE>)/gi,formatIndentatorRemove:/^    /};}this.queryState=function(a){if(a.$pluginsActive==this.name){return apf.SELECTED;}return apf.OFF;};this.destroy=function(){E=this.regex=null;delete E;delete this.regex;};});apf.ContentEditable.colorPlugin=function(o){this.name=o;this.icon=o;this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.buttonNode=null;this.state=apf.OFF;this.colspan=18;var s;var n=["00","33","66","99","CC","FF"];function m(){apf.ContentEditable.colorPlugin.palette=[];var c,d,a,i;for(c=0;c<n.length;c++){for(d=0;d<n.length;d++){i=(c%3)*6+d;for(a=0;a<n.length;a++){if(!apf.ContentEditable.colorPlugin.palette[i]){apf.ContentEditable.colorPlugin.palette[i]=[];}apf.ContentEditable.colorPlugin.palette[i][(c<3?0:6)+a]={red:n[c],green:n[d],blue:n[a]};}}}}function t(c){if(typeof c=="string"&&c.length>0){var d=[];var i=c.charAt(0);var a=c.charAt(4);d[0]=a;d[4]=i;i=c.charAt(1);a=c.charAt(5);d[1]=a;d[5]=i;return d[0]+d[1]+c.charAt(2)+c.charAt(3)+d[4]+d[5];}return c;}function q(c){var a=(c&16777215).toString(16);return("000000").substring(0,6-a.length)+a;}this.init=function(c,d){this.buttonNode.className=this.buttonNode.className+" dropdown_small";var i=this.buttonNode.getElementsByTagName("div")[0];this.colorPreview=this.buttonNode.insertBefore(document.createElement("div"),i);this.colorPreview.className="colorpreview";var a=this.buttonNode.insertBefore(document.createElement("span"),i);a.className="selectarrow";};this.execute=function(a){if(!s){this.editor=a;apf.popup.setContent(this.$uniqueId,this.createPanelBody());}a.dispatchEvent("pluginexecute",{name:this.name,plugin:this});this.editor.$showPopup(this,this.$uniqueId,this.buttonNode,apf.isIE6?296:292,167);return{id:this.name,action:null};};this.setStyleMethod=function(a){if(typeof a=="undefined"){a=true;}try{this.editor.$activeDocument.execCommand("styleWithCSS",false,a);}catch(c){this.editor.$activeDocument.execCommand("useCSS",false,!a);}};this.queryState=function(c){var i=this.name=="forecolor"?"ForeColor":apf.isIE?"BackColor":"HiliteColor";this.state=c.$queryCommandState(i);var a="";try{a=c.$queryCommandValue(i);}catch(d){}if(apf.isIE){a="#"+t(q(a));}if(a!=this.colorPreview.style.backgroundColor){this.colorPreview.style.backgroundColor=a;}};this.submit=function(c){c=new apf.AbstractEvent(c||window.event);while(c.target.tagName.toLowerCase()!="a"&&c.target.className!="editor_popup"){c.target=c.target.parentNode;}var a=c.target.getAttribute("rel");if(a){apf.popup.forceHide();this.editor.$execCommand(this.name=="forecolor"?"ForeColor":apf.isIE?"BackColor":"HiliteColor","#"+a);}};this.createPanelBody=function(){if(!apf.ContentEditable.colorPlugin.palette){m();}s=document.body.appendChild(document.createElement("div"));s.className="editor_popup";s.style.display="none";var a=[];var c,d,i,j=apf.ContentEditable.colorPlugin.palette;for(c=0;c<j[0].length;c++){a.push('<div class="editor_panelrow">');for(d=0;d<j.length;d++){i=j[d][c].red+j[d][c].green+j[d][c].blue;a.push('<a class="editor_smallcell editor_panelcell" style="background-color:#',i,';" rel="',i,'" href="javascript:;" onmousedown="apf.lookup(',this.$uniqueId,').submit(event);">                    &nbsp;</a>');}a.push("</div>");}s.innerHTML=a.join("");return s;};this.destroy=function(){s=this.colorPreview=null;delete s;delete this.colorPreview;};};apf.ContentEditable.colorPlugin.palette=null;apf.ContentEditable.plugin("forecolor",apf.ContentEditable.colorPlugin);apf.ContentEditable.plugin("backcolor",apf.ContentEditable.colorPlugin);apf.ContentEditable.plugin("print",function(){this.name="print";this.icon="print";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding="ctrl+p";this.state=apf.OFF;this.execute=function(c){if(apf.print){apf.print(c.getValue());}c.dispatchEvent("pluginexecute",{name:this.name,plugin:this});};this.queryState=function(){return this.state;};});apf.ContentEditable.plugin("preview",function(){this.name="preview";this.icon="preview";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding="ctrl+shift+p";this.state=apf.OFF;this.execute=function(c){if(apf.printer){apf.printer.preview(c.getValue());}c.dispatchEvent("pluginexecute",{name:this.name,plugin:this});};this.queryState=function(){return this.state;};});apf.ContentEditable.plugin("anchor",function(){this.name="anchor";this.icon="anchor";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.keyBinding="ctrl+shift+a";this.state=apf.OFF;this.editor=null;var c;this.init=function(a,j){this.editor=a;this.buttonNode.className=this.buttonNode.className+" dropdown_small";var l=this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]);l.className="selectarrow";};this.execute=function(a){if(!c){this.editor=a;apf.popup.setContent(this.$uniqueId,this.createPanelBody());}this.editor.dispatchEvent("pluginexecute",{name:this.name,plugin:this});this.editor.$showPopup(this,this.$uniqueId,this.buttonNode,218,47);if(c.style.visibility=="hidden"){c.style.visibility="visible";}var i=this;$setTimeout(function(){i.oName.focus();});return{id:this.name,action:null};};this.queryState=function(){var a=this.editor.$selection.getSelectedNode();if(a.tagName=="A"&&a.getAttribute("name")){return apf.ON;}return this.state;};this.submit=function(a){apf.popup.forceHide();if(!this.oName.value){return;}this.editor.$insertHtml('<a name="'+this.oName.value+'" class="itemAnchor" />');this.editor.$selection.collapse(false);};this.createPanelBody=function(){c=document.body.appendChild(document.createElement("div"));c.className="editor_popup";c.style.display="none";var i="editor_"+this.$uniqueId+"_anchor_url",a="editor_"+this.$uniqueId+"_anchor_button";c.innerHTML='<div class="editor_panelrow editor_panelrowinput">                <label for="'+i+'">Anchor name</label>                <input type="text" id="'+i+'" name="'+i+'" class="editor_input" value="" />            </div>            <div id="'+a+'" class="editor_panelrow editor_panelrowbtns"></div>';new apf.toolbar({htmlNode:document.getElementById(a),skinset:apf.getInheritedAttribute(this.editor.parentNode,"skinset"),childNodes:[new apf.bar({childNodes:[new apf.button({caption:this.editor.$translate("insert"),onclick:"apf.lookup("+this.$uniqueId+").submit(event)"})]})]});this.oName=document.getElementById(i);apf.sanitizeTextbox(this.oName);return c;};this.destroy=function(){c=this.editor=this.oName=null;delete c;delete this.editor;delete this.oName;};});apf.ContentEditable.plugin("scayt",function(){this.name="scayt";this.icon="scayt";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding="ctrl+h";this.state=apf.OFF;this.execute=function(c){apf.oHttp.get(function(){},{});c.dispatchEvent("pluginexecute",{name:this.name,plugin:this});};this.queryState=function(c){return this.state;};});apf.ContentEditable.searchPlugin=function(i){this.name=i;this.icon=i;this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.keyBinding=this.name=="search"?"ctrl+f":"ctrl+shift+f";this.state=apf.OFF;var d;this.init=function(a,c){this.buttonNode.className=this.buttonNode.className+" dropdown_small";var l=this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]);l.className="selectarrow";};this.execute=function(a){if(!d){this.editor=a;apf.popup.setContent(this.$uniqueId,this.createPanelBody());}a.dispatchEvent("pluginexecute",{name:this.name,plugin:this});this.editor.$showPopup(this,this.$uniqueId,this.buttonNode,218,this.name=="search"?71:95);this.oSearch.value=this.editor.$selection.getContent();var c=this;$setTimeout(function(){c.oSearch.focus();});return{id:this.name,action:null};};this.queryState=function(a){return this.state;};this.submit=function(z){var u=this.oSearch.value,t=this.oCase.checked,s=0;if(!u){return;}if(apf.isIE){this.editor.$selection.set();}this.editor.$selection.collapse(false);this.editor.$visualFocus();if(t){s=s|4;}var A=false;if(apf.isIE){var a=this.editor.$selection;var c=a.getRange();if(!(A=c.findText(u,1,s))){this.editor.$activeDocument.execCommand("SelectAll");a.collapse(true);c=a.getRange();A=c.findText(u,1,s);}if(A){c.scrollIntoView();c.select();}a.cache();}else{if(this.editor.oWin.find(u,t,false,true,false,false,false)){A=true;}}if(this.oReplBtn){this.oReplBtn[!A?"disable":"enable"]();}if(!A){if(this.oReplBtn){this.oReplBtn.disable();}alert("No occurences found for '"+u+"'");}else{if(this.oReplBtn){this.oReplBtn.enable();}}if(z.stop){z.stop();}else{z.cancelBubble=true;}if(!apf.isIE){var w=this;$setTimeout(function(){w.oSearch.focus();});}return false;};this.onDoReplClick=function(a){this.replace();};this.onReplAllClick=function(w){var u=this.oSearch.value,t=this.oCase.checked,s=0,c=this.editor;if(!u){return;}this.editor.$execCommand("SelectAll");this.editor.$selection.collapse(true);this.editor.$visualFocus();var q=this.editor.$selection.getRange(),a=0;if(t){s=s|4;}if(apf.isIE){while(q.findText(u,1,s)){q.scrollIntoView();q.select();this.replace();a++;}this.editor.$selection.cache();}else{while(this.editor.oWin.find(u,t,false,false,false,false,false)){this.replace();a++;}}if(a>0){alert(a+" occurences found and replaced with '"+this.oReplace.value+"'");}else{alert("No occurences found for '"+u+"'");}};this.replace=function(){var a=this.oReplace.value;if(apf.isIE){this.editor.$selection.getRange().duplicate().pasteHTML(a);}else{this.editor.$activeDocument.execCommand("InsertHTML",false,a);}};this.createPanelBody=function(){d=document.body.appendChild(document.createElement("div"));d.className="editor_popup";d.style.display="none";var n="editor_"+this.$uniqueId+"_input",o="editor_"+this.$uniqueId+"_replace",q="editor_"+this.$uniqueId+"_case",a="editor_"+this.$uniqueId+"_btns";d.innerHTML='<div class="editor_panelrow editor_panelrowinput">                <label for="'+n+'">Find what</label>                <textarea type="text" id="'+n+'" class="editor_input" name="'+n+'" value="">                </textarea>            </div>'+(this.name=="replace"?'<div class="editor_panelrow editor_panelrowinput">                <label for="'+o+'">Replace with</label>                <input type="text" id="'+o+'" class="editor_input" name="'+o+'" value="" />            </div>':"")+'<div class="editor_panelrow editor_panelrowinput">                <label for="'+q+'">Match case</label>                <input type="checkbox" id="'+q+'" name="'+q+'" class="editor_checkbox" value="" />            </div>            <div id="'+a+'" class="editor_panelrow editor_panelrowbtns"></div>';this.oSearch=document.getElementById(n);this.oCase=document.getElementById(q);new apf.toolbar({htmlNode:document.getElementById(a),skinset:apf.getInheritedAttribute(this.editor.parentNode,"skinset"),childNodes:[new apf.bar({childNodes:this.name=="search"?[new apf.button({caption:this.editor.$translate("findnext"),onclick:"apf.lookup("+this.$uniqueId+").submit(event)"})]:[new apf.button({caption:this.editor.$translate("findnext"),onclick:"apf.lookup("+this.$uniqueId+").submit(event)"}),(this.oReplBtn=new apf.button({caption:this.editor.$translate("doreplace"),onclick:"apf.lookup("+this.$uniqueId+").onDoReplClick(event)"})),(this.oReplAllBtn=new apf.button({caption:this.editor.$translate("replaceall"),onclick:"apf.lookup("+this.$uniqueId+").onReplAllClick(event)"}))]})]});if(this.name=="replace"){this.oReplace=document.getElementById(o);this.oReplBtn.disable();}if(apf.hasFocusBug){var c=function(j){j=j||window.event;j.cancelBubble=true;};apf.sanitizeTextbox(this.oSearch);this.oSearch.onselectstart=c;if(this.oReplace){apf.sanitizeTextbox(this.oReplace);this.oReplace.onselectstart=c;}apf.sanitizeTextbox(this.oCase);}return d;};this.destroy=function(){d=this.oSearch=this.oCase=null;delete d;delete this.oSearch;delete this.oCase;if(this.oReplace){this.oReplace=this.oReplBtn=this.oReplAllBtn=null;delete this.oReplace;delete this.oReplBtn;delete this.oReplAllBtn;}};};apf.ContentEditable.plugin("search",apf.ContentEditable.searchPlugin);apf.ContentEditable.plugin("replace",apf.ContentEditable.searchPlugin);apf.ContentEditable.plugin("emotions",function(){this.name="emotions";this.icon="emotions";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.buttonNode=null;this.state=apf.OFF;this.colspan=4;this.emotions=[];var c;this.init=function(a,j){this.buttonNode.className=this.buttonNode.className+" dropdown_small";var l=this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]);l.className="selectarrow";};this.execute=function(m){if(!c){this.editor=m;this.emotionsPath=m.$getPluginOption("emotions","path");var n,i,a=m.$getPluginOption("emotions");for(n=0;n<a.childNodes.length;n++){i=a.childNodes[n];if(i.nodeType==3||i.nodeType==4){this.emotions=i.nodeValue.splitSafe(",");}}apf.popup.setContent(this.$uniqueId,this.createPanelBody());}m.dispatchEvent("pluginexecute",{name:this.name,plugin:this});this.editor.$showPopup(this,this.$uniqueId,this.buttonNode,123,110);return{id:this.name,action:null};};this.queryState=function(){return this.state;};this.submit=function(a){a=new apf.AbstractEvent(a||window.event);this.editor.$visualFocus();var i=a.target.getAttribute("rel");if(!i||i==null){i=a.target.parentNode.getAttribute("rel");}if(!i){return;}apf.popup.forceHide();this.editor.$insertHtml('<img src="'+this.emotionsPath+"/smiley-"+i+'.gif" alt="" border="0" />',true);};this.createPanelBody=function(){c=document.body.appendChild(document.createElement("div"));c.className="editor_popup";c.style.display="none";var q=[];var n=this.emotions;var a=this.emotionsPath;var i=this.colspan-1;for(var o=0;o<n.length;o++){if(o%this.colspan==0){q.push('<div class="editor_panelrow">');}q.push('<a class="editor_panelcell editor_largestcell" rel="',n[o],'" href="javascript:;" onmousedown="apf.lookup(',this.$uniqueId,').submit(event);">                <img border="0" src="',a,"/smiley-",n[o],'.gif" />                </a>');if(o%this.colspan==i){q.push("</div>");}}c.innerHTML=q.join("");return c;};this.destroy=function(){c=null;delete c;};});apf.ContentEditable.directionPlugin=function(c){this.name=c;this.icon=c;this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.state=apf.OFF;this.execute=function(a){a.dispatchEvent("pluginexecute",{name:this.name,plugin:this});};this.queryState=function(a){return this.state;};};apf.ContentEditable.plugin("ltr",apf.ContentEditable.directionPlugin);apf.ContentEditable.plugin("rtl",apf.ContentEditable.directionPlugin);apf.ContentEditable.plugin("image",function(){this.name="image";this.icon="image";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARPANEL;this.hook="ontoolbar";this.keyBinding="ctrl+alt+i";this.state=apf.OFF;var c;this.init=function(a){this.buttonNode.className=this.buttonNode.className+" dropdown_small";var i=this.buttonNode.insertBefore(document.createElement("span"),this.buttonNode.getElementsByTagName("div")[0]);i.className="selectarrow";};this.execute=function(a){if(!c){this.editor=a;apf.popup.setContent(this.$uniqueId,this.createPanelBody());}a.dispatchEvent("pluginexecute",{name:this.name,plugin:this});this.editor.$showPopup(this,this.$uniqueId,this.buttonNode,218,47);var i=this;$setTimeout(function(){i.oUrl.focus();});return{id:this.name,action:null};};this.queryState=function(a){return this.state;};this.submit=function(a){var l=this.oUrl.value;if(l){apf.popup.forceHide();var j=new apf.url(l);if(!j.protocol||!j.host||!j.file){alert("Please enter a valid URL");}else{this.editor.$insertHtml('<img src="'+l+'" border="0" />',true);}}};this.createPanelBody=function(){c=document.body.appendChild(document.createElement("div"));c.className="editor_popup";c.style.display="none";var a="editor_"+this.$uniqueId+"_input";var i="editor_"+this.$uniqueId+"_btns";c.innerHTML='<div class="editor_panelrow editor_panelrowinput">                <label for="'+a+'">Image URL</label>                <input type="text" id="'+a+'" class="editor_input" name="'+a+'" value="" />            </div>            <div id="'+i+'" class="editor_panelrow editor_panelrowbtns"></div>';this.oUrl=document.getElementById(a);this.appendAmlNode('<a:toolbar xmlns:a="'+apf.ns.aml+'"><a:bar>             <a:button caption="Insert"               onclick="apf.lookup('+this.$uniqueId+').submit(event)" />             </a:bar></a:toolbar>',document.getElementById(i));if(apf.hasFocusBug){apf.sanitizeTextbox(this.oUrl);this.oUrl.onselectstart=function(d){d=d||window.event;d.cancelBubble=true;};}return c;};this.destroy=function(){c=this.oUrl=null;delete c;delete this.oUrl;};});apf.ContentEditable.plugin("imagespecial",function(){this.name="imagespecial";this.icon="image";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding="ctrl+alt+j";this.state=apf.OFF;var c;this.execute=function(a){if(!c){var i=(a.getAttribute("imagewindow")||"").trim();if(i){c=self[i];}}if(c&&c.show){c.show();}a.dispatchEvent("pluginexecute",{name:this.name,plugin:this});};this.queryState=function(a){return this.state;};});apf.ContentEditable.plugin("visualaid",function(){this.name="visualaid";this.icon="visualaid";this.type=apf.TOOLBARITEM;this.subType=apf.TOOLBARBUTTON;this.hook="ontoolbar";this.keyBinding="ctrl+shift+v";this.state=apf.OFF;this.execute=function(d){var i=this.queryState(d);d.$activeDocument.body.className=(i==apf.ON)?"":"visualAid";d.$notifyButton(this.name);apf.dispatchEvent("pluginexecute",{name:this.name,plugin:this});};this.queryState=function(c){this.state=apf[c.$activeDocument.body.className=="visualAid"?"ON":"OFF"];return this.state;};});apf.__CHILDVALUE__=1<<27;apf.ChildValue=function(){if(!this.$childProperty){this.$childProperty="value";}this.$regbase=this.$regbase|apf.__CHILDVALUE__;var c;this.addEventListener("DOMCharacterDataModified",c=function(a){if(a.currentTarget==this){return;}var l=this.serialize().match(/^[\s\S]*?>([\s\S]*)<[\s\S]*?$/),j=l&&l[1]||"";if(j.indexOf("{")>-1||j.indexOf("[")>-1){this.$setDynamicProperty(this.$childProperty,j);}else{this.setProperty(this.$childProperty,j);}});this.addEventListener("DOMNodeInserted",c);this.addEventListener("DOMNodeRemoved",c);this.addEventListener("DOMNodeInsertedIntoDocument",function(a){if(!this.getElementsByTagNameNS(this.namespaceURI,"*").length&&(this.childNodes.length>1||this.firstChild&&(this.firstChild.nodeType==1||this.firstChild.nodeType!=7&&this.firstChild.nodeValue.trim().length))){var l=(this.$aml&&this.$aml.xml||this.serialize()).match(/^[\s\S]*?>([\s\S]*)<[\s\S]*?$/),j=l&&l[1]||"";if(j.indexOf("{")>-1||j.indexOf("[")>-1){this.$setDynamicProperty(this.$childProperty,j);}else{this.setProperty(this.$childProperty,j);}}else{if(typeof this[this.$childProperty]=="undefined"){this.$propHandlers[this.$childProperty].call(this,"");}}});};apf.__DATAACTION__=1<<25;apf.DataAction=function(){this.$regbase=this.$regbase|apf.__DATAACTION__;this.getActionTracker=function(l){if(!apf.AmlNode){return apf.window.$at;}var n=this,m=l?null:this.$at;if(!m&&this.dataParent){m=this.dataParent.parent.$at;}while(!m){if(!n.parentNode){var j;return(j=this.getModel&&this.getModel(true))&&j.$at||apf.window.$at;}m=(n=n.parentNode).$at;}return m;};this.$lock={};this.$actionsLog={};this.$actions=false;this.$startAction=function(u,s,A){if(this.disabled||this.contenteditable&&u!="edit"){return false;}var t=this.$actions&&this.$actions.getRule(u,s);if(!t&&apf.config.autoDisableActions&&this.$actions){return false;}var z=typeof apf.offline!="undefined";if(z&&!apf.offline.canTransact()){return false;}if(this.dispatchEvent(u+"start",{xmlContext:s})===false){return false;}if(this.$lock[u]&&!this.$lock[u].stopped){this.$stopAction();}var o=t?t.lock:null;if((z&&(!apf.offline.enabled||!apf.offline.onLine))&&o){var w=this.$lock[u]={start:z&&!apf.offline.onLine?apf.offline.offlineTime:new Date().getTime(),stopped:false,xmlContext:s,instr:o,rollback:A},q=this;apf.saveData(o,{xmlNode:s,unlock:false,callback:function(a,c,d){if(c==apf.TIMEOUT&&d.retries<apf.maxHttpRetries){return d.tpModule.retry(d.id);}if(c==apf.SUCCESS){q.dispatchEvent("locksuccess",apf.extend({state:d.http.status,bubbles:true},d));w.retrieved=true;if(w.stopped){q.$stopAction(u,true,w);}}else{if(w.stopped){return;}A.call(q,s);q.dispatchEvent("lockfailed",apf.extend({state:d.http.status,bubbles:true},d));}}});}this.$actionsLog[u]=s;return true;};this.addEventListener("xmlupdate",function(i){if(apf.xmldb.disableRSB!=2){return;}for(var d in this.$actionsLog){if(apf.isChildOf(this.$actionsLog[d],i.xmlNode,true)){this.$actionsLog[d].rollback.call(this,this.$actionsLog[d].xmlContext);}}});this.$stopAction=function(m,l,n){delete this.$actionsLog[m];if(!n){n=this.$lock[m];}if(n&&!n.stopped){n.stopped=true;if(l&&n.retrieved){var j=this;apf.saveData(n.instr,{xmlNode:n.xmlContext,unlock:true,callback:function(a,c,d){if(c==apf.TIMEOUT&&d.retries<apf.maxHttpRetries){return d.tpModule.retry(d.id);}j.dispatchEvent((c==apf.SUCCESS?"unlocksuccess":"unlockfailed"),apf.extend({state:d.http.status,bubbles:true},d));}});}}return n;};this.$executeAction=function(K,D,G,w,C,F,J){if(this.disabled||this.contenteditable&&G!="edit"){return;}if(typeof apf.offline!="undefined"&&!apf.offline.canTransact()){return false;}var A=this.$actions&&this.$actions.getRule(G,w);if(!A&&this.$actions&&apf.config.autoDisableActions&&"action|change".indexOf(G)==-1){apf.console.warn("Could not execute action '"+G+"'.               No valid action rule was found and auto-disable-actions is enabled");return false;}var M=this.$stopAction(G);var z;if(J){z=[];for(var I=J.length-1;I>=0;I--){z.unshift({xmlActionNode:A&&A[4],amlNode:this,selNode:J[I],xmlNode:J[I]});}}var B=new apf.AmlEvent("before"+G.toLowerCase(),{action:K,args:D,xmlActionNode:A,amlNode:this,selNode:F,multiple:z||false,timestamp:M?M.start:new Date().getTime()});if(!C){if(this.dispatchEvent(B.name,null,B)===false){return false;}}var E=this.getActionTracker().execute(B);B.xmlNode=E.xmlNode;B.undoObj=E;if(!C){B.name="after"+G.toLowerCase();B.cancelBubble=false;delete B.returnValue;this.dispatchEvent(B.name,null,B);}return E;};this.$executeSingleValue=function(J,A,K,M){var B,m,N=this.$getBindRule(A,K);var O=N.cvalue||N.cmatch;var I,G=O.xpaths,D=false;if(G[0]=="#"||G[1]=="#"){var E=(N.cvalue3||(N.cvalue3=apf.lm.compile(N.value,{xpathmode:5})))(K);var C=E.model&&E.model.nodeFunc&&E.model;if(C){var F=C.queryNode(E.xpath);K=C.data;}else{C=apf.xmldb.findModel(E.model);var F=E.model.selectSingleNode(E.xpath);K=E.model;}G[1]=E.xpath;}else{var C=G[0]&&apf.nameserver.get("model",G[0])||this.$model,F=C?C.queryNode(G[1]):(K||this.xmlRoot).selectSingleNode(G[1]);}if(F){if(apf.queryValue(F)==M){return;}I=(F.nodeType==1||F.nodeType==3||F.nodeType==4)?"setTextNode":"setAttribute";m=(F.nodeType==1)?[F,M]:(F.nodeType==3||F.nodeType==4?[F.parentNode,M]:[F.ownerElement||F.selectSingleNode(".."),F.nodeName,M]);}else{if(!this.$createModel){return false;}I="setValueByXpath";B=G[1];if(!K){if(!C){C=this.getModel();}if(C){if(!C.data){C.load("<data />");}B=(C.getXpathByAmlNode(this)||".")+(B&&B!="."?"/"+B:"");K=C.data;}else{if(!this.dataParent){return false;}K=this.dataParent.parent.selected||this.dataParent.parent.xmlRoot;if(!K){return false;}B=(this.dataParent.xpath||".")+(B&&B!="."?"/"+B:"");D=true;}}m=[K,M,B];}this.$executeAction(I,m,J,K);if(D){this.load(K.selectSingleNode(B));}};this.change=function(j,l){if(this.errBox&&this.errBox.visible&&this.isValid&&this.isValid()){this.clearError();}if(!this.xmlRoot&&!this.$createModel||!(this.$mainBind=="value"&&this.hasFeature(apf.__MULTISELECT__)?this.$attrBindings.value:this.$hasBindRule(this.$mainBind))){if(!l&&j===this.value||this.dispatchEvent("beforechange",{value:j})===false){return false;}this.setProperty("value",j);return this.dispatchEvent("afterchange",{value:j});}var i=this.$attrBindings.eachvalue&&"eachvalue"||this.$bindings.value&&"value"||this.$hasBindRule("caption")&&"caption";if(j==(i!="value"&&(this.xmlRoot&&this.$applyBindRule("value",this.xmlRoot,null,true))||this.value)){return false;}this.$executeSingleValue("change",this.$mainBind,this.xmlRoot,j);};this.$booleanProperties["render-root"]=true;this.$supportedProperties.push("create-model","actions");this.$propHandlers["create-model"]=function(c){this.$createModel=c;};this.addEventListener("DOMNodeInsertedIntoDocument",function(c){if(typeof this["create-model"]=="undefined"&&!this.$setInheritedAttribute("create-model")){this.$createModel=true;}});};apf.config.$inheritProperties["create-model"]=1;apf.__CACHE__=1<<2;apf.Cache=function(){this.cache={};this.subTreeCacheContext=null;this.caching=true;this.$regbase=this.$regbase|apf.__CACHE__;this.addEventListener("$load",function(a){if(!this.caching||a.forceNoCache){return;}if(!this.cacheId){this.cacheId=a.xmlNode.getAttribute(apf.xmldb.xmlIdTag)||apf.xmldb.nodeConnect(apf.xmldb.getXmlDocId(a.xmlNode),a.xmlNode);}var c=i.call(this,this.cacheId,a.xmlNode);if(c){if(c==-1){return false;}var l=this.getTraverseNodes();if(l.length&&this.autoselect){this.select(l[0],null,null,null,true);}else{this.clearSelection();}if(!l.length){this.$removeClearMessage();this.$setClearMessage(this["empty-message"],"empty");}if(l.length!=this.length){this.setProperty("length",l.length);}return false;}});this.addEventListener("$clear",function(){if(!this.caching){return;}if(this.hasFeature(apf.__MULTISELECT__)&&this.subTreeCacheContext&&this.subTreeCacheContext.oHtml){if(this.renderRoot){this.subTreeCacheContext.parentNode.insertBefore(this.subTreeCacheContext.oHtml,this.subTreeCacheContext.beforeNode);}else{while(this.$int.childNodes.length){this.subTreeCacheContext.oHtml.appendChild(this.$int.childNodes[0]);}}this.documentId=this.xmlRoot=this.cacheId=this.subTreeCacheContext=null;}else{if(this.$loadedWhenOffline){this.$loadedWhenOffline=false;}else{var a=this.$getCurrentFragment();if(!a){return;}a.documentId=this.documentId;a.xmlRoot=this.xmlRoot;if(this.cacheId||this.xmlRoot){d.call(this,this.cacheId||this.xmlRoot.getAttribute(apf.xmldb.xmlIdTag)||"doc"+this.xmlRoot.getAttribute(apf.xmldb.xmlDocTag),a);}}}});function i(u,c){if(c&&this.hasFeature(apf.__MULTISELECT__)&&this.$isTreeArch){var z,t=c.getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId,a=this.$pHtmlDoc.getElementById(t);if(a){z=getId?false:this.$int;}else{for(var w in this.cache){if(this.cache[w]&&this.cache[w].nodeType){a=this.cache[w].getElementById(t);if(a){z=getId?w:this.cache[w];break;}}}}if(z&&!this.cache[u]){var A=this.$findHtmlNode(c.getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId);this.subTreeCacheContext={oHtml:A,parentNode:A.parentNode,beforeNode:A.nextSibling,cacheItem:z};this.documentId=apf.xmldb.getXmlDocId(c);this.cacheId=u;this.xmlRoot=c;if(this.renderRoot){this.$int.appendChild(A);}else{while(A.childNodes.length){this.$int.appendChild(A.childNodes[0]);}}return true;}}if(!this.cache[u]){return false;}var s=this.cache[u];this.documentId=s.documentId;this.cacheId=u;this.xmlRoot=s.xmlRoot;this.clearCacheItem(u);this.$setCurrentFragment(s);return true;}function d(a,c){if(!this.caching){return;}this.cache[a]=c;}this.$findHtmlNode=function(a){var l=this.$pHtmlDoc.getElementById(a);if(l){return l;}for(var c in this.cache){if(this.cache[c]&&this.cache[c].nodeType){l=this.cache[c].getElementById(a);if(l){return l;}}}return null;};this.clearCacheItem=function(a,c){this.cache[a].documentId=this.cache[a].cacheId=this.cache[a].xmlRoot=null;if(c){apf.destroyHtmlNode(this.cache[a]);}this.cache[a]=null;};this.clearAllCache=function(){for(var a in this.cache){if(this.cache[a]){this.clearCacheItem(a,true);}}};this.getCacheItem=function(a){return this.cache[a];};this.$isCached=function(a){return this.cache[a]||this.cacheId==a?true:false;};if(!this.$getCurrentFragment){this.$getCurrentFragment=function(){var a=this.$int.ownerDocument.createDocumentFragment();while(this.$int.childNodes.length){a.appendChild(this.$int.childNodes[0]);}return a;};this.$setCurrentFragment=function(a){this.$int.appendChild(a);if(!apf.window.hasFocus(this)){this.blur();}};}this.$booleanProperties.caching=true;this.$supportedProperties.push("caching");this.addEventListener("DOMNodeRemovedFromDocument",function(a){this.clearAllCache();});};apf.GuiElement.propHandlers.caching=function(c){if(!apf.isTrue(c)){return;}if(!this.hasFeature(apf.__CACHE__)){this.implement(apf.Cache);}};apf.__DOCKING__=1<<18;apf.Docking=function(){this.$regbase=this.$regbase|apf.__DOCKING__;this.startDocking=function(c){apf.DockServer.start(this.aData,this,c);};};apf.DockServer={edge:30,inited:false,init:function(){if(this.inited){return;}this.inited=true;if(!this.nextPositionMarker){this.nextPositionMarker=document.body.appendChild(document.createElement("div"));this.nextPositionMarker.style.border="4px solid #555";this.nextPositionMarker.style.position="absolute";this.nextPositionMarker.style.zIndex=10000;this.nextPositionMarker.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=50);";this.nextPositionMarker.style.opacity=0.5;apf.setUniqueHtmlId(this.nextPositionMarker);}},start:function(n,l,o){if(!this.inited){apf.DockServer.init();}this.dragdata={item:n,amlNode:l,x:o.offsetX||o.layerX,y:o.offsetY||o.layerY};apf.dragMode=true;document.onmousemove=this.onmousemove;document.onmouseup=this.onmouseup;apf.plane.show(this.nextPositionMarker);var m=apf.getAbsolutePosition(n.oHtml),q=apf.getDiff(this.nextPositionMarker);this.nextPositionMarker.style.left=m[0]+"px";this.nextPositionMarker.style.top=m[1]+"px";this.nextPositionMarker.style.width=(n.oHtml.offsetWidth-q[0])+"px";this.nextPositionMarker.style.height=(n.oHtml.offsetHeight-q[1])+"px";this.nextPositionMarker.style.display="block";apf.layout.pause(n.oHtml.parentNode);},floatElement:function(c){this.dragdata.item.setPosition(c.clientX-this.dragdata.x,c.clientY-this.dragdata.y);if(this.dragdata.item.hidden!=3){this.dragdata.item.setFloat();this.dragdata.amlNode.$purgeAlignment();}else{apf.layout.play(this.dragdata.item.oHtml.parentNode);}},setPosition:function(i){var d=apf.getDiff(this.nextPositionMarker);this.nextPositionMarker.style.left=(i.clientX-this.dragdata.x)+"px";this.nextPositionMarker.style.top=(i.clientY-this.dragdata.y)+"px";this.nextPositionMarker.style.width=(this.dragdata.item.size[0]-d[0])+"px";this.nextPositionMarker.style.height=((this.dragdata.item.state<0?this.dragdata.item.size[1]:this.dragdata.item.fheight)-d[1])+"px";document.body.style.cursor="default";},onmousemove:function(q){if(!q){q=event;}if(apf.isIE&&q.button<1){return false;}apf.plane.hide();apf.DockServer.nextPositionMarker.style.top="10000px";var ae=document.elementFromPoint(q.clientX+document.documentElement.scrollLeft,q.clientY+document.documentElement.scrollTop);apf.plane.show(apf.DockServer.nextPositionMarker);var P=ae;while(P&&!P.host&&P.parentNode){P=P.parentNode;}var z=P&&P.host?P.host:false,U=z.$ext;if(!z.aData||!z.dock){document.body.style.cursor="";apf.setStyleClass(document.body,"same",["south","east","north","west"]);return apf.DockServer.setPosition(q);}if(apf.DockServer.dragdata.item==z.aData&&z.aData.hidden==3){return apf.DockServer.setPosition(q);}var ac=z.aData.calcData,aa=apf.getAbsolutePosition(U),t=q.clientX-aa[0],X=q.clientY-aa[1],W=apf.getDiff(apf.DockServer.nextPositionMarker),af=W[1],ab=W[0],Z=Math.min(apf.DockServer.edge,U.offsetHeight/2),w=Math.min(apf.DockServer.edge,U.offsetWidth/2),V=U.offsetWidth-t,l=U.offsetHeight-X,ad,R=l/Z,T=t/w,Q=X/Z,Y=V/w;if(R<Math.min(T,Y,Q)){if(l<=Z){ad="south";}}else{if(Y<Math.min(R,Q,T)){if(V<=w){ad="east";}}else{if(T<Math.min(R,Q,Y)){if(t<=w){ad="west";}}else{if(Q<Math.min(T,Y,R)){if(X<=Z){ad="north";}}}}}if(apf.DockServer.dragdata.item==z.aData){ad="same";}if(!ad){return apf.DockServer.setPosition(q);}var o=apf.DockServer.nextPositionMarker;if(ad=="west"){o.style.left=aa[0]+"px";o.style.top=aa[1]+"px";o.style.width=((U.offsetWidth/2)-ab)+"px";o.style.height=(U.offsetHeight-af)+"px";}else{if(ad=="north"){o.style.left=aa[0]+"px";o.style.top=aa[1]+"px";o.style.width=(U.offsetWidth-ab)+"px";o.style.height=(Math.ceil(U.offsetHeight/2)-af)+"px";}else{if(ad=="east"){o.style.left=(aa[0]+Math.ceil(U.offsetWidth/2))+"px";o.style.top=aa[1]+"px";o.style.width=((U.offsetWidth/2)-ab)+"px";o.style.height=(U.offsetHeight-af)+"px";}else{if(ad=="south"){o.style.left=aa[0]+"px";o.style.top=(aa[1]+Math.ceil(U.offsetHeight/2))+"px";o.style.width=(U.offsetWidth-ab)+"px";o.style.height=(Math.ceil(U.offsetHeight/2)-af)+"px";}else{if(ad=="same"){o.style.left=aa[0]+"px";o.style.top=aa[1]+"px";o.style.width=(U.offsetWidth-ab)+"px";o.style.height=(U.offsetHeight-af)+"px";}}}}}document.body.style.cursor="";apf.setStyleClass(document.body,ad,["same","south","east","north","west"]);},onmouseup:function(l){if(!l){l=event;}if(apf.isIE&&l.button<1){return false;}apf.plane.hide();apf.dragMode=false;document.onmousemove=document.onmouseup=null;apf.DockServer.nextPositionMarker.style.display="none";document.body.className="";var at=document.elementFromPoint(l.clientX+document.documentElement.scrollLeft,l.clientY+document.documentElement.scrollTop),aa=at;while(aa&&!aa.host&&aa.parentNode){aa=aa.parentNode;}var z=aa&&aa.host?aa.host:false,al=z.$ext,au=z.aData;if(!z.aData||!z.dock||apf.DockServer.dragdata.item==z.aData&&z.aData.hidden==3){return apf.DockServer.floatElement(l);}if(apf.DockServer.dragdata.item==z.aData){return apf.layout.play(al.parentNode);}var an=apf.getAbsolutePosition(al),q=l.clientX-an[0],ae=l.clientY-an[1],aq,am=Math.min(apf.DockServer.edge,al.offsetHeight/2),w=Math.min(apf.DockServer.edge,al.offsetWidth/2),ad=al.offsetWidth-q,j=al.offsetHeight-ae,ab=j/am,ac=q/w,ak=ae/am,af=ad/w;if(ab<Math.min(ac,af,ak)){if(j<=am){aq="b";}}else{if(af<Math.min(ab,ak,ac)){if(ad<=w){aq="r";}}else{if(ac<Math.min(ab,ak,af)){if(q<=w){aq="l";}}else{if(ak<Math.min(ac,af,ab)){if(ae<=am){aq="t";}}}}}if(!aq){return apf.DockServer.floatElement(l);}var ao=al.parentNode;q=apf.layout.layouts[ao.getAttribute("id")];if(!q){return false;}var t=q.root;var Y=au;if(apf.DockServer.dragdata.item.hidden==3){apf.DockServer.dragdata.item.unfloat();}var ah=apf.DockServer.dragdata.item,ap=ah.parent;if(ap.children.length==2){var ag=ap.children[(ah.stackId==0)?1:0];ag.parent=ap.parent;ag.stackId=ap.stackId;ag.parent.children[ag.stackId]=ag;ag.weight=ap.weight;ag.fwidth=ap.fwidth;ag.fheight=ap.fheight;}else{var Z=ap.children;for(var o=ah.stackId;o<Z.length;o++){Z[o]=Z[o+1];if(Z[o]){Z[o].stackId=o;}}Z.length--;}var ar=(aq=="l"||aq=="r")?"hbox":"vbox",ai=Y.parent,aj=apf.layout.getData(ar,q.layout);aj.splitter=Y.splitter;aj.edgeMargin=Y.edgeMargin;aj.id=apf.layout.metadata.push(aj)-1;aj.parent=ai;ai.children[Y.stackId]=aj;aj.stackId=Y.stackId;aj.children=(aq=="b"||aq=="r")?[Y,ah]:[ah,Y];Y.parent=ah.parent=aj;Y.stackId=(aq=="b"||aq=="r")?0:1;ah.stackId=(aq=="b"||aq=="r")?1:0;aj.fwidth=Y.fwidth;aj.fheight=Y.fheight;ah.weight=Y.weight=1;Y.fwidth=Y.fheight=null;var t=t.copy();q.layout.compile(t);q.layout.reset();apf.layout.activateRules(q.layout.parentNode);}};apf.BaseButton=function(){this.$init(true);};(function(){this.implement(apf.ChildValue);this.refKeyDown=this.refMouseDown=0;this.mouseOver=this.mouseLeft=false;this.$propHandlers.background=function(l){var j=this.$getLayoutNode("main","background",this.$ext);if(!j){return;}if(l){var i=l.split("|");this.$background=i.concat(["vertical",2,16].slice(i.length-1));j.style.backgroundImage="url("+this.mediaPath+i[0]+")";j.style.backgroundRepeat="no-repeat";}else{j.style.backgroundImage="";j.style.backgroundRepeat="";this.$background=null;}};this.addEventListener("keydown",function(i){var d=i.keyCode;switch(d){case 13:if(this.localName!="checkbox"){this.$ext.onmouseup(i.htmlEvent,true);}break;case 32:if(!i.htmlEvent.repeat){this.refKeyDown++;this.$updateState(i.htmlEvent);}return false;}},true);this.addEventListener("keyup",function(i){var d=i.keyCode;switch(d){case 32:this.refKeyDown--;if(this.refKeyDown<0){this.refKeyDown=0;return false;}if(this.refKeyDown+this.refMouseDown==0&&!this.disabled){this.$ext.onmouseup(i,true);}this.$updateState(i);return false;}},true);this.states={Out:1,Over:2,Down:3};this.$updateState=function(i,d){if(this.disabled||i.reset){this.refKeyDown=0;this.refMouseDown=0;this.mouseOver=false;return false;}if(this.refKeyDown>0||(this.refMouseDown>0&&this.mouseOver)||(this.isBoolean&&this.value)){this.$setState("Down",i,d);}else{if(this.mouseOver){this.$setState("Over",i,d);}else{this.$setState("Out",i,d);}}};this.$setupEvents=function(){var c=this;this.$ext.onmousedown=function(a){a=a||window.event;if(c.$notfromext&&(a.srcElement||a.target)==this){return;}c.refMouseDown=1;c.mouseLeft=false;c.$updateState(a,"mousedown");};this.$ext.onmouseup=function(a,i){a=a||window.event;if(!i&&(!c.mouseOver||!c.refMouseDown)){return;}c.refMouseDown=0;c.$updateState(a,"mouseup");if(c.disabled||(a&&a.type=="click"&&c.mouseLeft==true)){return false;}if(c.refMouseDown+c.refKeyDown){return false;}if(c.$clickHandler&&c.$clickHandler()){c.$updateState(a||event,"click");}else{c.dispatchEvent("click",{htmlEvent:a});}return false;};this.$ext.onmousemove=function(a){if(!c.mouseOver){a=a||window.event;if(c.$notfromext&&(a.srcElement||a.target)==this){return;}c.mouseOver=true;c.$updateState(a,"mouseover");}};this.$ext.onmouseout=function(a){a=a||window.event;var i=a.explicitOriginalTarget||a.toElement;if(this==i||apf.isChildOf(this,i)){return;}c.mouseOver=false;c.refMouseDown=0;c.mouseLeft=true;c.$updateState(a,"mouseout");};if(apf.isIphone){apf.iphone.linkEvents(this.$ext,true);}if(apf.hasClickFastBug){this.$ext.ondblclick=this.$ext.onmouseup;}};this.$doBgSwitch=function(i){if(this.bgswitch&&(this.$background[2]>=i||i==4)){if(i==4){i=this.$background[2]+1;}var d=this.$background[1]=="vertical"?"0 -"+(parseInt(this.$background[3])*(i-1))+"px":"-"+(parseInt(this.$background[3])*(i-1))+"px 0";this.$getLayoutNode("main","background",this.$ext).style.backgroundPosition=d;}};this.$focus=function(){if(!this.$ext){return;}this.$setStyleClass(this.$ext,this.$baseCSSname+"Focus");};this.$blur=function(c){if(!this.$ext){return;}this.$setStyleClass(this.$ext,"",[this.$baseCSSname+"Focus"]);if(c){this.$updateState(c);}};this.$destroy=function(c){if(!c&&this.$ext){this.$ext.onmousedown=this.$ext.onmouseup=this.$ext.onmouseover=this.$ext.onmouseout=this.$ext.onclick=this.$ext.ondblclick=null;}};}).call(apf.BaseButton.prototype=new apf.StandardBinding());apf.BaseTab=function(){this.$init(true);};(function(){this.isPaged=true;this.$focussable=apf.KEYBOARD;this.length=0;this.isLoading={};this.inited=this.ready=false;this.set=function(c,a,d){if(d||this.src&&!this.$findPage(c,{})){return this.$propHandlers.activepage.call(this,c,null,null,a,d);}if(a&&this.activepage==c){return a();}this.$lastCallback=a;this.setProperty("activepage",c);};this.$supportedProperties.push("activepage","activepagenr","length","src","loading");this.$propHandlers.activepagenr=this.$propHandlers.activepage=function(n,c,a,d,m){if(!this.inited||apf.isNot(n)){return;}if(!d){d=this.$lastCallback;delete this.$lastCallback;}var l,o={};l=this.$findPage(n,o);if(!l){if(this.src){if(this.isLoading[n]){return;}if(this.$findPage("loading",{})){this.$propHandlers.activepage.call(this,"loading");}this.setProperty("loading",true);this.isLoading[n]=true;l=this.ownerDocument.createElementNS(apf.ns.apf,"page");l.setAttribute("id",n);this.appendChild(l);var j=this;l.insertMarkup(this.src,{page:n,callback:function(s){if(!s.xmlNode){var q=new Error(apf.formatErrorString(0,null,"Loading new page","Could not load new page: "+j.src));j.setProperty("loading",false);if(this.dispatchEvent("error",apf.extend({error:q,bubbles:true},s))===false){return true;}throw q;}else{j.setProperty("activepage",n);if(d){d();}j.setProperty("loading",false);}}});return;}return false;}if(l.parentNode!=this){return false;}if(!l.visible||l.disabled){return false;}if(n.tagName){n=o.position;this.activepage=l.name||n;}if(!m){var i={previous:this.activepage,previousId:this.activepagenr,previousPage:this.$activepage,next:n,nextId:o.position,nextpage:l};if(this.dispatchEvent("beforeswitch",i)===false){if(this.hideLoader){this.hideLoader();}return false;}}this.activepagenr=o.position;this.setProperty("activepagenr",o.position);if(this.$activepage){this.$activepage.$deactivate();}l.$activate();this.$activepage=l;this.scrollIntoView(l);if(this.hideLoader){if(l.$rendered!==false){this.hideLoader();}else{l.addEventListener("afterrender",function(){this.parentNode.hideLoader();});}}if(!m){if(l.$rendered!==false){this.dispatchEvent("afterswitch",i);}else{l.addEventListener("afterrender",function(){this.parentNode.dispatchEvent("afterswitch",i);});}}if(typeof d=="function"){d();}return true;};this.getPages=function(){var a=[],d=this.childNodes;for(var c=0,i=d.length;c<i;c++){if("page|case".indexOf(d[c].localName)>-1){a.push(d[c]);}}return a;};this.getPage=function(a){if(apf.isNot(a)){return this.$activepage;}else{return this.$findPage(a);}};this.add=function(i,d,c){var a=apf.document.createElement(c||"page");if(d){a.setAttribute("id",d);}if(i){a.setAttribute("caption",i);}this.appendChild(a);this.scrollIntoView(a);return a;};this.remove=function(c){var a=this.$findPage(c);if(!a){return false;}a.removeNode();this.setScrollerState();return a;};var N={scrollOn:false,steps:15,interval:10,size:0,left:0,control:{stop:false},stopHandle:function(){J=false;}},P=1,U=2,D=4,F=8,E=P,T=P,M=1,Q=2,V=4,J=false,I=null,C=false,O=M;function G(){var d="cache_"+this.$buttons.childNodes.length;if(N[d]){return N[d];}var a=0;for(var c=0,i=this.$buttons.childNodes.length;c<i;c++){if(typeof this.$buttons.childNodes[c].offsetWidth!="undefined"){a+=this.$buttons.childNodes[c].offsetWidth;}}return N[d]=a;}function K(i,c){var d=i&V;if(d){i=M;}var a=this[i&M?"oLeftScroll":"oRightScroll"];if(!(c&F)){if(i&M){E=c;}else{T=c;}}if(c&P){apf.setStyleClass(a,"",["disabled","hover","down"]);}else{if(c&U){apf.setStyleClass(a,"hover",["disabled","down"]);}else{if(c&D){apf.setStyleClass(a,"down",["disabled","hover"]);}else{if(c&F){apf.setStyleClass(a,"disabled",["hover","down"]);}}}}if(d){K(Q,c);}}this.setScrollerState=function(a,c){if(!this.ready||!this.$hasButtons||!this.oScroller){return;}if(typeof a=="undefined"){var d=this.oScroller.offsetWidth||parseInt(apf.getStyle(this.oScroller,"width").replace(/(px|em|%)/,""));a=((G.call(this)+d)>this.$ext.offsetWidth);c=V;}if(c&V&&a!==N.scrollOn){N.scrollOn=a;if(!a){this.$buttons.style.left=N.left+"px";this.oScroller.style.display="none";}}else{this.oScroller.style.display="";}this.oScroller.style.display=(c&V&&!a)?"none":"";if(typeof c=="undefined"){c=V;}if(!a){if((c&M)||(c&V)){K.call(this,M,F);}if((c&Q)||(c&V)){K.call(this,Q,F);}}};this.correctScrollState=function(){if(!this.ready||!this.$hasButtons||!this.oScroller){return;}this.setScrollerState();};function R(c,d){if(N.size<=0){N.left=this.$buttons.offsetLeft;N.size=Math.round(this.firstChild.$button.offsetWidth);}if(c&M){return N.left;}else{if(c&Q){var a=this.$buttons.childNodes[this.$buttons.childNodes.length-1];return this.$ext.offsetWidth-(a.offsetLeft+a.offsetWidth+(this.oScroller.offsetWidth+4));}}}this.scroll=function(a,i){if(!this.ready||!this.$hasButtons||!this.oScroller){return;}if(!a){a=window.event;}if(typeof a.type=="unknown"){a={type:"click"};}if(J&&a.type!="dblclick"){return;}J=true;if(typeof i=="undefined"){i=M;}var l=this.$buttons.offsetLeft,c=a.delta?Math.round(a.delta*36):N.size,d=R.call(this,i),m=this;if(i&M){K(M,D);K(Q,P);if(l===d){this.setScrollerState(false,M);return apf.tween.single(this.$buttons,{steps:N.steps,interval:20,from:l,to:l+12,type:"left",anim:apf.tween.EASEOUT,onstop:N.stopHandle,onfinish:function(n){apf.tween.single(n,{steps:N.steps,interval:N.interval,from:l+12,to:l,type:"left",anim:apf.tween.EASEIN,onstop:N.stopHandle,onfinish:function(){J=false;if(a.name=="mousescroll"){K(M,P);}}});}});}var j=l+(a.type=="dblclick"?c*3:c);if(j>d){j=d;}if(j===d){this.setScrollerState(false,M);}this.setScrollerState(true,Q);apf.tween.single(this.$buttons,{steps:N.steps,interval:N.interval,control:N.control,from:l,to:j,type:"left",anim:apf.tween.NORMAL,onstop:N.stopHandle,onfinish:function(){J=false;if(a.name=="mousescroll"){K(M,P);}if(C){m.scroll(a,O);}}});}else{if(i&Q){this.setScrollerState(true);K(Q,D);K(M,P);if(l===d){this.setScrollerState(false,Q);return apf.tween.single(this.$buttons,{steps:N.steps,interval:20,from:l,to:l-24,type:"left",anim:apf.tween.EASEOUT,onstop:N.stopHandle,onfinish:function(o,n){apf.tween.single(o,{steps:N.steps,interval:N.interval,from:l-24,to:l,type:"left",anim:apf.tween.EASEIN,onstop:N.stopHandle,onfinish:function(){J=false;if(a.name=="mousescroll"){K(Q,P);}}});}});}var j=l-(a.type=="dblclick"?c*3:c);if(j<d){j=d;}apf.tween.single(this.$buttons,{steps:N.steps,interval:N.interval,control:N.control,from:l,to:j,type:"left",anim:apf.tween.NORMAL,onstop:N.stopHandle,onfinish:function(){J=false;if(a.name=="mousescroll"){K(Q,P);}if(C){m.scroll(a,O);}}});}}};this.scrollIntoView=function(m){J=false;if(!this.ready||!this.$hasButtons||!this.oScroller||!m.$drawn){return;}J=true;if(this.$buttons.offsetWidth<this.$ext.offsetWidth){return this.setScrollerState(false);}var j=m.$button.offsetLeft,d=m.$button.offsetWidth,l=this.$buttons.offsetLeft;if(N.size<=0){N.left=this.$buttons.offsetLeft;var o=this.firstChild;while(!o.$button){o=o.nextSibling;}N.size=Math.round(o.$button.offsetWidth);}this.$buttons.style.left=l;var c=this.$ext.offsetWidth,a=this.oScroller.offsetWidth+4,i=null,n;if((j+d)>((c-a)-l)){i=(-(j-N.left)+(c-d-a));n=Q;}else{if((l+j)<N.left){i=N.left-j;n=M;}}if(i!==null){this.setScrollerState(true);K(Q,n&Q?D:P);K(M,n&M?D:P);apf.tween.clearQueue(this.$buttons,true);apf.tween.single(this.$buttons,{steps:N.steps,interval:N.interval,from:l,to:i,type:"left",anim:apf.tween.NORMAL,onstop:N.stopHandle,onfinish:function(){J=false;K(Q,P);K(M,P);}});}else{J=false;}};this.addEventListener("DOMNodeRemoved",function(a){var c=a.currentTarget;if(a.$doOnlyAdmin||a.relatedNode!=this||c.localName!="page"){return;}if(this.firstChild==c&&c.nextSibling){c.nextSibling.$first();}if(this.lastChild==c&&c.previousSibling){c.previousSibling.$last();}if(this.$activepage==c){if(c.nextSibling||c.previousSibling){this.set(c.nextSibling||c.previousSibling);}else{this.setScrollerState();this.$activepage=this.activepage=this.activepagenr=null;}}else{this.setScrollerState();}this.setProperty("length",this.childNodes.length);});this.addEventListener("DOMNodeInserted",function(a){var i=a.currentTarget;if(i.localName!="page"||a.relatedNode!=this){return;}if(!a.$beforeNode){var d;if(d=this.lastChild){if(d.nodeType!=1){d=d.previousSibling;}if(d){d.$last(true);}}i.$last();}if(!this.firstChild||a.$beforeNode==this.firstChild){if(this.firstChild){this.firstChild.$first(true);}i.$first();}if(this.$activepage){var c={};this.$findPage(this.$activepage,c);if(this.activepagenr!=c.position){if(parseInt(this.activepage)==this.activepage){this.activepage=c.position;this.setProperty("activepage",c.position);}this.activepagenr=c.position;this.setProperty("activepagenr",c.position);}}else{if(!this.$activepage){this.set(i);}}this.setProperty("length",this.childNodes.length);});this.$findPage=function(c,a){var d,l=this.childNodes;for(var i=0,j=0,m=l.length;j<m;j++){d=l[j];if("page|case".indexOf(d.localName)>-1&&(i++==c||(c.localName&&d||d.name)==c)){if(a){a.position=i-1;}return d;}}return null;};this.$enable=function(){var c=this.childNodes;for(var a=0,d=c.length;a<d;a++){if(c[a].enable){c[a].enable();}}};this.$disable=function(){var c=this.childNodes;for(var a=0,d=c.length;a<d;a++){if(c[a].disable){c[a].disable();}}};this.addEventListener("keydown",function(a){if(!this.$hasButtons){return;}var c,d=a.keyCode;switch(d){case 9:break;case 13:break;case 32:break;case 37:c=this.getPage().previousSibling;while(c&&(c.nodeType!=1||"page|case".indexOf(c.localName)==-1||!c.visible)){c=c.previousSibling;}if(c){this.setProperty("activepage",c);}break;case 39:c=this.getPage().nextSibling;while(c&&(c.nodeType!=1||"page|case".indexOf(c.localName)==-1||!c.visible)){c=c.nextSibling;}if(c){this.setProperty("activepage",c);}break;default:return;}},true);this.$loadChildren=function(d){var j=false,i=this,l,n,q,a,c;this.inited=true;if(this.$hasButtons){this.$buttons=this.$getLayoutNode("main","buttons",this.$ext);this.$buttons.setAttribute("id",this.$uniqueId+"_buttons");}this.oPages=this.$getLayoutNode("main","pages",this.$ext);this.oScroller=this.$getLayoutNode("main","scroller",this.oPages);if(this.oScroller){function m(s,t){clearTimeout(I);O=t;I=$setTimeout(function(){C=true;i.scroll(s,t);},500);}function o(){clearTimeout(I);C=false;}this.oScroller.onmouseout=function(s){N.control.stop=true;K(V,P);};this.oLeftScroll=apf.getNode(this.oScroller,[0]);this.oRightScroll=apf.getNode(this.oScroller,[1]);["oLeftScroll","oRightScroll"].forEach(function(s){var u=s=="oLeftScroll"?M:Q,t=s=="oLeftScroll"?Q:M;i[s].ondbclick=i[s].onmousedown=function(w){N.control.stop=false;var z=u&M?E:T;if(this.className.indexOf("disabled")!=-1||z&D){return;}w=w||event;i.scroll(w,u);m(w,u);if(!apf.isSafariOld){this.onmouseout();}};i[s].onmouseover=function(){N.control.stop=false;var w=u&M?E:T;if(this.className.indexOf("disabled")!=-1||w&D){return;}K(u,U);K(t,P);O=u;};i[s].onmouseout=function(){var w=u&M?E:T;if(this.className.indexOf("disabled")!=-1||w&D){return;}K(u,P);};i[s].onmouseup=function(){if(this.className.indexOf("disabled")==-1){K(u,P);}o();N.control.stop=true;};});}apf.layout.setRules(this.$ext,this.$uniqueId+"_tabscroller","var o = apf.all["+this.$uniqueId+"]; o && o.correctScrollState()");apf.layout.queue(this.$ext);if(this.$int){this.$int=this.oPages;j=true;c=this.childNodes;for(l=0;l<c.length;l++){a=c[l];if(a.nodeType!=1){continue;}a.$draw(true);if(a.$skinchange){a.$skinchange();}a.$loadAml();}}else{this.$int=this.oPages;c=this.childNodes;for(n=0,l=0,q=c.length;l<q;l++){if("page|case".indexOf((a=c[l]).localName)>-1){if(n++==0){a.$first();}if(n==q){a.$last();}}}}if(a){this.activepage=(typeof this.activepage!="undefined"?this.activepage:this.activepagenr)||0;j=this.getPage(this.activepage);if(j.render!="runtime"||j.$rendered){this.$propHandlers.activepage.call(this,this.activepage);}}else{this.isPages=false;}this.setProperty("length",n);this.ready=true;window.setTimeout(function(){i.setScrollerState();},0);if(!this.activepage&&this.getAttribute("src")){this.src=this.getAttribute("src");this.$propHandlers.activepage.call(this);}};this.$destroy=function(a){if(a||!this.oScroller){return;}apf.layout.removeRule(this.$ext,this.$uniqueId+"_tabscroller");[this.oLeftScroll,this.oRightScroll].forEach(function(c){c.onmousedown=c.ondblclick=c.onmouseover=c.onmouseout=c.onmouseup=null;});};}).call(apf.BaseTab.prototype=new apf.Presentation());apf.__CONTENTEDITABLE__=1<<24;apf.ContentEditable2=function(){this.$regbase=this.$regbase|apf.__CONTENTEDITABLE__;var c=this;if(!apf.ContentEditable2.resize){apf.ContentEditable2.resize=new apf.Resize();}this.$propHandlers.editable=function(i,a){apf.ContentEditable2.resize.initElement(this);this.isEditable=true;};this.addEventListener("DOMNodeInsertedIntoDocument",function(q){var o=this.$aml;var i=this.childNodes;for(var a=0,l=i.length;a<l;a++){if(typeof i[a].editable=="undefined"){if(i[a].nodeFunc==apf.NODE_VISIBLE&&i[a].localName!="page"){i[a].setAttribute("editable",true);}else{i[a].isEditable=true;arguments.callee.apply(i[a],arguments);}}}if(!this.parentNode.isEditable){$setTimeout(function(){apf.ContentEditable2.resize.grab(c);});}});this.addEventListener("DOMNodeRemovedFromDocument",function(a){});};apf.ContentEditable2.setMode=function(i,d){this.mode=i;if(!this.pointer){this.pointer=new apf.ElementDrawer();}if(i=="add"){this.pointer.activate();}else{this.pointer.deactivate();}this.addType=d;};apf.ContentEditable2.actions={transaction:[],undostack:[],redostack:[]};apf.ContentEditable2.execCommand=function(R,V,J){if(!V){V={};}var E=V.sel||this.resize.getSelected();if(this.started&&R!="commit"&&R!="rollback"&&!J){apf.ContentEditable2.actions.transaction.push([R,V]);return;}var O,K,F;switch(R){case"add":if(J){apf.ContentEditable2.execCommand("remove",{sel:V.addedNode,maintenance:true});}else{var W=apf.document.createElementNS(apf.ns.apf,this.addType),N=V.htmlNode,I=V.parentNode;if(!I){I=(this.resize.getSelected()||apf.document.documentElement);if(I.getPage){I=I.getPage();}else{while(!I.canHaveChildren){I=I.parentNode;}}V.parentNode=I;}var Q=apf.getAbsolutePosition(I.$int);W.setAttribute("left",N.offsetLeft-Q[0]);W.setAttribute("top",N.offsetTop-Q[1]);I.appendChild(W);var P=W.minwidth||parseInt(W.$getOption("main","minwidth"))||0,M=W.minheight||parseInt(W.$getOption("main","minheight"))||0,G=W.maxwidth||parseInt(W.$getOption("main","maxwidth"))||10000,U=W.maxheight||parseInt(W.$getOption("main","maxheight"))||10000;W.setAttribute("width",Math.min(G,Math.max(P,N.offsetWidth)));W.setAttribute("height",Math.min(U,Math.max(M,N.offsetHeight)));W.setAttribute("editable",true);apf.layout.processQueue();this.resize.grab(W);V.addedNode=W;}break;case"remove":if(J){V.removedNode[1].insertBefore(V.removedNode[0],V.removedNode[2]);this.resize.grab(V.removedNode[0]);}else{var X=E.parentNode;V.removedNode=[E,X,E.nextSibling];E.removeNode();this.resize.grab(apf.document.activeElement&&apf.document.activeElement.editable?apf.document.activeElement:(X.editable?X:X.firstChild));}break;case"property":if(J){E.setAttribute(V.name,V.prevValue);}else{V.prevValue=E[V.name];E.setAttribute(V.name,V.value);}break;case"undo":var T=apf.ContentEditable2.actions.undostack;if(!T.length){return false;}K=T.pop();apf.ContentEditable2.actions.redostack.push(K);K[1].maintenance=true;apf.ContentEditable2.execCommand(K[0],K[1],true);return true;case"redo":var i=apf.ContentEditable2.actions.redostack;if(!i.length){return false;}K=i.pop();apf.ContentEditable2.actions.undostack.push(K);K[1].maintenance=true;apf.ContentEditable2.execCommand(K[0],K[1]);return true;case"begin":this.started=true;return;case"commit":if(J){F=V;for(O=0;O<F.length;O++){apf.ContentEditable2.execCommand(F[O][0],F[O][1],true);}}else{if(this.started){this.started=false;F=apf.ContentEditable2.actions.transaction;apf.ContentEditable2.actions.transaction=[];apf.ContentEditable2.actions.undostack.push([R,F]);}else{F=V;}for(O=0;O<F.length;O++){F[O][1].maintenance=true;if(!F[O][1].sel){F[O][1].sel=E;}apf.ContentEditable2.execCommand(F[O][0],F[O][1]);}}apf.layout.processQueue();this.resize.regrab();return;case"rollback":this.started=false;apf.ContentEditable2.actions.transaction=[];return;}if(!V||!V.maintenance){apf.ContentEditable2.actions.undostack.push([R,V]);}};apf.Resize=function(){this.$init();this.$propHandlers=[];this.implement(apf.Interactive);this.draggable=true;this.resizable=true;this.dragOutline=true;this.dragSelection=true;var u=this,B=[],t=["n","ne","e","se","s","sw","w","nw"],D;while(B.length!=8){D=document.body.appendChild(document.createElement("div"));D.className="idegrabber";D.style.display="none";D.onmousedown=A;B.push(D);B[(D.type=t.pop())]=D;}this.getSelected=function(){return w;};this.initElement=function(a){a.$ext.onmousedown=function(c){u.grab(a);u.left=a.left;u.top=a.top;u.right=a.right;u.bottom=a.bottom;(c||event).cancelBubble=true;};this.$propHandlers.draggable.call({$ext:a.$ext},true);};var w,C,s=8,z=1;this.grab=function(c,d){if(this.$ext){apf.layout.removeRule(this.$ext,"contenteditable");apf.layout.activateRules(c);}if(!c){this.hide();return;}if(c.nodeFunc){w=c;C=c.$anchors&&c.$anchors.length?c.$anchors:[c.top,c.right,c.bottom,c.left];c=c.$ext;this.$ext=c;}this.regrab();for(var a=0;a<8;a++){B[a].style.display="block";}if(C){apf.setStyleClass(B.n,C[0]?"idegrabber_selected":"",["idegrabber_selected"]);apf.setStyleClass(B.e,C[1]?"idegrabber_selected":"",["idegrabber_selected"]);apf.setStyleClass(B.s,C[2]?"idegrabber_selected":"",["idegrabber_selected"]);apf.setStyleClass(B.w,C[3]?"idegrabber_selected":"",["idegrabber_selected"]);}apf.layout.setRules(c,"contenteditable","apf.all["+this.$uniqueId+"].regrab()",true);apf.layout.queue(c);u.onresize=function(){apf.ContentEditable2.execCommand("commit");};u.ondrag=function(i){apf.ContentEditable2.execCommand("commit");};};this.regrab=function(){var c=this.$ext;var a=apf.getAbsolutePosition(c);a.push(c.offsetWidth,c.offsetHeight);B.s.style.left=B.n.style.left=(a[0]+(a[2]-s)/2)+"px";B.e.style.top=B.w.style.top=(a[1]+(a[3]-s)/2)+"px";B.nw.style.top=B.ne.style.top=B.n.style.top=(a[1]-s-z)+"px";B.sw.style.left=B.nw.style.left=B.w.style.left=(a[0]-s-z)+"px";B.ne.style.left=B.se.style.left=B.e.style.left=(a[0]+a[2]+z)+"px";B.se.style.top=B.sw.style.top=B.s.style.top=(a[1]+a[3]+z)+"px";};this.show=function(){for(var a=0;a<8;a++){B[a].style.display="block";}};this.hide=function(){for(var a=0;a<8;a++){B[a].style.display="none";}};this.setProperty=function(c,a){if(!apf.ContentEditable2.started){apf.ContentEditable2.execCommand("begin");}apf.ContentEditable2.execCommand("property",{name:c,value:a});return a;};var E={e:"right",w:"left",n:"top",s:"bottom"};function A(d){if(!d){d=event;}if(d.ctrlKey&&this.type.length==1){apf.ContentEditable2.execCommand("begin");if(w.$anchors&&w.$anchors.length){var i=w.$anchors;u.setProperty("anchors",null);u.setProperty("top",i[0]);u.setProperty("right",i[1]);u.setProperty("bottom",i[2]);u.setProperty("left",i[3]);}apf.setStyleClass(this,!w[E[this.type]]?"idegrabber_selected":"",["idegrabber_selected"]);var a=E[this.type];if(w[a]){if(a=="right"&&!this.left){u.setProperty("left",w.$ext.offsetLeft);}else{if(a=="bottom"&&!this.top){u.setProperty("top",w.$ext.offsetTop);}}u.setProperty(a,null);}else{var c=w.$ext.offsetParent;if(c.tagName=="BODY"){c=document.documentElement;}switch(this.type){case"e":u.setProperty("right",c.offsetWidth-w.$ext.offsetLeft-w.$ext.offsetWidth);break;case"w":u.setProperty("left",w.$ext.offsetLeft);break;case"n":u.setProperty("top",w.$ext.offsetTop);break;case"s":u.setProperty("bottom",c.offsetHeight-w.$ext.offsetTop-w.$ext.offsetHeight);break;}}u.setProperty("width",!this.left||!this.right?w.$ext.offsetWidth:null);u.setProperty("height",!this.top||!this.bottom?w.$ext.offsetHeight:null);apf.ContentEditable2.execCommand("commit");}else{u.left=w.left;u.top=w.top;u.right=w.right;u.bottom=w.bottom;u.minwidth=w.minwidth||parseInt(w.$getOption("main","minwidth"))||0;u.minheight=w.minheight||parseInt(w.$getOption("main","minheight"))||0;u.maxwidth=w.maxwidth||parseInt(w.$getOption("main","maxwidth"))||10000;u.maxheight=w.maxheight||parseInt(w.$getOption("main","maxheight"))||10000;u.$resizeStart(d||event,{resizeType:this.type,nocursor:true});}}};apf.Resize.prototype=new apf.Class();apf.ElementDrawer=function(){var n=document.body.appendChild(document.createElement("div")),o=document.body.appendChild(document.createElement("div")),q=document.body.appendChild(document.createElement("div")),t=this,s,m;n.className="pointer_left";o.className="pointer_right";q.className="new_element";this.activate=function(){document.onmousemove=function(c){if(!c){c=event;}n.style.width=(Math.abs(c.clientX)||1)+"px";n.style.height=(Math.abs(c.clientY)||1)+"px";o.style.width=(Math.abs(document.documentElement.offsetWidth-c.clientX-5)||1)+"px";o.style.height=(Math.abs(document.documentElement.offsetHeight-c.clientY-5)||1)+"px";if(q.style.display=="block"){var a=c.clientX-s-1,i=c.clientY-m-1,d=Math.min(a,i);if(c.shiftKey){a=i=d;}q.style.width=(a<0?-1*(a-1):(a||1))+"px";q.style.height=(i<0?-1*(i-1):(i||1))+"px";q.style.left=a<0?"":(s)+"px";q.style.right=a<0?(document.documentElement.offsetWidth-s-4)+"px":"";q.style.bottom=i<0?(document.documentElement.offsetHeight-m-4)+"px":"";q.style.top=i<0?"":(m)+"px";}};document.onmousedown=function(a){if(!a){a=event;}q.style.display="block";q.style.left=(s=event.clientX)+"px";q.style.top=(m=event.clientY)+"px";q.style.width=(q.style.height=1)+"px";};document.onmouseup=function(){if(q.offsetWidth>10&&q.offsetHeight>10){apf.ContentEditable2.execCommand("add",{htmlNode:q});t.deactivate();}q.style.display="none";s=false;m=false;};n.style.display=o.style.display="block";document.body.style.cursor=document.documentElement.style.cursor="crosshair";};this.deactivate=function(){document.onmousemove=null;document.onmousedown=null;document.onmouseup=null;n.style.display=o.style.display="none";document.body.style.cursor=document.documentElement.style.cursor="";};};apf.Selection=function(){};apf.__XFORMS__=1<<17;apf.__FOCUSSABLE__=1<<26;apf.Focussable=function(){this.$regbase=this.$regbase|apf.__FOCUSSABLE__;this.setTabIndex=function(c){apf.window.$removeFocus(this);apf.window.$addFocus(this,c);return this;};this.focus=function(i,j,l){if(!i){if(this.$isWindowContainer){apf.window.$focusLast(this,j,true);}else{apf.window.$focus(this,j);if(!l&&apf.hasFocusBug){apf.window.$focusfix();}}return this;}if(this.$focus){this.$focus(j);}this.dispatchEvent("focus",apf.extend({srcElement:this,bubbles:true},j));return this;};this.blur=function(d,i){if(apf.popup.isShowing(this.$uniqueId)){apf.popup.forceHide();}if(this.$blur){this.$blur(i);}if(!d){apf.window.$blur(this);}this.dispatchEvent("blur",apf.extend({srcElement:this,bubbles:!i||!i.cancelBubble},i));return this;};this.hasFocus=function(){return apf.document.activeElement==this||this.$isWindowContainer&&(apf.document.activeElement||{}).$focusParent==this;};};apf.__MEDIA__=1<<20;apf.Media=function(){this.$init(true);};(function(){this.$regbase=this.$regbase|apf.__MEDIA__;this.muted=false;this.$booleanProperties.paused=true;this.$booleanProperties.muted=true;this.$booleanProperties.seeking=true;this.$booleanProperties.autoplay=true;this.$booleanProperties.controls=true;this.$booleanProperties.ready=true;this.$supportedProperties.push("position","networkState","readyState","progress","buffered","bufferedBytes","totalBytes","currentTime","paused","seeking","volume","type","src","autoplay","controls");this.$mainBind="src";this.$sources=[];this.$nomedia=null;this.$amlTimer=null;this.$loadTimer=null;this.$posTimer=null;this.$volTimer=null;this.$propHandlers.readyState=function(c){if(this.readyState!==c){this.readyState=c;}if(c==apf.Media.HAVE_NOTHING){var a=this.MediaError("Unable to open medium with URL '"+this.src+"'. Please check if the URL you entered as src is pointing to                    a valid resource.");if(this.dispatchEvent("havenothing",{error:a,bubbles:true})===false){throw a;}}else{if(c==apf.Media.HAVE_CURRENT_DATA){this.dispatchEvent("havecurrentdata");}else{if(c==apf.Media.HAVE_FUTURE_DATA){this.dispatchEvent("havefuturedata");}else{if(c==apf.Media.HAVE_ENOUGH_DATA){this.dispatchEvent("haveenoughdata");this.setProperty("ready",true);}}}}};this.$propHandlers.bufferedBytes=function(a){this.setProperty("progress",this.totalBytes?a.end/this.totalBytes:0);};this.$propHandlers.position=function(a){clearTimeout(this.$posTimer);if(this.duration<=0||!this.seek){return;}var c=this;this.$posTimer=$setTimeout(function(){if(a>=c.progress){a=c.progress-0.05;}var l=!c.paused;if(l){c.pause();}if(a<0){a=0;}else{if(a>1){a=1;}}c.seek(Math.round(a*c.duration));c.setProperty("paused",!l);});};this.$propHandlers.currentTime=function(a){if(a>=0&&this.seek){this.seek(a);}};this.$propHandlers.volume=function(a){if(!this.player){return;}if(a<1&&a>0){a=a*100;}if(this.setVolume){this.setVolume(a);}if(a>0&&this.muted){this.setProperty("muted",false);}};this.oldVolume=null;this.$propHandlers.muted=function(a){if(!this.player||!this.setVolume){return;}if(a){this.oldVolume=this.volume;this.setVolume(0);}else{this.setVolume(this.oldVolume||20);}};this.$propHandlers.paused=function(a){if(!this.player){return;}this.paused=apf.isTrue(a);if(this.paused){this.player.pause();}else{this.player.play();}};this.$propHandlers.type=function(a){if(this.$loadTimer){return;}var c=this;this.$loadTimer=window.setTimeout(function(){d.call(c);});};this.$propHandlers.src=function(a){if(this.$loadTimer||!a){return;}var c=new apf.url(a);this.src=c.uri;if(this.src!=this.currentSrc&&this.networkState!==apf.Media.LOADING){var m=this.$guessType(this.src);if(m==this.type){i.call(this);this.loadMedia();}else{this.type=m;var n=this;this.$loadTimer=window.setTimeout(function(){d.call(n);});}}};this.$propHandlers.ID3=function(a){if(!this.player){return;}if(typeof this.player.setID3=="function"){this.player.setID3(a);}};this.addEventListener("AMLRemove",function(a){i.call(this);});this.addEventListener("AMLReparent",function(l,a,c){if(!this.$amlLoaded){return;}this.$draw();d.call(this,true);});function i(){this.setProperty("networkState",apf.Media.NETWORK_EMPTY);this.setProperty("ready",false);this.buffered={start:0,end:0,length:0};this.bufferedBytes={start:0,end:0,length:0};this.totalBytes=0;this.setProperty("progress",0);this.setProperty("seeking",false);this.setProperty("paused",true);this.setProperty("position",0);this.currentTime=this.duration=0;this.played=this.seekable=null;this.ended=false;this.start=this.end=this.loopStart=this.loopEnd=this.playCount=this.currentLoop=0;this.controls=this.muted=false;}function d(a){window.clearTimeout(this.$loadTimer);this.$loadTimer=null;if(!a){i.call(this);}this.$destroy(true);this.playerType=this.$getPlayerType(this.type);if(!this.playerType||!this.$isSupported()){this.$ext.innerHTML=this.notSupported;return;}this.$initPlayer();}this.MediaError=function(a){return new Error(apf.formatErrorString(0,this,"Media",a));};this.src=this.currentSrc=null;this.networkState=apf.Media.NETWORK_EMPTY;this.bufferingRate=0;this.bufferingThrottled=false;this.buffered={start:0,end:0,length:0};this.bufferedBytes={start:0,end:0,length:0};this.totalBytes=0;this.volume=100;this.loadMedia=function(){};this.readyState=apf.Media.HAVE_NOTHING;this.seeking=false;this.currentTime=this.duration=0;this.paused=true;this.defaultPlaybackRate=this.playbackRate=0;this.played=null;this.seekable=null;this.ended=this.autoplay=false;this.canPlayType=function(a){if(this.$getPlayerType){var c=this.$getPlayerType(a);if(!c||!this.$isSupported(c)){return"no";}if(c.indexOf("Wmp")!=-1){return"maybe";}return"probably";}return"no";};this.play=function(){this.setProperty("paused",false);};this.pause=function(){this.setProperty("paused",true);};this.start=this.end=this.loopStart=this.loopEnd=this.playCount=this.currentLoop=0;this.addCueRange=function(q,a,s,u,t,w,c){};this.removeCueRanges=function(a){};this.getCounter=function(c,t,A){if(A){c=c-this.duration;}var z=Math.round(Math.abs(c/1000)),a=String(Math.round(Math.abs(z/60/60))).pad(2,"0"),s=String(Math.round(Math.abs(z/60))).pad(2,"0"),u=String(z).pad(2,"0"),w=String(Math.round(Math.abs(c%1000))).pad(3,"0");return(A?"- ":"")+t.replace(/\%T/g,"%H:%M:%S").replace(/\%[a-zA-Z\%]/g,function(j){switch(j){case"%H":return a;case"%M":return s;case"%S":return u;case"%Q":return w;case"%n":return"\n";case"%t":return"\t";case"%%":return"%";}});};this.setSource=function(){if(!this.src){var q,s,j=this.$sources;for(var a=0,c=j.length;a<c;a++){q=j[a].src;if(!q){continue;}s=j[a].type;if(!s){s=this.$guessType(q);}if(this.canPlayType(s)!="no"){this.src=q;this.type=s;break;}}}else{if(!this.type){this.type=this.$guessType(this.src);if(this.canPlayType(this.type)=="no"){return false;}}}return(this.src&&this.type);};this.$addSource=function(a){clearTimeout(this.$amlTimer);if(a.localName!="source"){return false;}this.$sources.pushUnique(a);var c=this;this.$amlTimer=$setTimeout(function(){clearTimeout(c.$amlTimer);c.dispatchEvent("AMLMediaReady");});};this.$removeSource=function(a){this.$sources.remove(a);};this.addEventListener("DOMNodeInserted",function(a){var c=a.currentTarget;if(c.parentNode!=this){return;}this.$addSource(c);});this.addEventListener("DOMNodeRemoved",function(a){var c=a.currentTarget;if(!(c.parentNode==this||c.parentNode.parentNode==this)){return;}this.$removeSource(c);});}).call(apf.Media.prototype=new apf.StandardBinding());apf.nomedia=function(i,d){this.$init(d||"nomedia",apf.NODE_HIDDEN,i);};(function(){this.addEventListener("DOMNodeInsertedIntoDocument",function(){this.parentNode.notSupported=apf.getXmlString(this.$aml).replace(/<\/?a:nomedia[^>]*>/g,"");});}).call(apf.nomedia.prototype=new apf.AmlElement());apf.aml.setElement("nomedia",apf.nomedia);apf.Media.NETWORK_EMPTY=0;apf.Media.NETWORK_IDLE=1;apf.Media.NETWORK_LOADING=2;apf.Media.NETWORK_LOADED=3;apf.Media.HAVE_NOTHING=0;apf.Media.HAVE_METADATA=1;apf.Media.HAVE_SOME_DATA=2;apf.Media.HAVE_CURRENT_DATA=3;apf.Media.HAVE_FUTURE_DATA=4;apf.Media.HAVE_ENOUGH_DATA=5;apf.BaseSimple=function(){this.$init(true);};(function(){this.implement(apf.DataAction);this.getValue=function(){return this.value;};}).call(apf.BaseSimple.prototype=new apf.StandardBinding());apf.__ALIGNMENT__=1<<29;apf.A11y=function(){this.setRole=function(i,d){if(!i){throw new Error();}if(!apf.A11y.ROLES[d]){throw new Error();}i.setAttribute("role",d);};this.setWidgetAttr=function(l,m,n){var j=apf.A11y.ATTR_WIDGETS[m];if(!j){throw new Error("attr does not exist");}if((typeof j=="boolean"&&typeof n!="boolean")||(typeof j=="number"&&typeof n!="number")||((typeof j=="string"||apf.isArray(j))&&typeof n!="string")){throw new Error("invalid type");}l.setAttribute("aria-"+m,n);};this.updateLiveRegion=function(l,m,n){var j=apf.A11y.ATTR_LIVEREGION[m];if(!j){throw new Error("attr does not exist");}if((typeof j=="boolean"&&typeof n!="boolean")||(apf.isArray(j)&&typeof n!="string")){throw new Error("invalid type");}if(l){l.setAttribute("aria-"+m,n);}else{}};this.setDragDropAttr=function(l,m,n){var j=apf.A11y.ATTR_LIVEREGION[m];if(!j){throw new Error("attr does not exist");}if((typeof j=="boolean"&&typeof n!="boolean")||(apf.isArray(j)&&typeof n!="string")){throw new Error("invalid type");}l.setAttribute("aria-"+m,n);};this.setRelationAttr=function(){var n=Array.prototype.slice.call(arguments),l=n.shift(),m=n.shift(),j=n.join(" ");if(!apf.A11y.ATTR_RELATIONS[m]){throw new Error();}l.setAttribute("aria-"+m,j);};};apf.A11y.ROLES={alert:1,alertdialog:1,application:1,article:1,banner:1,button:1,checkbox:1,columnheader:1,combobox:1,complementary:1,contentinfo:1,definition:1,dialog:1,directory:1,grid:1,gridcell:1,"group:":1,heading:1,img:1,link:1,list:1,listbox:1,listitem:1,log:1,main:1,marquee:1,math:1,menu:1,menubar:1,menuitem:1,menuitemcheckbox:1,menuitemradio:1,navigation:1,note:1,option:1,presentation:1,progressbar:1,radio:1,radiogroup:1,region:1,row:1,rowheader:1,search:1,seperator:1,slider:1,slinbutton:1,status:1,tab:1,tablist:1,tabpanel:1,textbox:1,timer:1,toolbar:1,tooltip:1,tree:1,treegrid:1,treeitem:1};apf.A11y.ATTR_WIDGETS={autocomplete:true,checked:true,disabled:true,expanded:true,haspopup:true,hidden:true,invalid:["grammar","false","spelling","true"],level:1,multiline:true,multiselectable:true,pressed:["true","false","pressed"],readonly:true,required:true,selected:true,sort:["ascending","descending","none","other"],valuemax:1,valuemin:1,valuenow:1,valuetext:"string"};apf.A11y.ATTR_LIVEREGION={atomic:true,busy:true,live:["off","polite","assertive"],relevant:["additions","removals","text","all","additions text"]};apf.A11y.ATTR_DRAGDROP={dropeffect:["copy","move","reference","execute","popup","none"],grabbed:true};apf.A11y.ATTR_RELATIONS={activedescendant:{},controls:{},describedby:{},flowto:{},label:"1",labelledby:{},owns:{},posinset:1,setsize:1};apf.__TRANSACTION__=1<<3;apf.Transaction=function(){this.$regbase=this.$regbase|apf.__TRANSACTION__;this.$addParent=this.$transactionNode=this.$transactionSubject=this.$originalNode=this.$inTransaction=this.$lastAction=null;this.$supportedProperties.push("autoshow");this.$booleanProperties.autoshow=true;this.commit=function(j){if(!this.$inTransaction){return false;}if(!this.$validgroup&&this.validgroup){this.$validgroup=self[this.validgroup];}if(this.$validgroup&&!this.$validgroup.isValid()){return false;}var l=true;if(!this.$at.undolength){if(j){return false;}this.$at.purge();this.$inTransaction=false;this.load(this.$originalNode);this.$helperModel.reset();l=false;}else{this.$at.reset();this.$inTransaction=false;this.$transactionNode.removeAttribute(apf.xmldb.xmlListenTag);if(this.$lastAction=="add"){if(this.$transactionSubject.$executeAction("appendChild",[this.$addParent,this.$transactionNode],"add",this.$transactionNode)&&this.$transactionSubject.hasFeature(apf.__MULTISELECT__)){this.$transactionSubject.select(this.$transactionNode);}this.$transactionSubject=null;}else{var i=this.$at;this.$at=this.dataParent?this.dataParent.parent.getActionTracker():null;this.$transactionSubject.$executeAction("replaceNode",[this.$originalNode,this.$transactionNode],"update",this.$transactionNode);this.$at=i;}}this.$transactionNode=null;this.$addParent=null;this.$originalNode=null;if(this.autoshow){if(this.autoshow==-1){this.autoshow=true;}else{this.hide();}}return l;};this.rollback=function(c){if(!this.$inTransaction){return;}if(this.$at){if(this.rpcMode=="realtime"){this.$at.undo(-1);}this.$at.reset();}this.$transactionNode=null;this.$addParent=null;if(!c){this.load(this.$originalNode);}this.$helperModel.reset();this.$stopAction(this.$lastAction,true);this.$originalNode=null;this.$inTransaction=false;if(this.autoshow){if(this.autoshow==-1){this.autoshow=true;}else{this.hide();}}};this.begin=function(F,K,D,M){if(this.$inTransaction){if(this.autoshow){this.autoshow=-1;}this.rollback();}var O=this;this.$lastAction=F;if(!this.$lastAction){this.$lastAction=this.xmlRoot&&"update"||"add";}if(M){this.$setDynamicProperty("model","["+M.id+".selected]");}if(K&&this.$lastAction=="update"){this.xmlRoot=K;}if(!this.$at){this.$at=new apf.actiontracker();var i=function(a){O.setProperty(a.prop,a.value);};this.$at.addEventListener("prop.undolength",i);this.setProperty("undolength",0);this.$at.addEventListener("prop.redolength",i);this.setProperty("redolength",0);}if(!this.$helperModel){this.$helperModel=new apf.model();this.$helperModel["save-original"]=true;this.$helperModel.load("<data />");}this.$transactionNode=null;this.$addParent=null;this.$originalNode=this.xmlRoot;if(typeof apf.offline!="undefined"&&!apf.offline.canTransact()){return false;}this.$inTransaction=true;function I(){this.$inTransaction=-1;this.$helperModel.data.appendChild(this.$transactionNode);this.load(this.$helperModel.data.firstChild);this.$inTransaction=true;if(this.disabled){this.enable();}if(this.autoshow){if(this.autoshow==-1){this.autoshow=true;}else{this.show();}}}M=this.dataParent&&this.dataParent.parent;if(!M||!M.$actions||!M.$actions[this.$lastAction]){M=this;}if(this.$lastAction=="add"){var N,J=M.$actions;if(J){if(K&&K.nodeType){N=J.getRule("add",K);}else{if(typeof K=="string"){if(K.trim().charAt(0)=="<"){K=apf.getXml(K);N=J.getRule("add",K);}else{var B=J.$rules.add;for(var C=0,E=B.length;C<E;C++){if(B[C].getAttribute("type")==K){K=null;N=B[C];break;}}}}}if(!N){N=(M.$actions.add||{})[0];}}else{N=null;}if(typeof apf.offline!="undefined"&&!apf.offline.onLine&&!N.get){return false;}var l=this.$isTreeArch?this.selected||this.xmlRoot:this.xmlRoot;var G=function(m,j,c){if(j!=apf.SUCCESS){var d;d=new Error(apf.formatErrorString(1032,M,"Loading xml data","Could not add data for control "+M.name+"["+M.tagName+"] \nUrl: "+c.url+"\nInfo: "+c.message+"\n\n"+K));if(c.tpModule.retryTimeout(c,j,M,d)===true){return true;}throw d;}if(typeof m!="object"){m=apf.getXmlDom(m).documentElement;}if(m.getAttribute(apf.xmldb.xmlIdTag)){m.setAttribute(apf.xmldb.xmlIdTag,"");}if(!M.$startAction("add",m,O.rollback)){return false;}var a=(M.$actions&&M.$actions.getRule("add",M.$isTreeArch?M.selected:M.xmlRoot)||{})[2];if(D){O.$addParent=D;}else{if(a&&a.getAttribute("parent")){O.$addParent=M.xmlRoot.selectSingleNode(a.getAttribute("parent"));}else{O.$addParent=M.$isTreeArch?M.selected||M.xmlRoot:M.xmlRoot;}}if(!O.$addParent){O.$addParent=M.xmlRoot||M.getModel(true).data;}if(apf.isWebkit&&O.$addParent.ownerDocument!=m.ownerDocument){m=O.$addParent.ownerDocument.importNode(m,true);}O.$transactionNode=m;O.$transactionSubject=M;I.call(O);};if(K){return G(K,apf.SUCCESS);}else{if(N&&N.get){return apf.getData(N.get,{xmlNode:l,callback:G});}else{}}}else{if(!M.$startAction(this.$lastAction,this.xmlRoot,this.rollback)){return false;}this.$transactionSubject=M;this.$transactionNode=this.$originalNode.cloneNode(true);I.call(this);}};this.$canLoadData=function(){return true;};this.addEventListener("prop.model",function(c){return false;});this.clear=function(){this.documentId=this.xmlRoot=this.cacheId=null;};this.addEventListener("beforeload",function(i){var d=i.xmlNode;if(this.$inTransaction==-1){return;}if(this.$inTransaction){if(this.$transactionNode&&d!=this.$transactionNode){if(this.autoshow){this.autoshow=-1;}this.rollback(true);}else{return;}}if(this.autoshow){this.autoshow=-1;}if(this.begin("update",d)!==false){return false;}});};apf.GuiElement.propHandlers.transaction=function(i){if(!(this.transaction=apf.isTrue(i))){return;}if(!this.hasFeature(apf.__DATABINDING__)){this.implement(apf.StandardBinding);}if(!this.hasFeature(apf.__DATAACTION__)){this.implement(apf.DataAction);if(this.actions){this.$propHandlers.actions.call(this,this.actions,"actions");}}if(!this.hasFeature(apf.__TRANSACTION__)){this.implement(apf.Transaction);if(!this.validgroup){this.$validgroup=new apf.ValidationGroup();this.$validgroup.register(this);}if(!this.id){this.setProperty("id",this.localName+"_"+this.$uniqueId);}var d=this.attributes.getNamedItem("model");if(!d){this.attributes.push(d=new apf.AmlAttr(this,"model",null));}d.inheritedValue="{"+this.id+".root}";if(typeof this.autoshow=="undefined"&&(this.localName=="modalwindow"||this.localName=="window")){this.autoshow=true;}}};apf.BaseList=function(){this.$init(true);this.dynCssClasses=[];this.listNodes=[];};(function(){this.implement(apf.Cache,apf.DataAction);this.$focussable=true;this.multiselect=true;this.mode="normal";this.$propHandlers.fill=function(c){if(c){this.loadFillData(this.getAttribute("fill"));}else{this.clear();}};this.$propHandlers.template=function(j){this.$template=typeof j=="object"?j:apf.nameserver.get("template",j);if(!this.$template){var l;apf.addEventListener("parsestop",l=function(){_self.$propHandlers.template.call(_self,j);apf.removeEventListener("parsestop",l);});return;}this.$deInitNode=function(c,a){var d=c.getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId;this.$template.destroyInstance(d);if(a){a.parentNode.removeChild(a);}};this.$updateNode=function(d,a,c){};this.$moveNode=function(c,a){};var i=document.createDocumentFragment();this.$add=function(c,d,a,s,q){var t=document.createElement("div");t.setAttribute("id",d);i.appendChild(t);this.$template.getNewInstance(this.$getLayoutNode("item","container",t),d,c,true);};this.$fill=function(){this.$int.appendChild(i);apf.queue.empty();};this.$checkLoadQueue();};this.$keyHandler=function(D){var E=D.keyCode,O=D.ctrlKey,T=D.shiftKey,U=this.$selected||this.$caret;if(D.returnValue==-1||!U||this.renaming){return;}var P=this.caret||this.selected,N=this.$ext,M,K,V,i,R,G,I;switch(E){case 13:if(this.$tempsel){this.$selectTemp();}if(this.ctrlselect=="enter"){this.select(this.caret,true);}this.choose(this.selected);break;case 32:if(O||this.mode!="normal"||!this.isSelected(this.caret)){this.select(this.caret,O);}break;case 109:case 46:if(this.disableremove){return;}if(this.$tempsel){this.$selectTemp();}this.remove(this.mode!="normal"?this.caret:null);break;case 36:if(this.hasFeature(apf.__VIRTUALVIEWPORT__)){this.viewport.change(0,null,true,true);}this.select(this.getFirstTraverseNode(),false,T);this.$int.scrollTop=0;break;case 35:if(this.hasFeature(apf.__VIRTUALVIEWPORT__)){this.viewport.change(this.viewport.length,null,true,true);}this.select(this.getLastTraverseNode(),false,T);this.$int.scrollTop=this.$int.scrollHeight;break;case 107:if(this.more){this.startMore();}break;case 37:if(!P&&!this.$tempsel){return;}M=this.$tempsel?apf.xmldb.getNode(this.$tempsel):P;K=apf.getBox(apf.getStyle(U,"margin"));V=U.offsetWidth?Math.floor((N.offsetWidth-(R?15:0))/(U.offsetWidth+K[1]+K[3])):1;K=apf.getBox(apf.getStyle(U,"margin"));M=this.getNextTraverseSelected(M,false);if(M){this.$setTempSelected(M,O,T,true);}else{return;}U=apf.xmldb.findHtmlNode(M,this);if(U.offsetTop<N.scrollTop){N.scrollTop=Array.prototype.indexOf.call(this.getTraverseNodes(),M)<V?0:U.offsetTop-K[0];}break;case 38:if(!P&&!this.$tempsel){return;}M=this.$tempsel?apf.xmldb.getNode(this.$tempsel):P;K=apf.getBox(apf.getStyle(U,"margin"));R=N.scrollHeight>N.offsetHeight;V=U.offsetWidth?Math.floor((N.offsetWidth-(R?15:0))/(U.offsetWidth+K[1]+K[3])):1;M=this.getNextTraverseSelected(M,false,V);if(M){this.$setTempSelected(M,O,T,true);}else{return;}U=apf.xmldb.findHtmlNode(M,this);if(U.offsetTop<N.scrollTop){N.scrollTop=Array.prototype.indexOf.call(this.getTraverseNodes(),M)<V?0:U.offsetTop-K[0];}break;case 39:if(!P&&!this.$tempsel){return;}M=this.$tempsel?apf.xmldb.getNode(this.$tempsel):P;K=apf.getBox(apf.getStyle(U,"margin"));M=this.getNextTraverseSelected(M,true);if(M){this.$setTempSelected(M,O,T);}else{return;}U=apf.xmldb.findHtmlNode(M,this);if(U.offsetTop+U.offsetHeight>N.scrollTop+N.offsetHeight){N.scrollTop=U.offsetTop-N.offsetHeight+U.offsetHeight+K[0];}break;case 40:if(!P&&!this.$tempsel){return;}M=this.$tempsel?apf.xmldb.getNode(this.$tempsel):P;K=apf.getBox(apf.getStyle(U,"margin"));R=N.scrollHeight>N.offsetHeight;V=U.offsetWidth?Math.floor((N.offsetWidth-(R?15:0))/(U.offsetWidth+K[1]+K[3])):1;M=this.getNextTraverseSelected(M,true,V);if(M){this.$setTempSelected(M,O,T);}else{return;}U=apf.xmldb.findHtmlNode(M,this);if(U.offsetTop+U.offsetHeight>N.scrollTop+N.offsetHeight){N.scrollTop=U.offsetTop-N.offsetHeight+U.offsetHeight+K[0];}break;case 33:if(!P&&!this.$tempsel){return;}M=this.$tempsel?apf.xmldb.getNode(this.$tempsel):P;K=apf.getBox(apf.getStyle(U,"margin"));I=N.scrollHeight>N.offsetHeight;G=N.scrollWidth>N.offsetWidth;V=Math.floor((N.offsetWidth-(I?15:0))/(U.offsetWidth+K[1]+K[3]));i=Math.floor((N.offsetHeight-(G?15:0))/(U.offsetHeight+K[0]+K[2]));M=this.getNextTraverseSelected(M,false,V*i);if(!M){M=this.getFirstTraverseNode();}if(M){this.$setTempSelected(M,O,T,true);}else{return;}U=apf.xmldb.findHtmlNode(M,this);if(U.offsetTop<N.scrollTop){N.scrollTop=Array.prototype.indexOf.call(this.getTraverseNodes(),M)<V?0:U.offsetTop-K[0];}break;case 34:if(!P&&!this.$tempsel){return;}M=this.$tempsel?apf.xmldb.getNode(this.$tempsel):P;K=apf.getBox(apf.getStyle(U,"margin"));I=N.scrollHeight>N.offsetHeight;G=N.scrollWidth>N.offsetWidth;V=Math.floor((N.offsetWidth-(I?15:0))/(U.offsetWidth+K[1]+K[3]));i=Math.floor((N.offsetHeight-(G?15:0))/(U.offsetHeight+K[0]+K[2]));M=this.getNextTraverseSelected(P,true,V*i);if(!M){M=this.getLastTraverseNode();}if(M){this.$setTempSelected(M,O,T);}else{return;}U=apf.xmldb.findHtmlNode(M,this);if(U.offsetTop+U.offsetHeight>N.scrollTop+N.offsetHeight){N.scrollTop=U.offsetTop-N.offsetHeight+U.offsetHeight+K[0];}break;default:if(E==65&&O){this.selectAll();}else{if(this.$hasBindRule("caption")){if(!this.xmlRoot||this.autorename){return;}if(!this.lookup||new Date().getTime()-this.lookup.date.getTime()>300){this.lookup={str:"",date:new Date()};}this.lookup.str+=String.fromCharCode(E);var Q=this.getTraverseNodes();for(var F,J=0;J<Q.length;J++){F=this.$applyBindRule("caption",Q[J]);if(F&&F.substr(0,this.lookup.str.length).toUpperCase()==this.lookup.str){if(!this.isSelected(Q[J])){if(this.mode=="check"){this.setCaret(Q[J]);}else{this.select(Q[J]);}}if(U){this.$int.scrollTop=U.offsetTop-(this.$int.offsetHeight-U.offsetHeight)/2;}return;}}return;}}break;}this.lookup=null;return false;};this.$deInitNode=function(d,i){if(!i){return;}i.parentNode.removeChild(i);};this.$updateNode=function(u,q,t){var w=this.$getLayoutNode("item","icon",q);if(w){if(w.nodeType==1){w.style.backgroundImage="url("+apf.getAbsolutePath(this.iconPath,this.$applyBindRule("icon",u))+")";}else{w.nodeValue=apf.getAbsolutePath(this.iconPath,this.$applyBindRule("icon",u));}}else{var s=this.$getLayoutNode("item","image",q);if(s){if(s.nodeType==1){s.style.backgroundImage="url("+apf.getAbsolutePath(apf.hostPath,this.$applyBindRule("image",u))+")";}else{s.nodeValue=apf.getAbsolutePath(apf.hostPath,this.$applyBindRule("image",u));}}}var n=this.$getLayoutNode("item","caption",q);if(n){if(n.nodeType==1){n.innerHTML=this.$applyBindRule("caption",u);}else{n.nodeValue=this.$applyBindRule("caption",u);}}q.title=this.$applyBindRule("title",u)||"";var o=this.$applyBindRule("css",u);if(o||this.dynCssClasses.length){this.$setStyleClass(q,o,this.dynCssClasses);if(o&&!this.dynCssClasses.contains(o)){this.dynCssClasses.push(o);}}if(!t&&this.$updateModifier){this.$updateModifier(u,q);}};this.$moveNode=function(n,m){if(!m){return;}var l=m.parentNode;var o=this.getNextTraverse(n);var q=o?apf.xmldb.findHtmlNode(o,this):null;l.insertBefore(m,q);};this.$add=function(M,C,A,K,z){this.$getNewContext("item");var D=this.$getLayoutNode("item"),F=this.$getLayoutNode("item","select"),B=this.$getLayoutNode("item","icon"),I=this.$getLayoutNode("item","image"),w=this.$getLayoutNode("item","caption");D.setAttribute("id",C);F.setAttribute("onmouseover","apf.setStyleClass(this, 'hover');");F.setAttribute("onselectstart","return false;");F.setAttribute("style",(F.getAttribute("style")||"")+";user-select:none;-moz-user-select:none;-webkit-user-select:none;");if(this.hasFeature(apf.__RENAME__)||this.hasFeature(apf.__DRAGDROP__)){F.setAttribute("ondblclick","var o = apf.lookup("+this.$uniqueId+"); o.stopRename(); o.choose()");F.setAttribute("onmouseout","apf.setStyleClass(this, '', ['hover']);                this.hasPassedDown = false;");F.setAttribute(this.itemSelectEvent||"onmousedown","var o = apf.lookup("+this.$uniqueId+');                 var xmlNode = apf.xmldb.findXmlNode(this);                 var isSelected = o.isSelected(xmlNode);                 this.hasPassedDown = true;                 if (!o.renaming && o.hasFocus() && isSelected == 1)                     this.dorename = true;                 if (!o.hasFeature(apf.__DRAGDROP__) || o.mode != "normal" || !isSelected && !event.ctrlKey)                     o.select(this, event.ctrlKey, event.shiftKey)');F.setAttribute("onmouseup","if (!this.hasPassedDown) return;                var o = apf.lookup("+this.$uniqueId+');if (o.hasFeature(apf.__RENAME__) && this.dorename && o.mode == "normal")                    o.startDelayedRename(event);this.dorename = false;                 var xmlNode = apf.xmldb.findXmlNode(this);                 var isSelected = o.isSelected(xmlNode);                 if (o.mode == "normal" && o.hasFeature(apf.__DRAGDROP__))                     o.select(this, event.ctrlKey, event.shiftKey)');}else{F.setAttribute("onmouseout","apf.setStyleClass(this, '', ['hover']);");F.setAttribute("ondblclick","var o = apf.lookup("+this.$uniqueId+"); o.choose()");F.setAttribute(this.itemSelectEvent||"onmousedown","var o = apf.lookup("+this.$uniqueId+"); o.select(this, event.ctrlKey, event.shiftKey)");}if(B){if(B.nodeType==1){B.setAttribute("style","background-image:url("+apf.getAbsolutePath(this.iconPath,this.$applyBindRule("icon",M))+")");}else{B.nodeValue=apf.getAbsolutePath(this.iconPath,this.$applyBindRule("icon",M));}}else{if(I){if(I.nodeType==1){I.setAttribute("style","background-image:url("+apf.getAbsolutePath(apf.hostPath,this.$applyBindRule("image",M))+")");}else{if(apf.isSafariOld){var G=I.ownerElement.parentNode,E=G.appendChild(G.ownerDocument.createElement("img"));E.setAttribute("src",apf.getAbsolutePath(apf.hostPath,this.$applyBindRule("image",M)));}else{I.nodeValue=apf.getAbsolutePath(apf.hostPath,this.$applyBindRule("image",M));}}}}if(w){apf.setNodeValue(w,this.$applyBindRule("caption",M));}D.setAttribute("title",this.$applyBindRule("tooltip",M)||"");var J=this.$applyBindRule("css",M);if(J){this.$setStyleClass(D,J);if(J){this.dynCssClasses.push(J);}}if(this.$addModifier){this.$addModifier(M,D);}if(K){apf.insertHtmlNode(D,K,z);}else{this.listNodes.push(D);}};this.$fill=function(){if(this.more&&!this.moreItem){this.$getNewContext("item");var l=this.$getLayoutNode("item"),j=this.$getLayoutNode("item","caption"),i=this.$getLayoutNode("item","select");l.setAttribute("class","more");i.setAttribute("onmousedown","var o = apf.lookup("+this.$uniqueId+');o.clearSelection();o.$setStyleClass(this, "more_down");');i.setAttribute("onmouseout","apf.lookup("+this.$uniqueId+').$setStyleClass(this, "", ["more_down"]);');i.setAttribute("onmouseup","apf.lookup("+this.$uniqueId+").startMore(this)");if(j){apf.setNodeValue(j,this.more.match(/caption:(.*)(;|$)/i)[1]);}this.listNodes.push(l);}apf.insertHtmlNodes(this.listNodes,this.$int);this.listNodes.length=0;if(this.more&&!this.moreItem){this.moreItem=this.$int.lastChild;}};this.startMore=function(i){this.$setStyleClass(i,"",["more_down"]);var d;if(!this.$actions.add){if(this.each&&!this.each.match(/[\/\[]/)){d="<"+this.each+(this.each.match(/^a:/)?" xmlns:a='"+apf.ns.aml+"'":"")+" custom='1' />";}else{return false;}}this.add(d,null,null,function(n){this.select(n,null,null,null,null,true);this.$int.appendChild(this.moreItem);var m=function(){this.getActionTracker().undo(this.autoselect?2:1);this.removeEventListener("stoprename",m);this.removeEventListener("beforerename",a);this.removeEventListener("afterrename",c);};var c=function(){this.removeEventListener("afterrename",c);};var a=function(l){this.removeEventListener("stoprename",m);this.removeEventListener("beforerename",a);var j=this.findXmlNodeByValue(l.args[1]);if(j||!l.args[1]){if(l.args[1]&&this.dispatchEvent("notunique",{value:l.args[1]})===false){this.startRename();this.addEventListener("stoprename",m);this.addEventListener("beforerename",a);}else{this.removeEventListener("afterrename",c);this.getActionTracker().undo();if(!this.isSelected(j)){this.select(j);}}return false;}};this.addEventListener("stoprename",m);this.addEventListener("beforerename",a);this.addEventListener("afterrename",c);this.startDelayedRename({},1);});};this.$calcSelectRange=function(s,o){var n=[],t=this.hasFeature(apf.__VIRTUALVIEWPORT__)?this.xmlRoot.selectNodes(this.each):this.getTraverseNodes(),i,q;for(i=false,q=0;q<t.length;q++){if(t[q]==s){i=true;}if(i){n.push(t[q]);}if(t[q]==o){i=false;}}if(!n.length||i){n=[];for(i=false,q=t.length-1;q>=0;q--){if(t[q]==s){i=true;}if(i){n.push(t[q]);}if(t[q]==o){i=false;}}}return n;};this.$selectDefault=function(c){this.select(this.getTraverseNodes()[0],null,null,null,true);};this.loadFillData=function(D){var E,C,z,u=D.splitSafe(","),i=[];for(var B,A,j=0;j<u.length;j++){if((A=u[j]).match(/^\d+-\d+$/)){B=A.split("-");C=parseInt(B[0]);z=parseInt(B[1]);if(B[0].length==B[1].length){E=Math.max(B[0].length,B[1].length);for(var w=C;w<z+1;w++){i.push("<item>"+(w+"").pad(E,"0")+"</item>");}}else{for(var w=C;w<z+1;w++){i.push("<item>"+w+"</item>");}}}else{i.push("<item>"+A+"</item>");}}this.$initingModel=true;this.each="item";this.$setDynamicProperty("caption","[label/text()|@caption|text()]");this.$setDynamicProperty("eachvalue","[value/text()|@value|text()]");this.$canLoadDataAttr=false;this.load("<data>"+i.join("")+"</data>");};}).call(apf.BaseList.prototype=new apf.MultiSelect());apf.__VIRTUALVIEWPORT__=1<<19;apf.VirtualViewport=function(){this.$init(true);this.$regbase=this.$regbase|apf.__VIRTUALVIEWPORT__;this.virtualVTimer=null;this._xmlUpdate=this.$xmlUpdate;apf.setStyleClass(this.$ext,"virtual");this.$deInitNode=function(c,a){this.viewport.redraw();};this.$moveNode=function(c,a){this.viewport.redraw();};this.emptyNode=apf.xmldb.getXml("<empty />");this.$addEmpty=this.$add;this.$add=function(a,c,t,i,d){var s=this.$pHtmlDoc.getElementById(c);if(!s){return;}this.$updateNode(a,s);};this.$fill=function(){};this.addEventListener("$load",function(){if(!this.viewport.limit){this.viewport.limit=1;}});this.clear=function(a,c){if(this.clearSelection){this.clearSelection(!c);}this.documentId=this.xmlRoot=this.cacheId=null;if(!a){this.viewport.offset=0;this.viewport.length=0;this.viewport.resize(0);this.viewport.sb.update();this.$setClearMessage(this["empty-message"]);}else{if(this.$removeClearMessage){this.$removeClearMessage();}}this.viewport.cache=null;};var j=this;this.viewport={offset:0,limit:2,length:0,sb:new apf.scrollbar(),host:this,cache:null,inited:false,draw:function(){this.inited=true;var a=this.limit;this.limit=0;this.resize(a,true);},redraw:function(){this.change(this.offset);},prepare:function(){if(!this.inited){this.draw();}var w=j.getTraverseNodes();if(!w){return;}var d=apf.xmldb.getXmlDocId(j.xmlRoot),c=j.$int.childNodes;for(var u=0,i=0,a=c.length;i<a;i++){if(c[i].nodeType!=1){continue;}c[i].style.display=(u>=w.length)?"none":"block";apf.xmldb.nodeConnect(d,w[u],c[i],j);u++;}},resize:function(d,i){this.cache=null;var a;if(d<this.limit){var c=j.$int.childNodes;for(a=c.length-1;a>=0;a--){if(c[a].nodeType!=1){continue;}j.$int.removeChild(c[a]);if(--this.limit==d){break;}}}else{if(d>this.limit){for(a=this.limit;a<d;a++){j.$addEmpty(j.emptyNode,"",j.xmlRoot,j.$int);}}else{return;}}this.limit=d;if(i){this.sb.update(this.$int);}},findNewLimit:function(i){var t=j.$int;if(!i){i=t.scrollTop;}if(!j.xmlRoot||t.lastChild&&t.lastChild.style.display=="none"){return;}if(!t.lastChild||t.lastChild.offsetTop+t.lastChild.offsetHeight<=t.offsetHeight+i){var c,a,d,u=j.$getSelection();while(this.limit<this.length-1&&(!t.lastChild||t.lastChild.offsetTop+t.lastChild.offsetHeight<=t.offsetHeight+i)){this.limit++;d=j.getTraverseNodes();if(d.length<this.limit){this.limit=d.length;break;}a=d[d.length-1];c=apf.xmldb.nodeConnect(j.documentId,a,null,j);j.$addEmpty(a,c,j.xmlRoot,t);if(u.indexOf(a)>-1){j.$select(t.lastChild);}else{j.$deselect(t.lastChild);}}}else{if(t.lastChild&&t.lastChild.offsetTop>t.offsetHeight+i){var w;while(this.limit>2&&(w=t.lastChild).offsetTop>t.offsetHeight+i){j.$int.removeChild(w);this.limit--;}}}if(!this.initialLimit){this.initialLimit=this.limit;}},change:function(V,c,W,X){var aa;if(V<0){V=0;}if(V>this.length-this.limit-1){aa=Math.floor(this.length-this.limit-1);}else{aa=Math.floor(V);}if(!c){c=this.limit;}this.cache=null;var N=aa-this.offset,K=this.limit;if(N*N>=this.limit*this.limit){N=false;}this.offset=aa;if(N>0){var Q=j.$int.lastChild;if(Q.nodeType!=1){Q=Q.previousSibling;}}if(W){this.sb.$curValue=this.offset/(this.length-this.limit-1);this.sb.updatePos();}var a=j.getTraverseNodes();if(!a){return;}if(a.length<this.limit){if(V>0){alert("shouldnt get here");}else{this.resize(a.length);}}var R=apf.xmldb.getXmlDocId(j.xmlRoot),i=j.$int.childNodes,Y,P,U,T,d,O,M;if(N>0){U=K-N;d=i.length,T=j.$getSelection();for(O=0,M=0;O<N&&M<d;M++){P=j.$int.firstChild;if(P.nodeType==1){O++;Y=a[U++];if(Y){apf.xmldb.nodeConnect(R,Y,P,j);j.$updateNode(Y,P);if(T.indexOf(Y)>-1){j.$select(P);}else{j.$deselect(P);}P.style.display="block";}else{P.style.display="none";}}j.$int.appendChild(P);}}else{if(N<0){N=N*-1;U=0;T=j.$getSelection();for(O=0,M=i.length-1;O<N&&M>=0;M++){P=j.$int.lastChild;if(P.nodeType==1){O++;Y=a[U++];apf.xmldb.nodeConnect(R,Y,P,j);j.$updateNode(Y,P);if(T.indexOf(Y)>-1){j.$select(P);}else{j.$deselect(P);}P.style.display="block";}j.$int.insertBefore(P,j.$int.firstChild);}}else{if(N===false){d=i.length;T=j.$getSelection();for(O=0,M=0;M<d;M++){P=i[M];if(P.nodeType==1){Y=a[O++];apf.xmldb.nodeConnect(R,Y,P,j);j.$updateNode(Y,P);if(T.indexOf(Y)>-1){j.$select(P);}else{j.$deselect(P);}}}}}}if(!X){if(V>=this.length-this.initialLimit){N=V-(this.length-this.initialLimit)+2;j.$int.scrollTop=(j.$int.scrollHeight-j.$int.offsetHeight)*(N/2);}else{var Z=(V%1)*j.$int.firstChild.offsetHeight;this.findNewLimit(Z);j.$int.scrollTop=Z;}if(W){this.sb.update();}return;}}};this.viewport.sb.parentNode=new apf.Class().$init();this.viewport.sb.parentNode.$int=this.$pHtmlNode;this.viewport.sb.dispatchEvent("DOMNodeInsertedIntoDocument");this.viewport.sb.attach(this.$int,this.viewport,function(i,d){var a=j.viewport;if(a.sb.realtime||!i){var c=a.length-a.initialLimit;if(c==0){j.$int.scrollTop=d*(j.$int.scrollHeight-j.$int.offsetHeight);}else{a.change(c*d,a.limit,false);}}else{clearTimeout(this.virtualVTimer);this.virtualVTimer=$setTimeout(function(){a.change(Math.round((a.length-a.initialLimit)*d),a.limit,false);},300);}});apf.layout.setRules(this.$int,"scrollbar","        var s = apf.all["+this.viewport.sb.$uniqueId+"];        s.update();    ",true);apf.layout.queue(this.$int);this.$isInViewport=function(i,d){var a=this.getTraverseNodes();for(var s=0,c=a.length;s<c;s++){if(a[s]==i){return true;}}return false;};this.scrollTo=function(c,a){var d={};this.$isInViewport(c,d);this.viewport.change(d.position+(a?this.viewport.limit-1:0));};this.getFirstTraverseNode=function(a){return this.getTraverseNodes(a)[0];};this.$clearVirtualDataset=function(d){var c=d.childNodes;for(var a=c.length-1;a>=0;a--){d.removeChild(c[a]);}};this.$createVirtualDataset=function(a,i,c){var d=a.selectSingleNode("a_marker")||a.appendChild(a.ownerDocument.createElement("a_marker"));d.setAttribute("start","0");if(i){d.setAttribute("end",i);d.setAttribute("reserved",++this.nodeCount[c]);this.nodeCount[c]+=i;}};this.$xmlUpdate=function(){this.viewport.cache=null;this.viewport.length=this.xmlRoot.selectNodes(this.each).length;this.viewport.sb.update(this.$int);this._xmlUpdate.apply(this,arguments);};this.$load=function(d){apf.xmldb.addNodeListener(d,this);if(!this.renderRoot&&!this.getTraverseNodes(d).length){return this.clear("loading");}if(this.$hasBindRule("load")){this.$createVirtualDataset(d);}this.viewport.cache=null;this.viewport.length=this.xmlRoot.selectNodes(this.each).length+1;this.viewport.prepare();var c=this.$addNodes(d,null,null,this.renderRoot);this.viewport.sb.update(this.$int);if(this.selectable){if(this.autoselect){if(c.length){this.$selectDefault(d);}else{this.setProperty("selected",null);}}else{this.clearSelection(true);var a=this.getFirstTraverseNode();if(a){this.setCaret(a);}this.setProperty("selected",null);this.setProperty("chosen",null);}}if(this.$focussable){apf.window.hasFocus(this)?this.$focus():this.$blur();}};this.$loadSubData=function(){};this.$loadPartialData=function(d,i,c){var s,t=this.$getBindRule("load",xmlRootNode);if(t&&(!t[1]||t[1](xmlRootNode))){this.$setLoadStatus(xmlRootNode,"loading");var a=this.getModel(true);a.$insertFrom(t.getAttribute("get"),{ascending:this.$sort?this.$sort.get().ascending:true,xmlNode:s,documentId:this.documentId,marker:d,start:i,length:c,insertPoint:this.xmlRoot,amlNode:this,callback:function(q){j.setProperty("root",j.xmlRoot);var o=parseInt(apf.queryValue(q,t.getAttribute("total")));if(j.viewport.length!=o){j.viewport.length=o;this.$createVirtualDataset(j.xmlRoot,j.viewport.length,j.documentId);}}});}};function n(d,a,i){for(var c=0;c<d;c++){a.push(j.documentId+"|"+(i+c));}}function m(c,F,D,G){var J,C,i,d=this.viewport.limit,E=[];if(F==-1){C=G.selectNodes(j.each);i=0;J=c[0];}else{if(D<0){n(Math.abs(D),E,parseInt(J.getAttribute("reserved"))+parseInt(J.getAttribute("end"))-parseInt(J.getAttribute("start"))+D);D=0;j.$loadPartialData(J);if(E.length==d){return E;}}C=c[F].selectNodes("following-sibling::"+this.each.split("|").join("following-sibling::"));i=c[F].getAttribute("end");J=c[++F];}do{var I=Math.min(J.getAttribute("start")-i,d);for(var a=D;a<I;a++){E.push(C[a]);}if(E.length==d){break;}var B=parseInt(J.getAttribute("end"))-parseInt(J.getAttribute("start"));n(Math.min(B,d-E.length),E,parseInt(J.getAttribute("reserved")));j.$loadPartialData(J);i=parseInt(J.getAttribute("end"));J=c[++F];D=0;}while(E.length<d&&J);j.viewport.cache=E;return E;}this.getTraverseNodes=function(a){if(!this.xmlRoot){return;}if(this.viewport.cache){return this.viewport.cache;}var i=this.viewport.offset+1,d=i+this.viewport.limit;var s=(a||this.xmlRoot).selectNodes("a_marker");if(!s.length){var t=(a||this.xmlRoot).selectNodes("("+this.each+")[position() >= "+i+" and position() < "+(d)+"]");return this.$sort?this.$sort.apply(t):t;}for(var c=0;c<s.length;c++){if(s[c].getAttribute("end")<i){if(c==s.length-1){return m(s,c,i-s[c].getAttribute("end"),(a||this.xmlRoot));}continue;}if(s[c].getAttribute("start")-d<=0&&i>=s[c].getAttribute("start")){return m(s,c,i-s[c].getAttribute("end"),(a||this.xmlRoot));}else{if(s[c-1]){return m(s,c-1,i-s[c-1].getAttribute("end"),(a||this.xmlRoot));}else{return m(s,-1,i,(a||this.xmlRoot));}}}};var l=this.getNextTraverseSelected;this.getNextTraverseSelected=function(t,d,i){if(!t){t=this.selected;}if(!i){i=1;}var s=l.call(this,t,d,i);if(s&&s!=t){return s;}var c=this.getTraverseNodes(),a=0;while(c[a]&&c[a]!=t){a++;}if(d){a=-1*(c.length-a-1);}this.viewport.change(Math.max(0,this.viewport.offset+a+(d?i:-1*i)),null,true,true);c=this.getTraverseNodes();return c[d?c.length-1:0];};this.caching=false;};apf.BaseStateButtons=function(){this.state="normal";this.edit=false;this.animate=true;var n={min:["minimized","minimize","restore"],max:["maximized","maximize","restore"],edit:["edit","edit","closeedit"],close:["closed","close","show"]};this.$lastheight=null;this.$lastpos=null;this.$lastzindex=null;this.$lastState={normal:true};this.$booleanProperties.animate=true;this.$supportedProperties.push("buttons","animate","state");this.close=function(){this.setProperty("state",this.state.split("|").pushUnique("closed").join("|"),false,true);return this;};this.minimize=function(){this.setProperty("state",this.state.split("|").remove("maximized").remove("normal").pushUnique("minimized").join("|"),false,true);return this;};this.maximize=function(){this.setProperty("state",this.state.split("|").remove("minimized").remove("normal").pushUnique("maximized").join("|"),false,true);return this;};this.restore=function(){this.setProperty("state",this.state.split("|").remove("minimized").remove("maximized").pushUnique("normal").join("|"),false,true);return this;};this.edit=function(a){this.setProperty("state",this.state.split("|").pushUnique("edit").join("|"),false,true);return this;};this.closeedit=function(a){this.setProperty("state",this.state.split("|").remove("edit").join("|"),false,true);return this;};this.$toggle=function(a){var c=n[a][0];this[n[a][this.state.indexOf(c)>-1?2:1]]();};this.$propHandlers.refparent=function(a){if(typeof a=="string"){this.$refParent=self[a]&&self[a].$ext||document.getElementById(a);}else{this.$refParent=a;}};this.$propHandlers.state=function(W,V,d,U){var ab=this;if(!this.$amlLoaded){apf.queue.add("state"+this.$uniqueId,function(){ab.$propHandlers.state.call(ab,W,V);});return;}var l,ac,a,T,aa,X={},Y=W.split("|"),P=this.$lastState,j=[];for(l=0;l<Y.length;l++){X[Y[l]]=true;}X.value=W;if(!X.maximized&&!X.minimized){X.normal=true;}if(!U&&this.dispatchEvent("beforestatechange",{from:P,to:X})===false){this.state=P.value;return false;}if(X.closed==this.visible){this.setProperty("visible",!X.closed);}if(X.normal!=P.normal||!X.normal&&(X.minimized!=P.minimized||X.maximized!=P.maximized)){if(this.$lastheight){this.$ext.style.height=this.$lastheight;}if(this.$lastpos){if(this.animate&&!V){var Q=this.$ext;a=apf.getStyle(Q,"position");if(a!="absolute"){T=parseInt(apf.getStyle(Q,"left"))||0;aa=parseInt(apf.getStyle(Q,"top"))||0;}else{T=Q.offsetLeft;aa=Q.offsetTop;}this.animstate=1;apf.tween.multi(Q,{steps:5,interval:10,tweens:[{type:"left",from:T,to:this.$lastpos.px[0]},{type:"top",from:aa,to:this.$lastpos.px[1]},{type:"width",from:this.$ext.offsetWidth-o,to:this.$lastpos.px[2]},{type:"height",from:this.$ext.offsetHeight-t,to:this.$lastpos.px[3]}],oneach:function(){if(apf.hasSingleRszEvent){apf.layout.forceResize(ab.$int);}},onfinish:function(){ab.$propHandlers.state.call(ab,W,true,null,true);}});return;}this.$ext.style.left=this.$lastpos.css[0];this.$ext.style.top=this.$lastpos.css[1];this.$ext.style.width=this.$lastpos.css[2];this.$ext.style.height=this.$lastpos.css[3];ac=this.$lastpos.parentNode;ac.style.width=this.$lastpos.parent[0];ac.style.height=this.$lastpos.parent[1];ac.style.overflow=this.$lastpos.parent[2];}if(this.aData&&this.aData.restore){this.aData.restore();}if(apf.layout){apf.layout.play(this.$pHtmlNode);}if(this.$lastzindex){this.$ext.style.zIndex=this.$lastzindex[0];if(this.oCover){this.oCover.style.zIndex=this.$lastzindex[1];}}this.$lastheight=this.$lastpos=this.$lastzindex=null;if(X.normal){j.push("",this.$baseCSSname+"Max",this.$baseCSSname+"Min");}}if(X.minimized!=P.minimized){if(X.minimized){j.unshift(this.$baseCSSname+"Min",this.$baseCSSname+"Max",this.$baseCSSname+"Edit");if(this.aData&&this.aData.minimize){this.aData.minimize(this.collapsedHeight);}if(!this.aData||!this.aData.minimize){this.$lastheight=apf.getStyle(this.$ext,"height");this.$ext.style.height=Math.max(0,this.collapsedHeight-apf.getHeightDiff(this.$ext))+"px";}if(this.hasFocus()){apf.window.moveNext(null,this,true);}}else{j.push(this.$baseCSSname+"Min");$setTimeout(function(){apf.window.$focusLast(ab);});}}if(X.maximized!=P.maximized){if(X.maximized){j.unshift(this.$baseCSSname+"Max",this.$baseCSSname+"Min",this.$baseCSSname+"Edit");ac=this.$refParent;if(!ac){ac=(this.$ext.offsetParent==document.body?document.documentElement:this.$ext.parentNode);}ab.animstate=0;var c=false,Q=this.$ext;var a=apf.getStyle(Q,"position");if(a=="absolute"){ac.style.overflow="hidden";T=Q.offsetLeft;aa=Q.offsetTop;}else{var Z=apf.getAbsolutePosition(Q,ac);T=Z[0];aa=Z[1];}this.$lastpos={css:[this.$ext.style.left,this.$ext.style.top,this.$ext.style.width,this.$ext.style.height],px:[T,aa,this.$ext.offsetWidth-o,this.$ext.offsetHeight-t],parent:[ac.style.width,ac.style.height,ac.style.overflow],parentNode:ac};var R=[Q.offsetWidth,Q.offsetHeight];function i(){var C=!apf.isIE&&ac==document.documentElement?window.innerWidth:ac.offsetWidth,z=!apf.isIE&&ac==document.documentElement?window.innerHeight:ac.offsetHeight;if(a!="absolute"){var A=apf.getDiff(ac);C-=A[0]+(!ab.$refParent&&apf.isIE8?4:0);z-=A[0]+(!ab.$refParent&&apf.isIE8?4:0);}else{if(!ab.$refParent&&apf.isIE8){C-=4;z-=4;}}var B=ab.$refParent?[0,0,0,0]:q,w=ac!=Q.offsetParent?apf.getAbsolutePosition(ac,Q.offsetParent):[0,0],u=apf.getDiff(ac);ac.style.width=(ac.offsetWidth-u[0])+"px";ac.style.height=(ac.offsetHeight-u[1])+"px";if(ab.animate&&!c){ab.animstate=1;c=true;apf.tween.multi(Q,{steps:5,interval:10,tweens:[{type:"left",from:T,to:w[0]-B[3]},{type:"top",from:aa,to:w[1]-B[0]},{type:"width",from:R[0]-o,to:(C-o+B[1]+B[3])},{type:"height",from:R[1]-t,to:(z-t+B[0]+B[2])}],oneach:function(){if(apf.hasSingleRszEvent){apf.layout.forceResize(ab.$int);}},onfinish:function(){ab.animstate=0;ab.dispatchEvent("afterstatechange",{from:P,to:X});}});}else{if(!ab.animstate){Q.style.left=(w[0]-B[3])+"px";Q.style.top=(w[1]-B[0])+"px";Q.style.width=(C-o+B[1]+B[3])+"px";Q.style.height=(z-t+B[0]+B[2])+"px";}}}if(apf.layout){apf.layout.pause(this.$pHtmlNode,i);}this.$lastzindex=[this.$ext.style.zIndex||1,this.oCover&&this.oCover.style.zIndex||1];if(this.oCover){this.oCover.style.zIndex=apf.WinServer.count+1;}this.$ext.style.zIndex=apf.WinServer.count+2;}else{j.push(this.$baseCSSname+"Max");}}if(X.edit!=P.edit){if(X.edit){j.unshift(this.$baseCSSname+"Edit",this.$baseCSSname+"Max",this.$baseCSSname+"Min");if(this.btnedit){s.edit.innerHTML="close";}this.dispatchEvent("editstart");}else{if(this.dispatchEvent("editstop")===false){return false;}j.push(this.$baseCSSname+"Edit");if(j.length==1){j.unshift("");}if(this.btnedit){s.edit.innerHTML="edit";}}}if(j.length||X.closed!=P.closed){if(j.length){this.$setStyleClass(this.$ext,j.shift(),j);}if(X.edit){this.dispatchEvent("prop.visible",{value:true});if(ab.oSettings){apf.layout.forceResize(ab.oSettings);}}if(!X.maximized||P.maximized&&ab.animate){ab.dispatchEvent("afterstatechange",{from:P,to:X});}this.$lastState=X;if(this.aData&&!X.maximized){this.$purgeAlignment();}if(!this.animate&&apf.hasSingleRszEvent&&apf.layout){apf.layout.forceResize(ab.$int);}}};var q,o,t,s={};this.$propHandlers.buttons=function(B){if(apf.isIphone){return;}if(!this.$hasLayoutNode("button")){return;}var a=B&&(B=B.replace(/(\|)\||\|$/,"$1")).split("|")||[],i=this.$buttons.childNodes,l=B&&new RegExp("("+B+")"),j={},A=[];for(var c=0;c<i.length;c++){if(i[c].nodeType!=1||i[c].tagName!="DIV"){continue;}if(i[c].getAttribute("button")&&(!B||!i[c].className||!i[c].className.match(l))){i[c].style.display="none";this.$setStyleClass(i[c],"",["min","max","close","edit"]);A.push(i[c]);}else{j[RegExp.$1]=i[c];}}for(c=0;c<a.length;c++){if(!a[c]){continue;}if(j[a[c]]){this.$buttons.insertBefore(j[a[c]],this.$buttons.firstChild);continue;}var d=A.pop();if(!d){this.$getNewContext("button");d=this.$getLayoutNode("button");d.setAttribute("button","button");m(d);d=apf.insertHtmlNode(d,this.$buttons);}this.$setStyleClass(d,a[c],["min","max","close","edit"]);d.onclick=new Function("apf.lookup("+this.$uniqueId+").$toggle('"+a[c]+"')");d.style.display="block";s[a[c]]=d;this.$buttons.insertBefore(d,this.$buttons.firstChild);}var C=apf.getDiff(this.$ext);o=C[0];t=C[1];q=apf.getBox(apf.getStyle(this.$ext,"borderWidth"));};function m(a){a.setAttribute("onmousedown","apf.setStyleClass(this, 'down');             event.cancelBubble = true;              var o = apf.findHost(this).$ext;             if (o.onmousedown) o.onmousedown(event);             apf.window.$mousedown(event);");a.setAttribute("onmouseup","apf.setStyleClass(this, '', ['down'])");a.setAttribute("onmouseover","apf.setStyleClass(this, 'hover')");a.setAttribute("onmouseout","apf.setStyleClass(this, '', ['hover', 'down'])");}this.$initButtons=function(c){this.collapsedHeight=this.$getOption("Main","collapsed-height");var d=this.$getLayoutNode("main","buttons",c);if(!d||apf.isIphone||!this.getAttribute("buttons")||!this.$hasLayoutNode("button")){return;}var a=(this.getAttribute("buttons")||"").split("|").length;for(var i,j=0;j<a;j++){this.$getNewContext("button");i=d.appendChild(this.$getLayoutNode("button"));i.setAttribute("button","button");m(i);}};this.addEventListener("DOMNodeRemovedFromDocument",function(c){for(var a in s){s[a].onclick=null;}});};apf.Teleport=function(){this.$init(true);};apf.__TELEPORT__=1<<28;(function(){this.$parsePrio="002";this.$regbase=this.$regbase|apf.__TELEPORT__;this.$booleanProperties.autoroute=true;this.$supportedProperties.push("url","timeout","protocol","route-server","autoroute");this.$propHandlers.url=function(i){var d=new apf.url(i);if(!d.protocol){throw new Error(apf.formatErrorString(0,this,"Communication (Teleport) initialization error","Invalid server url provided."));}this.$domain=d.host;this.$rootPath=d.path;this.$server=i.replace(new RegExp(this.$rootPath+"$"),"");};this.$propHandlers.timeout=function(c){this.timeout=parseInt(c)||10000;};this.$propHandlers.protocol=function(i){var d=i.toLowerCase();if(!apf[d]){throw new Error(apf.formatErrorString(1025,null,"Teleport baseclass","Could not find Ajax.org Teleport RPC Component '"+d+"'",this));}this.implement(apf[d]);};this.toString=function(){return"[Ajax.org Teleport Component : "+(this.name||"")+" ("+this.type+")]";};this.addEventListener("DOMNodeInsertedIntoDocument",function(){if(!apf.http){throw new Error(apf.formatErrorString(1024,null,"Teleport baseclass","Could not find Ajax.org Teleport HTTP Component",this.$aml));}this.implement(apf.http);if(this.id){apf.$asyncObjects[this.id]=1;}});}).call(apf.Teleport.prototype=new apf.AmlElement());apf.Init.run("teleport");apf.__INTERACTIVE__=1<<21;apf.Interactive=function(){var aS,aT,aM,l,aZ,au=null,aO,an,aD,am,ay,aQ,ar,aJ,aY,aE,a0,aN,aW,aF,ao,ap,aL,aR=this,aH,t,w,aw,al,aP,aX;this.$regbase=this.$regbase|apf.__INTERACTIVE__;this.$propHandlers.draggable=function(d){if(apf.isFalse(d)){this.draggable=d=false;}else{if(apf.isTrue(d)){this.draggable=d=true;}}var c=this.oDrag||this.$ext;if(c.interactive&1){return;}var a=c.onmousedown;c.onmousedown=function(){if(a&&a.apply(this,arguments)===false){return;}aV.apply(this,arguments);};c.interactive=(c.interactive||0)+1;};this.$propHandlers.resizable=function(c){if(apf.isFalse(c)){this.resizable=c=false;}else{if(apf.isTrue(c)){this.resizable=c=true;}}var i=this.oResize||this.$ext;if(i.interactive&2){return;}var a=i.onmousedown;var d=i.onmousemove;i.onmousedown=function(){if(a&&a.apply(this,arguments)===false){return;}av.apply(this,arguments);};i.onmousemove=function(){if(d&&d.apply(this,arguments)===false){return;}aG.apply(this,arguments);};i.interactive=(i.interactive||0)+2;aW=this.$getOption&&parseInt(this.$getOption("Main","resize-border"))||3;aF=this.$getOption&&parseInt(this.$getOption("Main","resize-corner"))||12;ao=apf.getBox(apf.getStyle(this.$ext,apf.isIE?"borderWidth":"border-width"));};function aV(d){if(!d){d=event;}if(!aR.draggable||apf.dragMode){return;}al=aR.dragOutline==true||apf.config.dragOutline;apf.dragMode=true;aw=false;apf.popup.forceHide();aH="absolute|fixed".indexOf(apf.getStyle(aR.$ext,"position"))>-1;if(!aH){aR.$ext.style.position=(aH=aR.dragSelection)?"absolute":"relative";}if(aH&&!aR.aData){apf.plane.show(al?at:aR.$ext);}var c=aH?apf.getAbsolutePosition(aR.$ext,aR.$ext.offsetParent):[parseInt(apf.getStyle(aR.$ext,"left"))||0,parseInt(apf.getStyle(aR.$ext,"top"))||0];aS=c[0]-(t=d.clientX);aT=c[1]-(w=d.clientY);if(aH&&al){at.className="drag";var a=apf.getDiff(at);aR.$ext.parentNode.appendChild(at);at.style.left=c[0]+"px";at.style.top=c[1]+"px";at.style.width=(aR.$ext.offsetWidth-a[0])+"px";at.style.height=(aR.$ext.offsetHeight-a[1])+"px";if(aR.dragSelection){at.style.display="block";}}document.onmousemove=aU;document.onmouseup=function(){document.onmousemove=document.onmouseup=null;if(aH&&!aR.aData){apf.plane.hide();}var j=al?at:aR.$ext;if(aw){if(aR.setProperty){if(aR.right||aR.bottom){var i=aR.$ext.offsetParent;if(i.tagName=="BODY"){i=document.documentElement;}}if(aR.right){aR.setProperty("right",i.offsetWidth-j.offsetLeft-j.offsetWidth);}if(aR.bottom){aR.setProperty("bottom",i.offsetHeight-j.offsetTop-j.offsetHeight);}if(aO&&(!aR.right||aR.left)){aR.setProperty("left",aO);}if(an&&(!aR.bottom||aR.top)){aR.setProperty("top",an);}}else{if(al){aR.$ext.style.left=aO+"px";aR.$ext.style.top=an+"px";}}}aO=an=ar=aJ=null;if(!aH){aR.$ext.style.position="relative";}if(aR.showdragging){apf.setStyleClass(aR.$ext,"",["dragging"]);}if(aH&&al){at.style.display="none";}apf.dragMode=false;if(aR.dispatchEvent){aR.dispatchEvent("drag",{htmlNode:j});}};if(apf.isIE){apf.window.$mousedown(d);}return false;}function aU(j){if(!j){j=event;}if(aR.dragSelection){aw=true;}if(!aw&&aR.showdragging){apf.setStyleClass(aR.$ext,"dragging");}var d=j.clientX-t,c=j.clientY-w,i;if(!aw&&(i=d*d>c*c?d:c)*i<2){return;}else{if(!aw&&al&&at.style.display!="block"){at.style.display="block";}}var a=al?at:aR.$ext;a.style.left=(aO=j.clientX+aS)+"px";a.style.top=(an=j.clientY+aT)+"px";aw=true;}this.$resizeStart=av;function av(o,c){if(!o){o=event;}if(!aR.resizable){return;}aP=!(aR.resizeOutline==false||!apf.config.resizeOutline);if(!aP){var d=apf.getDiff(aR.$ext);aL=d[0];ap=d[1];}aZ=apf.getAbsolutePosition(aR.$ext);aZ.push(aR.$ext.offsetWidth);aZ.push(aR.$ext.offsetHeight);aX=apf.getAbsolutePosition(aR.$ext,aR.$ext.offsetParent);var n=0,j=0,i=(t=o.clientX)-aZ[0]+n+document.documentElement.scrollLeft,m=(w=o.clientY)-aZ[1]+j+document.documentElement.scrollTop,q;if(c&&c.resizeType){aH="absolute|fixed".indexOf(apf.getStyle(aR.$ext,"position"))>-1;q=c.resizeType;}else{q=aq.call(aR.$ext,i,m);}aM=i;l=m;if(!q){return;}if(aR.dispatchEvent&&aR.dispatchEvent("resizestart",{type:q})===false){return;}apf.popup.forceHide();if(aR.$ext.style.right){aR.$ext.style.left=aR.$ext.offsetLeft+"px";aR.$ext.style.right="";}if(aR.$ext.style.bottom){aR.$ext.style.top=aR.$ext.offsetTop+"px";aR.$ext.style.bottom="";}apf.dragMode=true;aw=false;aY=q.indexOf("w")>-1;aE=q.indexOf("n")>-1;a0=q.indexOf("e")>-1;aN=q.indexOf("s")>-1;if(!aR.minwidth){aR.minwidth=0;}if(!aR.minheight){aR.minheight=0;}if(!aR.maxwidth){aR.maxwidth=10000;}if(!aR.maxheight){aR.maxheight=10000;}if(aH){aD=aZ[0]+aZ[2]-aR.minwidth;am=aZ[1]+aZ[3]-aR.minheight;ay=aZ[0]+aZ[2]-aR.maxwidth;aQ=aZ[1]+aZ[3]-aR.maxheight;}if(aH){apf.plane.show(aP?at:aR.$ext);}if(aP){at.className="resize";var a=apf.getDiff(at);aL=a[0];ap=a[1];at.style.left=aZ[0]+"px";at.style.top=aZ[1]+"px";at.style.width=(aR.$ext.offsetWidth-aL)+"px";at.style.height=(aR.$ext.offsetHeight-ap)+"px";at.style.display="block";}if(!c||!c.nocursor){if(au===null){au=document.body.style.cursor;}document.body.style.cursor=q+"-resize";}document.onmousemove=aK;document.onmouseup=function(s){document.onmousemove=document.onmouseup=null;if(aH){apf.plane.hide();}if(aP){var u=apf.getDiff(aR.$ext);aL=u[0];ap=u[1];}aB(s||event,true);if(aR.setProperty){ak();}aO=an=ar=aJ=null;document.body.style.cursor=au;au=null;if(aP){at.style.display="none";}apf.dragMode=false;if(aR.dispatchEvent){aR.dispatchEvent("resize");}};if(apf.isIE){apf.window.$mousedown(o);}return false;}function ak(){if(aH){var a=aR.$ext;if(aR.right||aR.bottom){var c=a.offsetParent;if(c.tagName=="BODY"){c=document.documentElement;}}if(aR.right&&aR.right!=aR.setProperty("right",c.offsetWidth-a.offsetLeft-a.offsetWidth)){a.style.left="";}if(aR.bottom&&aR.bottom!=aR.setProperty("bottom",c.offsetHeight-a.offsetTop-a.offsetHeight)){a.style.top="";}if(aO&&(!aR.right||aR.left)){aR.setProperty("left",aO);}if(an&&(!aR.bottom||aR.top)){aR.setProperty("top",an);}}if(ar&&(!aR.left||!aR.right)){aR.setProperty("width",ar+aL);}if(aJ&&(!aR.top||!aR.bottom)){aR.setProperty("height",aJ+ap);}}var aC=Math.min,aI=Math.max,az;function aK(a){if(!a){a=event;}if(az&&new Date().getTime()-az<(aP?6:apf.mouseEventBuffer)){return;}az=new Date().getTime();aB(a);}function aB(i,j){var c=aP&&!j?at:aR.$ext;var d=document.documentElement.scrollLeft,a=document.documentElement.scrollTop;if(aY){c.style.left=(aO=aI(ay,aC(aD,aX[0]+i.clientX-t+d)))+"px";c.style.width=(ar=aC(aR.maxwidth-aL,aI(aL,aR.minwidth,aZ[2]-(i.clientX-t)+d)-aL))+"px";}if(aE){c.style.top=(an=aI(aQ,aC(am,aX[1]+i.clientY-w+a)))+"px";c.style.height=(aJ=aC(aR.maxheight-ap,aI(ap,aR.minheight,aZ[3]-(i.clientY-w)+a)-ap))+"px";}if(a0){c.style.width=(ar=aC(aR.maxwidth-aL,aI(aL,aR.minwidth,i.clientX-aZ[0]+(aZ[2]-aM)+d)-aL))+"px";}if(aN){c.style.height=(aJ=aC(aR.maxheight-ap,aI(ap,aR.minheight,i.clientY-aZ[1]+(aZ[3]-l)+a)-ap))+"px";}if(aR.parentNode.localName=="table"){ak();apf.layout.processQueue();}if(apf.hasSingleRszEvent){apf.layout.forceResize(aR.$int);}}function aq(c,i){var a="",d="";aH="absolute|fixed".indexOf(apf.getStyle(aR.$ext,"position"))>-1;if(aR.resizable==true||aR.resizable=="vertical"){if(i<aW+ao[0]){a=aH?"n":"";}else{if(i>this.offsetHeight-aW){a="s";}else{if(i>this.offsetHeight-aF){d="s";}}}}if(aR.resizable==true||aR.resizable=="horizontal"){if(c<(a?aF:aW)+ao[0]){a+=d+(aH?"w":"");}else{if(c>this.offsetWidth-(a||d?aF:aW)){a+=d+"e";}}}return a;}var aA;function aG(n){if(!n){n=event;}if(!aR.resizable||document.onmousemove){return;}var i=apf.getAbsolutePosition(aR.$ext),c=0,d=0,a=n.clientX-i[0]+c+document.documentElement.scrollLeft,j=n.clientY-i[1]+d+document.documentElement.scrollTop;if(!aA){aA=apf.getStyle(this,"cursor");}var m=aq.call(aR.$ext,a,j);this.style.cursor=m?m+"-resize":aA||"default";}var at;function ax(a){at=this.$pHtmlDoc.getElementById("apf_outline");if(!at){at=this.$pHtmlDoc.body.appendChild(this.$pHtmlDoc.createElement("div"));at.refCount=0;at.setAttribute("id","apf_outline");at.style.position="absolute";at.style.display="none";at.style.zIndex=2000000;}at.refCount++;}if(this.addEventListener&&this.hasFeature(apf.__AMLNODE__)){this.addEventListener("DOMNodeInsertedIntoDocument",ax);}else{this.$pHtmlDoc=document;ax.call(this);}};apf.GuiElement.propHandlers.resizable=function(c){this.implement(apf.Interactive);this.$propHandlers.resizable.apply(this,arguments);};apf.GuiElement.propHandlers.draggable=function(c){this.implement(apf.Interactive);this.$propHandlers.draggable.apply(this,arguments);};apf.__DELAYEDRENDER__=1<<11;apf.DelayedRender=function(){this.$regbase=this.$regbase|apf.__DELAYEDRENDER__;this.$rendered=false;this.$render=function(a){if(this.$rendered){return;}if(this.dispatchEvent("beforerender")===false){return;}if(this["render-delay"]||a){$setTimeout("apf.lookup("+this.$uniqueId+").$renderparse()",10);}else{this.$renderparse();}};this.$renderparse=function(){if(this.$rendered){return;}var a=this.ownerDocument.$domParser;a.parseFromXml(this.$aml,{amlNode:this,doc:this.ownerDocument,delayedRender:true});a.$continueParsing(this);this.$rendered=true;this.dispatchEvent("afterrender");};var c;this.addEventListener("prop.visible",c=function(){if(arguments[0].value){this.$render();this.removeEventListener("prop.visible",c);}});};apf.GuiElement.propHandlers.render=function(c){if(!this.hasFeature(apf.__DELAYEDRENDER__)&&c=="runtime"){this.implement(apf.DelayedRender);if(this.localName!="page"){this.visible=false;this.$ext.style.display="none";}if(typeof this["render-delay"]=="undefined"){this.$setInheritedAttribute("render-delay");}}};apf.config.$inheritProperties["render-delay"]=1;apf.__RENAME__=1<<10;apf.Rename=function(){this.$regbase=this.$regbase|apf.__RENAME__;this.canrename=true;this.renameSubject=this.renameTimer=this.lastCursor=null;this.$booleanProperties.canrename=true;this.$booleanProperties.autorename=true;this.$supportedProperties.push("canrename","autorename");this.$propHandlers.autorename=function(a){if(a){this.reselectable=true;this.bufferselect=false;this.addEventListener("afterselect",d);this.addEventListener("keydown",i);}else{this.removeEventListener("afterselect",d);this.removeEventListener("keydown",i);}};function d(){var a=this;$setTimeout(function(){if(a.hasFocus()){a.startRename();}},20);}function i(a){if(!this.renaming&&apf.isCharacter(a.keyCode)){this.startRename();}}this.$isContentEditable=function(a){if(this.renaming&&this.autorename){return true;}};this.rename=function(c,a){if(!c){c=this.caret||this.selected;}if(!c){return;}this.$executeSingleValue("rename","caption",c,a);};this.startDelayedRename=function(a,c){if(a&&(a.button==2||a.ctrlKey||a.shiftKey)){return;}clearTimeout(this.renameTimer);this.renameTimer=$setTimeout("apf.lookup("+this.$uniqueId+").startRename()",c||400);};this.startRename=function(c,u){if(!c&&(this.renaming||!this.canrename||!this.$startAction("rename",this.caret||this.selected,this.stopRename))){return false;}if(!this.hasFocus()){this.focus(null,null,true);}clearTimeout(this.renameTimer);var t=this.$getCaptionElement?this.$getCaptionElement():this.$caret||this.$selected;if(!t){return this.stopRename();}this.renaming=true;this.renameSubject=this.caret||this.selected;var s=t.offsetWidth;this.lastCursor=t.style.cursor;t.style.cursor="text";t.parentNode.replaceChild(this.oTxt,t);t.host=this;if(apf.isTrue(this.$getOption("main","scalerename"))){var w=apf.getWidthDiff(this.oTxt);this.oTxt.style.width=(s-w-3)+"px";}this.replacedNode=t;var q=this.$getCaptionXml?this.$getCaptionXml(this.renameSubject):this.$getDataNode("caption",this.renameSubject);this.oTxt[apf.hasContentEditable?"innerHTML":"value"]=u||!q?"":(q.nodeType>=2&&q.nodeType<=4?unescape(decodeURI(q.nodeValue)):(apf.isOnlyChild(q.firstChild,[3,4])?apf.queryValue(q):this.$applyBindRule("caption",this.renameSubject)))||"";this.oTxt.unselectable="Off";this.oTxt.host=this;try{this.oTxt.focus();this.oTxt.select();}catch(a){}};this.stopRename=function(c,a){clearTimeout(this.renameTimer);if(!this.renaming||c&&c!=this.renameSubject||!this.replacedNode){return false;}if(this.oTxt.parentNode&&this.oTxt.parentNode.nodeType==1){if(apf.isIE8||apf.isIE7Emulate){this.oTxt.blur();}this.oTxt.parentNode.replaceChild(this.replacedNode,this.oTxt);}this.renaming=false;if(this.replacedNode){this.replacedNode.style.cursor=this.lastCursor||"";this.replacedNode.host=null;}if(!a){this.dispatchEvent("stoprename");this.$stopAction("rename");}else{if(this.replacedNode){this.replacedNode.innerHTML=this.oTxt[apf.hasContentEditable?"innerText":"value"];}this.rename(this.renameSubject,this.oTxt[apf.hasContentEditable?"innerText":"value"].replace(/<.*?nobr>/gi,""));}if(!this.renaming){this.renameSubject=null;this.replacedNode=null;this.oTxt.style.width="";}return true;};this.addEventListener("keydown",function(a){var c=a.keyCode;if(this.renaming){if(c==27||c==13){this.stopRename(null,c==13&&!this.$autocomplete);a.cancelBubble=true;return false;}return;}if(c==113){if(this.$tempsel){this.$selectTemp();}if(this.caret!=this.selected){if(this.multiselect||this.isSelected(this.caret)){this.selected=this.caret;this.$selected=this.$caret;}else{this.select(this.caret,true);}}this.startRename();return false;}},true);this.addEventListener("DOMNodeRemovedFromDocument",function(a){this.oTxt.refCount--;if(!this.oTxt.refCount){this.oTxt.host=this.oTxt.onmouseover=this.oTxt.onmousedown=this.oTxt.select=this.oTxt.onfocus=this.oTxt.onblur=null;}});this.$init(function(){if(!(this.oTxt=document.getElementById("txt_rename"))){if(apf.hasContentEditable){this.oTxt=document.createElement("DIV");this.oTxt.contentEditable=true;if(apf.isIE6){this.oTxt.style.width="1px";}}else{this.oTxt=document.createElement("input");this.oTxt.id="txt_rename";this.oTxt.autocomplete=false;}if(apf.hasFocusBug){apf.sanitizeTextbox(this.oTxt);}this.oTxt.refCount=0;this.oTxt.id="txt_rename";this.oTxt.style.whiteSpace="nowrap";this.oTxt.onselectstart=function(a){(a||event).cancelBubble=true;};apf.sanitizeTextbox(this.oTxt);this.oTxt.onmouseover=this.oTxt.onmouseout=this.oTxt.oncontextmenu=this.oTxt.onmousedown=function(a){(a||event).cancelBubble=true;};this.oTxt.onkeyup=function(){if(!this.host.$autocomplete){return;}this.host.$lookup(this[apf.hasContentEditable?"innerHTML":"value"]);};this.oTxt.select=function(){if(!apf.hasMsRangeObject){return this.focus();}var c=document.selection.createRange();try{c.moveToElementText(this);if(apf.isFalse(this.host.$getOption("main","selectrename"))||typeof this.host.$renameStartCollapse!="undefined"){c.collapse(this.host.$renameStartCollapse);}}catch(a){}c.select();};if(apf.hasFocusBug){this.oTxt.onfocus=function(){if(apf.window){apf.window.$focusfix2();}};}this.oTxt.onblur=function(){if(apf.isGecko){return;}if(apf.hasFocusBug){apf.window.$blurfix();}if(this.host.$autocomplete){return;}this.host.stopRename(null,true);};}this.oTxt.refCount++;});};apf.__DRAGDROP__=1<<5;apf.DragDrop=function(){this.$regbase=this.$regbase|apf.__DRAGDROP__;this.$dragInited=false;this.copy=function(A,t,a,i){if(A.nodeType){A=[A];}var w,l=[],u=0,z=A.length;for(;u<z;u++){l.push({func:i?"moveNode":"appendChild",args:[t,i?A[u]:A[u]=A[u].cloneNode(true),a]});}if(this.$actions[(i?"movegroup":"copygroup")]){w=this.$executeAction("multicall",l,(i?"movegroup":"copygroup"),A[0]);}else{w=this.$executeAction("multicall",l,(i?"move":"copy"),A[0],null,null,A.length>1?A:null);}if(w!==false){return A;}return false;};this.move=function(j,a,l){return this.copy(j,a,l,true);};this.isDragAllowed=function(d,l){if(typeof apf.offline!="undefined"&&!apf.offline.canTransact()){return false;}if(this.disabled||!d||!d.length||!d[0]){return false;}if(this.drag||this.dragcopy){if(l){l.merge(d);}return true;}var j,t=[],s=0,a=d.length;for(;s<a;s++){j=this.$getDataNode("drag",d[s],null,t);if(!j){return false;}if(l){l.push(j);}}return t.length?t:false;};this.isDropAllowed=function(F,J){if(typeof apf.offline!="undefined"&&!apf.offline.canTransact()){return false;}if(this.disabled||!F||!F.length||!J){return false;}var i,C,a=this.$attrBindings&&this.$attrBindings.drop;if(this.drop&&(!a||a.value=="true")){this.$setDynamicProperty("drop",this.hasFeature(apf.__MULTISELECT__)?"["+this.each+"]":"[node()]");a=true;}if(a){for(var B=0,E=F.length;B<E;B++){i=this.$getDataNode("drop",F[B]);if(!i){break;}}if(B==E&&J&&!apf.isChildOf(i,J,true)){return[J,null];}}var j=this.$bindings.drop;if(!j||!j.length){return false;}var G,D,l=0,I=j.length;for(;l<I;l++){G=this.$bindings.getRuleIndex("drop",l);for(var B=0,E=F.length;B<E;B++){i=G.cvalue?G.cvalue(F[B]):G.cmatch(F[B]);if(!i){break;}}if(B!=E){continue;}D=G.target;if(!D||D=="."){C=J;}else{C=(G.ctarget||G.compile("target"))(J);}if(C&&!apf.isChildOf(i,C,true)){return[C,G];}}return false;};this.$dragDrop=function(i,K,O,G,Q,E,N){if(l=="tree-append"&&Q){return false;}var l=O&&O.action;if(l){l=(O.caction||O.compile("action"))(K[0]);}else{l=G;}var M={internal:apf.DragServer.dragdata.host==this,ctrlKey:N.ctrlKey,keyCode:N.keyCode},R=O&&O.copy;if(R){R=!apf.isFalse((O.ccopy||O.compile("copy"))(K[0],M));}else{if(typeof this.dragcopy=="boolean"||typeof this.dropcopy=="boolean"){if(this.dropcopy){R=this.dropcopy;}else{if(this.dragcopy){R=N.ctrlKey;}else{var I=this.$attrBindings&&this.$attrBindings.dragcopy;if(I){R=!apf.isFalse((I.cvalue2||I.compile("value",{withopt:true}))(K[0],M));}}}}}if(!R){for(var T=0,J=E.length;T<J;T++){R=typeof E[T]=="object"&&E[T].copy?!apf.isFalse((E[T].ccopy||E[T].compile("copy"))(K[0],M)):N.ctrlKey;if(R){break;}}}var P,a=R?"copy":"move",F=O?O.getAttribute("parent"):null;switch(l){case"list-append":i=(Q?i:this.getTraverseParent(i));if(F){if(i.selectSingleNode(F)){i=i.selectSingleNode(F);}else{i.appendChild(i.ownerDocument.createElement(F));i=i.selectSingleNode(F);}}P=this[a](K,i);break;case"insert-before":P=Q?this[a](K,i):this[a](K,i.parentNode,i);break;case"tree-append":if(F){if(i.selectSingleNode(F)){i=i.selectSingleNode(F);}else{i.appendChild(i.ownerDocument.createElement(F));i=i.selectSingleNode(F);}}P=this[a](K,i);break;}if(this.selectable&&P){this.selectList(P);this.setCaret(P[0]);this.focus();}return P;};this.enableDragDrop=function(){this.icoAllowed="";this.icoDenied="";this.$ext.dragdrop=false;var a=this;this.$ext[apf.isIphone?"ontouchstart":"onmousedown"]=function(A){A=A||window.event;if(apf.isIphone){if(A.touches.length==1){return;}var q=A;A=A.touches[0];var z=apf.getAbsolutePosition(A.target,this);A.offsetX=z[0];A.offsetY=z[1];}var s,u=A.originalTarget||A.srcElement||A.target,w=a.hasFeature(apf.__MULTISELECT__);if(w&&u==a.$int){return;}a.dragging=0;if(!apf.isIphone&&a.allowdeselect&&(u==this||u.getAttribute(apf.xmldb.htmlIdTag))){return a.clearSelection();}if(a.$findValueNode){s=a.$findValueNode(u);}var t=(s?apf.xmldb.getNode(s):apf.xmldb.findXmlNode(u));if(w&&(!a.selected||!t||t==a.xmlRoot)){return;}if(a.isDragAllowed(w?a.$getSelection():t)){if(apf.isIphone){q.preventDefault();}apf.DragServer.start(a,u,A);}};this.$ext[apf.isIphone?"ontouchmove":"onmousemove"]=function(i){if(this.host.dragging!=1){return;}};if(apf.isIphone){this.$ext.ontouchend=this.$ext.ontouchcancel=function(){this.host.dragging=0;};}else{this.$ext.onmouseup=function(){this.host.dragging=0;};this.$ext.ondragcopy=this.$ext.ondragstart=function(){return false;};}if(document.elementFromPointAdd){document.elementFromPointAdd(this.$ext);}if(this.$initDragDrop&&!this.$dragInited){this.$initDragDrop();this.$dragInited=2;}else{this.$dragInited=true;}};function c(){this.$dragInited=false;if(apf.isIphone){this.$ext.ontouchstart=this.$ext.ontouchmove=this.$ext.ontouchend=this.$ext.ontouchcancel=null;}else{this.$ext.onmousedown=this.$ext.onmousemove=this.$ext.onmouseup=null;}if(document.elementFromPointRemove){document.elementFromPointRemove(this.$ext);}}this.implement(this.hasFeature(apf.__MULTISELECT__)?apf.MultiselectDragDrop:apf.StandardDragDrop);this.$supportedProperties.push("drop","drag","dragcopy");this.$propHandlers.dragcopy=this.$propHandlers.dropcopy=this.$propHandlers.drag=this.$propHandlers.drop=function(i,a){this[a]=apf.isTrue(i);if(this.$dragInited&&a=="drag"&&i&&this.$dragInited!=2){this.$initDragDrop();this.$dragInited=2;return;}if(a=="dragcopy"||a=="dropcopy"){return;}if(!i&&!this.drag&&!this.drop&&!this.$bindings&&(this.$attrBindings&&(!this.$attrBindings.drag||!this.$attrBindings.drop))){c.call(this);}else{if(i&&!this.$dragInited){this.enableDragDrop();}}};this.addEventListener("DOMNodeRemovedFromDocument",function(a){c.call(this);if(this.oDrag){apf.destroyHtmlNode(this.oDrag);this.oDrag=null;}});};apf.GuiElement.propHandlers.dragcopy=apf.GuiElement.propHandlers.dropcopy=apf.GuiElement.propHandlers.drop=apf.GuiElement.propHandlers.drag=function(d,i){if(!apf.isFalse(d)){if(!this.hasFeature(apf.__DRAGDROP__)){this.implement(apf.DragDrop);this.enableDragDrop();}this[i]=apf.isTrue(d);}};apf.DragServer={Init:function(){if(apf.isIphone){this.ontouchmove=this.onmousemove;this.ontouchend=this.ontouchcancel=this.onmouseup;}apf.addEventListener("hotkey",function(c){if(apf.window.dragging&&c.keyCode==27){if(document.body.lastHost&&document.body.lastHost.dragOut){document.body.lastHost.dragOut(apf.dragHost);}return apf.DragServer.stopdrag();}});},start:function(B,F,z){if(document.elementFromPointReset){document.elementFromPointReset();}B.dragging=1;var d=window.document;d=(!d.compatMode||d.compatMode=="CSS1Compat")?d.html||d.documentElement:d.body;var I=(apf.isIE?d.scrollLeft:window.pageXOffset),J=(apf.isIE?d.scrollTop:window.pageYOffset),G=B.$ext.offsetParent,M;while(G&&G!=d&&G.tagName!="BODY"){I-=G.scrollLeft;J-=G.scrollTop;G=G.offsetParent;}var C=F,D;while(C&&C.nodeType==1&&!(D=C.getAttribute(apf.xmldb.htmlIdTag))){C=C.parentNode;}if(!D){return;}M=apf.getAbsolutePosition(C);apf.DragServer.coordinates={srcElement:F,doc:d,scrollX:I,scrollY:J,offsetX:z.clientX-M[0],offsetY:z.clientY-M[1],clientX:z.pageX?z.pageX-window.pageXOffset:z.clientX,clientY:z.pageY?z.pageY-window.pageYOffset:z.clientY};var K=B.hasFeature(apf.__MULTISELECT__)?B.getSelection():[B.xmlRoot],A=[],E=B.isDragAllowed(K,A);if(!E){return;}if(B.hasEventListener("dragdata")){A=B.dispatchEvent("dragdata",{data:A});}this.dragdata={rules:E,selection:K,data:A,indicator:B.$showDragIndicator(K,this.coordinates),host:B};if(B.dispatchEvent("dragstart",this.dragdata)===false){return false;}B.dragging=2;apf.dragMode=true;document.onmousemove=this.onmousemove;document.onmouseup=this.onmouseup;},stop:function(d,i){if(this.last){this.dragout();}this.dragdata.host.dragging=0;this.dragdata.host.$hideDragIndicator(i);apf.dragMode=false;document.onmousemove=document.onmouseup=null;this.dragdata=null;},dragover:function(q,u,s){s=s||window.event;var t;if(q.$findValueNode){t=q.$findValueNode(u);}if(this.lastFel&&this.lastFel==t||!this.lastFel&&this.last==q){return;}var n=(t?apf.xmldb.getNode(t):apf.xmldb.findXmlNode(u)),o=q.isDropAllowed&&q.xmlRoot?q.isDropAllowed(this.dragdata.data,n||q.xmlRoot):apf.isTrue(apf.getInheritedAttribute(q,"",function(a){if(a.drop){q=a;if(q==apf.DragServer.last){return false;}return true;}}));if(this.last&&this.last!=q){this.dragout(this.last);}if(!o){return;}if(q.dispatchEvent("dragover",this.dragdata)===false){o=false;}var w=s.originalTarget||s.srcElement||s.target;if(q&&q.$dragover){q.$dragover(u,this.dragdata,o);}this.last=q;this.lastFel=t;},dragout:function(c){this.lastFel=null;if(c){c.dispatchEvent("dragout",this.dragdata);}if(this.last&&this.last.$dragout){this.last.$dragout(null,this.dragdata);}this.last=null;},dragdrop:function(D,C,E,m){var o,F,z=(D.$findValueNode?apf.xmldb.getNode(D.$findValueNode(C)):apf.xmldb.findXmlNode(C)),B=(D.isDropAllowed&&D.xmlRoot)?D.isDropAllowed(this.dragdata.data,z||D.xmlRoot):false;if(this.dragdata.indicator){F=this.dragdata.indicator.style.top;this.dragdata.indicator.style.top="10000px";}if(!B){B=apf.isTrue(apf.getInheritedAttribute(D,"",function(a){if(a.drop){D=a;return true;}}));}if(B){if(D.dispatchEvent("dragdrop",apf.extend({candrop:B,htmlEvent:m,top:F},this.dragdata))===false){B=false;}else{if(!D.xmlRoot){var A=D.getModel?D.getModel(true):apf.nameserver.get("model",D.model);if(A){A.load(this.dragdata.data[0]);}return true;}else{var w=B[1]&&B[1].action||(D.$isTreeArch?"tree-append":"list-append");if(w=="list-append"&&(!D.$isTreeArch&&D==this.dragdata.host)){B=false;}}}}if(this.dragdata.indicator){this.dragdata.indicator.style.top=F;}if(!B){this.dragout(D);return false;}if(D.$dragDrop){var G=D.$dragDrop(B[0],this.dragdata.data,B[1],w,o||B[0]==D.xmlRoot,this.dragdata.rules,m);this.dragdata.resultNode=G;}if(D.$dragdrop){D.$dragdrop(C,apf.extend({htmlEvent:m,xmlNode:G},this.dragdata),B);}this.last=null;this.lastFel=null;return true;},onmousemove:function(o){if(!apf.DragServer.dragdata){return;}o=o||window.event;if(apf.isIphone){o.preventDefault();if(!o.touches){return apf.DragServer.stop(true);}o=o.touches[0];}var t=apf.DragServer.dragdata,c={clientX:o.pageX?o.pageX-window.pageXOffset:o.clientX,clientY:o.pageY?o.pageY-window.pageYOffset:o.clientY};if(!t.started&&Math.abs(apf.DragServer.coordinates.clientX-c.clientX)<6&&Math.abs(apf.DragServer.coordinates.clientY-c.clientY)<6){return;}if(!t.started){if(t.host.$dragstart){t.host.$dragstart(null,t);}t.started=true;}var n=t.indicator.style.top;t.indicator.style.display="block";if(t.indicator){t.indicator.style.top="10000px";}apf.DragServer.dragdata.x=o.pageX?o.pageX-(apf.isGecko?window.pageXOffset:0):c.clientX;apf.DragServer.dragdata.y=o.pageY?o.pageY-(apf.isGecko?window.pageYOffset:0):c.clientY;var s=document.elementFromPoint(apf.DragServer.dragdata.x,apf.DragServer.dragdata.y);t.indicator.style.top=n;t.host.$moveDragIndicator(c);var q=apf.findHost(s);if(q){apf.DragServer.dragover(q,s,o);}else{if(apf.DragServer.last){apf.DragServer.dragout(apf.DragServer.last);}}apf.DragServer.lastTime=new Date().getTime();},onmouseup:function(q){q=q||window.event;if(apf.isIphone){q.preventDefault();if(!q.changedTouches){return apf.DragServer.stop(true);}q=q.changedTouches[0];}var w={clientX:q.pageX?q.pageX-window.pageXOffset:q.clientX,clientY:q.pageY?q.pageY-window.pageYOffset:q.clientY};if(!apf.DragServer.dragdata.started&&Math.abs(apf.DragServer.coordinates.clientX-w.clientX)<6&&Math.abs(apf.DragServer.coordinates.clientY-w.clientY)<6){apf.DragServer.stop(true);return;}var u=apf.DragServer.dragdata.indicator,o=u.style.top;if(u){u.style.top="10000px";}apf.DragServer.dragdata.x=q.pageX?q.pageX-(apf.isGecko?window.pageXOffset:0):w.clientX;apf.DragServer.dragdata.y=q.pageY?q.pageY-(apf.isGecko?window.pageYOffset:0):w.clientY;var t=document.elementFromPoint(apf.DragServer.dragdata.x,apf.DragServer.dragdata.y);u.style.top=o;var s=apf.findHost(t);if(apf.DragServer.host&&s!=apf.DragServer.host){apf.DragServer.dragout(apf.DragServer.host);}var c=apf.DragServer.dragdrop(s,t,apf.DragServer.dragdata.host,q);apf.DragServer.stop(true,c);}};apf.MultiselectDragDrop=function(){this.diffX=this.diffY=0;this.multiple=false;this.lastDragNode=null;this.lastel=null;this.$showDragIndicator=function(s,w){this.multiple=s.length>1;if(this.multiple){this.diffX=w.scrollX;this.diffY=w.scrollY;}else{this.diffX=-1*w.offsetX;this.diffY=-1*w.offsetY;}var t=this.oDrag.className.split(" ")[0];this.$setStyleClass(this.oDrag,this.multiple?t+"_multiple":"",[t+"_multiple"]);if(this.multiple){document.body.appendChild(this.oDrag);return this.oDrag;}else{if(this.localName=="datagrid"){if(this.lastDragNode){apf.destroyHtmlNode(this.lastDragNode);}s=this.$selected||this.$caret;var i=s.cloneNode(true);i.removeAttribute("onmousedown");i.onmousedown=null;i.removeAttribute("onmouseup");i.onmouseup=null;i.removeAttribute("onmouseout");i.onmouseout=null;i.removeAttribute("ondblclick");i.ondblclick=null;document.body.appendChild(i);i.style.position="absolute";i.style.width=s.offsetWidth+"px";i.style.display="none";i.style.zIndex=10000000;i.removeAttribute("id");this.$setStyleClass(i,"draggrid");var q=s.childNodes;var o=i.childNodes;for(var u=q.length-1;u>=0;u--){if(o[u].nodeType==1){o[u].style.width=apf.getStyle(q[u],"width");}}return(this.lastDragNode=i);}else{this.$updateNode(this.selected,this.oDrag);}}return this.oDrag;};this.$hideDragIndicator=function(m){var n=this.lastDragNode||this.oDrag,j=this;if(!this.multiple&&!m&&n.style.display=="block"){var l=apf.getAbsolutePosition(this.$selected||this.$caret);apf.tween.multi(n,{anim:apf.tween.EASEIN,steps:15,interval:10,tweens:[{type:"left",from:n.offsetLeft,to:l[0]},{type:"top",from:n.offsetTop,to:l[1]}],onfinish:function(){if(j.lastDragNode){apf.destroyHtmlNode(j.lastDragNode);j.lastDragNode=null;}else{j.oDrag.style.display="none";}}});}else{if(this.lastDragNode){apf.destroyHtmlNode(this.lastDragNode);this.lastDragNode=null;}else{this.oDrag.style.display="none";}}};this.$moveDragIndicator=function(i){var d=this.lastDragNode||this.oDrag;d.style.left=(i.clientX+this.diffX)+"px";d.style.top=(i.clientY+this.diffY+(this.multiple?15:0))+"px";};this.$initDragDrop=function(){if(!this.$hasLayoutNode("dragindicator")){return;}this.oDrag=apf.insertHtmlNode(this.$getLayoutNode("dragindicator"),document.body);this.oDrag.style.zIndex=1000000;this.oDrag.style.position="absolute";this.oDrag.style.cursor="default";this.oDrag.style.display="none";};this.$findValueNode=function(c){if(!c){return null;}while(c&&c.nodeType==1&&!c.getAttribute(apf.xmldb.htmlIdTag)){if(this.$isTreeArch&&c.previousSibling&&c.previousSibling.nodeType==1){c=c.previousSibling;}else{c=c.parentNode;}}return(c&&c.nodeType==1&&c.getAttribute(apf.xmldb.htmlIdTag))?c:null;};this.$dragout=function(i,t,l){if(this.lastel){this.$setStyleClass(this.lastel,"",["dragDenied","dragInsert","dragAppend","selected","indicate"]);}var s=this.$getSelection(true);for(var o=0,q=s.length;o<q;o++){this.$setStyleClass(s[o],"selected",["dragDenied","dragInsert","dragAppend","indicate"]);}this.$setStyleClass(this.$ext,"",[this.$baseCSSname+"Drop"]);this.lastel=null;};if(!this.$dragdrop){this.$dragdrop=this.$dragout;}this.$dragover=function(i,A,l){this.$setStyleClass(this.$ext,this.$baseCSSname+"Drop");var t=this.$getSelection(true);for(var s=0,w=t.length;s<w;s++){this.$setStyleClass(t[s],"",["dragDenied","dragInsert","dragAppend","selected","indicate"]);}if(this.lastel){this.$setStyleClass(this.lastel,"",["dragDenied","dragInsert","dragAppend","selected","indicate"]);}var u=l[1]&&l[1].action;this.lastel=this.$findValueNode(i);if(this.$isTreeArch&&u=="list-append"){var z=apf.xmldb.findHtmlNode(this.getTraverseParent(apf.xmldb.getNode(this.lastel)),this);this.lastel=z?this.$getLayoutNode("item","container",z):this.$int;this.$setStyleClass(this.lastel,"dragInsert");}else{this.$setStyleClass(this.lastel,l?(u=="insert-before"?"dragInsert":"dragAppend"):"dragDenied");}};};apf.StandardDragDrop=function(){this.$showDragIndicator=function(o,n){var l=n.offsetX+22,m=n.offsetY;this.oDrag.startX=l;this.oDrag.startY=m;document.body.appendChild(this.oDrag);var q=this.$getLayoutNode("main","caption",this.oDrag);if(q.nodeType!=1){q=q.parentNode;}q.innerHTML=this.$applyBindRule("caption",this.xmlRoot)||"";return this.oDrag;};this.$hideDragIndicator=function(){this.oDrag.style.display="none";};this.$moveDragIndicator=function(c){this.oDrag.style.left=(c.clientX-this.oDrag.startX+document.documentElement.scrollLeft)+"px";this.oDrag.style.top=(c.clientY-this.oDrag.startY+document.documentElement.scrollTop)+"px";};this.$initDragDrop=function(){if(!this.getAttribute("drag")){return;}this.oDrag=document.body.appendChild(this.$ext.cloneNode(true));this.oDrag.style.zIndex=1000000;this.oDrag.style.position="absolute";this.oDrag.style.cursor="default";this.oDrag.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=50)";this.oDrag.style.MozOpacity=0.5;this.oDrag.style.opacity=0.5;this.oDrag.style.display="none";};};apf.DragServer.Init();apf.__MULTICHECK__=1<<22;apf.MultiCheck=function(){this.$regbase=this.$regbase|apf.__MULTICHECK__;this.multicheck=true;this.checklength=0;this.checkedList=[];this.check=function(n){if(this.disabled||this.checkedList.indexOf(n)>-1){return;}if(this.dispatchEvent("beforecheck",{xmlNode:n})===false){return false;}if(!this.multicheck&&this.checkedList.length){this.clearChecked(true);}this.checkedList.push(n);if(this.$isTreeArch){var m=n.selectNodes(".//"+this.each.split("|").join("|.//"));this.checkList(m,null,true,true);var i,o=this.getTraverseParent(n);while(o&&o!=this.xmlRoot){m=this.getTraverseNodes(o);i=true;for(var q=0;q<m.length;q++){if(this.checkedList.indexOf(m[q])==-1){i=false;break;}}apf.setStyleClass(apf.xmldb.getHtmlNode(o,this),i?"checked":"partial",["partial","checked"]);if(i){this.checkedList.push(o);}o=this.getTraverseParent(o);}}this.$setStyleClass(apf.xmldb.getHtmlNode(n,this),"checked",["partial"]);this.dispatchEvent("aftercheck",{list:this.checkedList,xmlNode:n});};this.uncheck=function(c){if(this.disabled||this.checkedList.indexOf(c)==-1){return;}if(this.$isTreeArch){return this.checkList([c],true,true);}if(this.dispatchEvent("beforeuncheck",{xmlNode:c})===false){return false;}this.checkedList.remove(c);this.$setStyleClass(apf.xmldb.getHtmlNode(c,this),"",["checked","partial"]);this.dispatchEvent("afteruncheck",{list:this.checkedList,xmlNode:c});};this.checkToggle=function(i){if(i.style){var l=i,j=l.getAttribute(apf.xmldb.htmlIdTag);while(!j&&l.parentNode){j=(l=l.parentNode).getAttribute(apf.xmldb.htmlIdTag);}i=apf.xmldb.getNode(l);}if(this.checkedList.indexOf(i)>-1){this.uncheck(i);}else{this.check(i);}};this.checkList=function(w,t,u,q){if(!w.indexOf){w=apf.getArrayFromNodelist(w);}if(this.disabled){return;}if(!q&&this.dispatchEvent("beforecheck",{list:w})===false){return false;}if(!t&&!u){this.clearChecked(true);}if(!this.multicheck){w=[w[0]];}var s;if(t){for(s=w.length-1;s>=0;s--){this.checkedList.remove(w[s]);this.$setStyleClass(apf.xmldb.getHtmlNode(w[s],this),"",["checked"]);}}else{for(s=w.length-1;s>=0;s--){this.checkedList.push(w[s]);this.$setStyleClass(apf.xmldb.getHtmlNode(w[s],this),"checked");}}if(!q&&this.$isTreeArch){var o=this;function i(a,j){var c=o.getTraverseNodes(a);if(!c.length){if(j){if(t){o.checkedList.remove(a);o.$setStyleClass(apf.xmldb.getHtmlNode(a,o),"",["checked"]);return 0;}else{if(o.checkedList.indexOf(a)==-1){o.checkedList.push(a);o.$setStyleClass(apf.xmldb.getHtmlNode(a,o),"checked");}return 1;}}return o.checkedList.indexOf(a)>-1?1:0;}var E=o.checkedList.indexOf(a)!=-1,F=j||w.indexOf(a)>-1&&(t?!E:E),d=true,l=true,m=false,D;for(var n=c.length-1;n>=0;n--){D=i(c[n],F);if(D){l=false;if(!m&&D==2){m=true;}}else{d=false;}if(!d&&!l){m=true;}}if(a==o.xmlRoot){return;}if(d){if(!E){o.checkedList.push(a);apf.setStyleClass(apf.xmldb.getHtmlNode(a,o),"checked",["partial"]);}}else{if(E){o.checkedList.remove(a);}apf.setStyleClass(apf.xmldb.getHtmlNode(a,o),m?"partial":"",["partial","checked"]);}return d?1:(l?0:2);}i(this.xmlRoot);}if(!q){this.dispatchEvent("aftercheck",{list:w});}};this.clearChecked=function(i){if(!i&&this.dispatchEvent("beforeuncheck",{xmlNode:this.checkedList})===false){return false;}for(var d=this.checkedList.length-1;d>=0;d--){this.$setStyleClass(apf.xmldb.getHtmlNode(this.checkedList[d],this),"",["checked"]);}this.checkedList.length=0;if(!i){this.dispatchEvent("afteruncheck",{list:this.checkedList});}};this.isChecked=function(c){return this.checkedList.indexOf(c)>-1;};this.getChecked=function(i){var l,j;if(i){j=this.xmlRoot?this.xmlRoot.ownerDocument.createDocumentFragment():apf.getXmlDom().createDocumentFragment();for(l=0;l<this.checkedList.length;l++){apf.xmldb.cleanNode(j.appendChild(this.checkedList[l].cloneNode(true)));}}else{for(j=[],l=0;l<this.checkedList.length;l++){j.push(this.checkedList[l]);}}return j;};this.checkAll=function(){if(!this.multicheck||this.disabled||!this.xmlRoot){return;}var c=this.$isTreeArch?this.xmlRoot.selectNodes(".//"+this.each.split("|").join("|.//")):this.getTraverseNodes();this.checkList(c);};this.addEventListener("aftercheck",function(){if(this.checklength!=this.checkedList.length){this.setProperty("checklength",this.checkedList.length);}});this.addEventListener("afteruncheck",function(){if(this.checklength!=this.checkedList.length){this.setProperty("checklength",this.checkedList.length);}});};apf.window=function(){this.$uniqueId=apf.all.push(this);this.apf=apf;this.toString=function(){return"[APF Component : "+(this.name||"")+" (apf.window)]";};this.getActionTracker=function(){return this.$at;};this.loadCodeFile=function(a){if(self[a]){apf.importClass(self[a],true,this.win);}else{apf.include(a);}};this.flash=function(){if(apf.window.hasFocus()||apf.isIphone){return;}if(apf.isDeskrun){G.Flash();}else{if(apf.isIE){if(!this.popup){this.popup=window.createPopup();}if(apf.window.stopFlash){return;}K+="x";function a(c){if(apf.window.hasFocus()){return;}window.focus();function d(){if(apf.window.hasFocus()){return;}this.popup.hide();this.popup.show(0,0,0,0,document.body);this.popup.document.write("<body><script>                        document.p = window.createPopup();                        document.p.show(0, 0, 0, 0, document.body);                        <\/script></body>");this.popup.document.focus();clearInterval(this.flashTimer);this.flashTimer=setInterval(function(){if(!apf.window.popup.isOpen||!apf.window.popup.document.p.isOpen){clearInterval(apf.window.flashTimer);if(!apf.window.hasFocus()){apf.window.popup.hide();document.body.focus();K="d";M();}}},10);}if(c){$setTimeout(function(){d.call(apf.window);},10);}else{d.call(apf.window);}}if("TEXTAREA|INPUT|SELECT".indexOf(document.activeElement.tagName)>-1){document.activeElement.blur();document.body.focus();apf.window.stopFlash=true;$setTimeout(function(){a.call(apf.window,true);apf.window.stopFlash=false;},10);}else{a.call(apf.window);}}}};this.show=function(){if(apf.isDeskrun){G.Show();}};this.hide=function(){if(apf.isDeskrun){G.Hide();}else{this.loaded=false;if(this.win){this.win.close();}}};this.focus=function(){if(apf.isDeskrun){G.SetFocus();}else{window.focus();}};this.setIcon=function(a){if(apf.isDeskrun){G.icon=parseInt(a)==a?parseInt(a):a;}};this.setTitle=function(a){this.title=a||"";if(apf.isDeskrun){G.caption=a;}else{document.title=(a||"");}};this.loadAml=function(a){if(a[apf.TAGNAME]=="deskrun"){this.loadDeskRun(a);}else{}};var G=apf.isDeskrun?window.external:null,T=apf.isDeskrun?G.shell:null;this.loadDeskRun=function(a){G.style=a.getAttribute("style")||"ismain|taskbar|btn-close|btn-max|btn-min|resizable";apf.config.drRegName=a.getAttribute("record");if(a.getAttribute("minwidth")){G.setMin(a.getAttribute("minwidth"),a.getAttribute("minheight"));}if(a.getAttribute("record")&&T.RegGet(apf.config.drRegName+"/window")){var c=T.RegGet(apf.config.drRegName+"/window");if(c){c=c.split(",");window.external.width=Math.max(a.getAttribute("minwidth"),Math.min(parseInt(c[2]),window.external.shell.GetSysValue("deskwidth")));window.external.height=Math.max(a.getAttribute("minheight"),Math.min(parseInt(c[3]),window.external.shell.GetSysValue("deskheight")));window.external.left=Math.max(0,Math.min(parseInt(c[0]),screen.width-window.external.width));window.external.top=Math.max(0,Math.min(parseInt(c[1]),screen.height-window.external.height));}}else{G.left=a.getAttribute("left")||200;G.top=a.getAttribute("top")||200;G.width=a.getAttribute("width")||800;G.height=a.getAttribute("height")||600;}G.caption=a.getAttribute("caption")||"DeskRun";G.icon=a.getAttribute("icon")||100;var i=$xmlns(a,"context",apf.ns.aml);if(i.length){i=i[0];if(!apf.config.tray){apf.config.tray=window.external.CreateWidget("trayicon");}var d=apf.config.tray;d.icon=a.getAttribute("tray")||100;d.tip=a.getAttribute("tooltip")||"DeskRun";d.PopupClear();d.PopupItemAdd("Exit",3);d.PopupItemAdd("SEP",function(){});var l=i.childNodes;for(var j=l.length-1;j>=0;j--){if(l[j].nodeType!=1){continue;}if(l[j][apf.TAGNAME]=="divider"){d.PopupItemAdd("SEP",function(){});}else{d.PopupItemAdd(apf.queryValue(l[j],"."),l[j].getAttribute("href")?new Function("window.open('"+l[j].getAttribute("href")+"')"):new Function(l[j].getAttribute("onclick")));}}}G.shell.debug=apf.debug?7:0;G.Show();G.SetFocus();};this.$tabList=[];this.$addFocus=function(i,d,j){if(!j){i.addEventListener("DOMNodeInserted",D);i.addEventListener("DOMNodeRemoved",C);if(i.$isWindowContainer>-2){i.addEventListener("focus",N);i.addEventListener("blur",N);i.$focusParent=i;if(i.$isWindowContainer>-1){if(!i.$tabList){i.$tabList=[i];}this.$tabList.push(i);return;}else{i.$tabList=[i];}}}var c=Q(i),a=c.$tabList;if(!i.$isWindowContainer){i.$focusParent=c;}if(a[d]){a.insertIndex(i,d);}else{a.push(i);}};this.$removeFocus=function(a){if(!a.$focusParent){return;}a.$focusParent.$tabList.remove(a);if(!a.$isWindowContainer){a.removeEventListener("DOMNodeInserted",D);a.removeEventListener("DOMNodeRemoved",C);}if(a.$isWindowContainer>-2){a.removeEventListener("focus",N);a.removeEventListener("blur",N);}};var O;this.$focus=function(d,a,c){var i=this.document.activeElement;if(i==d&&!c){return;}this.$settingFocus=d;if(!a){a={};}if(i&&i!=d&&O!=i){O=i;a.toElement=d;a.fromElement=i;i.blur(true,a);if(O!=i){return false;}}(apf.activeElement=this.document.activeElement=d).focus(true,a);this.$settingFocus=null;apf.dispatchEvent("movefocus",{toElement:d});if(typeof apf.offline!="undefined"&&apf.offline.state.enabled&&apf.offline.state.realtime){apf.offline.state.set(this,"focus",d.name||d.$uniqueId);}};this.$blur=function(a){var c=this.document.activeElement;if(c!=a){return false;}c.$focusParent.$lastFocussed=null;apf.activeElement=this.document.activeElement=null;apf.dispatchEvent("movefocus",{fromElement:a});};var E;this.$focusDefault=function(d,a){var c=Q(d);this.$focusLast(c,a);};this.$focusRoot=function(c){var a=apf.document.documentElement;if(this.$focusLast(a,c)===false){}};this.$focusLast=function(j,a,l){var m=j.$lastFocussed;if(m&&m.parentNode&&m.$focussable===true&&(l||m.$ext.offsetHeight)){this.$focus(m,a,true);}else{var i,c=j,d;while(c){if(!d&&c.focussable!==false&&c.$focussable===true&&!c.$tabList&&(l||c.$ext.offsetHeight)&&!c.disabled){this.$focus(c,a,true);break;}if((i=!d&&c.firstChild||!(d=false)&&c.nextSibling)){c=i;if(c.$isWindowContainer>0){d=true;}}else{if(c==j){if(c.$isWindowContainer){this.$focus(c,a,true);}return;}else{do{c=c.parentNode;}while(c&&!c.nextSibling&&c!=j&&!c.$isWindowContainer);if(c==j){return;}if(c){if(c.$isWindowContainer){this.$focus(c,a,true);break;}c=c.nextSibling;}}}}if(!c){this.$focus(apf.document.documentElement);}}};function N(a){if(a.name=="blur"){if(a.srcElement!=this&&this.$blur){this.$blur();}return;}if(a.srcElement!=this&&this.$focus){this.$focus();}if(a.srcElement==this||a.trackedChild){a.trackedChild=true;return;}this.$lastFocussed=a.srcElement;if(this.localName.indexOf("window")>-1){a.trackedChild=true;}}function Q(c){var a=c;do{a=a.parentNode;}while(a&&!a.$isWindowContainer);return a||apf.document.documentElement;}function D(a){if(a&&a.currentTarget!=this){return;}if(this.$isWindowContainer){apf.window.$tabList.pushUnique(this);}else{apf.window.$addFocus(this,this.tabindex,true);}}function C(a){if(a&&a.currentTarget!=this){return;}if(this.$isWindowContainer){apf.window.$tabList.remove(this);return;}if(!this.$focusParent){return;}this.$focusParent.$tabList.remove(this);}this.hasFocus=function(a){return this.document.activeElement==a;};this.moveNext=function(i,s,d,j){if(d&&apf.document.activeElement){var a=apf.document.activeElement.$focusParent;if(a.visible&&a.modal){return false;}}var o,c,m,q=s||apf.document.activeElement,n=q?(d&&q.$isWindowContainer>0?apf.window:q.$focusParent):apf.document.documentElement,l=n.$tabList;if(q&&(d||q!=apf.document.documentElement)){c=(l||[]).indexOf(q);if(c==-1){return;}}else{c=-1;}if(this.document.activeElement&&this.document.activeElement==q&&l.length==1||l.length==0){return false;}o=(i?-1:1);m=c;if(c<0){c=0;}do{m+=o;if(m>=l.length){m=0;}else{if(m<0){m=l.length-1;}}if(c==m&&q){return false;}q=l[m];}while(!q||q.disabled||q==apf.document.activeElement||(d?!q.visible:q.$ext&&!q.$ext.offsetHeight)||q.focussable===false||d&&!q.$tabList.length);if(n==apf.window){this.$focusLast(q,{mouse:true},d);}else{(j||(j={})).shiftKey=i;this.$focus(q,j);}};this.focusDefault=function(){if(typeof apf.offline!="undefined"&&apf.offline.state.enabled){var c,a=apf.offline.state.get(this,"focus");if(a==-1){return this.$focusRoot();}if(a){c=self[a]||apf.lookup(a);}if(c){if(!c.$focussable){apf.offline.clear();apf.offline.reboot();}else{this.$focus(c);return;}}}if(this.moveNext()===false){this.moveNext(null,apf.document.documentElement,true);}};apf.addListener(window,"beforeunload",function(){return apf.dispatchEvent("exit");});apf.addListener(window,"unload",function(){if(!apf){return;}apf.window.isExiting=true;apf.window.destroy();});var J,K="",R="";this.$focusfix=function(){if(apf.isIphone){return;}K+="a";clearTimeout(J);$setTimeout("window.focus();");J=$setTimeout(M);};this.$focusfix2=function(){if(apf.isIphone){return;}K+="b";clearTimeout(J);J=$setTimeout(M);};this.$blurfix=function(){if(apf.isIphone){return;}K+="c";clearTimeout(J);J=$setTimeout(M);};function M(){clearTimeout(J);if(K=="e"||K=="c"||K.charAt(0)=="x"&&!K.match(/eb$/)||K=="ce"||K=="de"){if(R!="blur"){R="blur";apf.window.dispatchEvent("blur");}}else{if(R!="focus"){R="focus";apf.window.dispatchEvent("focus");}}K="";J=null;}apf.addListener(window,"focus",this.$focusevent=function(){if(apf.isIphone){return apf.window.dispatchEvent("focus");}if(apf.hasFocusBug){K+="d";clearTimeout(J);J=$setTimeout(M);}else{clearTimeout(P);I.newState="focus";P=$setTimeout(I,10);}});apf.addListener(window,"blur",this.$blurevent=function(){if(!apf){return;}if(apf.isIphone){return apf.window.dispatchEvent("blur");}if(apf.hasFocusBug){K+="e";clearTimeout(J);J=$setTimeout(M);}else{clearTimeout(P);I.newState="blur";P=$setTimeout(I,10);}});var P;function I(){clearTimeout(P);var a=I.newState;if(R==a){return;}R=a;apf.dispatchEvent(R);}this.hasFocus=function(){return(R=="focus");};apf.addListener(document,"contextmenu",function(c){if(!c){c=event;}var a,d,i=apf.findHost(c.srcElement||c.target)||apf.document.activeElement||apf.document&&apf.document.documentElement;if(i&&i.localName=="menu"){return false;}if(apf.contextMenuKeyboard){if(i){a=i.selected?apf.getAbsolutePosition(i.$selected):apf.getAbsolutePosition(i.$ext||i.$pHtmlNode);}else{a=[0,0];}d={x:a[0]+10+document.documentElement.scrollLeft,y:a[1]+10+document.documentElement.scrollTop,htmlEvent:c};}else{if(c.htmlEvent){d=c;}else{d={x:c.clientX+document.documentElement.scrollLeft,y:c.clientY+document.documentElement.scrollTop,htmlEvent:c};}}d.bubbles=true;apf.contextMenuKeyboard=null;if((i||apf).dispatchEvent("contextmenu",d)===false||d.returnValue===false){if(c.preventDefault){c.preventDefault();}return false;}if(apf.config.disableRightClick){if(c.preventDefault){c.preventDefault();}return false;}});var F={INPUT:1,TEXTAREA:1,SELECT:1};apf.addListener(document,"mousedown",this.$mousedown=function(a){a=a||window.event;var c,i=apf.findHost(a.srcElement||a.target),j=i&&i.$editable||(i&&i.hasFeature(apf.__CONTENTEDITABLE__));if(apf.popup.last&&(!i||apf.popup.last!=i.$uniqueId)){apf.popup.forceHide();}if((!i||!i.$focussable||i.focussable===false)&&apf.config.allowBlur&&i.canHaveChildren!=2){E=null;if(apf.document.activeElement){apf.document.activeElement.blur();}}else{if(i){if((c=apf.document.activeElement&&apf.document.activeElement.$focusParent||E)&&c.visible&&c.modal&&i.$focusParent!=c){apf.window.$focusLast(c,{mouse:true});}else{if(!i&&apf.document.activeElement){apf.window.$focusRoot();}else{if(i.$isWindowContainer==-1){if(i.$tabList.length){apf.window.moveNext(null,i.$tabList[0],null,{mouse:true});}else{apf.window.$focus(i);}}else{if(!i.disabled&&i.focussable!==false){if(i.$focussable===apf.KEYBOARD_MOUSE){apf.window.$focus(i,{mouse:true});}else{if(i.canHaveChildren==2){if(!apf.config.allowBlur||!apf.document.activeElement||apf.document.activeElement.$focusParent!=i){apf.window.$focusLast(i,{mouse:true});}}else{apf.window.$focusDefault(i,{mouse:true});}}}else{apf.window.$focusDefault(i,{mouse:true});}}}}if(apf.hasFocusBug){var l=F[(a.srcElement||a.target).tagName]&&!(a.srcElement||a.target).disabled||(a.srcElement&&a.srcElement.isContentEditable)||i.$isContentEditable&&i.$isContentEditable(a)&&!i.disabled;if(!i||!l){apf.window.$focusfix();}}else{if(!R){apf.window.$focusevent();}}}}apf.dispatchEvent("mousedown",{htmlEvent:a,amlNode:i||apf.document.documentElement});var d=!(!apf.isIphone&&!apf.isIE&&(apf.document&&!apf.config.allowSelect&&(!apf.isParsingPartial||i)||apf.dragMode)&&!F[a.target.tagName]);if(d){i=apf.findHost(a.target);if(i){var l=F[(a.srcElement||a.target).tagName]&&!(a.srcElement||a.target).disabled||(a.srcElement&&a.srcElement.isContentEditable)||i.$isContentEditable&&i.$isContentEditable(a)&&!i.disabled;if(!l&&i.nodeType!=i.NODE_PROCESSING_INSTRUCTION&&!i.$allowSelect&&!i.getElementsByTagNameNS(apf.ns.xhtml,"*").length){d=false;}}}if(!d&&!j){if(a.preventDefault){a.preventDefault();}return false;}});apf.addListener(document,"selectstart",function(a){if(!a){a=event;}var c=!(apf.document&&!apf.config.allowSelect||apf.dragMode);if(c){var d=apf.findHost(a.srcElement);if(d&&d.nodeType!=d.NODE_PROCESSING_INSTRUCTION&&!d.$allowSelect&&!d.getElementsByTagNameNS(apf.ns.xhtml,"*").length){c=false;}}if(!c){a.returnValue=false;return false;}});apf.addListener(document,"keyup",this.$keyup=function(a){if(!a){a=event;}if(apf.document&&apf.document.activeElement&&!apf.document.activeElement.disableKeyboard&&apf.document.activeElement.dispatchEvent("keyup",{keyCode:a.keyCode,ctrlKey:a.ctrlKey,shiftKey:a.shiftKey,altKey:a.altkey,htmlEvent:a})===false){a.returnValue=false;return false;}apf.dispatchEvent("keyup",null,a);});function B(d){if(!d){d=event;}var a=null;if(d.wheelDelta){a=d.wheelDelta/120;if(apf.isOpera){a*=-1;}}else{if(d.detail){a=-d.detail/3;}}if(a!==null){if(apf.isIE){var j=d.srcElement||d.target;while(j&&j.scrollHeight<=j.offsetHeight){j=j.parentNode;}if(!j){return;}if(j.nodeType==9){j=j.documentElement;}if(j&&j.tagName=="BODY"&&"auto|scroll".indexOf(apf.getStyle(j,"overflowY"))==-1){j=document.documentElement;}if(j&&"auto|scroll".indexOf(apf.getStyle(j,"overflowY"))>-1){var m,c=0.35*j.offsetHeight*a;if(a<0){if(j&&j.scrollTop>=(m=j.scrollHeight-j.offsetHeight+apf.getVerBorders(j))+c){j.scrollTop=m;d.returnValue=false;}}else{if(j&&j.scrollTop<=c){j.scrollTop=0;d.returnValue=false;}}}}var i={delta:a,target:d.target||d.srcElement},l=apf.dispatchEvent("mousescroll",i);if(l===false||i.returnValue===false){if(d.preventDefault){d.preventDefault();}d.returnValue=false;}}}if(document.addEventListener){document.addEventListener("DOMMouseScroll",B,false);}window.onmousewheel=document.onmousewheel=B;apf.addListener(document,"keydown",this.$keydown=function(n){n=n||event;if(n.keyCode==93){apf.contextMenuKeyboard=true;}var o=apf.findHost(n.srcElement||n.target),i=F[(n.explicitOriginalTarget||n.srcElement||n.target).tagName]||(n.srcElement&&n.srcElement.isContentEditable)||(o&&o.hasFeature(apf.__CONTENTEDITABLE__));var a,c=apf.isMac?n.metaKey:n.ctrlKey;if(!i&&apf.config.undokeys&&c){if(n.keyCode==90){a=apf.document.activeElement;while(a&&!a.getActionTracker&&!a.$at){a=a.parentNode;}if(!a){a=apf.window;}(a.$at||a.getActionTracker()).undo();}else{if(n.keyCode==89){a=apf.document.activeElement;while(a&&!a.getActionTracker&&!a.$at){a=a.parentNode;}if(!a){a=apf.window;}(a.$at||a.getActionTracker()).redo();}}}var m={ctrlKey:n.ctrlKey,metaKey:n.metaKey,shiftKey:n.shiftKey,altKey:n.altKey,keyCode:n.keyCode,htmlEvent:n,bubbles:true};if(apf.dispatchEvent("hotkey",m)===false||m.returnValue===false){n.returnValue=false;n.cancelBubble=true;if(n.stopPropagation){n.stopPropagation();}if(apf.canDisableKeyCodes){try{n.keyCode=0;}catch(n){}}if(n.preventDefault){n.preventDefault();}return false;}var j=[];if(n.altKey){j.push("Alt");}if(n.ctrlKey){j.push("Ctrl");}if(n.shiftKey){j.push("Shift");}if(n.metaKey){j.push("Meta");}if(apf.keyNames[n.keyCode]){j.push(apf.keyNames[n.keyCode]);}if(j.length){if(n.keyCode>46){j.push(String.fromCharCode(n.keyCode));}apf.setProperty("hotkey",j.join("-"));}if(apf.document.activeElement&&!apf.document.activeElement.disableKeyboard&&apf.document.activeElement.dispatchEvent("keydown",m)===false){n.returnValue=false;n.cancelBubble=true;if(apf.canDisableKeyCodes){try{n.keyCode=0;}catch(n){}}if(n.preventDefault){n.preventDefault();}return false;}else{if((!apf.config.disableTabbing||apf.document.activeElement)&&n.keyCode==9){if(n.ctrlKey&&apf.document.activeElement){var l=apf.document.activeElement.$focusParent;if(l.modal){if(n.preventDefault){n.preventDefault();}return false;}apf.window.moveNext(n.shiftKey,apf.document.activeElement.$focusParent,true);l=apf.document.activeElement.$focusParent;if(l&&l.bringToFront){l.bringToFront();}}else{if(!apf.document.activeElement||apf.document.activeElement.tagName!="menu"){apf.window.moveNext(n.shiftKey);}}if(n.preventDefault){n.preventDefault();}return false;}}var d=apf.isMac?n.metaKey:n.altKey;if(apf.config.disableBackspace&&n.keyCode==8&&!i){if(apf.canDisableKeyCodes){try{n.keyCode=0;}catch(n){}}n.returnValue=false;}if(apf.config.disableF5&&(n.keyCode==116||n.keyCode==117)){if(apf.canDisableKeyCodes){try{n.keyCode=0;}catch(n){}}else{n.preventDefault();n.stopPropagation();}}if(n.keyCode==27){n.returnValue=false;}if(!apf.config.allowSelect&&n.shiftKey&&(n.keyCode>32&&n.keyCode<41)&&!i){n.returnValue=false;}if(n.returnValue===false&&n.preventDefault){n.preventDefault();}return n.returnValue;});apf.document={};this.init=function(a){if(apf.actiontracker){this.$at=new apf.actiontracker();this.$at.name="default";apf.nameserver.register("actiontracker","default",this.$at);}this.$domParser=new apf.DOMParser();this.document=apf.document=this.$domParser.parseFromString(a,"text/xml",{timeout:apf.config.initdelay,callback:function(c){if(apf.parsed!=2){var d=apf.parsed;apf.parsed=2;apf.dispatchEvent("parse",{initial:d});apf.parsed=true;}if(!apf.loaded){if(apf.isDeskrun){apf.window.deskrun.Show();}if(!apf.document.activeElement&&!apf.config.allowBlur){apf.window.focusDefault();}apf.loaded=true;$setTimeout(function(){apf.dispatchEvent("load");});}}});this.addEventListener("focus",function(c){if(!apf.document.activeElement&&E&&!apf.isIphone){if(E.$isWindowContainer==-1){if(E.$tabList.length){apf.window.moveNext(null,E.$tabList[0]);}else{apf.window.$focus(E);}}else{apf.window.$focusLast(E);}}});this.addEventListener("blur",function(c){if(!apf.document.activeElement||apf.isIphone){return;}apf.document.activeElement.blur(true,{srcElement:this});E=apf.document.activeElement.$focusParent;apf.activeElement=apf.document.activeElement=null;});};this.destroy=function(){this.$at=null;apf.unload(this);apf=this.win=this.window=this.document=null;window.onfocus=window.onerror=window.onunload=window.onbeforeunload=window.onbeforeprint=window.onafterprint=window.onmousewheel=window.onblur=null;document.oncontextmenu=document.onmousedown=document.onmousemove=document.onmouseup=document.onselectstart=document.onmousewheel=document.onkeyup=document.onkeydown=null;if(document.body){document.body.onmousedown=document.body.onmousemove=document.body.onmouseup=null;document.body.innerHTML="";}};};apf.window.prototype=new apf.Class().$init();apf.window=new apf.window();apf.sanitizeTextbox=function(c){c.onfocus=function(){if(apf.window){apf.window.$focusfix2();}};c.onblur=function(){if(apf.window){apf.window.$blurfix();}};};apf.runGecko=function(){if(apf.runNonIe){apf.runNonIe();}HTMLDocument.prototype.selectNodes=XMLDocument.prototype.selectNodes=function(s,w){try{var u=this.evaluate(s,(w||this),this.createNSResolver(this.documentElement),7,null);}catch(z){var t=z.message;if(z.code==z.INVALID_EXPRESSION_ERR){t=t.replace(/the expression/i,"'"+s+"'");}throw new i(z.lineNumber,"XPath error: "+t);}var c=new Array(u.snapshotLength);c.expr=s;for(var a=c.length-1;a>=0;a--){c[a]=u.snapshotItem(a);}return c;};Text.prototype.selectNodes=Element.prototype.selectNodes=function(a){return this.ownerDocument.selectNodes(a,this);};HTMLDocument.prototype.selectSingleNode=XMLDocument.prototype.selectSingleNode=function(c,l){var a=this.selectNodes(c+"[1]",l||null);return a[0]||null;};Text.prototype.selectSingleNode=Element.prototype.selectSingleNode=function(a){return this.ownerDocument.selectSingleNode(a,this);};var d=new XMLSerializer();apf.insertHtmlNodes=function(a,w,l){var o=document.createElement("div"),c=document.createDocumentFragment(),B=a.length-1,A,z;for(;B>=0;B--){z=a[B];c.insertBefore(z,c.firstChild);}o.innerHTML=apf.html_entity_decode(d.serializeToString(c)).replace(/<([^>]+)\/>/g,"<$1></$1>");c=document.createDocumentFragment();for(B=0,A=o.childNodes.length;B<A;B++){z=o.childNodes[0];c.appendChild(z);}if(l){w.insertBefore(c,l);}w.appendChild(c);};apf.insertHtmlNode=function(o,c,q,n){var a=document.createElement("div");if(!n){n=apf.html_entity_decode(o.serialize?o.serialize(true):((o.nodeType==3||o.nodeType==4||o.nodeType==2)?o.nodeValue:d.serializeToString(o)));}a.innerHTML=n.replace(/<([^>]+)\/>/g,"<$1></$1>");if(q){c.insertBefore(a.firstChild,q);}c.appendChild(a.firstChild);return q?q.previousSibling:c.lastChild;};function i(c,a){this.message=a;this.nr=c;}};apf.initGears=function(){var j,n;var l=apf.nameserver.get("google","gears");if(l){return l;}if(typeof GearsFactory!="undefined"){j=new GearsFactory();}else{if(apf.isIE){try{j=new ActiveXObject("Gears.Factory");}catch(m){}}else{if(navigator.mimeTypes["application/x-googlegears"]){j=document.createElement("object");j.setAttribute("type","application/x-googlegears");j.setAttribute("width",0);j.setAttribute("height",0);j.style.display="none";document.documentElement.appendChild(j);}}}if(!j){return null;}return apf.nameserver.register("google","gears",j);};apf.runIphone=function(){if(!apf.isIphone){return;}$setTimeout(function(){apf.importCssString('html, body {                margin: 0;                font-family: Helvetica;                background: #fff;                color: #000000;                overflow-x: hidden;                -webkit-user-select: none;                -webkit-text-size-adjust: none;                -webkit-touch-callout: none;            }            body > *:not(.toolbar) {                min-height: 372px;            }            body[orient="landscape"] > *:not(.toolbar) {                min-height: 268px;            }            body > *[selected="true"] {                display: block;            }',"screen");var d=document.getElementsByTagName("head")[0];if(apf.config.iphoneIcon){var c=document.createElement("link");c.setAttribute("rel","apple-touch-icon"+(apf.config.iphoneIconIsGlossy?"":"-precomposed"));c.setAttribute("href","apf.config.iphoneIcon");d.appendChild(c);}function a(l,j){var i=document.createElement("meta");i.setAttribute("name",l);i.setAttribute("content",j);d.appendChild(i);}if(apf.config.iphoneFixedViewport){a("viewport","width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;");}if(apf.config.iphoneFullScreen){a("apple-mobile-web-app-capable","yes");if(apf.config.iphoneStatusBar){a("apple-mobile-web-app-status-bar-style","apf.config.iphoneStatusBar");}}});var s=false,w=0,q="portrait",u="landscape",t=null;apf.addDomLoadEvent(function(){$setTimeout(z,0);t=setInterval(z,300);});function A(){switch(window.orientation){case 0:o(q);break;case 90:case -90:o(u);break;}}if(typeof window.onorientationchange=="object"){window.onorientationchange=A;s=true;$setTimeout(A,0);}function z(){if(!s){if(window.innerWidth!=w){w=window.innerWidth;var a=w==320?q:u;o(a);}}}function o(a){document.body.setAttribute("orient",a);$setTimeout("scrollTo(0,1)",100);}["gesturestart","gesturechange","gestureend","orientationchange"].forEach(function(a){document["on"+a]=function(c){if(apf.dispatchEvent){apf.dispatchEvent(a,c);}};});apf.iphone={titleNode:null,linkEvents:function(a,c){return;a[c?"onclick":"ontouchstart"]=function(j){if(!j.touches||j.touches.length!=1){return;}var i=j.touches[0];if(typeof this.onmousedown=="function"){this.onmousedown(i);if(this!=document){return false;}}};a.ontouchmove=function(j){if(!j.touches||j.touches.length!=1){return;}var i=j.touches[0];if(typeof this.onmousemove=="function"){this.onmousemove(i);if(this!=document){return false;}}};var d=false;a.ontouchend=a.ontouchcancel=function(j){if(d){return;}var i=j.touches&&j.touches.length?j.touches[0]:j.changedTouches[0];if(!i){return;}d=true;$setTimeout(function(){d=false;});if(typeof this.onmouseup=="function"){this.onmouseup(i);if(this!=document){return false;}}};return this;},nav:{sections:null,active:null,def:"home",divideChar:"/",levelTwoChar:"-",go:function(l,n){var m,c,j=apf.iphone.nav;j.update();if(!(c=j.sections[l.page])){return;}scrollTo(0,1);apf.dispatchEvent("pagechange",l);var a=c.getAttribute("title");if(apf.iphone.titleNode&&a){apf.iphone.titleNode.innerHTML=a;}if(n){for(m in j.sections){j.sections[m].hide();}c.show();}else{for(m in j.sections){if(!j.sections[m].visible||m==l.page){continue;}var d=j.sections[m];d.setProperty("zindex",0);apf.tween.single(d.$ext,{steps:5,interval:10,from:d.$ext.offsetLeft,to:(l.index<0)?1000:-1000,type:"left",anim:apf.tween.EASEOUT,onfinish:function(){d.setProperty("visible",false);}});}var D=10,E=c.$ext,i=(l.index<0)?-(E.offsetWidth)-D:window.innerWidth+E.offsetLeft+D;c.setProperty("visible",true);c.setProperty("zindex",apf.all.length+1);apf.tween.single(E,{steps:5,interval:10,from:i,to:0,type:"left",anim:apf.tween.EASEIN});}},update:function(a){if(this.sections&&!a){return;}this.sections={};for(var c in window){if(window[c]&&window[c]["tagName"]&&window[c].tagName=="section"){this.sections[c]=window[c];}}}}};$setTimeout(function(){apf.addEventListener("hashchange",apf.iphone.nav.go);if(location.href.match(/#(.*)$/)){apf.history.init(decodeURI(RegExp.$1));}else{if(apf._GET.page){apf.history.init(apf._GET.page);}else{apf.history.init();}}});document.ontouchstart=function(i){if(!i.touches||i.touches.length!=1){return;}var a=i.touches[0],c=a.target,d=apf.findHost(a.target);if(!d){return;}while(typeof c.onmousedown!="function"&&c!=document.body){c=c.parentNode;}if(typeof c.onmousedown=="function"){if(typeof c.onmouseover=="function"){c.onmouseover(a);}else{if(typeof c.onmousemove=="function"){c.onmousemove(a);}}c.onmousedown(a);return false;}};document.ontouchmove=function(i){if(!i.touches||i.touches.length!=1){return;}var a=i.touches[0],c=a.target,d=apf.findHost(a.target);if(!d){return;}while(typeof c.onmousemove!="function"&&c!=document.body){c=c.parentNode;}if(typeof c.onmousemove=="function"){c.onmousemove(a);return false;}else{if(typeof document.onmousemove=="function"){return document.onmousemove(a);}}};document.ontouchend=document.ontouchcancel=function(i){var a=i.touches&&i.touches.length?i.touches[0]:i.changedTouches[0];if(!a){return;}var c=a.target,d=apf.findHost(a.target);if(!d){return;}while(typeof c.onmouseup!="function"&&c!=document.body){c=c.parentNode;}if(typeof c.onmouseup=="function"){if(typeof c.onmouseout=="function"){c.onmouseout(a);}c.onmouseup(a,true);return false;}else{if(typeof document.onmouseup=="function"){return document.onmouseup(a);}}};};apf.runIE=function(){var i=false,j=false;if(self.XMLHttpRequest){try{new XMLHttpRequest();}catch(l){i=true;}}try{new ActiveXObject("microsoft.XMLHTTP");}catch(l){j=true;}if(j){apf.importClass(runTpIframe,true,self);}apf.getHttpReq=j?function(){if(apf.availHTTP.length){return apf.availHTTP.pop();}return new XMLHttpRequest();}:function(){if(apf.availHTTP.length){return apf.availHTTP.pop();}return new ActiveXObject("microsoft.XMLHTTP");};apf.getXmlDom=j?function(a,d){var c=getDOMParser(a,d);return c;}:function(a,o,c){var d=new ActiveXObject("microsoft.XMLDOM");d.setProperty("SelectionLanguage","XPath");if(c){d.preserveWhiteSpace=true;}if(a){if(apf.cantParseXmlDefinition){a=a.replace(/\] \]/g,"] ]").replace(/^<\?[^>]*\?>/,"");}d.loadXML(a);if(d.parseError!=0&&apf.xmldb&&apf.isJson(a)){try{d=apf.json2Xml(a,o);}catch(q){throw new Error(apf.formatErrorString(1051,null,"JSON to XML conversion error occurred."+q.message,"\nSource Text : "+a.replace(/\t/gi," ")));}}else{if(!o){this.xmlParseError(d);}}}return d;};apf.xmlParseError=function(a){var c=a.parseError;if(c!=0){throw new Error(apf.formatErrorString(1050,null,"XML Parse error on line "+c.line,c.reason+"Source Text:\n"+c.srcText.replace(/\t/gi," ")));}return a;};apf.getStyle=function(c,a){return c.currentStyle[a];};apf.insertHtmlNodes=function(B,z,C){for(var d=[],A=0,a=B.length;A<a;A++){d[A]=B[A].xml;}d=apf.html_entity_decode(d.join(""));if(apf.isIE<7){d=d.replace(/style="background-image:([^"]*)"/g,"find='$1' style='background-image:$1'");}try{(C||z).insertAdjacentHTML(C?"beforebegin":"beforeend",d);}catch(w){document.body.insertAdjacentHTML("beforeend","<table><tr>"+d+"</tr></table>");var c=document.body.lastChild.firstChild.firstChild;for(A=c.childNodes.length-1;A>=0;A--){z.appendChild(c.childNodes[apf.hasDynamicItemList?0:A]);}}if(apf.isIE<7){$setTimeout(function(){var o=z.getElementsByTagName("*");for(var q,m=0,n=o.length;m<n;m++){if(q=o[m].getAttribute("find")){o[m].style.backgroundImage=q.trim();}}});}};apf.insertHtmlNode=function(c,a,q,s){if(a.nodeType!=11&&!a.style){return a.appendChild(c);}var d=q||a;if(!s){s=apf.html_entity_decode(c.serialize?c.serialize(true):c.xml||c.outerHTML||c.nodeValue);}try{d.insertAdjacentHTML(q?"beforeBegin":"beforeEnd",s);}catch(t){d.insertAdjacentHTML("afterEnd",s);return d.nextSibling;}return q?q.previousSibling:a.lastChild;};apf.getHorBorders=function(a){return Math.max(0,(parseInt(a.currentStyle.borderLeftWidth)||0)+(parseInt(a.currentStyle.borderRightWidth)||0));};apf.getVerBorders=function(a){return Math.max(0,(parseInt(a.currentStyle.borderTopWidth)||0)+(parseInt(a.currentStyle.borderBottomWidth)||0));};apf.getWidthDiff=function(a){return Math.max(0,(parseInt(a.currentStyle.paddingLeft)||0)+(parseInt(a.currentStyle.paddingRight)||0)+(parseInt(a.currentStyle.borderLeftWidth)||0)+(parseInt(a.currentStyle.borderRightWidth)||0));};apf.getHeightDiff=function(a){return Math.max(0,(parseInt(a.currentStyle.paddingTop)||0)+(parseInt(a.currentStyle.paddingBottom)||0)+(parseInt(a.currentStyle.borderTopWidth)||0)+(parseInt(a.currentStyle.borderBottomWidth)||0));};apf.getDiff=function(a){return[Math.max(0,(parseInt(a.currentStyle.paddingLeft)||0)+(parseInt(a.currentStyle.paddingRight)||0)+(parseInt(a.currentStyle.borderLeftWidth)||0)+(parseInt(a.currentStyle.borderRightWidth)||0)),Math.max(0,(parseInt(a.currentStyle.paddingTop)||0)+(parseInt(a.currentStyle.paddingBottom)||0)+(parseInt(a.currentStyle.borderTopWidth)||0)+(parseInt(a.currentStyle.borderBottomWidth)||0))];};apf.getMargin=function(a){return[Math.max(0,(parseInt(a.currentStyle.marginLeft)||0)+(parseInt(a.currentStyle.marginRight)||0)),Math.max(0,(parseInt(a.currentStyle.marginTop)||0)+(parseInt(a.currentStyle.marginBottom)||0))];};apf.popup2={cache:{},setContent:function(q,a,c,d,o){if(!this.popup){this.init();}this.cache[q]={content:a,style:c,width:d,height:o};if(a.parentNode){a.parentNode.removeChild(a);}if(c){apf.importCssString(c,this.popup.document);}return this.popup.document;},removeContent:function(a){this.cache[a]=null;delete this.cache[a];},init:function(){this.popup=window.createPopup();this.popup.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">                <html xmlns="http://www.w3.org/1999/xhtml" xmlns:a='+apf.ns.aml+' xmlns:xsl="http://www.w3.org/1999/XSL/Transform">                <head>                    <script>                    var apf = {                        all: [],                        lookup:function(uniqueId){                            return this.all[uniqueId] || {                                $setStyleClass:function(){}                            };                        }                    };                    function destroy(){                        apf.all=null;                    }                    <\/script>                    <style>                    HTML{border:0;overflow:hidden;margin:0}                    BODY{margin:0}                    </style>                </head>                <body onmouseover="if(!self.apf) return;if(this.c){apf.all = this.c.all;this.c.Popup.parentDoc=self;}"></body>                </html>');var a=apf;this.popup.document.body.onmousemove=function(){this.c=a;};},show:function(a,J,K,E,c,F,d,o){if(!this.popup){this.init();}var D=this.cache[a];this.popup.document.body.innerHTML=D.content.outerHTML;if(E){var I,M=7,N=0,G=this.popup;I=setInterval(function(){var m=++N*((d||D.height)/M);G.show(J,K,F||D.width,m,c);G.document.body.firstChild.style.marginTop=(N-M-1)*((d||D.height)/M);if(N>M){clearInterval(I);o(G.document.body.firstChild);}},10);}else{this.popup.show(J,K,F||D.width,d||D.height,c);}this.last=a;},hide:function(){if(this.popup){this.popup.hide();}},forceHide:function(){if(this.last){apf.lookup(this.last).dispatchEvent("popuphide");}},destroy:function(){if(!this.popup){return;}this.popup.document.body.c=null;this.popup.document.body.onmouseover=null;}};apf.importClass(apf.runXpath,true,self);};apf.runNonIe=function(){DocumentFragment.prototype.getElementById=function(a){return this.childNodes.length?this.childNodes[0].ownerDocument.getElementById(a):null;};if(XMLDocument.prototype.__defineGetter__){XMLDocument.prototype.__defineGetter__("xml",function(){return(new XMLSerializer()).serializeToString(this);});XMLDocument.prototype.__defineSetter__("xml",function(){throw new Error(apf.formatErrorString(1042,null,"XML serializer","Invalid assignment on read-only property 'xml'."));});Node.prototype.__defineGetter__("xml",function(){if(this.nodeType==3||this.nodeType==4||this.nodeType==2){return this.nodeValue;}return(new XMLSerializer()).serializeToString(this);});Element.prototype.__defineGetter__("xml",function(){return(new XMLSerializer()).serializeToString(this);});}if(typeof HTMLElement!="undefined"){if(!HTMLElement.prototype.insertAdjacentElement){Text.prototype.insertAdjacentElement=HTMLElement.prototype.insertAdjacentElement=function(c,a){switch(c.toLowerCase()){case"beforebegin":this.parentNode.insertBefore(a,this);break;case"afterbegin":this.insertBefore(a,this.firstChild);break;case"beforeend":this.appendChild(a);break;case"afterend":if(this.nextSibling){this.parentNode.insertBefore(a,this.nextSibling);}else{this.parentNode.appendChild(a);}break;}};}if(!HTMLElement.prototype.insertAdjacentHTML){Text.prototype.insertAdjacentHTML=HTMLElement.prototype.insertAdjacentHTML=function(d,a){var c=this.ownerDocument.createRange();c.setStartBefore(apf.isWebkit?document.body:(self.document?document.body:this));var i=c.createContextualFragment(a);this.insertAdjacentElement(d,i);};}if(!HTMLBodyElement.prototype.insertAdjacentHTML){HTMLBodyElement.prototype.insertAdjacentHTML=HTMLElement.prototype.insertAdjacentHTML;}if(!HTMLElement.prototype.insertAdjacentText){Text.prototype.insertAdjacentText=HTMLElement.prototype.insertAdjacentText=function(c,a){var d=document.createTextNode(a);this.insertAdjacentElement(c,d);};}HTMLElement.prototype.removeNode=function(){if(!this.parentNode){return;}this.parentNode.removeChild(this);};if(HTMLElement.prototype.__defineSetter__){HTMLElement.prototype.__defineSetter__("innerText",function(c){var a=""+c;this.innerHTML=a.replace(/\&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");});HTMLElement.prototype.__defineGetter__("innerText",function(){return this.innerHTML.replace(/<[^>]+>/g,"").replace(/\s\s+/g," ").replace(/^\s*|\s*$/g," ");});HTMLElement.prototype.__defineGetter__("outerHTML",function(){return(new XMLSerializer()).serializeToString(this);});}}var u=false;try{XMLDocument.prototype.async=true;u=true;}catch(q){}Document.prototype.onreadystatechange=null;Document.prototype.parseError=0;Array.prototype.item=function(a){return this[a];};Array.prototype.expr="";try{XMLDocument.prototype.readyState=0;}catch(q){}XMLDocument.prototype.$clearDOM=function(){while(this.hasChildNodes()){this.removeChild(this.firstChild);}};XMLDocument.prototype.$copyDOM=function(d){this.$clearDOM();if(d.nodeType==9||d.nodeType==11){var a=d.childNodes;for(var c=0;c<a.length;c++){this.appendChild(this.importNode(a[c],true));}}else{if(d.nodeType==1){this.appendChild(this.importNode(d,true));}}};XMLDocument.prototype.loadXML=function(a){apf.xmldb.setReadyState(this,1);var c=this.xml||this.serialize();var d=(new DOMParser()).parseFromString(a,"text/xml");apf.xmldb.setReadyState(this,2);this.$copyDOM(d);apf.xmldb.setReadyState(this,3);apf.xmldb.loadHandler(this);return c;};Node.prototype.getElementById=function(a){};HTMLElement.prototype.replaceNode=Element.prototype.replaceNode=function(a){if(!this.parentNode){return;}this.parentNode.insertBefore(a,this);this.parentNode.removeChild(this);};XMLDocument.prototype.$load=XMLDocument.prototype.load;XMLDocument.prototype.load=function(a){var i=document.implementation.createDocument("","",null);i.$copyDOM(this);this.parseError=0;apf.xmldb.setReadyState(this,1);try{if(this.async==false&&u){var d=new XMLHttpRequest();d.open("GET",a,false);d.overrideMimeType("text/xml");d.send(null);apf.xmldb.setReadyState(this,2);this.$copyDOM(d.responseXML);apf.xmldb.setReadyState(this,3);}else{this.$load(a);}}catch(c){this.parseError=-1;}finally{apf.xmldb.loadHandler(this);}return i;};Element.prototype.transformNodeToObject=function(a,c){var d=document.implementation.createDocument("","",null);d.$copyDOM(this);d.transformNodeToObject(a,c);};Document.prototype.transformNodeToObject=function(a,i){var j=null;try{j=new XSLTProcessor();if(j.reset){a=apf.getXmlDom(a.xml||a.serialize());j.importStylesheet(a);var d=j.transformToFragment(this,i);i.$copyDOM(d);}else{j.transformDocument(this,a,i,null);}}catch(c){if(a&&i){throw new Error(apf.formatErrorString(1043,null,"XSLT Transformation","Failed to transform document. \nInfo : "+c));}else{if(!a){throw new Error(apf.formatErrorString(1044,null,"XSLT Transformation","No Stylesheet Document was provided. \nInfo : "+c));}else{if(!i){throw new Error(apf.formatErrorString(1045,null,"XSLT Transformation","No Result Document was provided. \nInfo : "+c));}else{if(j==null){throw new Error(apf.formatErrorString(1046,null,"XSLT Transformation","Could not instantiate an XSLTProcessor object. \nInfo : "+c));}else{throw c;}}}}}};Element.prototype.transformNode=function(a){return apf.getXmlDom(this.xml||this.serialize()).transformNode(a);};Document.prototype.transformNode=function(a){var d=new XSLTProcessor();a=apf.getXmlDom(a.xml||a.serialize());d.importStylesheet(a);var c=d.transformToFragment(this,document.implementation.createDocument("","",null));return c.xml||c.serialize();};apf.getStyle=function(c,a){return window.getComputedStyle(c,"").getPropertyValue(a);};HTMLDocument.prototype.setProperty=XMLDocument.prototype.setProperty=function(c,a){};apf.getHttpReq=function(){if(apf.availHTTP.length){return apf.availHTTP.pop();}return new XMLHttpRequest();};apf.getXmlDom=function(c,i){var d;if(c){d=new DOMParser();d=d.parseFromString(c,"text/xml");if(d.documentElement.tagName=="parsererror"&&apf.xmldb&&apf.isJson(c)){try{d=apf.json2Xml(c,i);}catch(a){throw new Error(apf.formatErrorString(1051,null,"JSON to XML conversion error occurred.","\nSource Text : "+c.replace(/\t/gi," ")));}}else{if(!i){this.xmlParseError(d);}}}else{d=document.implementation.createDocument("","",null);}return d;};apf.xmlParseError=function(i){if(i.documentElement.tagName=="parsererror"){var a=i.documentElement.firstChild.nodeValue.split("\n"),d=a[2].match(/\w+ (\d+)/)[1],c=a[0].replace(/\w+ \w+ \w+: (.*)/,"$1"),j=i.documentElement.lastChild.firstChild.nodeValue.split("\n")[0];throw new Error(apf.formatErrorString(1050,null,"XML Parse Error on line "+d,c+"\nSource Text : "+j.replace(/\t/gi," ")));}return i;};apf.xmldb.setReadyState=function(c,a){c.readyState=a;if(c.onreadystatechange!=null&&typeof c.onreadystatechange=="function"){c.onreadystatechange();}};apf.xmldb.loadHandler=function(a){if(!a.documentElement||a.documentElement.tagName=="parsererror"){a.parseError=-1;}apf.xmldb.setReadyState(a,4);};apf.Init.add(function(){var a,c=document.getElementsByTagName("form");for(a=0;a<c.length;a++){c[a].removeNode();}c=document.getElementsByTagName("xml");for(a=0;a<c.length;a++){c[a].removeNode();}c=null;});if(document.body){document.body.focus=function(){};}if(!document.elementFromPoint){Document.prototype.elementFromPointRemove=function(a){if(!this.RegElements){return;}this.RegElements.remove(a);};Document.prototype.elementFromPointAdd=function(a){if(!this.RegElements){this.RegElements=[];}this.RegElements.push(a);};Document.prototype.elementFromPointReset=function(a){FoundValue=[];FoundNode=null;LastFoundAbs=document.documentElement;};Document.prototype.elementFromPoint=function(a,l){document.elementFromPointReset();if(this.RegElements){var G=-1,I,d,j,c,i,z,F,m;for(G=-1,d,I=0;I<this.RegElements.length;I++){j=this.RegElements[I];if(o(j,"display")=="none"){continue;}c=n(j);i=s(j);z=c+j.offsetWidth;F=i+j.offsetHeight;if(a>c&&a<z&&l>i&&l<F){m=t(j);if(m>G){d=[j,a,l,c,i];G=m;}}}if(d){w(d[0],d[1],d[2],0,FoundValue,d[3],d[4]);if(!FoundNode){FoundNode=d[0];LastFoundAbs=d[0];FoundValue=[G];}}}if(!this.RegElements||!this.RegElements.length){w(document.body,a,l,0,[],n(document.body),s(document.body));}return FoundNode;};function o(c,a){return document.defaultView.getComputedStyle(c,"").getPropertyValue(a);}function w(m,T,V,z,c,aa,ab){var a=c,U=z,Q=m.childNodes,R,l,W,X,Y,d,i,j,ac,Z;for(R,l=0;l<m.childNodes.length;l++){R=m.childNodes[l];if(R.nodeType==1&&o(R,"display")!="none"&&R.offsetParent){X=aa+R.offsetLeft-R.offsetParent.scrollLeft;Y=ab+R.offsetTop-R.offsetParent.scrollTop;d=X+R.offsetWidth;i=Y+R.offsetHeight;j=o(R,"position");j=(j=="absolute")||(j=="relative");ac=o(R,"overflow")=="hidden";Z=(T>X&&T<d&&V>Y&&V<i);if(j&&ac&&!Z){continue;}z=U;c=a.copy();W=parseInt(o(R,"z-index"))||0;if(j&&(W||W==0)||ac){if(!j){W=0;}if(W>=(FoundValue[z]||0)){if(W>(c[z]||0)){c[z]=W;}z++;if(Z&&z>=FoundValue.length){FoundNode=R;FoundValue=c;LastFoundAbs=R;}}else{continue;}}else{if(Z&&z>=FoundValue.length){FoundNode=R;FoundValue=c;}}w(R,T,V,z,c,j?X:aa,j?Y:ab);}}}function s(a){return a.offsetTop+parseInt(apf.getStyle(a,"border-top-width"))+(a.offsetParent?s(a.offsetParent):0);}function n(a){return a.offsetLeft+parseInt(apf.getStyle(a,"border-left-width"))+(a.offsetParent?n(a.offsetParent):0);}function t(c){var d=0,a,i=c;while(i&&i.nodeType==1){d=Math.max(d,parseInt(o(i,"z-index"))||-1);i=i.parentNode;}return d;}}apf.getHorBorders=function(a){return Math.max(0,(parseInt(apf.getStyle(a,"border-left-width"))||0)+(parseInt(apf.getStyle(a,"border-right-width"))||0));};apf.getVerBorders=function(a){return Math.max(0,(parseInt(apf.getStyle(a,"border-top-width"))||0)+(parseInt(apf.getStyle(a,"border-bottom-width"))||0));};apf.getWidthDiff=function(a){return Math.max(0,(parseInt(apf.getStyle(a,"padding-left"))||0)+(parseInt(apf.getStyle(a,"padding-right"))||0)+(parseInt(apf.getStyle(a,"border-left-width"))||0)+(parseInt(apf.getStyle(a,"border-right-width"))||0));};apf.getHeightDiff=function(a){return Math.max(0,(parseInt(apf.getStyle(a,"padding-top"))||0)+(parseInt(apf.getStyle(a,"padding-bottom"))||0)+(parseInt(apf.getStyle(a,"border-top-width"))||0)+(parseInt(apf.getStyle(a,"border-bottom-width"))||0));};apf.getDiff=function(a){return[Math.max(0,parseInt(apf.getStyle(a,"padding-left"))+parseInt(apf.getStyle(a,"padding-right"))+parseInt(apf.getStyle(a,"border-left-width"))+parseInt(apf.getStyle(a,"border-right-width"))||0),Math.max(0,parseInt(apf.getStyle(a,"padding-top"))+parseInt(apf.getStyle(a,"padding-bottom"))+parseInt(apf.getStyle(a,"border-top-width"))+parseInt(apf.getStyle(a,"border-bottom-width"))||0)];};apf.getMargin=function(a){return[Math.max(0,(parseInt(apf.getStyle(a,"margin-left"))||0)+(parseInt(apf.getStyle(a,"margin-right"))||0)),Math.max(0,(parseInt(apf.getStyle(a,"margin-top"))||0)+(parseInt(apf.getStyle(a,"margin-bottom"))||0))];};};apf.runOpera=function(){if(apf.runNonIe){apf.runNonIe();}Document.prototype.selectNodes=XMLDocument.prototype.selectNodes=HTMLDocument.prototype.selectNodes=function(o,q){var a=this.evaluate(o,(q?q:this),this.createNSResolver(this.documentElement),XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);var n=new Array(a.snapshotLength);n.expr=o;for(var i=0;i<n.length;i++){n[i]=a.snapshotItem(i);}return n;};Text.prototype.selectNodes=Element.prototype.selectNodes=function(i){var a=this.ownerDocument;if(!a.selectSingleNode){a.selectSingleNode=HTMLDocument.prototype.selectSingleNode;a.selectNodes=HTMLDocument.prototype.selectNodes;}if(a.selectNodes){return a.selectNodes(i,this);}else{throw new Error(apf.formatErrorString(1047,null,"XPath Selection","Method selectNodes is only supported by XML Nodes"));}};Document.prototype.selectSingleNode=XMLDocument.prototype.selectSingleNode=HTMLDocument.prototype.selectSingleNode=function(j,l){var a=this.selectNodes(j+"[1]",l?l:null);return a.length>0?a[0]:null;};Text.prototype.selectSingleNode=Element.prototype.selectSingleNode=function(i){var a=this.ownerDocument;if(!a.selectSingleNode){a.selectSingleNode=HTMLDocument.prototype.selectSingleNode;a.selectNodes=HTMLDocument.prototype.selectNodes;}if(a.selectSingleNode){return a.selectSingleNode(i,this);}else{throw new Error(apf.formatErrorString(1048,null,"XPath Selection","Method selectSingleNode is only supported by XML Nodes. \nInfo : "+e));}};var c=new XMLSerializer();apf.insertHtmlNodes=function(i,t,s){var w,l=document.createDocumentFragment(),a=0,u=i.length;for(;a<u;a++){if(!(w=i[a])){continue;}l.appendChild(w);}(s||t).insertAdjacentHTML(s?"beforebegin":"beforeend",apf.html_entity_decode(c.serializeToString(l)).replace(/<([^>]+)\/>/g,"<$1></$1>"));};apf.insertHtmlNode=function(m,a,n,l){if(!l){l=apf.html_entity_decode(m.serialize?m.serialize(true):((m.nodeType==3||m.nodeType==4||m.nodeType==2)?m.nodeValue:c.serializeToString(m)));}(n||a).insertAdjacentHTML(n?"beforebegin":"beforeend",l.replace(/<([^>]+)\/>/g,"<$1></$1>"));return n?n.previousSibling:a.lastChild;};};apf.runWebkit=function(){if(!apf.isChrome){var l=window.setTimeout;self.lookupSafariCall=[];$setTimeout=function(c,a){if(typeof c=="string"){return l(c,a);}return l("self.lookupSafariCall["+(self.lookupSafariCall.push(c)-1)+"]()",a);};if(apf.isSafariOld){HTMLHtmlElement=document.createElement("html").constructor;Node=HTMLElement={};HTMLElement.prototype=HTMLHtmlElement.apf.__proto__.apf.__proto__;HTMLDocument=Document=document.constructor;var i=new DOMParser();XMLDocument=i.constructor;Element=i.parseFromString("<Single />","text/xml").documentElement.constructor;i=null;}if(!XMLDocument.prototype.__defineGetter__){Document.prototype.serialize=Node.prototype.serialize=XMLDocument.prototype.serialize=function(){return(new XMLSerializer()).serializeToString(this);};}}HTMLDocument.prototype.selectNodes=XMLDocument.prototype.selectNodes=function(c,d){if(c.substr(0,2)=="//"){c="."+c;}try{var s=this.evaluate(c,(d||this),this.createNSResolver(this.documentElement),7,null);}catch(t){try{var s=this.evaluate("child::"+c,(d||this),this.createNSResolver(this.documentElement),7,null);}catch(t){throw new Error("XPath error: "+t.message+"\nLine: "+t.lineNumber+"\nExpression: '"+c+"'");}}var a=new Array(s.snapshotLength);a.expr=c;for(var u=a.length-1;u>=0;u--){a[u]=s.snapshotItem(u);}return a;};Text.prototype.selectNodes=Element.prototype.selectNodes=function(a){return this.ownerDocument.selectNodes(a,this);};HTMLDocument.prototype.selectSingleNode=XMLDocument.prototype.selectSingleNode=function(c,d){var a=this.selectNodes(c,d||null);return a[0]||null;};Text.prototype.selectSingleNode=Element.prototype.selectSingleNode=function(a){return this.ownerDocument.selectSingleNode(a,this);};var j=new XMLSerializer();apf.insertHtmlNodes=function(B,w,C){var z,d=document.createDocumentFragment(),a=[],A=0,c=B.length;for(;A<c;A++){if(!(z=B[A])){continue;}d.appendChild(z);}(C||w).insertAdjacentHTML(C?"beforebegin":"beforeend",apf.html_entity_decode(j.serializeToString(d)).replace(/<([^>]+)\/>/g,"<$1></$1>"));};apf.insertHtmlNode=function(d,a,n,c){if(!c){c=apf.html_entity_decode(d.serialize?d.serialize(true):((d.nodeType==3||d.nodeType==4||d.nodeType==2)?d.nodeValue:j.serializeToString(d)));}(n||a).insertAdjacentHTML(n?"beforebegin":"beforeend",c.replace(/<([^>]+)\/>/g,"<$1></$1>"));return n?n.previousSibling:a.lastChild;};if(apf.runNonIe){apf.runNonIe();}};apf.crypto.BigInt=(function(){var aD=2;var aw=16;var a3=aw;var aY=1<<16;var bb=aY>>>1;var aq=aY*aY;var aS=aY-1;var aJ=9999999999999998;var aQ;var aG;var a4,bd;function aU(a){aQ=a;aG=new Array(aQ);for(var c=0;c<aG.length;c++){aG[c]=0;}a4=new be();bd=new be();bd.digits[0]=1;}aU(20);var au=15;var ar=a1(1000000000000000);function be(a){if(typeof a=="boolean"&&a==true){this.digits=null;}else{this.digits=aG.slice(0);}this.isNeg=false;}function a0(a){var c=a.charAt(0)=="-";var d=c?1:0;var j;while(d<a.length&&a.charAt(d)=="0"){++d;}if(d==a.length){j=new be();}else{var i=a.length-d;var l=i%au;if(l==0){l=au;}j=a1(Number(a.substr(d,l)));d+=l;while(d<a.length){j=a9(aB(j,ar),a1(Number(a.substr(d,au))));d+=au;}j.isNeg=c;}return j;}function aZ(a){var c=new be(true);c.digits=a.digits.slice(0);c.isNeg=a.isNeg;return c;}function a1(a){var d=new be();d.isNeg=a<0;a=Math.abs(a);var c=0;while(a>0){d.digits[c++]=a&aS;a=Math.floor(a/aY);}return d;}function aO(a){var d="";for(var c=a.length-1;c>-1;--c){d+=a.charAt(c);}return d;}var bc=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z");function ao(d,a){var i=new be();i.digits[0]=a;var l,c=aP(d,i),j=bc[c[1].digits[0]];while(ba(c[0],a4)==1){c=aP(c[0],i);l=c[1].digits[0];j+=bc[c[1].digits[0]];}return(d.isNeg?"-":"")+aO(j);}function aE(c){var d=new be();d.digits[0]=10;var a=aP(c,d);var i=String(a[1].digits[0]);while(ba(a[0],a4)==1){a=aP(a[0],d);i+=String(a[1].digits[0]);}return(c.isNeg?"-":"")+aO(i);}var a5=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");function aW(a){var c,d=15,i="";for(c=0;c<4;++c){i+=a5[a&d];a>>>=4;}return aO(i);}function aF(d){var i="";var a=aN(d);for(var c=aN(d);c>-1;--c){i+=aW(d.digits[c]);}return i;}function aH(l){var d=48;var i=d+9;var c=97;var m=c+25;var n=65;var a=65+25;var j;if(l>=d&&l<=i){j=l-d;}else{if(l>=n&&l<=a){j=10+l-n;}else{if(l>=c&&l<=m){j=10+l-c;}else{j=0;}}}return j;}function at(a){var d=0;var i=Math.min(a.length,4);for(var c=0;c<i;++c){d<<=4;d|=aH(a.charCodeAt(c));}return d;}function aM(a){var i=new be();var j=a.length;for(var c=j,d=0;c>0;c-=4,++d){i.digits[d]=at(a.substr(Math.max(c-4,0),Math.min(c,4)));}return i;}function aC(a,c){var o=a.charAt(0)=="-";var l=o?1:0;var q=new be();var n=new be();n.digits[0]=1;for(var m=a.length-1;m>=l;m--){var j=a.charCodeAt(m);var i=aH(j);var d=a7(n,i);q=a9(q,d);n=a7(n,c);}q.isNeg=o;return q;}function aA(a){return(a.isNeg?"-":"")+a.digits.join(" ");}function a9(i,l){var j;if(i.isNeg!=l.isNeg){l.isNeg=!l.isNeg;j=aT(i,l);l.isNeg=!l.isNeg;}else{j=new be();var a=0;var c;for(var d=0;d<i.digits.length;++d){c=i.digits[d]+l.digits[d]+a;j.digits[d]=c%aY;a=Number(c>=aY);}j.isNeg=i.isNeg;}return j;}function aT(i,l){var j;if(i.isNeg!=l.isNeg){l.isNeg=!l.isNeg;j=a9(i,l);l.isNeg=!l.isNeg;}else{j=new be();var a,c;c=0;for(var d=0;d<i.digits.length;++d){a=i.digits[d]-l.digits[d]+c;j.digits[d]=a%aY;if(j.digits[d]<0){j.digits[d]+=aY;}c=0-Number(a<0);}if(c==-1){c=0;for(var d=0;d<i.digits.length;++d){a=0-j.digits[d]+c;j.digits[d]=a%aY;if(j.digits[d]<0){j.digits[d]+=aY;}c=0-Number(a<0);}j.isNeg=!i.isNeg;}else{j.isNeg=i.isNeg;}}return j;}function aN(a){var c=a.digits.length-1;while(c>0&&a.digits[c]==0){--c;}return c;}function av(d){var a=aN(d);var c=d.digits[a];var i=(a+1)*a3;var j;for(j=i;j>i-a3;--j){if((c&32768)!=0){break;}c<<=1;}return j;}function aB(c,d){var q=new be();var i;var n=aN(c);var s=aN(d);var a,o,m,j,l;for(j=0;j<=s;++j){i=0;m=j;for(l=0;l<=n;++l,++m){o=q.digits[m]+c.digits[l]*d.digits[j]+i;q.digits[m]=o&aS;i=o>>>aw;}q.digits[j+n+1]=i;}q.isNeg=c.isNeg!=d.isNeg;return q;}function a7(i,l){var m,a,c,j=new be();m=aN(i);a=0;for(var d=0;d<=m;++d){c=j.digits[d]+i.digits[d]*l+a;j.digits[d]=c&aS;a=c>>>aw;}j.digits[1+m]=a;return j;}function aR(a,l,d,m,n){var j=Math.min(l+n,a.length);for(var c=l,i=m;c<j;++c,++i){d[i]=a[c];}}var a2=new Array(0,32768,49152,57344,61440,63488,64512,65024,65280,65408,65472,65504,65520,65528,65532,65534,65535);function aV(i,l){var c=Math.floor(l/a3);var j=new be();aR(i.digits,0,j.digits,c,j.digits.length-c);var m=l%a3;var d=a3-m;for(var a=j.digits.length-1,n=a-1;a>0;--a,--n){j.digits[a]=((j.digits[a]<<m)&aS)|((j.digits[n]&a2[m])>>>(d));}j.digits[0]=((j.digits[a]<<m)&aS);j.isNeg=i.isNeg;return j;}var az=new Array(0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535);function a6(i,l){var d=Math.floor(l/a3);var j=new be();aR(i.digits,d,j.digits,0,i.digits.length-d);var n=l%a3;var m=a3-n;for(var c=0,a=c+1;c<j.digits.length-1;++c,++a){j.digits[c]=(j.digits[c]>>>n)|((j.digits[a]&az[n])<<m);}j.digits[j.digits.length-1]>>>=n;j.isNeg=i.isNeg;return j;}function aL(c,a){var d=new be();aR(c.digits,0,d.digits,a,d.digits.length-a);return d;}function a8(c,a){var d=new be();aR(c.digits,a,d.digits,0,d.digits.length-a);return d;}function ap(c,a){var d=new be();aR(c.digits,0,d.digits,0,a);return d;}function ba(d,a){if(d.isNeg!=a.isNeg){return 1-2*Number(d.isNeg);}for(var c=d.digits.length-1;c>=0;--c){if(d.digits[c]!=a.digits[c]){if(d.isNeg){return 1-2*Number(d.digits[c]>a.digits[c]);}else{return 1-2*Number(d.digits[c]<a.digits[c]);}}}return 0;}function aP(o,s){var D=av(o);var w=av(s);var A=s.isNeg;var a,c;if(D<w){if(o.isNeg){a=aZ(bd);a.isNeg=!s.isNeg;o.isNeg=false;s.isNeg=false;c=aT(s,o);o.isNeg=true;s.isNeg=A;}else{a=new be();c=aZ(o);}return new Array(a,c);}a=new be();c=o;var j=Math.ceil(w/a3)-1;var m=0;while(s.digits[j]<bb){s=aV(s,1);++m;++w;j=Math.ceil(w/a3)-1;}c=aV(c,m);D+=m;var u=Math.ceil(D/a3)-1;var i=aL(s,u-j);while(ba(c,i)!=-1){++a.digits[u-j];c=aT(c,i);}for(var n=u;n>j;--n){var d=(n>=c.digits.length)?0:c.digits[n];var l=(n-1>=c.digits.length)?0:c.digits[n-1];var q=(n-2>=c.digits.length)?0:c.digits[n-2];var t=(j>=s.digits.length)?0:s.digits[j];var C=(j-1>=s.digits.length)?0:s.digits[j-1];if(d==t){a.digits[n-j-1]=aS;}else{a.digits[n-j-1]=Math.floor((d*aY+l)/t);}var z=a.digits[n-j-1]*((t*aY)+C);var B=(d*aq)+((l*aY)+q);while(z>B){--a.digits[n-j-1];z=a.digits[n-j-1]*((t*aY)|C);B=(d*aY*aY)+((l*aY)+q);}i=aL(s,n-j-1);c=aT(c,a7(i,a.digits[n-j-1]));if(c.isNeg){c=a9(c,i);--a.digits[n-j-1];}}c=a6(c,m);a.isNeg=o.isNeg!=A;if(o.isNeg){if(A){a=a9(a,bd);}else{a=aT(a,bd);}s=a6(s,m);c=aT(s,c);}if(c.digits[0]==0&&aN(c)==0){c.isNeg=false;}return new Array(a,c);}function aK(c,a){return aP(c,a)[0];}function aI(c,a){return aP(c,a)[1];}function aX(c,a,d){return aI(aB(c,a),d);}function ax(d,a){var i=bd;var c=d;while(true){if((a&1)!=0){i=aB(i,c);}a>>=1;if(a==0){break;}c=aB(c,c);}return i;}function ay(d,l,i){var j=bd;var c=d;var a=l;while(true){if((a.digits[0]&1)!=0){j=aX(j,c,i);}a=a6(a,1);if(a.digits[0]==0&&aN(a)==0){break;}c=aX(c,c,i);}return j;}return{construct:be,setMaxDigits:aU,fromDecimal:a0,copy:aZ,fromNumber:a1,toString:ao,toDecimal:aE,toHex:aF,fromHex:aM,fromString:aC,dump:aA,add:a9,subtract:aT,highIndex:aN,numBits:av,multiply:aB,shiftLeft:aV,shiftRight:a6,compare:ba,pow:ax,powMod:ay,divide:aK,divideByRadixPower:a8,moduloByRadixPower:ap};})();(function(l){function i(a,c){var d=(a<<c)|(a>>>(32-c));return d;}function j(o){var a="";var c;var d;for(c=7;c>=0;c--){d=(o>>>(c*4))&15;a+=d.toString(16);}return a;}l.SHA1=function(A){var V,c,d,Y=new Array(80),E=1732584193,T=4023233417,U=2562383102,W=271733878,X=3285377520,C,D,P,R,B,a;A=apf.crypto.UTF8.encode(A);var Z=A.length,Q=[];for(c=0;c<Z-3;c+=4){d=A.charCodeAt(c)<<24|A.charCodeAt(c+1)<<16|A.charCodeAt(c+2)<<8|A.charCodeAt(c+3);Q.push(d);}switch(Z%4){case 0:c=2147483648;break;case 1:c=A.charCodeAt(Z-1)<<24|8388608;break;case 2:c=A.charCodeAt(Z-2)<<24|A.charCodeAt(Z-1)<<16|32768;break;case 3:c=A.charCodeAt(Z-3)<<24|A.charCodeAt(Z-2)<<16|A.charCodeAt(Z-1)<<8|128;break;}Q.push(c);while((Q.length%16)!=14){Q.push(0);}Q.push(Z>>>29);Q.push((Z<<3)&4294967295);for(V=0;V<Q.length;V+=16){for(c=0;c<16;c++){Y[c]=Q[V+c];}for(c=16;c<=79;c++){Y[c]=i(Y[c-3]^Y[c-8]^Y[c-14]^Y[c-16],1);}C=E;D=T;P=U;R=W;B=X;for(c=0;c<=19;c++){a=(i(C,5)+((D&P)|(~D&R))+B+Y[c]+1518500249)&4294967295;B=R;R=P;P=i(D,30);D=C;C=a;}for(c=20;c<=39;c++){a=(i(C,5)+(D^P^R)+B+Y[c]+1859775393)&4294967295;B=R;R=P;P=i(D,30);D=C;C=a;}for(c=40;c<=59;c++){a=(i(C,5)+((D&P)|(D&R)|(P&R))+B+Y[c]+2400959708)&4294967295;B=R;R=P;P=i(D,30);D=C;C=a;}for(c=60;c<=79;c++){a=(i(C,5)+(D^P^R)+B+Y[c]+3395469782)&4294967295;B=R;R=P;P=i(D,30);D=C;C=a;}E=(E+C)&4294967295;T=(T+D)&4294967295;U=(U+P)&4294967295;W=(W+R)&4294967295;X=(X+B)&4294967295;}a=j(E)+j(T)+j(U)+j(W)+j(X);return a.toLowerCase();};})(apf.crypto);apf.crypto.Base64=(function(){var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function l(N){var E,F,G,I,J,K,M,C,a=0,c=0,d="",D=[];if(!N){return N;}N=apf.crypto.UTF8.encode(N+"");do{E=N.charCodeAt(a++);F=N.charCodeAt(a++);G=N.charCodeAt(a++);C=E<<16|F<<8|G;I=C>>18&63;J=C>>12&63;K=C>>6&63;M=C&63;D[c++]=i.charAt(I)+i.charAt(J)+i.charAt(K)+i.charAt(M);}while(a<N.length);d=D.join("");switch(N.length%3){case 1:d=d.slice(0,-2)+"==";break;case 2:d=d.slice(0,-1)+"=";break;}return d;}function j(a){var C,D,E,G,I,J,K,F,d=0,c=0,B=[];if(!a){return a;}a+="";do{G=i.indexOf(a.charAt(d++));I=i.indexOf(a.charAt(d++));J=i.indexOf(a.charAt(d++));K=i.indexOf(a.charAt(d++));F=G<<18|I<<12|J<<6|K;C=F>>16&255;D=F>>8&255;E=F&255;if(J==64){B[c++]=String.fromCharCode(C);}else{if(K==64){B[c++]=String.fromCharCode(C,D);}else{B[c++]=String.fromCharCode(C,D,E);}}}while(d<a.length);return apf.crypto.UTF8.decode(B.join(""));}return{decode:j,encode:l};})();apf.crypto.UTF8={encode:function(s){s=(s+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n");var t=[],u=0,A=0,l,z;for(var w=0,n=s.length;w<n;w++){l=s.charCodeAt(w);z=null;if(l<128){A++;}else{if((l>127)&&(l<2048)){z=String.fromCharCode((l>>6)|192)+String.fromCharCode((l&63)|128);}else{z=String.fromCharCode((l>>12)|224)+String.fromCharCode(((l>>6)&63)|128)+String.fromCharCode((l&63)|128);}}if(z!==null){if(A>u){t.push(s.substring(u,A));}t.push(z);u=A=w+1;}}if(A>u){t.push(s.substring(u,s.length));}return t.join("");},decode:function(q){var t=[],o=0,w=0,i=0,s=0,u=0;q+="";while(o<q.length){i=q.charCodeAt(o);if(i<128){t[w++]=String.fromCharCode(i);o++;}else{if((i>191)&&(i<224)){s=q.charCodeAt(o+1);t[w++]=String.fromCharCode(((i&31)<<6)|(s&63));o+=2;}else{s=q.charCodeAt(o+1);u=q.charCodeAt(o+2);t[w++]=String.fromCharCode(((i&15)<<12)|((s&63)<<6)|(u&63));o+=3;}}}return t.join("");}};apf.crypto.RSA=(function(){function m(c,a,d){this.e=apf.crypto.BigInt.fromHex(c);this.d=apf.crypto.BigInt.fromHex(a);this.m=apf.crypto.BigInt.fromHex(d);this.digitSize=2*apf.crypto.BigInt.highIndex(this.m)+2;this.chunkSize=this.digitSize-11;this.radix=16;this.barrett=new apf.crypto.Barrett(this.m);}function j(a){return(a<10?"0":"")+String(a);}function l(c,R){if(c.chunkSize>c.digitSize-11){return"Error";}var i=new Array();var M=R.length;var d=0;while(d<M){i[d]=R.charCodeAt(d);d++;}var T=i.length;var Q="";var I,J,K;for(d=0;d<T;d+=c.chunkSize){K=new apf.crypto.BigInt.construct();I=0;var s;var N=(d+c.chunkSize)>T?T%c.chunkSize:c.chunkSize;var P=new Array();for(s=0;s<N;s++){P[s]=i[d+N-1-s];}P[N]=0;var O=Math.max(8,c.digitSize-3-N);for(s=0;s<O;s++){P[N+1+s]=Math.floor(Math.random()*254)+1;}P[c.digitSize-2]=2;P[c.digitSize-1]=0;for(J=0;J<c.digitSize;++I){K.digits[I]=P[J++];K.digits[I]+=P[J++]<<8;}var U=c.barrett.powMod(K,c.e);var a=c.radix==16?apf.crypto.BigInt.toHex(U):apf.crypto.BigInt.toString(U,c.radix);Q+=a+" ";}return Q.substring(0,Q.length-1);}function n(z,s){var d=s.split(" ");var c="";var A,B,i;for(A=0;A<d.length;++A){var a;if(z.radix==16){a=apf.crypto.BigInt.fromHex(d[A]);}else{a=apf.crypto.BigInt.fromString(d[A],z.radix);}i=z.barrett.powMod(a,z.d);for(B=0;B<=apf.crypto.BigInt.highIndex(i);++B){c+=String.fromCharCode(i.digits[B]&255,i.digits[B]>>8);}}if(c.charCodeAt(c.length-1)==0){c=c.substring(0,c.length-1);}return c;}return{F4:"10001",E3:"3",getKeyPair:m,twoDigit:j,encrypt:l,decrypt:n};})();apf.crypto.MD5={hexcase:0,b64pad:"",chrsz:8,hex_md5:function(c){return this.binl2hex(this.core_md5(this.str2binl(c),c.length*this.chrsz));},b64_md5:function(c){return this.binl2b64(this.core_md5(this.str2binl(c),c.length*this.chrsz));},str_md5:function(c){return this.binl2str(this.core_md5(this.str2binl(c),c.length*this.chrsz));},hex_hmac_md5:function(d,i){return this.binl2hex(this.core_hmac_md5(d,i));},b64_hmac_md5:function(d,i){return this.binl2b64(this.core_hmac_md5(d,i));},str_hmac_md5:function(d,i){return this.binl2str(this.core_hmac_md5(d,i));},core_md5:function(C,a){C[a>>5]|=128<<((a)%32);C[(((a+64)>>>9)<<4)+14]=a;var D=1732584193,E=-271733879,F=-1732584194,G=271733878;for(var i=0;i<C.length;i+=16){var c=D,d=E,A=F,B=G;D=this.md5_ff(D,E,F,G,C[i+0],7,-680876936);G=this.md5_ff(G,D,E,F,C[i+1],12,-389564586);F=this.md5_ff(F,G,D,E,C[i+2],17,606105819);E=this.md5_ff(E,F,G,D,C[i+3],22,-1044525330);D=this.md5_ff(D,E,F,G,C[i+4],7,-176418897);G=this.md5_ff(G,D,E,F,C[i+5],12,1200080426);F=this.md5_ff(F,G,D,E,C[i+6],17,-1473231341);E=this.md5_ff(E,F,G,D,C[i+7],22,-45705983);D=this.md5_ff(D,E,F,G,C[i+8],7,1770035416);G=this.md5_ff(G,D,E,F,C[i+9],12,-1958414417);F=this.md5_ff(F,G,D,E,C[i+10],17,-42063);E=this.md5_ff(E,F,G,D,C[i+11],22,-1990404162);D=this.md5_ff(D,E,F,G,C[i+12],7,1804603682);G=this.md5_ff(G,D,E,F,C[i+13],12,-40341101);F=this.md5_ff(F,G,D,E,C[i+14],17,-1502002290);E=this.md5_ff(E,F,G,D,C[i+15],22,1236535329);D=this.md5_gg(D,E,F,G,C[i+1],5,-165796510);G=this.md5_gg(G,D,E,F,C[i+6],9,-1069501632);F=this.md5_gg(F,G,D,E,C[i+11],14,643717713);E=this.md5_gg(E,F,G,D,C[i+0],20,-373897302);D=this.md5_gg(D,E,F,G,C[i+5],5,-701558691);G=this.md5_gg(G,D,E,F,C[i+10],9,38016083);F=this.md5_gg(F,G,D,E,C[i+15],14,-660478335);E=this.md5_gg(E,F,G,D,C[i+4],20,-405537848);D=this.md5_gg(D,E,F,G,C[i+9],5,568446438);G=this.md5_gg(G,D,E,F,C[i+14],9,-1019803690);F=this.md5_gg(F,G,D,E,C[i+3],14,-187363961);E=this.md5_gg(E,F,G,D,C[i+8],20,1163531501);D=this.md5_gg(D,E,F,G,C[i+13],5,-1444681467);G=this.md5_gg(G,D,E,F,C[i+2],9,-51403784);F=this.md5_gg(F,G,D,E,C[i+7],14,1735328473);E=this.md5_gg(E,F,G,D,C[i+12],20,-1926607734);D=this.md5_hh(D,E,F,G,C[i+5],4,-378558);G=this.md5_hh(G,D,E,F,C[i+8],11,-2022574463);F=this.md5_hh(F,G,D,E,C[i+11],16,1839030562);E=this.md5_hh(E,F,G,D,C[i+14],23,-35309556);D=this.md5_hh(D,E,F,G,C[i+1],4,-1530992060);G=this.md5_hh(G,D,E,F,C[i+4],11,1272893353);F=this.md5_hh(F,G,D,E,C[i+7],16,-155497632);E=this.md5_hh(E,F,G,D,C[i+10],23,-1094730640);D=this.md5_hh(D,E,F,G,C[i+13],4,681279174);G=this.md5_hh(G,D,E,F,C[i+0],11,-358537222);F=this.md5_hh(F,G,D,E,C[i+3],16,-722521979);E=this.md5_hh(E,F,G,D,C[i+6],23,76029189);D=this.md5_hh(D,E,F,G,C[i+9],4,-640364487);G=this.md5_hh(G,D,E,F,C[i+12],11,-421815835);F=this.md5_hh(F,G,D,E,C[i+15],16,530742520);E=this.md5_hh(E,F,G,D,C[i+2],23,-995338651);D=this.md5_ii(D,E,F,G,C[i+0],6,-198630844);G=this.md5_ii(G,D,E,F,C[i+7],10,1126891415);F=this.md5_ii(F,G,D,E,C[i+14],15,-1416354905);E=this.md5_ii(E,F,G,D,C[i+5],21,-57434055);D=this.md5_ii(D,E,F,G,C[i+12],6,1700485571);G=this.md5_ii(G,D,E,F,C[i+3],10,-1894986606);F=this.md5_ii(F,G,D,E,C[i+10],15,-1051523);E=this.md5_ii(E,F,G,D,C[i+1],21,-2054922799);D=this.md5_ii(D,E,F,G,C[i+8],6,1873313359);G=this.md5_ii(G,D,E,F,C[i+15],10,-30611744);F=this.md5_ii(F,G,D,E,C[i+6],15,-1560198380);E=this.md5_ii(E,F,G,D,C[i+13],21,1309151649);D=this.md5_ii(D,E,F,G,C[i+4],6,-145523070);G=this.md5_ii(G,D,E,F,C[i+11],10,-1120210379);F=this.md5_ii(F,G,D,E,C[i+2],15,718787259);E=this.md5_ii(E,F,G,D,C[i+9],21,-343485551);D=this.safe_add(D,c);E=this.safe_add(E,d);F=this.safe_add(F,A);G=this.safe_add(G,B);}return[D,E,F,G];},md5_cmn:function(a,q,s,t,n,o){return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(q,a),this.safe_add(t,o)),n),s);},md5_ff:function(c,d,t,u,s,w,a){return this.md5_cmn((d&t)|((~d)&u),c,d,s,w,a);},md5_gg:function(c,d,t,u,s,w,a){return this.md5_cmn((d&u)|(t&(~u)),c,d,s,w,a);},md5_hh:function(c,d,t,u,s,w,a){return this.md5_cmn(d^t^u,c,d,s,w,a);},md5_ii:function(c,d,t,u,s,w,a){return this.md5_cmn(t^(d|(~u)),c,d,s,w,a);},core_hmac_md5:function(s,i){var o=this.str2binl(s),n=Array(16),q=Array(16);if(o.length>16){o=this.core_md5(o,s.length*this.chrsz);}for(var t=0;t<16;t++){n[t]=o[t]^909522486;q[t]=o[t]^1549556828;}return this.core_md5(q.concat(this.core_md5(n.concat(this.str2binl(i)),512+i.length*this.chrsz)),512+128);},safe_add:function(j,l){var m=(j&65535)+(l&65535),n=(j>>16)+(l>>16)+(m>>16);return(n<<16)|(m&65535);},bit_rol:function(d,i){return(d<<i)|(d>>>(32-i));},str2binl:function(l){var m=[],n,i=(1<<this.chrsz)-1;for(n=0;n<l.length*this.chrsz;n+=this.chrsz){m[n>>5]|=(l.charCodeAt(n/this.chrsz)&i)<<(n%32);}return m;},binl2str:function(m){var l=[],n,i=(1<<this.chrsz)-1;for(n=0;n<m.length*32;n+=this.chrsz){l.push(String.fromCharCode((m[n>>5]>>>(n%32))&i));}return l.join("");},binl2hex:function(m){var n=this.hexcase?"0123456789ABCDEF":"0123456789abcdef",l=[],i;for(i=0;i<m.length*4;i++){l.push(n.charAt((m[i>>2]>>((i%4)*8+4))&15)+n.charAt((m[i>>2]>>((i%4)*8))&15));}return l.join("");},binl2b64:function(o){var q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=[],s;for(s=0;s<o.length*4;s+=3){var i=(((o[s>>2]>>8*(s%4))&255)<<16)|(((o[s+1>>2]>>8*((s+1)%4))&255)<<8)|((o[s+2>>2]>>8*((s+2)%4))&255);for(var j=0;j<4;j++){if(s*8+j*6>o.length*32){t.push(this.b64pad);}else{t.push(q.charAt((i>>6*(3-j))&63));}}}return t.join("");}};apf.crypto.MD4={hexcase:0,b64pad:"",chrsz:8,hex_md4:function(c){return this.binl2hex(this.core_md4(this.str2binl(c),c.length*this.chrsz));},b64_md4:function(c){return this.binl2b64(this.core_md4(this.str2binl(c),c.length*this.chrsz));},str_md4:function(c){return this.binl2str(this.core_md4(this.str2binl(c),c.length*this.chrsz));},hex_hmac_md4:function(d,i){return this.binl2hex(this.core_hmac_md4(d,i));},b64_hmac_md4:function(d,i){return this.binl2b64(this.core_hmac_md4(d,i));},str_hmac_md4:function(d,i){return this.binl2str(this.core_hmac_md4(d,i));},md4_vm_test:function(){return this.hex_md4("abc")=="a448017aaf21d8525fc10ae87aa6729d";},core_md4:function(C,a){C[a>>5]|=128<<(a%32);C[(((a+64)>>>9)<<4)+14]=a;var D=1732584193;var E=-271733879;var F=-1732584194;var G=271733878;for(var i=0;i<C.length;i+=16){var c=D;var d=E;var A=F;var B=G;D=this.md4_ff(D,E,F,G,C[i+0],3);G=this.md4_ff(G,D,E,F,C[i+1],7);F=this.md4_ff(F,G,D,E,C[i+2],11);E=this.md4_ff(E,F,G,D,C[i+3],19);D=this.md4_ff(D,E,F,G,C[i+4],3);G=this.md4_ff(G,D,E,F,C[i+5],7);F=this.md4_ff(F,G,D,E,C[i+6],11);E=this.md4_ff(E,F,G,D,C[i+7],19);D=this.md4_ff(D,E,F,G,C[i+8],3);G=this.md4_ff(G,D,E,F,C[i+9],7);F=this.md4_ff(F,G,D,E,C[i+10],11);E=this.md4_ff(E,F,G,D,C[i+11],19);D=this.md4_ff(D,E,F,G,C[i+12],3);G=this.md4_ff(G,D,E,F,C[i+13],7);F=this.md4_ff(F,G,D,E,C[i+14],11);E=this.md4_ff(E,F,G,D,C[i+15],19);D=this.md4_gg(D,E,F,G,C[i+0],3);G=this.md4_gg(G,D,E,F,C[i+4],5);F=this.md4_gg(F,G,D,E,C[i+8],9);E=this.md4_gg(E,F,G,D,C[i+12],13);D=this.md4_gg(D,E,F,G,C[i+1],3);G=this.md4_gg(G,D,E,F,C[i+5],5);F=this.md4_gg(F,G,D,E,C[i+9],9);E=this.md4_gg(E,F,G,D,C[i+13],13);D=this.md4_gg(D,E,F,G,C[i+2],3);G=this.md4_gg(G,D,E,F,C[i+6],5);F=this.md4_gg(F,G,D,E,C[i+10],9);E=this.md4_gg(E,F,G,D,C[i+14],13);D=this.md4_gg(D,E,F,G,C[i+3],3);G=this.md4_gg(G,D,E,F,C[i+7],5);F=this.md4_gg(F,G,D,E,C[i+11],9);E=this.md4_gg(E,F,G,D,C[i+15],13);D=this.md4_hh(D,E,F,G,C[i+0],3);G=this.md4_hh(G,D,E,F,C[i+8],9);F=this.md4_hh(F,G,D,E,C[i+4],11);E=this.md4_hh(E,F,G,D,C[i+12],15);D=this.md4_hh(D,E,F,G,C[i+2],3);G=this.md4_hh(G,D,E,F,C[i+10],9);F=this.md4_hh(F,G,D,E,C[i+6],11);E=this.md4_hh(E,F,G,D,C[i+14],15);D=this.md4_hh(D,E,F,G,C[i+1],3);G=this.md4_hh(G,D,E,F,C[i+9],9);F=this.md4_hh(F,G,D,E,C[i+5],11);E=this.md4_hh(E,F,G,D,C[i+13],15);D=this.md4_hh(D,E,F,G,C[i+3],3);G=this.md4_hh(G,D,E,F,C[i+11],9);F=this.md4_hh(F,G,D,E,C[i+7],11);E=this.md4_hh(E,F,G,D,C[i+15],15);D=this.safe_add(D,c);E=this.safe_add(E,d);F=this.safe_add(F,A);G=this.safe_add(G,B);}return Array(D,E,F,G);},md4_cmn:function(a,q,s,t,n,o){return this.safe_add(rol(this.safe_add(this.safe_add(q,a),this.safe_add(t,o)),n),s);},md4_ff:function(c,d,s,t,q,a){return this.md4_cmn((d&s)|((~d)&t),c,0,q,a,0);},md4_gg:function(c,d,s,t,q,a){return this.md4_cmn((d&s)|(d&t)|(s&t),c,0,q,a,1518500249);},md4_hh:function(c,d,s,t,q,a){return this.md4_cmn(d^s^t,c,0,q,a,1859775393);},core_hmac_md4:function(t,i){var q=this.str2binl(t);if(q.length>16){q=this.core_md4(q,t.length*this.chrsz);}var o=Array(16),s=Array(16);for(var w=0;w<16;w++){o[w]=q[w]^909522486;s[w]=q[w]^1549556828;}var u=this.core_md4(o.concat(this.str2binl(i)),512+i.length*this.chrsz);return this.core_md4(s.concat(u),512+128);},safe_add:function(j,l){var m=(j&65535)+(l&65535);var n=(j>>16)+(l>>16)+(m>>16);return(n<<16)|(m&65535);},rol:function(d,i){return(d<<i)|(d>>>(32-i));},str2binl:function(l){var m=Array();var i=(1<<this.chrsz)-1;for(var n=0;n<l.length*this.chrsz;n+=this.chrsz){m[n>>5]|=(l.charCodeAt(n/this.chrsz)&i)<<(n%32);}return m;},binl2str:function(m){var l="";var i=(1<<this.chrsz)-1;for(var n=0;n<m.length*32;n+=this.chrsz){l+=String.fromCharCode((m[n>>5]>>>(n%32))&i);}return l;},binl2hex:function(m){var n=this.hexcase?"0123456789ABCDEF":"0123456789abcdef";var l="";for(var i=0;i<m.length*4;i++){l+=n.charAt((m[i>>2]>>((i%4)*8+4))&15)+n.charAt((m[i>>2]>>((i%4)*8))&15);}return l;},binl2b64:function(o){var q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var t="";for(var s=0;s<o.length*4;s+=3){var i=(((o[s>>2]>>8*(s%4))&255)<<16)|(((o[s+1>>2]>>8*((s+1)%4))&255)<<8)|((o[s+2>>2]>>8*((s+2)%4))&255);for(var j=0;j<4;j++){if(s*8+j*6>o.length*32){t+=this.b64pad;}else{t+=q.charAt((i>>6*(3-j))&63);}}}return t;}};(function(q){if(typeof apf.crypto=="undefined"){apf.crypto={};}function m(c){var d=[];var a,i;for(a=0;a<c.length;a++){i=c.charCodeAt(a);d[a>>2]|=i<<(3-a%4)*8;}return d;}function n(d){var c=new String();for(var a=0;a<d.length;a++){c+=String.fromCharCode(d[a]>>>24,(d[a]>>>16)&255,(d[a]>>>8)&255,d[a]&255);}return c;}function o(a){var c,i=0;var d=[];while(i<a.length*6){c=a.charCodeAt(i/6);if(c>47&&c<58){c-=48;}if(c>62&&c<91){c-=53;}if(c>96&&c<123){c-=59;}switch(i&31){case 0:d[i>>5]=c;i+=6;break;case 28:d[i>>5]=(d[i>>5]<<4)|(c>>2);i+=4;d[i>>5]=c&3;i+=2;break;case 30:d[i>>5]=(d[i>>5]<<2)|(c>>4);i+=2;d[i>>5]=c&15;i+=4;break;default:d[i>>5]=(d[i>>5]<<6)|c;i+=6;}}return d;}function l(d){var t,c,j=0,a="",i="0123456789?@ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";while(j<d.length){for(c=0;c<2;c++){t=d[j]>>>26;a+=i.charAt(t);t=(d[j]>>>20)&63;a+=i.charAt(t);t=(d[j]>>>14)&63;a+=i.charAt(t);t=(d[j]>>>8)&63;a+=i.charAt(t);t=(d[j]>>>2)&63;a+=i.charAt(t);t=(d[j++]&3)<<4;t=t|(d[j]>>>28);a+=i.charAt(t);t=(d[j]>>>22)&63;a+=i.charAt(t);t=(d[j]>>>16)&63;a+=i.charAt(t);t=(d[j]>>>10)&63;a+=i.charAt(t);t=(d[j]>>>4)&63;a+=i.charAt(t);t=(d[j++]&15)<<2;t=t|(d[j]>>>30);a+=i.charAt(t);t=(d[j]>>>24)&63;a+=i.charAt(t);t=(d[j]>>>18)&63;a+=i.charAt(t);t=(d[j]>>>12)&63;a+=i.charAt(t);t=(d[j]>>>6)&63;a+=i.charAt(t);t=d[j++]&63;a+=i.charAt(t);}}return a;}apf.crypto.Blowfish=function(){this.init.apply(this,arguments);};apf.crypto.Blowfish.prototype={init:function(a){this.P;this.S;this.previous_xHi=0;this.previous_xLo=0;},encode:function(i,u){var j=new String(""),w=new Array(),c;for(c=0;c<4;c++){if(typeof(this.customRand)=="function"){w[c]=this.customRand();}else{w[c]=Math.floor(Math.random()*4294967295);}}var a=this.passtokey(u,w[2],w[3],w[4]);w[4]=a[14];w[5]=a[15];this.initialise(a,w);var d=m(i);this.encipher_array(d);return{code:l(d),init:l(w)};},decode:function(i,j,d){var t=o(d);var a=this.passtokey(j,t[2],t[3]);if((t[4]==a[14])&&(t[5]==a[15])){this.initialise(a,t);var c=o(i);this.decipher(c);return n(c);}return null;},setConstants:function(){var d=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946];var i=[1266315497,3048417604,3681880366,3289982499,2909710000,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055];var a=[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504];var c=[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409000,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462];this.S=[d,i,a,c];this.P=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731];},encipher:function(a){var d=a[0];var c=a[1];var i=0;d^=this.P[0];while(i<16){c^=(((this.S[0][d>>>24]+this.S[1][(d>>>16)&255])^this.S[2][(d>>>8)&255])+this.S[3][d&255])^this.P[++i];d^=(((this.S[0][c>>>24]+this.S[1][(c>>>16)&255])^this.S[2][(c>>>8)&255])+this.S[3][c&255])^this.P[++i];}c^=this.P[16+1];a[0]=c;a[1]=d;},encipher_array:function(a){var u,j,d,c,i,w;for(u=0;(u<a.length)||(a.length%6);u+=2){d=a[u];c=a[u+1];d^=this.previous_xHi;c^=this.previous_xLo;d^=this.P[0];i=0;while(i<16){c^=(((this.S[0][d>>>24]+this.S[1][(d>>>16)&255])^this.S[2][(d>>>8)&255])+this.S[3][d&255])^this.P[++i];d^=(((this.S[0][c>>>24]+this.S[1][(c>>>16)&255])^this.S[2][(c>>>8)&255])+this.S[3][c&255])^this.P[++i];}c^=this.P[17];this.previous_xHi=c;this.previous_xLo=d;a[u+1]=d;a[u]=c;}},decipher:function(a){var j,d,c,i,t;for(j=0;j<a.length;j+=2){d=a[j];c=a[j+1];d^=this.P[17];i=16;while(i>0){c^=(((this.S[0][d>>>24]+this.S[1][(d>>>16)&255])^this.S[2][(d>>>8)&255])+this.S[3][d&255])^this.P[i--];d^=(((this.S[0][c>>>24]+this.S[1][(c>>>16)&255])^this.S[2][(c>>>8)&255])+this.S[3][c&255])^this.P[i--];}c^=this.P[0];t=a[j];a[j]=c^this.previous_xHi;this.previous_xHi=t;t=a[j+1];a[j+1]=d^this.previous_xLo;this.previous_xLo=t;}},initialise:function(j,u){var w,a,c,i;var d=new Array(2);this.previous_xHi=u[0];this.previous_xLo=u[1];this.setConstants();for(a=0,w=0;w<16+2;++w){this.P[w]=this.P[w]^j[a];a=(a+1)%14;}for(w=0;w<16+2;w+=2){this.encipher(d);this.P[w]=d[0];this.P[w+1]=d[1];}for(w=0;w<4;++w){for(a=0;a<256;a+=2){this.encipher(d);this.S[w][a]=d[0];this.S[w][a+1]=d[1];}}},passtokey:function(j,w,a){var d=m(j);var i=new Array(2);var z=new Array(16);var A=0,c;i[0]=w;i[1]=a;do{this.initialise(z,i,16);for(c=0;c<16;){i[0]^=d[A];this.encipher(i);z[c++]^=i[0];z[c++]^=i[1];}}while(++A<d.length);return z;}};})(this);apf.crypto.Barrett=function(){this.init.apply(this,arguments);};apf.crypto.Barrett.prototype={init:function(d){this.modulus=apf.crypto.BigInt.copy(d);this.k=apf.crypto.BigInt.highIndex(this.modulus)+1;var i=new apf.crypto.BigInt.construct();i.digits[2*this.k]=1;this.mu=apf.crypto.BigInt.divide(i,this.modulus);this.bkplus1=new apf.crypto.BigInt.construct();this.bkplus1.digits[this.k+1]=1;},modulo:function(s){var t=apf.crypto.BigInt.divideByRadixPower(s,this.k-1);var w=apf.crypto.BigInt.multiply(t,this.mu);var z=apf.crypto.BigInt.divideByRadixPower(w,this.k+1);var A=apf.crypto.BigInt.moduloByRadixPower(s,this.k+1);var q=apf.crypto.BigInt.multiply(z,this.modulus);var B=apf.crypto.BigInt.moduloByRadixPower(q,this.k+1);var C=apf.crypto.BigInt.subtract(A,B);if(C.isNeg){C=apf.crypto.BigInt.add(C,this.bkplus1);}var u=apf.crypto.BigInt.compare(C,this.modulus)>=0;while(u){C=apf.crypto.BigInt.subtract(C,this.modulus);u=apf.crypto.BigInt.compare(C,this.modulus)>=0;}return C;},multiplyMod:function(i,j){var l=apf.crypto.BigInt.multiply(i,j);return this.modulo(l);},powMod:function(o,a){var q=new apf.crypto.BigInt.construct();q.digits[0]=1;var n=o;var m=a;while(true){if((m.digits[0]&1)!=0){q=this.multiplyMod(q,n);}m=apf.crypto.BigInt.shiftRight(m,1);if(m.digits[0]==0&&apf.crypto.BigInt.highIndex(m)==0){break;}n=this.multiplyMod(n,n);}return q;}};apf.JSImplementation=function(){var i=["[","{","(","text","xpath","word","sep","ws","semi","sh","op","col","str","regex","comment"];var j=["]","}",")"];var l=new RegExp();l.compile("([\\w_\\.]+)|([\\s]*,[\\s]*)|([\\s]*;[\\s]*)|(\\/\\*)|(\\*\\/)|(\\/\\/)|([\\r\\n])|((?:[\\s]*)[\\$\\@\\#\\%\\^\\&\\*\\?\\!](?:[\\s]*))|([\\s]*[\\+\\-\\<\\>\\|\\=]+[\\s]*)|(\\s*\\:\\s*)|(\\s+)|(\\\\[\\\\\\{\\}\\[\\]\\\"\\'\\/])|(\\[)|(\\])|([\\s]*\\([\\s]*)|([\\s]*\\)[\\s]*)|([\\s]*\\{[\\s]*)|([\\s]*\\}[\\s]*)|(\\')|(\\\")|(\\/)","g");this.dump_tree=function(s,d,a){for(var m=0;m<s.length;m++){var c=s[m],n=c[0];if(n<3){d.push(a+i[n]);this.dump_tree(c[1],d,"  "+a);d.push(j[n]);d.push("\n");}else{d.push(a+i[n]+": "+c[1]+"\n");}}return d;};this.parse=function(E,I){var Q=[];var a=[];var d=[];var G=a;var J=0,N=0;var c=0,K=0;var F=0;var M=[0,0,0];E.replace(l,function(m,at,t,ar,n,q,s,ak,aq,z,ah,al,D,ao,ai,au,am,B,u,w,A,o,ag){function C(R){var T=I?E.substr(N,ag-N).replace(/[\r\n]\s*/,"").replace(/^\s*[\r\n]/,"").replace(/[\r\n\t]/g,""):E.substr(N,ag-N).replace(/[\r\n\t]/g,"");if(T.length>0){G[G.length]=[R,T,N,ag];}}function ap(T,R){G[G.length]=[T,R,ag];}function aj(T){M[T]++;var R=[];G[G.length]=[T,R,ag];d[d.length]=G;G=R;}function an(T){M[T]--;if(d.length==0){Q[Q.length]=["extra "+j[T],ag];}else{G=d.pop();var R=G[G.length-1][0];if(R!=T){Q[Q.length]=["scope mismatch "+i[R]+" with "+i[T],ag];}}}if(!c){if(at){ap(5,m);if(m=="macro"){F=1;}else{if(F){macros[m]=1,F=0;}}}if(t){ap(6,",");}if(al){ap(7,m);}if(ar){ap(8,m);}if(aq){ap(9,m);}if(z){ap(10,m);}if(ah){ap(11,m);}if(ao){aj(0);}if(ai){an(0);}if(B){aj(1);}if(u){an(1);}if(au){aj(2);}if(am){an(2);}}if(s){if(c==0){c=5;N=ag+2;}}if(ak){if(c==5){c=0;ag+=1;C(14);}}if(w){if(c==0){c=1;N=ag;}else{if(c==1){c=0;ag+=1;C(12);}}}if(A){if(c==0){c=2;N=ag;}else{if(c==2){c=0;ag+=1;C(12);}}}if(n){if(c==0){c=4;N=ag+2;}}if(q){if(c==4){c=0;C(14);}}if(o){if(c==0){if(G.length==0||G[G.length-1][0]==6){c=3;N=ag;}else{ap(10,m);}}else{if(c==3){c=0;ag+=1;C(13);}}}return m;});if(d.length>0){for(var O=d.length-1;O>=0;O--){var P=d[O][d[O].length-1];Q[Q.length]=["unclosed tag "+i[P[0]],P[2]];}}return{tree:a,stack:d,err:Q,count:M};};};apf.JavascriptParser=new apf.JSImplementation();apf.lm=new (function(){var dh={"var":1,"for":1,"while":1,"do":1,"if":1,"else":1,"switch":1,"case":1,"break":1,"continue":1,"default":1,"function":2,"return":1,"try":1,"catch":1,"throw":1,"debugger":1,alert:1,"delete":1,"export":1,"import":1,label:1,foreach:1,each:1,node:1,local:1,yield:1,let:1,"finally":1,"delete":1},dJ={"\n":1,"\r\n":1,"==":2,"++":2,"--":2,'"':5,"'":5,"<!--":6,"-->":6,"/*":6,"//":6,"*/":6,"{":7,"}":8,"[":9,"]":10,"(":11,")":12,"<":13,">":14,"+=":2,"-=":2,"/=":2,"*=":2},ds={"{":"}","[":"]","(":")","{{":"}"},dp={ancestor:1,"ancestor-or-self":1,attribute:1,child:1,descendant:1,"descendant-or-self":1,following:1,"following-sibling":1,namespace:1,parent:1,preceding:1,self:1},dR={";":1,",":2,"^":3,"=":4,"+=":4,"-=":4,"/=":4,"*=":4,"/":5,":":6},dq={"~":"_val(_n,","%":"_nod(_n,","*":"_nods(_n,","#":"_cnt(_n,","$":"_lng("},bP={"~":"_val(_n,","%":"_xml(_n,","*":"_xmls(_n,","#":"_cnt(_n,","$":"_lng("},cf={"~":"_val(_n,","%":"_val(_n,","*":"_val(_n,","#":"_cnt(_n,","$":"_lng("},c2,cB={"~":"_val(_n,","%":"_xml(_n,","*":"_xmls(_n,","#":"_cnt(_n,","$":"_lng("},cM={"~":"_val(_n,","%":"_xml(_n,","*":"_xmls(_n,","#":"_cnt(_n,","$":"_lnged("},bQ={"[":1,"(":1,",":1,"=":1,"return":1,"throw":1},c3={"else":1,"return":1,"delete":1},dF={"do":1,"else":1,"try":1},cv={"=":"_asn(","+=":"_add(","-=":"_sub(","/=":"_div(","*=":"_mul("},dD={"+":1,"%":1,"-":1,"/":1,"=":1,"(":1,"?":1,"|":1,"^":1,"[":1,"&":1,"*":1,"!":1,":":1,"<":1,",":1},dn={"{":1,"} ":1,")":1,")   ":1,";":1,"\n":1,"else":1},cm={"{":1,";":1,"\n":1,"else":1},cP={"} ":1,")   ":1,"(":1,")":1,";":1,"&":1,"^":1,"|":1,",":1,'"':1,"'":1,"=":1,"+=":2,"-=":2,"/=":2,"*=":2,"?":1,"{":1,"}":1,">":1,"[":1,"]":1,"+":1,":":1,"else":1,"return":1},cy={'"':1,"'":1,">":1,"]":1,"}":1},dm={'\\"':'"',"\\'":"'","\\{":"{","\\}":"}","\\[":"[","\\]":"]","\\(":"(","\\)":")","\\\\":"\\"},db={alert:1,confirm:1,setTimeout:1,setInterval:1,"switch":1,call:1,"return":1,"throw":1,"case":1,"catch":1},a0={" ":1,"\n":1},dO={"{":1,";":1,"(":1,"\n":1},b6={"\\{":"{","\\}":"}","\\[":"[","\\]":"]","\\(":"(","\\)":")"},cD={"\\{":"{","\\}":"}","\\[":"[","\\]":"]","\\(":"(","\\)":")","\\\\":"\\\\\\\\","\\":"\\\\","\\<":"<","\\>":">"},dN={lte:"<=",gte:">=",lt:"<",gt:">",and:"&&",or:"||",andbin:"&",orbin:"|",LTE:"<=",GTE:">=",LT:"<",GT:">",AND:"&&",OR:"||",ANDBIN:"&",ORBIN:"|"},cg={0:"_val(_n,",1:"_valcr(_n,_cr,",2:"_nod(_n,",3:"_nodcr(_n,_cr,",4:"_nods(_n,",5:"_xpt(_n,",6:"_valst(_n,",7:"_valed(_n,",foreach:"_nods(_n,",each:"_nods(_n,",local:"_nod(_n,",tagName:"_nod(_n,",localName:"_nod(_n,",xml:"_xmlq(",_call:"_val(_n,"},dQ={"_val(_n,":"_valm(","_valcr(_n,_cr,":"_valcr(0,_cr,","_nod(_n,":"_nodm(","_nodcr(_n,_cr,":"_nodcr(0,_cr,","_nods(_n,":"_nodsm(","_xml(_n,":"_xml(0,","_xmls(_n,":"_xmls(0,","_cnt(_n,":"_cntm(","_xpt(_n,":"_xptm(","_valst(_n,":"_valm(","_valed(_n,":"_valed(0,","_lng(":"_lng(","_lnged(":"_lnged(","_nod_del(_n,":"_nod_del(0,","_nods_del(_n,":"_nods_del(0,"},c0={"=":{"_val(_n,":"_nod_asn(_n,","_valm(":"_nod_asn(0,","_valcr(_n,_cr,":"_nod_asn(_n,","_valcr(0,_cr,":"_nod_asn(0,","_nod(_n,":"_nod_asn(_n,","_nodm(":"_nod_asn(0,","_nodcr(_n,_cr,":"_nod_asn(_n,","_nodcr(0,_cr,":"_nod_asn(0,","_nods(_n,":"_nods_asn(_n,","_nodsm(":"_nods_asn(0,"},"+=":{"_val(_n,":"_nod_add(_n,","_valm(":"_nod_add(0,","_valcr(_n,_cr,":"_nod_add(_n,","_valcr(0,_cr,":"_nod_add(0,","_nod(_n,":"_nod_add(_n,","_nodm(":"_nod_add(0,","_nodcr(_n,_cr,":"_nod_add(_n,","_nodcr(0,_cr,":"_nod_add(0,","_nods(_n,":"_nods_add(_n,","_nodsm(":"_nods_add(0,"}},s={"_cnt(_n,":"_nod_del(_n,","_xpt(_n,":"_nod_del(_n,","_val(_n,":"_nod_del(_n,","_valcr(_n,":"_nod_del(_n,","_nod(_n,":"_nod_del(_n,","_nodcr(_n,_cr,":"_nod_del(_n,","_nods(_n,":"_nods_del(_n,"},cV=/(\r?[\n]|\/\*|\*\/|\/\/|\<\!\-\-|\-\-\>|[=+\/\*-]=|\+\+|\-\-|["'{(\[\])}\]\<\>]|$)|([ \t]+)|([a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF.$_][\w.$_]*)|(\d[x\d.]*)|(\\?[\w._?,:;!=+-\\\/^&|*"'[\]{}()%$#@~`<>]?)/g,cT=/(^|\|)(?!\@|text\(\)|\.\.|[\w\-\:]+?\:\:)/g,dH={},dC={},dG={},dl=apf.$asyncObjects||{comm:1,rpc:1,http:1},dA,c6,dz,bR,cI,cG,cW,ca,dy,c1,c5,dj,cU=[],cc,dL=[],dK=[],b0,cr,cR,bY,cX,cx,dE,b4,cK,cH,bW,dw,c7,o,cO,dx,ci,b2,co;dH["if"]="if(",dC["if"]=")",dH["while"]="while(",dC["while"]=")",dH["for"]="for(",dC["for"]=")",dH["switch"]="switch(",dC["switch"]=")",dH["catch"]="catch(",dC["catch"]=")",dC["function"]=")  ";dH.foreach=dH.each="\nfor(var _t=_t||[],_t=(_t.push(_n,0,(";dC.foreach=dC.each=")||[]),_t);(_n=_t[_t.length-1][_t[_t.length-2]++])||(_t.length-=2,_n=_t.pop(),0);)";dH.local="\nfor(var _t=_t||[],_t=(_t.push(_n,((_n=_local(";dC.local=")),1)),_t);(_t[_t.length-1]--&&_n)||(_t.length--,_n=_t.pop(),0);)";dH.localName="_localName(_n",dC.localName=")";dH.output="_o.join(''",dC.output=")";dH.reset="(_o=[],l=0",dC.reset=")";dH.item="(_t[_t.length-1][_t[_t.length-2]-1]",dC.item=")",dH.first="(_t[_t.length-2]==1",dC.first=")",dH.last="(_t[_t.length-2]==_t[_t.length-1].length",dC.last=")",dH.total="(_t[_t.length-1].length",dC.total=")",dH.pos="(_t[_t.length-2]-1",dC.pos=")",dH.tagName="_tagName(_n",dC.tagName=")";dH._nodeValue="_nodeValue(_n",dC._nodeValue=")";dC.async="])";dC.precall="])";dC._call=")";var ch={_call:".call(_n",localName:dH.localName,tagName:dH.tagName,nodeValue:dH.nodeValue},cJ="(function(){var _o=[],_l=0;",cq=";return _l==1?_o[0]:_o.join('');})()",cL="_async(_n,_c,_a,_w,_f,this,",cF="',_a[++_a.i]||[",cz="_r=",cZ,cC="_o[_l++]=",dd="",dr="{var _o=[],_l=0,_n=this;",dP=";\nreturn _l==1?_o[0]:_o.join('');}",dS="(_a=_a||{}).i=0;try{",cl="}catch(_e){if(_e.x)return;throw(_e);}",dT="(_a=_a||{}).i=0;try{_pc(_w);",cn="}catch(_e){if(_e.x)return;throw(_e);}",ck="with(_w){",b7="}",di="var _o=[],_l=0;_o[_l++]=",dg="var _o=[],_l=0;",cY=";\nreturn _ret(_l==1?_o[0]:_o.join(''));",cb=";\n_c(_ret(_l==1?_o[0]:_o.join('')),apf.SUCCESS,apf.$lmx);apf.$lmx=null;",cQ="return _ret(",dM=");",cw="_c(_ret(",ce="),apf.SUCCESS,apf.$lmx);apf.$lmx=null;",cA="var _r=",bt="var _r;",cj=";\nreturn _r;",bZ=";\n_c(_r,apf.SUCCESS,apf.$lmx);apf.$lmx=null;",b1=";\n_c(0,apf.SUCCESS,apf.$lmx);apf.$lmx=null;;",dU="return ",cp="",dt="_c(",dV=",apf.SUCCESS);",ct="var _f=function(_n,_c,_w,_a){",bU="var _f=function(_n,_w){",bS="var _f=function(_n){",c9="var _f=function(_n,_c,_w,_cr,_a){",bT="var _f=function(_n,_w,_cr,){",cS="var _f=function(_n,_cr){",df="var _f=function(event,_c,_w,_a,_n){",b9="var _f=function(event,_w,_n){",da="var _f=function(event,_n){",cN="}",cd="var _f=function(_m){",cs=";\nif(_n=_r){if(!_n.nodeType)_n=_m;",cE=";\nif(_n=",dI="){if(!_n.nodeType)_n=_m;",b8="\nreturn ",du="\nreturn _ret(",dW=");",b3="\nreturn _n;",bX="\nreturn (_r = (",c8="))?(_r.nodeType?_r:_n):(_r===null?null:_n);",b5="var _r, _n = _m;",cu=";\n_n = _m;",bO="\nreturn _ret(_nodeValue(_n));",dv="\nreturn _n;",de="\n}";function dc(d){var a,c;if(cI[cr-1]=="{{"){a=cr-1;}else{for(c=cc-2,a=0;c>=0&&cI[a=(cU[c]&268435455)-1]!="{{";c-=2){}}if(!d&&cG>a+1){cI[a]=cJ+cC;}else{cI[a]=cJ;}b0=1;}function dB(a,n,u,q,c,t,l){var d,i,j,m=n?dJ[n]:(u?0:(q?3:(c?4:(a?2:15))));switch(b0){case 0:case 1:switch(m){case 0:if((cH==3&&cK!="$")||cH==4){cI[cG++]=" ";}else{if(dq[cK]){cH=0;}}break;case 1:dE++,ci=l;if(cI[cG-1]!="\n"&&!dO[cK]){cI[cG++]="\n";}if(dq[cK]){cH=0;}break;case 2:if(i=dR[a]){switch(i){case 1:if(!cU[cc-1]){cI[cG++]=")",cc-=2;}if(!b0){if(cI[cG-1]!="\n"&&cK!="{"&&cK!=";"){cI[cG++]="\n";}}else{if(!cc||cU[cc-1]){cI[cG++]=";";}}break;case 2:if(!cU[cc-1]){cI[cG++]=")",cc-=2;}cI[cG++]=",";break;case 3:if(cI[cG-1]=="\n"||cI[cG-1]==";"||cK=="{"||cK=="} "||cG==cr){if(!b0){dc();}cI[cG++]="  ";}else{cI[cG++]="^";}break;case 4:if(cK!="<"&&cK!=">"){if(!b0){dc(true);}cI[cG++]=a;for(i=cG;i>=cr&&!dh[cI[i]]&&!((cI[i]=="  "||cI[i]==(b4?cC:cZ))&&(cI[i]="",1));i--){}if(cH==3&&bW>0&&cK.charAt(0)!="."){cG-=2;while(a0[cI[cG]]){cG--;}j=cK;cI[cG++]=cv[a],cI[cG++]=j.slice(0,bW),cI[cG++]=",'",cI[cG++]=j.slice(bW+1),cI[cG++]="',",cU[cc++]=cr|(b0<<28),cU[cc++]="";}else{if(cI[i=cG-2]==") "){if(!(d=c0[a])||!(d=d[cI[j=cU[cc]&268435455]])){throw {t:"Invalid xpath assign",p:l};}cI[j]=d,cI[i]=",",cI[i+1]="",cI[i+2]="";cU[cc++]=cr|(b0<<28),cU[cc++]="";}}}else{cI[cG++]=a;}break;case 5:if(bQ[cK]){cU[cc++]=cr|(b0<<28);cU[cc++]=cI[cG++]=a;cr=cR=cG-1;b4++,b0=5,bY=a;}else{cI[cG++]="/";}break;case 6:if(cc>2&&cU[cc-1]=="{{"&&(cG<cr+4&&cH==5)||(cG<cr+3&&(cH==3||cH==4))){cI[cr-1]=cU[cc-1]="{";b0=(i=cU[cc-2])>>28;cU[cc-2]=i&268435455,b4--;}else{if(cI[cG-3]=="case"||(cH==5&&co=="case")){a=";";}}cI[cG++]=":";break;}}else{cI[cG++]=dm[a]||a;}break;case 3:case 4:i=d=j=0;bW=(co=a).lastIndexOf(".");if(a.charAt(0)!="."&&((i=(d=((dn[cK]||cI[cG-1]=="\n")&&!dD[cK]))&&!cU[cc-1].indexOf("{")&&cG>cr)||(j=dh[a]))&&!b0){if(j==2&&cU[cc-1].indexOf("{")){j=0;}dc(j);}if(d&&!cU[cc-1]){cI[cG-1]=="\n"&&(cI[cG-1]=""),cI[cG++]=")",cI[cG++]="\n",i=1,cc-=2;}if(i&&b0&&!dh[a]){cI[cG++]=(b4?cC:cZ);}if(bW>0&&a.charAt(0)!="."){dy[cI[cG++]=c7=a]=1;}else{cI[cG++]=dN[a]||a;}break;case 5:if((i=(d=((dn[cK]||cI[cG-1]=="\n")&&!dD[cK]))&&!cU[cc-1].indexOf("{")&&cG>cr)&&!b0){dc();}if(d&&!cU[cc-1]){cI[cG-1]=="\n"&&(cI[cG-1]=""),cI[cG++]=")",cI[cG++]="\n",i=1,cc-=2;}if(i){cI[cG++]=(cI[cG-2]!="\n"&&cy[cK])?"+":(b4?cC:cZ);}else{if(cy[cK]){cI[cG++]="+";}}cU[cc++]=cr|(b0<<28),cU[cc++]=cI[cG++]=a;cr=cR=cG-1,b4++,b0=5,bY=a;break;case 6:if(a=="*/"||a=="-->"){throw {t:"Unmatched comment "+a,p:l};}o=b0,cO=cK,dx=cH,b0=6,bY=a;break;case 7:if(cI[cG-1]==")  "||(cI[cG-2]==")  "&&cG--)){if(cU[cc-1]!="("&&cU[cc-1]!="["){cU[cc++]=cr|(b0<<28),cU[cc++]="{{",cI[cG++]=dr,cr=cG,b0=1,b4++,cI[cG++]="";}else{cU[cc++]=cr,cU[cc++]=cI[cG++]=a,cr=cG;b0=1;}}else{if((dH[cU[cc+1]]&&cK==")   ")||dF[cK]){cU[cc++]=cr,cU[cc++]=cI[cG++]=a,cr=cG;cI[cG++]="";}else{if((i=(d=((dn[cK]||cI[cG-1]=="\n")&&!dD[cK]))&&!cU[cc-1].indexOf("{")&&cG>cr)&&!b0){dc();}if(d&&!cU[cc-1]){cI[cG-1]=="\n"&&(cI[cG-1]=""),cI[cG++]=")",cI[cG++]="\n",i=1,cc-=2;}if(i){cI[cG++]=(cI[cG-2]!="\n"&&cy[cK])?"+''+":(b4?cC:cZ);}else{if(cy[cK]){cI[cG++]=(cK=="}")?"+''+":"+";}}cU[cc++]=cr|(b0<<28),cU[cc++]=cI[cG++]="{{";if(!b4&&cr!=cG){c1++;}b4++,cR=cr=cG,b0=0;}}break;case 8:if(!cU[cc-1]){cI[cG++]=")",cI[cG++]="\n",cc-=2;}if(ds[i=cU[--cc]]!=(cI[cG++]=a)){throw {t:"Cannot close "+i+" with "+a,p:l};}if(i=="{{"){if(cr==cG-1){if((cU[cc-1]>>28)<=1){cI[cr-1]="{",cI[cG-1]="}";}else{cI[cr-1]=cI[cG-1]="'";}}else{if(!b0){cI[cr-1]="(",cI[cG-1]=")";}else{if(cI[cr-1]==dr){if(cr==cG-2){cI[cr-1]="{",cI[cG-1]="}";}else{cI[cG-1]=dP;}}else{cI[cG-1]=cq;}}}b0=(i=cU[--cc])>>28,cr=i&268435455;cR=cG,b4--;if(!b4){c1++;}if(b0==7){cI[cG++]='+"\\"',b0=4;}}else{cr=cU[--cc];}break;case 9:if(((cH==3&&!c3[cK]&&cK!="$")||cK==")"||cK=="]")&&cI[cG-1]!="\n"){cI[cG++]="[",cU[cc++]=cr|(b0<<28),cU[cc++]=a,cR=cr=cG;}else{dw=null;if((j=dq[cK])){cG--,cK=cI[cG-1];if(cI[cG-1]=="delete"||(cI[cG-2]=="delete"&&cG--)){j=s[j],cG--;}}else{j=cg[cU[cc-1]]||cg[b4?0:dA];if(cK=="delete"){j=s[j],cG-=2;}}if((i=(d=((dn[cK]||cI[cG-1]=="\n")&&!dD[cK]))&&!cU[cc-1].indexOf("{")&&(cG>cr||cU[cc-1].length==1))&&!b0){dc();}if(d&&!cU[cc-1]){cI[cG-1]=="\n"&&(cI[cG-1]=""),cI[cG++]=")",cI[cG++]="\n",i=1,cc-=2;}if(i){cI[cG++]=(cI[cG-2]!="\n"&&cy[cK])?"+":(b4?cC:cZ);}else{if(cy[cK]){cI[cG++]="+";}}if(!b4&&cG!=cr){c1++;}b4++,cU[cc++]=cr|(b0<<28),cU[cc++]=cI[cG++]=j,cR=cr=cG,dL[cr]=l,b0=3;}break;case 10:if(!cU[cc-1]){cI[cG++]=")",cc-=2;}if(ds[i=cU[--cc]]!=(cI[cG++]=a)){throw {t:"Cannot close "+i+" with "+a,p:l};}cr=cU[--cc]&268435455;break;case 11:if(((i=(d=((cm[cK]||cI[cG-1]=="\n")&&!dD[cK]))&&!cU[cc-1].indexOf("{")&&cG>cr))&&!b0){dc();}if(d&&!cU[cc-1]){cI[cG-1]=="\n"&&(cI[cG-1]=""),cI[cG++]=")",cI[cG++]="\n",i=1,cc-=2;}if(i&&b0){cI[cG++]=(b4?cC:cZ),cH=0;}if(j=dH[cK]){if(cI[cG-1]==" "){cG--;}cI[cG-1]=j,cU[cc++]=cr,cU[cc++]=cK,cr=cR=cG;}else{if(cH==3){if(bW<0){i=0;if(cK=="function"||cI[cG-3]=="function"||cI[cG-4]=="function"){cU[cc++]=cr,cU[cc++]="function",cI[cG++]="(",cr=cR=cG;}else{if(!db[cK]&&cI[cG-3]!="new"){cI[cG++]=".call(_n",cU[cc++]=cr,cU[cc++]="_call",cr=cR=cG;}else{cU[cc++]=cr,cU[cc++]=cI[cG++]=a,cr=cR=cG;}}}else{if(bW>1&&dl[i=cK.substring(0,bW)]){if(cI[--cG]==" "){cG--;}cI[cG++]=cL,cI[cG++]=i,cI[cG++]=",'";cI[cG++]=cK.slice(bW+1);cI[cG++]=cF,cU[cc++]=cr,cU[cc++]="async",cr=cR=cG,cW++;}else{cU[cc++]=cr,cU[cc++]=cI[cG++]=a,cr=cR=cG;}}}else{cU[cc++]=cr,cU[cc++]=cI[cG++]=a,cr=cR=cG;}if(cK==c7){delete dy[cK];}}break;case 12:if(!cU[cc-1]){cI[cG-1]=="\n"&&(cI[cG-1]=""),cI[cG++]=")",cI[cG++]="\n",i=1,cc-=2;}if(j=dC[i=cU[--cc]]){if(i!="_call"){a=")   ";}if((d=ch[i])&&d!=cI[cG-1]){cI[cr-1]=d+",";}cI[cG++]=j;}else{if(ds[i]!=(cI[cG++]=a)){throw {t:"Cannot close "+i+" with "+a,p:l};}}cr=cU[--cc]&268435455;break;case 13:if(cG==cr||cP[cK]||cI[cG-1]=="\n"){if((i=(d=((dn[cK]||cI[cG-1]=="\n")&&!dD[cK]))&&!cU[cc-1].indexOf("{")&&cG>cr)&&!b0){dc();}if(d&&!cU[cc-1]){cI[cG-1]=="\n"&&(cI[cG-1]=""),cI[cG++]=")",cI[cG++]="\n",i=1,cc-=2;}if(i){cI[cG++]=(cI[cG-2]!="\n"&&cy[cK])?"+''+":(b4?cC:cZ);}else{if(cy[cK]){cI[cG++]="+";}}b2=null,cI[cG++]='"',cI[cG++]="<",b4++,cU[cc++]=cr|(b0<<28),cc+=3,cU[cc-2]=cU[cc-1]=0;cR=cr=cG-1,b0=4;}else{cI[cG++]="<";}break;case 14:cI[cG++]=">";break;case 15:if(cc&&!cU[cc-1]){cI[cG-1]=="\n"&&(cI[cG-1]=""),cI[cG++]=")",cI[cG++]="\n",i=1,cc-=2;}break;}break;case 2:switch(m){case 1:dE++,ci=l;if(cG!=cr&&cG!=cR){cI[cG++]="\\n";}break;case 2:if(cG==cR){cI[cG]=(cG++==cr)?'"':'+"';}cI[cG++]=cD[a]||a;break;case 3:if(cG==cR){cI[cG]=(cG++==cr)?'"':'+"';}if(a.charAt(a.length-1)=="$"){cI[cG++]=a.slice(0,-1);cI[cG++]=a="$";}else{cI[cG++]=a;}break;case 5:if(cG==cR){cI[cG]=(cG++==cr)?'"':'+"';}cI[cG++]=(a=='"')?'\\"':"'";break;case 7:if(cG==cR){if(cG!=cr){cI[cG++]="+";}}else{cI[cG++]='"+',b4||c1++;}cU[cc++]=cr|536870912,cU[cc++]=cI[cG++]="{{",b4++,cR=cr=cG,b0=0;break;case 9:dw=null;if((j=bP[cK])&&cI[cG-1]==cK){if(--cG-1==cr){cG--;}}else{j=cg[(b4||cr!=cG)?0:dA];}if(cG!=cr){cI[cG]=(cG++==cR)?"+":(b4||c1++,'"+');if(!b4){c1++;}}cU[cc++]=cr|536870912,cU[cc++]=cI[cG++]=j,cR=cr=cG,b4++,b0=3;break;case 15:if(cc){throw {t:"Unclosed "+cU[cc-1]+" found at end in textmode",p:l};}if(cG!=cr&&cG!=cR){cI[cG++]='"',b4||c1++;}break;default:if(cG==cR){cI[cG]=(cG++==cr)?'"':'+"';}cI[cG++]=a;}break;case 3:switch(m){case 0:if(cG!=cr){if(cG==cR){cI[cG++]='+"';}cI[cG++]=a;}break;case 1:dE++,ci=l;break;case 2:if(a==":"&&cK==":"&&!dp[j=cI[cG-2]]&&((i=cU[cc-2])>>28)!=6){if(cI[cG-2]=='+"'){cI[cG-2]=cI[cG-1]="",dw="#";}else{cI[cG-1]='"';if(cR==cr){dw=cI.slice(cR+1,cG-1).join("");}else{dw="#";}}if(!(j=dQ[cI[cr-1]])){throw {t:"Invalid model found for: "+cI[cr-1],p:l};}cI[cr-1]=j,cI[cG++]=",",cR=cr=cG;}else{if(a==","&&(i=(cU[cc-2]>>28))<=1){cG=cr-1,d=cX.slice(dL[cr]+1,l+1);cH=9,b0=i,cI[cG++]=cK="[";cU[cc-2]=(cU[cc-2]&268435455)|(b0<<28),cU[cc-1]=cK,cR=cr=cG,b4--;if(!b4){c5--;}if(d.length>1){dK.push(cX);(cX=d).replace(cV,dB);cX=dK.pop();}}else{if(cG==cR){cI[cG]=(cG++==cr)?'"':'+"';}cI[cG++]=dm[a]||a;}}break;case 3:if(cG==cR){cI[cG]=(cG++==cr)?'"':'+"';}if(a.charAt(a.length-1)=="$"){cI[cG++]=a.slice(0,-1);cI[cG++]=a="$";}else{cI[cG++]=a;}break;case 5:if(cG==cR){cI[cG]=(cG++==cr)?'"':'+"';}if(cU[cc-1]=="["){cU[cc-1]=a;}else{if(cU[cc-1]==a){cU[cc-1]="[";}}if(a=='"'){cI[cG++]="\\";}cI[cG++]=a;break;case 7:if(cG==cR){if(cG!=cr){cI[cG++]="+''+";}}else{cI[cG++]='"+';}cU[cc++]=cr|805306368,cU[cc++]=cI[cG++]="{{",b4++,cR=cr=cG,b0=0;if(dw&&cU[cc-3]!=bP["$"]){ca.push(dw,"#");dw=null,dj++;}break;case 9:if(cU[cc-1]=="'"||cU[cc-1]=='"'||((cH!=3||cK=="$")&&cK!=")")){if(dw){ca.push(dw,"#"),dj++;}dw=null;if((j=bP[cK])&&cI[cG-1]==cK){cG--;}else{j=cg[0];}if(cG==cR){if(cG!=cr){cI[cG++]="+";}}else{cI[cG++]='"+';}cU[cc++]=cr|805306368,cU[cc++]=cI[cG++]=j,b4++,cR=cr=cG,b0=3;}else{if(cG==cR){cI[cG]=(cG++==cr)?'"':'+"';}cU[cc++]=cr|1610612736,cU[cc++]=cI[cG++]="[";}break;case 10:cc--,b0=(d=cU[--cc])>>28,d=d&268435455;if(b0==6){if(cU[cc+1]!="["){throw {t:"In xpath, cannot close "+cU[cc+1]+" with "+a,p:l};}if(cG==cR){cI[cG]=(cG++==cr)?'"':'+"';}cI[cG++]="]";b0=3;}else{if(cG==cr){if((cU[cc]>>28)<=1){cI[cr-1]="[",cI[cG++]="]";}else{cI[cr-1]=cI[cG++]='"';}cR=cG;}else{if(cG!=cR){cI[cG++]='"';}if(cR==cr){i=cI.slice(cR+1,cG-1).join("");if(bR&&cI[cr-1]!=","&&i!=(d=i.replace(cT,"$1self::"))&&cU[cc+1]!=bP["$"]){cI[cr+1]=i=d;for(d=cr+2;d<cG-1;d++){cI[d]="";}}}else{if((d=cI[cr-1])!=","){i="#";if(bR){cI[cr-1]=d+"_injself(",cI[cG++]=")";}}else{i="";}}if(cU[cc+1]!=bP["$"]&&i){ca.push(dw,i);if(dw){dj++;}}cI[cG++]=") ",cR=cG;if(b0==7){cI[cG++]='+"\\"',b0=4;}}b4--,dw=null;if(!b4){c1++,c5++;}}cr=d;break;case 11:if(cG==cR){cI[cG]=(cG++==cr)?'"':'+"';}cU[cc++]=cr|805306368,cU[cc++]=cI[cG++]="(";break;case 12:if(cG==cR){cI[cG]=(cG++==cr)?'"':'+"';}if(ds[i=cU[--cc]]!=(cI[cG++]=a)){throw {t:"Cannot close "+i+" with "+a,p:l};}cr=cU[--cc]&268435455;break;case 15:throw {t:"Unexpected end whilst parsing xpath",p:l};break;default:if(cG==cR){cI[cG]=(cG++==cr)?'"':'+"';}cI[cG++]=a;break;}break;case 4:switch(m){case 0:if(cG==cR){cI[cG++]='+"';}cI[cG++]=" ",cH=0;break;case 1:if(cG==cR){cI[cG++]='+"';}dE++,ci=l,cI[cG++]="\\n",cH=1;break;case 2:if(cG==cR){cI[cG++]='+"';}if(a=="/"&&cK=="<"){cc-=4;if(cU[cc]||cU[cc+2]){throw {t:"Unexpected closing tag whilst parsing xml",p:l};}}else{if(a==":"&&cH==3&&cI[cG-2]=="<"){b2=cK;}}cI[cG++]=cD[a]||a;break;case 3:if(cG==cR){cI[cG++]='+"';}if(a.charAt(a.length-1)=="$"){cI[cG++]=a.slice(0,-1);cI[cG++]=a="$";}else{cI[cG++]=a;}break;case 5:if(cG==cR){cI[cG++]='+"';}if(a=='"'){cI[cG++]="\\";}cI[cG++]=a;break;case 6:if(a=="//"&&!cU[cc-1]){if(cG==cR){cI[cG++]='+"';}cI[cG++]=a;}else{if(a=="*/"){throw {t:"Unmatched comment "+a,p:l};}o=b0,cO=cK,dx=cH,b0=6,bY=a;}break;case 13:b2=null;if(cG==cR){cI[cG++]='+"';}cI[cG++]=a,cU[cc]=cU[cc+2]=0,cc+=4,cU[cc-1]=0;break;case 14:if(cG==cR){cI[cG++]='+"';}cI[cG++]=a;if(cK!="<"){if(cK=="/"){cc-=4;if(cU[cc+2]){throw {t:"Unexpected / whilst parsing xml",p:l};}if(cI[cG-3]=="<"){cG-=2,cI[cG-1]="";}}else{cc-=2;}if(cU[cc]){b4--,cI[cG++]='"',cr=cU[cc],cR=cG,b0=cr>>28,cr=cr&268435455;}else{cU[cc-1]=1;}}else{cG--,cI[cG-1]="";}break;case 9:dw=null;if(cK=="!"&&cI[cG-2]=="<"&&!cU[cc-1]){cI[cG++]=a,cU[cc++]=cr|(b0<<28);cU[cc++]="]]>",cr=cR=cG-1;b4++,b0=5;}else{if(cU[cc-1]){if((i=c2[cK])){cG--;}else{i=cg[b2?c6:0];}cU[cc++]=cr|1073741824;}else{cU[cc++]=cr|1073741824;if((i=cf[cK])){cG--;if(cI[cG-1]=="="){cK="=";}}else{i=cg[b2?dz:0];}if(cK=="="){cI[cG++]='\\"',cU[cc-1]=cr|1879048192;}}cI[cG]=(cG++==cR)?"+''+":'"+';b4++,cU[cc++]=cI[cG++]=i,cR=cr=cG,b0=3;}break;case 7:if(cK=="="){cI[cG++]='\\"',cU[cc++]=cr|1879048192;}else{cU[cc++]=cr|1073741824;}cI[cG]=(cG++==cR)?"+''+":'"+';cU[cc++]=cI[cG++]="{{",b4++;cR=cr=cG,b0=0;break;default:if(cG==cR){cI[cG++]='+"';}cI[cG++]=a;break;case 15:throw {t:"Unexpected end whilst parsing xml",p:l};break;}break;case 5:switch(m){case 1:dE++,ci=l;if(cG==cR){cI[cG]=(cG++==cr)?'"':'+"';}cI[cG++]="\\n";break;case 2:if(a=="/"&&cU[cc-1]=="/"){cI[cG++]="/",cr=cU[cc-=2],cR=cG,b0=cr>>28,cr=cr&268435455,b4--;}else{if(cG==cR){cI[cG]=(cG++==cr)?'"':'+"';}cI[cG++]=(cU[cc-1]!="/"&&b6[a])||a;}break;case 3:if(cG==cR){cI[cG]=(cG++==cr)?"":'+"';}if(a.charAt(a.length-1)=="$"){cI[cG++]=a.slice(0,-1);cI[cG++]=a="$";}else{cI[cG++]=a;}break;case 5:if(cU[cc-1]==a){if(cr!=cR){cI[cG]=(cG++!=cR)?(a+")"):")";}else{cI[cG++]=a;}cr=cU[cc-=2],cR=cG,b0=cr>>28;cr=cr&268435455,b4--;}else{if(cG==cR){cI[cG]=(cG++==cr)?'"':'+"';}cI[cG++]=a=='"'?'\\"':a;}break;case 6:if(cU[cc-1]=="/"&&a=="*/"){cI[cG++]="*/",cr=cU[cc-=2],cR=cG,b0=cr>>28,cr=cr&268435455,b4--;}else{if(cG==cR){cI[cG]=(cG++==cr)?"":'+"';}cI[cG++]=a;}break;case 7:if(cU[cc-1]!="'"&&cU[cc-1]!="/"){if(cU[cc-1]=='"'){cI[cr]='("';}if(cG==cR){if(cG!=cr){cI[cG++]="+";}}else{cI[cG++]='"+';}cU[cc++]=cr|1342177280,cI[cG++]=cU[cc++]="{{",b4++,cR=cr=cG,b0=0;}else{cI[cG++]=a;}break;case 9:if(cU[cc-1]!="'"&&cU[cc-1]!="/"&&(cU[cc-1]=='"'&&(cI[cr]='("')||cG!=cr+2||cK!="CDATA")){dw=null;if((j=bP[cK])&&cI[cG-1]==cK){cG--;}else{j=cg[0];}if(cG!=cr){cI[cG]=(cG++==cR)?"+":'"+';}cU[cc++]=cr|1342177280,cU[cc++]=cI[cG++]=j,cR=cr=cG,b4++,b0=3;}else{cI[cG++]=a;}break;case 14:if(cG==cR){cI[cG]=(cG++==cr)?"":'+"';}cI[cG++]=a;if(cU[cc-1]=="]]>"&&cK=="]"&&cI[cG-3]=="]"){cr=cU[cc-=2],b0=cr>>28;cr=cr&268435455,b4--;cc-=4;if(cU[cc]){b4--,cI[cG++]='"',cr=cU[cc],cR=cG,b0=cr>>28,cr=cr&268435455;}else{cU[cc-1]=1;}}break;case 15:throw {t:"Unexpected end whilst parsing string",p:l};break;default:if(cG==cR){cI[cG]=(cG++==cr)?"":'+"';}cI[cG++]=a;break;}break;case 6:switch(m){case 1:dE++,ci=l;if(bY=="//"){b0=o,a=cK=cO,m=cH=dx;}break;case 6:if((bY=="/*"&&a=="*/")||(bY=="<!--"&&a=="-->")){b0=o,a=cK=cO,m=cH=dx;}break;case 15:throw {t:"Unexpected end whilst parsing comment",p:l};break;}break;}if(m>1){cK=a,cH=m;}}this.lastCode=function(){if(typeof(cI)=="object"){return cI.join("");}return cI;};function bV(a,d,c){if(a.t){throw new Error(apf.formatErrorString(0,null,"Parsing live markup source","Error whilst parsing: "+a.t+" on line:"+dE+" col:"+(a.p-d-2)+(c?(" part: "+c):"")+"\n"+cX));}else{throw new Error(apf.formatErrorString(0,null,"Compiling live markup function","Error whilst compiling: "+a.message+"\nInput:\n"+cX+"\nGenerated:\n"+apf.lm.lastCode()));}}var c4={},dk={};this.resetCache=function(){c4={};};this.compile=function(i,l){if(!l){l=dk;}if(i==null||!i.length){return l.nostring?function(){return i;}:{type:2,str:i};}var c,j,a=(l.xpathmode|(l.withopt&&16)|(l.precall&&32)|(l.alwayscb&&64)|(l.nostring&&128)|(l.parsecode&&256)|(l.nostate&&512)|(l.editable&&1024)|(l.langedit&&2048)|(l.injectself&&4096)|(l.event&&8192))+i;if(c=c4[a]){return c;}bR=l.injectself,dA=l.xpathmode||0,dz=l.nostate?0:6,c6=l.editable?7:0;c2=l.langedit?cM:cB;dy={},ca=[],cU=[],cI=["","","",""],cX=i,cx=cX.length;cG=cr=cR=cI.length,c1=c5=cW=dj=b4=dE=cH=ci=0;if(l.parsecode){b0=0,cc=2,cU[0]=cG,cU[1]="{{",cK="{",cZ=l.event?"":(dA<=1?cC:cz);}else{b0=2,cc=cK=0,cZ=cC;}if(l.nothrow){cX.replace(cV,dB);}else{try{cX.replace(cV,dB);}catch(d){bV(d,ci);return null;}}if(l.parsecode){if(b4||cU[cc-1].length==1){bV({t:"Unclosed "+cU[cc-1]+" found at end in codemode",p:cx},ci);}if(cR!=cG){c1++;}}if(!l.nostring&&(b0==2&&cR==4||cG==4)){return{type:2,str:cI.slice(5,-1).join("").replace(/\\n/g,"\n").replace(/\\"/g,'"')};}if(cW||l.alwayscb){if(l.event){if(b0==1){cI[3]="";}cI[cG++]=b1;}else{if(dA){if(b0==1){cI[3]=(cI[3]!=cJ)?cA:bt,cI[cG++]=bZ;}else{cI[3]=dt,cI[cG++]=dV;}}else{if(b0==1){cI[3]=(cI[3]!=cJ)?di:dg,cI[cG++]=cb;}else{cI[3]=cw,cI[cG++]=ce;}}}if(l.withopt){cI[2]=ck,cI[cG++]=b7;}if(cW){if(l.precall){cI[1]=dT,cI[cG++]=cn;}else{cI[1]=dS,cI[cG++]=cl;}}cI[0]=l.event?df:((dA==1||dA==3)?c9:ct);cI[cG++]=cN;}else{if(l.event){if(b0==1){cI[3]="";}}else{if(dA){if(b0==1){cI[3]=(cI[3]!=cJ)?cA:bt,cI[cG++]=cj;}else{cI[3]=dU,cI[cG++]=cp;}}else{if(b0==1){cI[3]=(cI[3]!=cJ)?di:dg,cI[cG++]=cY;}else{cI[3]=cQ,cI[cG++]=dM;}}}if(l.withopt){cI[2]=ck,cI[cG++]=b7;}cI[0]=l.event?(l.withopt?b9:da):(l.withopt?((dA==1||dA==3)?bT:bU):((dA==1||dA==3)?cS:bS));cI[cG++]=cN;}if(l.nothrow){j=apf.lm_exec.compile(cI.join(""));}else{try{j=apf.lm_exec.compile(cI.join(""));}catch(d){bV(d,ci);return null;}}j.type=(c1==1&&c5==1)?3:1;j.xpaths=ca,j.models=dj,j.props=dy,j.asyncs=cW;c4[a]=j;return j;};this.compileMatch=function(i,n){if(!n){n=dk;}dy={},ca=[],cI=[cd,b5],cU=[],b4=0,cG=cI.length,c2=cB;for(var m,l,j=0,c=i.length;j<c;j+=2){if(cX=i[j]){cx=cU.length,dA=2;if(j){cI[cG++]=cu;}cI[cG++]="";cU[0]=l=cG=cr=cR=cI.length,cZ=cz;dE=cH=c1=c5=cW=b0=ci=0;cc=2,cU[1]="{{",cK="{";bR=1;if(n.nothrow){cX.replace(cV,dB);}else{try{cX.replace(cV,dB);}catch(a){bV(a,ci);return null;}}if(b4||cU[cc-1].length==1){bV({t:"Unclosed "+cU[cc-1]+" found at end in codemode",p:cx});}if(cW){bV({t:"Asynchronous calls not supported in match/value"});}if(b0==1){cI[l-1]=(cI[l-1]!=cJ)?cZ:"",cI[cG++]=cs;}else{cI[l-1]=cE,cI[cG++]=dI;}}if(cX=i[j+1]){cx=cU.length;if(!i[j]&&j){cI[cG++]=cu;}cI[cG++]="";l=cG=cr=cR=cI.length,cZ=cC;dA=bR=cK=cc=dE=c1=c5=cH=cW=ci=0;if(n.node){dA=2;}b0=2,bR=0;if(n.nothrow){cX.replace(cV,dB);}else{try{cX.replace(cV,dB);}catch(a){bV(a,ci);return null;}}if(cW){bV({t:"Asynchronous calls not supported in match/value"});}if(n.node){if(b0==2&&cR==l||cG==l){cI[l-1]=b3;}else{cI[l-1]=bX,cI[cG++]=c8;}}else{if(b0==2&&cR==l||cG==l){cI[l-1]=b8;}else{cI[l-1]=du,cI[cG++]=dW;}}if(i[j]){cI[cG++]=de;}else{break;}}else{if(!i[j]){bV({t:"Both match and value are empty"});}if(n.node){cI[cG++]=dv;}else{cI[cG++]=bO;}dA=2;cI[cG++]=de;}}cI[cG++]=cN;var d;if(n.nothrow){d=apf.lm_exec.compile(cI.join(""));}else{try{d=apf.lm_exec.compile(cI.join(""));}catch(a){bV(a,ci);return null;}}d.type=1,d.xpaths=ca,d.props=dy,d.asyncs=cW;return d;};this.setWarnLevel=function(a){apf.lm_exec.setWarnLevel(a);};})();apf.lm_exec=new (function(){var wlvl=3;this.setWarnLevel=function(lvl){wlvl=lvl;};function wxpath(x,t){apf.console.warn("Live Markup warning in "+t+", no results for xpath: '"+x+"'");}function wnode(x,t){apf.console.warn("Live Markup warning in "+t+", xpath on null node: '"+x+"'");}function wmodel(m,x,t){apf.console.warn("Live Markup warning in "+t+", xpath on empty model: '"+m+"' xpath: '"+x+"'");}function wlang(x,t){apf.console.warn("Live Markup warning in "+t+", language symbol not found: '"+x+"'");}function xmlParse(str){var n=apf.getXmlDom("<_apflmlist_>"+str+"</_apflmlist_>");if(!n||!(n=n.documentElement)){return null;}return(n.firstChild==n.lastChild)?n.firstChild:n;}function __val(n,x){if(!n){return("");}return(n=(n.nodeType!=1&&n||(n=n.selectSingleNode(x))&&(n.nodeType!=1&&n||(n=n.firstChild)&&n.nodeType!=1&&n)))&&n.nodeValue||("");}function __valm(m,x){var n;if(!m||!(n=(m.charAt&&((m.charAt(0)=="<"&&xmlParse(m))||((n=apf.nameserver.lookup.model[m])&&n.data)))||(m.$isModel?m.data:(m.charAt?0:m)))){return("");}return(n=(n.nodeType!=1&&n||(n=n.selectSingleNode(x))&&(n.nodeType!=1&&n||(n=n.firstChild)&&n.nodeType!=1&&n)))&&n.nodeValue||("");}function __nod(n,x){return n?n.selectSingleNode(x):(null);}function _nods(n,x){return n?n.selectNodes(x):([]);}function __nodm(m,x){var n;if(!m||!(n=(m.charAt&&((m.charAt(0)=="<"&&xmlParse(m))||((n=apf.nameserver.lookup.model[m])&&n.data)))||(m.$isModel?m.data:(m.charAt?0:m)))){return(null);}return n.selectSingleNode(x);}function _nodsm(m,x){var n;if(!m||!(n=(m.charAt&&((m.charAt(0)=="<"&&xmlParse(m))||((n=apf.nameserver.lookup.model[m])&&n.data)))||(m.$isModel?m.data:(m.charAt?0:m)))){return([]);}return n.selectNodes(x);}function __cnt(n,x){return n?n.selectNodes(x).length:(0);}function __cntm(m,x){var n;if(!m||!(n=(m.charAt&&((m.charAt(0)=="<"&&xmlParse(m))||((n=apf.nameserver.lookup.model[m])&&n.data)))||(m.$isModel?m.data:(m.charAt?0:m)))){return(0);}return n.selectNodes(x).length;}function _xpt(n,x){return{xpath:x,toString:function(){return"LM Xpath object: "+this.x;}};}function _xptm(m,x){return{model:m,xpath:x,toString:function(){return"LM Xpath object with model: "+this.x;}};}function _xml(n,m,x){if(n){x=m;}else{if(!m||!(n=(m.charAt&&((m.charAt(0)=="<"&&xmlParse(m))||((n=apf.nameserver.lookup.model[m])&&n.data)))||(m.$isModel?m.data:(m.charAt?0:m)))){return("");}}return(n&&(n=n.selectSingleNode(x)))&&n.xml||("");}function _xmls(n,m,x){if(n){x=m;}else{if(!m||!(n=(m.charAt&&((m.charAt(0)=="<"&&xmlParse(m))||((n=apf.nameserver.lookup.model[m])&&n.data)))||(m.$isModel?m.data:(m.charAt?0:m)))){return("");}}for(var i=0,j=((n=n.selectNodes(x))).length,o=[];i<j;i++){o[i]=n[i].xml;}return o.join("");}function _valcr(n,cr,m,x){if(n){x=m;}else{if(!m||!(n=(m.charAt&&((m.charAt(0)=="<"&&xmlParse(m))||((n=apf.nameserver.lookup.model[m])&&n.data)))||(m.$isModel?m.data:(m.charAt?0:m)))){return("");}}if(cr){apf.createNodeFromXpath(ni,x);}else{if(n=ni.selectSingleNode(x)){return(n=(n.nodeType!=1&&n||(n=n.selectSingleNode(x))&&(n.nodeType!=1&&n||(n=n.firstChild)&&n.nodeType!=1&&n)))&&n.nodeValue||"";}}return("");}function _nodcr(n,cr,m,x){if(n){x=m;}else{if(!m||!(n=(m.charAt&&((m.charAt(0)=="<"&&xmlParse(m))||((n=apf.nameserver.lookup.model[m])&&n.data)))||(m.$isModel?m.data:(m.charAt?0:m)))){return(null);}}return n.selectSingleNode(x)||(cr&&apf.createNodeFromXpath(n,x));}function _valst(n,x){var m=apf.xmldb.findModel(n);if(!m){return("");}return"["+m.id+"::"+apf.xmlToXpath(n,m.data,true)+"/"+x+"]";}function _valed(n,m,x){if(n){x=m;}return"<div contenteditable='true' class='contenteditable'>CONTENT_EDITABLE_TODO</div>";}function _nod_del(n,m,x){if(n){x=m;}else{if(!m||!(n=(m.charAt&&((m.charAt(0)=="<"&&xmlParse(m))||((n=apf.nameserver.lookup.model[m])&&n.data)))||(m.$isModel?m.data:(m.charAt?0:m)))){return(null);}}if(!(n=n.selectSingleNode(x))){return(null);}apf.xmldb.removeNode(n);}function _nods_del(n,m,x){if(n){x=m;}else{if(!m||!(n=(m.charAt&&((m.charAt(0)=="<"&&xmlParse(m))||((n=apf.nameserver.lookup.model[m])&&n.data)))||(m.$isModel?m.data:(m.charAt?0:m)))){return(null);}}if(!(n=n.selectNodes(x))){return;}apf.xmldb.removeNodeList(n);}function _nod_asn(n,m,x,v){if(n){v=x,x=m;}else{if(!m||!(n=(m.charAt&&((m.charAt(0)=="<"&&xmlParse(m))||((n=apf.nameserver.lookup.model[m])&&n.data)))||(m.$isModel?m.data:(m.charAt?0:m)))){throw new Error(apf.formatErrorString(0,0,"LM Xpath Assign","Cannot assign to nonresolving model:"+m+"\nxpath:"+x+"\nvalue:"+v));}}if(!n||(x&&!(n=apf.createNodeFromXpath(n,x)))){throw new Error(apf.formatErrorString(0,0,"LM Xpath Assign","Cannot assign could not resolve \nxpath:"+x+"\nvalue:"+v));}var c;if(!v||(v.charAt&&(c=v.charAt(0)!="<"))||typeof(v)=="number"){apf.setNodeValue(n,v,true);return v;}if(!c){if(n.nodeType!=1){throw new Error(apf.formatErrorString(0,0,"LM Xpath Assign","Cannot assign to a non-element node\nxpath:"+x+"\nvalue:"+v));}if(!(c=xmlParse(v))){throw new Error(apf.formatErrorString(0,0,"LM Xpath append","Cannot append broken XML.\nxpath:"+x+"\nvalue:"+v));}if(c.tagName!="_apflmlist_"){return apf.xmldb.replaceNode(c,n);}else{c=c.childNodes;apf.xmldb.replaceNode(n=c[0],n);for(var i=0,j=c.length;i<j;i++){n=apf.xmldb.appendChild(n.parentNode,c[0],n.nextSibling);}return n;}}else{if(v.length){throw new Error(apf.formatErrorString(0,0,"LM Xpath Assign","Assign of xpath nodelists not yet supported\nxpath:"+x+"\nvalue:"+v));}else{if(!v.selectNodes){throw new Error(apf.formatErrorString(0,0,"LM Xpath Assign","Cannot assign non-element node\nxpath:"+x+"\nvalue:"+v));}if(v.nodeType==2){if(n.nodeType!=2){throw new Error(apf.formatErrorString(0,0,"LM Xpath Assign","Cannot assign attribute node to replace non attribute, use += xpath:"+x+"\nvalue:"+v));}apf.xmldb.removeAttribute(c=n.ownerElement||n.selectSingleNode(".."),n.nodeName);apf.xmldb.setAttribute(c,v.nodeName,v.nodeValue);c.getAttributeNode(v.nodeName);}else{apf.xmldb.replaceNode(v,n);}}}return v;}function _nods_asn(n,m,x,v){if(n){v=x,x=m;}else{if(!m||!(n=(m.charAt&&((m.charAt(0)=="<"&&xmlParse(m))||((n=apf.nameserver.lookup.model[m])&&n.data)))||(m.$isModel?m.data:(m.charAt?0:m)))){throw new Error(apf.formatErrorString(0,0,"LM Xpath Assign","Cannot assign to nonresolving model:"+m+"\nxpath:"+x+"\nvalue:"+v));}}for(var i=0,j=(n=n.selectNodes(x)).length;i<j;i++){_nod_asn(n[i],null,v);}return v;}function _nod_add(n,m,x,v){if(n){v=x,x=m;}else{if(!m||!(n=(m.charAt&&((m.charAt(0)=="<"&&xmlParse(m))||((n=apf.nameserver.lookup.model[m])&&n.data)))||(m.$isModel?m.data:(m.charAt?0:m)))){throw new Error(apf.formatErrorString(0,0,"LM Xpath append","Cannot append to nonresolving model:"+m+"\nxpath:"+x+"\nvalue:"+v));}}if(!n||(x&&!(n=n.selectSingleNode(x)))){return _nod_asn(n,0,x,v);}var c;if(!v||(v.charAt&&(c=v.charAt(0)!="<"))||typeof(v)=="number"){apf.setNodeValue(n,v=((n=(n.nodeType!=1&&n||(n=n.selectSingleNode(x))&&(n.nodeType!=1&&n||(n=n.firstChild)&&n.nodeType!=1&&n)))&&n.nodeValue||"")+v,true);return v;}if(!c){if(n.nodeType!=1){throw new Error(apf.formatErrorString(0,0,"LM Xpath append","Cannot append to a non-element node\nxpath:"+x+"\nvalue:"+v));}if(!(c=xmlParse(v))){throw new Error(apf.formatErrorString(0,0,"LM Xpath append","Cannot append broken XML.\nxpath:"+x+"\nvalue:"+v));}if(c.tagName!="_apflmlist_"){return apf.xmldb.appendChild(n.parentNode,xmlParse(v),n.nextSibling);}else{c=c.childNodes;for(var i=0,j=c.length;i<j;i++){n=apf.xmldb.appendChild(n.parentNode,c[0],n.nextSibling);}return n;}}else{if(v.length){throw new Error(apf.formatErrorString(0,0,"LM Xpath append","Nodelists not yet supported\nxpath:"+x+"\nvalue:"+v));}else{if(!v.selectNodes){throw new Error(apf.formatErrorString(0,0,"LM Xpath append","Cannot assign non-element node\nxpath:"+x+"\nvalue:"+v));}if(v.nodeType==2){if(n.nodeType!=1){throw new Error(apf.formatErrorString(0,0,"LM Xpath append","Cannot append attribute to anything but element node"));}apf.xmldb.setAttribute(c=n.ownerElement||n.selectSingleNode(".."),v.nodeName,v.nodeValue);apf.xmldb.removeAttribute(v.ownerElement||v.selectSingleNode(".."),v.nodeName);return c.getAttributeNode(v.nodeName);}else{return apf.xmldb.appendChild(n.parentNode,v,n.nextSibling);}}}}function _nods_add(n,m,x,v){if(n){v=x,x=m;}else{if(!m||!(n=(m.charAt&&((m.charAt(0)=="<"&&xmlParse(m))||((n=apf.nameserver.lookup.model[m])&&n.data)))||(m.$isModel?m.data:(m.charAt?0:m)))){throw new Error(apf.formatErrorString(0,0,"LM Xpath Assign","Cannot append to nonresolving model:"+m+"\nxpath:"+x+"\nvalue:"+v));}}for(var i=0,j=(n=n.selectNodes(x)).length;i<j;i++){_nod_add(n[i],null,v);}return v;}function _asn(o,p,v){if(!o||typeof(o)!="object"){throw new Error(apf.formatErrorString(0,0,"LM Property Assign","Cannot assign property on non object, property:"+p));}if(o.setAttribute){o.setAttribute(p,v);}else{o[p]=v;}return v;}function _add(o,p,v){return _asn(o,p,o&&o[p]+v);}function _sub(o,p,v){return _asn(o,p,o&&o[p]-v);}function _div(o,p,v){return _asn(o,p,o&&o[p]/v);}function _mul(o,p,v){return _asn(o,p,o&&o[p]*v);}function _local(n){if(n&&n.charAt&&n.charAt(0)=="<"){return apf.getXmlDom(n).documentElement;}return n;}function _tagName(n1,n2){return(n2&&n2.tagName)||(n1&&n1.tagName);}function _localName(n1,n2){return(n2&&n2[apf.TAGNAME])||(n1&&n1[apf.TAGNAME]);}function _nodeValue(n,n2){if(n2){n=n2;}return(n=(n.nodeType!=1&&n||(n.nodeType!=1&&n||(n=n.firstChild)&&n.nodeType!=1&&n)))&&n.nodeValue||"";}var langrx=/(\\*)\$\[(.*?)\]/g;var lang=apf.language;apf.$lm_has_lang=0;function _lngrx(tok,esc,x){apf.$lm_has_lang=1;if(esc){return"$["+x+"]";}return lang.words[x]||("");}function __ret(r){if(r&&r.indexOf&&r.indexOf("$[")!=-1){return r.replace(langrx,_lngrx);}return r;}function __lng(x,x2){apf.$lm_has_lang=1;return lang.words[x]||("");}function _lnged(x,x2){apf.$lm_has_lang=1;return lang.words[x]||("");}function _injself(s){return s.charAt?s.replace(selfrx,"$1self::"):s;}apf.$lmx=null;function _async(_n,_c,_a,_w,_f,_this,obj,func,args){var i=_a.i,v;if(!_a.ret){_a.ret=[];}if(_a[i]){return _a.ret[i];}_a[i]=true;if(!obj.exec){return _a.ret[i]=(func)?obj[func].apply(obj,args):obj.apply(obj,args);}if(_w&&_w._pc){_w._pc={obj:obj,func:func,args:args,_c:_c};}else{obj.exec(func,args,function(data,state,extra){if(state!=apf.SUCCESS){_c(null,state,extra);}else{apf.$lmx=extra;_a.ret[i]=data;if(_w){_f.call(_this,_n,_c,_w,_a);}else{_f.call(_this,_n,_c,_a);}}});}throw ({x:1});}function _pc(_w){var o;if(typeof(o=_w._pc)!="object"||!o){return;}o.obj.exec(o.func,o.args,o._c);throw ({x:1});}this.compile=function(code){var _ret=__ret,_val=__val,_valm=__valm,_nod=__nod,_nodm=__nodm,_cnt=__cnt,_cntm=__cntm,_lng=__lng;eval(code);return _f;};})();apf.url=function(t){var o;if(t.indexOf(":")==-1&&(o=location.toString()).indexOf(":")!=-1){o=new apf.url(o);t=apf.getAbsolutePath(o.protocol+"://"+o.host+"/"+(o.directory.charAt(o.directory.length-1)=="/"?o.directory:o.directory+"/"),t).replace(/\/\/\/\//,"///");}var m=apf.url.options,s=m.parser[m.strictMode?"strict":"loose"].exec(t),q=14;this.uri=t.toString();while(q--){this[m.key[q]]=s[q]||"";}this[m.q.name]={};var i=this;this[m.key[12]].replace(m.q.parser,function(a,c,d){if(c){i[m.q.name][c]=d;}});this.isSameLocation=function(){if(this.uri.length&&this.uri.charAt(0)=="#"){return false;}if(!this.protocol&&!this.port&&!this.host){return true;}if(!this.protocol&&this.host&&this.port&&window.location.hostname==this.host&&window.location.port==this.port){return true;}if(!this.protocol&&this.host&&!this.port&&window.location.hostname==this.host&&window.location.port==80){return true;}return window.location.protocol==(this.protocol+":")&&window.location.hostname==this.host&&(window.location.port==this.port||!window.location.port&&!this.port);};};apf.url.options={strictMode:false,key:["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],q:{name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},parser:{strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/}};apf.runXpath=function(){apf.XPath={cache:{},getSelf:function(htmlNode,tagName,info,count,num,sResult){var numfound=0,result=null,data=info[count];if(data){data[0](htmlNode,data[1],info,count+1,numfound++,sResult);}else{sResult.push(htmlNode);}},getChildNode:function(htmlNode,tagName,info,count,num,sResult){var numfound=0,result=null,data=info[count];var nodes=htmlNode.childNodes;if(!nodes){return;}for(var i=0;i<nodes.length;i++){if(tagName&&(tagName!=nodes[i].tagName)&&(nodes[i].style?nodes[i].tagName.toLowerCase():nodes[i].tagName)!=tagName){continue;}htmlNode=nodes[i];if(data){data[0](nodes[i],data[1],info,count+1,numfound++,sResult);}else{sResult.push(nodes[i]);}}},doQuery:function(htmlNode,qData,info,count,num,sResult){var result=null,data=info[count];var query=qData[0];var returnResult=qData[1];try{var qResult=eval(query);}catch(e){return;}if(returnResult){return sResult.push(qResult);}if(!qResult||qResult.dataType==apf.ARRAY&&!qResult.length){return;}if(data){data[0](htmlNode,data[1],info,count+1,0,sResult);}else{sResult.push(htmlNode);}},getTextNode:function(htmlNode,empty,info,count,num,sResult){var data=info[count],nodes=htmlNode.childNodes;for(var i=0;i<nodes.length;i++){if(nodes[i].nodeType!=3&&nodes[i].nodeType!=4){continue;}if(data){data[0](nodes[i],data[1],info,count+1,i,sResult);}else{sResult.push(nodes[i]);}}},getAnyNode:function(htmlNode,empty,info,count,num,sResult){var data=info[count],nodes=htmlNode.getElementsByTagName("*");for(var i=0;i<nodes.length;i++){if(data){data[0](nodes[i],data[1],info,count+1,i,sResult);}else{sResult.push(nodes[i]);}}},getAttributeNode:function(htmlNode,attrName,info,count,num,sResult){if(!htmlNode||htmlNode.nodeType!=1){return;}if(attrName=="*"){var nodes=htmlNode.attributes;for(var i=0;i<nodes.length;i++){arguments.callee.call(this,htmlNode,nodes[i].nodeName,info,count,i,sResult);}return;}var data=info[count],value=htmlNode.getAttributeNode(attrName);if(data){data[0](value,data[1],info,count+1,0,sResult);}else{if(value){sResult.push(value);}}},getAllNodes:function(htmlNode,x,info,count,num,sResult){var data=info[count],tagName=x[0],inclSelf=x[1],prefix=x[2],nodes,i,l;if(inclSelf&&(htmlNode.tagName==tagName||tagName=="*")){if(data){data[0](htmlNode,data[1],info,count+1,0,sResult);}else{sResult.push(htmlNode);}}if(tagName=="node()"){tagName="*";prefix="";if(apf.isIE){nodes=htmlNode.getElementsByTagName("*");}else{nodes=[];(function recur(x){for(var n,i=0;i<x.childNodes.length;i++){n=x.childNodes[i];if(n.nodeType!=1){continue;}nodes.push(n);recur(n);}})(htmlNode);}}else{nodes=htmlNode.getElementsByTagName((prefix&&(apf.isGecko||apf.isOpera||htmlNode.nodeFunc)?prefix+":":"")+tagName);}for(i=0,l=nodes.length;i<l;i++){if(data){data[0](nodes[i],data[1],info,count+1,i,sResult);}else{sResult.push(nodes[i]);}}},getAllAncestorNodes:function(htmlNode,x,info,count,num,sResult){var data=info[count],tagName=x[0],inclSelf=x[1],i=0,s=inclSelf?htmlNode:htmlNode.parentNode;while(s&&s.nodeType==1){if(s.tagName==tagName||tagName=="*"||tagName=="node()"){if(data){data[0](s,data[1],info,count+1,++i,sResult);}else{sResult.push(s);}}s=s.parentNode;}},getParentNode:function(htmlNode,empty,info,count,num,sResult){var data=info[count],node=htmlNode.parentNode;if(data){data[0](node,data[1],info,count+1,0,sResult);}else{if(node){sResult.push(node);}}},getPrecedingSibling:function(htmlNode,tagName,info,count,num,sResult){var data=info[count],node=htmlNode.previousSibling;while(node){if(tagName!="node()"&&(node.style?node.tagName.toLowerCase():node.tagName)!=tagName){node=node.previousSibling;continue;}if(data){data[0](node,data[1],info,count+1,0,sResult);}else{if(node){sResult.push(node);break;}}}},getFollowingSibling:function(htmlNode,tagName,info,count,num,sResult){var result=null,data=info[count];var node=htmlNode.nextSibling;while(node){if(tagName!="node()"&&(node.style?node.tagName.toLowerCase():node.tagName)!=tagName){node=node.nextSibling;continue;}if(data){data[0](node,data[1],info,count+1,0,sResult);}else{if(node){sResult.push(node);break;}}}},multiXpaths:function(contextNode,list,info,count,num,sResult){for(var i=0;i<list.length;i++){info=list[i][0];var rootNode=(info[3]?contextNode.ownerDocument.documentElement:contextNode);info[0](rootNode,info[1],list[i],1,0,sResult);}sResult.makeUnique();},compile:function(sExpr){var isAbsolute=sExpr.match(/^\//);sExpr=sExpr.replace(/\[(\d+)\]/g,"/##$1").replace(/\|\|(\d+)\|\|\d+/g,"##$1").replace(/\.\|\|\d+/g,".").replace(/\[([^\]]*)\]/g,function(match,m1){return"/##"+m1.replace(/\|/g,"_@_");});if(sExpr=="/"||sExpr=="."){return sExpr;}return this.processXpath(sExpr.replace(/\/\//g,"descendant::"),isAbsolute);},processXpath:function(sExpr,isAbsolute){var results=[],i,l,m,query;sExpr=sExpr.replace(/'[^']*'/g,function(m){return m.replace("|","_@_");});sExpr=sExpr.split("|");for(i=0,l=sExpr.length;i<l;i++){sExpr[i]=sExpr[i].replace(/_\@\_/g,"|");}if(sExpr.length==1){sExpr=sExpr[0];}else{for(i=0,l=sExpr.length;i<l;i++){sExpr[i]=this.processXpath(sExpr[i]);}results.push([this.multiXpaths,sExpr]);return results;}var sections=sExpr.split("/");for(i=0,l=sections.length;i<l;i++){if(sections[i]=="."||sections[i]==""){continue;}else{if(sections[i]==".."){results.push([this.getParentNode,null]);}else{if(sections[i].match(/^[\w-_\.]+(?:\:[\w-_\.]+){0,1}$/)){results.push([this.getChildNode,sections[i]]);}else{if(sections[i].match(/^\#\#(\d+)$/)){results.push([this.doQuery,["num+1 == "+parseInt(RegExp.$1)]]);}else{if(sections[i].match(/^\#\#(.*)$/)){query=RegExp.$1;m=[query.match(/\(/g),query.match(/\)/g)];if(m[0]||m[1]){while(!m[0]&&m[1]||m[0]&&!m[1]||m[0].length!=m[1].length){if(!sections[++i]){break;}query+="/"+sections[i];m=[query.match(/\(/g),query.match(/\)/g)];}}results.push([this.doQuery,[this.compileQuery(query)]]);}else{if(sections[i]=="*"){results.push([this.getChildNode,null]);}else{if(sections[i].substr(0,2)=="[]"){results.push([this.getAllNodes,["*",false]]);}else{if(sections[i].match(/descendant-or-self::node\(\)$/)){results.push([this.getAllNodes,["*",true]]);}else{if(sections[i].match(/descendant-or-self::([^\:]*)(?:\:(.*)){0,1}$/)){results.push([this.getAllNodes,[RegExp.$2||RegExp.$1,true,RegExp.$1]]);}else{if(sections[i].match(/descendant::([^\:]*)(?:\:(.*)){0,1}$/)){results.push([this.getAllNodes,[RegExp.$2||RegExp.$1,false,RegExp.$1]]);}else{if(sections[i].match(/ancestor-or-self::([^\:]*)(?:\:(.*)){0,1}$/)){results.push([this.getAllAncestorNodes,[RegExp.$2||RegExp.$1,true,RegExp.$1]]);}else{if(sections[i].match(/ancestor::([^\:]*)(?:\:(.*)){0,1}$/)){results.push([this.getAllAncestorNodes,[RegExp.$2||RegExp.$1,false,RegExp.$1]]);}else{if(sections[i].match(/^\@(.*)$/)){results.push([this.getAttributeNode,RegExp.$1]);}else{if(sections[i]=="text()"){results.push([this.getTextNode,null]);}else{if(sections[i]=="node()"){results.push([this.getChildNode,null]);}else{if(sections[i].match(/following-sibling::(.*)$/)){results.push([this.getFollowingSibling,RegExp.$1.toLowerCase()]);}else{if(sections[i].match(/preceding-sibling::(.*)$/)){results.push([this.getPrecedingSibling,RegExp.$1.toLowerCase()]);}else{if(sections[i]=="self::node()"){results.push([this.getSelf,null]);}else{if(sections[i].match(/self::(.*)$/)){results.push([this.doQuery,["apf.XPath.doXpathFunc(htmlNode, 'local-name') == '"+RegExp.$1+"'"]]);}else{query=sections[i];m=[query.match(/\(/g),query.match(/\)/g)];if(m[0]||m[1]){while(!m[0]&&m[1]||m[0]&&!m[1]||m[0].length!=m[1].length){if(!sections[++i]){break;}query+="/"+sections[i];m=[query.match(/\(/g),query.match(/\)/g)];}}results.push([this.doQuery,[this.compileQuery(query),true]]);}}}}}}}}}}}}}}}}}}}}results[0][3]=isAbsolute;return results;},compileQuery:function(code){return new apf.CodeCompilation(code).compile();},doXpathFunc:function(contextNode,type,nodelist,arg2,arg3,xmlNode){if(!nodelist||nodelist.length==0){nodelist="";}if(type=="not"){return !nodelist;}var arg1,i,l;if(typeof nodelist=="object"||nodelist.dataType==apf.ARRAY){if(nodelist&&!nodelist.length){nodelist=[nodelist];}var res=false,value;for(i=0,l=nodelist.length;i<l;i++){xmlNode=nodelist[i];if(!xmlNode||typeof xmlNode=="string"){value=xmlNode;}else{if(xmlNode.nodeType==1&&xmlNode.firstChild&&xmlNode.firstChild.nodeType!=1){xmlNode=xmlNode.firstChild;}value=xmlNode.nodeValue;}if(res=arguments.callee.call(this,contextNode,type,value,arg2,arg3,xmlNode)){return res;}}return res;}else{arg1=nodelist;}switch(type){case"position":return apf.getChildNumber(contextNode)+1;case"format-number":return apf.formatNumber(arg1);case"floor":return Math.floor(arg1);case"ceiling":return Math.ceil(arg1);case"starts-with":return arg1?arg1.substr(0,arg2.length)==arg2:false;case"string-length":return arg1?arg1.length:0;case"count":return arg1?arg1.length:0;case"last":return arg1?arg1[arg1.length-1]:null;case"local-name":return(xmlNode?xmlNode.tagName:contextNode.tagName).split(":").pop();case"substring":return arg1&&arg2?arg1.substring(arg2,arg3||0):"";case"contains":return arg1&&arg2?arg1.indexOf(arg2)>-1:false;case"concat":var str="";for(i=1,l=arguments.length;i<l;i++){if(typeof arguments[i]=="object"){str+=getNodeValue(arguments[i][0]);continue;}str+=arguments[i];}return str;case"translate":for(i=0,l=arg2.length;i<l;i++){arg1=arg1.replace(arg2.substr(i,1),arg3.substr(i,1));}return arg1;}},selectNodeExtended:function(sExpr,contextNode,match){var sResult=this.selectNodes(sExpr,contextNode);if(sResult.length==0){return null;}if(!match){return sResult;}for(var i=0,l=sResult.length;i<l;i++){if(getNodeValue(sResult[i])==match){return[sResult[i]];}}return null;},getRoot:function(xmlNode){while(xmlNode.parentNode&&xmlNode.parentNode.nodeType==1){xmlNode=xmlNode.parentNode;}return xmlNode;},selectNodes:function(sExpr,contextNode){if(!this.cache[sExpr]){this.cache[sExpr]=this.compile(sExpr);}if(typeof this.cache[sExpr]=="string"){if(this.cache[sExpr]=="."){return[contextNode];}if(this.cache[sExpr]=="/"){return[(contextNode.nodeType==9?contextNode.documentElement:this.getRoot(contextNode))];}}if(typeof this.cache[sExpr]=="string"&&this.cache[sExpr]=="."){return[contextNode];}var info=this.cache[sExpr][0],rootNode=(info[3]?(contextNode.nodeType==9?contextNode.documentElement:this.getRoot(contextNode)):contextNode),sResult=[];info[0](rootNode,info[1],this.cache[sExpr],1,0,sResult);return sResult;}};function getNodeValue(sResult){if(sResult.nodeType==1){return sResult.firstChild?sResult.firstChild.nodeValue:"";}if(sResult.nodeType>1||sResult.nodeType<5){return sResult.nodeValue;}return sResult;}apf.CodeCompilation=function(code){this.data={F:[],S:[],I:[],X:[]};this.compile=function(){code=code.replace(/ or /g," || ").replace(/ and /g," && ").replace(/!=/g,"{}").replace(/=/g,"==").replace(/\{\}/g,"!=");this.tokenize();this.insert();code=code.replace(/, \)/g,", htmlNode)");return code;};this.tokenize=function(){var data=this.data.F;code=code.replace(/(translate|format-number|contains|substring|local-name|last|position|round|starts-with|string|string-length|sum|floor|ceiling|concat|count|not)\s*\(/g,function(d,match){return(data.push(match)-1)+"F_";});data=this.data.S;code=code.replace(/'([^']*)'/g,function(d,match){return(data.push(match)-1)+"S_";}).replace(/"([^"]*)"/g,function(d,match){return(data.push(match)-1)+"S_";});data=this.data.X;code=code.replace(/(^|\W|\_)([\@\.\/A-Za-z\*][\*\.\@\/\w\-]*(?:\(\)){0,1})/g,function(d,m1,m2){return m1+(data.push(m2)-1)+"X_";}).replace(/(\.[\.\@\/\w]*)/g,function(d,m1,m2){return(data.push(m1)-1)+"X_";});data=this.data.I;code=code.replace(/(\d+)(\W)/g,function(d,m1,m2){return(data.push(m1)-1)+"I_"+m2;});};this.insert=function(){var data=this.data;code=code.replace(/(\d+)X_\s*==\s*(\d+S_)/g,function(d,nr,str){return"apf.XPath.selectNodeExtended('"+data.X[nr].replace(/'/g,"\\'")+"', htmlNode, "+str+")";}).replace(/(\d+)([FISX])_/g,function(d,nr,type){var value=data[type][nr];if(type=="F"){return"apf.XPath.doXpathFunc(htmlNode, '"+value+"', ";}else{if(type=="S"){return"'"+value+"'";}else{if(type=="I"){return value;}else{if(type=="X"){return"apf.XPath.selectNodeExtended('"+value.replace(/'/g,"\\'")+"', htmlNode)";}}}}}).replace(/, \)/g,")");};};};apf.BindingRule=function(i,d){this.$init(d||true,apf.NODE_HIDDEN,i);};(function(){this.$bindingRule=true;this.compile=function(c){return(this["c"+c]=apf.lm.compile(this[c],{xpathmode:3,injectself:true}));};this.$compile=function(i,d){return(this["c"+i+"2"]=apf.lm.compile(this[i],d));};this.$attrExcludePropBind=apf.extend({value:1,match:1},this.$attrExcludePropBind);this.$propHandlers.value=this.$propHandlers.match=function(l,j){delete this["c"+j];if(this.$amlLoaded){var i=this;while(i&&i.$bindingRule){i=i.parentNode;}if(!i){return;}apf.queue.add("reload"+i.$uniqueId,function(){i.reload();});if(i.$bindings.$isCompiled){i.$bindings.$compiled=i.$bindings.compile(this.localName!="each"&&this.localName);}}};this.addEventListener("DOMNodeInserted",function(i){var d=this;while(d.$bindingRule){d=d.parentNode;}apf.queue.add("reload"+d.$uniqueId,function(){d.reload();});if(i.currentTarget==this){(d.$bindings[this.localName]||(d.$bindings[this.localName]=[])).push(this);}else{if(!this.attributes.getNamedItem("value")){this.value=apf.serializeChildren(this);}else{return;}}if(d.$bindings.$isCompiled){d.$bindings.$compiled=d.$bindings.compile(this.localName!="each"&&this.localName);}});this.addEventListener("DOMNodeRemoved",function(l){var j,i=this;while(i&&i.$bindingRule){i=i.parentNode;}if(!i){return;}if(l.currentTarget==this){if(i.$bindings&&i.$bindings[this.localName]){i.$bindings[this.localName].remove(this);}else{return;}}else{if(!this.attributes.getNamedItem("value")&&(j=this.firstChild)){if(j.nodeType==this.NODE_PROCESSING_INSTRUCTION){if(j.target=="lm"){this.value="{"+j.nodeValue+"}";}else{this.value=j.nodeValue;}}else{this.value=apf.serializeChildren(this).trim();}}else{return;}}apf.queue.add("reload"+i.$uniqueId,function(){i.reload();});if(i.$bindings.$isCompiled){i.$bindings.$compiled=i.$bindings.compile(this.localName!="each"&&this.localName);}});this.addEventListener("DOMNodeInsertedIntoDocument",function(o){var n;if(!this.value&&(n=this.$aml&&this.$aml.firstChild||this.firstChild)){if(n.nodeType==this.NODE_PROCESSING_INSTRUCTION){if(n.target=="lm"){this.value="{"+n.nodeValue+"}";}else{this.value=n.nodeValue;}}else{this.value=apf.serializeChildren(this.$aml).trim();}}var l=this.parentNode;while(l.$bindingRule){l=l.parentNode;}var m=l.$bindings||(l.$bindings=new apf.ruleList());(m[this.localName]||(m[this.localName]=[])).push(this);if(l.localName!="bindings"&&(this.localName!="each"||!this.childNodes.length)){var q=this;while((q=q.nextSibling)&&q.nodeType!=1){}if(!q||!q.$bindingRule){l.$cbindings=l.$bindings.compile(l.$bindings.$isCompiled?this.localName:null);l.dispatchEvent("bindingsload",{bindings:l.$bindings,compiled:l.$cbindings});l.$checkLoadQueue();}}});}).call(apf.BindingRule.prototype=new apf.AmlElement());apf.aml.setElement("icon",apf.BindingRule);apf.aml.setElement("image",apf.BindingRule);apf.aml.setElement("caption",apf.BindingRule);apf.aml.setElement("css",apf.BindingRule);apf.aml.setElement("selectable",apf.BindingRule);apf.aml.setElement("value",apf.BindingRule);apf.aml.setElement("src",apf.BindingRule);apf.aml.setElement("collapsed",apf.BindingRule);apf.aml.setElement("empty",apf.BindingRule);apf.toc=function(i,d){this.$init(d||"toc",apf.NODE_VISIBLE,i);};(function(){this.$supportedProperties.push("represent");this.$propHandlers.represent=function(i){var d=this;$setTimeout(function(){var a=d.$represent=self[i];a.addEventListener("afterswitch",function(c){d.$setActivePage(c.nextId);});if(a.$drawn){d.$createReflection();}else{a.$amlLoaders.push(function(){toc.$createReflection();});}});};this.gotoPage=function(o){if(this.disabled){return false;}if(this.$represent.isValid&&!this.$represent.testing){var q,i,s=this.$represent.getPages(),t=this.$represent.activepagenr;for(q=t;q<o;q++){s[q].$ext.style.position="absolute";s[q].$ext.style.top="-10000px";s[q].$ext.style.display="block";i=!this.$represent.isValid||this.$represent.isValid(q<t,q<t,s[q]);s[q].$ext.style.display="";s[q].$ext.style.position="";s[q].$ext.style.top="";s[q].$ext.style.left="";s[q].$ext.style.width="1px";s[q].$ext.style.width="";if(!i){return this.$represent.set(q);}}}if(this.$represent.showLoader){this.$represent.showLoader(true,o);}var n=this;$setTimeout(function(){n.$represent.set(o);},1);};this.$setActivePage=function(o){if(this.disabled){return false;}if(!this.pagelookup[o]){var q,s,i;for(q in this.pagelookup){if(q<o){s=q;}if(q>o){i=true;}}if(!s||!i){return;}o=s;}for(var t=true,n=0;n<this.pages.length;n++){if(this.pagelookup[o]==this.pages[n]){this.$setStyleClass(this.pages[n],"present",["future","past","hover"]);t=false;}else{if(t){this.$setStyleClass(this.pages[n],"past",["future","present",]);}else{this.$setStyleClass(this.pages[n],"future",["past","present"]);}}if(n==this.pages.length-1){this.$setStyleClass(this.pages[n],"last");}}};this.$createReflection=function(){var A,i,t,w={},z=this.$represent.getPages(),l=z.length,u=[];for(A=0;A<l;A++){this.$getNewContext("page");i=this.$getLayoutNode("page","caption");t=this.$getLayoutNode("page");this.$setStyleClass(t,"page"+A);t.setAttribute("onmouseover","apf.lookup("+this.$uniqueId+').$setStyleClass(this, "hover", null);');t.setAttribute("onmouseout","apf.lookup("+this.$uniqueId+').$setStyleClass(this, "", ["hover"]);');if(!z[A].getAttribute("caption")){}else{apf.setNodeValue(i,z[A].getAttribute("caption")||"");}t.setAttribute("onmousedown","setTimeout(function(){                    apf.lookup("+this.$uniqueId+").gotoPage("+A+");                });");u.push(apf.insertHtmlNode(t,this.$int));w[A]=u[u.length-1];}this.pages=u;this.pagelookup=w;this.$setActivePage(0);if(apf.isGecko){var s=this;$setTimeout(function(){s.$ext.style.height=s.$ext.offsetHeight+1+"px";s.$ext.style.height=s.$ext.offsetHeight-1+"px";},10);}};this.$draw=function(){this.$ext=this.$getExternal();this.oCaption=this.$getLayoutNode("main","caption",this.$ext);this.$int=this.$getLayoutNode("main","container",this.$ext);};}).call(apf.toc.prototype=new apf.Presentation());apf.aml.setElement("toc",apf.toc);apf.portal=function(i,d){this.$init(d||"portal",apf.NODE_VISIBLE,i);this.$columns=[];};(function(){this.implement(apf.DataAction);this.$focussable=false;this.buttons="edit|min|close";this.$deInitNode=function(c,a){q.call(this,apf.findHost(a));};this.$updateNode=function(c,a){var d=apf.findHost(a);d.setProperty("buttons",this.$applyBindRule("buttons",c)||"");d.draggable=this.$applyBindRule("draggable",c);};this.$moveNode=function(c,a){if(!a){return;}};this.select=function(){};this.findColumnNr=function(d,a){var c=document.elementFromPoint(d,a);while(!c.isColumn&&c.parentNode){c=c.parentNode;}return c.isColumn&&this.$columns.indexOf(c)||0;};this.$moveDocklet=function(l){var i=this.$columns.indexOf(l.$ext.parentNode)||0;var d=l.dataNode;d.setAttribute("column",i);var c=apf.xmldb.getChildNumber(l.oExt),j=d.selectNodes("../node()[@column='"+i+"']");if(j[c]!=d){var a=apf.findHost(l.oExt.nextSibling);d.parentNode.insertBefore(d,a&&a.dataNode||null);}this.dispatchEvent("widgetmove");};this.columns="33.33%,33.33%,33.33%";this.$columnWidths=this.columns.splitSafe(",");this.$propHandlers.columns=function(l){if(!l){return;}this.$columnWidths=l.splitSafe(",");var a,d,j,D,E;while(this.$columns.length>this.$columnWidths.length){a=this.$columns.pop();a.host=null;d=a.childNodes;j=this.$columns[0];for(var C=d.length-1;C>=0;C--){if((E=d[C]).nodeType!=1){continue;}j.appendChild(E);D=apf.findHost(E);D.$pHtmlNode=j;D.dataNode.setAttribute("column",0);}apf.destroyHtmlNode(a);}for(var i,a,c,C=0;C<this.$columnWidths.length;C++){c=this.$columnWidths[C];if(!this.$columns[C]){this.$getNewContext("column");a=apf.insertHtmlNode(this.$getLayoutNode("column"),this.$int,this.$int.lastChild);this.$columns.push(a);a.isColumn=true;a.host=this;}else{a=this.$columns[C];this.oInt.insertBefore(a,this.oInt.lastChild);}this.$setStyleClass(a,(i=(C==this.$columnWidths.length-1))?"collast":"",["collast"]);c.match(/(%|px|pt)/);var m=RegExp.$1||"px";a.style.width=(parseInt(c)-(apf.isIE&&apf.isIE<8&&i?1:0))+m;}};this.addEventListener("keydown",function(c){var i=c.keyCode;var a=c.ctrlKey;var j=c.shiftKey;var d=c.altKey;if(!this.selected){return;}switch(i){default:break;}},true);function q(m){var a=m.$srcUrl;if(!a){throw new Error("Something went terribly wrong");}if(m.$dockletClass.$unload){m.$dockletClass.$unload();}var c=[],i,d=n[a];if(m.oSettings){var l=m.oSettings.childNodes;while(l.length){i=apf.findHost(d.fragSettings.appendChild(l[0]));if(i){c.push(i.removeNode(null,true));}}}var l=m.$int.childNodes;while(l.length){i=apf.findHost(d.fragInt.appendChild(l[0]));if(i){c.push(i.removeNode(null,true));}}var l=m.childNodes;for(var j=l.length-1;j>=0;j--){c.push(l[j].removeNode(null,true));}d.amlNodes=c;m.oSettings=m.$int=null;m.childNodes=[];s.push(m);m.parentNode=null;m.$ext.parentNode.removeChild(m.$ext);return a;}this.$getCurrentFragment=function(){var j,c,d=[];for(var a=0,l=this.$columns.length;a<l;a++){c=this.$columns[a];for(var i=c.childNodes.length-1;i>=0;i--){if(c.childNodes[i].nodeType!=1){continue;}d.push(q.call(this,apf.findHost(c.childNodes[i])));}}return d;};this.$setCurrentFragment=function(d){var i,m,a,A,j=this.getTraverseNodes();for(var c=0,l=j.length;c<l;c++){i=j[c];m=this.$columns[this.$applyBindRule("column",i)||0];a=this.$applyBindRule("src",i)||"file:"+this.$applyBindRule("url",i);A=t.call(this,i,m);u.call(this,a,null,A,i);}};var w;this.$setClearMessage=function(a){if(!w){if(!this.$hasLayoutNode("empty")){return;}this.$getNewContext("empty");var d=this.$getLayoutNode("empty");if(!d){return;}w=apf.insertHtmlNode(d,this.$int);}else{this.$int.appendChild(w);}var c=this.$getLayoutNode("empty","caption",w);if(c){apf.setNodeValue(c,a||"");}if(w){w.setAttribute("id","empty"+this.$uniqueId);}};this.$removeClearMessage=function(){var a=document.getElementById("empty"+this.$uniqueId);if(a){a.parentNode.removeChild(a);}};var n={};function u(G,N,M,O){var I;while(I=n[G]){if(!I.fragInt.childNodes.length){G+="_";}else{break;}}if(!I&&!N){G="error";I=n.error;}M.$getLayoutNode("main","container",M.$ext).innerHTML="";M.$srcUrl=G;if(I){var a=I.xmlNode;if(a.getAttribute("width")){M.setProperty("width",a.getAttribute("width"));}else{M.$ext.style.width="auto";}M.oSettings=M.$getLayoutNode("main","settings_content",M.$ext);M.$int=M.$getLayoutNode("main","container",M.$ext);M.$int.appendChild(I.fragInt);if(M.oSettings){M.oSettings.appendChild(I.fragSettings);}var d=I.amlNodes||[];for(var J=0,c=d.length;J<c;J++){if(d[J].hasFeature){M.appendChild(d[J],null,true);}}M.$dockletClass=I.dockletClass;if(I.dockletClass.load){I.dockletClass.load(O,M);}}else{var l=apf.all.length;var j=[];N=N.replace(/\b(id|actiontracker|group)="([^"]*)"|\b(id|actiontracker|group)='([^']*)''/g,function(C,E,z,A,B){var D=z||B;j.push(D);if(z){return E+'="'+D+"_"+l+'"';}if(B){return A+"='"+D+"_"+l+"'";}});if(j.length){N=N.replace(new RegExp("\\b("+j.join("|")+")\\b","g"),function(A,z){return z+"_"+l;});}var i=this.ownerDocument.$domParser.parseFromString(N,"text/xml",{docFrag:M,doc:M.ownerDocument,htmlNode:M.$int}).firstChild;var m=i.name;if(i.width){M.setProperty("width",i.width);}else{M.$ext.style.width="auto";}if(!self[m]){throw new Error("could not find docklet class '"+m+"'");}var K=new self[m]().$init();this.docklets.push(K);K.create(O,M,this);if(K.load){K.load(O,M);}M.$dockletClass=K;n[G]={srcUrl:G,xmlNode:i.$aml,fragInt:document.createDocumentFragment(),fragSettings:document.createDocumentFragment(),dockletClass:K};}M.$refParent=this.$int;}var s=[];function t(i,a){var j;var d=this.$applyBindRule("columns",this.xmlRoot);if(d!=this.columns){this.setProperty("columns",d);a=this.$columns[this.$applyBindRule("column",i)||0];}if(j=s.pop()){j.parentNode=this;a.appendChild(j.$ext);j.$pHtmlNode=a;var c=this.$applyBindRule("dockskin",i)||"docklet";if(j.skin!=c){j.$forceSkinChange(j.skin=c);}j.show();}else{j=new apf.modalwindow({htmlNode:a,skinset:apf.getInheritedAttribute(this.parentNode,"skinset"),skin:this.$applyBindRule("dockskin",i)||"docklet",draggable:true,visible:true});j.implement(apf.modalwindow.widget);j.parentNode=this;j.$create();j.addEventListener("beforestatechange",function(l){if(l.to.maximized){j.$ext.parentNode.style.zIndex=100000;}return this.$dockletClass.dispatchEvent("beforestatechange",l);});j.addEventListener("afterstatechange",function(l){if(l.from.maximized){j.$ext.parentNode.style.zIndex=1;}this.$dockletClass.dispatchEvent("afterstatechange",l);if(l.to.closed){this.remove(this.dataNode);}});}j.dataNode=i;apf.xmldb.nodeConnect(apf.xmldb.getXmlDocId(i),i,j.$ext,this);if(this.$hasBindRule("buttons")){j.setProperty("buttons",this.$applyBindRule("buttons",i)||this.buttons);}j.setProperty("state",this.$applyBindRule("state",i)||"normal");j.setProperty("title",this.$applyBindRule("caption",i));j.setProperty("icon",this.$applyBindRule("icon",i));j.show();return j;}this.$clear=function(){};this.docklets=[];var o={};this.$add=function(j,I,E,d,l){var m=this.$columns[this.$applyBindRule("column",j)||0];var J=this.$applyBindRule("src",j)||"file:"+this.$applyBindRule("url",j);if(!m){var F=this.$applyBindRule("columns",this.xmlRoot);if(F&&F!=this.columns){this.setProperty("columns",F);}m=this.$columns[this.$applyBindRule("column",j)||0];if(!m){throw new Error(apf.formatErrorString(0,this,"Building docklet","Cannot find column to hook docklet on. Seems like a timing error"));}}var a=t.call(this,j,m);if(o[J]){var i=o[J];u.call(this,J,i,a,j);}else{a.$getLayoutNode("main","container",a.$ext).innerHTML="<div class='loading'>Loading...</div>";var c=new apf.model(),G=this;c.$loadFrom(J,{callback:function(A,B,C){if(!A||B!=apf.SUCCESS){u.call(G,"error","<a:docklet xmlns:a='"+apf.ns.apf+"' name='dockerror'>                        <a:script><![CDATA[                            function dockerror(){                                this.init = this.load = function(x,d){                                    d.setAttribute('buttons', '');                                    d.setAttribute('icon', '');                                    d.setAttribute('title', 'Error')                                }                            }                        ]]></a:script>                        <a:body>                            <a:label style='margin:0 auto 0 auto'>Error loading this widget</a:label>                        </a:body>                    </a:docklet>",a,j);return true;}var z=A;if(apf.isSafariOld){z=z.replace(/name/,"name='"+xmlNode.getAttribute("name")+"'");o[J]=z;}else{o[J]=z;}u.call(G,J,z,a,j);this.isLoaded=true;}});}};this.$fill=function(){};this.addEventListener("beforeload",function(a){if(!this.$columns.length){var c=this.$applyBindRule("columns",a.xmlNode);if(c&&c!=this.columns){this.setProperty("columns",c);}}});this.addEventListener("xmlupdate",function(a){var c=this.$applyBindRule("columns",this.xmlRoot);if(c&&c!=this.columns){this.setProperty("columns",c);}});this.$selectDefault=function(a){if(this.select(this.getFirstTraverseNode(a),null,null,null,true)){return true;}else{var d=this.getTraverseNodes(a);for(var c=0;c<d.length;c++){if(this.$selectDefault(d[c])){return true;}}}};this.$draw=function(){this.$ext=this.$getExternal();this.$int=this.$getLayoutNode("main","container",this.$ext);};this.$loadAml=function(a){if(document.elementFromPointAdd){document.elementFromPointAdd(this.$ext);}};}).call(apf.portal.prototype=new apf.MultiSelect());apf.aml.setElement("portal",apf.portal);apf.aml.setElement("src",apf.BindingRule);apf.aml.setElement("column",apf.BindingRule);apf.aml.setElement("draggable",apf.BindingRule);apf.aml.setElement("dockskin",apf.BindingRule);apf.aml.setElement("buttons",apf.BindingRule);apf.aml.setElement("caption",apf.BindingRule);apf.aml.setElement("traverse",apf.BindingRule);apf.portal.Docklet=function(){};apf.portal.Docklet.prototype=new apf.Class();apf.portal.Docklet.prototype.create=function(j,i,l){this.xmlSettings=j;this.oWidget=i;if(this.$create){this.$create(j,i,l);}};apf.audio=function(i,d){this.$init(d||"audio",apf.NODE_VISIBLE,i);};(function(){this.$supportedProperties.push("waveform","peak","EQ","ID3");this.$mainBind="src";this.loadMedia=function(){if(!this.player){return this;}this.setProperty("currentSrc",this.src);this.setProperty("networkState",apf.Media.NETWORK_LOADING);this.player.load(this.src);return this;};this.seek=function(c){if(this.player&&c>=0&&c<=this.duration){this.player.seek(c);}};this.setVolume=function(c){if(this.player){this.player.setVolume(c);}};this.$guessType=function(j){var l=j.substr(j.lastIndexOf(".")+1),i="";if(apf.hasAudio&&((l=="ogg"||l=="wav")||(l=="mp3"&&apf.isWebkit))){i="audio/ogg";}else{if(l=="mp3"){i="audio/flash";}}return i;};this.$getPlayerType=function(i){if(!i){return null;}var n=null;var o=i.splitSafe(",");if(o.length==1){o=o[0].splitSafe(";");}for(var q=0,l=o.length;q<l;q++){if(i.indexOf("ogg")>-1){n="TypeNative";}if(i.indexOf("flash")>-1){n="TypeFlash";}else{if(i.indexOf("quicktime")>-1){n="TypeQT";}else{if(i.indexOf("wmv")>-1){n=apf.isMac?"TypeQT":"TypeWmp";}else{if(i.indexOf("silverlight")>-1){n="TypeSilverlight";}}}}if(this.$isSupported(n)){return n;}}return n;};this.$isSupported=function(c){c=c||this.playerType;return(apf.audio[c]&&apf.audio[c].isSupported());};this.$initPlayer=function(){this.player=new apf.audio[this.playerType](this,this.$ext,{src:this.src,width:this.width,height:this.height,autoLoad:true,autoPlay:this.autoplay,showControls:this.controls,volume:this.volume,mimeType:this.type});return this;};this.$initHook=function(d){if(d.error){var i=this.MediaError(d.error);if(this.dispatchEvent("error",{error:i,bubbles:true})===false){throw i;}}this.loadMedia();};this.$cuePointHook=function(){};this.$playheadUpdateHook=function(){};this.$errorHook=function(c){apf.console.log("Error: <audio>");apf.console.error(c.error);};this.$progressHook=function(i){this.setProperty("bufferedBytes",{start:0,end:i.bytesLoaded,length:i.bytesLoaded});this.setProperty("totalBytes",i.totalBytes);var d=Math.abs(i.bytesLoaded-i.totalBytes);if(d<=20){this.setProperty("readyState",apf.Media.HAVE_ENOUGH_DATA);}};this.$stateChangeHook=function(c){if(c.state=="connectionError"){this.networkState=apf.Media.HAVE_NOTHING;this.$propHandlers.readyState.call(this,this.networkState);}};this.$changeHook=function(c){if(typeof c.volume!="undefined"){this.volume=c.volume;this.muted=(c.volume>0);this.setProperty("volume",c.volume);}else{this.duration=this.player.getTotalTime();this.position=c.playheadTime/this.duration;if(isNaN(this.position)){return;}this.setProperty("position",this.position);this.currentTime=c.playheadTime;this.setProperty("currentTime",this.currentTime);}};this.$completeHook=function(c){this.paused=true;this.setProperty("paused",true);};this.$readyHook=function(c){this.setProperty("networkState",apf.Media.NETWORK_LOADED);this.setProperty("readyState",apf.Media.HAVE_FUTURE_DATA);this.setProperty("duration",this.player.getTotalTime());this.seeking=false;this.seekable=true;this.setProperty("seeking",false);if(this.autoplay){this.play();}return this;};this.$metadataHook=function(c){this.oVideo.setProperty("readyState",apf.Media.HAVE_METADATA);if(c.waveData){this.setProperty("waveform",c.waveData);}if(c.peakData){this.setProperty("peak",c.peakData);}if(c.eqData){this.setProperty("EQ",c.eqData);}if(c.id3Data){this.setProperty("ID3",c.id3Data);}};this.$draw=function(){this.$ext=this.$pHtmlNode.appendChild(document.createElement("div"));this.$ext.className="apf_audio "+(this.getAttributeNode("class")||"");this.$int=this.$ext;};this.addEventListener("DOMNodeInsertedIntoDocument",function(){if(this.setSource()){this.$propHandlers.type.call(this,this.type);}});this.$destroy=function(c){if(this.player&&this.player.$detroy){this.player.$destroy();}delete this.player;this.player=null;if(c){this.$ext.innerHTML="";}};}).call(apf.audio.prototype=new apf.Media());apf.aml.setElement("audio",apf.audio);apf.audio.TypeInterface={properties:["src","volume","showControls","autoPlay","totalTime","mimeType"],setOptions:function(i){if(i==null){return this;}var m=this.properties;for(var n=0;n<m.length;n++){var l=m[n];if(i[l]==null){continue;}this[l]=i[l];}return this;},getElement:function(c){return apf.flash.getElement(c);}};apf.ActionRule=function(i,d){this.$init(d||true,apf.NODE_HIDDEN,i);};(function(){this.$actionRule=true;this.compile=function(i,d){return(this["c"+i]=apf.lm.compile(this[i],d||{xpathmode:2}));};this.$attrExcludePropBind=apf.extend({set:1,get:1,undo:1,lock:1,match:1,parent:1},this.$attrExcludePropBind);this.$propHandlers.set=this.$propHandlers.get=this.$propHandlers.parent=this.$propHandlers.match=function(d,i){delete this["c"+i];};this.addEventListener("DOMNodeInserted",function(i){if(i.currentTarget==this){var d=this.parentNode;if(!d.$actions){d.$actions=new apf.ruleList();}(d.$actions[this.localName]||(d.$actions[this.localName]=[])).push(this);}else{if(this.attributes.getNamedItem("value")){return;}this.value=apf.serializeChildren(this);}});this.addEventListener("DOMNodeRemoved",function(c){if(c.currentTarget==this){this.parentNode.$actions[this.localName].remove(this);}else{if(this.attributes.getNamedItem("value")){return;}this.value=apf.serializeChildren(this);}});this.addEventListener("DOMNodeInsertedIntoDocument",function(d){if(!this.get){this.get=apf.serializeChildren(this.$aml).trim();}var i=this.parentNode.$actions||(this.parentNode.$actions=new apf.ruleList());(i[this.localName]||(i[this.localName]=[])).push(this);});}).call(apf.ActionRule.prototype=new apf.AmlElement());apf.aml.setElement("rename",apf.ActionRule);apf.aml.setElement("remove",apf.ActionRule);apf.aml.setElement("add",apf.ActionRule);apf.aml.setElement("update",apf.ActionRule);apf.aml.setElement("copy",apf.ActionRule);apf.aml.setElement("move",apf.ActionRule);apf.flowchart=function(i,d){this.$init(d||"flowchart",apf.NODE_VISIBLE,i);};(function(){this.implement(apf.DataAction,apf.Cache,apf.MultiSelect,apf.Rename);this.objCanvas=null;this.nodes=[];this.snap=false;this.gridW=48;this.gridH=48;this.$flowVars={lastBlockId:0,template:null,resizeManager:null,xmlBlocks:{},objBlocks:{},xmlConnections:{},connToPaint:[]};this.$init(function(){var i=this;var j=function(c){c=(c||event);var C=c.keyCode,A=c.ctrlKey,a=c.shiftKey,w=this.getSelection(),E=this.snap?((C==37||C==39?this.gridW:(C==38||C==40?this.gridH:0))*(A?2:(a?3:1))):(A?10:(a?100:1)),d=i.objCanvas.disableremove;if(!w||d){return;}switch(C){case 37:this.moveTo(w,-E,0);break;case 38:this.moveTo(w,0,-E);break;case 39:this.moveTo(w,E,0);break;case 40:this.moveTo(w,0,E);break;case 46:i.$flowVars.resizeManager.hide();switch(i.objCanvas.mode){case"normal":this.removeBlocks(w);break;case"connection-change":var D=[],z=i.objCanvas.htmlConnectors;for(var B in z){if(z[B].selected){D.push(z[B].other.xmlNode);z[B].destroy();}}i.removeConnectors(D);i.objCanvas.mode="normal";break;}break;}return false;};this.addEventListener("keydown",j,true);apf.addEventListener("contextmenu",function(){return false;});function l(){i.objCanvas.disableremove=false;}this.addEventListener("afterrename",l);this.addEventListener("stoprename",l);});this.$propHandlers.snap=function(i){var d=parseInt(i)>0?true:false;this.snap=this.objCanvas.snap=i=="true"||d?true:false;if(d){this.gridW=this.objCanvas.gridW=parseInt(i);this.gridH=this.objCanvas.gridH=parseInt(i);}};this.$propHandlers["grid-width"]=function(c){this.gridW=this.objCanvas.gridW=parseInt(c);};this.$propHandlers["grid-height"]=function(c){this.gridH=this.objCanvas.gridH=parseInt(c);};this.$getCaptionElement=function(){var c=this.$flowVars.objBlocks[this.$applyBindRule("id",this.selected)];if(!c){return;}return c.caption;};this.$beforeRename=function(m){m=m||event;var n=m.srcElement||m.target;this.$selectCaption(n);this.objCanvas.disableremove=true;this.$deselectCaption(n);this.startRename();var c=this.$pHtmlDoc.getElementById("txt_rename");this.$setStyleClass(c,n.className);var l=c;if((n.className||"").indexOf("inside")!=-1){if(l.offsetHeight!==0){l.style.marginTop="-"+(Math.ceil(l.offsetHeight/2))+"px";}}return false;};this.$selectCaption=function(c){if(!c||c.nodeType!=1){return;}this.$setStyleClass(c,"selected");};this.$deselectCaption=function(c){if(!c||c.nodeType!=1){return;}this.$setStyleClass(c,"",["selected"]);};this.$select=function(l){if(!l){return;}var i=apf.flow.isBlock(l);if(i){if(this.$flowVars.resizeManager){var j=i.other;if(j.lock==1){return;}this.$flowVars.resizeManager.grab(l,{scalex:j.scalex,scaley:j.scaley,scaleratio:j.scaleratio,dwidth:j.dwidth,dheight:j.dheight,ratio:j.ratio,snap:this.snap,gridH:this.gridH,gridW:this.gridW});}this.$setStyleClass(l,"selected");if(i.other.capPos!=="inside"){this.$selectCaption(i.caption);}}};this.$deselect=function(i){if(!i){return;}this.$setStyleClass(i,"",["selected"]);var d=apf.flow.isBlock(i);if(!d){return;}this.$deselectCaption(d.caption);this.$flowVars.resizeManager.hide();};this.moveTo=function(K,M,E){if(!K){return;}if(!K.length){K=[K];}var I=[],G=["top","left"],D,F,i,B,l;for(i=0,B=K.length;i<B;i++){for(l=0;l<G.length;l++){D=this.$getDataNode(G[l],K[i],this.$createModel);F=(G[l]=="left"?M:E)+(parseInt(this.$applyBindRule(G[l],K[i]))||0);if(this.snap){var C=G[l]=="top"?this.gridH:this.gridW;F=Math.round(F/C)*C;}if(D){var j=D.nodeType==1||D.nodeType==3||D.nodeType==4?"setTextNode":"setAttribute";var J=D.nodeType==1?[D,F]:(D.nodeType==3||D.nodeType==4?[D.parentNode,F]:[D.ownerElement||D.selectSingleNode(".."),D.nodeName,F]);I.push({func:j,args:J});}}}this.$executeAction("multicall",I,"moveTo",K);};this.setZindex=function(d,i){this.$executeSingleValue("setzindex","zindex",d,i);};this.setMode=function(c){this.objCanvas.setMode(c);};this.getMode=function(){return this.objCanvas.getMode();};this.setLock=function(d,i){this.$executeSingleValue("setlock","lock",d,String(i));};this.rotate=function(t,q){var w=this.$applyBindRule("flipv",t)=="true"?true:false,C=this.$applyBindRule("fliph",t)=="true"?true:false,A=parseInt(this.$applyBindRule("rotation",t))||0,z=["fliph","flipv","rotation"],s;if(w&&C){s=["false","false",(q+180)%360];}else{s=[String(C),String(w),q];if(Math.abs(q-A)%180!==0){var u=parseInt(this.$applyBindRule("width",t))||0,B=parseInt(this.$applyBindRule("height",t))||0;z.push("width","height");s.push(B,u);}}this.$executeMulticallAction("rotate",z,t,s);};this.flipVertical=function(o,n){var m=this.$applyBindRule("fliph",o)=="true"?true:false,q=this.$applyBindRule("rotation",o)?parseInt(this.$applyBindRule("rotation",o)):0;var l=m&&n?["false","false",(q+180)%360]:[String(m),String(n),q];this.$executeMulticallAction("verticalFlip",["fliph","flipv","rotation"],o,l);};this.flipHorizontal=function(o,m){var n=this.$applyBindRule("flipv",o)=="true"?true:false,q=this.$applyBindRule("rotation",o)?parseInt(this.$applyBindRule("rotation",o)):0;var l=n&&m?["false","false",(q+180)%360]:[String(m),String(n),q];this.$executeMulticallAction("horizontalFlip",["fliph","flipv","rotation"],o,l);};this.resize=function(o,m,l,q,n){this.$executeMulticallAction("resize",["top","left","width","height"],o,[q,n,m,l]);};this.$executeMulticallAction=function(D,C,G,F){var z,B,i,E,w,l=[],A=C.length;for(z=0;z<A;z++){B=this.$getDataNode(C[z],G,this.$createModel);i=F[z];if(B){E=B.nodeType==1||B.nodeType==3||B.nodeType==4?"setTextNode":"setAttribute";w=B.nodeType==1?[B,i]:(B.nodeType==3||B.nodeType==4?[B.parentNode,i]:[B.ownerElement||B.selectSingleNode(".."),B.nodeName,i]);l.push({func:E,args:w});}}this.$executeAction("multicall",l,D,G);};this.addConnector=function(l,o,n,m){var q=this.xmlRoot.ownerDocument.createElement("connection");q.setAttribute("ref",this.$applyBindRule("id",n));q.setAttribute("output",o);q.setAttribute("input",m);this.$executeAction("appendChild",[l,q],"addConnector",l);};this.removeConnectors=function(l){var m=[],n=0,i=l.length;for(;n<i;n++){m.push({func:"removeNode",args:[l[n]]});}this.$executeAction("multicall",m,"removeConnectors",l[0]);};this.addBlock=function(q,n,o,m){if(!q){return;}var s=this.$flowVars.template.selectSingleNode("//element[@type='"+q+"']");if(!s){return;}var t=this.xmlRoot.ownerDocument.createElement("block");t.setAttribute("id","b"+(this.$flowVars.lastBlockId+1));t.setAttribute("left",n||20);t.setAttribute("top",o||20);t.setAttribute("width",s.getAttribute("dwidth"));t.setAttribute("height",s.getAttribute("dheight"));t.setAttribute("type",q);t.setAttribute("caption",m);this.$executeAction("appendChild",[this.xmlRoot,t],"addBlock",this.xmlRoot);};this.removeBlocks=function(i){var z,B,l,u,C=[],A=[],j=0,w=i.length;for(;j<w;j++){z=this.$applyBindRule("id",i[j]);A.push(z);C.push({func:"removeNode",args:[i[j]]});}for(B in this.$flowVars.xmlConnections){for(l=this.$flowVars.xmlConnections[B].length-1;l>=0;l--){for(u=0,w=A.length;u<w;u++){if(this.$flowVars.xmlConnections[B][l].ref==A[u]){C.push({func:"removeNode",args:[this.$flowVars.xmlConnections[B][l].xmlNode]});}}}}this.$executeAction("multicall",C,"removeBlocksWithConnections",i);};this.$draw=function(){this.$ext=this.$getExternal();this.$int=this.$getLayoutNode("main","container",this.$ext);this.objCanvas=new apf.flow.getCanvas(this.$int);apf.flow.init();};this.$deInitNode=function(i,l){var j=this.$applyBindRule("id",i);this.$flowVars.objBlocks[j].destroy();delete this.$flowVars.objBlocks[j];delete this.$flowVars.xmlBlocks[j];l.parentNode.removeChild(l);this.$flowVars.resizeManager.hide();};this.addEventListener("dragdrop",function(l){var j=apf.getAbsolutePosition(l.indicator),i=apf.getAbsolutePosition(this.objCanvas.htmlElement);apf.setNodeValue(this.$getDataNode("top",l.data[0],true),parseInt(l.top)-i[1]);apf.setNodeValue(this.$getDataNode("left",l.data[0],true),j[0]-i[0]);});this.$updateModifier=function(ag,W){apf.console.info("UPDATE");var ad=this.$flowVars,ah=this.$applyBindRule("id",ag),T=ad.objBlocks[ah],X=parseInt(this.$applyBindRule("top",ag))?this.$applyBindRule("top",ag):parseInt(T.htmlElement.style.top),R=parseInt(this.$applyBindRule("left",ag))?this.$applyBindRule("left",ag):parseInt(T.htmlElement.style.left);T.moveTo(X,R);var ab=parseInt(this.$applyBindRule("width",ag))?this.$applyBindRule("width",ag):T.other.dwidth,j=parseInt(this.$applyBindRule("height",ag))?this.$applyBindRule("height",ag):T.other.dheight;T.resize(ab,j);T.setCaption(this.$applyBindRule("caption",ag));var i=this.$applyBindRule("lock",ag)=="true"?true:false;T.setLock(i);T.changeRotation(this.$applyBindRule("rotation",ag),this.$applyBindRule("fliph",ag),this.$applyBindRule("flipv",ag));var t,Q,Y,ac,w,aa,U,ae,P=this.$getDataNode("connection",ag,null,null,true),af=ad.xmlConnections[ah]||[],l=0;R=af.length;if(af.length){for(;l<R;l++){for(t=0,Y=false,Q=P.length;t<Q;t++){if(af[l].xmlNode==P[t]){Y=true;break;}}if(!Y){if(ad.objBlocks[ah]&&ad.objBlocks[af[l].ref]){var Z=apf.flow.findConnector(ad.objBlocks[ah],af[l].output,ad.objBlocks[af[l].ref],af[l].input);if(Z){apf.flow.removeConnector(Z.connector.htmlElement);}ad.xmlConnections[ah].removeIndex(l);}}}}else{delete ad.xmlConnections[ah];}for(l=0,R=P.length;l<R;l++){Y=false;if(af){for(t=0,Q=af.length;t<Q;t++){if(af[t].xmlNode==P[l]){Y=true;break;}}}if(!Y){ac=this.$applyBindRule("ref",P[l]),w=this.$applyBindRule("blockoutput",P[l]),aa=this.$applyBindRule("blockinput",P[l]),U=this.$applyBindRule("blocklabel",P[l]),ae=this.$applyBindRule("type",P[l]);if(ad.xmlBlocks[ac]){var V=ad.xmlConnections[ah]||[];V.push({ref:ac,output:w,input:aa,label:U,type:ae,xmlNode:P[l]});new apf.flow.addConnector(this.objCanvas,ad.objBlocks[ah],ad.objBlocks[ac],{output:w,input:aa,label:U,type:ae,xmlNode:P[l]});ad.xmlConnections[ah]=V;}else{apf.console.info("Destination block doesn't exist.");}}}if(ad.resizeManager&&ag==this.selected&&!i){ad.resizeManager.show();}else{ad.resizeManager.hide();}T.updateOutputs();T.onMove();};this.$add=function(az,ac,aA,ar,ad){this.$flowVars.lastBlockId++;apf.console.info("ADD");this.$getNewContext("item");var am=this.$getLayoutNode("item"),ao=this.$getLayoutNode("item","select"),al=this.$getLayoutNode("item","image"),ab=this.$getLayoutNode("item","imagecontainer"),af=this.$getLayoutNode("item","caption");if(af){af.setAttribute("ondblclick","apf.lookup("+this.$uniqueId+").$beforeRename(event); return false;");}this.nodes.push(am);var l=[],w=[],an,Z,aa,aw=this.$applyBindRule("left",az)||0,ai=this.$applyBindRule("top",az)||0,aq=this.$applyBindRule("zindex",az)||1001;if(this.snap){aw=Math.round(aw/this.gridW)*this.gridW;ai=Math.round(ai/this.gridH)*this.gridH;}l.push("z-index:"+aq);l.push("left:"+aw+"px");l.push("top:"+ai+"px");if(this.$flowVars.template){var av=this.$flowVars.template.selectSingleNode("//element[@type='"+this.$applyBindRule("type",az)+"']");if(av){var au=av.getAttribute("css");if(au){au=au.split(";");for(Z=0,aa=au.length;Z<aa;Z++){an=au[Z].trim();if(an!==""){if(an.substr(0,5)=="color"&&af){af.setAttribute("style",[an].join(";"));}else{l.push(an);}}}}var at=av.getAttribute("dwidth"),X=av.getAttribute("dheight");}}if(this.$applyBindRule("id",az)){var ay=this.$applyBindRule("id",az).substr(1);if(ay>this.$flowVars.lastBlockId){this.$flowVars.lastBlockId=ay;}}var ag=this.$applyBindRule("id",az)||"b"+this.$flowVars.lastBlockId,ae=this.$applyBindRule("width",az)||at||56,ah=this.$applyBindRule("height",az)||X||56,i=this.$applyBindRule("lock",az)||"false",ax=this.$applyBindRule("cap-pos",az)||"outside";l.push("width:"+ae+"px");l.push("height:"+ah+"px");am.setAttribute("style",l.join(";"));w.push("width:"+ae+"px");w.push("height:"+ah+"px");al.setAttribute("style",w.join(";"));ab.setAttribute("style",w.join(";"));az.setAttribute("id",ag);az.setAttribute("width",ae);az.setAttribute("height",ah);az.setAttribute("lock",i);az.setAttribute("left",aw);az.setAttribute("top",ai);az.setAttribute("zindex",aq);az.setAttribute("cap-pos",ax);if(af){this.$setStyleClass(af,ax);}ao.setAttribute(this.itemSelectEvent||"onmousedown","var o = apf.lookup("+this.$uniqueId+"); o.select(this, event.ctrlKey, event.shiftKey)");apf.xmldb.nodeConnect(this.documentId,az,am,this);this.$flowVars.xmlBlocks[ag]=az;var ak=[],Y,ap=this.$getDataNode("connection",az,null,null,true);for(Y=0,aa=ap.length;Y<aa;Y++){ak.push({ref:this.$applyBindRule("ref",ap[Y]),output:this.$applyBindRule("blockoutput",ap[Y]),input:this.$applyBindRule("blockinput",ap[Y]),label:this.$applyBindRule("blocklabel",ap[Y]),type:this.$applyBindRule("type",ap[Y]),xmlNode:ap[Y]});}var aj=this.$applyBindRule("css",az);if(aj){this.$setStyleClass(am,aj);if(aj){this.dynCssClasses.push(aj);}}if(ak.length>0){this.$flowVars.xmlConnections[ag]=ak;}};this.$fill=function(){apf.insertHtmlNodes(this.nodes,this.$int);apf.console.info("FILL");var M,l,I,F=this.$flowVars;for(M in F.xmlBlocks){var G=F.xmlBlocks[M],J=apf.xmldb.findHtmlNode(G,this),N=this.$flowVars.xmlBlocks[M].getAttribute("type")||null,K={};if(N){if(F.template){var i=F.template.selectSingleNode("element[@type='"+this.$applyBindRule("type",G)+"']");if(i){var T=i.selectNodes("input");if(T){for(l=0,I=T.length;l<I;l++){K[parseInt(T[l].getAttribute("name"))]={x:parseInt(T[l].getAttribute("x")),y:parseInt(T[l].getAttribute("y")),position:T[l].getAttribute("position")};}}}}}var E=this.$applyBindRule("lock",G)=="true"?true:false;var R={};R.lock=E;R.flipv=this.$applyBindRule("flipv",G)=="true"?true:false;R.fliph=this.$applyBindRule("fliph",G)=="true"?true:false;R.rotation=parseInt(this.$applyBindRule("rotation",G))||0;R.inputList=K;R.type=N;R.picture=N&&F.template&&i?i.getAttribute("picture"):null;R.dwidth=N&&F.template&&i?parseInt(i.getAttribute("dwidth")):56;R.dheight=N&&F.template&&i?parseInt(i.getAttribute("dheight")):56;R.scalex=N&&F.template&&i?(i.getAttribute("scalex")=="true"?true:false):true;R.scaley=N&&F.template&&i?(i.getAttribute("scaley")=="true"?true:false):true;R.scaleratio=N&&F.template&&i?(i.getAttribute("scaleratio")=="true"?true:false):false;R.xmlNode=G;R.caption=this.$applyBindRule("caption",G);R.capPos=this.$applyBindRule("cap-pos",G);var c=apf.flow.isBlock(J);var P=this;if(c){this.$setStyleClass(J,"",["empty"]);c.other=R;c.initBlock();}else{c=apf.flow.addBlock(J,this.objCanvas,R);if(c){c.oncreateconnection=function(m,d,a,j){P.addConnector(m,d,a,j);};c.onremoveconnection=function(a){P.removeConnectors(a);};F.objBlocks[M]=c;}}}for(M in F.xmlBlocks){var Q=F.xmlConnections[M]||[];for(l=0,I=Q.length;l<I;l++){var O=apf.flow.findConnector(F.objBlocks[M],Q[l].output,F.objBlocks[Q[l].ref],Q[l].input);if(!O){if(F.objBlocks[M]&&F.objBlocks[Q[l].ref]){F.objBlocks[M].onMove();new apf.flow.addConnector(this.objCanvas,F.objBlocks[M],F.objBlocks[Q[l].ref],{output:Q[l].output,input:Q[l].input,label:Q[l].label,type:Q[l].type,xmlNode:Q[l].xmlNode});}else{F.connToPaint.push({id:M,id2:Q[l].ref,output:Q[l].output,input:Q[l].input,label:Q[l].label,type:Q[l].type,xmlNode:Q[l].xmlNode});}}else{O.connector.other={output:Q[l].output,input:Q[l].input,label:Q[l].label,type:Q[l].type,xmlNode:Q[l].xmlNode};O.connector.activateInputs();O.connector.draw();}}}for(l=F.connToPaint.length-1;l>=0;l--){if(F.objBlocks[F.connToPaint[l].id]&&F.objBlocks[F.connToPaint[l].id2]){new apf.flow.addConnector(this.objCanvas,F.objBlocks[F.connToPaint[l].id],F.objBlocks[F.connToPaint[l].id2],{output:F.connToPaint[l].output,input:F.connToPaint[l].input,label:F.connToPaint[l].label,type:F.connToPaint[l].type,xmlNode:F.connToPaint[l].xmlNode});F.connToPaint.removeIndex(l);}}this.nodes=[];if(!this.objCanvas.scrollPointer){this.objCanvas.addScrollPointer();}};this.$destroy=function(){};this.$loadAml=function(l){apf.getData(this.getAttribute("template"),{callback:function(a,c,d){if(c==apf.SUCCESS){i.loadTemplate(a);}else{apf.console.info("An error has occurred: "+d.message,2);return;}}});var i=this,j=this.$flowVars;j.resizeManager=new apf.resize();j.resizeManager.onresizedone=function(c,o,a,d){i.resize(i.selected,c,o,a,d);};j.resizeManager.onresize=function(s,u,c,d,t){if(!s){return;}var a=apf.flow.isBlock(s);a.moveTo(u,c);a.resize(d,t);a.updateOutputs();a.onMove();};apf.flow.onaftermove=function(a,c){i.moveTo(i.selected,c,a);};apf.flow.onblockmove=function(){j.resizeManager.show();};};this.loadTemplate=function(c){if(typeof c!="object"){c=apf.getXmlDom(c);}if(c.nodeType==9){c=c.documentElement;}if(c.nodeType==3||c.nodeType==4){c=c.parentNode;}if(c.nodeType==2){c=c.ownerElement||c.parentNode||c.selectSingleNode("..");}this.$flowVars.template=c;this.$checkLoadQueue();};this.$canLoadData=function(){return this.$flowVars.template?true:false;};}).call(apf.flowchart.prototype=new apf.BaseList());apf.aml.setElement("flowchart",apf.flowchart);apf.aml.setElement("resize",apf.BindingRule);apf.aml.setElement("left",apf.BindingRule);apf.aml.setElement("top",apf.BindingRule);apf.aml.setElement("id",apf.BindingRule);apf.aml.setElement("width",apf.BindingRule);apf.aml.setElement("height",apf.BindingRule);apf.aml.setElement("flipv",apf.BindingRule);apf.aml.setElement("fliph",apf.BindingRule);apf.aml.setElement("rotation",apf.BindingRule);apf.aml.setElement("lock",apf.BindingRule);apf.aml.setElement("type",apf.BindingRule);apf.aml.setElement("cap-pos",apf.BindingRule);apf.aml.setElement("zindex",apf.BindingRule);apf.aml.setElement("connection",apf.BindingRule);apf.aml.setElement("ref",apf.BindingRule);apf.aml.setElement("blockoutput",apf.BindingRule);apf.aml.setElement("blockinput",apf.BindingRule);apf.aml.setElement("blocklabel",apf.BindingRule);apf.Graph=function(i,d){this.$init(d||"graph",apf.NODE_VISIBLE,i);};apf.aml.setElement("graph",apf.Graph);(function(){this.$focussable=false;this.$drawCode=0;this.$_style=null;this.$docompile=true;this.$doinit=true;this.style="";this.$microtime=0;this.$datasource=null;this.$datamode=null;this.$datatype=null;this.dataslice="1X";this.steps=100;this.$data=null;this.$tilex=0;this.$tiley=0;this.m={x:0,y:0};this.nc=0;this.$styletag="";this.$propHandlers.left=this.$propHandlers.top=this.$propHandlers.width=this.$propHandlers.height=function(c){};this.$propHandlers.series=function(ag){var ax=this.v_yval=[];var aB=this.v_xval=[];var ak=this.v_zval=[];var aw=this.v_time=[];var ar=this.v_caption=[];var aD=this.v_class=[];var af=this.v_state=[];this.v_stateresolve=false;var ao,au,ai,ad,ae,aq=(new Date()).getTime()*0.001,av;var ay,aj,c,j,az,aA,ap,al;if(typeof ag=="string"){ay=ag;aj=",";c=" ";av="#";j=null;}else{ay=ag.series;aj=ag.split;j=ag.caption;c=ag.delim;av=ag.css;aA=ag.formula;ap=ag.length;}if(!ay){return;}if(aA){var aC=this.getModel();if(!aC.v_yval){var l=new Function("length","v_yval",apf.draw.baseMacro(["for(v = 0;v<length;v++){","v_yval[v] = ",[aA],";","}"]));l(ap,ax);aC.v_yval=ax;}else{ax=aC.v_yval;}if(this.mipstep>1){var an=this.mipstep;var aE=this.v_yvalmip=[ax];var am=[],at=ax,m,n,au,ai,ah,i;switch(this.mipset){case"avg":while(at.length>10){aE.push(am);for(n=0,ai=0,ah=at.length;ai<ah;ai++){if(!(ai%an)){if(ai){am[n++]=au/an;}au=at[ai];}else{au+=at[ai];}}at=am,am=[];}break;case"add":while(at.length>10){aE.push(am);for(n=0,ai=0,ah=at.length;ai<ah;ai++){if(!(ai%an)){if(ai){am[n++]=au;}au=at[ai];}else{au+=at[ai];}}at=am,am=[];}break;case"min":while(at.length>10){aE.push(am);for(n=0,ai=0,ah=at.length;ai<ah;ai++){if(!(ai%an)){if(ai){am[n++]=au;}au=at[ai];}else{if(au>(i=at[ai])){au=i;}}}at=am,am=[];}break;case"max":while(at.length>10){aE.push(am);for(n=0,ai=0,ah=at.length;ai<ah;ai++){if(!(ai%an)){if(ai){am[n++]=au;}au=at[ai];}else{if(au<(i=at[ai])){au=i;}}}at=am,am=[];}break;}this.$datamode="series";}}else{ao=ay.split(c);for(au=0;au<ao.length;au++){this.v_time[au]=aq;ai=ao[au].split(av);this.v_state[au]=0;if(ai.length>1){this.v_class[au]=ai[1];}if(j){ad=ai[0].split(j);if(ad.length>1){ar[au]=ad[1];}ad=ad[0].split(aj);}else{ad=ai[0].split(aj);}var t=1;if((ae=ad.length)>0){if(ae==1){ax[au]=parseFloat(ad[0]);}else{if(ae>=2){aB[au]=parseFloat(ad[0]);ax[au]=parseFloat(ad[1]);if(ae>=3){ak[au]=parseFloat(ad[2]);}}}}}this.$datamode="series";}};this.$propHandlers.formula=function(c){this.pformula=apf.draw.parseJSS(c);this.$datamode="math";this.$docompile=true;};this.$propHandlers.mode=function(c){this.$regenerate();};this.$propHandlers.style=function(c){this.$regenerate();};this.$propHandlers.a=this.$propHandlers.b=this.$propHandlers.c=this.$propHandlers.d=function(c){this.$redraw();};this.$redraw=function(i,d){if(this.$parentChart){this.$parentChart.$redraw(i,d);}};this.$regenerate=function(){this.$_style=null;this.$docompile=true;};this.$drawGraph=function(c,t){if(this.$doinit){this.$doinit=false;this.$parentAxis.$copySubPos(this);apf.draw.initLayer(this,this.$parentChart);}else{if(t){this.$parentAxis.$copySubPos(this);apf.draw.resizeLayer(this,this.$parentChart);}}if(this.$docompile){if(!this.$datamode){return this.$redraw();}this.$docompile=false;var A={};var j=this.mode+this.$parentAxis.mode;if(!this.$_style){this.$_style=apf.draw.parseStyle(apf.chart_draw["_"+j],this.style+this.$styletag,A);}if(this.$_style.graph&&this.$_style.graph.$clslist&&this.v_class){for(var C,i=this.v_class,B=this.v_state,s=0,z=i.length;s<z;s++){if(C=i[s]){B[s]=this.$_style.graph.$clslist[C];}}}this.$datatype=apf.chart_draw["dt_"+this.$datamode+this.dataslice](this);this.$drawCode=apf.chart_draw[j](this,this.$datatype,this.$_style);}if(this.$drawCode){this.$drawCode(this,c);if(this._anim){this.$redraw();}}};this.$drawBalloons=function(c,t){if(this.$doinit){this.$doinit=false;apf.draw.initLayer(this,this.$parentChart);}else{if(t){this.$parentAxis.$copySubPos(this);apf.draw.resizeLayer(this,this.$parentChart);}}if(this.$docompile){if(!this.$datamode){return this.$redraw();}this.$docompile=false;var A={};var j=this.mode+this.$parentAxis.mode;if(!this.$_style){this.$_style=apf.draw.parseStyle(apf.chart_draw["_"+j],this.style+this.$styletag,A);}if(this.$_style.graph.$clslist&&this.v_class){for(var C,i=this.v_class,B=this.v_state,s=0,z=i.length;s<z;s++){if(C=i[s]){B[s]=this.$_style.graph.$clslist[C];}}}this.$datatype=apf.chart_draw["dt_"+this.$datamode+this.dataslice](this);this.$drawCode=apf.chart_draw[j](this,this.$datatype,this.$_style);}if(this.$drawCode){this.$drawCode(this,c);if(this._anim){this.$redraw();}}};this.$mouseDown=function(i,j,l){};this.$mouseUp=function(d,i){};this.lastOver=-1;this.$mouseMove=function(l,s,i,N,T,V,X){if(!this.$drawCode){return;}var M=this.m;M.x=V*this.ds,M.y=X*this.ds;var P=this.$drawCode(this,this.parentNode,this.m),t,Y;var R=(new Date()).getTime()*0.001;var W=this;function U(w,a,n){var u,j,q,c,d;u=(c=W.v_state[w])&4294901760,j=c&65535;q=Math.min(1,(R-W.v_time[w])*(W.$_style.graph.$speedlut?(W.$_style.graph.$speedlut[c]||1):1));W.v_state[w]=d=j|a;if(W.$_style.graph.notransit==1||W.$_style.graph.nogap==1){q=1;}W.v_time[w]=u==n?(R-(1-q)/(W.$_style.graph.$speedlut?(W.$_style.graph.$speedlut[d]||1):1)):R;}function O(n,u,q,c){var j,d,a,w;j=(a=W.v_state[n])&4294901760,d=a&65535;W.v_state[n]=w=d|u,W.v_time[n]=(q-(1-c)/(this.$_style.graph.$speedlut?(this.$_style.graph.$speedlut[w]||1):1));}if(P!=(t=this.lastOver)){var Z=apf.draw.stateBit;if(t>=0){U(t,Z.hoverout,Z.hoverin);if(this.$_style.graph.nogap==1&&R-this.lasttime<0.3){if(R-this.lasttime==0){}var Q=this.lastOut,m=t;if(Q>m){for(var o=Q;o>m;o--){O(o,Z.hoverout,R-(R-this.lasttime)*(1-(Q-o)/(Q-m)),1);}}else{for(var o=Q;o<m;o++){O(o,Z.hoverout,R-(R-this.lasttime)*((m-o)/(m-Q)),1);}}}this.lasttime=R,this.lastOut=t,this.lastMicro=this.$microtime;}if(P>=0){U(P,Z.hoverin,Z.hoverout);}this.lastOver=P;this.$redraw();}};this.$load=function(Q){apf.xmldb.addNodeListener(Q,this);var V=this.v_yval=[];var G=this.v_xval=[];var T=this.v_zval=[];var P=this.v_time=[];var I=this.v_caption=[];var O=this.v_state=[];if(this.$hasBindRule("series")){var R=(this.$getBindRule("series",Q)||{})[4];this.setProperty("series",{series:this.$applyBindRule("series",Q),split:R.getAttribute("split")||",",datatype:R.getAttribute("datatype")||"1X",caption:R.getAttribute("caption")||null,cls:R.getAttribute("class")||null,delim:R.getAttribute("delimeter")||" ",formula:R.getAttribute("formula")||null,length:R.getAttribute("length")||null,mip:R.getAttribute("mip")||null});}else{if(this.$hasBindRule("formula")){this.setProperty("formula",this.$applyBindRule("formula",Q));}else{var W=this.v_nodes=this.getTraverseNodes(Q);var n,t,N,M,U,F=(new Date()).getTime()*0.001;if(!this.$hasBindRule("y")){apf.console.warn("No y binding rule found for graph "+this.name+" ["+this.localName+"]");}else{var K=this.$hasBindRule("z")?true:false,J=this.$hasBindRule("x")?true:false;for(N=0,U=W.length;N<U;N++){n=W[N];this.v_time[N]=F;V[N]=parseFloat(this.$applyBindRule("y",n));if(J){G[N]=parseFloat(this.$applyBindRule("x",n));if(K){T[N]=parseFloat(this.$applyBindRule("z",n));}}var X=this.$applyBindRule("css",n);I[N]=this.$applyBindRule("caption",n);O[N]=0;}this.$sourcetype="seriesX";}if(U!=this.length){this.setProperty("length",U);}}}};this.$xmlUpdate=function(R,af,ab,t){if(R=="redo-remove"){var M=false,ac=this.getModel(true);if(ac){var X=ac.getXpathByAmlNode(this);if(X){var af=ac.data.selectSingleNode(X);if(af!=this.xmlRoot){M=true;}}}if(M||this.xmlRoot==af){return ac.$waitForXml(this);}}if(this.$hasBindRule("series")||this.$hasBindRule("formula")){if(t&&!t.xmlNode){t.xmlNode=this.xmlRoot;}}else{var ae=this.v_yval=[];var n=this.v_xval=[];var aa=this.v_zval=[];var Y=this.v_time=[];var O=this.v_caption=[];var V=this.v_state=[];var ag=this.v_nodes=this.getTraverseNodes(this.xmlRoot);var W,Z,U,T,ad,Q=(new Date()).getTime()*0.001;if(!this.$hasBindRule("y")){apf.console.warn("No y binding rule found for graph "+this.name+" ["+this.localName+"]");}else{var P=this.$hasBindRule("z")?true:false,N=this.$hasBindRule("x")?true:false;for(U=0,ad=ag.length;U<ad;U++){W=ag[U];this.v_time[U]=Q;ae[U]=parseFloat(this.$applyBindRule("y",W));if(N){n[U]=parseFloat(this.$applyBindRule("x",W));if(P){aa[U]=parseFloat(this.$applyBindRule("z",W));}}var ah=this.$applyBindRule("css",W);O[U]=this.$applyBindRule("caption",W);V[U]=0;}this.$sourcetype="seriesX";}if(ad!=this.length){this.setProperty("length",ad);}this.$redraw();}};this.addEventListener("DOMNodeInsertedIntoDocument",function(d){this.$parentAxis=this.parentNode;this.$parentChart=this.$parentAxis.parentNode;var i=this.getElementsByTagNameNS(apf.ns.apf,"style");if(i.length>0){this.$styletag=i[0].firstChild.nodeValue;}});}).call(apf.Graph.prototype=new apf.AmlElement());apf.remote=function(i,d){this.$init(d||"remote",apf.NODE_HIDDEN,i);};(function(){this.lookup={};this.select=[];this.models=[];this.rsbQueue={};this.queueTimer=null;this.discardBefore=null;this.$attrExcludePropBind=apf.extend({match:1},this.$attrExcludePropBind);this.sendChange=function(j,l){if(apf.xmldb.disableRSB){return;}clearTimeout(this.queueTimer);this.queueMessage(j,l,this);if(!apf.isO3){var i=this;this.queueTimer=$setTimeout(function(){i.processQueue(i);});}else{this.processQueue(this);}};this.buildMessage=function(m,n){for(var l=0,i=m.length;l<i;l++){if(m[l]&&m[l].nodeType){m[l]=this.xmlToXpath(m[l],n.data);}}return{model:n.name,args:m,timestamp:new Date().toGMTString()};};this.queueMessage=function(l,i,j){if(!i.id){i.setAttribute("id","rmtRsbGen".appendRandomNumber(5));}if(!j.rsbQueue){j.rsbQueue={};}if(!j.rsbQueue[i.id]){j.rsbQueue[i.id]=[];j.rsbModel=i;}j.rsbQueue[i.id].push(this.buildMessage(l,i));};this.processQueue=function(i){if(i===this){clearTimeout(this.queueTimer);}if(apf.xmldb.disableRSB){return;}for(var d in i.rsbQueue){if(!i.rsbQueue[d].length){continue;}this.transport.sendRSB(apf.serialize(i.rsbQueue[d]));}i.rsbQueue={};};this.receiveChange=function(s){if(apf.xmldb.disableRSB){return;}if(apf.offline&&apf.offline.inProcess==2){queue.push(s);return;}if(s.timestamp<this.discardBefore){return;}var u=apf.nameserver.get("model",s.model),q=s.args;var t=this.xpathToXml(q[1],u.data);if(!t){return;}var n=apf.xmldb.disableRSB,w;apf.xmldb.disableRSB=2;switch(q[0]){case"setTextNode":apf.xmldb.setTextNode(t,q[2],q[3]);break;case"setAttribute":apf.xmldb.setAttribute(t,q[2],q[3],q[4]);break;case"addChildNode":apf.xmldb.addChildNode(t,q[2],q[3],this.xpathToXml(q[4],u.data),q[5]);break;case"appendChild":w=(q[3]?this.xpathToXml(q[3],u.data):null);if(typeof q[2]=="string"){q[2]=apf.getXml(q[2]);}apf.xmldb.appendChild(t,apf.xmldb.cleanNode(q[2]),w,q[4],q[5]);break;case"moveNode":w=(q[3]?this.xpathToXml(q[3],u.data):null);var o=this.xpathToXml(q[2],u.data);apf.xmldb.appendChild(t,o,w,q[4],q[5]);break;case"removeNode":apf.xmldb.removeNode(t,q[2]);break;}apf.xmldb.disableRSB=n;};this.xmlToXpath=apf.xmlToXpath;this.xpathToXml=apf.xpathToXml;this.addEventListener("DOMNodeInsertedIntoDocument",function(j){var l=this;if(apf.offline&&apf.offline.enabled){var i=[];apf.offline.addEventListener("afteronline",function(){for(var a=0,c=i.length;a<c;a++){l.receiveChange(i[a]);}i.length=0;});}this.transport=self[this["transport"]];this.transport.addEventListener("datachange",function(d){var q=apf.unserialize(d.data),a=0,c=q.length;for(;a<c;a++){l.receiveChange(q[a]);}});});}).call(apf.remote.prototype=new apf.AmlElement());apf.aml.setElement("remote",apf.remote);apf.aml.setElement("unique",apf.BindingRule);apf.auth=function(i,d){this.$init(d||"auth",apf.NODE_HIDDEN,i);this.$services={};this.$cache={};this.$queue=[];this.$credentials=null;};apf.aml.setElement("auth",apf.auth);(function(){this.$retry=true;this.$loggedIn=false;this.$needsLogin=false;this.$autoStart=true;this.$hasHost=false;this.inProcess=0;this.$attrExcludePropBind=apf.extend({login:1,logout:1},this.$attrExcludePropBind);this.$booleanProperties.autostart=true;this.$booleanProperties.remember=true;this.$supportedProperties.push("login","logout","fail-state","error-state","login-state","logout-state","waiting-state","window","autostart","remember");this.$propHandlers.login=this.$propHandlers["login-state"]=function(a){this.$services["default"]=a?this:null;this.$needsLogin=a?true:false;};this.register=function(a){this.$services[a.name]=a;this.$needsLogin=true;};this.unregister=function(i){var a;delete this.$services[i.name];if(!(a in this.$services)){this.$needsLogin=false;}};this.addEventListener("DOMNodeInsertedIntoDocument",function(a){this.inited=true;if(this.parentNode&&this.parentNode.$setAuth){this.parentNode.$setAuth(this);this.$hasHost=true;}if(this.$autoStart&&!this.$hasHost){var i=this;apf.addEventListener("load",function(){i.authRequired();apf.removeEventListener("load",arguments.callee);});}});this.addEventListener("authrequired",function(){if(self[this.window]){this.win=self[this.window];if(this.win){this.win.show();return false;}}});this.addEventListener("beforelogin",function(){if(self[this["waiting-state"]]){this.state=self[this["waiting-state"]];if(this.state){this.state.activate();}}});function c(a){var i=(a.state==apf.TIMEOUT?self[this["error-state"]]:self[this["fail-state"]])||self[this["fail-state"]];if(i){this.state=i;if(this.state){this.state.activate();return false;}}}this.addEventListener("loginfail",c);this.addEventListener("logoutfail",c);this.addEventListener("logoutsuccess",function(){if(self[this["logout-state"]]){this.state=self[this["logout-state"]];if(this.state){this.state.activate();}}});this.addEventListener("loginsuccess",function(a){if(self[this.window]){this.win=self[this.window];if(this.win){this.win.hide();}}if(self[this["login-state"]]){this.state=self[this["login-state"]];if(this.state){this.state.activate();}}if(a.data&&this.model){this.model=apf.nameserver.get("model",this.model);if(this.model){this.model.load(a.data);}}});this.loginFn=function(B,u,s,E){if(!E){E={};}E.username=B;E.password=u;if(this.dispatchEvent("beforelogin",E)===false){return false;}this.inProcess=1;var w=0,A=0,z=this,C=function(){if(A!=++w){return;}z.inProcess=0;z.$loggedIn=true;z.clearQueue();if(s){s();}};if(this.$hasHost){this.$credentials=E;s=this.$hostCallback;this.$hostCallback=null;A=1;C();this.dispatchEvent("loginsuccess",{state:1,data:null,bubbles:true});if(!this.remember){this.$credentials=null;}}else{if(!E.service){var a=E.$services||this.$services;for(var D in a){A++;this.$do(D,E,"in",null,C);}}else{if(E.service){A=1;this.$do(E.service,E,"in",null,C);}}}};this.relogin=function(){if(this.dispatchEvent("beforerelogin")===false){return false;}var m,a=0,o=0,q=this,n=function(){if(o!=++a){return;}q.inProcess=0;q.$loggedIn=true;q.clearQueue();};for(m in this.$services){if(!this.$cache[m]){return false;}o++;this.$do(m,this.$cache[m],"in",true,n);}return true;};this.$do=function(t,s,o,a,w){var q=this.$services[t],u=s.userdata=this;s.ignoreOffline=true;s.callback=function(C,i,m){if(i==apf.TIMEOUT&&m.retries<apf.maxHttpRetries){return m.tpModule.retry(m.id);}var n=u.dispatchEvent("log"+o+"check",apf.extend({state:i,data:C,service:t,bubbles:true},m)),l=typeof n=="boolean"?!n:!(i==apf.SUCCESS||o=="out"&&m.http.status==401);if(l){u.inProcess=0;if(a){return u.authRequired();}var j=new Error(apf.formatErrorString(0,null,"Logging "+o,"Error logging in: "+m.message));if(u.dispatchEvent("log"+o+"fail",apf.extend({error:j,service:t,state:i,data:C,bubbles:true},m))!==false){throw j;}return;}if(o=="in"){if(!a&&u.$retry){var B={};for(var d in s){if("object|array".indexOf(typeof s[d])==-1){B[d]=s[d];}}u.$cache[t||"default"]=B;}}else{if(u.$cache[t||"default"]){u.$cache[t||"default"]=null;}u.authRequired();}if(w){w();}u.dispatchEvent("log"+o+"success",apf.extend({state:i,service:t,data:C,bubbles:true},m));};apf.saveData(q.getAttribute("log"+o),s);};this.clearQueue=function(){if(!this.$loggedIn){return;}var l=this.$queue.slice();this.$queue.length=0;for(var i=0;i<l.length;i++){var a=l[i];if(!this.$loggedIn){this.$queue.push(a);continue;}if(a.retry){a.$retry.call(a.object);}else{if(a.id){a.tpModule.retry(a.id);}}}if(this.$queue.length){this.clearQueue();}};this.logoutFn=function(a,j){if(!j){j={};}if(this.dispatchEvent("beforelogout",j)===false){return;}this.$loggedIn=false;if(!j.service){for(var l in this.$services){this.$do(l,j,"out",null,a);}}else{if(j.service){this.$do(j.service,j,"out",null,a);}}};this.authRequired=function(j,a){if(j&&j.userdata==this){return;}if(this.$loggedIn&&!a&&this.$retry&&this.relogin()){var l=false;}else{if(this.inProcess!=1){if(this.$hasHost&&typeof j=="function"){if(this.$credentials){return j();}this.$hostCallback=j;}var l=this.dispatchEvent("authrequired",apf.extend({bubbles:true,data:j&&j.data},j));}}this.$loggedIn=false;if(l===false){if(j){this.$queue.push(j);}return true;}};}).call(apf.auth.prototype=new apf.AmlElement());apf.template=function(i,d){this.$init(d||"template",apf.NODE_HIDDEN,i);};(function(){this.$focussable=false;this.$frags={};this.getNewInstance=function(s,A,u,t){if(this.$frags[A]){var o=this.$frags[A];}else{var w,z,q,o=this.$frags[A]=this.cloneNode(true);o.$int=s;if(u){w=apf.xmldb.findModel(u);z=apf.xmlToXpath(u,w.data,true)||".";o.attributes.push(q=new apf.AmlAttr(o,"model",""));q.inheritedValue=[w.name,z];}o.ownerDocument.$domParser.$continueParsing(o,{delay:true});}return o;};this.destroyInstance=function(i){var d=this.$frags[i];delete this.$frags[i];d.destroy(true);};}).call(apf.template.prototype=new apf.AmlElement());apf.aml.setElement("template",apf.template);apf.radio=function(i,d){this.$init(d||"radio",apf.NODE_HIDDEN,i);};apf.check=function(i,d){this.$init(d||"check",apf.NODE_HIDDEN,i);};apf.item=function(i,d){this.$init(d||"item",apf.NODE_HIDDEN,i);};(function(){this.$focussable=false;this.$childProperty="caption";this.$canLeechSkin="item";this.implement(apf.ChildValue);this.$attrExcludePropBind=apf.extend({match:1},this.$attrExcludePropBind);this.$supportedProperties.push("submenu","value","match","group","icon","checked","selected","disabled","caption");this.$propHandlers.submenu=function(a){apf.setStyleClass(this.$ext,"submenu");};this.$propHandlers.select=function(a){this.select=a?"self::"+a.split("|").join("|self::"):a;};this.$propHandlers.hotkey=function(a){if(this.$hotkey){apf.setNodeValue(this.$hotkey,a);}if(this.$lastHotkey){apf.removeHotkey(this.$lastHotkey);}if(a){this.$lastHotkey=a;var i=this;apf.registerHotkey(a,function(){var d=apf.document.getElementsByTagNameNS(apf.ns.aml,"button");for(var n=0;n<d.length;n++){if(d[n].submenu==i.parentNode.name){var o=d[n];o.$setState("Over",{});$setTimeout(function(){o.$setState("Out",{});},200);break;}}i.$down();i.$up();i.$click();});}};this.$propHandlers.icon=function(a){if(this.$icon){apf.skins.setIcon(this.$icon,a,this.parentNode.iconPath);}};this.$propHandlers.caption=function(a){if(this.$caption){apf.setNodeValue(this.$caption,a);}};this.$propHandlers.checked=function(a){if(this.localName!="check"){return;}if(apf.isTrue(a)){apf.setStyleClass(this.$ext,"checked");}else{apf.setStyleClass(this.$ext,"",["checked"]);}};this.$propHandlers.selected=function(a){if(this.localName!="radio"){return;}if(apf.isTrue(a)){apf.setStyleClass(this.$ext,"selected");}else{apf.setStyleClass(this.$ext,"",["selected"]);}};this.$propHandlers.disabled=function(a){if(apf.isTrue(a)){apf.setStyleClass(this.$ext,"disabled");}else{apf.setStyleClass(this.$ext,"",["disabled"]);}};this.enable=function(a){apf.setStyleClass(this.$ext,this.parentNode.$baseCSSname+"Disabled");};this.disable=function(a){apf.setStyleClass(this.$ext,null,[this.parentNode.$baseCSSname+"Disabled"]);};this.show=function(){this.$ext.style.display="block";};this.hide=function(){this.$ext.style.display="none";};this.addEventListener("AMLReparent",function(l,a,j){if(!this.$amlLoaded){return;}if(!j&&this.skinName!=a.skinName){this.loadAml();}});this.$down=function(){};this.$up=function(){if(this.localName=="radio"){this.parentNode.select(this.group,this.value||this.caption);}else{if(this.localName=="check"){this.$handlePropSet("checked",!this.checked);}}if(this.submenu){this.$over(null,true);return;}this.parentNode.$hideTree=true;this.parentNode.hide();this.parentNode.dispatchEvent("itemclick",{value:this.value||this.caption});};this.$click=function(){this.dispatchEvent("click",{xmlContext:this.parentNode.xmlReference,opener:this.parentNode.opener});};var c;this.$out=function(a){if(apf.isChildOf(this.$ext,a.toElement||a.explicitOriginalTarget)||apf.isChildOf(this.$ext,a.srcElement||a.target)){return;}clearTimeout(c);if(!this.submenu||this.$submenu(true)){apf.setStyleClass(this.$ext,"",["hover"]);var i=this.parentNode.$selected;if(i&&i!=this){apf.setStyleClass(i.$ext,"",["hover"]);}this.parentNode.$selected=null;}};this.$over=function(l,m){if(this.parentNode.$selected==this){return;}if(this.parentNode.$selected){apf.setStyleClass(this.parentNode.$selected.$ext,"",["hover"]);}apf.setStyleClass(this.$ext,"hover");this.parentNode.$selected=this;if(!m&&(apf.isChildOf(this.$ext,l.toElement||l.explicitOriginalTarget)||apf.isChildOf(this.$ext,l.fromElement||l.target))){return;}var a=this.parentNode.$showingSubMenu;if(a){if(a.name==this.submenu){return;}a.hide();this.parentNode.$showingSubMenu=null;}if(this.submenu){if(m){this.$submenu();}else{var n=this;clearTimeout(c);c=$setTimeout(function(){n.$submenu();c=null;},200);}}};this.$submenu=function(n,m){if(!this.submenu){return true;}var l=self[this.submenu];if(!l){return;}if(!n){this.parentNode.$showingSubMenu=l;var a=apf.getAbsolutePosition(this.$ext,this.parentNode.$ext.offsetParent);l.display(a[0]+this.$ext.offsetWidth-3,a[1]+3,false,this,this.parentNode.xmlReference,this.parentNode.$uniqueId);l.setAttribute("zindex",(this.parentNode.zindex||1)+1);}else{if(l.visible&&!m){return false;}if(this.parentNode.$showingSubMenu){this.parentNode.$showingSubMenu=null;}apf.setStyleClass(this.$ext,"",["hover"]);l.hide();return true;}};this.$draw=function(m){var a=this.parentNode;while(a.$canLeechSkin=="item"){a=a.parentNode;}if(a.hasFeature(apf.__MULTISELECT__)){var n=this;if(!this.$hasSetSkinListener){var l;this.parentNode.addEventListener("$skinchange",l=function(){if(n.$amlDestroyed){return;}if(n.$ext.parentNode){this.$deInitNode(n,n.$ext);}var j=a==n.parentNode?a.$int:n.parentNode.$int;var d=j.lastChild;a.$add(n,n.getAttribute(apf.xmldb.xmlIdTag)+"|"+this.$uniqueId,n.parentNode,j!=a.$int&&j,null);a.$fill();if(a.$isTreeArch){n.$int=a.$getLayoutNode("item","container",n.$ext=d&&d.nextSibling||j.firstChild);}else{n.$ext=d&&d.nextSibling||j.firstChild;}var i=n;while((i=i.nextSibling)&&i.nodeType!=1){}if(!i||i.$canLeechSkin!="item"){a.dispatchEvent("afterload");}});this.addEventListener("DOMNodeRemoved",function(d){this.parentNode.removeEventListener("$skinchange",l);});this.$hasSetSkinListener=true;}if(!a.$itemInited){a.canrename=false;a.$removeClearMessage();a.$itemInited=[a.getTraverseNodes,a.getFirstTraverseNode,a.getTraverseParent];a.getTraverseNodes=function(d){return(d||a).getElementsByTagNameNS(apf.ns.apf,"item");};a.getFirstTraverseNode=function(d){return(d||a).getElementsByTagNameNS(apf.ns.apf,"item")[0];};a.getTraverseParent=function(d){return d&&d.parentNode;};a.each=(this.prefix?this.prefix+":":"")+"item";a.$preventDataLoad=true;a.$initingModel=true;a.$setDynamicProperty("icon","[@icon]");a.$setDynamicProperty("image","[@image]");a.$setDynamicProperty("caption","[label/text()|@caption|text()]");a.$setDynamicProperty("eachvalue","[value/text()|@value|text()]");a.$canLoadDataAttr=false;if(!a.xmlRoot){a.xmlRoot=a;}}this.$loadAml=function(){if(!this.getAttribute("caption")){this.setAttribute("caption",this.caption);}var j=a==this.parentNode?a.$int:this.parentNode.$int;var d=j.lastChild;if(!a.documentId){a.documentId=apf.xmldb.getXmlDocId(this);}a.$add(this,apf.xmldb.nodeConnect(a.documentId,this,null,a),this.parentNode,j!=a.$int&&j,null);a.$fill();if(a.$isTreeArch){this.$int=a.$getLayoutNode("item","container",this.$ext=d&&d.nextSibling||j.firstChild);}else{this.$ext=d&&d.nextSibling||j.firstChild;}var i=this;while((i=i.nextSibling)&&i.nodeType!=1){}if(!i||i.$canLeechSkin!="item"){a.dispatchEvent("afterload");if(a.autoselect){a.$selectDefault(this.parentNode);}}};return;}this.$ext=this.$getExternal(this.$isLeechingSkin?"item":"main",null,function(i){var d="apf.lookup("+this.$uniqueId+")";i.setAttribute("onmouseup",d+".$up(event)");i.setAttribute("onmousemove",d+".$over(event)");i.setAttribute("onmouseout",d+".$out(event)");i.setAttribute("onmousedown",d+".$down()");i.setAttribute("onclick",d+".$click()");});apf.setStyleClass(this.$ext,this.localName);this.$caption=this.$getLayoutNode("item","caption",this.$ext);this.$icon=this.$getLayoutNode("item","icon",this.$ext);this.$hotkey=this.$getLayoutNode("item","hotkey",this.$ext);if(!m&&this.nextSibling&&this.nextSibling.$ext){this.$ext.parentNode.insertBefore(this.$ext,this.nextSibling.$ext);}};this.addEventListener("DOMNodeInsertedIntoDocument",function(a){var i=this.$ext?true:false;if(i){if(typeof this.checked!=="undefined"){this.$handlePropSet("checked",this.checked);}else{if(typeof this.selected!=="undefined"){this.$handlePropSet("selected",this.selected);}}if(this.disabled){this.$handlePropSet("disabled",this.disabled);}if(this.caption){this.$handlePropSet("caption",this.caption);}}});}).call(apf.item.prototype=new apf.Presentation());apf.radio.prototype=apf.check.prototype=apf.item.prototype;apf.aml.setElement("radio",apf.radio);apf.aml.setElement("check",apf.check);apf.aml.setElement("item",apf.item);apf.WinServer={count:9000,wins:[],setTop:function(j,l){if(j.$opened){if(j.$opened.visible){return;}else{delete j.$opened;}}var i;if(!l&&this.wins.length){var i=this.wins[this.wins.length-1];if(i==j){return;}if(!i.modal||!i.visible){i=null;}else{if(i&&j.modal){j.$opener=i;i.$opened=j;i=null;}}}this.count+=2;j.setProperty("zindex",this.count);this.wins.remove(j);this.wins.push(j);if(i){this.setTop(i,true);}return j;},setNext:function(){if(this.wins.length<2){return;}var d,i=this.wins.shift();do{if(this.setTop(d||i).visible){break;}d=this.wins.shift();}while(i!=d);},setPrevious:function(){if(this.wins.length<2){return;}this.wins.unshift(this.wins.pop());var d,i=this.wins.pop();do{if(this.setTop(d||i).visible){break;}d=this.wins.pop();}while(i!=d);},remove:function(c){this.wins.remove(c);}};apf.toolwindow=function(i,d){this.$init(d||"toolwindow",apf.NODE_VISIBLE,i);};apf.modalwindow=function(i,d){this.$init(d||"modalwindow",apf.NODE_VISIBLE,i);};apf.AmlWindow=function(i,d){this.$init(d||"window",apf.NODE_VISIBLE,i);};(function(){this.implement(apf.Docking,apf.BaseStateButtons);this.$isWindowContainer=true;this.collapsedHeight=30;this.canHaveChildren=2;this.visible=false;this.showdragging=false;this.kbclose=false;this.$focussable=apf.KEYBOARD;this.setTitle=function(a){this.setProperty("title",a,false,true);return this;};this.setIcon=function(a){this.setProperty("icon",a,false,true);return this;};this.show=function(a){this.execAction=a;this.setProperty("visible",true,false,true);return this;};this.slideIn=function(z,B){if(!z){z="bottom";}var a=this.center;this.center=false;this.setProperty("visible",true);this.center=a;var C=0,E=0,c=(apf.isIE?this.$ext.offsetParent.offsetWidth:window.innerWidth),A=(apf.isIE?this.$ext.offsetParent.offsetHeight:window.innerHeight),F=Math.max(0,((c-this.$ext.offsetWidth)/2)),G=Math.max(0,((A-this.$ext.offsetHeight)/3)),D="top",w=10;switch(z){case"top":C=-(this.$ext.offsetHeight)-w;E=B?0:G;break;case"left":C=-(this.$ext.offsetWidth)-w;E=B?0:F;D="left";break;case"bottom":C=A+this.$ext.offsetHeight+w;E=B?A-this.$ext.offsetHeight:G;break;case"right":C=c+this.$ext.offsetLeft+w;E=B?c-this.$ext.offsetWidth:F;D="left";break;}apf.tween.single(this.$ext,{steps:apf.isIphone?5:30,interval:10,from:C,to:E,type:D,anim:apf.tween.EASEIN});return this;};this.slideOut=function(q){if(!q){q="bottom";}var t=0,a=0,c="top",o=10;switch(q){case"top":t=this.$ext.offsetTop;a=-(this.$ext.offsetHeight)-o;break;case"left":t=this.$ext.offsetLeft;a=-(this.$ext.offsetWidth)-o;c="left";break;case"bottom":t=this.$ext.offsetTop;a=(apf.isIE?this.$ext.offsetParent.offsetHeight:window.innerHeight)+this.$ext.offsetHeight+o;break;case"right":t=this.$ext.offsetLeft;a=(apf.isIE?this.$ext.offsetParent.offsetWidth:window.innerWidth)+this.$ext.offsetLeft+o;c="left";break;}var s=this;apf.tween.single(this.$ext,{steps:apf.isIphone?5:30,interval:10,from:t,to:a,type:c,anim:apf.tween.EASEOUT,onfinish:function(){s.setProperty("visible",false);}});return this;};this.bringToFront=function(){apf.WinServer.setTop(this);return this;};this.syncAlignment=function(a){if(a.hidden==3){apf.WinServer.setTop(this);}if(a.state>0){this.$setStyleClass(this.$ext,this.$baseCSSname+"Min",[this.$baseCSSname+"Edit",this.$baseCSSname+"Max"]);}else{this.$setStyleClass(this.$ext,"",[this.$baseCSSname+"Min",this.$baseCSSname+"Edit",this.$baseCSSname+"Max"]);}};this.$booleanProperties.modal=true;this.$booleanProperties.center=true;this.$booleanProperties.transaction=true;this.$booleanProperties.hideselects=true;this.$booleanProperties.showdragging=true;this.$booleanProperties.kbclose=true;this.$supportedProperties.push("title","icon","modal","minwidth","minheight","hideselects","center","kbclose","maxwidth","maxheight","showdragging","transaction");this.$propHandlers.modal=function(a){if(a&&!this.oCover){var c=this.$getLayoutNode("cover");if(c){this.oCover=apf.insertHtmlNode(c,this.$pHtmlNode);if(!this.visible){this.oCover.style.display="none";}if(this.zindex){this.oCover.style.zIndex=this.zindex;}}}if(!a&&this.oCover){this.oCover.style.display="none";}};this.$propHandlers.center=function(a){this.$ext.style.position="absolute";};this.$propHandlers.title=function(a){if(this.oTitle){this.oTitle.nodeValue=a;}};this.$propHandlers.icon=function(a){if(!this.oIcon){return;}this.oIcon.style.display=a?"block":"none";apf.skins.setIcon(this.oIcon,a,this.iconPath);};var i=[],d;this.$propHandlers.visible=function(t){if(apf.isTrue(t)){if(this.oCover){if(this.oCover.offsetParent){this.oCover.style.height=Math.max(this.oCover.offsetParent.scrollHeight,document.documentElement.offsetHeight)+"px";this.oCover.style.width=this.oCover.offsetParent.scrollWidth+"px";}this.oCover.style.display="block";}this.state=this.state.split("|").remove("closed").join("|");this.$ext.style.display="block";if(apf.layout&&this.$int){apf.layout.forceResize(this.$int);}if(this.center){var w=!this.$ext.offsetParent||this.$ext.offsetParent.tagName=="BODY"?[apf.getWindowWidth(),apf.getWindowHeight()]:[this.$ext.offsetParent.offsetWidth,this.$ext.offsetParent.offsetHeight,0,0];if(w.length==2){w.push(document.documentElement.scrollLeft,document.documentElement.scrollTop);}this.$ext.style.left=(Math.max(0,((w[0]-parseInt(this.width))/2))+w[2])+"px";this.$ext.style.top=(Math.max(0,((w[1]-parseInt(this.height))/3))+w[3])+"px";}if(!apf.canHaveHtmlOverSelects&&this.hideselects){i=[];var a=document.getElementsByTagName("select");for(var z=0;z<a.length;z++){var c=apf.getStyle(a[z],"display");i.push([a[z],c]);a[z].style.display="none";}}if(this.modal){this.bringToFront();}if(!this.$rendered){this.addEventListener("afterrender",function(){if(this.$amlLoaded&&(this.model||(!this.dockable||!this.aData)&&!this.$isWidget&&this.localName!="toolwindow")){this.focus(false,{mouse:true});}});}else{if(this.$amlLoaded&&(this.model||(!this.dockable||!this.aData)&&!this.$isWidget&&this.localName!="toolwindow")){this.focus(false,{mouse:true});}}if(apf.isIE){var s=this.$ext.className;this.$ext.className="rnd"+Math.random();this.$ext.className=s;}var u=this;$setTimeout(function(){u.dispatchEvent("show");});}else{if(this.oCover){this.oCover.style.display="none";}this.$ext.style.display="none";if(!apf.canHaveHtmlOverSelects&&this.hideselects){for(var z=0;z<i.length;z++){i[z][0].style.display=i[z][1];}}if(this.hasFocus()){apf.window.moveNext(true,this,true);}this.dispatchEvent("close");this.visible=false;}d=t;};this.$propHandlers.zindex=function(a){this.$ext.style.zIndex=a+1;if(this.oCover){this.oCover.style.zIndex=a;}};if(!apf.isIphone){this.addEventListener("keydown",function(n){var o=n.keyCode;var a=n.ctrlKey;var q=n.shiftKey;var c=false;switch(o){case 38:if(q&&this.resizable){this.setProperty("height",Math.max(this.minheight||0,this.$ext.offsetHeight-(a?50:10)));}else{if(this.draggable){this.setProperty("top",this.$ext.offsetTop-(a?50:10));}}break;case 37:if(q&&this.resizable){this.setProperty("width",Math.max(this.minwidth||0,this.$ext.offsetWidth-(a?50:10)));}else{if(this.draggable){this.setProperty("left",this.$ext.offsetLeft-(a?50:10));}}break;case 39:if(q&&this.resizable){this.setProperty("width",Math.min(this.maxwidth||10000,this.$ext.offsetWidth+(a?50:10)));}else{if(this.draggable){this.setProperty("left",this.$ext.offsetLeft+(a?50:10));}}break;case 40:if(q&&this.resizable){this.setProperty("height",Math.min(this.maxheight||10000,this.$ext.offsetHeight+(a?50:10)));}else{if(this.draggable){this.setProperty("top",this.$ext.offsetTop+(a?50:10));}}break;default:c=null;return;}if(apf.hasSingleRszEvent){apf.layout.forceResize(this.$int);}return c;},true);this.addEventListener("keydown",function(a){if(a.keyCode==27&&this.buttons.indexOf("close")>-1&&(!this.dockable||!this.aData)&&this.kbclose){this.close();}});}this.$draw=function(){this.popout=apf.isTrue(this.getAttribute("popout"));if(this.popout){this.$pHtmlNode=document.body;}this.$ext=this.$getExternal(null,null,function(c){this.$initButtons(c);});this.oTitle=this.$getLayoutNode("main","title",this.$ext);this.oIcon=this.$getLayoutNode("main","icon",this.$ext);this.oDrag=this.$getLayoutNode("main","drag",this.$ext);this.$buttons=this.$getLayoutNode("main","buttons",this.$ext);this.oDrag.host=this;if(this.popout){this.$ext.style.position="absolute";}if(this.oIcon){this.oIcon.style.display="none";}if(!apf.isIphone){var a=this;this.oDrag.onmousedown=function(c){if(!c){c=event;}if(!a.$isWidget&&(!a.aData||!a.dockable||a.aData.hidden==3)){apf.WinServer.setTop(a);}if(a.$lastState.maximized){return false;}if(a.aData&&a.dockable){if(a.$lastState.normal){a.startDocking(c);}return false;}};this.$ext.onmousedown=function(){var c=apf.document.activeElement;if(c&&c.$focusParent!=a&&c.$focusParent.modal){return false;}if(!a.$isWidget&&(!a.aData||!a.dockable||a.aData.hidden==3)){apf.WinServer.setTop(a);}if(!a.$lastState.normal){return false;}};this.$ext.onmousemove=function(){if(!a.$lastState.normal){return false;}};}};this.$loadAml=function(a){apf.WinServer.setTop(this);this.$int=this.$getLayoutNode("main","container",this.$ext);if(!apf.isIphone){if(this.oTitle){var c=this;(this.oTitle.nodeType!=1?this.oTitle.parentNode:this.oTitle).ondblclick=function(l){if(c.state.indexOf("normal")==-1){c.restore();}else{if(c.buttons.indexOf("max")>-1){c.maximize();}else{if(c.buttons.indexOf("min")>-1){c.minimize();}}}};}if(typeof this.draggable=="undefined"){(this.$propHandlers.draggable||apf.GuiElement.propHandlers.draggable).call(this,true);this.draggable=true;}if(typeof this.buttons=="undefined"){this.buttons="";}}if(this.modal===undefined&&this.oCover){this.$propHandlers.modal.call(this,true);this.modal=true;}if(!this.visible){this.$ext.style.display="none";if(this.oCover){this.oCover.style.display="none";}}else{if(this.modal){var c=this;apf.queue.add("focus",function(){c.focus(false,{mouse:true});});}}if(this.minwidth===undefined){this.minwidth=this.$getOption("Main","min-width");}if(this.minheight===undefined){this.minheight=this.$getOption("Main","min-height");}if(this.maxwidth===undefined){this.maxwidth=this.$getOption("Main","max-width");}if(this.maxheight===undefined){this.maxheight=this.$getOption("Main","max-height");}if(this.center&&this.visible){this.visible=false;this.$ext.style.display="none";var c=this;$setTimeout(function(){c.setProperty("visible",true);});}};this.addEventListener("$skinchange",function(){if(this.title){this.$propHandlers.title.call(this,this.title);}if(this.icon){this.$propHandlers.icon.call(this,this.icon);}});this.$destroy=function(a){if(this.oDrag){this.oDrag.host=null;this.oDrag.onmousedown=null;apf.destroyHtmlNode(this.oDrag);this.oDrag=null;}this.oTitle=this.oIcon=this.oCover=null;if(this.$ext&&!a){this.$ext.onmousedown=null;this.$ext.onmousemove=null;}};}).call(apf.modalwindow.prototype=new apf.Presentation());apf.AmlWindow.prototype=apf.toolwindow.prototype=apf.modalwindow.prototype;apf.aml.setElement("toolwindow",apf.toolwindow);apf.aml.setElement("modalwindow",apf.modalwindow);apf.aml.setElement("window",apf.modalwindow);apf.xmpp=function(i,d){this.$init(d||"xmpp",apf.NODE_HIDDEN,i);this.$serverVars={};this.$reqCount=0;this.$reqStack=[];this.$listening=false;this.$listener=null;this.$sAJAX_ID=this.$makeUnique("ajaxRSB");this.$retryCount=0;this.$RID=null;};(function(){this.$server=null;this.timeout=10000;this.maxrequests=2;this.useHTTP=true;this.method="POST";this.$model=null;this.$modelContent=null;this.$xmppMethod=apf.xmpp.CONN_BOSH;this.$isPoll=false;this.$pollTimeout=2000;this.$autoRegister=false;this.$autoConfirm=true;this.$autoDeny=false;this.$canMuc=false;this.$modelContent={roster:true,chat:true,typing:true};var ao="SID",aj="JID",aq="connected",ax="roster";this.$booleanProperties["auto-register"]=true;this.$booleanProperties["auto-confirm"]=true;this.$booleanProperties["auto-deny"]=true;this.$supportedProperties.push("poll-timeout","resource","auto-register","auto-confirm","auto-deny","model","model-contents","muc-domain","muc-model");this.$propHandlers.type=function(a){this.$xmppMethod=(a=="polling")?apf.xmpp.CONN_POLL:apf.xmpp.CONN_BOSH;this.$isPoll=Boolean(this.$xmppMethod&apf.xmpp.CONN_POLL);};this.$propHandlers["poll-timeout"]=function(a){this.$pollTimeout=parseInt(a)||2000;};this.$propHandlers.resource=function(a){this.resource=a||apf.config.name||"apf".appendRandomNumber(5);};this.$propHandlers["auto-register"]=function(a){this.$autoRegister=a;};this.$propHandlers["auto-confirm"]=function(a){this.$autoConfirm=a;};this.$propHandlers["auto-deny"]=function(a){this.$autoDeny=a;};this.$propHandlers.model=function(a){if(!a){return;}this.$model=apf.setReference(a,apf.nameserver.register("model",a,new apf.model()));this.$model.id=this.$model.name=a;this.$model.load("<xmpp/>");};this.$propHandlers["model-contents"]=function(d){var c=(d||"all").splitSafe("\\|",0,true),i=0,a=c.length;this.$modelContent={roster:c[0]=="all",chat:c[0]=="all",typing:c[0]=="all"};for(;i<a;i++){c[i]=c[i].trim();if(!this.$modelContent[c[i]]){this.$modelContent[c[i]]=true;}}};this.$propHandlers["muc-model"]=function(a){this.$mucDomain=this["muc-domain"]||"conference."+this.$domain;if(a){this.$canMuc=true;this.$mucModel=apf.setReference(a,apf.nameserver.register("model",a,new apf.model()));this.$mucModel.id=this.$mucModel.name=a;this.$mucModel.load("<xmpp_muc/>");this.implement(apf.xmpp_muc);}};function ak(a){if(typeof a!="string"){throw new Error("Dependencies not met, please provide a string");}return(a+"_").appendRandomNumber(5);}function aA(a,c){var i,d=["<body "];for(i in a){if(a[i]==null){continue;}d.push(i,"='",a[i],"' ");}d.push(">",c||"","</body>");return d.join("");}function ag(a,c){if(!a){a={};}var d=[this.$serverVars[ao]||"0",","];if(a.doOpen){d.push("<stream:stream");for(var i in a){if(i=="doOpen"||i=="doClose"||a[i]==null){continue;}d.push(" ",i,"='",a[i],"'");}d.push(">");}d.push(c||"");if(a.doClose){d.push("</stream:stream>");}return d.join("");}function au(d){var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i,a="";for(i=0;i<d;i++){a+=c.charAt(apf.randomGenerator.generate(0,61));}return a;}function ae(c){var a,i=[];for(a in c){if(c[a]==null){continue;}i.push(a,'="',c[a],'",');}var d=i.join("").replace(/,$/,"");return"<response xmlns='"+apf.xmpp.NS.sasl+"'>"+apf.crypto.Base64.encode(d)+"</response>";}function aa(c,d){var a,i=["<iq "];for(a in c){if(c[a]==null){continue;}i.push(a,"='",c[a],"' ");}i.push(">",d||"","</iq>");return i.join("");}function am(a,c){var d=["<presence xmlns='",apf.xmpp.NS.jabber,"'"];if(a.type){d.push(" type='",a.type,"'");}if(a.to){d.push(" to='",a.to,"'");}if(a.from){d.push(" from='",a.from,"'");}d.push(">");if(a.status){d.push("<show>",a.status,"</show>");}if(a.custom){d.push("<status>",a.custom,"</status>");}d.push(c||"");d.push("</presence>");return d.join("");}function Y(d,a){var c=["<message xmlns='",apf.xmpp.NS.jabber,"' from='",this.$serverVars[aj],"' to='",d.to,"' id='message_",++this.$serverVars.mess_count,"' xml:lang='",d["xml:lang"],"'"];if(d.type){c.push(" type='",d.type,"'");}c.push(">");if(d.subject){c.push("<subject>",d.subject,"</subject>");}if(d.thread){c.push("<thread>",d.thread,"</thread>");}c.push("<body>",a,"</body></message>");return c.join("");}this.$getRID=function(){if(this.$RID===null){this.$RID=parseInt("".appendRandomNumber(10));}return this.$RID++;};this.$makeUnique=ak;this.$createBodyElement=aA;this.$createStreamElement=ag;this.$createIqBlock=aa;this.$createPresenceBlock=am;this.$createMessageBlock=Y;this.$doXmlRequest=function(i,d){if(i&&d){this.$reqStack.push({callback:i,body:d});}if(this.$reqCount>=this.maxrequests){return null;}var a=this,c=this.$reqStack.shift();++this.$reqCount;return this.get(this.url,{callback:function(l,m,n){--a.$reqCount;if(a.$reqStack.length){a.$doXmlRequest();}if(a.$isPoll){if(!l||l.replace(/^[\s\n\r]+|[\s\n\r]+$/g,"")==""){}else{if(l.indexOf("<stream:stream")>-1&&l.indexOf("</stream:stream>")==-1){l=l+"</stream:stream>";}l=apf.getXmlDom(l);if(!apf.supportNamespaces){l.setProperty("SelectionLanguage","XPath");}}}if(m!=apf.SUCCESS){var j;j=new Error(apf.formatErrorString(0,a,"XMPP Communication error","Url: "+n.url+"\nInfo: "+n.message));if(typeof c.callback=="function"){c.callback.call(a,l,m,n);return true;}else{if(n.tpModule.retryTimeout(n,m,a,j)===true){return true;}}ap.call(a,apf.xmpp.ERROR_CONN,n.message,m);throw j;}if(typeof c.callback=="function"){c.callback.call(a,l,m,n);}},nocache:true,useXML:!this.$isPoll,ignoreOffline:true,data:c.body||""});};function ap(j,l,i){if(j&apf.xmpp.ERROR_CONN){if(this.$retryCount==3){this.$retryCount=0;clearTimeout(this.$listener);this.$listener=null;return this.connect(this.$serverVars.username,this.$serverVars.password,this.$serverVars.login_callback,this.$serverVars.register||this.$autoRegister);}this.$retryCount++;}else{this.$retryCount=0;}var c=j&apf.xmpp.ERROR_AUTH,d=j&apf.xmpp.ERROR_CONN;clearTimeout(this.$listener);this.$listener=null;var m={username:this.$serverVars.username,server:this.url,message:l||(c?"Access denied. Please check your username or password.":d?"Could not connect to server, please contact your System Administrator.":"Could not register for a new user account")},a=this.$serverVars.login_callback;if(a){delete this.$serverVars.login_callback;return a(null,i||apf.ERROR,m);}return this.dispatchEvent(c?"authfailure":d?"connectionerror":"registererror",m);}this.connect=function(c,a,d,i){this.reset();this.$serverVars.username=c;this.$serverVars.password=a;this.$serverVars.login_callback=d;this.$serverVars.register=i||this.$autoRegister;this.$serverVars.previousMsg=[];this.$serverVars[ax].registerAccount(c,this.$domain);if(this.$canMuc){this.$mucRoster.registerAccount(c,this.$domain);}this.$doXmlRequest(ad,this.$isPoll?ag.call(this,null,{doOpen:true,to:this.$domain,xmlns:apf.xmpp.NS.jabber,"xmlns:stream":apf.xmpp.NS.stream,version:"1.0"}):aA({content:"text/xml; charset=utf-8",hold:"1",rid:this.$getRID(),to:this.$domain,route:"xmpp:jabber.org:9999",secure:"true",wait:"120",ver:"1.6","xml:lang":"en","xmpp:version":"1.0",xmlns:apf.xmpp.NS.httpbind,"xmlns:xmpp":apf.xmpp.NS.bosh}));};this.disconnect=function(a){if(this.$serverVars[aq]){if(a){this.$serverVars.logout_callback=a;}if(this.$canMuc){this.leaveAllRooms();}this.$doXmlRequest(ai,this.$isPoll?ag.call(this,null,{doClose:true}):aA({pause:120,rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind}));}else{this.reset();if(a){a(null,apf.SUCCESS);}}};this.reset=function(){var a=this.$serverVars[ax];if(a){a.reset();}if(this.$canMuc&&this.$mucRoster){this.$mucRoster.reset();}for(var c in this.$serverVars){delete this.$serverVars[c];}this.$RID=null;this.$serverVars.cnonce=au(14);this.$serverVars.nc="00000001";this.$serverVars[aq]=false;this.$serverVars[ax]=new apf.xmpp_roster(this.$model,this.$modelContent,this.resource);this.$serverVars.bind_count=0;this.$serverVars.mess_count=0;};function ad(q,j,d){if(j!=apf.SUCCESS){return ap.call(this,apf.xmpp.ERROR_CONN,d.message,j);}this.$retryCount=0;if(!this.$isPoll){this.$serverVars[ao]=q.getAttribute("sid");this.$serverVars.AUTH_ID=q.getAttribute("authid");}else{var l=d.http.getResponseHeader("Set-Cookie").splitSafe(";");this.$serverVars[ao]=l[0].splitSafe("=")[1];this.$serverVars.AUTH_ID=q.firstChild.getAttribute("id");}var i=q.getElementsByTagName("mechanisms")[0],a=i.getAttribute("xmlns");this.$serverVars.AUTH_SASL=apf.isO3||(a&&a==apf.xmpp.NS.sasl);var o=q.getElementsByTagName("mechanism"),s=0,c=o.length,m=false,n;for(;s<c&&!m;s++){n=o[s].firstChild.nodeValue;if(n=="DIGEST-MD5"||n=="PLAIN"){this.$serverVars.AUTH_TYPE=n;m=true;}}o=q.getElementsByTagName("register");for(s=0,c=o.length;s<c;s++){this.$serverVars.AUTH_REG=(o[s].getAttribute("xmlns")==apf.xmpp.NS.feature_reg);}if(!m){return ap.call(this,apf.xmpp.ERROR_AUTH,"No supported authentication protocol found. We cannot continue!");}return(this.$serverVars.AUTH_REG&&this.$serverVars.register)?Z.call(this):aD.call(this);}function Z(){var c=aa({type:"set",id:ak("reg")},"<query xmlns='"+apf.xmpp.NS.register+"'><username>"+this.$serverVars.username+"</username><password>"+this.$serverVars.password+"</password></query>"),a=this;this.$doXmlRequest(function(i){if(i&&i.nodeType){var d=i.getElementsByTagName("iq")[0];if((d&&d.getAttribute("type")=="error")||i.getElementsByTagName("error").length){ap.call(a,apf.xmpp.ERROR_REG,"New account registration for account '"+this.$serverVars.username+" failed.");}aD.call(a);}},a.$isPoll?ag.call(this,null,null,c):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},c));}function aD(){if(this.$serverVars.AUTH_SASL){var c=this.$serverVars.AUTH_TYPE,a="<auth xmlns='"+apf.xmpp.NS.sasl+"' mechanism='"+c+(c=="PLAIN"?"'>"+this.$serverVars.username+"@"+this.$domain+String.fromCharCode(0)+this.$serverVars.username+String.fromCharCode(0)+this.$serverVars.password+"</auth>":"'/>");this.$doXmlRequest((c=="ANONYMOUS"||c=="PLAIN")?ay:ab,this.$isPoll?ag.call(this,null,null,a):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},a));}else{var d=aa({type:"get",id:ak("auth")},"<query xmlns='"+apf.xmpp.NS.auth+"'><username>"+this.$serverVars.username+"</username></query>");this.$doXmlRequest(ab,this.$isPoll?ag.call(this,null,null,d):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},d));}}function ai(c,d,i){var a=this.$serverVars.logout_callback;this.reset();if(a){a(c,d,i);}}function af(c){if(!c||c.getElementsByTagName("failure").length){return false;}var d=c.getElementsByTagName("challenge");if(d.length&&(d=d[0])){var j,a,m,l=d.firstChild.nodeValue,i=apf.crypto.Base64.decode(l).split(",");for(j=0,a=i.length;j<a;j++){m=i[j].split("=");this.$serverVars[m[0]]=m[1].trim().replace(/[\"\']/g,"");}}return true;}function ab(a){if(this.$serverVars.AUTH_SASL){if(!af.call(this,a)){return ap.call(this,apf.xmpp.ERROR_AUTH);}var s=this.$serverVars.realm,q=apf.crypto.MD5;if(!s){this.$serverVars.realm=s=this.$domain;}if(s){this.$serverVars["digest-uri"]="xmpp/"+s;}var i=q.str_md5(this.$serverVars.username+":"+this.$domain+":"+this.$serverVars.password)+":"+this.$serverVars.nonce+":"+this.$serverVars.cnonce,j="AUTHENTICATE:"+this.$serverVars["digest-uri"],m=q.hex_md5(q.hex_md5(i)+":"+this.$serverVars.nonce+":"+this.$serverVars.nc+":"+this.$serverVars.cnonce+":"+this.$serverVars.qop+":"+q.hex_md5(j));var o=ae({username:this.$serverVars.username,realm:s,nonce:this.$serverVars.nonce,cnonce:this.$serverVars.cnonce,nc:this.$serverVars.nc,qop:this.$serverVars.qop,"digest-uri":this.$serverVars["digest-uri"],response:m,charset:this.$serverVars.charset});this.$doXmlRequest(W,this.$isPoll?ag.call(this,null,null,o):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},o));}else{if(a&&a.nodeType){var c=a.getElementsByTagName("iq")[0];if((c&&c.getAttribute("type")=="error")||a.getElementsByTagName("error").length){return ap.call(this,apf.xmpp.ERROR_AUTH);}var d,l=(d=a.getElementsByTagName("digest")&&d[0]),n=aa({type:"set",id:ak("auth")},"<query xmlns='"+apf.xmpp.NS.auth+"'><username>"+this.$serverVars.username+"</username><resource>"+this.resource+"</resource>"+(l?"<digest xmlns='"+apf.xmpp.NS.auth+">"+apf.crypto.SHA1(this.$serverVars.AUTH_ID+this.$serverVars.password)+"</digest>":"<password xmlns='"+apf.xmpp.NS.auth+"'>"+this.$serverVars.password+"</password>")+"</query>");this.$doXmlRequest(ay,this.$isPoll?ag.call(this,null,null,n):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},n));}}}function W(c){if(!af.call(this,c)){return ap.call(this,apf.xmpp.ERROR_AUTH);}var a=ae({});this.$doXmlRequest(ay,this.$isPoll?ag.call(this,null,null,a):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},a));}function ay(d){if(this.$serverVars.AUTH_SASL){if(!af.call(this,d)){return ap.call(this,apf.xmpp.ERROR_AUTH);}}else{if(d&&d.nodeType){var c=d.getElementsByTagName("iq")[0];if((c&&c.getAttribute("type")=="error")||d.getElementsByTagName("error").length){return ap.call(this,apf.xmpp.ERROR_AUTH);}delete this.$serverVars.password;}}var a=this;this.$doXmlRequest(function(i){if(a.$isPoll||i.getElementsByTagName("bind").length){a.bind();}},this.$isPoll?ag.call(this,null,{doOpen:true,to:this.$domain,xmlns:apf.xmpp.NS.jabber,"xmlns:stream":apf.xmpp.NS.stream,version:"1.0"}):aA({rid:this.$getRID(),sid:this.$serverVars[ao],to:this.$domain,"xml:lang":"en","xmpp:restart":"true",xmlns:apf.xmpp.NS.httpbind,"xmlns:xmpp":apf.xmpp.NS.bosh}));}this.bind=function(){var a=aa({id:"bind_"+ ++this.$serverVars.bind_count,type:"set",xmlns:this.$isPoll?null:apf.xmpp.NS.jabber},"<bind xmlns='"+apf.xmpp.NS.bind+"'><resource>"+this.resource+"</resource></bind>");this.$doXmlRequest(az,this.$isPoll?ag.call(this,null,null,a):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},a));};function az(d){var c=d.getElementsByTagName("jid")[0];if(c){this.$serverVars[aj]=c.firstChild.nodeValue;var i=aa({from:this.$serverVars[aj],id:this.$sAJAX_ID,to:this.$domain,type:"set",xmlns:apf.xmpp.NS.jabber},"<session xmlns='"+apf.xmpp.NS.session+"'/>"),a=this;this.$doXmlRequest(function(j){aB.call(a,j);at.call(a);},this.$isPoll?ag.call(this,null,null,i):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},i));}else{ap.call(this,apf.xmpp.ERROR_AUTH);}}function at(){var c=am({type:apf.xmpp.TYPE_AVAILABLE}),a=this;this.$doXmlRequest(function(d){aB.call(a,d);al.call(a);},this.$isPoll?ag.call(this,null,null,c):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},c));}function al(){var d=aa({from:this.$serverVars[aj],type:"get",id:ak("roster")},"<query xmlns='"+apf.xmpp.NS.roster+"'/>"),a=this,c=this.$serverVars;this.$doXmlRequest(function(j){aB.call(a,j);a.$listen();var n=c.login_callback,i=c.previousMsg;if(n){n(null,apf.SUCCESS,{username:c.username});delete c.login_callback;}if(i&&i.length){for(var l=0,m=i.length;l<m;l++){a.sendMessage.apply(a,i[l]);}delete i;c.previousMsg=[];}c[aq]=true;a.dispatchEvent(aq,{username:c.username});},this.$isPoll?ag.call(this,null,null,d):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},d));}this.$listen=function(){if(this.$listening===true){return;}this.$listening=true;this.$doXmlRequest(av,this.$isPoll?ag.call(this):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},""));};function aE(c,d,i){clearTimeout(this.$listener);this.$listener=null;if(c||d){if(d!=apf.SUCCESS){return ap.call(this,apf.xmpp.ERROR_CONN,i.message,d);}else{aB.call(this,c);}}if(this.$serverVars[aq]&&!this.$listening){var a=this;this.$listener=$setTimeout(function(){a.$listen();},this.$pollTimeout||0);}}this.$restartListener=aE;function av(c,d){clearTimeout(this.$listener);this.$listener=null;aB.call(this,c);var i=(this.$listening===false);this.$listening=false;if(this.$serverVars[aq]&&!i){var a=this;this.$listener=$setTimeout(function(){a.$listen();},this.$pollTimeout||0);}}function aB(d){if(d&&d.nodeType){this.$serverVars.previousMsg=[];var c=d.getElementsByTagName("message");if(c.length){aC.call(this,c);}var i=d.getElementsByTagName("presence");if(i.length){ac.call(this,i);}var a=d.getElementsByTagName("iq");if(a.length){X.call(this,a);}}}this.$parseData=aB;function ah(d){var i,c=[],j=0,a=d.childNodes.length;for(j=0;j<a;j++){if((i=d.childNodes[j])&&i.nodeType==3){c.push(i.nodeValue);}}return c.join("").replace(/\&quot;/g,'"');}function aC(d){var n,l,i,m,c,j=0,a=d.length;for(;j<a;j++){i=d[j].getAttribute("from");c=(d[j].getAttribute("type")=="groupchat");if(i&&!c){this.$serverVars[ax].getEntityByJID(i);}if(d[j].getAttribute("type")=="chat"||c){m=d[j].getElementsByTagName("body")[0];if(!(m&&m.childNodes.length)){continue;}l=d[j].getAttribute("from");n=ah(m);if(c&&l==this.$mucRoster.fullJID){return;}if((c?this.$mucRoster:this.$serverVars[ax]).updateMessageHistory(l,n)){this.dispatchEvent("receivechat",{from:l,message:n});}}else{if(d[j].getAttribute("type")=="normal"){m=d[j].getElementsByTagName("body")[0];if(!(m&&m.childNodes.length)){continue;}n=ah(m);this.dispatchEvent("datachange",{data:n});}}}}function ac(d){for(var n=0,s=d.length;n<s;n++){var m=d[n].getAttribute("from"),o=d[n].getElementsByTagName("x"),a=(m.indexOf(this.$mucDomain)>-1);if(o.length){for(var c,q=0,t=o.length;q<t;q++){switch(o[q].getAttribute("xmlns")){case apf.xmpp.NS.muc_user:if(this.$getStatusCode(o[q],201)){this.$mucSignal(apf.xmpp_muc.ROOM_CREATE,m);break;}if(!this.$isRoom(m)||this.$getStatusCode(o[q],110)){break;}c=o[q].getElementsByTagName("item")[0];if(!c){break;}this.$mucRoster.getEntityByJID(m,{roomJID:c.getAttribute("jid"),affiliation:c.getAttribute("affiliation"),role:c.getAttribute("role"),status:d[n].getAttribute("type")||apf.xmpp.TYPE_AVAILABLE});break;}}}if(m&&!a){var l=this.$serverVars[ax],i=l.getEntityByJID(m),j=d[n].getAttribute("type");if(j==apf.xmpp.TYPE_SUBSCRIBE){an.call(this,d[n].getAttribute("from"));}if(i){l.update(i,j||apf.xmpp.TYPE_AVAILABLE);}}}}function X(j){for(var n=0,u=j.length;n<u;n++){if(j[n].getAttribute("type")!="result"&&j[n].getAttribute("type")!="error"){continue;}var c=j[n].getElementsByTagName("query"),l=j[n].getAttribute("from");for(var q=0,t=c.length;q<t;q++){var A,s,z;switch(c[q].getAttribute("xmlns")){case apf.xmpp.NS.roster:A=c[q].getElementsByTagName("item");var D=this.$serverVars[ax],B=[];for(s=0,z=A.length;s<z;s++){var m=A[s].getAttribute("subscription"),o=(A[s].childNodes.length>0)?A[s].firstChild.firstChild.nodeValue:"",w=A[s].getAttribute("jid");var d=D.getEntityByJID(w,{subscription:m,group:o});if(m==apf.xmpp.SUBSCR_TO||m==apf.xmpp.SUBSCR_BOTH){B.push(d);}else{if(d.subscription==apf.xmpp.TYPE_SUBSCRIBED){ar.call(this,d);}}}if(B.length){this.requestPresence(B);}break;case apf.xmpp.NS.disco_items:if(!this.$canMuc){break;}var i=j[n].getElementsByTagName("error");if(i.length&&parseInt(i[0].getAttribute("code"))==404){this.$mucSignal(apf.xmpp_muc.ROOM_NOTFOUND,l);break;}A=c[q].getElementsByTagName("item");var C=this.$addRoom(l,l.split("@")[0]),a;this.$mucSignal(apf.xmpp_muc.ROOM_EXISTS,l);for(s=0,z=A.length;s<z;s++){a=A[s].getAttribute("jid");if(a.indexOf("/")!=-1){this.$addRoomOccupant(a);}else{if(A[s].hasAttribute("name")){C.subscription=A[s].getAttribute("name");}}}break;case apf.xmpp.NS.muc_user:break;case apf.xmpp.NS.muc_owner:this.$mucSignal(apf.xmpp_muc.ROOM_CREATE,l);break;default:break;}}}}this.setPresence=function(d,a,c){if(!this.$serverVars[aq]){return false;}this.$doXmlRequest(restartlistener,aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},am({type:d||apf.xmpp.TYPE_AVAILABLE,status:a,custom:c})));};this.requestPresence=function(c){if(!this.$serverVars[aq]){return false;}var l=this.$serverVars[ax];if(typeof c=="string"){c=l.getEntityByJID(c);}if(!c){return false;}var j,i=[];if(apf.isArray(c)){for(var d=0,a=c.length;d<a;d++){i.push(am({type:apf.xmpp.TYPE_PROBE,to:c[d].fullJID,from:l.fullJID}));}}else{i.push(am({type:apf.xmpp.TYPE_PROBE,to:c.fullJID,from:l.fullJID}));}j=i.join("");this.$doXmlRequest(aE,this.$isPoll?ag.call(this,null,null,j):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},j));};this.addContact=function(i,c){if(typeof i!="string"){return false;}var d=this.$serverVars[ax],l=d.getEntityByJID(i);if(l&&(l.subscription==apf.xmpp.SUBSCR_TO||l.subscription==apf.xmpp.SUBSCR_BOTH)){return this.requestPresence(l);}var j=aa({type:"set",id:ak("set")},"<query xmlns='"+apf.xmpp.NS.roster+"'><item jid='"+i+"' /></query>"),a=this;this.$doXmlRequest(function(m){aB.call(a,m);a.$listen();var n=am({type:apf.xmpp.TYPE_SUBSCRIBE,to:i});a.$doXmlRequest(function(o){if(!o||!o.nodeType){return !a.$isPoll?ap.call(a,apf.xmpp.ERROR_CONN,null,apf.OFFLINE):null;}a.$listen();var q=o.getElementsByTagName("presence")[0];if(q.getAttribute("error")){n=am({type:apf.xmpp.TYPE_UNSUBSCRIBE,to:i});a.$doXmlRequest(function(s,t,u){if(c){c.call(a,s,t,u);}aE.call(a,s,t,u);},a.$isPoll?ag.call(this,null,null,n):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},n));}},a.$isPoll?ag.call(a,null,null,n):aA({rid:a.$getRID(),sid:a.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},n));},this.$isPoll?ag.call(this,null,null,j):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},j));};function an(c){if(this.$autoConfirm){var a=aa({from:this.$serverVars[aj],type:"get",id:ak("roster")},"<query xmlns='"+apf.xmpp.NS.roster+"'><item jid='"+c+"' /></query>")+am({type:apf.xmpp.TYPE_SUBSCRIBED,to:c});this.$doXmlRequest(aE,this.$isPoll?ag.call(this,null,null,a):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},a));}if(this.$autoDeny){var d=am({type:apf.xmpp.TYPE_UNSUBSCRIBED,to:c});this.$doXmlRequest(aE,this.$isPoll?ag.call(this,null,null,d):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},d));}}function ar(a){var c=am({type:apf.xmpp.TYPE_SUBSCRIBED,to:a.jid});this.$doXmlRequest(aE,this.$isPoll?ag.call(this,null,null,c):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},c));}var aw={online:apf.xmpp.STATUS_ONLINE,offline:apf.xmpp.STATUS_OFFLINE,away:apf.xmpp.STATUS_AWAY,xa:apf.xmpp.STATUS_XA,extendedaway:apf.xmpp.STATUS_XA,onvacation:apf.xmpp.STATUS_XA,dnd:apf.xmpp.STATUS_DND,donotdisturb:apf.xmpp.STATUS_DND,invisible:apf.xmpp.STATUS_INVISIBLE,ffc:apf.xmpp.STATUS_FFC,chatty:apf.xmpp.STATUS_FFC,freeforchat:apf.xmpp.STATUS_FFC};this.setStatus=function(a){a=aw[a]||apf.xmpp.STATUS_ONLINE;return this.setPresence(a,a);};this.sendMessage=function(o,l,a,s,m){if(!l){return false;}var q=this;if(typeof apf.offline!="undefined"&&!apf.offline.onLine){if(apf.offline.queue.enabled){var i={to:o,message:l,thread:a,callback:m,type:s,retry:function(){q.sendMessage(this.to,this.message,this.thread,this.type,this.callback);},$object:[this.name,"new apf.xmpp()"],$retry:"this.object.sendMessage(this.to, this.message,                         this.thread, this.type, this.callback)"};apf.offline.queue.add(i);return true;}}if(!this.$serverVars[aq]){return false;}var n=(this.$canMuc&&s=="groupchat"),c=Array.prototype.slice.call(arguments),j;if(!n){j=this.$serverVars[ax].getEntityByJID(o);}if(!j){return false;}var d=Y.call(this,{type:s||apf.xmpp.MSG_CHAT,to:o,thread:a,"xml:lang":"en"},"<![CDATA["+l+"]]>");this.$doXmlRequest(function(w,t,u){if(m){m.call(q,w,t,u);}q.$serverVars.previousMsg=c;aE.call(q,w,t,u);},this.$isPoll?ag.call(this,null,null,d):aA({rid:this.$getRID(),sid:this.$serverVars[ao],xmlns:apf.xmpp.NS.httpbind},d));};this.sendRSB=function(d){var j=this.$serverVars[ax];if(!j){return;}var c=j.getAllEntities(apf.xmpp.TYPE_AVAILABLE),i=0,a=c.length;for(;i<a;i++){this.sendMessage(c[i].bareJID,d,null,apf.xmpp.MSG_NORMAL);}};this.$headerHook=function(a){a.setRequestHeader("Host",this.$domain);a.setRequestHeader("Content-Type",this.$isPoll?"application/x-www-form-urlencoded":"text/xml; charset=utf-8");};this.addEventListener("DOMNodeRemovedFromDocument",function(){this.disconnect();});this.exec=function(c,a,d){switch(c){case"login":this.connect(a[0],a[1],d);break;case"logout":break;case"notify":this.sendMessage(a[1],a[0],a[2],a[3],d);break;default:break;}};}).call(apf.xmpp.prototype=new apf.Teleport());apf.aml.setElement("xmpp",apf.xmpp);apf.xmpp.NS={sasl:"urn:ietf:params:xml:ns:xmpp-sasl",httpbind:"http://jabber.org/protocol/httpbind",feature_reg:"http://jabber.org/features/iq-register",bosh:"urn:xmpp:xbosh",jabber:"jabber:client",bind:"urn:ietf:params:xml:ns:xmpp-bind",session:"urn:ietf:params:xml:ns:xmpp-session",auth:"jabber:iq:auth",roster:"jabber:iq:roster",register:"jabber:iq:register",data:"jabber:x:data",stream:"http://etherx.jabber.org/streams",disco_info:"http://jabber.org/protocol/disco#info",disco_items:"http://jabber.org/protocol/disco#items",muc:"http://jabber.org/protocol/muc",muc_user:"http://jabber.org/protocol/muc#user",muc_owner:"http://jabber.org/protocol/muc#owner"};apf.xmpp.CONN_POLL=1;apf.xmpp.CONN_BOSH=2;apf.xmpp.ERROR_AUTH=4;apf.xmpp.ERROR_CONN=8;apf.xmpp.ERROR_MUC=16;apf.xmpp.ERROR_REG=17;apf.xmpp.SUBSCR_FROM="from";apf.xmpp.SUBSCR_TO="to";apf.xmpp.SUBSCR_BOTH="both";apf.xmpp.SUBSCR_NONE="none";apf.xmpp.TYPE_AVAILABLE="";apf.xmpp.TYPE_UNAVAILABLE="unavailable";apf.xmpp.TYPE_PROBE="probe";apf.xmpp.TYPE_SUBSCRIBED="subscribed";apf.xmpp.TYPE_SUBSCRIBE="subscribe";apf.xmpp.TYPE_UNSUBSCRIBE="unsubscribe";apf.xmpp.TYPE_UNSUBSCRIBED="unsubscribed";apf.xmpp.STATUS_ONLINE="online";apf.xmpp.STATUS_OFFLINE="offline";apf.xmpp.STATUS_SHOW="show";apf.xmpp.STATUS_AWAY="away";apf.xmpp.STATUS_XA="xa";apf.xmpp.STATUS_DND="dnd";apf.xmpp.STATUS_INVISIBLE="invisible";apf.xmpp.STATUS_FFC="chat";apf.xmpp.MSG_CHAT="chat";apf.xmpp.MSG_GROUPCHAT="groupchat";apf.xmpp.MSG_ERROR="error";apf.xmpp.MSG_HEADLINE="headline";apf.xmpp.MSG_NORMAL="normal";apf.actiontracker=function(i,d){this.$init(d||"actiontracker",apf.NODE_HIDDEN,i);this.$stackDone=[];this.$stackUndone=[];this.$execStack=[];};(function(){this.$lastExecStackItem=null;this.realtime=true;this.undolength=0;this.redolength=0;this.$booleanProperties={};this.$booleanProperties.realtime=true;this.$supportedProperties=["realtime","undolength","redolength","alias"];this.$handlePropSet=function(a,j,l){switch(a){case"undolength":this.undolength=this.$stackDone.length;break;case"redolength":this.redolength=this.$stackUndone.length;break;default:this[a]=j;}};this.addEventListener("DOMNodeInsertedIntoDocument",function(a){if(this.parentNode){this.parentNode.$at=this;}});this.define=function(a,i){apf.actiontracker.actions[a]=i;};this.getParent=function(){return this.parentNode&&this.parentNode.getActionTracker?this.parentNode.getActionTracker(true):(apf.window.$at!=this?apf.window.$at:null);};this.execute=function(l){if(this.dispatchEvent("beforechange",l)===false){return;}var a=new apf.UndoData(l,this);if(l.action){apf.actiontracker.actions[l.action](a,false,this);}a.id=this.$stackDone.push(a)-1;this.setProperty("undolength",this.$stackDone.length);if(typeof apf.offline!="undefined"){var j=apf.offline.transactions;if(j.doStateSync){j.addAction(this,a,"undo");j.clearActions(this,"redo");}}if(a.multiple){this.$addToQueue(a.multiple,false,true);}else{this.$addToQueue(a,false);}this.$stackUndone.length=0;this.setProperty("redolength",this.$stackUndone.length);this.dispatchEvent("afterchange",{action:"do"});return a;};this.$addActionGroup=function(l,a){var j=new apf.UndoData("group",null,[apf.copyArray(l,UndoData),apf.copyArray(a,UndoData)]);this.$stackDone.push(j);this.setProperty("undolength",this.$stackDone.length);this.dispatchEvent("afterchange",{action:"group",done:l});};this.purge=function(a,i){if(true){if(this.$execStack.length){this.$execStack[0].undoObj.saveChange(this.$execStack[0].undo,this);this.$lastExecStackItem=this.$execStack[this.$execStack.length-1];}}else{if(parent){this.reset();}}};this.reset=function(){this.$stackDone.length=this.$stackUndone.length=0;this.setProperty("undolength",0);this.setProperty("redolength",0);this.dispatchEvent("afterchange",{action:"reset"});};this.undo=function(a,j,l){c.call(this,a,j,true,l);};this.redo=function(a,j,l){c.call(this,a,j,false,l);};function c(B,i,u,t){var w=u?this.$stackDone:this.$stackUndone,a=u?this.$stackUndone:this.$stackDone;if(!w.length){return;}if(i){var z=w[B];if(!z){return;}w.length--;a.push(z);if(typeof apf.offline!="undefined"&&apf.offline.transactions.doStateSync){apf.offline.transactions.removeAction(this,true,u?"undo":"redo");apf.offline.transactions.addAction(this,z,u?"redo":"undo");}if(z.action){apf.actiontracker.actions[z.action](z,u,this);}if(!t){if(z.multiple){this.$addToQueue(z.multiple,u,true);}else{this.$addToQueue(z,u);}}this.setProperty("undolength",this.$stackDone.length);this.setProperty("redolength",this.$stackUndone.length);return z;}if(this.dispatchEvent("beforechange")===false){return;}if(B==-1){B=w.length;}if(!B){B=1;}var A=0;while(A<B&&w.length>0){if(!w[w.length-1]){w.length--;this.$stackDone=[];this.$stackUndone=[];if(typeof apf.offline!="undefined"){var C=apf.offline.transactions;if(C.doStateSync){C.clear("undo|redo");}}return false;}else{c.call(this,w.length-1,true,u,t);A++;}}this.dispatchEvent("afterchange",{action:u?"undo":"redo",rollback:t});}this.$receive=function(o,q,t,s,a){if(q==apf.TIMEOUT&&t.tpModule.retryTimeout(t,q,this)===true){return true;}if(q!=apf.SUCCESS){if(this.dispatchEvent("actionfail",apf.extend(t,{state:q,message:"Could not sent Action RPC request for control "+this.name+"["+this.localName+"] \n\n"+t.message,bubbles:true}))===false){return true;}if(typeof apf.offline!="undefined"&&!apf.offline.reloading){this.undo(s.id,t.userdata,true);}if(a){a(!t.userdata);}if(!t.userdata){this.$execStack=[];var n=new Error(apf.formatErrorString(0,this,"Executing action","Error sending action to the server:\n"+(t.url?"Url:"+t.url+"\n\n":"")+t.message));if((s&&s.xmlActionNode||t.amlNode||apf).dispatchEvent("error",apf.extend({error:n,state:q,bubbles:true},t))===false){return;}throw n;}}else{this.dispatchEvent("actionsuccess",apf.extend(t,{state:q,bubbles:true},t));s.processRsbQueue();if(a){a();}}this.$queueNext(s,a);};this.$addToQueue=function(o,t,s){if(!s&&this.$execStack.length&&!o.state&&this.$execStack[this.$execStack.length-1].undoObj==o){this.$execStack.length--;if(typeof apf.offline!="undefined"&&apf.offline.transactions.enabled){apf.offline.transactions.removeAction(this,true,"queue");}o.clearRsbQueue();return;}if(s){var i,a=this.$execStack.shift();for(var q=0;q<o.length;q++){i=o[q];this.$execStack.unshift({undoObj:(i.tagName?i:new apf.UndoData(i,this)).preparse(t,this),undo:t});}if(a){this.$execStack.unshift(a);}return;}var a={undoObj:o.preparse(t,this),undo:t};this.$execStack.push(a)-1;if(typeof apf.offline!="undefined"&&apf.offline.transactions.enabled){apf.offline.transactions.addAction(this,a,"queue");}if(this.$execStack.length==1&&this.realtime){o.saveChange(t,this);}};this.$queueNext=function(j,a){if(!this.$execStack[0]||this.$execStack[0].undoObj!=j){throw new Error(apf.formatErrorString(0,this,"Executing Next                 action in queue","The execution stack was corrupted. This is                 a fatal error. The application should be restarted. You will                 lose all your changes. Please contact the administrator."));}j.state=null;var l=this.$execStack.shift();if(typeof apf.offline!="undefined"&&apf.offline.transactions.enabled){apf.offline.transactions.removeAction(this,null,"queue");}if(!this.$execStack[0]||l==this.$lastExecStackItem){return;}this.$execStack[0].undoObj.saveChange(this.$execStack[0].undo,this,a);};this.$loadQueue=function(i,a){if(a=="queue"){this.$execStack=i;}else{if(a=="undo"){this.$stackDone=i;}else{if(a=="redo"){this.$stackUndone=i;}}}};this.$getQueueLength=function(){return this.$execStack.length;};this.$startQueue=function(a){if(!this.$execStack[0]||this.$execStack[0].undoObj.state){return false;}this.$execStack[0].undoObj.saveChange(this.$execStack[0].undo,this,a);};}).call(apf.actiontracker.prototype=new apf.AmlElement());apf.aml.setElement("actiontracker",apf.actiontracker);apf.UndoData=function(m,q){this.localName="UndoData";this.extra={};this.rsbQueue={};apf.extend(this,m);if(q){this.at=q;}else{if(m&&m.tagName=="UndoData"){this.args=m.args.slice();this.rsbArgs=m.rsbArgs.slice();}else{this.selNode=this.selNode||(this.action=="removeNode"?this.args[0]:(this.amlNode?this.amlNode.selected:null));}}var n,l=this;var o;this.$export=function(){if(o){return o;}o={action:this.action,rsbModel:this.rsbModel?this.rsbModel.name:null,rsbQueue:this.rsbQueue,at:this.at.name,timestamp:this.timestamp,parsed:n?n.parsed:null,userdata:n?n.userdata:null,extra:{}};var a=this.rsbModel?this.rsbModel.rsb:apf.remote;var D=(typeof apf.offline!="undefined"&&apf.offline.sLookup)?apf.offline.sLookup:(apf.offline.sLookup={});if(!D.count){D.count=0;}var B,C,E=this.args.slice();for(var d=0;d<E.length;d++){if(E[d]&&E[d].nodeType){if(!o.argsModel){var c=apf.nameserver.get("model",apf.xmldb.getXmlDocId(E[d]));if(c){o.argsModel=c.name||c.$uniqueId;}}E[d]=i(E[d]);}}var A,j;for(j in this.extra){A=this.extra[j];o.extra[j]=A&&A.nodeType?i(A):A;}o.args=E;return o;function i(u){if(u.nodeType==2||apf.isChildOf(c.data,u,true)){C=u.getAttribute(apf.xmldb.xmlIdTag);return{xpath:a.xmlToXpath(u,c.data,true),lookup:C};}else{var s=u;while(s.parentNode&&s.parentNode.nodeType==1){s=u.parentNode;}C=s.getAttribute(apf.xmldb.xmlIdTag);if(!C){C="serialize"+D.count++;s.setAttribute(apf.xmldb.xmlIdTag,C);}var t={xpath:a.xmlToXpath(u,s,true),lookup:C};if(!D[C]){s.setAttribute(apf.xmldb.xmlDocTag,apf.xmldb.getXmlDocId(s));D[C]=s;t.xml=s.xml||s.serialize();}return t;}}};this.$import=function(){if(this.rsbModel){this.rsbModel=apf.nameserver.get("model",this.rsbModel);}if(this.argsModel){var F=apf.nameserver.get("model",this.argsModel)||apf.lookup(this.argsModel);var C=(typeof apf.offline!="undefined"&&apf.offline.sLookup)?apf.offline.sLookup:(apf.offline.sLookup={});if(!C.count){C.count=0;}var D=this.args,E=this.rsbModel?this.rsbModel.rsb:apf.remote,B,c,i,d,j;for(c=0,i=D.length;c<i;c++){if(D[c]&&D[c].xpath){D[c]=a(D[c],F);}}for(j in this.extra){d=this.extra[j];if(d&&d.xpath){this.extra[j]=a(d,F);}}this.args=D;}n={undoObj:this,userdata:this.userdata,parsed:this.parsed};if(this.timestamp){n.actionstart=this.timestamp;n.headers={"X-JPF-ActionStart":this.timestamp};}return this;function a(t,s){if(t.xml){B=apf.xmldb.getXml(t.xml);C[B.getAttribute(apf.xmldb.xmlIdTag)]=B;}else{if(t.lookup){B=C[t.lookup];}else{B=null;}}return E.xpathToXml(t.xpath,B||s.data);}};this.processRsbQueue=function(){if(this.rsbModel){this.rsbModel.rsb.processQueue(this);}};this.clearRsbQueue=function(){this.rsbQueue=this.rsbModel=null;};this.saveChange=function(a,c,d){if(this.action=="group"){var i=this.args[1];c.$addToQueue(i,a,true);return c.$queueNext(this);}var j;if(this.xmlActionNode){j=this.xmlActionNode.getAttribute(a?"undo":"set");if(a&&!j){j=this.xmlActionNode.getAttribute("set");}}if(!j){this.processRsbQueue();return c.$queueNext(this);}this.state=a?"restoring":"saving";if(n._pc==-2){return c.$receive(null,apf.SUCCESS,{amlNode:this.amlNode},this,d);}n.callback=function(w,z,A){A.amlNode=l.amlNode;return c.$receive(w,z,A,l,d);};n.ignoreOffline=true;apf.saveData(j,n);};this.preparse=function(a,c,i){var d;if(this.xmlActionNode){d=this.xmlActionNode.getAttribute(a?"undo":"set");if(a&&!d){d=this.xmlActionNode.getAttribute("set");}}if(!d){return this;}n=apf.extend({xmlNode:this.action=="multicall"?this.args[0].xmlNode:this.selNode||this.xmlNode,userdata:apf.isTrue(this.xmlActionNode.getAttribute("ignore-fail")),multicall:i,undo:a,_pc:true,callback:function(j,u,w){n._pc=-2;}},this.extra);if(this.timestamp){n.actionstart=this.timestamp;n.headers={"X-JPF-ActionStart":this.timestamp};}apf.saveData(d,n);if(n._pc===true){n._pc=-1;}return this;};};apf.actiontracker.actions={setTextNode:function(j,i){var l=j.args;if(!i){apf.xmldb.setTextNode(l[0],l[1],l[2],j);}else{apf.xmldb.setTextNode(l[0],j.extra.oldValue,l[2]);}},setAttribute:function(j,i){var l=j.args;if(!i){j.extra.name=l[1];j.extra.oldValue=l[0].getAttribute(l[1]);apf.xmldb.setAttribute(l[0],l[1],l[2],l[3],j);}else{if(!j.extra.oldValue){apf.xmldb.removeAttribute(l[0],l[1]);}else{apf.xmldb.setAttribute(l[0],l[1],j.extra.oldValue,l[3]);}}},removeAttribute:function(j,i){var l=j.args;if(!i){j.extra.name=l[1];j.extra.oldValue=l[0].getAttribute(l[1]);apf.xmldb.removeAttribute(l[0],l[1],l[2],j);}else{apf.xmldb.setAttribute(l[0],l[1],j.extra.oldValue,l[2]);}},setAttributes:function(n,q){var m,o=n.args;if(!q){var l={};for(m in o[1]){l[m]=o[0].getAttribute(m);o[0].setAttribute(m,o[1][m]);}n.extra.oldValues=l;apf.xmldb.applyChanges("attribute",o[0],n);}else{for(m in n.oldValues){if(!n.extra.oldValues[m]){o[0].removeAttribute(m);}else{o[0].setAttribute(m,n.extra.oldValues[m]);}}apf.xmldb.applyChanges("attribute",o[0],n);}},replaceNode:function(j,i){var l=j.args;if(!i){apf.xmldb.replaceNode(l[1],l[0],l[2],j);}else{apf.xmldb.replaceNode(l[0],l[1],l[2],j);}},addChildNode:function(j,i){var l=j.args;if(!i){apf.xmldb.addChildNode(l[0],l[1],l[2],l[3],j);}else{apf.xmldb.removeNode(j.extra.addedNode);}},appendChild:function(j,i){var l=j.args;if(!i){apf.xmldb.appendChild(l[0],l[1],l[2],l[3],l[4],j);}else{apf.xmldb.removeNode(j.xmlNode);}},moveNode:function(j,i){var l=j.args;if(!i){apf.xmldb.moveNode(l[0],l[1],l[2],l[3],j);}else{apf.xmldb.moveNode(j.extra.oldParent,l[1],j.extra.beforeNode,l[3]);}},removeNode:function(j,i){var l=j.args;if(!i){apf.xmldb.removeNode(l[0],l[1],j);}else{apf.xmldb.appendChild(j.extra.parent,j.extra.removedNode,j.extra.beforeNode);}},removeNodeList:function(m,i){if(i){var d=m.extra.removeList;for(var n=d.length-1;n>=0;n--){apf.xmldb.appendChild(d[n].pNode,d[n].removedNode,d[n].beforeNode);}}else{apf.xmldb.removeNodeList(m.args,m);}},setUndoObject:function(j,i){var l=j.args;j.xmlNode=l[0];},group:function(l,m,j){if(!l.$stackDone){var n=l.args[0];l.$stackDone=n;l.$stackUndone=[];}j[m?"undo":"redo"](l.$stackDone.length,false,l.$stackDone,l.$stackUndone);},setProperty:function(j,i){var l=j.args;if(!i){j.extra.oldValue=l[0][l[1]];l[0].setProperty(l[1],l[2],l[3],l[4]);}else{l[0].setProperty(l[1],j.extra.oldValue);}},setValueByXpath:function(l,j){var m=l.args;if(!j){if(l.extra.newNode){apf.xmldb.appendChild(l.extra.parentNode,l.extra.newNode);}else{var n=[];apf.setNodeValue(m[0],m[1],true,{undoObj:l,xpath:m[2],newNodes:n,forceNew:m[3]});l.extra.newNode=n[0];}}else{if(l.extra.newNode){l.extra.parentNode=l.extra.newNode.parentNode;apf.xmldb.removeNode(l.extra.newNode);}else{apf.setNodeValue(l.extra.appliedNode,l.extra.oldValue,true);}}},multicall:function(i,t,o){var n=i.args;var q=apf.xmldb.delayUpdate;apf.xmldb.delayUpdate=true;if(!t){for(var s=0;s<n.length;s++){if(!n[s].extra){n[s].extra={};}if(n[0].rsbModel){n[s].rsbQueue=n[0].rsbQueue;}apf.actiontracker.actions[n[s].func](n[s],false,o);}if(n[0].rsbModel){i.rsbModel=n[0].rsbModel;i.rsbQueue=n[0].rsbQueue;}}else{for(var s=n.length-1;s>=0;s--){apf.actiontracker.actions[n[s].func](n[s],true,o);}}apf.xmldb.delayUpdate=q;},addRemoveNodes:function(l,i){var m=l.args;if(!i){for(var n=0;n<m[1].length;n++){apf.xmldb.appendChild(m[0],m[1][n],null,null,null,l);}for(var n=0;n<m[2].length;n++){apf.xmldb.removeNode(m[2][n],null,l);}}else{for(var n=0;n<m[2].length;n++){apf.xmldb.appendChild(m[0],m[2][n]);}for(var n=0;n<m[1].length;n++){apf.xmldb.removeNode(m[1][n]);}}}};apf.param=function(i,d){this.$init(d||"param",apf.NODE_HIDDEN,i);};apf.param.prototype=new apf.AmlElement();apf.param.prototype.$parsePrio="002";apf.aml.setElement("variable",apf.param);apf.aml.setElement("param",apf.param);apf.spinner=function(i,d){this.$init(d||"spinner",apf.NODE_VISIBLE,i);this.max=64000;this.min=-64000;this.focused=false;this.value=0;};(function(){this.implement(apf.DataAction);this.$supportedProperties.push("width","value","max","min","caption");this.$propHandlers.value=function(c){c=parseInt(c)||0;this.value=this.oInput.value=(c>this.max?this.max:(c<this.min?this.min:c));};this.$propHandlers.min=function(c){if(!(c=parseInt(c))){return;}this.min=c;if(c>this.value){this.change(c);}};this.$propHandlers.max=function(c){if(!(c=parseInt(c))){return;}this.max=c;if(c<this.value){this.change(c);}};this.setValue=function(c){this.setProperty("value",c,false,true);};this.getValue=function(){return this.value;};this.$enable=function(){this.oInput.disabled=false;this.$setStyleClass(this.oInput,"",["inputDisabled"]);};this.$disable=function(){this.oInput.disabled=true;this.$setStyleClass(this.oInput,"inputDisabled");};this.$focus=function(c){if(!this.$ext||this.disabled||this.focused){return;}if(apf.hasFocusBug){apf.sanitizeTextbox(this.oInput);}this.focused=true;this.$setStyleClass(this.oInput,"focus");this.$setStyleClass(this.$buttonPlus,"plusFocus");this.$setStyleClass(this.$buttonMinus,"minusFocus");if(this.oLeft){this.$setStyleClass(this.oLeft,"leftFocus");}};this.$blur=function(c){if(!this.$ext&&!this.focused){return;}this.$setStyleClass(this.oInput,"",["focus"]);this.$setStyleClass(this.$buttonPlus,"",["plusFocus"]);this.$setStyleClass(this.$buttonMinus,"",["minusFocus"]);if(this.oLeft){this.$setStyleClass(this.oLeft,""["leftFocus"]);}this.focused=false;};this.addEventListener("keydown",function(j){var i=j.keyCode,l=(i<8||(i>8&&i<37&&i!==12)||(i>40&&i<46)||(i>46&&i<48)||(i>57&&i<96)||(i>105&&i<109)||(i>109&&i!==189));if(l){return false;}},true);this.addEventListener("keyup",function(c){this.setValue(this.oInput.value);},true);this.$draw=function(){var l=this;this.$ext=this.$getExternal(null,null,function(a){a.setAttribute("onmousedown",'this.host.dispatchEvent("mousedown", {htmlEvent : event});');a.setAttribute("onmouseup",'this.host.dispatchEvent("mouseup", {htmlEvent : event});');a.setAttribute("onclick",'this.host.dispatchEvent("click", {htmlEvent : event});');});this.$int=this.$getLayoutNode("main","container",this.$ext);this.oInput=this.$getLayoutNode("main","input",this.$ext);this.$buttonPlus=this.$getLayoutNode("main","buttonplus",this.$ext);this.$buttonMinus=this.$getLayoutNode("main","buttonminus",this.$ext);this.oLeft=this.$getLayoutNode("main","left",this.$ext);apf.sanitizeTextbox(this.oInput);var m,o=(!document.compatMode||document.compatMode=="CSS1Compat")?document.html:document.body,n=0;this.oInput.value=this.value;this.oInput.onmousedown=function(F){if(l.disabled){return;}F=F||window.event;clearTimeout(m);var B,C=parseInt(this.value)||0,j=0,a=F.clientY,G=l.$int.offsetTop,E=l.$int.offsetLeft,i=l.$int.offsetWidth,d=l.$int.offsetHeight,c=function(){clearTimeout(m);m=$setTimeout(c,10);if(!j){return;}B=C+j;if(B<=l.max&&B>=l.min){C+=j;l.oInput.value=Math.round(C);}else{l.oInput.value=j<0?l.min:l.max;}};c();function D(t){t=t||window.event;var w=t.pageX||t.clientX+(o?o.scrollLeft:0),s=t.pageY||t.clientY+(o?o.scrollTop:0),u=a-s;if((s>G&&w>E)&&(s<G+d&&w<E+i)){j=0;return;}j=Math.pow(Math.min(200,Math.abs(u))/10,2)/10;if(u<0){j=-1*j;}}document.onmousemove=D;document.onmouseup=function(s){clearTimeout(m);var t=parseInt(l.oInput.value);if(t!=l.value){l.change(t);}document.onmousemove=document.onmouseup=null;};};var q=false;this.$buttonPlus.onmousedown=function(d){if(l.disabled){return;}d=d||window.event;q=true;var a=(parseInt(l.oInput.value)||0)+1,c=function(){clearTimeout(m);m=$setTimeout(c,50);n++;a+=Math.pow(Math.min(200,n)/10,2)/10;a=Math.round(a);l.oInput.value=a<=l.max?a:l.max;};apf.setStyleClass(this,"plusDown",["plusHover"]);c();};this.$buttonMinus.onmousedown=function(d){if(l.disabled){return;}d=d||window.event;q=true;var a=(parseInt(l.oInput.value)||0)-1,c=function(){clearTimeout(m);m=$setTimeout(c,50);n++;a-=Math.pow(Math.min(200,n)/10,2)/10;a=Math.round(a);l.oInput.value=a>=l.min?a:l.min;};apf.setStyleClass(this,"minusDown",["minusHover"]);c();};this.$buttonMinus.onmouseout=function(a){if(l.disabled){return;}clearTimeout(m);n=0;var c=parseInt(l.oInput.value);if(c!=l.value){l.change(c);}apf.setStyleClass(this,"",["minusHover"]);if(!l.focused){l.$blur(a);}};this.$buttonPlus.onmouseout=function(a){if(l.disabled){return;}clearTimeout(m);n=0;var c=parseInt(l.oInput.value);if(c!=l.value){l.change(c);}apf.setStyleClass(this,"",["plusHover"]);if(!l.focused){l.$blur(a);}};this.$buttonMinus.onmouseover=function(a){if(l.disabled){return;}apf.setStyleClass(this,"minusHover");};this.$buttonPlus.onmouseover=function(a){if(l.disabled){return;}apf.setStyleClass(this,"plusHover");};this.$buttonPlus.onmouseup=function(a){if(l.disabled){return;}a=a||event;a.cancelBubble=true;apf.setStyleClass(this,"plusHover",["plusDown"]);clearTimeout(m);n=0;var c=parseInt(l.oInput.value);if(!q){c++;l.oInput.value=c;}else{q=false;}if(c!=l.value){l.change(c);}};this.$buttonMinus.onmouseup=function(a){if(l.disabled){return;}a=a||event;a.cancelBubble=true;apf.setStyleClass(this,"minusHover",["minusDown"]);clearTimeout(m);n=0;var c=parseInt(l.oInput.value);if(!q){c--;l.oInput.value=c;}else{q=false;}if(c!=l.value){l.change(c);}};this.oInput.onselectstart=function(a){a=a||event;a.cancelBubble=true;};this.oInput.host=this;};this.$destroy=function(){this.oInput.onkeypress=this.oInput.onmousedown=this.oInput.onkeydown=this.oInput.onkeyup=this.oInput.onselectstart=this.$buttonPlus.onmouseover=this.$buttonPlus.onmouseout=this.$buttonPlus.onmousedown=this.$buttonPlus.onmouseup=this.$buttonMinus.onmouseover=this.$buttonMinus.onmouseout=this.$buttonMinus.onmousedown=this.$buttonMinus.onmouseup=null;};}).call(apf.spinner.prototype=new apf.StandardBinding());apf.aml.setElement("spinner",apf.spinner);apf.spreadsheet=function(i,d){this.$init(d||"spreadsheet",apf.NODE_VISIBLE,i);};apf.datagrid=function(i,d){this.$init(d||"datagrid",apf.NODE_VISIBLE,i);};(function(){this.$init(function(){this.$headings=[],this.$cssRules=[];this.$nodes=[];this.$lastOpened={};this.$editors={};this.dynCssClasses=[];});this.implement(apf.Cache,apf.DataAction);this.$focussable=true;this.multiselect=true;this.bufferselect=false;this.startClosed=true;this.$animType=apf.tween.NORMAL;this.$animSteps=3;this.$animSpeed=20;this.$curBtn=null;this.$useTable=false;this.$widthdiff=0;this.$defaultwidth=0;this.$useiframe=0;this.$renameStartCollapse=false;this.$init(function(){this.addEventListener("keydown",l,true);});this.$booleanProperties.iframe=true;function i(c,a){for(var d=0;d<c.length;d++){if(!c[d][1]){continue;}if(apf.isIE){(a||window).document.styleSheets[0].addRule(c[d][0],c[d][1]);}else{(a||window).document.styleSheets[0].insertRule(c[d][0]+" {"+c[d][1]+"}",0);}}}function j(){var c=(this.current||this.$selected),a=this.$int;a.scrollTop=(c.offsetTop)-21;}function l(U){var W=U.keyCode,N=U.ctrlKey,J=U.shiftKey,P=this.$selected||this.$caret;if(!U.force&&(!P||this.renaming)){return;}var d=this.caret||this.selected,R=this.$useiframe?this.oDoc.documentElement:this.$int,K,M,G,V,c,Q,T;switch(W){case 13:if(this.$tempsel){this.$selectTemp();}this.choose(P);break;case 32:if(N||!this.isSelected(this.caret)){this.select(this.caret,true);}return false;case 109:case 46:if(this.disableremove){return;}if(this.celledit){this.rename(this.caret||this.selected,"");return;}if(this.$tempsel){this.$selectTemp();}this.remove(this.mode?this.caret:null);break;case 36:this.$setTempSelected(this.getFirstTraverseNode(),false,J);this.$int.scrollTop=0;return false;case 35:this.$setTempSelected(this.getLastTraverseNode(),false,J);this.$int.scrollTop=this.$int.scrollHeight;return false;case 107:if(this.more){this.startMore();}break;case 37:if(this.$tempsel){this.$selectTemp();}if(this.cellselect){if(this.$lastcell){if(this.$lastcell.previousSibling){this.selectCell({target:this.$lastcell.previousSibling},this.$selected);}}else{this.selectCell({target:this.$selected.firstChild},this.$selected);}}else{if(this.$withContainer){this.slideToggle(this.$caret||this.$selected,2);}}return false;case 107:case 39:if(this.$tempsel){this.$selectTemp();}if(this.cellselect){if(this.$lastcell){if(this.$lastcell.nextSibling){this.selectCell({target:this.$lastcell.nextSibling},this.$selected);}}else{this.selectCell({target:this.$selected.firstChild},this.$selected);}}else{if(this.$withContainer){this.slideToggle(this.$caret||this.$selected,1);}}return false;case 38:if(!d&&!this.$tempsel){return false;}M=this.$tempsel?apf.xmldb.getNode(this.$tempsel):d;K=apf.getBox(apf.getStyle(P,"margin"));G=R.scrollHeight>R.offsetHeight;Q=Math.floor((R.offsetWidth-(G?15:0))/(P.offsetWidth+K[1]+K[3]));M=this.getNextTraverseSelected(M,false,Q);if(M){this.$setTempSelected(M,N,J);}else{return false;}P=apf.xmldb.findHtmlNode(M,this);if(P.offsetTop<=R.scrollTop){R.scrollTop=(Array.prototype.indexOf.call(this.getTraverseNodes(),M)<Q?0:P.offsetTop-K[0])-parseInt(apf.getStyle(R,apf.isIE?"paddingTop":"padding-top"));}return false;case 40:if(!d&&!this.$tempsel){return false;}M=this.$tempsel?apf.xmldb.getNode(this.$tempsel):d;K=apf.getBox(apf.getStyle(P,"margin"));G=R.scrollHeight>R.offsetHeight;Q=Math.floor((R.offsetWidth-(G?15:0))/(P.offsetWidth+K[1]+K[3]));M=this.getNextTraverseSelected(M,true,Q);if(M){this.$setTempSelected(M,N,J);}else{return false;}P=apf.xmldb.findHtmlNode(M,this);if(P.offsetTop+P.offsetHeight>R.scrollTop+R.offsetHeight){R.scrollTop=P.offsetTop-R.offsetHeight+P.offsetHeight+K[0];}return false;case 33:if(!d&&!this.$tempsel){return false;}M=this.$tempsel?apf.xmldb.getNode(this.$tempsel):d;K=apf.getBox(apf.getStyle(P,"margin"));c=R.scrollHeight>R.offsetHeight;V=R.scrollWidth>R.offsetWidth;Q=Math.floor((R.offsetWidth-(c?15:0))/(P.offsetWidth+K[1]+K[3]))||1;T=Math.floor((R.offsetHeight-(V?15:0))/(P.offsetHeight+K[0]+K[2]));M=this.getNextTraverseSelected(M,false,Q*T);if(!M){M=this.getFirstTraverseNode();}if(M){this.$setTempSelected(M,N,J);}else{return false;}P=apf.xmldb.findHtmlNode(M,this);if(P.offsetTop<R.scrollTop){R.scrollTop=(Array.prototype.indexOf.call(this.getTraverseNodes(),M)<Q?0:P.offsetTop-K[0])-parseInt(apf.getStyle(R,apf.isIE?"paddingTop":"padding-top"));}return false;case 34:if(!d&&!this.$tempsel){return false;}M=this.$tempsel?apf.xmldb.getNode(this.$tempsel):d;K=apf.getBox(apf.getStyle(P,"margin"));c=R.scrollHeight>R.offsetHeight;V=R.scrollWidth>R.offsetWidth;Q=Math.floor((R.offsetWidth-(c?15:0))/(P.offsetWidth+K[1]+K[3]))||1;T=Math.floor((R.offsetHeight-(V?15:0))/(P.offsetHeight+K[0]+K[2]));M=this.getNextTraverseSelected(d,true,Q*T);if(!M){M=this.getLastTraverseNode();}if(M){this.$setTempSelected(M,N,J);}else{return false;}P=apf.xmldb.findHtmlNode(M,this);if(P.offsetTop+P.offsetHeight>R.scrollTop+R.offsetHeight){R.scrollTop=P.offsetTop-R.offsetHeight+P.offsetHeight+K[0];}return false;default:if(this.celledit){if(!N&&!U.altKey&&(W>46&&W<112||W>123)){this.startRename(null,true);}return;}else{if(W==65&&N){this.selectAll();return false;}else{if(this.caption||(this.bindingRules||{})["caption"]){if(!this.xmlRoot){return;}if(!this.lookup||new Date().getTime()-this.lookup.date.getTime()>300){this.lookup={str:"",date:new Date()};}this.lookup.str+=String.fromCharCode(W);var O=this.getTraverseNodes();for(var a,I=0;I<O.length;I++){a=this.$applyBindRule("caption",O[I]);if(a&&a.substr(0,this.lookup.str.length).toUpperCase()==this.lookup.str){if(!this.isSelected(O[I])){if(this.mode=="check"){this.setCaret(O[I]);}else{this.select(O[I]);}}if(P){this.$int.scrollTop=P.offsetTop-(this.$int.offsetHeight-P.offsetHeight)/2;}return;}}return;}}}break;}this.lookup=null;}this.$focus=function(){if(!this.$ext||(apf.isIE&&this.$useiframe&&this.cssfix)){return;}this.$setStyleClass(this.oFocus||this.$ext,this.$baseCSSname+"Focus");if(this.oDoc){this.$setStyleClass(this.oDoc.documentElement,this.$baseCSSname+"Focus");}};this.$blur=function(){if(this.renaming){this.stopRename(null,true);}if(!this.$ext||(apf.isIE&&this.$useiframe&&this.cssfix)){return;}this.$setStyleClass(this.oFocus||this.$ext,"",[this.$baseCSSname+"Focus"]);if(this.oDoc){this.$setStyleClass(this.oDoc.documentElement,"",[this.$baseCSSname+"Focus"]);}};this.$calcSelectRange=function(a,d){var t=[],c=this.hasFeature(apf.__VIRTUALVIEWPORT__)?this.xmlRoot.selectNodes(this.each):this.getTraverseNodes(),s,u;for(s=false,u=0;u<c.length;u++){if(c[u]==a){s=true;}if(s){t.push(c[u]);}if(c[u]==d){s=false;}}if(!t.length||s){t=[];for(s=false,u=c.length-1;u>=0;u--){if(c[u]==a){s=true;}if(s){t.push(c[u]);}if(c[u]==d){s=false;}}}return t;};this.slideToggle=function(a,c){if(this.noCollapse){return;}var d=a.nextSibling;if(apf.getStyle(d,"display")=="block"){if(c==1){return;}a.className=a.className.replace(/min/,"plus");this.slideClose(d,apf.xmldb.getNode(a));}else{if(c==2){return;}a.className=a.className.replace(/plus/,"min");this.slideOpen(d,apf.xmldb.getNode(a));}};this.slideOpen=function(d,a){var t=apf.xmldb.findHtmlNode(a,this);if(!d){d=t.nextSibling;}if(this.singleopen){var c=this.getTraverseParent(a),s=(c||this.xmlRoot).getAttribute(apf.xmldb.xmlIdTag);if(this.$lastOpened[s]&&this.$lastOpened[s][1]!=a&&this.getTraverseParent(this.$lastOpened[s][1])==c){this.slideToggle(this.$lastOpened[s][0],2);}this.$lastOpened[s]=[t,a];}d.style.display="block";var q=this;apf.tween.single(d,{type:"scrollheight",from:0,to:d.scrollHeight,anim:this.$animType,steps:this.$animSteps,interval:this.$animSpeed,onfinish:function(m){if(a&&q.$hasLoadStatus(a,"potential")){$setTimeout(function(){q.$extend(a,m);});m.style.height="auto";}else{m.style.height="auto";}}});};this.slideClose=function(d,c){if(this.noCollapse){return;}if(this.singleopen){var a=(this.getTraverseParent(c)||this.xmlRoot).getAttribute(apf.xmldb.xmlIdTag);this.$lastOpened[a]=null;}d.style.height=d.offsetHeight;d.style.overflow="hidden";apf.tween.single(d,{type:"scrollheight",from:d.scrollHeight,to:0,anim:this.$animType,steps:this.$animSteps,interval:this.$animSpeed,onfinish:function(o,q){o.style.display="none";}});};this.$findContainer=function(a){var c=a.nextSibling;if(!c){return a;}return c.nodeType==1?c:c.nextSibling;};this.addEventListener("bindingsload",this.$loaddatabinding=function(z){var d=z.bindings.column;if(!d||!d.length){return;}this.$headings=d;var B=0,A=false;for(var C,a=0,c=d.length;a<c;a++){C=d[a];if(!C.$isPercentage){B+=parseFloat(C.$width)||0;}else{A=true;}}if(!A){this.$isFixedGrid=true;this.$setStyleClass(this.$ext,"fixed");if(this.$useiframe){this.$setStyleClass(this.oDoc.documentElement,"fixed");}}else{}if(B>0&&!this.$isFixedGrid){var w=B+5;this.$cssRules.push(["."+this.$baseCSSname+" .row"+this.$uniqueId,"padding-right:"+w+"px;margin-right:-"+w+"px"]);this.$int.style.paddingRight=this.$head.style.paddingRight=w+"px";}this.$fixed=B;this.$first=0;this.$withContainer=z.bindings.description?true:false;i(this.$cssRules,window);if(this.$useiframe){i(this.$cssRules,this.oWin);}});this.$add=function(K,O,N,d,M){this.$getNewContext("row");var J=this.$getLayoutNode("row");J.setAttribute("id",O);J.setAttribute("class","row"+this.$uniqueId);J.setAttribute("ondblclick","var o = apf.lookup("+this.$uniqueId+");o.choose();"+(this.$withContainer?"o.slideToggle(this);":"")+(this.celledit&&!this.namevalue?"o.startRename();":""));if(this.hasFeature(apf.__DRAGDROP__)){J.setAttribute("onmouseout","this.hasPassedDown = false;");J.setAttribute("onmousedown","var o = apf.lookup("+this.$uniqueId+");                var xmlNode = apf.xmldb.findXmlNode(this);                 var isSelected = o.isSelected(xmlNode);                 this.hasPassedDown = true;                 if (!o.hasFeature(apf.__DRAGDROP__) || !isSelected && !event.ctrlKey)                     o.select(this, event.ctrlKey, event.shiftKey);"+(this.cellselect||this.namevalue?"o.selectCell(event, this, isSelected);":""));J.setAttribute("onmouseup","if (!this.hasPassedDown) return;                var o = apf.lookup("+this.$uniqueId+");                 var xmlNode = apf.xmldb.findXmlNode(this);                 var isSelected = o.isSelected(xmlNode);                 if (o.hasFeature(apf.__DRAGDROP__))                     o.select(this, event.ctrlKey, event.shiftKey);");}else{J.setAttribute("onmousedown","var o = apf.lookup("+this.$uniqueId+");                var wasSelected = o.$selected == this;                o.select(this, event.ctrlKey, event.shiftKey);"+(this.cellselect||this.namevalue?"o.selectCell(event, this, wasSelected);":""));}for(var E,D,F=0;F<this.$headings.length;F++){D=this.$headings[F];this.$getNewContext("cell");E=this.$getLayoutNode("cell");apf.setStyleClass(E,D.$className);if(D.css){apf.setStyleClass(E,(apf.lm.compile(D.css))(K));}if(D.type=="icon"){var G=this.$getLayoutNode("cell","caption",J.appendChild(E));if(apf.isIE){apf.setNodeValue(G,"&nbsp;");}(G.nodeType==1&&G||G.parentNode).setAttribute("style","background-image:url("+apf.getAbsolutePath(this.iconPath,((D.cvalue2||D.$compile("value",{nostring:true}))(K)||""))+")");}else{apf.setNodeValue(this.$getLayoutNode("cell","caption",J.appendChild(E)),(D.cvalue2||D.$compile("value",{nostring:true}))(K)||"");}}if(this.$bindings&&this.$bindings.color){var P=this.$getDataNode("color",K);this.$setStyleClass(J,P?"highlight":null,P?["highlight"]:null);}var c=this.$applyBindRule("css",K);if(c){this.$setStyleClass(J,c);if(c){this.dynCssClasses.push(c);}}if(d){apf.insertHtmlNode(J,d,M);}else{this.$nodes.push(J);}if(this.$withContainer){var a=this.$applyBindRule("description",K);this.$getNewContext("container");var I=this.$getLayoutNode("container");apf.setNodeValue(this.$getLayoutNode("container","container",I),a);I.setAttribute("class",(I.getAttribute("class")||"")+" row"+this.$uniqueId);if(d){apf.insertHtmlNode(I,d,M);}else{this.$nodes.push(I);}}};this.$fill=function(a){if(this.$useiframe){this.$pHtmlDoc=this.oDoc;}if(this.$useTable){apf.insertHtmlNodes(this.$nodes,this.$int,null,"<table class='records' cellpadding='0' cellspacing='0'><tbody>","</tbody></table>");}else{apf.insertHtmlNodes(this.$nodes,this.$int);}this.$nodes.length=0;};this.$deInitNode=function(c,a){if(this.$withContainer){a.parentNode.removeChild(a.nextSibling);}a.parentNode.removeChild(a);};this.$updateNode=function(C,G){if(!G){return;}var F=this.$head.childNodes,a=G.childNodes,D,E;if(!this.namevalue&&this.$curBtn){E=this.$curBtn.parentNode;}for(var K,J,M=this.namevalue?1:0,d=F.length;M<d;M++){J=apf.all[F[M].getAttribute("hid")];K=a[M];while(K&&K.nodeType!=1){K=K.nextSibling;}D=this.$getLayoutNode("cell","caption",K)||K;if(J.type=="icon"){(D.nodeType==1&&D||D.parentNode).style.backgroundImage="url("+apf.getAbsolutePath(this.iconPath,((J.cvalue2||J.$compile("value",{nostring:true}))(C)||""))+")";}else{D.innerHTML=(J.cvalue2||J.$compile("value",{nostring:true}))(C)||"";}}if(!this.namevalue&&E){E.appendChild(this.$curBtn);}if(this.$bindings&&this.$bindings.color){var I=this.$getDataNode("color",C);this.$setStyleClass(G,I?"highlight":null,I?["highlight"]:null);}var c=this.$applyBindRule("css",C);if(c||this.dynCssClasses.length){this.$setStyleClass(G,c,this.dynCssClasses);if(c&&!this.dynCssClasses.contains(c)){this.dynCssClasses.push(c);}}if(this.$withContainer){G.nextSibling.innerHTML=this.$applyBindRule("description",C)||"";}};this.$moveNode=function(c,a){if(!a){return;}var n=a.parentNode;var d=c.nextSibling?apf.xmldb.findHtmlNode(this.getNextTraverse(c),this):null;n.insertBefore(a,d);};this.$selectDefault=function(a){this.select(a.selectSingleNode(this.each),null,null,null,true);};this.getColumn=function(a){return this.$headings[a||this.$lastcol||0];};this.resizeColumn=function(a,c){var d=this.$headings[a];d.resize(c);};this.hideColumn=function(a){var c=this.$headings[a];c.hide();};this.showColumn=function(a){var c=this.$headings[a];c.show();};this.sortColumn=function(c){var a=this.$headings[nr];a.sort();};this.moveColumn=function(a,c){var d=this.$headings[nr];d.move(c);};this.$draw=function(){this.$ext=this.$getExternal();this.$int=this.$getLayoutNode("main","body",this.$ext);this.$head=this.$getLayoutNode("main","head",this.$ext);this.$pointer=this.$getLayoutNode("main","pointer",this.$ext);if(this.$head.firstChild){this.$head.removeChild(this.$head.firstChild);}if(this.$int.firstChild){this.$int.removeChild(this.$int.firstChild);}var c=this.$widthdiff=this.$getOption("main","widthdiff")||0;this.$defaultwidth=this.$getOption("main","defaultwidth")||"100";this.$useiframe=apf.isIE&&(apf.isTrue(this.$getOption("main","iframe"))||this.iframe);var n=this;if(this.$useiframe&&!this.oIframe){var a=this.$int.className;this.oIframe=this.$int.appendChild(document.createElement(apf.isIE?"<iframe frameborder='0'></iframe>":"iframe"));this.oIframe.frameBorder=0;this.oWin=this.oIframe.contentWindow;this.oDoc=this.oWin.document;this.oDoc.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">                <html xmlns="http://www.w3.org/1999/xhtml">                    <head><script>                        apf = {                            lookup : function(uid){                                return window.parent.apf.lookup(uid);                            },                            Init : {add:function(){},run:function(){}}                        };<\/script>                    </head>                    <body></body>                </html>');this.$int=this.oDoc.body;this.$int.className=a;this.oDoc.documentElement.className=this.$ext.className;apf.skins.loadCssInWindow(this.skinName,this.oWin,this.mediaPath,this.iconPath);if(apf.isIE){this.$setStyleClass(this.oDoc.documentElement,this.$baseCSSname+"Focus");}apf.convertIframe(this.oIframe,true);this.oDoc.body.insertAdjacentHTML("beforeend",this.oTxt.outerHTML);var d=this.oTxt;d.refCount--;this.oTxt=this.oDoc.body.lastChild;this.oTxt.parentNode.removeChild(this.oTxt);this.oTxt.select=d.select;this.oTxt.ondblclick=this.oTxt.onselectstart=this.oTxt.onmouseover=this.oTxt.onmouseout=this.oTxt.oncontextmenu=this.oTxt.onmousedown=function(m){(m||(n.oWin||window).event).cancelBubble=true;};this.oTxt.onfocus=d.onfocus;this.oTxt.onblur=d.onblur;this.oTxt.onkeyup=d.onkeyup;this.oTxt.refCount=1;if(apf.getStyle(this.oDoc.documentElement,apf.isIE?"overflowY":"overflow-y")=="auto"){this.oIframe.onresize=function(){n.$head.style.marginRight=n.oDoc.documentElement.scrollHeight>n.oDoc.documentElement.offsetHeight?"16px":"0";};this.addEventListener("afterload",this.oIframe.onresize);this.addEventListener("xmlupdate",this.oIframe.onresize);}this.oDoc.documentElement.onmousedown=function(m){if(!m){m=n.oWin.event;}if((m.srcElement||m.target).tagName=="HTML"){apf.popup.forceHide();}};this.oDoc.documentElement.onscroll=function(){if(n.$isFixedGrid){n.$head.scrollLeft=n.oDoc.documentElement.scrollLeft;}};}else{if(apf.getStyle(this.$int,apf.isIE?"overflowY":"overflow-y")=="auto"){this.$resize=function(){n.$head.style.marginRight=n.$int.scrollHeight>n.$int.offsetHeight?"16px":"0";};apf.layout.setRules(this.$ext,this.$uniqueId+"_datagrid","var o = apf.all["+this.$uniqueId+"];                     if (o) o.$resize()");apf.layout.queue(this.$ext);this.addEventListener("afterload",this.$resize);this.addEventListener("xmlupdate",this.$resize);}this.$int.onmousedown=function(m){if(!m){m=event;}if((m.srcElement||m.target)==this){apf.popup.forceHide();}};this.$int.onscroll=function(){if(n.$isFixedGrid){n.$head.scrollLeft=n.$int.scrollLeft;}};}};this.$destroy=function(){apf.popup.removeContent(this.$uniqueId);this.$ext.onclick=this.$int.onresize=null;apf.layout.removeRule(this.$int,"dg"+this.$uniqueId);apf.layout.activateRules(this.$int);};}).call(apf.datagrid.prototype=new apf.MultiSelect());apf.spreadsheet.prototype=apf.datagrid.prototype;apf.aml.setElement("spreadsheet",apf.spreadsheet);apf.aml.setElement("datagrid",apf.datagrid);apf.aml.setElement("description",apf.BindingRule);apf.aml.setElement("color",apf.BindingRule);apf.aml.setElement("contents",apf.BindingRule);apf.skin=function(i,d){this.$init(d||"skin",apf.NODE_HIDDEN,i);};apf.aml.setElement("skin",apf.skin);(function(){this.$parsePrio="002";this.$propHandlers.src=function(a){this.$path=apf.getAbsolutePath(apf.hostPath,a);l.call(this,this.$path);};this.$propHandlers.name=function(a){if(!this.attributes.getNamedItem("src")){this.$path=apf.getAbsolutePath(apf.hostPath,a)+"/index.xml";l.call(this,this.$path);}};function m(i){if(!i.ownerDocument.documentElement){return false;}var c=i.ownerDocument.documentElement.attributes;for(var d=false,a=0;a<c.length;a++){if(c[a].nodeValue==apf.ns.aml){d=true;break;}}return d;}function l(c){var d=this.ownerDocument.$domParser;if(!apf.skins.$first){apf.skins.$first=this;}var a=this.attributes.getNamedItem("defer");if(!a||!apf.isTrue(a.nodeValue)){d.$shouldWait++;this.$parseContext=d.$parseContext||[this.ownerDocument.documentElement];}o.call(this,c);}function n(c){if(c){apf.skins.Init(c,this,this.$path);}if(!this.defer){var a=this.ownerDocument.$domParser;a.$continueParsing.apply(a,this.$parseContext);}}function q(i,a,d){var c=this;apf.getData(apf.getAbsolutePath(d,i.getAttribute("src")),{callback:function(j,B,F){if(B!=apf.SUCCESS){throw new Error("Could not load skin include");}var E=apf.getXml('<a:skin xmlns:a="http://ajax.org/2005/aml">'+j+"</a:skin>");apf.mergeXml(E,a,{beforeNode:i});i.parentNode.removeChild(i);var C=$xmlns(E,"include",apf.ns.aml);if(C.length){var G=apf.getDirname(F.url);for(var D=0;D<C.length;D++){q.call(c,C[D],a,G);}}else{if(!$xmlns(a,"include",apf.ns.aml).length){n.call(c,a);}}}});}function o(a){var c=this;apf.getData(a,{callback:function(d,j,E){if(j!=apf.SUCCESS){var D=new Error(apf.formatErrorString(1007,c,"Loading skin file","Could not load skin file '"+(i||c.src)+"'\nReason: "+E.message));if(E.tpModule.retryTimeout(E,j,null,D)===true){return true;}if(this.autoload){apf.console.warn("Could not autload skin.");return n.call(c);}throw D;}d=d.replace(/\<\!DOCTYPE[^>]*>/,"").replace(/&nbsp;/g," ").replace(/^[\r\n\s]*/,"").replace(/xmlns\=\"[^"]*\"/g,"");if(!d){throw new Error(apf.formatErrorString(0,c,"Loading skin","Empty skin file. Maybe the file does not exist?",c));}var B=apf.getXml(d);if(!B){throw new Error(apf.formatErrorString(0,c,"Loading skin","Could not parse skin. Maybe the file does not exist?",c));}B.setAttribute("filename",E.url);var A=$xmlns(B,"include",apf.ns.aml);if(A.length){var i=apf.getDirname(E.url);for(var C=0;C<A.length;C++){q.call(c,A[C],B,i);}return;}else{n.call(c,B);}},async:true,ignoreOffline:true});}this.addEventListener("DOMNodeInsertedIntoDocument",function(a){if(this.src||this.name){return;}apf.skins.Init(this);});}).call(apf.skin.prototype=new apf.AmlElement());apf.video=function(i,d){this.$init(d||"video",apf.NODE_VISIBLE,i);};(function(){this.implement(apf.DataAction);this.$booleanProperties.fullscreen=true;var n=null;this.$propHandlers.fullscreen=function(d){if(!this.player){return;}if(typeof this.player.setFullscreen=="function"){this.player.setFullscreen(d);}else{if(this.parentNode&&this.parentNode.tagName!="application"&&this.parentNode.setWidth){var j,i,c=this.parentNode.$ext;if(d){n={width:this.parentNode.getWidth(),height:this.parentNode.getHeight(),top:this.parentNode.getTop(),left:this.parentNode.getLeft(),position:apf.getStyle(c,"position"),zIndex:apf.getStyle(c,"z-index"),resizable:this.parentNode.resizable,nodes:[]};if(c!=document.body){while(c.parentNode!=document.body){var i=c.parentNode;j=n.nodes.push({pos:apf.getSyle(i,"position")||"",top:apf.getSyle(i,"top")||i.offsetTop+"px",left:apf.getSyle(i,"left")||i.offsetLeft+"px",node:i})-1;i.style.position="absolute";i.style.top="0";i.style.left="0";}}this.parentNode.$ext.style.position="absolute";this.parentNode.$ext.style.zIndex="1000000";this.parentNode.setWidth("100%");this.parentNode.setHeight("100%");this.parentNode.setTop("0");this.parentNode.setLeft("0");if(this.parentNode.resizable){this.parentNode.setAttribute("resizable",false);}}else{if(n){var l;if(n.nodes.length){for(j=n.nodes.length-1;j>=0;j--){l=n.nodes[j];i=l.node;i.style.position=l.pos;i.style.top=l.top;i.style.left=l.left;}}this.parentNode.$ext.style.zIndex=n.zIndex;this.parentNode.$ext.style.position=n.position;this.parentNode.setWidth(n.width);this.parentNode.setHeight(n.height);this.parentNode.setTop(n.top);this.parentNode.setLeft(n.left);if(n.resizable){this.parentNode.setAttribute("resizable",true);}n=null;delete n;}}if(this.player.onAfterFullscreen){this.player.onAfterFullscreen(d);}var a=this;window.setTimeout(function(){apf.layout.forceResize(a.parentNode.$ext);},100);}}};this.addEventListener("keydown",function(a){switch(a.keyCode){case 13&&(a.ctrlKey||a.altKey):case 70:this.setPropery("fullscreen",true);return false;break;case 80:this.setProperty("paused",!this.paused);return false;break;case 27:this.setProperty("fullscreen",false);return false;break;default:break;}},true);this.$mainBind="src";this.loadMedia=function(){if(this.player){this.setProperty("currentSrc",this.src);this.setProperty("networkState",apf.Media.NETWORK_LOADING);this.player.load(this.src);}return this;};this.seek=function(a){if(this.player&&a>=0&&a<=this.duration){this.player.seek(a);}};this.setVolume=function(a){if(this.player){this.player.setVolume(a);}};var o="mov",s="flv",m="asf|asx|avi|wmv",q="ogg",t="3gp|3gpp|3g2|3gpp2|divx|mp4|mpg4|mpg|mpeg|mpe|ogg|vob";this.$guessType=function(c){var d=c.substr(c.lastIndexOf(".")+1),a="";if(o.indexOf(d)!=-1){a="video/quicktime";}else{if(s.indexOf(d)!=-1){a="video/flv";}else{if(m.indexOf(d)!=-1){a="video/wmv";}else{if(q.indexOf(d)!=-1&&apf.hasVideo){a="video/ogg";}else{if(t.indexOf(d)!=-1){a="video/vlc";}}}}}if(d=="mpg"||d=="mpeg"||d=="mpe"){a=apf.isMac?"video/quicktime":"video/wmv";}if(!apf.isWin&&!apf.isMac&&a=="video/wmv"){a="video/vlc";}return a;};this.$getPlayerType=function(c){if(!c){return null;}var d=null;var i=c.splitSafe(",");if(i.length==1){i=i[0].splitSafe(";");}for(var a=0;a<i.length;a++){c=i[a];if(c.indexOf("ogg")>-1){d="TypeNative";}else{if(c.indexOf("flv")>-1){d="TypeFlv";}else{if(c.indexOf("quicktime")>-1){d="TypeQT";}else{if(c.indexOf("wmv")>-1){d="TypeWmp";}else{if(c.indexOf("silverlight")>-1){d="TypeSilverlight";}else{if(c.indexOf("vlc")>-1){d="TypeVlc";}}}}}}if(d=="TypeWmp"){if(!apf.isIE&&typeof apf.video.TypeVlc!="undefined"&&apf.video.TypeVlc.isSupported()){d="TypeVlc";}else{if(apf.isMac){d="TypeQT";}}}if(d&&apf.video[d]&&apf.video[d].isSupported()){this.$lastMimeType=a;return d;}}this.$lastMimeType=-1;return null;};this.$isSupported=function(a){a=a||this.playerType;return(apf.video[a]&&apf.video[a].isSupported());};this.$initPlayer=function(){this.player=new apf.video[this.playerType](this,this.$ext,{src:this.src.splitSafe(",")[this.$lastMimeType]||this.src,width:this.width,height:this.height,autoLoad:true,autoPlay:this.autoplay,showControls:this.controls,volume:this.volume,mimeType:this.type});return this;};this.$initHook=function(){this.loadMedia();};this.$cuePointHook=function(){};this.$playheadUpdateHook=function(){};this.$errorHook=function(a){apf.console.error(a.error);};this.$progressHook=function(c){this.setProperty("bufferedBytes",{start:0,end:c.bytesLoaded});this.setProperty("totalBytes",c.totalBytes);var a=Math.abs(c.bytesLoaded-c.totalBytes);if(a<=20){this.setProperty("readyState",apf.Media.HAVE_ENOUGH_DATA);}};this.$stateChangeHook=function(a){if(a.state=="loading"){this.setProperty("networkState",this.networkState=apf.Media.NETWORK_LOADING);}else{if(a.state=="connectionError"){this.$propHandlers.readyState.call(this,this.networkState=apf.Media.HAVE_NOTHING);}else{if(a.state=="playing"||a.state=="paused"){if(a.state=="playing"){this.$readyHook({type:"ready"});}this.paused=Boolean(a.state=="paused");this.setProperty("paused",this.paused);}else{if(a.state=="seeking"){this.seeking=true;this.setProperty("seeking",true);}}}}};this.$changeHook=function(a){if(typeof a.volume!="undefined"){this.volume=a.volume;if(!this.muted){this.setProperty("volume",this.volume);}}else{this.duration=this.player.getTotalTime();this.position=a.playheadTime/this.duration;if(isNaN(this.position)){return;}this.setProperty("position",this.position);this.currentTime=a.playheadTime;this.setProperty("currentTime",this.currentTime);}};this.$completeHook=function(a){this.paused=true;this.setProperty("paused",true);};this.$readyHook=function(a){this.setProperty("networkState",apf.Media.NETWORK_LOADED);this.setProperty("readyState",apf.Media.HAVE_FUTURE_DATA);this.setProperty("duration",this.player.getTotalTime());this.seeking=false;this.seekable=true;this.setProperty("seeking",false);return this;};this.$metadataHook=function(a){this.oVideo.setProperty("readyState",apf.Media.HAVE_METADATA);};this.stopListening=function(){if(!this.player){return this;}return this;};this.$draw=function(){this.$ext=this.$getExternal();};this.addEventListener("DOMNodeInsertedIntoDocument",function(){this.$int=this.$getLayoutNode("main","container",this.$ext);this.width=parseInt(this.width)||null;this.height=parseInt(this.height)||null;});this.addEventListener("AMLMediaReady",function(){if(this.setSource()){this.$propHandlers.type.call(this,this.type);}});this.$destroy=function(a){if(this.player&&this.player.$destroy){this.player.$destroy();}delete this.player;this.player=null;if(a){this.$ext.innerHTML="";}};}).call(apf.video.prototype=new apf.Media());apf.aml.setElement("video",apf.video);apf.video.TypeInterface={properties:["src","width","height","volume","showControls","autoPlay","totalTime","mimeType"],setOptions:function(i){if(i==null){return this;}var m=this.properties;for(var n=0;n<m.length;n++){var l=m[n];if(i[l]==null){continue;}this[l]=i[l];}return this;},getElement:function(i){var d;if(typeof i=="object"){return i;}if(apf.isIE){return window[i];}else{d=document[i]?document[i]:document.getElementById(i);if(!d){d=apf.lookup(i);}return d;}}};apf.model=function(i,d){this.$init(d||"model",apf.NODE_HIDDEN,i);this.$amlNodes={};this.$propBinds={};this.$listeners={};this.$proplisteners={};if(!apf.globalModel){apf.globalModel=this;apf.nameserver.register("model","@default",this);}};(function(){this.$parsePrio="020";this.$isModel=true;this.canHaveChildren=false;this["save-original"]=true;this.$state=0;this.$attrExcludePropBind=apf.extend({submission:1,src:1,session:1},this.$attrExcludePropBind);this.$booleanProperties.autoinit=true;this.$supportedProperties=["submission","src","session","autoinit","save-original","remote"];this.$propHandlers.src=this.$propHandlers.get=function(d,i){if(this.$amlLoaded){this.$loadFrom(d);}};this.$propHandlers.validation=function(d,i){apf.nameserver.get("validation",d).register(this);};this.$propHandlers.remote=function(d,i){if(this.rsb){this.rsb.models.remove(this);this.rsb=null;}if(d){this.rsb=apf.nameserver.get("remote",this.remote);this.rsb.models.push(this);}};this.validate=function(m,l,n,j){if(!this.$validation){return;}if(!m){}else{n=this.$validation.validate(m,l,n);if(n.valid){j.clearError();return true;}else{j.setError();return false;}}};this.register=function(w,q){if(!w||!w.load){return this;}if(w.$model&&w.$model!=this){w.$model.unregister(w);}var t=this.$amlNodes[w.$uniqueId]={amlNode:w,xpath:q};w.$model=this;var o,u,s=w.$propsUsingMainModel;for(var n in s){o=this.$bindXmlProperty(w,n,s[n].xpath,s[n].optimize);if(this.data){if(u=o.root||o.listen?this.data.selectSingleNode(o.root||o.listen):this.data){w.$execProperty(n,u);}else{this.$waitForXml(w,n);}}}if(typeof w.noloading=="undefined"&&w.$setInheritedAttribute&&!w.$setInheritedAttribute("noloading")){w.noloading=false;}if(this.$state==1){if(w.clear&&!w.noloading){w.clear("loading");}}else{if(this.data){this.$loadInAmlNode(t);}else{if(w.clear){w.clear("empty");}}}return this;};this.$register=function(i,d){this.$amlNodes[i.$uniqueId].xpath=d;};this.unregister=function(i){delete this.$amlNodes[i.$uniqueId];var l=i.$propsUsingMainModel;for(var j in l){this.$unbindXmlProperty(i,j);}};this.getXpathByAmlNode=function(d){var i=this.$amlNodes[d.$uniqueId];if(!i){return false;}return i.xpath;};this.$loadInAmlNode=function(l){var m;var j=l.xpath;var n=l.amlNode;if(this.data&&j){m=this.data.selectSingleNode(j);}else{m=this.data||null;}if(m){delete this.$listeners[n.$uniqueId];n.load(m);}else{this.$waitForXml(n);}};this.$loadInAmlProp=function(n,t){var o,s,q=this.$propBinds[n],m=apf.all[n];for(o in q){if(s=q[o].root?t.selectSingleNode(q[o].root):t){apf.xmldb.addNodeListener(t,m,"p|"+n+"|"+o+"|"+this.$uniqueId);delete this.$proplisteners[n];m.$execProperty(o,s);}else{this.$waitForXml(m,o);}}};this.$bindXmlProperty=function(z,D,q,F,l){var C,A,B=z.$uniqueId;if(!this.$propBinds[B]){this.$propBinds[B]={};}A=this.$propBinds[B][D]={bind:q};if(F){if((C=this.$amlNodes[B])&&C.xpath){q=(A.root=C.xpath)+"/"+q;}var w=q.split("/"),G=w.pop();if(G.indexOf("@")==0||G.indexOf("text()")>-1||G.indexOf("node()")>-1){A.listen=w.join("/");}else{A.listen=q;}}else{if((C=this.$amlNodes[B])&&C.xpath){A.listen=C.xpath;}}if(l){A.listen=".";}if(this.data){var E=A.listen?this.data.selectSingleNode(A.listen):this.data;if(E){apf.xmldb.addNodeListener(E,z,"p|"+z.$uniqueId+"|"+D+"|"+this.$uniqueId);return A;}}this.$waitForXml(z,D);return A;};this.$unbindXmlProperty=function(q,m){var n=q.$uniqueId;var o=this.$propBinds[n]&&this.$propBinds[n][m];if(!o){return;}if(this.data){var l=o.listen?this.data.selectSingleNode(o.listen):this.data;if(l){apf.xmldb.removeNodeListener(l,q,"p|"+n+"|"+m+"|"+this.$uniqueId);}}delete this.$proplisteners[n+m];delete this.$propBinds[n][m];return o;};this.getXml=function(){return this.data?apf.xmldb.cleanNode(this.data.cloneNode(true)):false;};this.setQueryValue=function(i,j){if(!this.data){return false;}var l=apf.createNodeFromXpath(this.data,i);if(!l){return null;}apf.setNodeValue(l,j,true);return l;};this.queryValue=function(c){if(!this.data){return false;}return apf.queryValue(this.data,c);};this.queryValues=function(c){if(!this.data){return false;}return apf.queryValue(this.data,c);};this.queryNode=function(c){if(!this.data){return null;}return this.data.selectSingleNode(c);};this.queryNodes=function(c){if(!this.data){return null;}return this.data.selectNodes(c);};this.appendXml=function(j,i){var l=i?apf.createNodeFromXpath(this.data,i):this.data;if(!l){return null;}if(typeof j=="string"){j=apf.getXml(j);}else{j=!j.nodeType?j.getXml():apf.xmldb.getCleanCopy(j);}if(!j){return;}apf.xmldb.appendChild(l,j);};this.removeXml=function(c){if(typeof c=="string"){c=this.data.selectNodes(c);}else{if(!c.length){c=[c];}}if(c){apf.xmldb.removeNodeList(c);}};this.clear=function(){this.load(null);doc=null;};this.reset=function(){this.load(this.copy);};this.savePoint=function(){this.copy=apf.xmldb.getCleanCopy(this.data);};this.reloadAmlNode=function(j){if(!this.data){return;}var l=this.$amlNodes[j];var i=l.xpath?this.data.selectSingleNode(l.xpath):this.data;l.amlNode.load(i);};this.addEventListener("DOMNodeInsertedIntoDocument",function(m){var j=this.$aml;if(this.parentNode.hasFeature(apf.__DATABINDING__)){if(!this.name){this.setProperty("id","model"+this.parentNode.$uniqueId);}this.register(this.parentNode);}if(!this.src){var l,n=j;if(n.childNodes.length){if(apf.getNode(n,[0])){if((l=n.xml||n.serialize()).match(/^[\s\S]*?>([\s\S]*)<[\s\S]*?$/)){l=RegExp.$1;if(!apf.supportNamespaces){l=l.replace(/xmlns=\"[^"]*\"/g,"");}}return this.load(apf.getXmlDom(l).documentElement);}else{if(apf.isJson(n.childNodes[0].nodeValue)){return this.load(apf.getXmlDom(n.childNodes[0].nodeValue).documentElement);}}}if(this.submission){this.load("<data />");}}if(!apf.isFalse(this.autoinit)){this.init();}return this;});this.init=function(c){if(this.session){this.$loadFrom(this.session,{isSession:true});}else{if(typeof apf.offline!="undefined"&&apf.offline.models.enabled){if(apf.offline.models.loadModel(this)){return;}if(this.src&&!apf.offline.onLine){apf.offline.models.addToInitQueue(this);return;}}if(this.src){this.$loadFrom(this.src,{callback:c});}}};this.$loadFrom=function(A,w){var t=A.split(":");if(!w){w={};}if(!w.isSession){this.src=A;this.$srcOptions=[A,w];}this.dispatchEvent("beforeretrieve");var z,u;for(z in this.$amlNodes){if(!(u=this.$amlNodes[z])||!u.amlNode){continue;}if(!u.amlNode.noloading){u.amlNode.clear("loading");}}this.$state=1;if(!this.$callCount){this.$callCount=1;}else{this.$callCount++;}var s=this,q=this.$callCount,o=w.callback;w.callback=function(c,d,i){if(q!=s.$callCount){return;}s.dispatchEvent("afterretrieve");if(d==apf.OFFLINE){apf.offline.models.addToInitQueue(this);return false;}if(d!=apf.SUCCESS){var a;a=new Error(apf.formatErrorString(1032,s,"Inserting xml data","Could not load data Instruction:"+A+"\nUrl: "+i.url+"\nInfo: "+i.message+"\n\n"+c));if(o&&o.apply(this,arguments)===true){return true;}if(i.tpModule&&i.tpModule.retryTimeout(i,d,s,a)===true){return true;}s.$state=0;throw a;}if(w&&w.isSession&&!c){if(this.src){return s.$loadFrom(this.src);}}else{if(w&&w.cancel){return;}s.load(c);s.dispatchEvent("receive",{data:c});if(o){o.apply(this,arguments);}}};return apf.getData(A,w);};this.reload=function(){if(!this.data){return;}if(this.$srcOptions){this.$loadFrom.apply(this,this.$srcOptions);}else{if(this.src){this.$loadFrom(this.src);}}};this.load=function(o,q){if(typeof o=="string"){if(o.charAt(0)=="<"){if(o.substr(0,5).toUpperCase()=="<!DOC"){o=o.substr(o.indexOf(">")+1);}o=apf.getXmlDom(o,null,true).documentElement;}else{return this.$loadFrom(o,q);}}if(this.ownerDocument&&this.ownerDocument.$domParser.$shouldWait){var l=this;apf.queue.add("modelload"+this.$uniqueId,function(){l.load(o,q);});return;}this.$state=0;if(this.dispatchEvent("beforeload",{xmlNode:o})===false){return false;}var n=o?o.ownerDocument:null;if(o){if(!apf.supportNamespaces&&(o.prefix||o.scopeName)){n.setProperty("SelectionNamespaces","xmlns:"+(o.prefix||o.scopeName)+"='"+o.namespaceURI+"'");}apf.xmldb.addNodeListener(o,this);apf.xmldb.nodeConnect(apf.xmldb.getXmlDocId(o,this),o,null,this);if((!q||!q.nocopy)&&this["save-original"]){this.copy=apf.xmldb.getCleanCopy(o);}}this.data=o;for(var m in this.$amlNodes){this.$loadInAmlNode(this.$amlNodes[m]);}for(m in this.$propBinds){this.$loadInAmlProp(m,o);}this.dispatchEvent("afterload",{xmlNode:o});return this;};this.$waitForXml=function(d,i){if(i){this.$proplisteners[d.$uniqueId+i]={id:d.$uniqueId,amlNode:d,prop:i};}else{this.$listeners[d.$uniqueId]=d;}};this.$xmlUpdate=function(s,w,t,u){var q,o;for(var n in this.$listeners){if(w=this.data.selectSingleNode(this.$amlNodes[n].xpath||".")){this.$listeners[n].load(w);delete this.$listeners[n];}}for(n in this.$proplisteners){q=this.$proplisteners[n];o=this.$propBinds[q.id][q.prop];if(w=o.listen?this.data.selectSingleNode(o.listen):this.data){apf.xmldb.addNodeListener(w,q.amlNode,"p|"+q.id+"|"+q.prop+"|"+this.$uniqueId);delete this.$proplisteners[n];q.amlNode.$execProperty(q.prop,o.root?this.data.selectSingleNode(o.root):this.data);}}};this.$insertFrom=function(n,m){if(!n){return false;}this.dispatchEvent("beforeretrieve");var l=m.callback,j=this;m.callback=function(a,c,d){j.dispatchEvent("afterretrieve");if(!d){d={};}if(c!=apf.SUCCESS){var i;if(d.tpModule.retryTimeout(d,c,m.amlNode||j,i)===true){return true;}throw i;}if(typeof m.insertPoint=="string"){m.insertPoint=j.data.selectSingleNode(m.insertPoint);}if(typeof m.clearContents=="undefined"&&d.userdata){m.clearContents=apf.isTrue(d.userdata[1]);}(m.amlNode||j).insert(a,m);if(l){l.call(this,d.data);}};apf.getData(n,m);};this.insert=function(j,i){if(typeof j=="string"){if(j.charAt(0)=="<"){j=apf.getXmlDom(j).documentElement;}else{return this.$insertFrom(j,i);}}if(!i.insertPoint){i.insertPoint=this.data;}if(typeof i.copyAttributes=="undefined"){i.copyAttributes=true;}var l=apf.mergeXml(j,i.insertPoint,i);apf.xmldb.applyChanges("insert",i.insertPoint);return j;};this.convertXml=function(c){if(!c){return this.data.xml;}return apf.convertXml(this.data,c);};this.submit=function(s,t,w,t,u,q){if(!s){s=this.submission;}if(!w){w=this.data;}if(!t){t="form";}if(this.dispatchEvent("beforesubmit",{instruction:s})===false){return false;}var A=this;function z(a,c,d){if((c==apf.TIMEOUT||(A.retryOnError&&c==apf.ERROR))&&d.retries<apf.maxHttpRetries){return d.tpModule.retry(d.id);}else{if(c!=apf.SUCCESS){A.dispatchEvent("submiterror",d);}else{A.dispatchEvent("submitsuccess",apf.extend({data:a},d));}}}var o;if(t.indexOf("xml")>-1){o=apf.getXmlString(w);}else{if(t.indexOf("form")>-1){o=apf.convertXml(apf.xmldb.getCleanCopy(w),"cgiobjects");}else{if(t.indexOf("json")>-1){o=apf.convertXml(w,"json");}}}apf.saveData(s,{xmlNode:w,data:o,callback:z});this.dispatchEvent("aftersubmit");};this.$destroy=function(){if(this.session&&this.data){apf.saveData(this.session,{xmlNode:this.getXml()});}};}).call(apf.model.prototype=new apf.AmlElement());apf.aml.setElement("model",apf.model);apf.list=function(i,d){this.$init(d||"list",apf.NODE_VISIBLE,i);};apf.thumbnail=function(i,d){this.$init(d||"thumbnail",apf.NODE_VISIBLE,i);};apf.select=function(i,d){this.$init(d||"select",apf.NODE_VISIBLE,i);};apf.select1=function(i,d){this.$init(d||"selectl",apf.NODE_VISIBLE,i);};(function(){if(!apf.isIphone){this.implement(apf.Rename);}this.$getCaptionElement=function(){if(!(this.$caret||this.$selected)){return;}var a=this.$getLayoutNode("item","caption",this.$caret||this.$selected);if(!a){return;}return a.nodeType==1?a:a.parentNode;};this.addEventListener("afterselect",function(a){if(this.hasFeature(apf.__VALIDATION__)){this.validate(true);}});this.$supportedProperties.push("appearance","mode","more","thumbsize");this.$propHandlers.thumbsize=function(a){var c=this.thumbclass;if(apf.isIE){c=c.splitSafe(",");for(var m=0;m<c.length;m++){apf.setStyleRule(c[m],"width",a+"px");apf.setStyleRule(c[m],"height",a+"px");}return;}apf.setStyleRule(c,"width",a+"px");apf.setStyleRule(c,"height",a+"px");};this.$propHandlers.appearance=function(a){};this.mode="normal";this.$propHandlers.mode=function(a){this.mode=a||"normal";if("check|radio".indexOf(this.mode)>-1){this.allowdeselect=false;this.addEventListener("afterrename",d);if(this.mode=="check"){this.autoselect=false;this.ctrlselect=true;}else{if(this.mode=="radio"){this.multiselect=false;}}}else{this.ctrlselect=false;this.removeEventListener("afterrename",d);}};function d(){}this.$propHandlers.more=function(a){if(a){this.delayedselect=false;this.addEventListener("xmlupdate",i);this.addEventListener("afterload",i);this.$setClearMessage=function(c){if(!this.moreItem){this.$fill();}this.$int.appendChild(this.moreItem);};this.$updateClearMessage=function(){};this.$removeClearMessage=function(){};}else{this.removeEventListener("xmlupdate",i);this.removeEventListener("afterload",i);}};function i(a){if((!a.action||"insert|add|synchronize|move".indexOf(a.action)>-1)&&this.moreItem){this.$int.appendChild(this.moreItem);}}this.addEventListener("keydown",this.$keyHandler,true);this.$draw=function(){this.appearance=this.getAttribute("appearance")||"compact";var a=this.getAttribute("mode");this.$ext=this.$getExternal();this.$int=this.$getLayoutNode("main","container",this.$ext);if(apf.hasCssUpdateScrollbarBug&&!this.mode){this.$fixScrollBug();}var c=this;this.$ext.onclick=function(l){c.dispatchEvent("click",{htmlEvent:l||event});};this.listtype=parseInt(this.$getOption("main","type"))||1;this.behaviour=parseInt(this.$getOption("main","behaviour"))||1;this.thumbsize=this.$getOption("main","thumbsize");this.thumbclass=this.$getOption("main","thumbclass");};this.$loadAml=function(a){};this.$destroy=function(){if(this.$ext){this.$ext.onclick=null;}apf.destroyHtmlNode(this.oDrag);this.oDrag=null;};}).call(apf.list.prototype=new apf.BaseList());apf.thumbnail.prototype=apf.select.prototype=apf.select1.prototype=apf.list.prototype;apf.aml.setElement("thumbnail",apf.thumbnail);apf.aml.setElement("select",apf.select);apf.aml.setElement("select1",apf.select1);apf.aml.setElement("list",apf.list);apf.errorbox=function(i,d){this.$init(d||"errorbox",apf.NODE_VISIBLE,i);};(function(){this.$positioning="basic";this.display=function(m){this.host=m;var n=m.validityState.$errorHtml||m.$ext;document.body.appendChild(this.$ext);var j=(parseFloat(m.$getOption&&m.$getOption("main","erroffsetx")||0)),l=(parseFloat(m.$getOption&&m.$getOption("main","erroffsety")||0));this.show();apf.popup.show(this.$uniqueId,{x:j,y:l,animate:false,ref:n});this.$setStyleClass(this.$ext,j+this.$ext.offsetWidth>this.$ext.offsetParent.offsetWidth?"rightbox":"leftbox",["leftbox","rightbox"]);};this.setMessage=function(c){if(c&&c.indexOf(";")>-1){c=c.split(";");c="<strong>"+c[0]+"</strong>"+c[1];}this.$int.innerHTML=c||"";};this.$draw=function(){this.$ext=this.$getExternal();this.$int=this.$getLayoutNode("main","container",this.$ext);this.oClose=this.$getLayoutNode("main","close",this.$ext);if(this.oClose){var c=this;this.oClose.onclick=function(){c.hide();if(apf.document.activeElement){apf.document.activeElement.focus(true,{mouse:true});}};}this.$ext.onmousedown=function(a){(a||event).cancelBubble=true;if(apf.hasFocusBug){apf.window.$focusfix();}};this.hide();apf.popup.setContent(this.$uniqueId,this.$ext,"",null,null);};this.$loadAml=function(c){};this.$destroy=function(){if(this.oClose){this.oClose.onclick=null;}this.$ext.onmousedown=null;apf.popup.removeContent(this.$uniqueId);};}).call(apf.errorbox.prototype=new apf.Presentation());apf.aml.setElement("errorbox",apf.errorbox);apf.services=function(i,d){this.$init(d||"services",apf.NODE_VISIBLE,i);this.addEventListener("DOMNodeInsertedIntoDocument",function(a){var c=this.parentNode;if(c.register){c.register(this);}});};apf.services.prototype=new apf.AmlElement();apf.aml.setElement("services",apf.services);apf.validation=function(i,d){this.$init(d||"validation",apf.NODE_HIDDEN,i);};(function(){this.$rules=[];var c={};this.register=function(a){if(a.tagName!="model"){return;}c[a.$uniqueId]=a;a.$validation=this;};this.unregister=function(){c[amlNode.$uniqueId]=null;delete c[amlNode.$uniqueId];amlNode.$validation=null;};this.getRule=function(i){var a=apf.xmldb.nodeConnect(apf.xmldb.getXmlDocId(i),i.nodeType==1?i:i.parentNode);for(var l=0,n=this.$rules.length;l<n;l++){if(i.ownerDocument.selectSingleNode("(.//"+this.$rules[l][0].split("|").join("|.//")+")[@"+apf.xmldb.xmlIdTag+"='"+a+"']")){return this.$rules[l][1];}}};this.validate=function(m,l,n){var a=this.getRule(m);if(!a){return n;}return(a.isValid||(a.isValid=apf.validator.compile(a)))(apf.queryValue(m),l,n);};this.addEventListener("DOMNodeInsertedIntoDocument",function(a){var A=this.$aml;var B,C,w,z=A.childNodes;for(var i=0,l=z.length;i<l;i++){if((w=z[i]).nodeType!=1){continue;}this.$rules.push([w.getAttribute("match"),(B={})]);C=w.attributes;for(var j=0;j<C.length;j++){B[C[j].nodeName]=C[j].nodeValue;}B.node=w;}this.register(this.parentNode);});}).call(apf.validation.prototype=new apf.AmlElement());apf.aml.setElement("validation",apf.validation);apf.splitter=function(i,d){this.$init(d||"splitter",apf.NODE_VISIBLE,i);apf.plane.init();};(function(){this.$focussable=true;this.update=function(){var O=(this.type=="vertical")?{fsize:"fwidth",size:"width",offsetPos:"offsetLeft",offsetSize:"offsetWidth",pos:"left"}:{fsize:"fheight",size:"height",offsetPos:"offsetTop",offsetSize:"offsetHeight",pos:"top"};this.$ext.offsetTop;this.$amlNode=this.refNode;var Y=this.refHtml;var W=apf.layout.vars;var M=this.oItem;var Q=false;var R=Y?Y[O.offsetPos]:W[O.pos+"_"+M.id];var Z=Y?Y[O.offsetSize]:W[O.size+"_"+M.id];var ab=M.parent.children;for(var X=0,V=0;V<ab.length;V++){if(!ab[V][O.fsize]){X++;}}if(!M[O.fsize]&&X>1){for(var ac=0,ad=0,V=M.stackId+1;V<ab.length;V++){if(!ab[V][O.fsize]){ac+=ab[V].weight||1;ad+=(ab[V].node?ab[V].oHtml[O.offsetSize]:W[O.size+"_"+ab[V].id]);}}var U=this.$ext[O.offsetPos]-R-Z;var T=(ad-U)/ac;for(var V=0;V<M.stackId;V++){if(!ab[V][O.fsize]){ab[V].original.weight=(ab[V].node?ab[V].oHtml[O.offsetSize]:W[O.size+"_"+ab[V].id])/T;}}M.original.weight=(Z+U)/T;Q=true;}else{var P=M[O.fsize]?M[O.fsize].match(/^\d+$/):false;var J=M[O.fsize]?M[O.fsize].match(/^([\d\.]+)\%$/):false;if(P||J||!M[O.fsize]){var U=this.$ext[O.offsetPos]-R-Z;var z=this.$ext[O.offsetPos]-R;for(var i=0,N=0,V=M.stackId+1;V<ab.length;V++){if(!ab[V][O.fsize]){i+=ab[V].weight||1;N+=(ab[V].node?ab[V].oHtml[O.offsetSize]:W[O.size+"_"+ab[V].id]);}}if(i>0){var aa=((N-U)/i)/(N/i);for(var V=M.stackId+1;V<ab.length;V++){ab[V].original.weight=aa*(ab[V].weight||1);}}else{for(var V=M.stackId+1;V<ab.length;V++){if(ab[V][O.fsize].match(/^\d+$/)){var K=(ab[V].node?ab[V].oHtml[O.offsetSize]:W[O.size+"_"+ab[V].id])-U;ab[V].original[O.fsize]=""+Math.max(0,K,ab[V].minheight||0);if(ab[V][O.fsize]-K!=0){U=ab[V][O.fsize]-K;}else{break;}}else{if(ab[V][O.fsize].match(/^([\d\.]+)\%$/)){var K=(ab[V].node?ab[V].oHtml[O.offsetSize]:W[O.size+"_"+ab[V].id])-U;ab[V].original[O.fsize]=Math.max(0,((parseFloat(RegExp.$1)/(ab[V].node?ab[V].oHtml[O.offsetSize]:W[O.size+"_"+ab[V].id]))*K))+"%";break;}}}}if(M.original[O.fsize]){M.original[O.fsize]=J?((parseFloat(J[1])/Z)*z)+"%":""+z;}Q=true;}}if(Q){apf.layout.compile(this.$ext.parentNode);apf.layout.activateRules(this.$ext.parentNode);if(apf.hasSingleRszEvent){apf.layout.forceResize();}return;}apf.layout.forceResize(this.$ext.parentNode);};this.init=function(i,O,d){this.min=0;this.max=1000000;this.size=parseInt(i)||3;this.refNode=null;this.refHtml=null;var W;if(O){if(typeof O!="object"){O=apf.lookup(O);}this.refNode=O;this.refHtml=this.refNode.$ext;W=this.refHtml.parentNode;d=O.aData.calcData;}else{W=d.pHtml;}this.oItem=d;if(W&&W!=this.$ext.parentNode){W.appendChild(this.$ext);}var F=apf.getDiff(this.$ext);this.$verdiff=F[0];this.$hordiff=F[1];this.$sizeArr=[];this.type=d.parent.vbox?"horizontal":"vertical";var K=apf.layout.get(this.$ext.parentNode).layout;var G="splitter"+this.$uniqueId;K.addRule("var "+G+" = apf.lookup("+this.$uniqueId+").$ext");var X=[G+".style.left = "];var U=[G+".style.top = "];var T=[G+".style.width = -"+this.$hordiff+" + "];var I=[G+".style.height = -"+this.$verdiff+" + "];var J=d.parent.children[d.stackId+1];if(this.type=="horizontal"){T.push("Math.max(");if(d.node){X.push(d.id+".offsetLeft");U.push(d.id+".offsetTop + "+d.id+".offsetHeight");T.push(d.id+".offsetWidth");}else{X.push("v.left_"+d.id);U.push("v.top_"+d.id+" + v.height_"+d.id);T.push("v.width_"+d.id);}T.push(",",J?(J.node?J.id+".offsetWidth":"v.width_"+J.id):0,")");K.addRule(T.join(""));this.$ext.style.height=(d.splitter-this.$hordiff)+"px";}else{I.push("Math.max(");if(d.node){X.push(d.id+".offsetLeft + "+d.id+".offsetWidth");U.push(d.id+".offsetTop");I.push(d.id+".offsetHeight");}else{X.push("v.left_"+d.id+" + v.width_"+d.id);U.push("v.top_"+d.id);I.push("v.height_"+d.id);}I.push(",",J?(J.node?J.id+".offsetHeight":"v.height_"+J.id):0,")");K.addRule(I.join(""));this.$ext.style.width=(d.splitter-this.$hordiff)+"px";}K.addRule(X.join(""));K.addRule(U.join(""));var R=d.parent.children;if(this.type=="vertical"){K.addRule(G+".host.min = "+(d.node?"document.getElementById('"+d.id+"').offsetLeft":"v.left_"+d.id)+" + "+parseInt(d.minwidth||d.childminwidth||10));var P=[],V=[];for(var Q=false,N=d.stackId+1;N<R.length;N++){if(!R[N].fwidth){Q=true;}}for(var M,N=d.stackId+1;N<R.length;N++){M=R[N];if(M.minwidth||M.childminheight){P.push(parseInt(M.minwidth||M.childminheight));}else{if(M.fwidth){if(!Q&&N==d.stackId+1){P.push(10);}else{if(M.fwidth.indexOf("%")!=-1){P.push("("+M.parent.innerspace+") * "+(parseFloat(M.fwidth)/100));}else{P.push(M.fwidth);}}}else{P.push(10);}}P.push(M.edgeMargin);}K.addRule(G+".host.max = v.left_"+d.parent.id+" + v.width_"+d.parent.id+" - ("+(P.join("+")||0)+")");}else{K.addRule(G+".host.min = "+(d.node?"document.getElementById('"+d.id+"').offsetTop":"v.top_"+d.id)+" + "+parseInt(d.minheight||d.childminheight||10));var P=[],V=[];for(var Q=false,N=d.stackId+1;N<R.length;N++){if(!R[N].fheight){Q=true;}}if(!Q&&J&&J.state>0){return this.$ext.parentNode.removeChild(this.$ext);}for(var M,N=d.stackId+1;N<R.length;N++){M=R[N];if(M.minheight||M.childminheight){P.push(parseInt(M.minheight||M.childminheight));}else{if(M.fheight){if(!Q&&N==d.stackId+1){P.push(10);}else{if(M.fheight.indexOf("%")!=-1){P.push("("+M.parent.innerspace+") * "+(parseFloat(M.fheight)/100));}else{P.push(M.fheight);}}}else{P.push(10);}}if(M.edgeMargin){P.push(M.edgeMargin);}}K.addRule(G+".host.max = v.top_"+d.parent.id+" + v.height_"+d.parent.id+" - ("+(P.join("+")||0)+")");}this.$setStyleClass(this.$ext,this.type,[this.type=="horizontal"?"vertical":"horizontal"]);if(this.type=="vertical"){this.$setStyleClass(this.$ext,"w-resize",["n-resize"]);}else{this.$setStyleClass(this.$ext,"n-resize",["w-resize"]);}return this;};this.$draw=function(){this.$ext=this.$getExternal();var c=this;this.$ext.onmousedown=function(j){if(!j){j=event;}var l=c;var a=apf.getAbsolutePosition(this);if(l.type=="vertical"){l.tx=j.clientX-a[0];}else{l.ty=j.clientY-a[1];}l.startPos=l.type=="vertical"?this.offsetLeft:this.offsetTop;j.returnValue=false;j.cancelBubble=true;apf.plane.show(this);l.$setStyleClass(this,"moving");l.$setStyleClass(document.body,l.type=="vertical"?"w-resize":"n-resize",[l.type=="vertical"?"n-resize":"w-resize"]);document.onmouseup=function(){l.$setStyleClass(l.$ext,"",["moving"]);apf.plane.hide();l.update();l.$setStyleClass(document.body,"",["n-resize","w-resize"]);document.onmouseup=document.onmousemove=null;};document.onmousemove=function(i){if(!i){i=event;}if(l.type=="vertical"){if(i.clientX>=0){var d=apf.getAbsolutePosition(l.$ext.offsetParent);l.$ext.style.left=(Math.min(l.max,Math.max(l.min,(i.clientX-d[0])-l.tx)))+"px";}}else{if(i.clientY>=0){var d=apf.getAbsolutePosition(l.$ext.offsetParent);l.$ext.style.top=(Math.min(l.max,Math.max(l.min,(i.clientY-d[1])-l.ty)))+"px";}}i.returnValue=false;i.cancelBubble=true;};};};this.$loadAml=function(q){if(this.left||this.top){var m=this.left||this.top;var n=this.right||this.bottom;m=m.split(/\s*,\s*/);n=n.split(/\s*,\s*/);for(var o=0;o<m.length;o++){m[o]=m[o];}for(var o=0;o<n.length;o++){n[o]=n[o];}var i=this;$setTimeout(function(){this.$amlNode.init(i.type,i.size,i.min,i.max,i.change,m,n);});}};}).call(apf.splitter.prototype=new apf.Presentation());apf.aml.setElement("splitter",apf.splitter);apf.pager=function(i,d){this.$init(d||"pager",apf.NODE_VISIBLE,i);};(function(){this.previous="Previous";this.next="Next";this.range=5;this.curpage=1;this.totalpages=0;this.autohide=false;this.oEmpty=null;this.$attrExcludePropBind=apf.extend({pageload:1},this.$attrExcludePropBind);this.$supportedProperties.push("range","curpage","totalpages","previous","next","autohide","pageload");this.$booleanProperties.autohide=true;this.$propHandlers.curpage=function(c){this.gotoPage(c);};this.gotoPage=function(m,n){var o=this.curpage;this.curpage=m||this.curpage+n;if(o!=this.curpage){this.setProperty("curpage",this.curpage);}if(this.curpage<1){this.curpage=1;}else{if(this.totalpages&&this.curpage>this.totalpages){this.curpage=this.totalpages;}}if(this.dispatchEvent("beforepagechange",{page:this.curpage})===false){return false;}var q=this.getModel(true),l=this;if(q){q.$loadFrom(this.pageload,{xmlNode:this.xmlRoot,page:this.curpage,callback:function(){l.dispatchEvent("afterpagechange",{page:l.curpage});}});}else{$setTimeout(function(){var a=l.getModel(true);if(a){a.$loadFrom(l.pageload,{xmlNode:l.xmlRoot,page:l.curpage,callback:function(){l.dispatchEvent("afterpagechange",{page:l.curpage});}});}l.removeEventListener("afterload",arguments.callee);});}};this.addEventListener("$clear",function(c){return false;});this.$setClearMessage=function(i,d){if(!this.$empty){this.$empty=this.$int.ownerDocument.createElement("span");this.$setStyleClass(this.$empty,"loader");}if(d=="loading"){this.$setStyleClass(this.$ext,this.$baseCSSname+"Loading");this.$int.appendChild(this.$empty);}};this.$removeClearMessage=function(){if(this.$empty&&this.$empty.parentNode){this.$empty.parentNode.removeChild(this.$empty);this.$setStyleClass(this.$ext,"",[this.$baseCSSname+"Loading"]);}};this.$draw=function(){this.$ext=this.$getExternal("main");this.$int=this.$getLayoutNode("main","container",this.$ext);};this.$load=function(z){this.setProperty("curpage",parseInt(this.$applyBindRule("current",z)));this.setProperty("totalpages",parseInt(this.$applyBindRule("total",z)));var w=this.curpage,s=this.totalpages,C=[],A;this.$int.innerHTML="";if(!s){return;}if(w!=1||!this.autohide){this.$getNewContext("button");A=this.$getLayoutNode("button");this.$getLayoutNode("button","caption").nodeValue=this.previous;this.$setStyleClass(A,"previous");if(w!=1){A.setAttribute("onclick","apf.lookup("+this.$uniqueId+").gotoPage(null, -1)");}else{this.$setStyleClass(A,"disabled");}C.push(A);}var i=Math.floor(this.range/2),B=Math.max(1,w-i),u=Math.min(s+1,B+this.range),t;if(u-B<this.range&&B!=1){B=Math.max(u-this.range,1);}for(t=B;t<u;t++){this.$getNewContext("button");A=this.$getLayoutNode("button");this.$getLayoutNode("button","caption").nodeValue=t;A.setAttribute("onclick","apf.lookup("+this.$uniqueId+").gotoPage("+t+")");C.push(A);if(t==w){this.$setStyleClass(A,"current");}}if(w!=s||!this.autohide){this.$getNewContext("button");A=this.$getLayoutNode("button");this.$getLayoutNode("button","caption").nodeValue=this.next;this.$setStyleClass(A,"next");if(w!=s){A.setAttribute("onclick","apf.lookup("+this.$uniqueId+").gotoPage(null, 1)");}else{this.$setStyleClass(A,"disabled");}C.push(A);}apf.insertHtmlNodes(C,this.$int);if(this.$empty){this.$int.appendChild(this.$empty);}};}).call(apf.pager.prototype=new apf.StandardBinding());apf.aml.setElement("pager",apf.pager);apf.aml.setElement("total",apf.BindingRule);apf.aml.setElement("current",apf.BindingRule);apf.calendar=function(i,d){this.$init(d||"calendar",apf.NODE_VISIBLE,i);this.$calVars={days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],months:[{name:"January",number:31},{name:"February",number:28},{name:"March",number:31},{name:"April",number:30},{name:"May",number:31},{name:"June",number:30},{name:"July",number:31},{name:"August",number:31},{name:"September",number:30},{name:"October",number:31},{name:"November",number:30},{name:"December",number:31}],day:null,month:null,year:null,hours:1,minutes:0,seconds:0,currentMonth:null,currentYear:null,numberOfDays:null,dayNumber:null,temp:null,inited:false,startDiffs:[],prevWidth:0,rRows:[],rCells:[[],[],[],[],[],[]],rDoW:[]};};(function(){this.implement(apf.DataAction);this.$supportedProperties.push("output-format","default");this.$propHandlers["output-format"]=function(j){if(this.value){var a=this.$calVars;this.setProperty("value",new Date(a.year,a.month,a.day,a.hours,a.minutes,a.seconds).format(this.outputFormat=j));}else{this.outputFormat=j;}};this.$propHandlers.value=function(l){var a=this.$calVars;if(!this.outputFormat){a.temp=l;return;}var m=Date.parse(l,this.outputFormat);a.day=m.getDate();a.month=m.getMonth();a.year=m.getFullYear();a.hours=m.getHours();a.minutes=m.getMinutes();a.seconds=m.getSeconds();this.value=l;this.redraw(a.month,a.year);};this.setValue=function(a){this.setProperty("value",a,false,true);};this.getValue=function(){return this.value;};this.addEventListener("keydown",function(o){o=o||event;var q=o.keyCode,n=o.ctrlKey,s=o.shiftKey,a=this.$calVars;switch(q){case 13:this.selectDay(a.day);break;case 33:this.nextMonth();break;case 34:this.prevMonth();break;case 37:if(n){this.prevMonth();}else{if(s){this.prevYear();}else{if(a.day-1<1){this.prevMonth();this.selectDay(a.months[a.currentMonth].number);}else{this.selectDay(a.day-1);}}}break;case 38:if(a.day-7<1){this.prevMonth();this.selectDay(a.months[a.currentMonth].number+a.day-7);}else{this.selectDay(a.day-7);}break;case 39:if(n){this.nextMonth();}else{if(s){this.nextYear();}else{this.selectDay(a.day+1);}}break;case 40:this.selectDay(a.day+7);break;case 84:if(n){this.today();}return false;break;}},true);this.$blur=function(){this.$setStyleClass(this.$ext,"",[this.$baseCSSname+"Focus"]);};this.$focus=function(){this.$setStyleClass(this.oFocus||this.$ext,this.$baseCSSname+"Focus");};var c=function(a){return((a%4==0)&&(a%100!==0))||(a%400==0)?true:false;};this.$getMargin=function(a){if(apf.isIE){return[(parseInt(apf.getStyle(a,"marginLeft"))||0)+(parseInt(apf.getStyle(a,"marginLeft"))||0),(parseInt(apf.getStyle(a,"marginTop"))||0)+(parseInt(apf.getSty