/*
    Copyright © 2005-2008 Apple Inc. All Rights Reserved.

    NWMatcher Copyright (c) 2007-2008 Diego Perini <http://www.iport.it>
    All rights reserved.
*/

if("undefined"!==typeof (coherent)){throw new Error("Library module (coherent) already defined")}var coherent={version:"1.2.0",revision:"",generateUid:(function(){var A=0;return function(){return ++A}})()};coherent.Browser={IE:!!(window.attachEvent&&!window.opera)&&(function(){var B=/MSIE (\d+)/;var A=B.exec(navigator.userAgent);return A&&parseInt(A[1],10)})(),Safari:navigator.userAgent.indexOf("AppleWebKit/")>-1,Safari2:(function(){var A=/AppleWebKit\/(\d+(?:\.\d+)?)/;var B=A.exec(navigator.userAgent);return(B&&parseInt(B[1],10)<420)})(),Mozilla:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1,MobileSafari:!!navigator.userAgent.match(/Apple.*Mobile.*Safari/),Chrome:navigator.userAgent.indexOf("Chrome")>-1};coherent.OS={Mac:navigator.userAgent.indexOf("Mac OS X")>-1&&navigator.userAgent.indexOf("Mobile")==-1,Windows:navigator.userAgent.indexOf("Windows")>-1,Linux:navigator.userAgent.indexOf("Linux")>-1,iPhone:navigator.userAgent.indexOf("iPhone")>-1};coherent.Support={Properties:("__defineGetter__" in Object.prototype),QuerySelector:("querySelector" in document),Touches:!!document.createTouch,CSS3ColorModel:false,CSSTransitions:false};if(coherent.Support.Properties){coherent.Support.__defineGetter__("CSS3ColorModel",function(){delete this.CSS3ColorModel;var B=document.createElement("span");try{B.style.backgroundColor="rgba(100,100,100,0.5)";return this.CSS3ColorModel=(B.style.length===1)}catch(A){}return(this.CSS3ColorModel=false)});coherent.Support.__defineGetter__("CSSTransitions",function(){delete this.CSSTransitions;var B=document.createElement("span");try{B.style.setProperty("-webkit-transition-duration","1ms","");B.style.setProperty("-o-transition-duration","1ms","");B.style.setProperty("-moz-transition-duration","1ms","");return this.CSSTransitions=(B.style.length>0)}catch(A){}return(this.CSSTransitions=false)})}coherent.typeOf=function(B){if(null===B){return"null"}var A=typeof (B);if("object"!==A&&"function"!==A){return A}return Object.prototype.toString.call(B).slice(8,-1).toLowerCase()};coherent.compareValues=function(F,D){var C=coherent.typeOf(F);if(C!==coherent.typeOf(D)){var A=String(F);var E=String(D);return A.localeCompare(E)}switch(C){case"null":return 0;case"boolean":case"number":var B=(F-D);if(0===B){return B}return(B<0?-1:1);case"regexp":case"function":break;case"string":case"array":case"object":if(F.localeCompare){return F.localeCompare(D)}if(F.compare){return F.compare(D)}break;case"undefined":return true;default:throw new TypeError("Unknown type for comparison: "+C)}return String(F).localeCompare(String(D))};coherent.defineError=function(B){function A(C){this.message=C;this.name=B}A.prototype=new Error;A.prototype.constructor=A;A.prototype.name=B;return A};var InvalidArgumentError=coherent.defineError("InvalidArgumentError");if("undefined"==typeof (window.console)){window.console={}}if("undefined"==typeof (window.console.log)){window.console.log=function(){}}String.prototype.titleCase=function(){return this.charAt(0).toUpperCase()+this.substr(1)};String.prototype.trim=function(){var B=this.replace(/^\s+/,"");for(var A=B.length-1;A>0;--A){if(/\S/.test(B.charAt(A))){B=B.substring(0,A+1);break}}return B};String.prototype.beginsWith=function(A){return A===this.substring(0,A.length)};if(!String.prototype.localeCompare){String.prototype.localeCompare=function(A){if(this<A){return -1}else{if(this>A){return 1}else{return 0}}}}String.prototype.expand=function(C,A){function B(F,D){var E=C[D];if(null===E||"undefined"===typeof (E)){return A}return E}return this.replace(/\$\{(\w+)\}/g,B)};String.prototype.times=function(B){if(isNaN(B)||B<=0){return""}var A=this;while(--B){A+=this}return A};String.prototype.truncate=function truncate(){var C=arguments[0],B=coherent.typeOf(C)==="number",I=B?{}:(C||{}),E=this.toString(),D=Math,A=B?C:(I.length||30),H,G=I.omission||"\u2026",F=I.from||"start";if(this.length>A){switch(F){case"start":case"beginning":E=this.slice(0,A).stripPunctuationAtEnd().trim()+G;break;case"middle":H=D.floor(A/2);E=[this.slice(0,H).stripPunctuationAtEnd().trim(),G,this.slice(-H).stripPunctuationAtStart().trim()].join(" ");break;case"end":case"ending":E=G+this.slice(-A).stripPunctuationAtStart().trim();break;default:break}}return E};String.prototype.escapeForInnerHTML=function(){var A=document.createElement("div");A.innerHTML="&";if(A.innerHTML===""){String.prototype.escapeForInnerHTML=function(){return this.replace(/&((\w){0,10})$/g,"&amp;$1")}}else{String.prototype.escapeForInnerHTML=function(){return this.valueOf()}}return this.escapeForInnerHTML()};String.stringify=function(A){return typeof A==="string"?A:String(A)};(function(){var C=String.prototype,H="\\s!¡\\?¿‽\\.\\,…:;_\\-–—~­·•‘’“”‚„‛‟′`″'\"#\\$&\\*@§¶\\^\\|\\/",D="",F="[",G="]",A="+",L=new RegExp([F,H,G,A,"$"].join(D)),J=new RegExp(["^",F,H,G,A].join(D)),B=/<[^>]*>/g,I=function I(){return this.replace(L,D)},K=function K(){return this.replace(J,D)},E=function E(){return this.replace(B,D)};C.stripPunctuationAtEnd=I;C.stripPunctuationAtStart=K;C.stripTags=E})();if("undefined"!==typeof (window.Prototype)){(function(){var A=["indexOf","lastIndexOf","forEach","filter","map","some","every","reduce","reduceRight"];for(var B=0;B<A.length;++B){delete Array.prototype[A[B]]}})()}Array.prototype.distinct=function(){var B=this.length;var A=new Array(B);var C;var E;var D=0;for(C=0;C<B;++C){E=this[C];if(-1==A.indexOf(E)){A[D++]=E}}A.length=D;return A};Array.prototype.compare=function(B){var D=this.length-B.length;if(0!==D){return D}var E;var A;var C;for(E=0,A=this.length;E<A;++E){C=coherent.compareValues(this[E],B[E]);if(0!==C){return C}}return 0};Array.from=function(A,B){return Array.prototype.slice.call(A,B||0)};if(!Array.prototype.reduce){Array.prototype.reduce=function(B){var A=this.length;if(typeof B!="function"){throw new TypeError()}if(0===A&&1===arguments.length){throw new TypeError()}var C=0;if(arguments.length>=2){var D=arguments[1]}else{do{if(C in this){D=this[C++];break}if(++C>=A){throw new TypeError()}}while(true)}for(;C<A;C++){if(C in this){D=B.call(null,D,this[C],C,this)}}return D}}if(!Array.prototype.reduceRight){Array.prototype.reduceRight=function(B){var A=this.length;if(typeof B!="function"){throw new TypeError()}if(0===A&&1===arguments.length){throw new TypeError()}var C=A-1;if(arguments.length>=2){var D=arguments[1]}else{do{if(C in this){D=this[C--];break}if(--C<0){throw new TypeError()}}while(true)}for(;C>=0;C--){if(C in this){D=B.call(null,D,this[C],C,this)}}return D}}if(!Array.indexOf){Array.indexOf=function(C,B,A){return Array.prototype.indexOf.call(C,B,A)}}if(!Array.lastIndexOf){Array.lastIndexOf=function(C,B,A){return Array.prototype.lastIndexOf.call(C,B,A)}}if(!Array.forEach){Array.forEach=function(C,A,B){return Array.prototype.forEach.call(C,A,B)}}if(!Array.filter){Array.filter=function(C,A,B){return Array.prototype.filter.call(C,A,B)}}if(!Array.map){Array.map=function(C,A,B){return Array.prototype.map.call(C,A,B)}}if(!Array.some){Array.some=function(C,A,B){return Array.prototype.some.call(C,A,B)}}if(!Array.every){Array.every=function(C,A,B){return Array.prototype.every.call(C,A,B)}}if(!Array.reduce){Array.reduce=function(B,A){if(arguments.length>2){return Array.prototype.reduce.call(B,A,arguments[2])}else{return Array.prototype.reduce.call(B,A)}}}if(!Array.reduceRight){Array.reduceRight=function(B,A){if(arguments.length>2){return Array.prototype.reduceRight.call(B,A,arguments[2])}else{return Array.prototype.reduceRight.call(B,A)}}}Array.from=function(D,E){var B=D.length;var A=[];for(var C=(E||0);C<B;++C){A.push(D[C])}return A};if(!Array.prototype.indexOf){Array.prototype.indexOf=function(C,B){if("undefined"===typeof (B)){B=0}else{if(B<0){B=Math.max(0,this.length+B)}}for(var A=B;A<this.length;A++){if(this[A]===C){return A}}return -1}}if(!Array.prototype.lastIndexOf){Array.prototype.lastIndexOf=function(C,B){if("undefined"===typeof (B)){B=this.length-1}else{if(B<0){B=Math.max(0,this.length+B)}}for(var A=B;A>=0;A--){if(this[A]===C){return A}}return -1}}if(!Array.prototype.forEach){Array.prototype.forEach=function(C,D){var A=this.length;for(var B=0;B<A;B++){C.call(D,this[B],B,this)}}}if(!Array.prototype.filter){Array.prototype.filter=function(D,E){var A=this.length;var C=[];for(var B=0;B<A;B++){if(D.call(E,this[B],B,this)){C.push(this[B])}}return C}}if(!Array.prototype.map){Array.prototype.map=function(D,E){var A=this.length;var C=[];for(var B=0;B<A;B++){C.push(D.call(E,this[B],B,this))}return C}}if(!Array.prototype.some){Array.prototype.some=function(C,D){var A=this.length;for(var B=0;B<A;B++){if(C.call(D,this[B],B,this)){return true}}return false}}if(!Array.prototype.every){Array.prototype.every=function(C,D){var A=this.length;for(var B=0;B<A;B++){if(!C.call(D,this[B],B,this)){return false}}return true}}if(!Function.prototype.bind){Function.prototype.bind=function(C){var A=this;if(!arguments.length){return A}if(1==arguments.length){return function(){return A.apply(C,arguments)}}var B=Array.from(arguments,1);return function(){return A.apply(C,B.concat(Array.from(arguments)))}}}if(!Function.prototype.bindAsEventListener){Function.prototype.bindAsEventListener=function(C){var A=this;if(1==arguments.length){return function(D){return A.call(C,D||window.event)}}var B=Array.from(arguments);B.shift();return function(D){return A.apply(C,[D||window.event].concat(B))}}}if(!Function.prototype.delay){Function.prototype.delay=function(D){var B=this;D=D||10;if(arguments.length<2){function A(){B()}return window.setTimeout(A,D)}var C=Array.from(arguments,1);function E(){B.apply(B,C)}return window.setTimeout(E,D)}}if(!Function.prototype.bindAndDelay){Function.prototype.bindAndDelay=function(F,D){var B=this;F=F||B;D=D||10;if(arguments.length<3){function A(){B.call(F)}return window.setTimeout(A,D)}var C=Array.from(arguments,2);function E(){B.apply(F,C)}return window.setTimeout(E,D)}}if(!Function.prototype.bindAndRepeat){Function.prototype.bindAndRepeat=function(F,C){var B=this;F=F||B;C=C||10;if(arguments.length<3){function A(){B.call(F)}return window.setInterval(A,C)}var D=Array.from(arguments,2);function E(){B.apply(F,D)}return window.setInterval(E,C)}}Function.prototype.sync=function(){var B=arguments.length?this.bind.apply(this,arguments):this;var A={};var C=false;B.stop=function(){C=true};B.waitFor=function(D){A[D]=true;return function(){A[D]=false;for(var E in A){if(A[E]){return }}if(C){return }B()}};return B};function Set(){var D=this;if(D.constructor!==Set){D=new Set()}var B=arguments;if(1==B.length&&B[0] instanceof Array){B=B[0]}var C;var A=B.length;for(C=0;C<A;++C){D[B[C]]=true}return D}Set.union=function(C,B){var A=Object.clone(C);if(!B){return A}var D;for(D in B){A[D]=true}return A};Set.intersect=function(C,B){var A=new Set();var D;for(D in C){if(D in B){A[D]=true}}return A};Set.add=function(B,A){B[A]=true;return B};Set.remove=function(B,A){delete B[A];return B};Set.toArray=function(C){var B;var A=[];for(B in C){A.push(B)}return A};Set.forEach=function(E,C,B){var D;var A=0;for(D in E){C.call(B,D,A++)}};Set.join=function(D,B){var C;var A=[];for(C in D){A.push(C)}return A.join(B||"")};var $S=Set;Object.clone=function(B){var A=(function(){});A.prototype=B;return new A()};Object.applyDefaults=function(C,B){C=C||{};if(!B){return C}for(var A in B){if(A in C){continue}C[A]=B[A]}return C};Object.extend=function(C,A){C=C||{};for(var B in A){C[B]=A[B]}return C};Object.merge=function(C,A){var B={};var D;for(D in C){B[D]=C[D]}for(D in A){if(D in B){continue}B[D]=A[D]}return B};(function(){var B=Set("file","submit","image","reset","button");var D={};function E(I,H,J){var G=I[H];var F=coherent.typeOf(G);if("string"===F){I[H]=[G,J]}else{if("array"===F){G.push(J)}else{I[H]=J}}}function C(H){var F=H.name;var G=(H.type||"").toLowerCase();if(H.disabled||G in B){return }if("radio"===G||"checkbox"===G){if(H.checked){E(this,F,H.value)}}else{if(H.multiple){function I(J){if(J.selected){E(this,F,J.value)}}this[F]=[];Array.forEach(H.options,I,this)}else{E(this,F,H.value);if("image"===G){E(this,F+".x",0);E(this,F+".y",0)}}}}Object.fromForm=function(G){var F={};Array.forEach(G.elements,C,F);return F};function A(H){H=H.split("=");if(1===H.length){return }var F=decodeURIComponent(H[0].trim());var G=decodeURIComponent(H[1].trim())||null;E(this,F,G)}Object.fromQueryString=function(G){if("?"==G.charAt(0)){G=G.slice(1)}G=G.split(/\s*&\s*/);var F={};G.forEach(A,F);return F};Object.toQueryString=function(K){if(!K){return""}var H;var J;var F;var G=[];function I(L){if(null!==L&&"undefined"!==typeof (L)){L=encodeURIComponent(L)}G.push(H+"="+L)}for(H in K){J=K[H];F=coherent.typeOf(J);if("null"===F){J=""}if("function"===F||J===D[H]){continue}H=encodeURIComponent(H);if("array"===F){J.forEach(I)}else{I(J)}}return G.join("&")}})();RegExp.escape=function(A){return A.replace(RegExp._escapeRegex,"\\$1")};RegExp.specialCharacters=["/",".","*","+","?","|","(",")","[","]","{","}","\\"];RegExp._escapeRegex=new RegExp("(\\"+RegExp.specialCharacters.join("|\\")+")","g");var Class=(function(){function D(I,L){var J;if(!I&&!L){return I}if(!I){J=function(){return L.apply(this,arguments)}}else{var K=/this\.base/.test(I);if(!K&&!L){return I}if(!K){J=function(){L.call(this);return I.apply(this,arguments)}}else{J=function(){var N=this.base;this.base=L||function(){};var M=I.apply(this,arguments);this.base=N;return M}}}J.valueOf=function(){return I};J.toString=function(){return String(I)};return J}function G(I,J){var K=I.prototype.__factory__.apply(I,J);if("function"!==typeof (K)){throw new Error("Factory function doesn't return a function")}K.__factoryFn__=true;return K}function F(K){if(K.__createFactoryObjects){K.__createFactoryObjects();return }var J;var I;for(J in K.__factories__){I=K[J];if(!I.__factoryFn__){continue}K[J]=I.call(K)}}function C(I,K){if(I&&!(I instanceof Function)){throw new Error("Invalid constructor")}if(K&&!(K instanceof Function)){throw new Error("Invalid superclass")}K=K?K.valueOf():null;I=D(I,K);var J;if(I){J=function(){if(!(this instanceof J)){return G(J,arguments)}this.__uid=this.__uid||coherent.generateUid();var L=I.apply(this,arguments);F(this);if(this.__postConstruct instanceof Function){this.__postConstruct()}return L||this}}else{J=function(){if(!(this instanceof J)){return G(J,arguments)}this.__uid=this.__uid||coherent.generateUid();F(this);if(this.__postConstruct instanceof Function){this.__postConstruct()}return this}}J.valueOf=function(){return I};J.toString=function(){return String(I||J)};return J}function B(J){function I(){}I.prototype=J.prototype;return new I()}function E(K,I){if(!K||!/this\.base/.test(K)){return K}function J(){var M=this.base;this.base=I||function(){};var L=K.apply(this,arguments);this.base=M;return L}J.valueOf=function(){return K};J.toString=function(){return String(K)};return J}function H(K,I,L){if(L instanceof Function){var J=K[I];var M=L.valueOf();if(J instanceof Function&&J.valueOf()!==M){L=E(L,J)}if(M.__factoryFn__){K.__factories__[I]=L}}K[I]=L;return L}function A(J){var I;for(I=J.superclass;I;I=I.superclass){if("__subclassCreated__" in I){I.__subclassCreated__(J)}}}return{create:function(L,J){var I;var K={};switch(arguments.length){case 0:throw new TypeError("Missing superclass and declaration arguments");case 1:J=L;L=undefined;break;default:K=B(L);break}if("function"==typeof (J)){J=J();if(!J){throw new Error("Class declaration function did not return a prototype")}}if(J.hasOwnProperty("constructor")){I=J.constructor;delete J.constructor}I=C(I,L);I.prototype=K;I.prototype.constructor=I;I.superclass=L;if(L){K.__factories__=Object.clone(L.prototype.__factories__)}else{K.__factories__={}}this.extend(I,J);A(I);return I},findPropertyName:function(L,I){var J;for(var K in L){J=L[K];if(J===I||("function"===typeof (J)&&J.valueOf()===I)){return K}}return null},extend:(function(){if(coherent.Support.Properties){return function(I,J){var N=I.prototype;var K;for(var O in J){var M=J.__lookupGetter__(O);var L=J.__lookupSetter__(O);if(M||L){M&&N.__defineGetter__(O,M);L&&N.__defineSetter__(O,L)}else{H(N,O,J[O])}}return I}}else{return function(I,J){var K=I.prototype;for(var L in J){H(K,L,J[L])}}}})()}})();coherent.strings={"marker.input.multipleValues":"Multiple Values","marker.input.placeholder":"","marker.input.noSelection":"No Selection","marker.image.multipleValues":"","marker.image.placeholder":"","marker.image.noSelection":"","marker.text.multipleValues":"Multiple Values","marker.text.placeholder":"","marker.text.noSelection":"No Selection","error.no_description":"An unspecified error occurred.","error.invalid_value":"This value is not valid.","error.invalid_number":"This value is not a valid number."};coherent.localisedString=function(A){return{valueOf:function(){if(A in coherent.strings){return coherent.strings[A]}return null},toString:function(){if(A in coherent.strings){return coherent.strings[A]}console.log("Localisation missing string for key: "+A);return A}}};var _=coherent.localisedString;coherent.Error=Class.create({constructor:function(A){Object.extend(this,A)},toString:function(){return this.description},description:_("error.no_description"),recoverySuggestion:null});coherent.KeyInfo=Class.create({constructor:function(D,B){var A=coherent.KVO.getPropertyMethodsForKeyOnObject(B,D);this.__uid=[B,coherent.generateUid()].join("_");this.reader=A.getter;this.mutator=A.mutator;this.validator=A.validator;this.key=B;this.mutable=((this.mutator||!this.reader)?true:false);if(!this.reader&&!this.mutator){this.mutable=true}this.changeCount=0;var C=A.value;if(!C){return }var E=coherent.typeOf(C);if(E in coherent.KVO.typesOfKeyValuesToIgnore||!C._addParentLink){return }C._addParentLink(D,this)},get:function(B){if(this.reader){return this.reader.call(B)}var A;if(this.key in B){A=B[this.key]}else{A=null}if(A&&A._addParentLink){A._addParentLink(B,this)}return A},set:function(B,A){if(this.mutator){this.mutator.call(B,A)}else{B.willChangeValueForKey(this.key,this);if("undefined"===typeof (A)){A=null}B[this.key]=A;B.didChangeValueForKey(this.key,this)}},validate:function(B,A){if(!this.validator){return A}return this.validator.call(B,A)},unlinkParentLink:function(){if(!this.parentLink){return }this.parentLink.observer=null;this.parentLink.callback=null;this.parentLink=null}});coherent.ChangeType={setting:0,insertion:1,deletion:2,replacement:3};coherent.ChangeNotification=Class.create({constructor:function(D,A,E,C,B){this.object=D;this.changeType=A;this.newValue=E;this.oldValue=C;this.indexes=B;this.objectKeyPath=[]},toString:function(){var A="[ChangeNotification changeType: ";switch(this.changeType){case coherent.ChangeType.setting:A+="setting";break;case coherent.ChangeType.insertion:A+="insertion";break;case coherent.ChangeType.deletion:A+="deletion";break;case coherent.ChangeType.replacement:A+="replacement";break;default:A+="<<unknown>>";break}A+=" newValue="+this.newValue+" oldValue="+this.oldValue+(this.indexes?" indexes="+this.indexes.join(", "):"")+"]";return A}});coherent.ObserverEntry=Class.create({constructor:function(A,C,B){this.observer=A;this.callback=C;this.context=B},observeChangeForKeyPath:function(A,B){if(!this.callback||!this.observer||-1!==A.objectKeyPath.indexOf(this.observer)){return }this.callback.call(this.observer,A,B,this.context)}});coherent.KVO=Class.create({constructor:function(){},__factory__:function(){var B=Array.from(arguments);var A=this;function C(){}return function(){C.prototype=A.prototype;var D=new C();A.prototype.constructor.apply(D,B);return D}},setValueForKeyPath:function(C,D){if(!D||0===D.length){throw new InvalidArgumentError("keyPath may not be empty")}if("string"==typeof (D)){if("$"==D.charAt(0)){this.setValueForVariableKeyPath(C,D);return }D=D.split(".")}var B=D[0];if(1==D.length){this.setValueForKey(C,B);return }if("@"==B.charAt(0)){return }var A=this.valueForKey(B);if(!A){return }A.setValueForKeyPath(C,D.slice(1))},setValueForVariableKeyPath:function(A,C){var B=coherent.VariableKeyPath.resolve(C,this);if("undefined"===typeof (B)){return }this.setValueForKeyPath(A,B)},setValueForKey:function(B,A){if(!A||0===A.length){throw new InvalidArgumentError("key may not be empty")}var C=this.infoForKey(A);if(!C||!C.mutable){return }C.set(this,B)},valueForKeyPath:function(E){if(!E||0===E.length){throw new InvalidArgumentError("keyPath may not be empty")}if("string"==typeof (E)){if("$"==E.charAt(0)){return this.valueForVariableKeypath(E)}E=E.split(".")}var D=E[0];if(1==E.length){return this.valueForKey(D)}if("@"==D.charAt(0)){var B=D.substr(1);var A=this.valueForKeyPath(E.slice(1));return coherent.ArrayOperator[B](A)}var C=this.valueForKey(D);if("undefined"===typeof (C)||null===C){return undefined}return C.valueForKeyPath(E.slice(1))},valueForVariableKeypath:function(B){var A=coherent.VariableKeyPath.resolve(B,this);if("undefined"===typeof (A)){return undefined}return this.valueForKeyPath(A)},valueForKey:function(A){if(!A||0===A.length){throw new InvalidArgumentError("the key is empty")}var B=this.infoForKey(A);if(!B){return null}return B.get(this)},validateValueForKeyPath:function(C,D){if(!D||0===D.length){throw new InvalidArgumentError("keyPath may not be empty")}if("string"==typeof (D)){if("$"==D.charAt(0)){return this.validateValueForVariableKeypath(C,D)}D=D.split(".")}var B=D[0];if(1==D.length){return this.validateValueForKey(C,B)}var A=this.valueForKey(B);if("undefined"===typeof (A)||null===A){return C}return A.validateValueForKeyPath(C,D.slice(1))},validateValueForVariableKeypath:function(A,C){var B=coherent.VariableKeyPath.resolve(C,this);if("undefined"===typeof (B)){return A}return this.validateValueForKeyPath(A,B)},validateValueForKey:function(B,A){if(!A||!A.length){throw new InvalidArgumentError("missing key")}var C=this.infoForKey(A);return C.validate(this,B)},observeChildObjectChangeForKeyPath:function(D,C,A){if(coherent.KVO.kAllPropertiesKey!=C){C=A+"."+C}else{C=A}var B=Object.clone(D);B.object=this;this.notifyObserversOfChangeForKeyPath(B,C)},infoForKeyPath:function(D){if(!D||0===D.length){throw new InvalidArgumentError("keyPath is empty")}if("string"==typeof (D)){if("$"==D.charAt(0)){return this.infoForVariableKeyPath(D)}D=D.split(".")}var B=D[0];if(1==D.length){return this.infoForKey(B)}else{if("@"==B.charAt(0)){var C=new coherent.KeyInfo(null,null);C.mutable=false;return C}else{var A=this.valueForKey(B);if(!A){return undefined}if(!A.infoForKeyPath){return undefined}return A.infoForKeyPath(D.slice(1))}}},infoForVariableKeyPath:function(B){var A=coherent.VariableKeyPath.resolve(B,this);return("undefined"===typeof (A))?undefined:this.infoForKeyPath(A)},infoForKey:function(A){var B;if(!this.__keys){this.__keys={}}if(coherent.KVO.kAllPropertiesKey==A){return null}B=this.__keys[A];if(B){return B}B=new coherent.KeyInfo(this,A);this.__keys[A]=B;return B},setKeysTriggerChangeNotificationsForDependentKey:function(D,C){if(!D||!D.length){throw new InvalidArgumentError("keys array is not valid")}if(!C){throw new InvalidArgumentError("dependentKey can not be null")}if(-1!==C.indexOf(".")){throw new InvalidArgumentError("dependentKey may not be a key path")}var B;var F;var A;var E;if("string"===typeof (D)){D=[D]}if(!this.__dependentKeys){this.__dependentKeys={}}for(A=0;A<D.length;++A){B=D[A];if(!B){throw new InvalidArgumentError("key at index "+A+" was null")}if(!(B in this.__dependentKeys)){this.__dependentKeys[B]=[]}coherent.KVO.getPropertyMethodsForKeyOnObject(B,this);E=this.__dependentKeys[B];if(-1==E.indexOf(C)){E.push(C)}}},mutableKeys:function(){var D=[];var B;var A;var C;if("__mutableKeys" in this&&this.__mutableKeys.concat){return this.__mutableKeys}var E=Set.union(coherent.KVO.keysToIgnore,this.__keysToIgnore);for(B in this){if(B in E||"__"===B.substr(0,2)){continue}A=this[B];if("function"!==typeof (A)){D.push(B);continue}if(1!==A.length||"set"!==B.substr(0,3)){continue}C=B.charAt(3);if(C!==C.toUpperCase()){continue}B=C.toLowerCase()+B.substr(4);if(B in E){continue}if(-1===D.indexOf(B)){D.push(B)}}return D},initialiseKeyValueObserving:function(){this.__uid=this.__uid||coherent.generateUid();this.__observers={};this.__variableBindings={}},_addParentLink:function(D,E,C){if(!this.hasOwnProperty("__observers")){this.initialiseKeyValueObserving()}var B=this.__observers[coherent.KVO.kAllPropertiesKey];if(!B){B=this.__observers[coherent.KVO.kAllPropertiesKey]={}}C=C||E.__uid;if(C in B){return }var A=new coherent.ObserverEntry(D,D.observeChildObjectChangeForKeyPath,E?E.key:"");B[C]=A;if(!E){return }E.unlinkParentLink();E.parentLink=A},_removeParentLink:function(C,D,B){if(!this.__observers){return }var A=this.__observers[coherent.KVO.kAllPropertiesKey];if(!A){A=this.__observers[coherent.KVO.kAllPropertiesKey]={}}B=B||D.__uid;if(D&&D.parentLink===A[B]){D.unlinkParentLink()}delete A[B]},addObserverForKeyPath:function(A,F,E,B){if(!E||0===E.length){throw new InvalidArgumentError("keyPath is empty")}if(!A){throw new InvalidArgumentError("Observer may not be null")}if(!F){F=A.observeChangeForKeyPath}if("string"===typeof (F)){F=A[F]}if(!F){throw new InvalidArgumentError("Missing callback method")}if(!this.hasOwnProperty("__observers")){this.initialiseKeyValueObserving()}if("$"===E.charAt(0)){var C=this.__variableBindings[E];if(!C){C=coherent.Binding.bindingFromString(E,this);this.__variableBindings[E]=C;C.bind();C.observerFn=function(L,K,H){var J=this.getObservers();for(var G in J){var I=J[G];I.observeChangeForKeyPath(L,K)}}}C.addObserver(A,F,B)}else{this.infoForKeyPath(E);if(!this.__observers[E]){this.__observers[E]=[]}var D=new coherent.ObserverEntry(A,F,B);this.__observers[E].push(D)}},removeObserverForKeyPath:function(C,G){if(!G||0===G.length){throw new InvalidArgumentError("keyPath may not be empty")}if(!C){throw new InvalidArgumentError("Observer may not be null")}if(!this.__observers){return }if("$"===G.charAt(0)){var D=this.__variableBindings[G];if(D){D.removeObserver(C)}return }if(!this.__observers[G]){return }var F=this.__observers[G];var B=-1;var E;var A=F.length;for(B=0;B<A;++B){E=F[B];if(E.observer==C){F.splice(B,1);return }}},willChangeValueForKey:function(A,C){if(!A){throw new InvalidArgumentError("key may not be null")}C=(C instanceof coherent.KeyInfo)?C:this.infoForKey(A);if(!C){return }if(1!==++C.changeCount){return }var B=(this.__dependentKeys&&this.__dependentKeys[A]);if(B){B.forEach(this.willChangeValueForKey,this)}C.previousValue=C.get(this)},forceChangeNotificationForKey:function(A,B){if(!A){throw new InvalidArgumentError("key may not be null")}B=(B instanceof coherent.KeyInfo)?B:this.infoForKey(A);if(!B){return }if(0!==B.changeCount){return }B.changeCount=1;this.didChangeValueForKey(A,B)},didChangeValueForKey:function(B,F){if(!B){throw new InvalidArgumentError("key may not be null")}F=(F instanceof coherent.KeyInfo)?F:this.infoForKey(B);if(!F){return }if(0!==--F.changeCount){return }var C=F.get(this);var A=F.previousValue;F.previousValue=null;if(C!==A){var E=new coherent.ChangeNotification(this,coherent.ChangeType.setting,C,A);this.notifyObserversOfChangeForKeyPath(E,B);if(A&&A._removeParentLink){A._removeParentLink(this,F)}if(C&&C._addParentLink){C._addParentLink(this,F)}}var D=(this.__dependentKeys&&this.__dependentKeys[B]);if(D){D.forEach(this.didChangeValueForKey,this)}},notifyObserversOfChangeForKeyPath:function(J,L){if(!L){throw new InvalidArgumentError("keyPath may not be null")}if(L.charAt(0)==="$"){throw new InvalidArgumentError("keyPath cannot be a variable keypath")}if(!this.__observers){return }var G;var F;var H;F=this.__observers[coherent.KVO.kAllPropertiesKey];if(F){var E=Object.clone(J);var A=J.objectKeyPath.length;J.objectKeyPath.push(this);for(G in F){var B=F[G];B.observeChangeForKeyPath(E,L)}J.objectKeyPath.length=A}if(coherent.KVO.kAllPropertiesKey==L){return }F=this.__observers[L];if(F&&F.length){H=F.length;for(G=0;G<H;++G){F[G].observeChangeForKeyPath(J,L)}}var D=L+".";var I=D.length;var K;var M;var P;var O;var C;var N=!(null===J.oldValue||"undefined"===typeof (J.oldValue));for(M in this.__observers){if(M.substr(0,I)!=D){continue}F=this.__observers[M];if(!F||!F.length){continue}K=M.substr(I);O=J.oldValue;if(O&&O.valueForKeyPath){O=O.valueForKeyPath(K)}else{O=null}C=J.newValue;if(C&&C.valueForKeyPath){C=C.valueForKeyPath(K)}else{C=null}if(N&&O===C){continue}P=new coherent.ChangeNotification(J.object,J.changeType,C,O,J.indexes);H=F.length;for(G=0;G<H;++G){F[G].observeChangeForKeyPath(P,M)}}},toJSON:function(A){var B={};this.mutableKeys().forEach(function(C){B[C]=this[C]},this);return B}});coherent.KVO.kAllPropertiesKey="*";coherent.KVO.keysToIgnore=$S("__keys","__observers","__keysToIgnore","__dependentKeys","__mutableKeys","__factories__");coherent.KVO.typesOfKeyValuesToIgnore=$S("string","number","boolean","date","regexp","function");coherent.KVO.getPropertyMethodsForKeyOnObject=(function(){function B(H,F){F=F||"__kvo_prop_"+H;var G={getter:function(){var I=null;if(F in this){I=this[F]}var J=this.__keys?this.__keys[H]:null;if(!J){return I}if(I&&I._addParentLink){I._addParentLink(this,J)}else{J.unlinkParentLink()}return I},mutator:function(I){this.willChangeValueForKey(H);if("undefined"===typeof (I)){I=null}this[F]=I;this.didChangeValueForKey(H);return I}};G.mutator.__key=H;G.getter.__key=H;return G}function C(H,G){function F(J){this.willChangeValueForKey(G);var I=H.call(this,J);this.didChangeValueForKey(G);return I}F.__key=G;F.valueOf=function(){return H};F.toString=function(){return String(H)};return F}function D(F,H){function G(){var I=F.call(this);var J=this.__keys?this.__keys[H]:null;if(!J){return I}if(I&&I._addParentLink){I._addParentLink(this,J)}else{J.unlinkParentLink()}return I}G.__key=H;G.valueOf=function(){return F};G.toString=function(){return String(F)};return G}function E(T,K){var M=K.constructor.prototype;var J=(M==K);var L=(M!=Object.prototype&&M!=Array.prototype&&M!=coherent.KVO.prototype)?M:K;var U=T.titleCase();var P="get"+U;var Q="set"+U;var I="validate"+U;var O;var H;var S;var F=K[I];var N=("undefined"!==typeof (O=K.__lookupGetter__(T))&&"undefined"!==typeof (H=K.__lookupSetter__(T)));if(!N){P=(P in K)?P:T;O=K[P];H=K[Q]}if("function"!==typeof (O)){var R="__kvo_prop_"+T;var G=B(T,R);if(T in K){S=K[R]=("undefined"==typeof (O)?null:O);delete K[T]}O=G.getter;H=G.mutator;N=true}else{if(0!==O.length){O=null}if(H&&1!==H.length){H=null}if(O&&!J){S=O.valueOf().call(K)}if(O&&T!==O.__key){O=D(O,T)}if(H&&T!==H.__key){H=C(H,T)}}if(N){L.__defineGetter__(T,O);L.__defineSetter__(T,H)}else{if(O){if(K.hasOwnProperty(P)){K[P]=O}else{L[P]=O}}if(H){if(K.hasOwnProperty(Q)){K[Q]=H}else{L[Q]=H}}}return{getter:O,mutator:H,validator:F,value:S}}function A(Q,J){var L=J.constructor.prototype;var I=(L==J);var K=(L!=Object.prototype&&L!=Array.prototype&&L!=coherent.KVO.prototype)?L:J;var R=Q.titleCase();var O="set"+R;var N="get"+R;var H="validate"+R;N=(N in J)?N:Q;var M=J[N];var G=J[O];var F=J[H];var P;if("function"!==typeof (M)){if(Q in J){P=M}M=null;G=null}else{if(0!==M.length){M=null}if(G&&1!==G.length){G=null}if(M&&!I){P=M.valueOf().call(J)}if(M&&Q!==M.__key){M=D(M,Q)}if(G&&Q!==G.__key){G=C(G,Q)}}if(M){if(J.hasOwnProperty(N)){J[N]=M}else{K[N]=M}}if(G){if(J.hasOwnProperty(O)){J[O]=G}else{K[O]=G}}return{getter:M,mutator:G,validator:F,value:P}}if(coherent.Support.Properties){return E}else{return A}})();coherent.KVO.adapt=function(C){if(!C){throw new InvalidArgumentError("Can't adapt a null object")}var B;var A=coherent.KVO.prototype;for(B in A){if(B in C){continue}C[B]=A[B]}if("keyDependencies" in C&&!("__dependentKeys" in C)){var D=C.keyDependencies;for(B in D){C.setKeysTriggerChangeNotificationsForDependentKey(D[B],B)}}return C};coherent.KVO.adaptTree=function(D){coherent.KVO.adapt(D);var C;var A;var E=coherent.KVO.keysToIgnore;var B=coherent.KVO.typesOfKeyValuesToIgnore;for(C in D){if(E[C]){continue}A=D[C];if(!A){continue}if(B[coherent.typeOf(A)]){continue}coherent.KVO.adaptTree(A)}return D};coherent.KVO.unadaptTree=function(C){var A,B=coherent.typeOf(C);switch(B){case"object":A={};break;case"array":A=[];break;default:return C}if(!C.mutableKeys){return C}C.mutableKeys().forEach(function(D){A[D]=coherent.KVO.unadaptTree(C[D])});return A};coherent.KVO.__subclassCreated__=function(A){var D=A.superclass.prototype;var B=A.prototype;if(D.keyDependencies===B.keyDependencies){return }var E=B.keyDependencies||{};for(var C in E){B.setKeysTriggerChangeNotificationsForDependentKey(E[C],C)}};coherent.Bindable=Class.create(coherent.KVO,{constructor:function(A){this.bindings={};this.__parameters=A;this.__context=coherent.dataModel},__createFactoryObjects:function(){var A=coherent.dataModel;var C=this.__context;coherent.dataModel=this.__context=this;var D;var B;for(D in this.__factories__){B=this[D];if(!B.__factoryFn__){continue}this[D]=B.call(this)}coherent.dataModel=A;this.__context=C},exposedBindings:[],automaticallySetupBindings:true,__relativeSource:null,bindNameToKeyPath:function(B,F,A){var C;var E;var D=this;if(!this.bindings){this.bindings={}}C=this["observe"+B.titleCase()+"Change"];if(!C){C=function(H){if(coherent.ChangeType.setting!==H.changeType){throw new InvalidArgumentError('Received invalid change type for synthesized binding observer (name="'+B+'" keyPath="'+F+'")')}var G=H.newValue;D.setValueForKey(H.newValue,B)}}if(this.bindings[B]){this.bindings[B].unbind()}if("*."==F.substr(0,2)){E=coherent.Binding.bindingFromString(F.substr(2),A)}else{E=coherent.Binding.bindingFromString(F,this.__context)}E.observerFn=C.bind(this);this.bindings[B]=E},__postConstruct:function(){if(!this.automaticallySetupBindings){return }this.__initialising=true;this.__copyParameters(this.__parameters||{});this.setupBindings();this.updateBindings();this.createObservers();delete this.__initialising},__copyParameters:function(C){var D;var A;var B=coherent.KVO.adaptTree;for(D in C){if(-1!==D.search(/Binding$/)){continue}A=C[D];if("object"===coherent.typeOf(A)&&!("addObserverForKeyPath" in A)){B(A)}this[D]=A}this.__parameters=C},bindingInfoForName:function(A){if(!this.__parameters){return null}return this.__parameters[A+"Binding"]||this.__parameters[A]},__createAutoObserver:function(C,B){var A=coherent.ChangeType.setting;return function(D){if(this.bindings[B]||A==D.changeType){return }C.apply(this,arguments)}},createObservers:function(){var E=this.exposedBindings;var A=E.length;var B;var D;var C;for(B=0;B<A;++B){C=E[B];D=this["observe"+C.titleCase()+"Change"];if(!D){continue}D=this.__createAutoObserver(D,C);this.addObserverForKeyPath(this,D,C,"__auto_observer__")}},setupBindings:function(){var D=this.exposedBindings;var B=D.length;var E;var A;var C;for(C=0;C<B;++C){A=D[C];E=this.bindingInfoForName(A);if(!E){continue}this.bindNameToKeyPath(A,E,this.__relativeSource)}},updateBindings:function(){var E=this.bindings;var D=this.exposedBindings;var B=D.length;var A;var C;for(C=0;C<B;++C){A=E[D[C]];if(!A){continue}A.update()}},unbind:function(){for(var A in this.bindings){this.bindings[A].unbind()}}});coherent.Bindable.__subclassCreated__=function(A){var C=A.superclass.prototype;var B=A.prototype;if(C.exposedBindings===B.exposedBindings){return }B.exposedBindings=C.exposedBindings.concat(B.exposedBindings)};coherent.SortDescriptor=Class.create({constructor:function(D,A,B){this.keyPath=D;this.ascending=A;this.comparisonFn=B||this.defaultCompare;var C=typeof (this.comparisonFn);if("string"!=C&&"function"!=C){throw new InvalidArgumentError("comparisonFn must be either the name of a method or a function reference")}},resolveComparisonFn:function(B){var A=this.comparisonFn;if("string"===typeof (A)){A=B[A]}if("function"!==typeof (A)){throw new TypeError("comparisonFn does not resolve to a function")}return A},compareObjects:function(C,B){if(!C.valueForKeyPath||!B.valueForKeyPath){throw new InvalidArgumentError("Objects are not Key Value compliant")}var E=C.valueForKeyPath(this.keyPath);var D=B.valueForKeyPath(this.keyPath);var A=this.resolveComparisonFn(E);return A.call(E,D)},defaultCompare:function(A){return coherent.compareValues(this,A)},reversedSortDescriptor:function(){return new coherent.SortDescriptor(this.keyPath,!this.ascending,this.comparisonFn)}});coherent.Controller=Class.create(coherent.Bindable,{constructor:function(A){this.base(A)},registerWithName:function(A){if(!A){return }this.name=A;coherent.registerModelWithName(this,A)}});coherent.Markers={MultipleValues:"ThisIsAnUniqueStringThatRepresentsMultipleValues",NoSelection:"ThisIsAnUniqueStringThatRepresentsNoSelection"};coherent.SelectionProxy=Class.create(coherent.KVO,{constructor:function(A){this.controller=A;this.mutable=true},infoForKey:function(B){var A=this.controller.selectedObjects();var C=A.infoForKey(B);C.mutable&=this.mutable;return C},infoForKeyPath:function(C){var A=this.controller.selectedObjects();var B=A.infoForKeyPath(C);B.mutable&=this.mutable;return B},translateValue:function(D){if("array"!==coherent.typeOf(D)){return D}if(1===D.length){return D[0]}var C;var A;var B=D[0];for(C=1,A=D.length;C<A;++C){if(0!==coherent.compareValues(B,D[C])){return coherent.Markers.MultipleValues}}return B},valueForKey:function(C){var B=this.controller.selectedObjects();if(0===B.length){return coherent.Markers.NoSelection}var A=B.valueForKey(C);return this.translateValue(A)},validateValueForKeyPath:function(E,F){var B=this.controller.selectedObjects();var A=B.length;var D;if(0===A){return E}var C;for(D=0;D<A;++D){C=B[D].validateValueForKeyPath(E,F);if(C instanceof coherent.Error){return C}}return C},valueForKeyPath:function(C){var B=this.controller.selectedObjects();if(0===B.length){return coherent.Markers.NoSelection}var A=B.valueForKeyPath(C);return this.translateValue(A)},setValueForKey:function(D,C){if(!this.mutable){return }var B=this.controller.selectedObjects();var A=this.valueForKey(C);B.setValueForKey(D,C);var E=this.valueForKey(C);if(A===E){return }var F=new coherent.ChangeNotification(this,coherent.ChangeType.setting,E,A);this.notifyObserversOfChangeForKeyPath(F,C)},setValueForKeyPath:function(C,F){if(!this.mutable){return }var B=this.controller.selectedObjects();var A=this.valueForKeyPath(F);B.setValueForKeyPath(C,F);var D=this.valueForKeyPath(F);if(A===D){return }var E=new coherent.ChangeNotification(this,coherent.ChangeType.setting,D,A);this.notifyObserversOfChangeForKeyPath(E,F)}});coherent.ObjectController=Class.create(coherent.Controller,{constructor:function(A){this.base(A);this.objectClass=coherent.KVO;this.__content=null;this.__editable=true;this.__selectedObjects=[];this.__selection=new coherent.SelectionProxy(this)},observeChildObjectChangeForKeyPath:function(F,E,B){this.base(F,E,B);if("selectedObjects"!==B){return }var C="selection."+E;var D=this.valueForKeyPath(C);var A=new coherent.ChangeNotification(this,coherent.ChangeType.setting,D,null);this.notifyObserversOfChangeForKeyPath(A,C)},keyDependencies:{},exposedBindings:["editable","content"],editable:function(){var A=this.__editable;if(this.bindings.content){A&=this.bindings.content.mutable()}return A},setEditable:function(A){if(this.bindings.content){A&=this.bindings.content.mutable()}if(this.bindings.editable){this.bingings.editable.setValue(A)}this.__editable=A},content:function(){return this.__content},setContent:function(A){if(this.bindings.content){this.bindings.content.setValue(A)}this.__content=A;this.willChangeValueForKey("selectedObjects");if(!A){this.__selectedObjects=[]}else{this.__selectedObjects=[A]}this.didChangeValueForKey("selectedObjects");this.forceChangeNotificationForKey("selection")},selectedObjects:function(){return this.__selectedObjects},selection:function(){return this.__selection}});window.XHR=(function(){var getTransport=function(){throw new Error("XMLHttpRequest not available.")};if(!coherent.Browser.IE){getTransport=function(){return new XMLHttpRequest()}}else{var progIdCandidates=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"];var len=progIdCandidates.length;var progId;var xhr;for(var i=0;i<len;++i){try{progId=progIdCandidates[i];xhr=new ActiveXObject(progId);getTransport=function(){return new ActiveXObject(progId)};break}catch(e){}}}function send(url,method,options){function noop(){}function cancel(){xhr.onreadystatechange=noop;xhr.abort()}function readyStateChanged(){if(4!==xhr.readyState){return }if(xhrSent===false){arguments.callee.delay(0);return }var status=xhr.status;var succeeded=(status>=200&&status<300)||304==status;if(0===status||"undefined"===typeof (status)){var protocol=window.location.protocol;succeeded="file:"===protocol||"chrome:"===protocol}var result=xhr.responseText;var err;if(succeeded){if("HEAD"==method){result={};try{var headers=xhr.getAllResponseHeaders();if(headers){headers=headers.split("\n");headers.forEach(function(header){var match=header.match(/^([^:]+):(.+)$/m);var name=match[1].trim();result[name]=match[2].trim()})}}catch(e){}}else{var contentType=options.responseContentType||xhr.getResponseHeader("Content-Type");if(contentType.match(/(?:application\/(?:x-)?json)|(?:text\/json)/)){try{result=eval("("+result+")")}catch(e){err=e;succeeded=false}}if(contentType.match(/(?:application|text)\/xml/)){result=xhr.responseXML}}}else{err=new Error("XHR request failed");err.url=url;err.method=method;err.xhr=xhr;try{err.status=xhr.status;err.statusText=xhr.statusText}catch(e){err.status=0;err.statusText=null}}if(succeeded){deferred.callback(result)}else{deferred.failure(err)}xhr.onreadystatechange=noop;xhr=null}var urlArgs=(url||"").split("?");if(2==urlArgs.length){url=urlArgs[0];urlArgs=Object.fromQueryString(urlArgs[1])}else{urlArgs={}}var xhr=getTransport();var args=Object.applyDefaults(options.parameters||{},urlArgs);var queryString=Object.toQueryString(args);var body=options.body||"";var async=!options.sync;var deferred=new coherent.Deferred(cancel);var xhrSent=false;method=(method||"GET").toUpperCase();if("GET"==method){url=url+"?"+queryString}if(options.user){xhr.open(method,url,async,options.user,options.password||"")}else{xhr.open(method,url,async)}var headers=options.headers||{};for(var h in headers){xhr.setRequestHeader(h,headers[h])}xhr.setRequestHeader("X-Requested-With","XMLHttpRequest");if("POST"==method){xhr.setRequestHeader("Content-Type",options.contentType||"application/x-www-form-urlencoded");body=queryString}if(async){xhr.onreadystatechange=readyStateChanged}xhr.send(body);xhrSent=true;if(!async){readyStateChanged()}return deferred}return{get:function(url,parameters,options){return XHR.request("GET",url,parameters,options)},post:function(url,parameters,options){return XHR.request("POST",url,parameters,options)},request:function(method,url,parameters,options){method=method.toUpperCase();options=options||{};options.parameters=parameters;return send(url,method,options)}}})();coherent.AjaxController=Class.create(coherent.ObjectController,{exposedBindings:["url"],flushContentBeforeQuery:false,constructor:function(A){this.base(A);this.addObserverForKeyPath(this,this.queryUpdated,"url");this.addObserverForKeyPath(this,this.queryUpdated,"method");this.queryDelay=500;this.url="";this.method="GET";this.setValueForKey(new coherent.KVO(),"parameters")},validateParameters:function(){return true},observeChildObjectChangeForKeyPath:function(C,B,A){this.base(C,B,A);if("parameters"===A){this.queryUpdated(C,B,A)}},queryUpdated:function(C,B,A){if(!this.parameters||!this.validateParameters()){return }this.setValueForKey(true,"queryInProgress");if(this.__queryTimer){window.clearTimeout(this.__queryTimer)}this.__queryTimer=this.performQuery.bindAndDelay(this,this.queryDelay)},performQuery:function(){var E={};var D=this.parameters.mutableKeys();var A=D.length;var F;var B;for(var C=0;C<A;++C){F=D[C];if(!this.parameters.hasOwnProperty(F)){continue}B=this.parameters[F];if(""===B||null===B||"undefined"===typeof (B)){continue}E[F]=B}this.finalParameters(E);this.__request=XHR.get(this.url,E,{responseContentType:"application/json"});this.__request.addMethods(this.querySucceeded.bind(this),this.queryFailed.bind(this));if(this.flushContentBeforeQuery){this.setContent(null)}},finalParameters:function(A){return A},extractContent:function(A){return A},querySucceeded:function(A){coherent.KVO.adaptTree(A);this.setContent(this.extractContent(A));this.setValueForKey("","statusCode");this.setValueForKey("","errorMessage");this.setValueForKey(false,"queryInProgress")},queryFailed:function(A){console.log("failure: "+this.url);this.setValueForKey(A.status,"statusCode");this.setValueForKey(A.statusText,"errorMessage");this.setContent(null);this.setValueForKey(false,"queryInProgress")}});function IndexRange(C,A){var B;var D=[];if(1==arguments.length&&C.length){A=C.length-1;C=0}for(B=C;B<=A;++B){D.push(B)}return D}coherent.ArrayController=Class.create(coherent.ObjectController,{constructor:function(A){this.base(A);this.arrangedObjects=[];this.__sortDescriptors=[];this.__filterPredicate=null;this.__selectionIndexes=[]},keyDependencies:{selectedObjects:["selectionIndexes"],selectionIndex:["selectionIndexes"],canRemove:["editable","selectionIndexes"],canAdd:["editable"]},selectsInsertedObjects:true,exposedBindings:["selectionIndexes","sortDescriptors","filterPredicate","contentForMultipleSelection"],observeContentChange:function(D){var A;var C;switch(D.changeType){case coherent.ChangeType.setting:this.setContent(D.newValue);break;case coherent.ChangeType.insertion:this._insertObjectsIntoArrangedObjects(D.newValue);if(this.selectsInsertedObjects){var B=this.selectedObjects();B=B.concat(D.newValue);this.setSelectedObjects(B)}break;case coherent.ChangeType.deletion:this.rearrangeObjects();break;case coherent.ChangeType.replacement:this.rearrangeObjects();break;default:break}},canAdd:function(){return this.editable()},add:function(){var A=new (this.objectClass)();var B=this.content();B.addObject(A)},canRemove:function(){return this.editable()&&this.selectionIndexes().length},remove:function(){var A=this.selectedObjects();var B=this.content();B.removeObjects(A)},setContent:function(A){A=A||[];if(this.bindings.content){this.bindings.content.setValue(A)}this.__content=A;this.rearrangeObjects(A)},sortDescriptors:function(){return this.__sortDescriptors},setSortDescriptors:function(A){if(this.bindings.sortDescriptors){this.bindings.sortDescriptors.setValue(A)}this.__sortDescriptors=A;this.rearrangeObjects()},filterPredicate:function(){return this.__filterPredicate},setFilterPredicate:function(A){if(this.bindings.filterPredicate){this.bindings.filterPredicate.setValue(A)}this.__filterPredicate=A;this.rearrangeObjects()},filterObjects:function(E){var F=this.filterPredicate();if(!F){return IndexRange(E)}var C=[];var D;var A;var B;for(D=0,A=E.length;D<A;++D){B=E[D];if(F(B)){C.push(D)}}return C},_compareObjects:function(F,E){var D;var B;var C=this.sortDescriptors();var A=C.length;for(D=0;D<A;++D){B=C[D].compareObjects(F,E);if(!C[D].ascending){B*=-1}if(0!==B){return B>0?1:-1}}return 0},sortObjects:function(D,B){B=B||IndexRange(D);var C=this.sortDescriptors();var E=C.length;function A(M,L){var I;var G;var K=D[M];var J=D[L];var F=E;var H=C;for(I=0;I<F;++I){G=H[I].compareObjects(K,J);if(!H[I].ascending){G*=-1}if(0!==G){return G}}return 0}if(0!==C.length){B.sort(A)}return B},arrangeObjects:function(E){var C=this.filterObjects(E);C=this.sortObjects(E,C);if(E===this.content()){var D=[];var A=C.length;for(var B=0;B<A;++B){D[C[B]]=B}this.__contentToArrangedMap=D;this.__arrangedToContentMap=C}return E.objectsAtIndexes(C)},rearrangeObjects:function(D){var G=D||this.content()||[];var C=this.arrangeObjects(G);var B=this.selectedObjects();var E=[];var A=B.length;var H;var F;for(F=0;F<A;++F){H=C.indexOf(B[F]);if(-1!==H){E.push(H)}}this.setValueForKey(C,"arrangedObjects");this.setValueForKey(E,"selectionIndexes")},_insertObjectsIntoArrangedObjects:function(A){var H=this.arrangeObjects(A);var J=H.length;var B=this.arrangedObjects;var F=B.length;var G=[];var I=0;var D;var C;var E;G.length=J;for(E=0;E<J;++E){D=H[E];while(I<F){C=B[I];if(-1===this._compareObjects(D,C)){break}++I}G[E]=I+E}B.insertObjectsAtIndexes(H,G)},selectedObjects:function(){return this.__selectedObjects},setSelectedObjects:function(B){var C=[];var E;var D;var A=this.arrangedObjects;for(E=0;E<B.length;++E){D=A.indexOf(B[E]);if(-1===D){continue}C.push(D)}return this.setSelectionIndexes(C)},selectionIndexes:function(){return this.__selectionIndexes},setSelectionIndexes:function(B){B=B||[];B.sort();if(0===(this.selectionIndexes()||[]).compare(B)){return false}if(this.bindings.selectionIndexes){this.bindings.selectionIndexes.setValue(B)}this.__selectionIndexes=B;var A=this.arrangedObjects;this.__selectedObjects=A.objectsAtIndexes(B);this.forceChangeNotificationForKey("selection");return true},setSelectionIndex:function(B){var A=this.setSelectionIndexes([B]);return A},selectionIndex:function(){var A=this.selectionIndexes();if(0===A.length){return -1}return A[0]}});coherent.ModelController=Class.create(coherent.Controller,{constructor:function(B,A){if(!("addObserverForKeyPath" in B)){coherent.KVO.adaptTree(B)}function C(D){this.setValueForKey(B[D],D)}B.mutableKeys().forEach(C,this);this.base(A)}});Object.extend(coherent,{dataModel:new coherent.KVO(),registerModelWithName:function(B,A){coherent.dataModel.setValueForKey(B,A)},unregisterModelWithName:function(A){delete coherent.dataModel[A]}});coherent.ValueTransformer=Class.create({transformedValue:function(A){return A},reverseTransformedValue:function(A){return A},__factory__:function(){var B=Array.from(arguments);var A=this;function C(){}return function(){C.prototype=A.prototype;var D=new C();A.prototype.constructor.apply(D,B);return D}}});coherent.ValueTransformer.__subclassCreated__=function(A){var C=coherent.ValueTransformer.prototype;var B=A.prototype;if(C.reverseTransformedValue==B.reverseTransformedValue){A.prototype.reverseTransformedValue=null}};coherent.transformer={};coherent.transformerInstances={};coherent.findTransformerWithName=function(transformerName){var valueTransformer=coherent.transformerInstances[transformerName.toLowerCase()];if(valueTransformer){return valueTransformer}if(-1===transformerName.indexOf(".")){valueTransformer=coherent.transformer[transformerName]}else{try{valueTransformer=eval(transformerName)}catch(e){}}valueTransformer=valueTransformer&&new valueTransformer();if(valueTransformer){return valueTransformer}throw new InvalidArgumentError("The transformerName argument does not specify a valid ValueTransformer: "+transformerName)};coherent.registerTransformerWithName=function(B,A){if(!B.transformedValue){throw new InvalidArgumentError("The valueTransformer argument does not support the ValueTransformer method transformedValue")}A=A.toLowerCase();coherent.transformerInstances[A]=B};coherent.transformer.Not=Class.create(coherent.ValueTransformer,{transformedValue:function(A){return(A?false:true)},reverseTransformedValue:function(A){return !!A}});coherent.registerTransformerWithName(new coherent.transformer.Not(),"not");coherent.transformer.Boolean=Class.create(coherent.ValueTransformer,{constructor:function(A,B){this.trueValue=A;this.falseValue=B},transformedValue:function(A){return(A==this.trueValue)},reverseTransformedValue:function(A){return(A?this.trueValue:this.falseValue)}});coherent.transformer.Matches=Class.create(coherent.ValueTransformer,{constructor:function(A){this.trueRegex=A},transformedValue:function(A){return this.trueRegex.test(A)}});coherent.transformer.Generic=Class.create(coherent.ValueTransformer,{constructor:function(A,B){this.modelValues=A;this.displayValues=B},transformedValue:function(B){var A=this.modelValues.indexOf(B);var C;if(-1==A){return C}else{return this.displayValues[A]}},reverseTransformedValue:function(B){var A=this.displayValues.indexOf(B);var C;if(-1==A){return C}else{return this.modelValues[A]}}});coherent.transformer.Truncated=Class.create(coherent.ValueTransformer,{constructor:function(A){this.max=A||50},ellipsis:String.fromCharCode(8230),transformedValue:function(A){if(A){return A.toString().truncate({from:"middle",length:this.max,omission:this.ellipsis})}else{return A}}});coherent.registerTransformerWithName(new coherent.transformer.Truncated(50),"truncated");coherent.transformer.StringsToObjects=Class.create(coherent.ValueTransformer,{constructor:function(A){this.key=A||"string"},transformedValue:function(B){if(!B||!B.map){return B}function A(C){var D=new coherent.KVO();D[this.key]=C;return D}return B.map(A,this)},reverseTransformedValue:function(B){if(!B||!B.map){return B}function A(C){return C[this.key]}return B.map(A,this)}});coherent.registerTransformerWithName(new coherent.transformer.StringsToObjects("string"),"StringsToObjects");coherent.transformer.ObjectToArray=Class.create(coherent.ValueTransformer,{transformedValue:function(D){var A=coherent.KVO.adapt([]);if(D){for(var C in D){var B=D[C].index;A[B]=D[C]}}return A}});coherent.registerTransformerWithName(new coherent.transformer.ObjectToArray(),"ObjectToArray");
/*
 * Sizzle CSS Selector Engine - v1.0
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
/*
 * ATTENTION: This file has been modified to remove all handling of XML
 */
(function(){var P=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,I=0,D=Object.prototype.toString,K=Array.prototype.splice,M=Array.prototype.push,H=Array.prototype.sort;var B=function(W,S,Z,a){Z=Z||[];var c=S=S||document;if(S.nodeType!==1&&S.nodeType!==9){return[]}if(!W||typeof W!=="string"){return Z}var X=[],U,e,h,R,b,T,V=true;P.lastIndex=0;while((U=P.exec(W))!==null){X.push(U[1]);if(U[2]){T=RegExp.rightContext;break}}if(X.length>1&&J.exec(W)){if(X.length===2&&E.relative[X[0]]){e=F(X[0]+X[1],S)}else{e=E.relative[X[0]]?[S]:B(X.shift(),S);while(X.length){W=X.shift();if(E.relative[W]){W+=X.shift()}e=F(W,e)}}}else{if(!a&&X.length>1&&S.nodeType===9&&E.match.ID.test(X[0])&&!E.match.ID.test(X[X.length-1])){var d=B.find(X.shift(),S);S=d.expr?B.filter(d.expr,d.set)[0]:d.set[0]}if(S){var d=a?{expr:X.pop(),set:A(a)}:B.find(X.pop(),X.length===1&&(X[0]==="~"||X[0]==="+")&&S.parentNode?S.parentNode:S);e=d.expr?B.filter(d.expr,d.set):d.set;if(X.length>0){h=A(e)}else{V=false}while(X.length){var g=X.pop(),f=g;if(!E.relative[g]){g=""}else{f=X.pop()}if(f==null){f=S}E.relative[g](h,f)}}else{h=X=[]}}if(!h){h=e}if(!h){throw"Syntax error, unrecognized expression: "+(g||W)}if(D.call(h)==="[object Array]"){if(!V){M.apply(Z,h)}else{if(S&&S.nodeType===1){for(var Y=0;h[Y]!=null;Y++){if(h[Y]&&(h[Y]===true||h[Y].nodeType===1&&G(S,h[Y]))){M.call(Z,e[Y])}}}else{for(var Y=0;h[Y]!=null;Y++){if(h[Y]&&h[Y].nodeType===1){M.call(Z,e[Y])}}}}}else{A(h,Z)}if(T){B(T,c,Z,a);B.uniqueSort(Z)}return Z};B.uniqueSort=function(S){if(C){hasDuplicate=false;H.call(S,C);if(hasDuplicate){for(var R=1;R<S.length;R++){if(S[R]===S[R-1]){K.call(S,R--,1)}}}}};B.matches=function(R,S){return B(R,null,null,S)};B.find=function(X,U){var Y,S;if(!X){return[]}for(var T=0,R=E.order.length;T<R;T++){var V=E.order[T],S;if((S=E.match[V].exec(X))){var W=RegExp.leftContext;if(W.substr(W.length-1)!=="\\"){S[1]=(S[1]||"").replace(/\\/g,"");Y=E.find[V](S,U);if(Y!=null){X=X.replace(E.match[V],"");break}}}}if(!Y){Y=U.getElementsByTagName("*")}return{set:Y,expr:X}};B.filter=function(a,Z,d,U){var T=a,f=[],X=Z,W,R;while(a&&Z.length){for(var Y in E.filter){if((W=E.match[Y].exec(a))!=null){var S=E.filter[Y],e,c;R=false;if(X==f){f=[]}if(E.preFilter[Y]){W=E.preFilter[Y](W,X,d,f,U);if(!W){R=e=true}else{if(W===true){continue}}}if(W){for(var V=0;(c=X[V])!=null;V++){if(c){e=S(c,W,V,X);var b=U^!!e;if(d&&e!=null){if(b){R=true}else{X[V]=false}}else{if(b){f.push(c);R=true}}}}}if(e!==undefined){if(!d){X=f}a=a.replace(E.match[Y],"");if(!R){return[]}break}}}if(a==T){if(R==null){throw"Syntax error, unrecognized expression: "+a}else{break}}T=a}return X};var E=B.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(R){return R.getAttribute("href")}},relative:{"+":function(X,S){var U=typeof S==="string",W=U&&!/\W/.test(S),Y=U&&!W;if(W){S=S.toUpperCase()}for(var T=0,R=X.length,V;T<R;T++){if((V=X[T])){while((V=V.previousSibling)&&V.nodeType!==1){}X[T]=Y||V&&V.nodeName===S?V||false:V===S}}if(Y){B.filter(S,X,true)}},">":function(X,S){var V=typeof S==="string";if(V&&!/\W/.test(S)){S=S.toUpperCase();for(var T=0,R=X.length;T<R;T++){var W=X[T];if(W){var U=W.parentNode;X[T]=U.nodeName===S?U:false}}}else{for(var T=0,R=X.length;T<R;T++){var W=X[T];if(W){X[T]=V?W.parentNode:W.parentNode===S}}if(V){B.filter(S,X,true)}}},"":function(U,S){var T=I++,R=Q;if(!S.match(/\W/)){var V=S=S.toUpperCase();R=O}R("parentNode",S,T,U,V)},"~":function(U,S){var T=I++,R=Q;if(typeof S==="string"&&!S.match(/\W/)){var V=S=S.toUpperCase();R=O}R("previousSibling",S,T,U,V)}},find:{ID:function(S,T){if(typeof T.getElementById!=="undefined"){var R=T.getElementById(S[1]);return R?[R]:[]}},NAME:function(T,W){if(typeof W.getElementsByName!=="undefined"){var S=[],V=W.getElementsByName(T[1]);for(var U=0,R=V.length;U<R;U++){if(V[U].getAttribute("name")===T[1]){S.push(V[U])}}return S.length===0?null:S}},TAG:function(R,S){return S.getElementsByTagName(R[1])}},preFilter:{CLASS:function(U,S,T,R,X){U=" "+U[1].replace(/\\/g,"")+" ";for(var V=0,W;(W=S[V])!=null;V++){if(W){if(X^(W.className&&(" "+W.className+" ").indexOf(U)>=0)){if(!T){R.push(W)}}else{if(T){S[V]=false}}}}return false},ID:function(R){return R[1].replace(/\\/g,"")},TAG:function(S,R){return S[1].toUpperCase()},CHILD:function(R){if(R[1]=="nth"){var S=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(R[2]=="even"&&"2n"||R[2]=="odd"&&"2n+1"||!/\D/.test(R[2])&&"0n+"+R[2]||R[2]);R[2]=(S[1]+(S[2]||1))-0;R[3]=S[3]-0}R[0]=I++;return R},ATTR:function(V,S,T,R,W){var U=V[1].replace(/\\/g,"");if(E.attrMap[U]){V[1]=E.attrMap[U]}if(V[2]==="~="){V[4]=" "+V[4]+" "}return V},PSEUDO:function(V,S,T,R,W){if(V[1]==="not"){if(V[3].match(P).length>1||/^\w/.test(V[3])){V[3]=B(V[3],null,null,S)}else{var U=B.filter(V[3],S,T,true^W);if(!T){R.push.apply(R,U)}return false}}else{if(E.match.POS.test(V[0])||E.match.CHILD.test(V[0])){return true}}return V},POS:function(R){R.unshift(true);return R}},filters:{enabled:function(R){return R.disabled===false&&R.type!=="hidden"},disabled:function(R){return R.disabled===true},checked:function(R){return R.checked===true},selected:function(R){R.parentNode.selectedIndex;return R.selected===true},parent:function(R){return !!R.firstChild},empty:function(R){return !R.firstChild},has:function(T,S,R){return !!B(R[3],T).length},header:function(R){return/h\d/i.test(R.nodeName)},text:function(R){return"text"===R.type},radio:function(R){return"radio"===R.type},checkbox:function(R){return"checkbox"===R.type},file:function(R){return"file"===R.type},password:function(R){return"password"===R.type},submit:function(R){return"submit"===R.type},image:function(R){return"image"===R.type},reset:function(R){return"reset"===R.type},button:function(R){return"button"===R.type||R.nodeName.toUpperCase()==="BUTTON"},input:function(R){return/input|select|textarea|button/i.test(R.nodeName)}},setFilters:{first:function(S,R){return R===0},last:function(T,S,R,U){return S===U.length-1},even:function(S,R){return R%2===0},odd:function(S,R){return R%2===1},lt:function(T,S,R){return S<R[3]-0},gt:function(T,S,R){return S>R[3]-0},nth:function(T,S,R){return R[3]-0==S},eq:function(T,S,R){return R[3]-0==S}},filter:{PSEUDO:function(X,T,U,Y){var S=T[1],V=E.filters[S];if(V){return V(X,U,T,Y)}else{if(S==="contains"){return(X.textContent||X.innerText||"").indexOf(T[3])>=0}else{if(S==="not"){var W=T[3];for(var U=0,R=W.length;U<R;U++){if(W[U]===X){return false}}return true}}}},CHILD:function(R,U){var X=U[1],S=R;switch(X){case"only":case"first":while(S=S.previousSibling){if(S.nodeType===1){return false}}if(X=="first"){return true}S=R;case"last":while(S=S.nextSibling){if(S.nodeType===1){return false}}return true;case"nth":var T=U[2],a=U[3];if(T==1&&a==0){return true}var W=U[0],Z=R.parentNode;if(Z&&(Z.sizcache!==W||!R.nodeIndex)){var V=0;for(S=Z.firstChild;S;S=S.nextSibling){if(S.nodeType===1){S.nodeIndex=++V}}Z.sizcache=W}var Y=R.nodeIndex-a;if(T==0){return Y==0}else{return(Y%T==0&&Y/T>=0)}}},ID:function(S,R){return S.nodeType===1&&S.getAttribute("id")===R},TAG:function(S,R){return(R==="*"&&S.nodeType===1)||S.nodeName===R},CLASS:function(S,R){return(" "+(S.className||S.getAttribute("class"))+" ").indexOf(R)>-1},ATTR:function(W,U){var T=U[1],R=E.attrHandle[T]?E.attrHandle[T](W):W[T]!=null?W[T]:W.getAttribute(T),X=R+"",V=U[2],S=U[4];return R==null?V==="!=":V==="="?X===S:V==="*="?X.indexOf(S)>=0:V==="~="?(" "+X+" ").indexOf(S)>=0:!S?X&&R!==false:V==="!="?X!=S:V==="^="?X.indexOf(S)===0:V==="$="?X.substr(X.length-S.length)===S:V==="|="?X===S||X.substr(0,S.length+1)===S+"-":false},POS:function(V,S,T,W){var R=S[2],U=E.setFilters[R];if(U){return U(V,T,S,W)}}}};var J=E.match.POS;for(var N in E.match){E.match[N]=new RegExp(E.match[N].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var A=function(S,R){S=Array.prototype.slice.call(S);if(R){M.apply(R,S);return R}return S};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(L){A=function(V,U){var S=U||[];if(D.call(V)==="[object Array]"){Array.prototype.push.apply(S,V)}else{if(typeof V.length==="number"){for(var T=0,R=V.length;T<R;T++){S.push(V[T])}}else{for(var T=0;V[T];T++){S.push(V[T])}}}return S}}var C;if(document.documentElement.compareDocumentPosition){C=function(S,R){var T=S.compareDocumentPosition(R)&4?-1:S===R?0:1;if(T===0){hasDuplicate=true}return T}}else{if("sourceIndex" in document.documentElement){C=function(S,R){var T=S.sourceIndex-R.sourceIndex;if(T===0){hasDuplicate=true}return T}}else{if(document.createRange){C=function(U,S){var T=U.ownerDocument.createRange(),R=S.ownerDocument.createRange();T.selectNode(U);T.collapse(true);R.selectNode(S);R.collapse(true);var V=T.compareBoundaryPoints(Range.START_TO_END,R);if(V===0){hasDuplicate=true}return V}}}}(function(){var S=document.createElement("form"),T="script"+(new Date).getTime();S.innerHTML="<input name='"+T+"'/>";var R=document.documentElement;R.insertBefore(S,R.firstChild);if(!!document.getElementById(T)){E.find.ID=function(V,W){if(typeof W.getElementById!=="undefined"){var U=W.getElementById(V[1]);return U?U.id===V[1]||typeof U.getAttributeNode!=="undefined"&&U.getAttributeNode("id").nodeValue===V[1]?[U]:undefined:[]}};E.filter.ID=function(W,U){var V=typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id");return W.nodeType===1&&V&&V.nodeValue===U}}R.removeChild(S)})();(function(){var R=document.createElement("div");R.appendChild(document.createComment(""));if(R.getElementsByTagName("*").length>0){E.find.TAG=function(S,W){var V=W.getElementsByTagName(S[1]);if(S[1]==="*"){var U=[];for(var T=0;V[T];T++){if(V[T].nodeType===1){U.push(V[T])}}V=U}return V}}R.innerHTML="<a href='#'></a>";if(R.firstChild&&typeof R.firstChild.getAttribute!=="undefined"&&R.firstChild.getAttribute("href")!=="#"){E.attrHandle.href=function(S){return S.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var R=B,T=document.createElement("div");T.innerHTML="<p class='TEST'></p>";if(T.querySelectorAll&&T.querySelectorAll(".TEST").length===0){return }B=function(X,W,U,V){W=W||document;if(!V&&W.nodeType===9){try{return A(W.querySelectorAll(X),U)}catch(Y){}}return R(X,W,U,V)};for(var S in R){B[S]=R[S]}})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var R=document.createElement("div");R.innerHTML="<div class='test e'></div><div class='test'></div>";if(R.getElementsByClassName("e").length===0){return }R.lastChild.className="e";if(R.getElementsByClassName("e").length===1){return }E.order.splice(1,0,"CLASS");E.find.CLASS=function(S,T){if(typeof T.getElementsByClassName!=="undefined"){return T.getElementsByClassName(S[1])}}})()}function O(S,X,W,a,Y){var Z=S=="previousSibling";for(var U=0,T=a.length;U<T;U++){var R=a[U];if(R){if(Z&&R.nodeType===1){R.sizcache=W;R.sizset=U}R=R[S];var V=false;while(R){if(R.sizcache===W){V=a[R.sizset];break}if(R.nodeType===1){R.sizcache=W;R.sizset=U}if(R.nodeName===X){V=R;break}R=R[S]}a[U]=V}}}function Q(S,X,W,a,Y){var Z=S=="previousSibling";for(var U=0,T=a.length;U<T;U++){var R=a[U];if(R){if(Z&&R.nodeType===1){R.sizcache=W;R.sizset=U}R=R[S];var V=false;while(R){if(R.sizcache===W){V=a[R.sizset];break}if(R.nodeType===1){R.sizcache=W;R.sizset=U;if(typeof X!=="string"){if(R===X){V=true;break}}else{if(B.filter(X,[R]).length>0){V=R;break}}}R=R[S]}a[U]=V}}}var G=document.compareDocumentPosition?function(S,R){return S.compareDocumentPosition(R)&16}:function(S,R){return S!==R&&(S.contains?S.contains(R):true)};var F=function(R,Y){var U=[],V="",W,T=Y.nodeType?[Y]:Y;while((W=E.match.PSEUDO.exec(R))){V+=W[0];R=R.replace(E.match.PSEUDO,"")}R=E.relative[R]?R+"*":R;for(var X=0,S=T.length;X<S;X++){B(R,T[X],U)}return B.filter(V,U)};window.Sizzle=B})();(function(){var A=this.Element;this.Element={};Object.extend(this.Element,A||{})}).call(window);Object.extend(Element,{uniqueId:function(){return"coherent_id_"+Element.assignId.uniqueId++},assignId:function(A){return A.id||(A.id=("coherent_id_"+Element.assignId.uniqueId++))},hasAttribute:function(B,A){return"hasAttribute" in B?B.hasAttribute(A):A in B.attributes&&typeof B.attributes[A]!=="undefined"},regexForClassName:function(B){var A=arguments.callee;if(!A._lookup){A._lookup={}}if(B in A._lookup){return A._lookup[B]}return(A._lookup[B]=new RegExp("(^|\\s)"+B+"(\\s|$)"))},hasClassName:function(A,B){var C=A.className;if(!C){return false}if(C==B){return true}return Element.regexForClassName(B).test(C)},addClassName:function(A,B){if(!B){return }if(Element.hasClassName(A,B)){return }A.className+=" "+B},removeClassName:function(A,B){if(!A||!B){return }var C=Element.regexForClassName(B);A.className=A.className.replace(C," ").trim()},replaceClassName:function(B,C,A){if(!C){return }if(!A){Element.removeClassName(B,C);return }var D=Element.regexForClassName(C);B.className=B.className.replace(D,"$1"+A+"$2").trim()},toggleClassName:function(A,B){if(!B){return }var C=Element.regexForClassName(B);var D=A.className;if(C.test(D)){A.className=D.replace(C," ").trim()}else{A.className+=" "+B}},updateClass:function(F,G,C){var E=$S(F.className.split(" "));var H=Set.add;var B=Set.remove;var D;var A;if("string"===typeof (G)){H(E,G)}else{for(D=0,A=G.length;D<A;++D){H(E,G[D])}}if("string"===typeof (C)){B(E,C)}else{for(D=0,A=C.length;D<A;++D){B(E,C[D])}}F.className=Set.join(E," ")},PROPERTIES:["backgroundColor","backgroundPosition","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","color","display","fontSize","letterSpacing","lineHeight","opacity","width","height","top","bottom","left","right","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft"],getStyles:function(E,D){var F={};var B=window.getComputedStyle(E,null);if("string"===typeof (D)){return E.style[D]||B[D]||null}D=D||Element.PROPERTIES;var G;var A=D.length;for(var C=0;C<A;++C){G=D[C];F[G]=E.style[G]||B[G]||null}return F},setStyle:function(A,B,C){A.style[B]=C},setStyles:function(A,B){var C=A.style;for(var D in B){C[D]=B[D]}},setInnerHTML:function(A,B){Element.innerHTML(A,B,false)},appendInnerHTML:function(A,B){Element.innerHTML(A,B,true)},innerHTML:function(D,E,B){var A=D.parentNode,C=A&&D.cloneNode(false);A&&A.replaceChild(C,D);E=String.stringify(E);if(B){D.innerHTML+=E.escapeForInnerHTML()}else{D.innerHTML=E.escapeForInnerHTML()}A&&A.replaceChild(D,C)},getDimensions:function(E){var G=Element.getStyle(E,"display");if(G&&G!="none"){return{left:E.offsetLeft,top:E.offsetTop,width:E.offsetWidth,height:E.offsetHeight}}var B=E.style;var F=B.visibility;var C=B.position;var A=B.display;B.visibility="hidden";B.position="absolute";B.display="block";var D={width:E.offsetWidth,height:E.offsetHeight,left:E.offsetLeft,top:E.offsetTop};B.display=A;B.position=C;B.visibility=F;return D},clone:function(A){return A.cloneNode(true)},depthFirstTraversal:function(D,E,C){if(!D||!E){return }var A=D.nextSibling||D.parentNode;var B;C=C||E;while(D!==A){if(1===D.nodeType){B=E.call(C,D);if(false!==B&&D.firstChild){D=D.firstChild;continue}}while(!D.nextSibling){D=D.parentNode;if(D===A){return }}D=D.nextSibling}},query:function(C,B){if(1==arguments.length){B=C;C=document}else{if(C!=document){B="#"+Element.assignId(C)+" "+B}}var A;try{A=C.querySelector(B)}catch(D){A=Sizzle(B,C)[0]||null}return A},queryAll:function(C,B){if(1==arguments.length){B=C;C=document}else{if(C!=document){B="#"+Element.assignId(C)+" "+B}}var A;try{A=Array.from(C.querySelectorAll(B))}catch(D){A=Sizzle(B,C)}return A},match:function(B,A){return Sizzle.matches(A,[B]).length==1},getViewport:function(){var C=["left","top","width","height"],D=C.length,B={},F=window,A,E;if(F.innerWidth){A=["pageXOffset","pageYOffset","innerWidth","innerHeight"]}else{A=["scrollLeft","scrollTop","clientWidth","clientHeight"];F=document.documentElement||document.body}for(E=0;E<D;E++){B[C[E]]=F[A[E]]}return B},scrollParent:function(D){var C;var B=Element.getStyles;var A=document.body;while(D&&D!=A){C=B(D,["overflow","overflowX","overflowY"]);if(("visible"!==C.overflowX||"visible"!==C.overflowY)||"visible"!==C.overflow){return D}D=D.parentNode}return D},getRect:function(P,N){if(!P){return null}var R=document.documentElement;var M=document.body;var D=0;var O=0;if(P!=document.body&&P.getBoundingClientRect){var L=P.getBoundingClientRect();L={left:L.left,right:L.right,top:L.top,bottom:L.bottom};if(!!N===false){L.left+=Math.max(R.scrollLeft,M.scrollLeft);L.right+=Math.max(R.scrollLeft,M.scrollLeft);L.top+=Math.max(R.scrollTop,M.scrollTop);L.bottom+=Math.max(R.scrollTop,M.scrollTop)}else{if(coherent.Browser.MobileSafari){L.top-=window.pageYOffset;L.bottom-=window.pageYOffset;L.left-=window.pageXOffset;L.right-=window.pageXOffset}}L.left-=R.clientLeft;L.right-=R.clientLeft;L.top-=R.clientTop;L.bottom-=R.clientTop;L.width=L.right-L.left;L.height=L.bottom-L.top;return L}var J=P.parentNode;var F=P;var A=P.offsetParent;var K=coherent.Browser.Mozilla;var Q=coherent.Browser.Safari&&!coherent.Browser.Safari2;var B=coherent.Browser.Safari2;var H=Element.getStyles;var G=Element.getDimensions(P);var C=("fixed"===Element.getStyles(P,"position"));var I;D+=P.offsetLeft;O+=P.offsetTop;while(!C&&A){D+=A.offsetLeft;O+=A.offsetTop;if(K&&!((/^t(able|d|h)$/i).test(A.tagName))||Q){I=H(A,["borderLeftWidth","borderTopWidth"]);D+=parseInt(I.borderLeftWidth||0,10);O+=parseInt(I.borderTopWidth||0,10)}if(!C){C=("fixed"===H(A,"position"))}if("BODY"!==A.tagName){F=A}A=A.offsetParent}var E=K?["display","overflow","borderLeftWidth","borderTopWidth"]:["display"];while(J&&J.tagName&&"BODY"!==J.tagName&&"HTML"!==J.tagName){I=H(J,E);if(!((/^inline|table.*$/i).test(I.display))){D-=J.scrollLeft;O-=J.scrollTop}if(K&&"visible"!=I.overflow){D+=parseInt(I.borderLeftWidth||0,10);O+=parseInt(I.borderTopWidth||0,10)}J=J.parentNode}var S=H(F,"position");if((B&&(C||S=="absolute"))||(K&&S!="absolute")){D-=M.offsetLeft;O-=M.offsetTop}if(N===true&&!C){D-=Math.max(window.pageXOffset,R.scrollLeft,M.scrollLeft);O-=Math.max(window.pageYOffset,R.scrollTop,M.scrollTop)}return{left:D,top:O,right:D+G.width-1,bottom:O+G.height-1,width:G.width,height:G.height}},offsetFromAncestor:function(B,A){var C=B&&B.offsetWidth&&{top:B.offsetTop,left:B.offsetLeft,width:B.offsetWidth,height:B.offsetHeight};A=C&&(A||document.body);while(A&&B&&A!==B){B=B.parentNode;C.top+=B.offsetTop;C.left+=B.offsetLeft}return C},locateAncestor:function(C,B,A){if(typeof B!="function"){throw new TypeError("Qualifier must be a function")}A=A||document.documentElement;while(C&&C!=A){if(B(C)){return C}C=C.parentNode}return null},scrollDocumentTopBy:function(A){document.documentElement.scrollTop=document.body.scrollTop=A},scrollDocumentLeftBy:function(A){document.documentElement.scrollLeft=document.body.scrollLeft=A},getDocumentScrollTop:function(){return document.documentElement.scrollTop||document.body.scrollTop},getDocumentScrollLeft:function(){return document.documentElement.scrollLeft||document.body.scrollLeft},isFixedPositionSupported:function(){var A=document.body;var F=4;var C=A.appendChild(document.createElement("DIV"));var H=C.appendChild(document.createElement("DIV"));var G=Element.getDocumentScrollTop();var E;var B;var D=true;if(A.getBoundingClientRect){C.style.cssText="position:relative;height:9999px;width:1px;";H.style.cssText="position:fixed;top:1px;width:1px;height:1px;";Element.scrollDocumentTopBy(0);E=H.getBoundingClientRect().top;Element.scrollDocumentTopBy(F);B=H.getBoundingClientRect().top;D=(E===B||B<0)&&Element.getDocumentScrollTop()===F;Element.scrollDocumentLeftBy(G)}A.removeChild(C);return D}});Element.getStyle=Element.getStyles;Element.assignId.uniqueId=1;if(!coherent.Support.QuerySelector){Object.extend(Element,{query:function(B,A){if(1==arguments.length){A=B;B=document}return(Sizzle(A,B)[0]||null)},queryAll:function(B,A){if(1==arguments.length){A=B;B=document}return(Sizzle(A,B)||null)}})}(function(){var A=this.Event;this.Event={};Object.extend(this.Event,A||{})}).call(window);Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_CLEAR:12,KEY_RETURN:13,KEY_SHIFT:16,KEY_CTRL:17,KEY_ALT:18,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,KEY_CAPSLOCK:20,KEY_LEFTCOMMAND:91,KEY_RIGHTCOMMAND:93,KEY_MOZILLACOMMAND:224,KEY_RIGHTWINDOWSSTART:92,MOUSE_LEFT:1,MOUSE_RIGHT:3,shiftKey:false,_domHasFinishedLoading:function(){if(arguments.callee.done){return }arguments.callee.done=true;if(Event._domLoadedTimer){window.clearInterval(Event._domLoadedTimer)}var C=Event._readyCallbacks;var A=C.length;var B;for(B=0;B<A;++B){C[B]()}Event._readyCallbacks=null},observe:function(C,A,B){if("on"==A.slice(0,2)){A=A.slice(2)}C.addEventListener(A,B,false)},stopObserving:function(C,A,B){if("on"==A.slice(0,2)){A=A.slice(2)}C.removeEventListener(A,B,false)},stop:function(A){A.preventDefault();A.stopPropagation()},preventDefault:function(A){A.preventDefault()},onDomReady:function(A){if(Event._domHasFinishedLoading.done){window.setTimeout(A,0);return }if(!Event._readyCallbacks){document.addEventListener("DOMContentLoaded",Event._domHasFinishedLoading,false);function B(){if((/loaded|complete/).test(document.readyState)){Event._domHasFinishedLoading()}}if(coherent.Browser.Safari){Event._domLoadedTimer=window.setInterval(B,10)}Event.observe(window,"load",Event._domHasFinishedLoading);Event._readyCallbacks=[]}Event._readyCallbacks.push(A)},isModifiedKey:function(A){return !!(A.altKey||A.ctrlKey||A.metaKey)},isMetaKey:function(A){switch(A.keyCode){case this.KEY_TAB:case this.KEY_CLEAR:case this.KEY_RETURN:case this.KEY_SHIFT:case this.KEY_CTRL:case this.KEY_ALT:case this.KEY_ESC:case this.KEY_LEFT:case this.KEY_UP:case this.KEY_RIGHT:case this.KEY_DOWN:case this.KEY_HOME:case this.KEY_END:case this.KEY_PAGEUP:case this.KEY_PAGEDOWN:case this.KEY_INSERT:case this.KEY_CAPSLOCK:case this.KEY_LEFTCOMMAND:case this.KEY_RIGHTCOMMAND:case this.KEY_MOZILLACOMMAND:case this.KEY_RIGHTWINDOWSSTART:return true;break;default:break}return false}});coherent.PartFinder=(function(){function C(G,E){var H=G.length;var D=Array.from(E);function I(){G=[];D=null;H=0}function M(P){G.splice(P,1);if(D){D.splice(P,1)}H=G.length}function F(P){var R=Element.assignId(P);var Q=G.indexOf(R);if(-1==Q){return }G.splice(Q,1);if(D){D.splice(Q,1)}H=G.length}function O(R,Q){var P=Element.assignId(R);G.splice(Q,0,P);if(D){D.splice(Q,0,R)}H=G.length}function N(P){G.push(Element.assignId(P));H=G.length;if(D){D.push(P)}}function K(){D=null}function J(){var R=[];var P;for(var Q=0;Q<H;++Q){P=document.getElementById(G[Q]);if(!P){continue}R.push(G[Q])}G=R;H=R.length;D=null}function L(R){if(D){if(1==arguments.length){return D[R]}return D}if(1==arguments.length){return document.getElementById(G[R])}var P=[];for(var Q=0;Q<H;++Q){P[Q]=document.getElementById(G[Q])}D=P;window.setTimeout(K,250);return P}if(E){window.setTimeout(K,250)}L.removePartAtIndex=M;L.removePart=F;L.insertPartAtIndex=O;L.add=N;L.removeAll=I;L.refresh=J;return L}function A(G,E){var D=E;function F(){D=null}function H(){if(D){return D}D=document.getElementById(G);window.setTimeout(F,250);return D}return H}function B(E,D){var F=Element.queryAll(E,D);var G=Array.map(F,Element.assignId);return{nodes:F,ids:G}}return{singlePart:function(E,D){function F(){var K=D;var G=typeof (K);if("function"===G){K=K()}else{if("string"===G){K=document.getElementById(K)}else{if(!K){K=this.viewElement()}}}var H=B(K,E);var J=A(H.ids[0],H.nodes[0]);var I=Class.findPropertyName(this,arguments.callee);if(I){this[I]=J}return H.nodes[0]}return F},multipleParts:function(E,D){function F(I){var L=D;var G=typeof (L);if("function"===G){L=L()}else{if("string"===G){L=document.getElementById(L)}else{if(!L){L=this.viewElement()}}}var H=B(L,E);var K=C(H.ids,H.nodes);var J=Class.findPropertyName(this,arguments.callee);if(J){this[J]=K}if(arguments.length){return H.nodes[I]}else{return Array.from(H.nodes)}}return F}}})();var Part=coherent.PartFinder.singlePart;var PartList=coherent.PartFinder.multipleParts;coherent.Style={kSelectedClass:"selected",kDisabledClass:"disabled",kReadOnlyClass:"read-only",kMarkerClass:"nullValue",kFocusClass:"focused",kHoverClass:"hover",kAscendingClass:"asc",kDescendingClass:"desc",kActiveClass:"active",kEditingClass:"editing",kUpdatingClass:"updating",kFadingClass:"invisible",kInvalidValueClass:"invalid",kInsertedClass:"inserted",kDeletedClass:"deleted",kReplacingClass:"replacing",kLoadingClass:"loading",kFirstClass:"first",kLastClass:"last"};coherent.Style.__styles=(function(){var A=[];var B=coherent.Style;for(var C in B){A.push(B[C])}return A})();coherent.setupSelectors=function(B,H,E){B=B||document.body;var A;var D;var G;var C=Element.queryAll;function F(J){for(var I in G){J.setAttribute(I,G[I])}}for(A in H){D=C(B,A);G=H[A];Array.forEach(D,F)}coherent.View.createViewsForNodeTree(B,E)};window.FIRST_RESPONDER="__first_responder__";coherent.Responder=Class.create(coherent.Bindable,{sendActionToView:function(B,A){if(FIRST_RESPONDER===A){A=coherent.page.firstResponder}var C=A||coherent.page.firstResponder||this;while(C){if(B in C){C[B](this);return true}C=C.nextResponder()}return false},acceptsFirstResponder:function(){return false},becomeFirstResponder:function(){return true},resignFirstResponder:function(){return true},nextResponder:function(){return this.__nextResponder||null},setNextResponder:function(A){this.__nextResponder=A},presentError:function(B){this.willPresentError(B);if(!("field" in B)){B.field=this}var A=this.nextResponder();if(A){return A.presentError(B)}return false},clearAllErrors:function(B){var A=this.nextResponder();if(A){A.clearAllErrors(B||this)}},willPresentError:function(A){},onmousedown:function(A){var B=this.nextResponder();if(B){B.onmousedown(A)}},onmouseup:function(A){var B=this.nextResponder();if(B){B.onmouseup(A)}},onmousedrag:function(A){var B=this.nextResponder();if(B){B.onmousedrag(A)}},onmouseenter:function(A){var B=this.nextResponder();if(B){B.onmouseenter(A)}},onmouseleave:function(A){var B=this.nextResponder();if(B){B.onmouseleave(A)}},onclick:function(A){var B=this.nextResponder();if(B){B.onclick(A)}},ondblclick:function(A){var B=this.nextResponder();if(B){B.ondblclick(A)}},onkeydown:function(A){var B=this.nextResponder();if(B){B.onkeydown(A)}},onkeyup:function(A){var B=this.nextResponder();if(B){B.onkeyup(A)}},onkeypress:function(A){var B=this.nextResponder();if(B){B.onkeypress(A)}},ontouchstart:function(A){var B=this.nextResponder();if(B){B.ontouchstart(A)}},ontouchmove:function(A){var B=this.nextResponder();if(B){B.ontouchmove(A)}},ontouchend:function(A){var B=this.nextResponder();if(B){B.ontouchend(A)}}});coherent.View=Class.create(coherent.Responder,{__viewClassName__:"View",__tagSpec__:["div","b","strong","em","i","q","p","span","li","h1","h2","h3","h4","td","label"],multipleValuesPlaceholder:_("marker.text.multipleValues"),nullPlaceholder:_("marker.text.placeholder"),noSelectionPlaceholder:_("marker.text.noSelection"),exposedBindings:["visible","class","enabled","editable","html","text","tabindex","title"],automaticallySetupBindings:false,requireBindingsForInferredViewType:true,formatter:null,target:null,action:null,sendActionOn:["click"],animated:false,updateAnimationDuration:0,updateAnimationDelay:0,postUpdateAnimationDuration:0,postUpdateAnimationDelay:0,preUpdateAnimationDuration:0,preUpdateAnimationDelay:0,constructor:function(A,B,C){this.base(C);if("string"===typeof (A)){this.id=A;this.__view=document.getElementById(A)}else{this.id=Element.assignId(A);this.__view=A}if(B&&!("addObserverForKeyPath" in B)){coherent.KVO.adaptTree(B)}this.__relativeSource=B;if(this.id in coherent.View.viewLookup){throw new Error("Two views share the same ID: "+this.id)}this.__updating=null;coherent.View.viewLookup[this.id]=this},__postConstruct:function(){var B=this;function C(){delete B.__view;delete B.__container}C.delay(250);var A=this.viewElement();if(A){this.__init()}else{Event.onDomReady(this.__init.bind(this))}},__init:function(){this.__initialising=true;var F=this.viewElement();if(!F){throw new Error("Unable to locate node with ID: "+this.id)}this.viewElement=function(){return F};var G;var A;if("true"===F.getAttribute("animated")){this.animated=true}var B=F.getAttribute("__parametersId");var H=this.__parameters||coherent.View.nodeParameters[B]||{};this.__copyParameters(H);if(this.innerHTML&&""===String(F.innerHTML).trim()){F.innerHTML=this.innerHTML}var I=coherent.dataModel;var C=this.__context;coherent.dataModel=this.__context=this;var D=this.structure()||{};var E={};for(A in D){G=D[A];if(G&&"function"==typeof (G)&&(G=G.valueOf()).__factoryFn__){E[A]=G;G.call(this,A,true)}}for(A in E){E[A].call(this,A,false)}this.__context=C;coherent.dataModel=I;this.setupBindings();this.init();this.updateBindings();this.createObservers();delete this.__initialising;delete this.viewElement},bindingInfoForName:function(C){var B=this.viewElement();var A=C+"Binding";return B.getAttribute(A)||this.__parameters[A]||this.__parameters[C]},teardown:function(){for(var A in this.bindings){this.bindings[A].unbind()}delete coherent.View.viewLookup[this.id]},__factory__:function(B,G,D){var A=this;var E=Element.queryAll;if("string"!==typeof (B)){D=G;G=B;B=null}G=G||{};var F="parameters_"+coherent.generateUid();coherent.View.nodeParameters[F]=G;G.viewClass=A;function H(I){I.setAttribute("__parametersId",F);if("sortKey" in G){I.setAttribute("sortKey",G.sortKey)}}function C(J){if(!J.getAttribute("__parametersId")){H(J)}var K=this.__relativeSource||this;var I=coherent.View.fromNode(J)||new A(J,K);coherent.View.createViewsForNodeTree(J,K,this.__context)}return function(M,J){if(M&&1===M.nodeType){return new A(M,J,G)}var N=D||(this?this.viewElement():document);var K=B||M;var I;if(/^#\S+$/.test(K)){var L=document.getElementById(K.substring(1));I=L?[L]:[]}else{I=E(N,K)||[]}if(!I.length){return null}if("action" in G){if(!G.target||G.target!==FIRST_RESPONDER){G.target=this}if(FIRST_RESPONDER!==G.target&&"string"===typeof (G.action)){G.action=(G.target)[G.action]}}Array.forEach(I,J?H:C,this);return coherent.View.fromNode(I[0])}},init:function(){var A=this.viewElement();var G=this.bindings;if(G["class"]&&!G["class"].hasValue()){var B=$S(A.className.split(" "));function E(H){delete B[H]}coherent.Style.__styles.forEach(E);var F=Set.join(B," ");G["class"].setValue(F)}if(G.enabled&&!G.enabled.hasValue()){G.enabled.setValue(!A.disabled)}if(G.text&&!G.text.hasValue()){var C=(A.textContent||A.innerText||"").trim();if(C){G.text.setValue(C)}}if(G.html&&!G.html.hasValue()){var D=(A.innerHTML||"").trim();if(D){G.html.setValue(D)}}if(G.title&&!G.title.hasValue()&&A.title){G.title.setValue(A.title)}},structure:function(){return this.__structure__},viewElement:function(){return this.__view||document.getElementById(this.id)},container:function(){return this.__container||this.__view||document.getElementById(this.__containerId||this.id)},setContainer:function(A){if(this.__view){this.__container=A}this.__containerId=Element.assignId(A);return A},superview:function(){var B=this.viewElement();if(!B){return null}var A=null;while(B&&!A){B=B.parentNode;if(!B){return null}if(document==B){return coherent.page}A=coherent.View.fromNode(B)}return A},isDescendantOf:function(B){if(!B){return false}var A=B.viewElement();var C=this.viewElement();while(C&&C!==document.body){if(C.id==A.id){return true}C=C.parentNode}return false},nextResponder:function(){return this.__nextResponder||this.superview()},focus:function(){var A=this.viewElement();function C(){A.focus()}if(coherent.Browser.IE){var B=/^(?:a|button|iframe|input|label|select|textarea)$/i;if(B.test(A.nodeName)){this.focus=C;C()}else{this.focus=function(){}}return }else{this.focus=C;C()}},blur:function(){var A=this.viewElement();function C(){A.blur()}if(coherent.Browser.IE){var B=/^(?:a|button|iframe|input|label|select|textarea)$/i;if(B.test(A.nodeName)){this.blur=C;C()}else{this.blur=function(){}}return }else{this.blur=C;C()}},setDelegate:function(A){this.delegate=A},sendToDelegate:function(A){if(this.delegate&&"function"==typeof (this.delegate[A])){this.delegate[A](this)}},sendAction:function(){var B=coherent.EventLoop.currentEvent;if(!this.action){return }if(FIRST_RESPONDER!==this.target||"string"!==typeof (this.action)){this.action.call(this.target||this.action,this,B);return }var A=coherent.page.firstResponder||this;var C=this.action;while(A){if(C in A){A[C](this,B);return }A=A.nextResponder()}},onclick:function(A){if(this.disabled){Event.stop(A);return }if(this.action&&this.sendActionOn.containsObject("click")){this.sendAction();Event.stop(A)}else{this.base(A)}},addTrackingInfo:function(A){coherent.page.addTrackingInfo(this.id,A)},observeVisibleChange:function(F,E,B){var A=this.viewElement();var D=coherent.Style.kFadingClass;function C(){A.style.display="none";Element.removeClassName(A,D)}if(!this.animated||this.__initialising){A.style.display=(F.newValue?"":"none")}else{if(F.newValue){if(A.style.display!==""){Element.addClassName(A,D);A.style.display=""}coherent.Animator.removeClassName(A,D,{duration:this.updateAnimationDuration||300})}else{coherent.Animator.addClassName(A,D,{duration:this.updateAnimationDuration||300,callback:C})}}},observeEnabledChange:function(B){var A=this.viewElement();this.disabled=A.disabled=!B.newValue;if(A.disabled){Element.addClassName(A,coherent.Style.kDisabledClass)}else{Element.removeClassName(A,coherent.Style.kDisabledClass)}},observeEditableChange:function(B){var A=this.viewElement();A.readOnly=!B.newValue;if(A.readOnly){Element.addClassName(A,coherent.Style.kReadOnlyClass)}else{Element.removeClassName(A,coherent.Style.kReadOnlyClass)}},observeClassChange:function(H,G,D){var A=this.viewElement();var C=$S(A.className.split(" "));var F=$S((H.newValue||"").split(" "));function E(I){if(I in C){Set.add(F,I)}}coherent.Style.__styles.forEach(E);var B=Set.join(F," ");if(this.animated&&!this.__initialising){coherent.Animator.setClassName(A,B,{duration:500})}else{A.className=B}},translateValue:function(C){var A=this.viewElement();var B=true;if(this.formatter){C=this.formatter.stringForValue(C)}switch(C){case"":case null:case undefined:C=this.attributeOrProperty("nullPlaceholder");break;case coherent.Markers.NoSelection:C=this.attributeOrProperty("noSelectionPlaceholder");break;case coherent.Markers.MultipleValues:C=this.attributeOrProperty("multipleValuesPlaceholder");break;default:C=String(C);B=false;break}if(B){Element.addClassName(A,coherent.Style.kMarkerClass)}else{Element.removeClassName(A,coherent.Style.kMarkerClass)}return C},_beginUpdate:function(H,F){var C=(this.preUpdateAnimationDuration||this.updateAnimationDuration||this.postUpdateAnimationDuration)===0;if(C&&H){H.call(this);return }F=F||coherent.Style.kUpdatingClass;var A=this.viewElement();var E=this;if(this.__updating){this.__updating=H||null;return }this.__updating=H||null;function B(){if(E.__updating){E.__updating.call(E)}E.__updating=null;var J=E.postUpdateAnimationDuration||E.updateAnimationDuration;var I=E.postUpdateAnimationDelay||E.updateAnimationDelay;coherent.Animator.removeClassName(A,F,{duration:J,delay:I})}var G=this.preUpdateAnimationDuration||this.updateAnimationDuration;var D=this.preUpdateAnimationDelay||this.updateAnimationDelay||0;coherent.Animator.addClassName(A,F,{duration:G,callback:B})},observeTitleChange:function(D,C,B){var A=this.viewElement();A.title=D.newValue},observeTextChange:function(F,E,B){var A=this.viewElement();var D=(this.translateValue(F.newValue)||"").trim();if(this.lastText===D){return }this.lastText=D;function C(){var G=document.createTextNode(D);A.innerHTML="";A.appendChild(G)}this._beginUpdate(C)},observeHtmlChange:function(H,G,B){var A=this.viewElement();var F=H.newValue;if("string"===typeof (F)){F=F.trim()}var D=(this.translateValue(F)||"").trim();function C(){var I=document.createTextNode(D);A.innerHTML="";A.appendChild(I)}function E(){Element.setInnerHTML(A,D)}if(D!==F){if((A.textContent||A.innerText||"").trim()===D){return }this._beginUpdate(C)}else{if((A.innerHTML||"").trim()===D){return }this._beginUpdate(E)}},observeTabindexChange:function(F,E,B){var A=this.viewElement(),D=F.newValue,C="tabindex";if(D!==0&&!D){A.removeAttribute(C)}else{A.setAttribute(C,D)}},removeChild:function(A){if(!A){return null}coherent.View.teardownViewsForNodeTree(A);if(this.beforeRemoveElement){this.beforeRemoveElement(A)}return A.parentNode.removeChild(A)},attributeOrProperty:(function(){if(coherent.Browser.IE){return function(B){var A=this.viewElement();var C=A[B];if(C||""===C){return C}return String(this[B])}}else{return function(B){var A=this.viewElement();var C=A.getAttribute(B);if(C||""===C){return C}C=A[B];if(C||""===C){return C}return String(this[B])}}})()});coherent.View.nodeParameters={};coherent.View.viewLookup={};coherent.View.registry={};coherent.View.tagToViewLookup={};coherent.View.tagSpecRegex=/^(\w+)\s*(?:\[(\w*)\s*=\s*(\w*)\s*\])?$/;coherent.View.__updateTagSpecTable=function(C){var B=C.prototype;function D(E){var G=E.match(coherent.View.tagSpecRegex);if(!G){throw new Error("Invalid view spec: "+E)}var H=G[1].toUpperCase();var F=G[2];var I=G[3];var J=coherent.View.tagToViewLookup[H]||{};if(!(H in coherent.View.tagToViewLookup)){coherent.View.tagToViewLookup[H]=J}if(!F){if(J.viewClass){console.log((B.__viewClassName__+": "||"")+"Redefining view spec: "+E+": previously registered to "+(J.viewClass.prototype.__viewClassName__||"unknown"));throw new Error("Redefining view spec: "+E)}J.viewClass=C;return }if(!J.attr){J.attr={}}if(!(F in J.attr)){J.attr[F]={}}if(I in J.attr[F]){console.log((B.__viewClassName__+": "||"")+"Redefining view spec: "+E+": previously registered to "+(J.viewClass.prototype.__viewClassName__||"unknown"));throw new Error("Redefining view spec: "+E)}J.attr[F][I]=C}if(B.hasOwnProperty("__tagSpec__")){var A=B.__tagSpec__;if("string"==typeof (A)){D(A)}else{if("forEach" in A){A.forEach(D)}else{console.log("Invalid type for __tagSpec__")}}}if(B.hasOwnProperty("__viewClassName__")){coherent.View.registry[B.__viewClassName__]=C}};coherent.View.__subclassCreated__=function(A){if(!coherent.View.registry){coherent.View.registry={}}var B=A.prototype;var C=A.superclass.prototype;coherent.View.__updateTagSpecTable(A);if(B.__structure__!==C.__structure__){Object.applyDefaults(B.__structure__,C.__structure__)}};coherent.View.viewClassForNode=function(F,D){function A(S){var O=[];var R=S.split(" ");var Q;var P=coherent.View.registry;for(Q=0;Q<R.length;++Q){if(R[Q] in P){O[O.length]=P[R[Q]]}}return O}var H=F.getAttribute("view");var C=F.getAttribute("__parametersId");var J;if(C){return coherent.View.nodeParameters[C].viewClass}if(H){J=coherent.View.registry[H];if(!J){throw new InvalidArgumentError("Invalid view type: "+H)}return J}var E=A(F.className)||0;if(1==E.length){return E[0]}if(E.length>1){throw new InvalidArgumentError("CSS class matches multiple view types: "+F.className)}var G=coherent.View.tagToViewLookup[F.tagName];if(!G){return null}var I;var L;var M=G.attr||{};var N;for(var B in M){N=M[B];L=F.getAttribute(B);if(L in N){J=N[L];break}L=F[B];if(L in N){I=N[L]}}J=J||I||G.viewClass;if(!J){return null}function K(R){var S=J.prototype.exposedBindings||[];var O=S.length;var Q;var P;for(P=0;P<O;++P){Q=S[P]+"Binding";if(R.getAttribute(Q)){return true}}return false}if(!D&&J.prototype.requireBindingsForInferredViewType&&!K(F)){return null}return J};coherent.View.createViewForNode=function(C,E,B){var A=coherent.View.fromNode(C);if(A){return A}var D=coherent.View.viewClassForNode(C,B);return new (D||coherent.View)(C,E,B)};coherent.View.fromNode=function(A){var B=coherent.View.viewLookup;if(!B||!B[A.id]){return null}return B[A.id]};coherent.View.rebindNodeTreeWithRelativeSource=function(C,E,D){var A=coherent.ListView;function B(G){var F=coherent.View.fromNode(G);if(!F||(E&&F.__relativeSource!==E)){return true}F.__relativeSource=D;F.setupBindings();F.updateBindings();if(F instanceof A){return false}}Element.depthFirstTraversal(C,B)};coherent.View.unbindNodeTree=function(B){function A(D){var C=coherent.View.fromNode(D);if(!C){return }C.unbind()}Element.depthFirstTraversal(B,A)};coherent.View.createViewsForNodeTree=function(E,C,D){function B(F){if(coherent.View.fromNode(F)){return }var G=coherent.View.viewClassForNode(F);if(!G){return }new (G)(F,C)}var A=coherent.dataModel;if(D){coherent.dataModel=D}Element.depthFirstTraversal(E||document.body,B);if(D){coherent.dataModel=A}};coherent.View.teardownViewsForNodeTree=function(A){function B(D){var C=coherent.View.fromNode(D);if(!C){return }C.teardown()}Element.depthFirstTraversal(A||document.body,B)};coherent.View.__updateTagSpecTable(coherent.View);coherent.Anchor=Class.create(coherent.View,{__viewClassName__:"Anchor",__tagSpec__:"a",exposedBindings:["href"],init:function(){this.base();var A=this.viewElement();var B=this.bindings;if(B.href&&!B.href.hasValue()&&A.href){B.href.setValue(A.href)}},observeHrefChange:function(B){var A=this.viewElement();A.href=B.newValue}});coherent.ListView=Class.create(coherent.View,{__viewClassName__:"List",__tagSpec__:["table","ul"],exposedBindings:["content","selectionIndexes","selectedIndex","selectedObject"],_items:null,_activeItem:-1,init:function(){this.base();this.objectCache={};var B=this.viewElement();var A;switch(B.tagName){case"SELECT":this._isSelectElement=true;this._items=PartList("option");this.templateElement=document.createElement("option");Event.observe(B,"change",this.selectedIndexChanged.bindAsEventListener(this));break;case"TABLE":A=this.setContainer(B.tBodies[0]);this._items=PartList("> tbody tr");this.templateElement=Element.clone(this._items(0));break;default:A=this.container();var C=B.firstChild;while(C){if(1===C.nodeType){break}C=C.nextSibling}if(!C){return }this._items=PartList("> "+C.nodeName);this.templateElement=Element.clone(C);break}this._items();if("true"===(this.attributeOrProperty("multiple")||"").toLowerCase()){this.multiple=true}this.templateElement.id="";if(this.template&&"function"!==typeof (this.template)){delete this.template}if(this.template&&!(this.template.valueOf()).__factoryFn__){this.template=this.template()}if(!this.template&&this.initFromDOM!==false){this._initFromDOM()}else{if(A){while(A.firstChild){A.removeChild(A.firstChild)}}}},computeSelectionIndexes:function(){var B=[];var A=this._items();function C(E,D){if(E.selected){B.push(D)}}A.forEach(C);return B},_initFromDOM:function(){var B=this.container();var L=this.viewElement();var C=this.bindings;var G=[];var N=[];var J=[];var K=this._items();var H=K.length;var I;if(!H||(C.content&&C.content.hasValue())){return }var D=this.objectClass||coherent.KVO;var A=coherent.Style.kSelectedClass;var M=Element.hasClassName;for(var F=0;F<H;++F){I=K[F];var E=J[F]=new D();if(I.selected||M(I,A)){G.push(F);N.push(E)}this.setupElement(I,E)}this.__selectionIndexes=G;this.selectedIndex=G.length?G[0]:-1;this.__content=J;if(C.content){C.content.setValue(J)}if(C.selectionIndexes){C.selectionIndexes.setValue(G)}if(C.selectedObject){C.selectedObject.setValue(N[0])}if(C.selectedIndex){C.selectedIndex.setValue(this.selectedIndex)}},acceptsFirstResponder:function(){var A=this.viewElement();if(A.disabled||A.readOnly){return false}return true},highlightSelectionIndexes:function(D){var K=this.viewElement();var J=this._items();var G=J.length;var E;var F=0;var B=!!this._isSelectElement;var C;var A=coherent.Style.kSelectedClass;var I;var L;if(this.animated){var M={curve:coherent.easing.inOutSine,duration:300};I=function(O,N){coherent.Animator.addClassName(O,N,M)};L=function(O,N){coherent.Animator.removeClassName(O,N,M)}}else{I=Element.addClassName;L=Element.removeClassName}for(E=0;E<G;++E){if(E===0){Element.addClassName(J[E],coherent.Style.kFirstClass)}else{Element.removeClassName(J[E],coherent.Style.kFirstClass)}if(G>1&&E===G-1){Element.addClassName(J[E],coherent.Style.kLastClass)}else{Element.removeClassName(J[E],coherent.Style.kLastClass)}C=(E==D[F]);try{J[E].selected=C}catch(H){J[E].setAttribute("selected",C)}if(C){F++}if(B){continue}if(C){I(J[E],A)}else{L(J[E],A)}}if(1===D.length){this.selectedIndex=K.selectedIndex=D[0]}this.__selectionIndexes=D},selectionIndexes:function(){return this.__selectionIndexes},setSelectionIndexes:function(E){var A;var B=this.viewElement();var F=this.bindings;E=(E||[]).concat().sort();if(String(E)===String(this.__selectionIndexes)){E=this.__selectionIndexes}if(1===E.length){A=this.selectedIndex=B.selectedIndex=E[0]}else{if(E.length){A=B.selectedIndex=E[0]}else{A=B.selectedIndex=-1}}if(F.selectionIndexes){F.selectionIndexes.setValue(E)}if(F.selectedIndex){F.selectedIndex.setValue(A)}if(F.selectedObject&&F.content){var C=null;if(-1!==A){C=(this.__content||[])[A]}F.selectedObject.setValue(C)}if(F.selectedValue){var D=null;if(-1!==A){D=B.options[A].value}F.selectedValue.setValue(D)}this.__selectionIndexes=E;this.highlightSelectionIndexes(E)},selectedObjects:function(){var A=this.__content||[];return A.objectsAtIndexes(this.selectionIndexes()||[])},onkeydown:function(B){var J=this.viewElement();if(J.disabled){return }if(Event.KEY_UP!=B.keyCode&&Event.KEY_DOWN!=B.keyCode){return }Event.stop(B);var I=this.selectionIndexes();var E=(this.__content||[]).length-1;var L;if(this.multiple&&B.shiftKey&&I.length){var H=(this.selectedIndex==I[0]);var G=I[0];var K=I[I.length-1];if(1==I.length){if(Event.KEY_UP==B.keyCode){L=G-1}else{L=G+1}if(L<0||L>E){return }I.push(L)}else{if(H){if(Event.KEY_UP==B.keyCode){I.length--}else{if(K<E){I.push(L=K+1)}}}else{if(this.KEY_DOWN==B.keyCode){I.splice(0,1)}else{if(G>0){I.push(L=G-1)}}}}}else{if(!I.length){if(Event.KEY_UP==B.keyCode){this.selectedIndex=E}else{if(Event.KEY_DOWN==B.keyCode){this.selectedIndex=0}}I=[L=this.selectedIndex]}else{if(Event.KEY_UP==B.keyCode&&this.selectedIndex>0){this.selectedIndex--}else{if(Event.KEY_DOWN==B.keyCode&&this.selectedIndex<E){this.selectedIndex++}}I=[L=this.selectedIndex]}}if(!isNaN(L)){var N=this._items(L);var M=Element.scrollParent(J);var F=M.offsetHeight;var C=N.offsetTop-M.scrollTop;var D=N.offsetHeight;var A=this.container();if(N.offsetParent!==A){C-=A.offsetTop}if(C<0){N.scrollIntoView(true)}else{if(C+D>F){N.scrollIntoView(false)}}}this.setSelectionIndexes(I);return },selectedIndexChanged:function(C){if(!this.bindings.selectionIndexes&&!this.bindings.selectedIndex&&!this.bindings.selectedObject&&!this.bindings.selectedValue){return }var A=this.viewElement();var B;if(this.multiple){B=this.computeSelectionIndexes()}else{B=[this.selectedIndex=A.selectedIndex]}this.setSelectionIndexes(B)},_clearSelection:function(){var A=this.viewElement();var E=("SELECT"!==A.tagName);var F=Element.removeClassName;var C=coherent.Style.kSelectedClass;function D(G){G.selected=false;if(E){F(G,C)}}var B=this._items();B.forEach(D);A.selectedIndex=-1},observeSelectedIndexChange:function(D){var C=D.newValue;var B=(-1!==C&&null!==C&&"undefined"!==typeof (C));var A=B?[C]:[];this.setSelectionIndexes(A)},observeSelectedObjectChange:function(E){var D=E.newValue;var C=this.__content||[];var A=C.indexOf(D);var B=(-1===A?[]:[A]);this.setSelectionIndexes(B)},observeSelectionIndexesChange:function(B){var A=B.newValue||[];this.setSelectionIndexes(A)},_updateDomWithContent:function(J){this._items.refresh();var L=coherent.View.rebindNodeTreeWithRelativeSource;var P=coherent.View.unbindNodeTree;var Q=this.selectedObjects();var H=[];var C=J.length;var K=this._items();var M=K.length;var E=Math.min(M,C);var G=0;var F;var I;var A;var N;var D;while(G<E){F=J[G];if(-1!==Q.indexOf(F)){H.push(G)}I=K[G];D=Element.assignId(I);A=this.objectCache[D];this.objectCache[D]=F;if("undefined"===typeof (A)){this.setupElement(I,F)}else{L(I,A,F)}N=coherent.View.fromNode(I);if(!N||!N.bindings.visible){I.style.display=""}++G}if(G<C){var B=this.container();var O=document.createDocumentFragment();while(G<C){F=J[G];if(-1!==Q.indexOf(F)){H.push(G)}I=this.createElement(F,null,O);this._items.add(I);++G}B.appendChild(O)}else{while(G<M){I=K[G];D=Element.assignId(I);P(I);this.objectCache[D]=null;if("SELECT"==this.viewElement().tagName){I.parentNode.removeChild(I);this._items.removePart(I);--M}else{I.style.display="none";++G}}}this.highlightSelectionIndexes(H)},observeContentChange:function(K){var B=this.container();var M=this.viewElement();var G;var L;var I;var J;var H;var F=[];var N=coherent.View.rebindNodeTreeWithRelativeSource;var O=coherent.View.unbindNodeTree;var A=this.objectCache;function D(R,Q){var S=Element.assignId(S);var P=A[S];A[S]=Q;N(R,P,Q);R.style.display=""}switch(K.changeType){case coherent.ChangeType.setting:this.__content=K.newValue||[];this._updateDomWithContent(this.__content);break;case coherent.ChangeType.insertion:for(G=0;G<K.indexes.length;++G){L=this._items(K.indexes[G]);if(L&&"none"===L.style.display){I=L;D(L,K.newValue[G])}else{I=this.createElement(K.newValue[G],L);this._items.insertPartAtIndex(I,K.indexes[G])}if(this.animated){Element.addClassName(I,coherent.Style.kInsertedClass);coherent.Animator.removeClassName(I,coherent.Style.kInsertedClass,{discreteTransitionPoint:1,duration:this.updateAnimationDuration})}}break;case coherent.ChangeType.replacement:function E(Q,P){D(Q,P);coherent.Animator.removeClassName(Q,coherent.Style.kReplacingClass,{duration:250,discreteTransitionPoint:1})}for(G=0;G<K.indexes.length;++G){I=this._items(K.indexes[G]);if(!this.animated){D(I,K.newValue[G])}else{coherent.Animator.addClassName(I,coherent.Style.kReplacingClass,{duration:this.updateAnimationDuration,discreteTransitionPoint:0,callback:E.bind(this,K.newValue[G])})}}break;case coherent.ChangeType.deletion:F=this.selectionIndexes();for(G=K.indexes.length-1;G>=0;--G){var C=K.indexes[G];F.removeObject(C);I=this._items(C);this._items.removePartAtIndex(C);if(!this.animated){this.removeChild(I)}else{coherent.Animator.addClassName(I,coherent.Style.kDeletedClass,{duration:this.updateAnimationDuration,discreteTransitionPoint:0,callback:this.removeChild.bind(this)})}}this.setSelectionIndexes(F);break;default:console.log("Unknown change type: "+K.changeType);break}if(this.bindings.displayValues){this.bindings.displayValues.update()}if(this.bindings.contentValues){this.bindings.contentValues.update()}},setupElement:function(D,C){if(coherent.Browser.MobileSafari&&!D.__setup){D.__setup=true;D.addEventListener("click",function(){},false)}if(this.template){var A=coherent.dataModel;var B;coherent.dataModel=this.__context;this.template.call(this,D,C);coherent.dataModel=A}else{coherent.View.createViewsForNodeTree(D,C,this.__context)}var E=Element.assignId(D);this.objectCache[E]=C;return D},createElement:function(C,D,B){var A=this.viewElement();B=B||this.container();var E=Element.clone(this.templateElement);var F=B.insertBefore(E,D||null);return this.setupElement(F,C)},onmousedown:function(D){var B=this.viewElement();if(B.disabled){return }if("SELECT"===B.tagName){this.base(D);return }var E=D.target||D.srcElement;var A=this.container();var C=this._items();if(E==A||E==B){return }while(E&&E.parentNode!=A){E=E.parentNode}if(E==A||E==B){return }this._activeItem=C.indexOf(E);Element.addClassName(E,coherent.Style.kActiveClass)},onmouseup:function(B){var A=this.viewElement();if(A.disabled){return }if(-1!==this._activeItem){Element.removeClassName(this._items(this._activeItem),coherent.Style.kActiveClass)}this._activeItem=-1},ontouchmove:function(B){var A=this.viewElement();if(A.disabled){return }if(-1!==this._activeItem){Element.removeClassName(this._items(this._activeItem),coherent.Style.kActiveClass)}this._activeItem=-1;this.base(B)},onclick:function(A){var J=this.viewElement();if(J.disabled){this.base(A);Event.stop(A);return }if("SELECT"===J.tagName){this.base(A);return }var H=A.target||A.srcElement;var E=-1;var D=null;var B=this.container();var I=this._items();if(H==B){return }while(H&&H.parentNode!=B){H=H.parentNode}if(H){E=I.indexOf(H);var C=Element.assignId(H);D=this.objectCache[C]}var G;if(!this.multiple){this.selectedIndex=E;this.setSelectionIndexes(G=[E])}else{G=this.selectionIndexes();if(A.shiftKey){this.setSelectionIndexes(IndexRange(this.selectedIndex,E))}else{if(A.ctrlKey||A.metaKey){var F=G.indexOf(E);if(-1===F){this.selectedIndex=E;G.push(E)}else{G.splice(F,1)}this.setSelectionIndexes(G)}else{this.selectedIndex=E;this.setSelectionIndexes([E])}}}if(H&&"A"==H.tagName){H.blur()}this.sendAction()}});coherent.Overlay=Class.create(coherent.View,{content:Part(".content"),container:Part(".container"),__structure__:{".close":coherent.Anchor({action:"close",visibleBinding:"canClose"}),".spinner":coherent.View({visibleBinding:"loading"}),".buttons":coherent.ListView({visibleBinding:"recoveryOptions",contentBinding:"recoveryOptions",action:"recoveryButtonClicked",acceptsFirstResponder:function(){return false},template:coherent.View({__structure__:{button:coherent.View({textBinding:"*.text"})}})})},minWidth:200,minHeight:200,contentScreen:null,spinnerDelay:500,spinnerClassName:"overlay-waiting",timeout:5000,focusableSelectors:"input, select, textarea, button, a[href]",tabStart:Part("#tab-start"),tabStop:Part("#tab-stop"),closeBtn:Part(".close"),innerHTML:'<span class="chrome tl"></span><span class="chrome tr"></span><span class="chrome top"></span><span class="chrome left"></span><span class="chrome right"></span><span class="chrome bottom"></span><span class="chrome bl"></span><span class="chrome br"></span><a href="#" class="close">close</a><a href="#" id="tab-start" tabindex="1"></a><span class="chrome center"></span><div class="spinner"></div><div class="container"><div class="content"></div><a href="#" id="tab-stop"></a><ul class="buttons"><li><button></button></li></ul></div>',errorInnerHTML:'<div class="blue-header-popup">        <div class="header">            <h2>Server did not respond</h2>        </div>        <div class="content clearfix">            <p><strong>Your request to the server got no response. Either the request took too long, or the server may be down temporarily. Please try again.</strong></p>            <div class="error-actions">                <a href="#" class="cancel continue"><span class="replaced">Continue</span></a>            </div>        </div>        <div class="footer empty-footer">            <p>&nbsp;</p>        </div>    </div>',keyDependencies:{canClose:["loading","displayCloseWidget"]},init:function(){this.__cache={};this.__urlCache={};var A=this.viewElement();Element.setStyle(A,"display","none");this.setValueForKey(false,"visible");this.__curFocusIndex=0;this.__curFocusElement=null;this.__focusableElements=null},__resetFocusableElements:function(){this.__focusableElements=Element.queryAll(this.viewElement(),this.focusableSelectors).sort(function A(F,E){var D=0,C=F.tabIndex,B=E.tabIndex;if(F==this.tabStop()){D=1}else{if(E==this.tabStop()){D=-1}else{if(F==this.closeBtn()){D=1}else{if(E==this.closeBtn()){D=-1}else{if(C>0&&B>0){D=C-B}else{if(C>0){D=-1}else{if(B>0){D=1}else{if(C<0&&B<0){D=0}else{if(C<0){D=1}else{if(B<0){D=-1}}}}}}}}}}return D}.bind(this)).filter(function(B){return B.type!=="hidden"&&B.tabIndex>=0})},__getNextFocusableIndex:function(A){var D=this.__focusableElements,C=D.length,B=0;if(C==3){B=1}else{if(C>3){B=this.__getNextTabbableIndex(this.__curFocusIndex,A)}}return B},__getNextTabbableIndex:function(H,B){var A=H,G=this.__focusableElements,E=G.length,D=E-1,C;do{A=(B?((A===0)?D:A-1):((A==D)?0:A+1));C=G[A];try{C.focus();return A}catch(F){}}while(A!=H);return A},__setFocus:function(A,C){var B=this.__focusableElements[A];if(!C&&B&&B.focus){B.focus()}this.__curFocusElement=B;this.__curFocusIndex=A},enableTabHandler:function(){this.__resetFocusableElements();this.__setFocus(this.__curFocusIndex);this.__keyboardObserver=this.__keyboardHandler.bindAsEventListener(this);Event.observe(document,"keydown",this.__keyboardObserver)},disableTabHandler:function(){Event.stopObserving(document,"keydown",this.__keyboardObserver)},__keyboardHandler:function(A){switch(A.keyCode||A.which){case Event.KEY_TAB:Event.stop(A);this.__setFocus(this.__getNextFocusableIndex(A.shiftKey));if((A.target||A.srcElement)==this.tabStop()){this.__resetFocusableElements()}break;case Event.KEY_ESC:if(this.valueForKey("canClose")){this.hide();Event.stop(A)}break;default:break}},__updateTabStateAfterClick:function(A){var B=A.target||A.srcElement,D=null;if(B&&Element.match(B,this.focusableSelectors)&&this.__inOverlay(B)){var C=function(E){return this.__focusableElements.indexOf(E)}.bind(this);if(C(B)<0){this.__resetFocusableElements()}this.__setFocus(C(B),true)}},__inOverlay:function(C){var A=this.viewElement(),B=Element.locateAncestor(C,function(D){return D==A},A.parentNode);return !!B},canClose:function(){return !this.loading&&this.displayCloseWidget},onclick:function(C){var A=this.viewElement(),D=Element.locateAncestor(C.target||C.srcElement,function B(E){return Element.hasClassName(E,"cancel")},A);if(D){this.hide();Event.stop(C)}else{this.__updateTabStateAfterClick(C)}D=this.nextResponder();if(D){D.onclick(C)}},display:function(C){C=Object.applyDefaults(C||{},{timeout:this.timeout,spinnerDelay:this.spinnerDelay,obscurePage:true,displayCloseWidget:true,nextResponder:null,grow:false,dimensions:{width:this.minWidth,height:this.minHeight}});if(!C.url&&!C.sourceId&&!C.html&&!C.text&&!C.error){throw new Error("No source specified for the overlay.")}this.setValueForKey(C.displayCloseWidget,"displayCloseWidget");if(C.nextResponder){this.setNextResponder(C.nextResponder)}if(!this.contentScreen){function B(D){this.close();Event.stop(D)}if(coherent.Browser.IE===6){this.contentScreen=document.createElement("IFRAME");this.contentScreen.scrolling="no";this.contentScreen.frameBorder="0";this.contentScreen.src="about:blank"}else{this.contentScreen=document.createElement("DIV");if(this.displayCloseWidget){Event.observe(this.contentScreen,"click",B.bindAsEventListener(this))}}this.contentScreen.className="overlayScreen";Element.assignId(this.contentScreen);document.body.appendChild(this.contentScreen)}var A=this.viewElement();if(A.parentNode!==document.body){document.body.appendChild(A)}if(this.__request){this.__request.abort()}this.__clearTimers();if(C.grow){this.__show(C)}if(C.url){this.__loadContent(C);return }this.__showContent(C)},__clearTimers:function(){var B=[this.__loadingTimer,this.__waitingTimer],A;for(A=0;A<B.length;A++){if(B[A]){window.clearTimeout(B[A]);B[A]=0}}},__prepareToShow:function(B){var A=document.getElementById(this.__spinnerDelayNodeId);if(A){Element.setStyle(A,"display","none")}B.obscurePage=false;this.setValueForKey(false,"loading");this.__showContent(B)},__loadContent:function(C){function E(){console.log("Failed to display overlay: timeout exceeded");this.__clearTimers();C.html=this.errorInnerHTML;this.__prepareToShow(C)}function G(H){console.log("Failed to display overlay: "+H.message);this.__clearTimers();C.html=this.errorInnerHTML;this.__prepareToShow(C)}function B(){var H=document.getElementById(this.__spinnerDelayNodeId),I=Element.setStyle;if(!this.__spinnerDelayNodeId){H=document.body.appendChild(document.createElement("DIV"));I(H,"display","none");H.className=this.spinnerClassName;this.__spinnerDelayNodeId=Element.assignId(H)}I(H,"display","")}function A(J){var I=document.createElement("div"),H=coherent.Scripts.extract(J);C.scripts=H.scripts;C.html=H.toString();C.sourceId=Element.assignId(I);Element.setInnerHTML(I,C.html);this.__urlCache[C.url]=C.sourceId;this.__cache[I.id]=I;this.__clearTimers();this.__prepareToShow(C)}var D=this.__urlCache[C.url],F;if(D){C.sourceId=D;this.__clearTimers();this.__showContent(C);return }if(C.obscurePage){this.__obscurePage()}F=XHR.get(C.url);F.addMethods(A.bind(this),G.bind(this));this.setValueForKey(true,"loading");this.__loadingTimer=E.bindAndDelay(this,C.timeout);this.__waitingTimer=B.bindAndDelay(this,C.spinnerDelay)},__obscurePage:function(){var B=this.contentScreen,A="px";if(!this.__didObscurePage){this.__didObscurePage=true;Element.setStyle(B,"display","block");if(6===coherent.Browser.IE||coherent.Browser.MobileSafari){Element.setStyles(B,{position:"absolute",top:0+A,left:0+A,width:document.body.offsetWidth+A,height:document.body.offsetHeight+A})}coherent.Animator.setStyles(B,{opacity:0.85},{duration:175})}},__unobscurePage:function(){var A=this.contentScreen;if(this.__didObscurePage){this.__didObscurePage=false;coherent.Animator.setStyles(A,{opacity:0},{duration:250,callback:function(){Element.setStyle(A,"display","none")}})}},__getNodeById:function(A){return this.__cache[A]=(document.getElementById(A)||this.__cache[A])},__removeChildren:function(A){while(A.firstChild){A.removeChild(A.firstChild)}},__suspendScrolling:function(){if(coherent.Browser.IE===6){Element.query("html").style.overflow="hidden"}},__resumeScrolling:function(){if(coherent.Browser.IE===6){Element.query("html").style.overflow=""}},__showContent:function(D){var F=document.body,H=F.insertBefore(this.viewElement(),F.firstChild),G=this.content(),A=this.container(),J,I,E,B,K;if("classname" in D){H.className=D.classname}Element.setStyles(H,{opacity:0,display:"",width:"",height:""});if("sourceId" in D){this.__removeChildren(G);B=this.__getNodeById(D.sourceId);if(B.parentNode){B.parentNode.removeChild(B)}G.appendChild(B)}else{if("html" in D){E=coherent.Scripts.extract(D.html);D.scripts=E.scripts;G.innerHTML=E}else{if("text" in D){J=document.createTextNode(D.text);this.__removeChildren(G);G.appendChild(J)}else{if("error" in D){J=document.createElement("span");Element.setInnerHTML(J,D.error.description);this.__removeChildren(G);G.appendChild(J);this.setValueForKey(D.error,"error");if(this.error.recoveryOptions&&this.error.recoveryAttempter){function C(M){var L=new coherent.KVO();L.text=M;return L}K=this.error.recoveryOptions.map(C);this.setValueForKey(K,"recoveryOptions")}else{this.setValueForKey(null,"recoveryOptions")}}}}}if(!D.error){this.setValueForKey(null,"error");this.setValueForKey(null,"recoveryOptions")}this.beforeShow(G,D);this.setDisplayDimensions(this.getDisplayDimensions(G),D);this.__show(D)},beforeShow:function(B,A){},getDisplayDimensions:function(A){return Element.getDimensions(A)},setDisplayDimensions:function(B,A){A.dimensions=B;A.dimensions.height=Math.max(this.minHeight,A.dimensions.height);A.dimensions.width=Math.max(this.minWidth,A.dimensions.width)},load:function(A){this.display({url:A})},__show:function(D){var B=D.dimensions.width,P=D.dimensions.height,A=this.container(),M=this.viewElement(),N="px",H=Element.getViewport(),G=Element.setStyle,L=Element.setStyles,F=coherent.Animator.setStyles,K=Math.max(P/2+15,Math.round(H.height/2+H.top))+N,I={display:"",position:"absolute",left:"50%",top:K},E={opacity:1},J=this;this.__grow=D.grow;if(this.__grow){I.width=this.minWidth+N;I.height=this.minHeight+N;I.marginLeft=(-this.minWidth/2)+N;I.marginTop=(-this.minHeight/2)+N;E.width=B+N;E.height=P+N;E.marginLeft=(-B/2)+N;E.marginTop=(-P/2)+N}else{I.width=B+N;I.height=P+N;I.marginLeft=(-B/2)+N;I.marginTop=(-P/2)+N}if(D.obscurePage){this.__obscurePage()}function O(){if(D.scripts){coherent.Scripts.install(D.scripts)}D.scripts=null}L(M,I);function C(){J.sendToDelegate("willShowOverlay");F(M,E,{duration:250,callback:function(){O();J.setValueForKey(true,"visible");J.sendToDelegate("didShowOverlay");J.enableTabHandler()}})}coherent.Overlay.__currentOverlay=this;C.delay(100)},close:function(){return this.hide()},hide:function(B){var K=this.contentScreen,I=this.viewElement(),A=this.container(),G=this.content(),J="px",F=this,H=this.__removeChildren,E=Element.setStyle,D=coherent.Animator.setStyles,C={opacity:0};this.sendToDelegate("willHideOverlay");if(this.__grow){C.width=this.minWidth+J;C.height=this.minHeight+J;C.marginLeft=(-this.minWidth/2)+J;C.marginTop=(-this.minHeight/2)+J}this.__unobscurePage();D(I,C,{duration:250,callback:function(){I=document.body.appendChild(I);E(I,"display","none");F.sendToDelegate("didHideOverlay");if(B){H(G)}}});coherent.Overlay.__currentOverlay=null;this.setValueForKey(false,"visible");this.disableTabHandler()},recoveryButtonClicked:function(D){var C=D.selectedIndex,B=this.error,A=B.recoveryAttempter;if(-1==C||!A){return }A(B,C)}});coherent.Overlay.getCurrentOverlay=function(){return coherent.Overlay.__currentOverlay||null};coherent.Bubble=Class.create(coherent.Overlay,{arrow:Part(".arrow"),innerHTML:'<span class="chrome tl"></span><span class="chrome tr"></span><span class="chrome top"></span><span class="chrome left"></span><span class="chrome right"></span><span class="chrome bottom"></span><span class="chrome bl"></span><span class="chrome br"></span><a href="#" class="close">close</a><span class="chrome center"></span><div class="spinner"></div><div class="container"><div class="content"></div><ul class="buttons"><li><button class="text-action"></button></li></ul></div><span class="chrome arrow"></span>',minWidth:50,minHeight:20,maxWidth:800,maxHeight:500,init:function(){this.base();this.currentTarget=null},display:function(A){A=Object.applyDefaults(A,{grow:false});var B=Element.assignId(A.target);if(this.currentTarget==B){return }if(this.currentTarget){this.base(A);return }if(this.__timer){window.clearTimeout(this.__timer)}this.currentTarget=B;this.__timer=this.base.bindAndDelay(this,150,A)},hide:function(A){if(A&&this.currentTarget!==A.target.id){return }if(this.__timer){window.clearTimeout(this.__timer)}this.__timer=this.__hide.bindAndDelay(this)},onmousedown:function(){if(this.__timer){window.clearTimeout(this.__timer)}},onmouseup:function(){this.hide()},__show:function(C){if(this.__timer){window.clearTimeout(this.__timer)}this.__timer=null;this.currentTarget=Element.assignId(C.target);var K=this.viewElement();var M=this.arrow();var G=this.content();var B=this.container();Element.setStyle(B,"opacity",1);B.style.position="";Element.setStyle(K,"opacity",0);K.style.display="";var A=Element.getRect(C.target),O=A.left+A.width/2;var H=Element.getViewport();var I,Q,P,F;if(C.within){I=Element.getRect(C.within)}else{if(C.dimensions){var L=parseInt(A.left,10)+Math.floor(A.width/2);var N=Math.floor(C.dimensions.width/2);I={left:L-N,right:L+N,width:C.dimensions.width}}else{I=Element.getRect(document.body)}}K.style.width="";Q=Element.getRect(G);if(Q.width<=I.width){if((O+Q.width/2)<I.right){P={width:Q.width+"px",left:Math.max(I.left,O-Q.width/2)+"px",right:""};F=(O-parseInt(P.left,10))+"px"}else{P={width:Q.width+"px",left:(I.right-Q.width)+"px",right:""};F=(O-parseInt(P.left,10))+"px"}}else{P={width:I.width+"px",left:I.left+"px",right:""};F=(O-I.left)+"px"}Element.setStyles(K,P);Element.setStyle(M,"left",F);Element.removeClassName(K,"below");var D=M.offsetHeight;var E=D+parseInt(Element.getStyle(M,"marginBottom")||0,10);var J=parseInt(A.top,10)-K.offsetHeight-E;if(J<H.top||"below"==C.position){Element.addClassName(K,"below");E=D+parseInt(Element.getStyle(M,"marginTop")||0,10);J=parseInt(A.bottom,10)+E}K.style.top=J+"px";coherent.Animator.setStyles(K,{opacity:1},{duration:100})},__hide:function(){if(this.__timer){window.clearTimeout(this.__timer)}this.__timer=null;this.currentTarget=null;var A=this.viewElement();coherent.Animator.setStyles(A,{opacity:0},{duration:100,callback:function(){A.style.display="none"}})}});coherent.Bubble.display=function(D){var B="coherent_bubble_node";var C=document.getElementById(B);var A;if(C){A=coherent.View.fromNode(C)}else{C=document.createElement("div");C.id=B;document.body.appendChild(C);A=new coherent.Bubble(C)}A.display(D)};coherent.Bubble.hide=function(D){var B="coherent_bubble_node";var C=document.getElementById(B);if(!C){return }var A=coherent.View.fromNode(C);A.hide(D)};coherent.FieldGroup=Class.create(coherent.View,{validateFields:function(){var C=this.viewElement();var B=Element.queryAll(C,"input, textarea");var A=B.length;var H;var F;var D;var G=true;for(var E=0;E<A;++E){H=coherent.View.fromNode(B[E]);if(!H){continue}if("validate" in H){D=H.validate();if(D instanceof coherent.Error){G=false;F=F||B[E]}}}if(F){F.focus()}return G}});coherent.Fieldset=Class.create(coherent.FieldGroup,{bubbleClass:"bubble",init:function(){this.__currentViewId=false;this.__fieldErrors={};coherent.page.addObserverForKeyPath(this,"observeFirstResponderChange","firstResponder")},presentError:function(A){var B=A.field;if(!B){return }this.__fieldErrors[B.id]=A},clearAllErrors:function(A){delete this.__fieldErrors[A.id];if(this.__currentViewId==A.id){this.__currentViewId=false;coherent.Bubble.hide({target:document.getElementById(A.id)})}},observeFirstResponderChange:function(B){var A=B.newValue;this.showErrorMessageForField(A)},showErrorMessageForField:function(B){var A=!!B&&this.__fieldErrors[B.id];if(!A||!B.isDescendantOf(this)){if(this.__currentViewId){coherent.Bubble.hide({target:document.getElementById(this.__currentViewId)})}this.__currentViewId=false;return }this.__currentViewId=B.id;coherent.Bubble.display({classname:this.bubbleClass,error:A,position:A.position,target:B.viewElement(),within:this.viewElement(),nextResponder:B})}});coherent.Binding=Class.create({constructor:function(B,C,A){if(0===arguments.length){return }this.object=B;this.keyPath=C;this.transformer=A;this.refresh()},bind:function(){this.object.addObserverForKeyPath(this,this.observeChangeForKeyPath,this.keyPath)},unbind:function(){this.object.removeObserverForKeyPath(this,this.keyPath)},refresh:function(){this.cachedOriginalValue=this.object.valueForKeyPath(this.keyPath);this.cachedValue=this.transformedValue(this.cachedOriginalValue)},transformedValue:function(A){if(!this.transformer){return A}return this.transformer.transformedValue(A)},validateProposedValue:function(B){if(this.transformer){if(!this.transformer.reverseTransformedValue){throw new Error("Can't validate a value when the transformer doesn't have a reverseTransformedValue method")}B=this.transformer.reverseTransformedValue(B)}var A=this.object.validateValueForKeyPath(B,this.keyPath);if(A instanceof coherent.Error){return A}return this.transformedValue(A)},setValue:function(A){if(this.cachedValue===A){return }this.cachedValue=A;if(this.transformer){if(!this.transformer.reverseTransformedValue){return }A=this.transformer.reverseTransformedValue(A)}this.cachedOriginalValue=A;var B=this.updating;this.updating=true;this.object.setValueForKeyPath(A,this.keyPath);this.updating=B},mutable:function(){if(this.transformer&&!this.transformer.reverseTransformedValue){return false}var A=this.object.infoForKeyPath(this.keyPath);return A&&A.mutable},value:function(){return this.cachedValue},hasValue:function(){var A=this.value();return !(null===A||"undefined"===typeof (A))},update:function(){var A=this.value();var B=new coherent.ChangeNotification(this.object,coherent.ChangeType.setting,A);this.updating=true;this.observerFn(B,this.keyPath);this.updating=false},observerFn:function(C,B,A){},observeChangeForKeyPath:function(F,E,A){if(this.updating&&F.newValue===this.cachedOriginalValue){return }this.cachedOriginalValue=F.newValue;this.cachedOldValue=F.oldValue;var D=this.transformedValue(F.newValue);var B=Object.clone(F);B.newValue=D;B.oldValue=null;if(coherent.ChangeType.setting===F.changeType){this.cachedValue=D}var C=this.updating;this.updating=true;this.observerFn(B,E,A);this.updating=C}});coherent.Binding.bindingRegex=/^(.*?)(?:\((.*)\))?$/;coherent.Binding.compoundRegex=/^\s*([^&|].*?)\s*(\&\&|\|\|)\s*(\S.+)\s*$/;coherent.Binding.bindingFromString=function(D,C){var B;var E;B=D.match(coherent.Binding.compoundRegex);if(B&&4==B.length){E=new coherent.CompoundBinding(B[2],coherent.Binding.bindingFromString(B[1],C),coherent.Binding.bindingFromString(B[3],C));E.bind();return E}B=D.match(coherent.Binding.bindingRegex);if(!B||B.length<3){throw new InvalidArgumentError("bindingString isn't in correct format")}var F=B[1];var A;if(B[2]){A=coherent.findTransformerWithName(B[2])}if("$"==F.charAt(0)){E=new coherent.VariableBinding(C||coherent.dataModel,F,A)}else{E=new coherent.Binding(C||coherent.dataModel,F,A)}E.bind();return E};coherent.VariableKeyPath=Class.create({constructor:function(B,A){this.keyPath=B;this.kvo=A},origKeyPath:function(){return this.keyPath},resolve:function(){return coherent.VariableKeyPath.resolve(this.keyPath,this.kvo)},variablePaths:function(){return coherent.VariableKeyPath.variableKeys(this.keyPath)}});coherent.VariableKeyPath.resolve=function(H,D){if("$"!==H.charAt(0)){throw new InvalidArgumentError("variable keypath isn't in correct format")}var A=H.substr(1).split("$"),G="",F={},C=D;for(var B=0;B<A.length;B++){var E=A[B];if(F[E]){G+=F[E]}else{if(E.length>0){if((E.charAt(0)!==".")&&(E.charAt(E.length-1)!==".")){E=C.valueForKeyPath(E);if("undefined"===typeof (E)||null===E){return undefined}}G+=E}}}return G};coherent.VariableKeyPath.variableKeys=function(C){var A=[],B={};C.substr(1).split("$").forEach(function(D){if(D.length>0&&D.charAt(0)!=="."&&D.charAt(D.length-1)!=="."){if(!B[D]){B[D]=true;A.push(D)}}});return A};coherent.VariableBinding=Class.create(coherent.Binding,{constructor:function(B,C,A){this.variableKeyPath=new coherent.VariableKeyPath(C,B);this.cachedVariablesMap={};this.base(B,C,A);this.observers={}},addObserver:function(A,D,B){var C=new coherent.ObserverEntry(A,D,B);C.vbuid=coherent.VariableBinding.observerId++;A.vbuid=C.vbuid;this.observers[C.vbuid]=C},removeObserver:function(A){delete this.observers[A.vbuid]},getObservers:function(){return this.observers},valueForResolvedKeyPath:function(A){if(null===A||"undefined"===typeof (A)||A.indexOf("undefined")!=-1){return undefined}return this.object.valueForKeyPath(A)},bind:function(){this.bindVariablePaths();this.bindResolvedPath()},bindVariablePaths:function(){for(var A in this.cachedVariablesMap){this.object.addObserverForKeyPath(this,this.observeChangeForVariablePath,A)}},bindResolvedPath:function(){this.object.addObserverForKeyPath(this,this.observeChangeForResolvedPath,this.cachedResolvedKey)},unbind:function(){this.unbindVariablePaths();this.unbindResolvedPath()},unbindVariablePaths:function(){for(var A in this.cachedVariablesMap){this.object.removeObserverForKeyPath(this,A)}},unbindResolvedPath:function(){this.object.removeObserverForKeyPath(this,this.cachedResolvedKey)},refresh:function(){this.refreshCacheForVariablePaths();this.refreshCacheForResolvedPath()},refreshCacheForVariablePaths:function(){this.variableKeyPath.variablePaths().forEach(function(A){this.cachedVariablesMap[A]=this.object.valueForKeyPath(A)},this)},refreshCacheForResolvedPath:function(){var B=this.resolvedKeyPathFromCache(),A=this.valueForResolvedKeyPath(B);this.cachedOriginalValue=A;this.cachedValue=A;this.cachedResolvedKey=B},resolvedKeyPathFromCache:function(){var A=this.cachedVariablesMap,B="";this.variableKeyPath.origKeyPath().substr(1).split("$").forEach(function(C){if(C.length>0){if(C.charAt(0)!=="."&&C.charAt(C.length-1)!=="."){B+=A[C]}else{B+=C}}});return B},observeChangeForVariablePath:function(F,E,A){this.unbindResolvedPath();this.cachedVariablesMap[E]=F.newValue;var C=this.resolvedKeyPathFromCache(),D=this.valueForResolvedKeyPath(C);this.cachedResolvedKey=C;var B=Object.clone(F);B.newValue=D;B.oldValue=this.cachedOriginalValue;this.observeChangeForResolvedPath(B,"",A);this.bindResolvedPath()},observeChangeForResolvedPath:function(C,B,A){this.observeChangeForKeyPath(C,this.variableKeyPath.origKeyPath(),A)}});coherent.VariableBinding.observerId=1;coherent.CompoundBinding=Class.create(coherent.Binding,{constructor:function(A,C,B){this.base();if(!A||!C||!B){throw new InvalidArgumentError("No parameters to CompoundBinding initialiser are optional")}this.operation=A;this.left=C;this.right=B;this.left.observerFn=this.right.observerFn=this.observeChange.bind(this);switch(this.operation){case coherent.CompoundBinding.AND:this.cachedValue=this.left.value()&&this.right.value();break;case coherent.CompoundBinding.OR:this.cachedValue=this.left.value()||this.right.value();break;default:throw new InvalidArgumentError("Unknown operation value for CompoundBinding");break}},bind:function(){this.left.bind();this.right.bind()},unbind:function(){this.left.unbind();this.right.unbind()},mutable:function(){return false},setValue:function(A){throw new Error("Attempting to set value of CompoundBinding")},observeChange:function(C,B){var A=this.cachedValue;switch(this.operation){case coherent.CompoundBinding.AND:this.cachedValue=this.left.value()&&this.right.value();break;case coherent.CompoundBinding.OR:this.cachedValue=this.left.value()||this.right.value();break;default:throw new Error("Unknown operation value for CompoundBinding");break}if(A===this.cachedValue){return }this.update()}});coherent.CompoundBinding.AND="&&";coherent.CompoundBinding.OR="||";Class.extend(Array,{containsObject:function(A){return -1!==this.indexOf(A)},valueForKey:function(C){if(!C||0===C.length){throw new InvalidArgumentError("the key is empty")}if("@count"==C){return this.length}var D=new Array(this.length);var B;var A=this.length;for(B=0;B<A;++B){D[B]=this[B].valueForKey(C)}return D},setValueForKey:function(D,C){if(!C||0===C.length){throw new InvalidArgumentError("key is empty")}var B;var A=this.length;for(B=0;B<A;++B){this[B].setValueForKey(D,C)}},indexesOfObjects:function(E){var D;var B=E.length;var A=[];var C;for(D=0;D<B;++D){C=this.indexOf(E[D]);if(-1===C){continue}A.push(C)}return A},addObject:function(B){var A=this.length;var C=new coherent.ChangeNotification(this,coherent.ChangeType.insertion,[B],null,[A]);this.push(B);this.observeElementAtIndex(A);this.notifyObserversOfChangeForKeyPath(C,coherent.KVO.kAllPropertiesKey)},addObjects:function(C){var B;var A=C.length;for(B=0;B<A;++B){this.addObject(C[B])}},insertObjectAtIndex:function(B,A){if(A<0||A>=this.length){throw new RangeError("index must be within the bounds of the array")}var C=new coherent.ChangeNotification(this,coherent.ChangeType.insertion,[B],null,[A]);this.splice(A,0,B);this.observeElementAtIndex(A);this.notifyObserversOfChangeForKeyPath(C,coherent.KVO.kAllPropertiesKey)},insertObjectsAtIndexes:function(E,C){if(E.length!==C.length){throw new InvalidArgumentError("length of objects and indexes parameters must be equal")}var A=E.length;var D;var B;for(D=0;D<A;++D){B=C[D];this.splice(B,0,E[D]);this.observeElementAtIndex(B)}var F=new coherent.ChangeNotification(this,coherent.ChangeType.insertion,E,null,C);this.notifyObserversOfChangeForKeyPath(F,coherent.KVO.kAllPropertiesKey)},replaceObjectAtIndex:function(C,B){var A=this[B];this[B]=C;var D=new coherent.ChangeNotification(this,coherent.ChangeType.replacement,[C],[A],[B]);this.notifyObserversOfChangeForKeyPath(D,coherent.KVO.kAllPropertiesKey)},replaceObjectsAtIndexes:function(F,D){var B=[];var A=F.length;var E;var C;for(E=0;E<A;++E){C=D[E];B[E]=this[C];this.stopObservingElementAtIndex(C);this[C]=F[E];this.observeElementAtIndex(C)}var G=new coherent.ChangeNotification(this,coherent.ChangeType.replacement,F,null,D);this.notifyObserversOfChangeForKeyPath(G,coherent.KVO.kAllPropertiesKey)},removeObject:function(B){var A=this.indexOf(B);if(-1===A){return }this.removeObjectAtIndex(A)},removeObjects:function(D){var A=D.length;var B;for(var C=0;C<A;++C){B=this.indexOf(D[C]);if(-1===B){continue}this.removeObjectAtIndex(B)}},removeObjectsAtIndexes:function(B){var A=B.length;for(var C=0;C<A;++C){this.removeObjectAtIndex(B[C])}},removeObjectAtIndex:function(B){if(B<0||B>=this.length){throw new RangeError("index must be within the bounds of the array")}this.stopObservingElementAtIndex(B);var A=this.splice(B,1);var C=new coherent.ChangeNotification(this,coherent.ChangeType.deletion,null,A,[B]);this.notifyObserversOfChangeForKeyPath(C,coherent.KVO.kAllPropertiesKey)},removeAllObjects:function(){var D;var C=[];var A=this.length;C.length=A;for(D=0;D<A;++D){this.stopObservingElementAtIndex(D);C[D]=D}var B=this.splice(0,A);var E=new coherent.ChangeNotification(this,coherent.ChangeType.deletion,null,B,C);this.notifyObserversOfChangeForKeyPath(E,coherent.KVO.kAllPropertiesKey)},objectsAtIndexes:function(C){var D;var B=[];var A=C.length;B.length=C.length;for(D=0;D<A;++D){B[D]=this[C[D]]}return B},observeChildObjectChangeForKeyPath:function(F,E,B){var D=F.object;var C=this.indexOf(D);if(!this.__uid){this.initialiseKeyValueObserving()}if(-1===C){D._removeParentLink(this,null,this.__uid);return }var A=new coherent.ChangeNotification(D,coherent.ChangeType.replacement,[F.newValue],[F.oldValue],[C]);this.notifyObserversOfChangeForKeyPath(A,E)},observeElementAtIndex:function(A){var B=this[A];if(!B||!B._addParentLink){return }if(!this.__uid){this.initialiseKeyValueObserving()}B._addParentLink(this,null,this.__uid)},stopObservingElementAtIndex:function(A){var B=this[A];if(!B||!B._removeParentLink){return }if(!this.__uid){this.initialiseKeyValueObserving()}B._removeParentLink(this,null,this.__uid)},initialiseKeyValueObserving:function(){var B;var A=this.length;this.__observers={};this.__uid=this.__uid||coherent.generateUid();for(B=0;B<A;++B){this.observeElementAtIndex(B)}},toJSON:function(){return this}});coherent.KVO.adapt(Array.prototype);coherent.ArrayOperator={avg:function(A){return this.sum(A)/A.length},count:function(A){throw new InvalidArgumentError("@count operator must end the keyPath")},distinctUnionOfArrays:function(A){return this.unionOfArrays(A).distinct()},distinctUnionOfObjects:function(A){return A.distinct()},max:function(D){var B=null;var E;var A;var C;for(E=0,A=D.length;E<A;++E){C=D[E];if(null===B||C>B){B=C}}return B},min:function(C){var E=null;var D;var A;var B;for(D=0,A=C.length;D<A;++D){B=C[D];if(null===E||B<E){E=B}}return E},sum:function(B){var D=0;var A=B.length;var C;for(C=0;C<A;++C){D+=B[C]}return D},unionOfArrays:function(B){var D=[];var A;var C;for(C=0,A=B.length;C<A;++C){D=D.concat(B[C])}return D},unionOfObjects:function(A){return A}};coherent.KVOTable=Class.create(coherent.KVO,{valueForKeyPath:function(A){if("array"===coherent.typeOf(A)){A=A.join(".")}return this.valueForKey(A)},setValueForKeyPath:function(A,B){if("array"===coherent.typeOf(B)){B=B.join(".")}return this.setValueForKey(A,B)},infoForKeyPath:function(A){if("array"===coherent.typeOf(A)){A=A.join(".")}return this.infoForKey(A)}});coherent.Scripts={extract:function(B){var C=RegExp("(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)","img");var A=[];var D=new String(B.replace(C,function(){A.push(arguments[1]);return""}));D.scripts=A;return D},install:function(A){if(!A){return }function B(F){if(!F||!F.length){return }if(window.execScript){window.execScript(F)}else{var C=document.createElement("script");var E=document.createTextNode(F);C.appendChild(E);C.type="text/javascript";C.defer=false;var D=document.getElementsByTagName("head").item(0);D.appendChild(C)}}if("string"===typeof (A)){B(A);return }A.forEach(B)}};Element.colours={black:"#000000",white:"#ffffff"};if(coherent.Browser.IE){Element.setStyle=function(A,E,D){if("opacity"!=E){A.style[E]=D;return }var C=A.style.filter;var B=A.style;if(D==1||D===""){B.filter=C.replace(/alpha\([^\)]*\)/gi,"");return }if(D<0.00001){D=0}B.filter=C.replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+(D*100)+")"};Element.setStyles=function(A,B){var C=A.style;for(var D in B){if("opacity"==D){Element.setStyle(A,D,B[D])}else{C[D]=B[D]}}};Element.getStyles=function(E,C){var B=E.currentStyle;function I(K){var J=0;if("width"===K){J+=parseInt(B.borderLeftWidth,10)||0+parseInt(B.borderRightWidth,10)||0+parseInt(B.paddingLeft,10)||0+parseInt(B.paddingRight,10)||0;return Math.max(0,E.offsetWidth-J)+"px"}else{J+=parseInt(B.borderTopWidth,10)||0+parseInt(B.borderBottomWidth,10)||0+parseInt(B.paddingTop,10)||0+parseInt(B.paddingBottom,10)||0;return Math.max(0,E.offsetHeight-J)+"px"}}var H={};var F;if("string"===typeof (C)){if("opacity"===C){F=B.filter.match(/opacity=(\d+)/i);return(null===F?1:parseInt(F[1],10)/100)}if(C=="height"||C=="width"){return I(C)}else{if(A=="backgroundPosition"){return B.backgroundPositionX+" "+B.backgroundPositionY}else{return B[C]}}}C=C||Element.PROPERTIES;var A;var G=C.length;for(var D=0;D<G;++D){A=C[D];if("opacity"===A){F=B.filter.match(/opacity=(\d+)/i);H[A]=(null===F?1:parseInt(F[1],10)/100)}else{if(A==="height"||A==="width"){H[A]=I(A)}else{if(A==="backgroundPosition"){H[A]=B.backgroundPositionX+" "+B.backgroundPositionY}else{H[A]=B[A]}}}}return H};Element.getStyle=Element.getStyles;Element.noScopeElements=["<style","<script","<link","&lt;style","&lt;script","&lt;link"];Element.setInnerHTML=function(A,B){Element.innerHTML(A,B,false)};Element.appendInnerHTML=function(A,B){Element.innerHTML(A,B,true)};Element.innerHTML=function(C,D,B){D=String.stringify(D);D=D.escapeForInnerHTML();var A=this.noScopeElements.some(function(E){return(D.indexOf(E)!==-1)});if(A){if(B){C.innerHTML='<input type="hidden"/>'+C.innerHTML+D}else{C.innerHTML='<input type="hidden"/>'+D}C.removeChild(C.firstChild)}else{if(B){C.innerHTML+=D}else{C.innerHTML=D}}};Element.clone=function(C){var D=C.cloneNode(false);if("TR"!=C.tagName){D.innerHTML=C.innerHTML;return D}var B;var A;var E;for(B=0;B<C.children.length;++B){A=C.children[B];E=A.cloneNode(false);E.id="";E.innerHTML=A.innerHTML;D.appendChild(E)}return D}}if(coherent.Browser.IE){Object.extend(Event,{preventDefault:function(A){A.returnValue=false},onDomReady:function(B){var C;function A(){try{document.documentElement.doScroll("left");document.body.firstChild;document.namespaces}catch(D){C=A.delay(1);return }Event._domHasFinishedLoading()}if(Event._domHasFinishedLoading.done){window.setTimeout(B,0);return }if(!Event._readyCallbacks){C=A.delay(1);Event.observe(window,"load",Event._domHasFinishedLoading);Event._readyCallbacks=[]}Event._readyCallbacks.push(B)}});if(!window.addEventListener){Object.extend(Event,{observe:function(C,A,B){if("on"!=A.slice(0,2)){A="on"+A}C.attachEvent(A,B)},stopObserving:function(C,A,B){if("on"!=A.slice(0,2)){A="on"+A}C.detachEvent(A,B)},stop:function(A){A=A||window.event;A.returnValue=false;A.cancelBubble=true}})}}coherent.Formatter=Class.create({invalidValueMessage:_("error.invalid_value"),constructor:function(A){Object.extend(this,A)},stringForValue:function(A){if(null===A||"undefined"===typeof (A)){return""}return String(A)},valueForString:function(A){return A},isStringValid:function(A){return true},isValidInputCharacter:function(A){return true}});coherent.NumberFormatter=Class.create(coherent.Formatter,{invalidValueMessage:_("error.invalid_number"),validFloatCharacters:"0123456789.-",validIntCharacters:"0123456789-",allowsFloats:true,stringForValue:function(A){if(null===A||"undefined"===typeof (A)){return""}return String(A)},valueForString:function(A){if(this.allowsFloats){return parseFloat(A)}else{return parseInt(A,10)}},isStringValid:function(A){var C=this.valueForString(A);var B=!isNaN(C);if(B&&!isNaN(this.minimum)){B=(C>=this.minimum)}if(B&&!isNaN(this.maximum)){B=(C<=this.maximum)}if(B){return true}return new coherent.Error({description:this.invalidValueMessage})},isValidInputCharacter:function(A){if(this.allowsFloats){return(-1!==this.validFloatCharacters.indexOf(A))}else{return(-1!==this.validIntCharacters.indexOf(A))}}});coherent.RegexFormatter=Class.create(coherent.Formatter,{constructor:function(A){this.base(A);this.typeofValidCharacters=typeof (this.validCharacters);if(this.invalidRegex&&"exec" in this.invalidRegex){this.invalidRegex=[this.invalidRegex]}if(this.validRegex&&"exec" in this.validRegex){this.validRegex=[this.validRegex]}},isStringValid:function(B){var C;var A;var E;var D=true;if(this.invalidRegex&&this.invalidRegex.length){E=this.invalidRegex;for(C=0,A=E.length;C<A;++C){if(E[C].test(B)){D=false;break}}}if(D&&this.validRegex&&this.validRegex.length){D=false;E=this.validRegex;for(C=0,A=E.length;C<A;++C){if(E[C].test(B)){D=true;break}}}if(D){return true}return new coherent.Error({description:this.invalidValueMessage})},isValidInputCharacter:function(A){if(!this.validCharacters){return true}if("string"===this.typeofValidCharacters){return(-1!==this.validCharacters.indexOf(A))}else{return this.validCharacters.test(A)}}});coherent.easing=(function(){var B=Math.PI/2;var A=Math.PI;return{linear:function(C){return C},cubicBezier:function(F,D,Q,O,K){var L=3*F,N=3*(Q-F)-L,C=1-L-N,J=3*D,M=3*(O-D)-J,R=1-J-M,P;function I(S){return((C*S+N)*S+L)*S}function H(S){return((R*S+M)*S+J)*S}function E(S){return(3*C*S+2*N)*S+L}function G(S,Z){var Y=0,X=1,V=S,T,W,U=8;while(U--){T=I(V)-S;if(Math.abs(T)<Z){return V}W=E(V);if(Math.abs(W)<0.000001){break}V=V-T/W}V=S;if(V<Y){return Y}if(V>X){return X}while(Y<X){T=I(V);if(Math.abs(T-S)<Z){return V}if(S>T){Y=V}else{X=V}V=(X-Y)*0.5+Y}return V}K=K/1000||5;P=function(S){return H(G(S,1/(200*K)))};P.timingFunction="cubic-bezier";P.p1x=F;P.p1y=D;P.p2x=Q;P.p2y=O;return P},ease:function(D){var C=coherent.easing.cubicBezier(0.25,0.1,0.25,1,D);C.timingFunction="ease";return C},easeIn:function(D){var C=coherent.easing.cubicBezier(0.42,0,1,1,D);C.timingFunction="ease-in";return C},easeOut:function(D){var C=coherent.easing.cubicBezier(0,0,0.58,1,D);C.timingFunction="ease-out";return C},easeInOut:function(D){var C=coherent.easing.cubicBezier(0.42,0,0.58,1,D);C.timingFunction="ease-in-out";return C},linearCompleteAndReverse:function(C){return(C>0.5)?2-2*C:2*C},inSine:function(C){return 1-Math.cos(C*B)},outSine:function(C){return Math.sin(C*B)},inOutSine:function(C){return(1-Math.cos(C*A))/2},inBack:function(C,D){if(D==undefined){D=1.70158}return C*C*((D+1)*C-D)},outBack:function(C,D){if(D==undefined){D=1.70158}C=C-1;return(C*C*((D+1)*C+D)+1)},outBackStrong:function(C,D){if(D==undefined){D=1.70158*1.5}C=C-1;return(C*C*((D+1)*C+D)+1)},inOutQuad:function(C){if((C/=1/2)<1){return 1/2*C*C}return -1/2*((--C)*(C-2)-1)}}})();coherent.Animator=function(){var A={duration:500,actions:{}};var J=null;var X={};var B=0;var F=Element.getStyles;function D(b,a,e){var d={};e=e||{};function c(f){if(!f||f.tagName.toUpperCase()=="PARAM"){return false}var g=Element.assignId(f);d[g]=F(f,a);if(e[g]){return false}}Element.depthFirstTraversal(b,c);return d}function Q(){return[this.r,this.g,this.b,this.a].join(",")}function N(a){if(typeof (a)!="string"){return a}var b;if((b=Element.colours[a.toLowerCase()])){a=b}if((b=a.match(/^rgb(?:a)?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d(?:\.\d+)?)\s*)?\)$/i))){return{r:parseInt(b[1],10),g:parseInt(b[2],10),b:parseInt(b[3],10),a:parseInt(b[4]||1,10),toString:Q}}if("#"!==a.charAt(0)){if(a=="transparent"){return{r:255,g:255,b:255,a:0}}throw new Error("Invalid colour: "+a)}if(4==a.length){return{r:parseInt(a.charAt(1)+a.charAt(1),16),g:parseInt(a.charAt(2)+a.charAt(2),16),b:parseInt(a.charAt(3)+a.charAt(3),16),a:1,toString:Q}}else{return{r:parseInt(a.substr(1,2),16),g:parseInt(a.substr(3,2),16),b:parseInt(a.substr(5,2),16),a:1,toString:Q}}}function M(a){if("margin" in a){a.marginLeft=a.marginRight=a.marginTop=a.marginBottom=a.margin;delete a.margin}if("padding" in a){a.paddingLeft=a.paddingRight=a.paddingTop=a.paddingBottom=a.padding;delete a.padding}if("borderColor" in a){a.borderLeftColor=a.borderRightColor=a.borderTopColor=a.borderBottomColor=a.borderColor;delete a.borderColor}if("borderWidth" in a){a.borderLeftWidth=a.borderRightWidth=a.borderTopWidth=a.borderBottomWidth=a.borderWidth;delete a.borderWidth}return a}function P(d,b,e,a,c){this.property=d;this.element=b;this.start=N(e);this.end=N(a);if(coherent.Support.CSS3ColorModel){if(this.start.a===0){this.start.r=this.end.r;this.start.g=this.end.g;this.start.b=this.end.b}else{if(this.end.a===0){this.end.r=this.start.r;this.end.g=this.start.g;this.end.b=this.start.b}}this.step=this.stepRGBA}else{this.step=this.stepRGB}this.delta={r:this.end.r-this.start.r,g:this.end.g-this.start.g,b:this.end.b-this.start.b,a:this.end.a-this.start.a};this.shouldCleanup=!!c}P.prototype.stepRGB=function(b){if(this.curve){b=this.curve(b)}var a=["rgb(",Math.round(b*this.delta.r+this.start.r),",",Math.round(b*this.delta.g+this.start.g),",",Math.round(b*this.delta.b+this.start.b),")"].join("");this.element.style[this.property]=a};P.prototype.stepRGBA=function(b){if(this.curve){b=this.curve(b)}var a=["rgba(",Math.round(b*this.delta.r+this.start.r),",",Math.round(b*this.delta.g+this.start.g),",",Math.round(b*this.delta.b+this.start.b),",",b*this.delta.a+this.start.a,")"].join("");this.element.style[this.property]=a};P.prototype.cleanup=function(){this.element.style[this.property]=""};function I(d,b,e,a,c){this.property=d;this.element=b;this.start=parseInt(e||0,10);this.end=parseInt(a||0,10);this.delta=this.end-this.start;this.shouldCleanup=!!c}I.prototype.step=function(a){if(this.curve){a=this.curve(a)}this.element.style[this.property]=Math.round(a*this.delta+this.start)+"px"};I.prototype.cleanup=function(){this.element.style[this.property]=""};function U(b,d,a,c){this.element=b;this.start=parseFloat(d||0);this.end=parseFloat(a||0);this.delta=a-d;this.shouldCleanup=!!c}var G=(typeof document.createElement("div").style.opacity!="undefined");if(G){U.prototype.step=function(b){if(this.curve){b=this.curve(b)}var a=b*this.delta+this.start;this.element.style.opacity=(a>=1)?1:a.toFixed(3)};U.prototype.cleanup=function(){this.element.style.opacity=""}}else{if(coherent.Browser.IE){U.prototype.step=function(b){if(this.curve){b=this.curve(b)}var a=b*this.delta+this.start;this.element.style.filter=(a>=1)?"":"Alpha(Opacity="+Math.round(a*100)+")"};U.prototype.cleanup=function(){this.element.style.cssText=this.element.style.cssText.replace(/filter:.*?(?:;|$)/i,"")}}}function V(d,b,e,a,c){this.property=d;this.element=b;this.start=e;this.end=a;this.shouldCleanup=!!c}V.prototype.step=function(a){if(a>=this.discreteTransitionPoint){this.element.style[this.property]=this.end;this.step=function(b){}}};V.prototype.cleanup=function(){this.element.style[this.property]=""};function K(b,c,a){this.element=b;this.start=c;this.end=a}K.prototype.step=function(a){if(a>=this.discreteTransitionPoint){this.element.className=this.end;this.step=function(b){}}};function S(e,h,b,g){function f(i){switch(i){case"top":return"0% 50%";case"right":return"100% 50%";case"bottom":return"50% 100%";case"left":return"0% 50%";case"center":return"50% 50%";default:i=i.replace(/top|left/g,"0%");i=i.replace(/bottom|right/g,"100%");return i}}function c(i){return parseInt(i,10)}h=f(h);b=f(b);var d=h.match(/%|px/)[0];var a=b.match(/%|px/)[0];if(d!=a){return new V("backgroundPosition",e,h,b,g)}this.element=e;this.unit=d;this.start=Array.map(h.split(" "),c);this.end=Array.map(b.split(" "),c);this.delta=[this.end[0]-this.start[0],this.end[1]-this.start[1]];this.shouldCleanup=!!g;return this}S.prototype.step=function(a){if(this.curve){a=this.curve(a)}this.element.style.backgroundPosition=Math.round(a*this.delta[0]+this.start[0])+this.unit+" "+Math.round(a*this.delta[1]+this.start[1])+this.unit};S.prototype.cleanup=function(){if(coherent.Browser.IE){this.element.style.backgroundPositionX="";this.element.style.backgroundPositionY=""}else{this.element.style.backgroundPosition=""}};function C(b,d,a,c){this.element=b;this.startX=parseInt(d[0]||0,10);this.endX=parseInt(a[0]||0,10);this.startY=parseInt(d[1]||0,10);this.endY=parseInt(a[1]||0,10);this.deltaX=this.endX-this.startX;this.deltaY=this.endY-this.startY;this.shouldCleanup=!!c}C.prototype.step=function(a){if(this.curve){a=this.curve(a)}this.element.scrollTo(Math.round(a*this.deltaX+this.startX),Math.round(a*this.deltaY+this.startY))};C.prototype.cleanup=function(){this.element.scrollTo(this.startX,this.startY)};function W(d,b,e,a,c){switch(d){case"_className":return new K(b,e,a);case"display":return new V(d,b,e,a,c);case"backgroundPosition":return new S(b,e,a,c);case"backgroundColor":case"color":case"borderColor":case"borderTopColor":case"borderRightColor":case"borderBottomColor":case"borderLeftColor":return new P(d,b,e,a,c);case"opacity":return new U(b,e,a,c);case"scroll":return new C(b,e,a,c);default:return new I(d,b,e,a,c)}}function Y(d,g){var f=[];var e=X[d];if(!e||!e.properties[g]){return }var a=e.properties[g].shift();if(a.shouldCleanup&&"function"===typeof (a.cleanup)){a.cleanup()}if("function"==typeof (a.callback)){f.push(a.callback)}if(!e.properties[g].length){delete e.properties[g];e.propCount--}if(!e.propCount){if("function"==typeof (X[d]._callback)){f.push(e._callback)}delete (X[d]);B--}if(!B){O()}var b=f.length;for(var h=0;h<b;h++){f[h](document.getElementById(d),g)}}function H(){if(J){return }J=window.setInterval(E,10)}function O(){if(!J){return }window.clearInterval(J);J=null}function E(){var c,e,f,b,d=(new Date()).getTime();coherent.EventLoop._start=d;for(c in X){e=X[c].properties;for(f in e){b=e[f][0];if(d>=b.endTime){b.step(1);Y(c,f)}else{if(b.startTime<=d){b.step((d-b.startTime)/b.totalTime)}}}}}function L(d,c,f){f=Object.applyDefaults(f,A);if(f.delay){arguments.callee.delay(f.delay,d,c,f);delete f.delay;return }var l=Element.assignId(d);var e=X[l];if(!e){B++;e=X[l]={_node:d,propCount:0,properties:{},timers:{}}}if("function"==typeof (f.callback)){e._callback=f.callback}var b=f.startTime||coherent.EventLoop.getStart();var a=b+f.duration;var t=f.startStyles||F(d,Set.toArray(c));M(c);for(var n in c){var j=c[n],u=j.delay||0,i=b+u,g=j.duration?j.duration+i:a,o=j,m=j.curve||f.curve,s=j.discreteTransitionPoint||f.discreteTransitionPoint||0.5,k=typeof (j.cleanup)!=="undefined"?j.cleanup:f.cleanup,h;if("object"===typeof (o)&&"value" in o){o=o.value}if(n in e.properties){h=e.properties[n]}else{e.propCount++;h=[]}function r(x,y,p){var w=y.startTime<g&&y.endTime>g;var v=y.startTime<i&&y.endTime>i;var z=y.startTime<=i&&y.endTime>=g;if(!(v||w||z)){x.push(y)}return x}if(h.length){h=h.reduce(r,[])}var q=W(n,d,t[n],o,k);q.curve=m;q.discreteTransitionPoint=s;q.startTime=i;q.endTime=g;q.totalTime=g-i;if("object"===typeof (j)&&"callback" in j){q.callback=j.callback}if(f.stepBackToZero){q.step(0)}h.push(q);e.properties[n]=h}H()}function R(a){var b=Element.assignId(a);return !!document.getElementById(b)}function Z(k,o,q){var m=X[k.id];if(k.className===o&&(!m||!m._className||m._className.value===o)){if(q.callback){q.callback()}return }q=Object.applyDefaults(q,A);if(q.delay){arguments.callee.delay(q.delay,k,o,q);delete q.delay;return }if(!R(k)){k.className=o;if(q.callback){q.callback()}return }var j=q.only;var f=D(k,j,q.ignore);var d=k.className;k.className=o;for(var c in f){var i=X[c];if(!i){continue}for(var b in i.properties){i._node.style[b]=""}}var h=D(k,j,q.ignore);k.className=d;var n={};n[k.id]={_className:{value:o,duration:q.duration,callback:q.callback}};delete q.callback;function l(t){var s=t.id;var v=q.actions[s];var y=f[s]||{};var z=h[s]||{};var AB={};if(!v){var AA=y.display;var x=z.display;if(AA=="none"&&x=="none"){v=coherent.Animator.IGNORE_NODE}if(AA=="none"&&x!=="none"){v=coherent.Animator.FADE_IN_NODE}if(AA!=="none"&&x=="none"){v=coherent.Animator.FADE_OUT_NODE}}if("function"===typeof (v)){v=v(t,f,h)}if("object"==typeof (v)){AB=v;v=coherent.Animator.MORPH_NODE}switch(v){case coherent.Animator.IGNORE_NODE:return false;case coherent.Animator.FADE_NODE:n[s]=n[s]||{};n[s].opacity={value:"0",duration:q.duration,curve:coherent.easing.linearCompleteAndReverse};return false;case coherent.Animator.FADE_OUT_NODE:document.getElementById(s).style.display="block";n[s]=n[s]||{};n[s].opacity={value:"0",duration:q.duration/2,cleanup:false,callback:function(){document.getElementById(s).style.display=""}};return false;case coherent.Animator.FADE_IN_NODE:y.opacity=0;document.getElementById(s).style.display="block";n[s]=n[s]||{};n[s].opacity={value:"1",duration:q.duration/2,delay:q.duration/2,callback:function(){document.getElementById(s).style.display=""}};return false;case coherent.Animator.MORPH_NODE:default:for(var r in y){var u=X[s];var w=AB[r];var a=w?(w.value||w):z[r];if((u&&r in u.properties)||(String(y[r])!=String(a))){n[s]=n[s]||{};if(r in AB){if(w.value){n[s][r]=w}else{n[s][r]={value:w}}n[s][r].cleanup=false}else{n[s][r]=a}}}return true}}Element.depthFirstTraversal(k,l);q.stepBackToZero=true;q.cleanup=true;q.startTime=(new Date()).getTime();for(var e in n){var g=document.getElementById(e);if(!g){continue}q.startStyles=f[e];L(g,n[e],q)}}function T(c,a){var b=Element.regexForClassName(a);return c.replace(b," ")}return{actors:function(){return X},addClassName:function(b,c,a){if(!c){return }var d=Element.regexForClassName(c);var e=b.className;if(!d.test(e)){if(e){e+=" "+c}else{e=c}}Z(b,e,a)},removeClassName:function(b,c,a){var e=b.className;var d;if(e===c){Z(b,"",a);return }if("string"===typeof (c)){e=T(e,c)}else{e=c.reduce(T,e)}Z(b,e,a)},setClassName:function(b,c,a){var d=b.className;Z(b,c,a)},replaceClassName:function(d,c,a,b){if(c){var e=Element.regexForClassName(c);a=d.className.replace(e,"$1"+a+"$2")}else{a=d.className+" "+a}Z(d,a,b)},setStyles:L,abort:function(){X={};O()},abortAnimation:function(a){delete X[a.id]}}}();coherent.Animator.FADE_NODE="fade";coherent.Animator.FADE_IN_NODE="fade_in";coherent.Animator.FADE_OUT_NODE="fade_out";coherent.Animator.IGNORE_NODE="ignore";coherent.Animator.MORPH_NODE="morph";coherent.Animator.innerHTML=function(B,A,D){D=D||500;function E(){var H=B.innerHTML;var I=Element.getStyles(B,"height");Element.setInnerHTML(B,A);var G=Element.getStyles(B,"height");Element.setInnerHTML(B,H);B.style.height=I;B.style.overflow="hidden";coherent.Animator.setStyles(B,{opacity:{value:0,callback:C}},{duration:D/2});coherent.Animator.setStyles(B,{height:{value:G,curve:coherent.easing.inOutSine}},{duration:D,cleanup:true})}function C(){Element.setInnerHTML(B,A);coherent.Animator.setStyles(B,{opacity:1},{duration:D/2,callback:F,cleanup:true})}function F(){B.style.overflow=""}if(B.style.display!="none"){E()}else{B.innerHTML=A}};coherent.Animator.innerText=function(B,E,D){D=D||500;function A(G){var F=document.createTextNode(G);B.innerHTML="";B.appendChild(F)}function C(){A(E);coherent.Animator.setStyles(B,{opacity:1},{duration:D/2,cleanup:true})}if(B.style.display!="none"){coherent.Animator.setStyles(B,{opacity:0},{duration:D/2,callback:C})}else{A(E)}};coherent.Animator.scrollTo=function(B,D){var A=Element.getViewport(),F=(window.height||document.body.scrollHeight)-A.height,C=B,E,G;if(typeof B=="string"){E=document.getElementById(B.replace("#",""))}else{if("nodeName" in B){E=B}}if(E){G=Element.getRect(E);C=[A.left,Math.min(F,G.top)]}D=Object.applyDefaults({duration:375,curve:coherent.easing.cubicBezier(0.175,0.9,0.2,1,375),startStyles:{scroll:[A.left,A.top]},callback:function(){if(E&&E.id){window.location.hash="#"+E.id}}},D);coherent.Animator.setStyles(window,{scroll:C},D)};var CancelledError=coherent.defineError("CancelledError");var InvalidStateError=coherent.defineError("InvalidStateError");(function(){var C=-1;var A=0;var B=1;coherent.Deferred=Class.create({constructor:function(D){this.canceller=D;this._result=null;this._status=C;this._callbacks=[]},_fire:function(D){while(this._callbacks.length){this._status=(D instanceof Error)?B:A;this._result=D;var E=this._callbacks.shift()[this._status];if(!E){continue}D=E(D);if(D instanceof coherent.Deferred){var F=this;function G(H){F._fire(H);return H}D.addMethods(G,G);return }}this._status=(D instanceof Error)?B:A;this._result=D},result:function(){return this._result},cancel:function(){if(C!==this._status){throw new InvalidStateError("Can not cancel Deferred because it is already complete")}var D=(this.canceller&&this.canceller());if(!(D instanceof Error)){D=new CancelledError("Deferred operation cancelled")}this.failure(D)},addMethods:function(D,E){this._callbacks.push([D,E]);if(C===this._status){return this}this._fire(this._result);return this},addCallback:function(D){return this.addMethods(D,null)},addErrorHandler:function(D){return this.addMethods(null,D)},callback:function(D){if(C!==this._status){throw new InvalidStateError("Can not signal callback because Deferred is already complete: result="+D)}this._fire(D)},failure:function(D){if(C!==this._status){throw new InvalidStateError("Can not signal failure because Deferred is already complete: error="+D)}this._fire(D)}})})();coherent.URL=Class.create({constructor:function(B){this.url=B.trim();var C=(/^(([^\:\/\?#]+)\:)?(\/\/([^\/\?#]*))?([^\?#]*)(\?([^#]*))?(#(.*))?$/),A=this.url.match(C)||[];this.protocol=A[2]||"";this.authority=A[4]||"";this.path=A[5].trim()||"";this.query=A[7]||"";this.fragment=A[9]||"";C=(/^(([^@]+)@)?([^\:]+)(:(.+))?$/);A=this.authority.match(C)||[];this.userInfo=A[2]||"";this.host=A[3]||"";this.port=A[5]||""},toHash:function(A){var B=this.query.split("&").map(function(D){return escape(D)}),C=typeof A!=="undefined"?A:",";B.sort();return[this.protocol,this.authority,this.path,B,this.fragment].join(C)}});coherent.FormControl=Class.create(coherent.View,{exposedBindings:["value","name"],init:function(){this.base();var A=this.viewElement();var B=this.bindings;if(B.value&&!B.value.hasValue()&&A.value){B.value.setValue(A.value)}if(B.name&&!B.name.hasValue()&&A.name){B.name.setValue(A.name)}},observeValueChange:function(C){var A=this.viewElement();var B=C.newValue;if("undefined"===typeof (B)){A.disabled=true}else{if(!this.bindings.enabled){A.disabled=false}}if(!this.bindings.editable){A.readOnly=!this.bindings.value.mutable()||coherent.Markers.MultipleValues===B||coherent.Markers.NoSelection===B}if(A.readOnly){Element.addClassName(A,coherent.Style.kReadOnlyClass)}else{Element.removeClassName(A,coherent.Style.kReadOnlyClass)}if(A.disabled){Element.addClassName(A,coherent.Style.kDisabledClass)}else{Element.removeClassName(A,coherent.Style.kDisabledClass)}A.value=B},observeNameChange:function(D,C,B){var A=this.viewElement();A.name=D.newValue},validate:function(){return this.viewElement().value}});coherent.Button=Class.create(coherent.FormControl,{__viewClassName__:"Button",__tagSpec__:["input[type=button]","input[type=submit]","input[type=reset]","button"],requireBindingsForInferredViewType:false,onmousedown:function(B){var A=this.viewElement();Element.addClassName(A,coherent.Style.kActiveClass)},onmouseup:function(B){var A=this.viewElement();Element.removeClassName(A,coherent.Style.kActiveClass)},onclick:function(A){if(this.disabled){Event.stop(A);return }this.sendAction()}});coherent.EventLoop={currentEvent:null,getStart:function(){if(!this._start){this._start=new Date().getTime()}return this._start},begin:function(A){this._start=new Date().getTime();this.currentEvent=A},end:function(){this.currentEvent=null;this._start=null}};coherent.Form=Class.create(coherent.FieldGroup,{exposedBindings:["actionUrl","method"],sendActionOn:["submit"],init:function(){this.base();var A=this.viewElement();var B=this.bindings;if(B.actionUrl&&!B.actionUrl.hasValue()&&A.action){B.actionUrl.setValue(A.action)}if(B.method&&!B.method.hasValue()&&A.method){B.method.setValue(A.method)}Event.observe(A,"submit",this.onsubmit.bind(this))},onsubmit:function(A){if(!this.action||!this.sendActionOn.containsObject("submit")){return }Event.stop(A);this.sendAction()},observeActionUrlChange:function(D,C,B){var A=this.viewElement();A.action=D.newValue},observeMethodChange:function(D,C,B){var A=this.viewElement();A.method=D.newValue}});coherent.ImageView=Class.create(coherent.View,{__viewClassName__:"Image",__tagSpec__:["img","input[type=image]"],exposedBindings:["src","alt","width","height"],multipleValuesPlaceholder:_("marker.image.multipleValues"),nullPlaceholder:_("marker.image.placeholder"),noSelectionPlaceholder:_("marker.image.noSelection"),init:function(){this.base();var A=this.viewElement();Event.observe(A,"error",this.onerror.bind(this));Event.observe(A,"load",this.onload.bind(this));var B=this.bindings;if(B.src&&!B.src.hasValue()&&A.src){B.src.setValue(A.src)}if(B.alt&&!B.alt.hasValue()&&A.alt){B.alt.setValue(A.alt)}if(B.width&&!B.width.hasValue()&&A.width){B.width.setValue(A.width)}if(B.height&&!B.height.hasValue()&&A.height){B.height.setValue(A.height)}},onload:function(){var A=this.viewElement();this.setValueForKey(false,"loading");Element.removeClassName(A,coherent.Style.kLoadingClass)},onerror:function(){var A=this.viewElement();this.setValueForKey(false,"loading");Element.updateClass(A,coherent.Style.kInvalidValueClass,coherent.Style.kLoadingClass)},src:function(){var A=this.viewElement().src;return("about:blank"===A)?null:A},setSrc:function(C){if(this.bindings.src){this.bindings.src.setValue(C)}this.setValueForKey(true,"loading");var B=this.viewElement();Element.updateClass(B,coherent.Style.kLoadingClass,coherent.Style.kInvalidValueClass);if(!C){C="about:blank"}var A=B.src;B.src=C;if(coherent.Browser.Safari&&B.src===A){this.onload()}},observeSrcChange:function(E){var C=this;var A=this.viewElement();var D=E.newValue;var B=true;switch(D){case"":case null:case undefined:D=this.attributeOrProperty("nullPlaceholder");break;case coherent.Markers.NoSelection:D=this.attributeOrProperty("noSelectionPlaceholder");break;case coherent.Markers.MultipleValues:D=this.attributeOrProperty("multipleValuesPlaceholder");break;default:B=false;break}if(B){Element.addClassName(A,coherent.Style.kMarkerClass)}else{Element.removeClassName(A,coherent.Style.kMarkerClass)}this.setSrc(D)},observeWidthChange:function(C){var A=this.viewElement();var B=parseInt(C.newValue,10);if(isNaN(B)){A.removeAttribute("width")}else{A.width=B}},observeAltChange:function(C){var A=this.viewElement();var B=C.newValue;if(B===null||"undefined"===typeof (B)){A.alt=""}else{A.alt=B}},observeHeightChange:function(C){var B=this.viewElement();var A=parseInt(C.newValue,10);if(isNaN(A)){B.removeAttribute("height")}else{B.height=A}}});coherent.Media=Class.create(coherent.View,{exposedBindings:["src","currentTime","volume","muted"],init:function(){var A=this.viewElement();var B=this.bindings;if(B.src&&!B.src.hasValue()&&A.src){B.src.setValue(A.src)}if(B.currentTime&&!B.currentTime.hasValue()){B.currentTime.setValue(A.currentTime)}if(B.duration&&!B.duration.hasValue()){B.duration.setValue(A.duration)}if(B.volume&&!B.volume.hasValue()){B.volume.setValue(A.volume)}if(B.muted&&!B.muted.hasValue()){B.muted.setValue(A.muted)}Event.observe(A,"ended",this.mediaDidEnd.bindAsEventListener(this))},pause:function(){var A=this.viewElement();if(!A.paused){A.pause()}},play:function(){var A=this.viewElement();A.play();this.forceChangeNotificationForKey("ended")},stop:function(){var A=this.viewElement();A.currentTime=A.duration},muted:function(){var A=this.viewElement();return A.muted},mediaDidEnd:function(A){this.forceChangeNotificationForKey("ended")},ended:function(){var A=this.viewElement();return A.ended},src:function(){var A=this.viewElement();return A.src},setSrc:function(C){if(this.bindings.src){this.bindings.src.setValue(C)}var B=this.viewElement();var D=this;function A(){B.src=C;B.load();D.forceChangeNotificationForKey("ended")}A.delay(0)}});coherent.Page=Class.create(coherent.Responder,{constructor:function(){this.firstResponder=null;this.__hoverTrackingIds={};this._onmousedragHandler=this._onmousedrag.bindAsEventListener(this);this._delegates={click:[]};this.onclick=this._fireDelegates},targetViewForEvent:function(C){var B=C.target||C.srcElement;var A;var D=coherent.View.fromNode;while(B&&B!=document&&!(A=D(B))){B=B.parentNode}if(!B||B==document){return null}return A},makeFirstResponder:function(A){if(this.firstResponder==A){return true}if(this.firstResponder&&!this.firstResponder.resignFirstResponder()){return false}if(this.firstResponder){Element.removeClassName(this.firstResponder.viewElement(),coherent.Style.kFocusClass)}if(A&&!A.becomeFirstResponder()){return false}this.willChangeValueForKey("firstResponder");this.firstResponder=A;this.didChangeValueForKey("firstResponder");if(A){A.focus();Element.addClassName(A.viewElement(),coherent.Style.kFocusClass)}return true},addTrackingInfo:function(C,B){if("string"!==typeof (C)){C=Element.assignId(C)}var A=this.__hoverTrackingIds[C];if(!A){A=this.__hoverTrackingIds[C]=[]}A.push(B)},superview:function(){return null},presentError:function(A){function B(){var C=A.description;if(A.recoverySuggestion){C+="\n"+A.recoverySuggestion}window.alert(C);coherent.page.makeFirstResponder(A.field)}B.delay(0)},delegate:function(A,C,B){if("string"===typeof (C)){this._delegates[C].push({sel:A,fn:B})}else{var D;for(D in C){if(!(D in this._delegates)){throw new Error("Invalid delegation event type: "+D)}this._delegates[D].push({sel:A,fn:C[D]})}}},superview:function(){return null},_fireDelegates:function(E){var C=E.target||E.srcElement;var B=Element.match;var A=this._delegates[E.type]||[];function D(F){if(B(C,F.sel)){F.fn(E)}}A.forEach(D)},_findFirstResponder:function(A){while(A&&!A.acceptsFirstResponder()){A=A.superview()}if(!A){this.makeFirstResponder(null);return }this.makeFirstResponder(A)},_onmousedown:function(B){var A=this.targetViewForEvent(B);if(A){this._findFirstResponder(A);A.onmousedown(B);Event.observe(document,"mousemove",this._onmousedragHandler)}this._mousedownView=A},_onmouseup:function(A){if(this._mousedownView){this._mousedownView.onmouseup(A)}Event.stopObserving(document,"mousemove",this._onmousedragHandler)},_onmousedrag:function(A){if(this._mousedownView){this._mousedownView.onmousedrag(A)}},_onmouseover:function(A){var E=this.__hoverTrackingIds||{};var L=this.__mouseOverIds||{};var C={};var H=A.target||A.srcElement;var F=document.body;var I;var K;var B;var D;var G;var J;for(;H&&H!=F;H=H.parentNode){B=H.id;if(!B||!(B in E)){continue}C[B]=true;if(B in L){continue}I=E[B];G=I.length;for(D=0;D<G;++D){J=I[D];if(J.onmouseenter){J.onmouseenter.call(J.owner,H,J.ownerInfo)}}}for(B in L){if(B in C){continue}H=document.getElementById(B);if(!H){continue}I=E[B];G=I.length;for(D=0;D<G;++D){J=I[D];if(J.onmouseleave){J.onmouseleave.call(J.owner,H,J.ownerInfo)}}}this.__mouseOverIds=C},_onmouseout:function(A){},_onclick:function(B){if(coherent.Browser.Mozilla&&B.button===2){return }var A=this.targetViewForEvent(B);if(A){A.onclick(B)}else{this._fireDelegates(B)}},_ondblclick:function(A){if(this._mousedownView){this._mousedownView.ondblclick(A)}},_onkeydown:function(A){var B=this.firstResponder;if(B){B.onkeydown(A)}},_onkeyup:function(A){var B=this.firstResponder;if(B){B.onkeyup(A)}},_onkeypress:function(A){var B=this.firstResponder;if(B){B.onkeypress(A)}},_onfocus:function(B){var C=B.target||B.srcElement;if(C==window){return }if(C==document){this.makeFirstResponder(this._previousFirstResponder||null);this._previousFirstResponder=null}else{var A=this.targetViewForEvent(B);if(A&&A.acceptsFirstResponder()){this.makeFirstResponder(A)}else{this.makeFirstResponder(null)}}},_onblur:function(B){var C=B.target||B.srcElement;if(C==window){return }if(C==document){this._previousFirstResponder=this.firstResponder;this.makeFirstResponder(null)}else{var A=this.targetViewForEvent(B);if(A&&this.firstResponder==A){this.makeFirstResponder(null)}}},_ontouchstart:function(B){var A=this.targetViewForEvent(B);if(A){A.ontouchstart(B);A.onmousedown(B)}this._touchstartView=A},_ontouchmove:function(A){if(this._touchstartView){this._touchstartView.ontouchmove(A)}},_ontouchend:function(A){if(this._touchstartView){this._touchstartView.ontouchend(A);this._touchstartView.onmouseup(A)}},_ontouchcancel:function(A){if(this._touchstartView){this._touchstartView.ontouchend(A);this._touchstartView.onmouseup(A)}},_onunload:function(){var B;var A=coherent.View.viewLookup;for(B in A){A[B].teardown();delete A[B]}}});(function(){coherent.page=new coherent.Page();window._setTimeout=window.setTimeout;window.setTimeout=function(F,E){if(!F){return null}if("string"===typeof (F)){F="coherent.EventLoop.begin();do {"+F+"} while (false); coherent.EventLoop.end();";return window._setTimeout(F,E)}var D=Array.from(arguments,2);function C(){coherent.EventLoop.begin();var G=F.apply(this,D);coherent.EventLoop.end();return G}return window._setTimeout(C,E)};window._setInterval=window.setInterval;window.setInterval=function(F,E){if(!F){return null}if("string"===typeof (F)){F="coherent.EventLoop.begin();do {"+F+"} while (false); coherent.EventLoop.end();";return window._setInterval(F,E)}var D=Array.from(arguments,2);function C(){coherent.EventLoop.begin();var G=F.apply(this,D);coherent.EventLoop.end();return G}return window._setInterval(C,E)};var B=coherent.page;var A;A=function(C){return function(D){D=D||window.event;Event.shiftKey=D.shiftKey;coherent.EventLoop.begin(D);B[C](D);coherent.EventLoop.end()}};if(window.addEventListener){document.addEventListener("mouseover",A("_onmouseover"),false);document.addEventListener("mouseout",A("_onmouseout"),false);document.addEventListener("mousedown",A("_onmousedown"),false);document.addEventListener("mouseup",A("_onmouseup"),false);document.addEventListener("click",A("_onclick"),false);document.addEventListener("dblclick",A("_ondblclick"),false);document.addEventListener("keydown",A("_onkeydown"),false);document.addEventListener("keyup",A("_onkeyup"),false);document.addEventListener("keypress",A("_onkeypress"),false);document.addEventListener("focus",A("_onfocus"),true);document.addEventListener("blur",A("_onblur"),true);window.addEventListener("focus",A("_onfocus"),false);window.addEventListener("blur",A("_onblur"),false);if(coherent.Support.Touches){document.addEventListener("touchstart",A("_ontouchstart"),true);document.addEventListener("touchmove",A("_ontouchmove"),true);document.addEventListener("touchend",A("_ontouchend"),true);document.addEventListener("touchcancel",A("_ontouchcancel"),true)}}else{if(window.attachEvent){document.attachEvent("onmouseover",A("_onmouseover"));document.attachEvent("onmouseout",A("_onmouseout"));document.attachEvent("onmousedown",A("_onmousedown"));document.attachEvent("onmouseup",A("_onmouseup"));document.attachEvent("onclick",A("_onclick"));document.attachEvent("ondblclick",A("_ondblclick"));document.attachEvent("onkeydown",A("_onkeydown"));document.attachEvent("onkeyup",A("_onkeyup"));document.attachEvent("onkeypress",A("_onkeypress"));document.attachEvent("onfocusin",A("_onfocus"));document.attachEvent("onfocusout",A("_onblur"));window.attachEvent("focus",A("_onfocus"));window.attachEvent("blur",A("_onblur"));window.attachEvent("onunload",A("_onunload"))}}})();coherent.TextField=Class.create(coherent.FormControl,{__viewClassName__:"TextField",__tagSpec__:["input[type=text]","input[type=password]","input[type=hidden]","textarea"],init:function(){this.base();var A=this.viewElement();Event.observe(A,"change",this.valueChanged.bindAsEventListener(this));Event.observe(A,"drop",this.fieldReceivedDropEvent.bindAsEventListener(this));this.editing=false;this.validationError=null;var B=this.bindings;if(B.maxLength&&!B.maxLength.hasValue()&&A.maxLength){B.maxLength.setValue(A.maxLength)}},exposedBindings:["errorMessage","maxLength"],multipleValuesPlaceholder:_("marker.input.multipleValues"),nullPlaceholder:_("marker.input.placeholder"),noSelectionPlaceholder:_("marker.input.noSelection"),keypressUpdateTimeout:500,continuallyUpdatesValue:true,sendsActionOnEndEditing:true,sendActionOn:["blur","keydown"],beginEditing:function(){this.editing=true},endEditing:function(){Element.removeClassName(this.viewElement(),coherent.Style.kEditingClass);this.editing=false;if(this.sendsActionOnEndEditing&&this.action){this.sendAction()}},validate:function(){var A=this.viewElement(),C=A.value,B;if(this.formatter){B=this.formatter.isStringValid(C);if(B!==true){this.presentError(B);return B}C=this.formatter.valueForString(C)}if(!(this.bindings.errorMessage&&this.bindings.errorMessage.value())){this.clearAllErrors()}if(this.bindings.value){C=this.bindings.value.validateProposedValue(C);if(C instanceof coherent.Error){this.presentError(C);return C}if(C!=this.bindings.value.value()){this.bindings.value.setValue(C)}}return C},presentError:function(A){this.validationError=A;Element.addClassName(this.viewElement(),coherent.Style.kInvalidValueClass);return this.base.apply(this,arguments)},clearAllErrors:function(){this.validationError=null;Element.removeClassName(this.viewElement(),coherent.Style.kInvalidValueClass);return this.base.apply(this,arguments)},acceptsFirstResponder:function(){var A=this.viewElement();if(A.disabled||A.readOnly){return false}return true},becomeFirstResponder:function(){var A=this.viewElement();if(A.disabled||A.readOnly){return false}if(this.markerValue){this.clearMarkerValue()}this.hasFocus=true;this.beginEditing();return true},resignFirstResponder:function(B){var A=this.viewElement();this.hasFocus=false;if(""===A.value){this.setMarkerValue("nullPlaceholder")}this.endEditing();return true},setMarkerValue:function(B){var A=this.viewElement();var C=this.attributeOrProperty(B);this.markerValue=B;A.value=C;Element.addClassName(A,coherent.Style.kMarkerClass)},clearMarkerValue:function(){var A=this.viewElement();this.markerValue=false;A.value="";Element.removeClassName(A,coherent.Style.kMarkerClass)},valueChanged:function(A){if(this.updateTimer){window.clearTimeout(this.updateTmer);this.updateTimer=null}if(this.markerValue){return }this.validate()},fieldReceivedDropEvent:function(B){var A=this.viewElement();A.value="";this.clearMarkerValue()},onkeyup:function(C){if(Event.isMetaKey(C)){return }var B=this.viewElement(),D=B.selectionStart,A=B.selectionEnd;Element.addClassName(B,coherent.Style.kEditingClass);if(coherent.Browser.Mozilla){B.selectionStart=D;B.selectionEnd=A}if(!this.continuallyUpdatesValue){return }if(this.updateTimer){window.clearTimeout(this.updateTimer)}if(B.readOnly||B.disabled){return }this.updateTimer=this.valueChanged.bindAndDelay(this,this.keypressUpdateTimeout)},onkeydown:function(A){if(this.action&&A.keyCode===Event.KEY_RETURN){this.valueChanged(null);if(this.validationError){return }this.sendAction();Event.stop(A)}},onkeypress:function(A){var B=Event;if(!this.formatter){return }if((A.charCode===0||B.isMetaKey(A)||A.charCode===B.KEY_BACKSPACE||B.isModifiedKey(A))){return }var C=String.fromCharCode(A.charCode||A.keyCode);if(!this.formatter.isValidInputCharacter(C)){Event.stop(A)}},observeValueChange:function(C){var A=this.viewElement();var B=C.newValue;if(this.formatter){B=this.formatter.stringForValue(B)}if("undefined"===typeof (B)){A.disabled=true}else{if(!this.bindings.enabled){A.disabled=false}}if(!this.bindings.editable){A.readOnly=!this.bindings.value.mutable()||coherent.Markers.MultipleValues===B||coherent.Markers.NoSelection===B}if(A.readOnly){Element.addClassName(A,coherent.Style.kReadOnlyClass)}else{Element.removeClassName(A,coherent.Style.kReadOnlyClass)}if(A.disabled){Element.addClassName(A,coherent.Style.kDisabledClass)}else{Element.removeClassName(A,coherent.Style.kDisabledClass)}if(!this.bindings.errorMessage||!this.bindings.errorMessage.value()){this.clearAllErrors()}if(this.hasFocus){return }switch(A.type){case"text":case"password":case"textarea":if(null===B||"undefined"===typeof (B)||""===B){this.setMarkerValue("nullPlaceholder")}else{if(coherent.Markers.NoSelection===B){this.setMarkerValue("noSelectionPlaceholder")}else{if(coherent.Markers.MultipleValues===B){this.setMarkerValue("multipleValuesPlaceholder")}else{this.clearMarkerValue();A.value=B}}}break;default:A.value=B;break}},observeErrorMessageChange:function(C){var B=C.newValue;if(!B){this.clearAllErrors();return }var A=new coherent.Error({description:C.newValue});this.presentError(A)},observeMaxLengthChange:function(C){var B=C.newValue;var A=this.viewElement();if("INPUT"==A.nodeName){A.maxLength=B}}});coherent.SearchField=Class.create(coherent.TextField,{__viewClassName__:"Search",__tagSpec__:"input[type=search]",exposedBindings:["predicate"],init:function(){this.base();var A=this.viewElement();if("search"===A.type){Event.observe(A,"search",this.valueChanged.bindAsEventListener(this))}},keypressUpdateTimeout:25,valueChanged:function(A){this.base(A);if(this.bindings.predicate){this.bindings.predicate.setValue(this.createFilterPredicate())}},createFilterPredicate:function(){var A=this.viewElement();var D=this.attributeOrProperty("predicate");var C=A.value.toLowerCase();function B(F){var E=F.valueForKeyPath(D);if(!E){return !!C}if(E.toLocaleString){E=E.toLocaleString()}else{E=E.toString()}E=E.toLowerCase();return(-1!==E.indexOf(C))}return B},observePredicateChange:function(A){}});coherent.SelectField=Class.create(coherent.ListView,{__viewClassName__:"Select",__tagSpec__:"select",exposedBindings:["errorMessage","displayValues","contentValues","selectedValue","name"],init:function(){this.base();this._items=function(B){var A=this.viewElement().options;return B?A[B]:A}},_initFromDOM:function(){var N=this.viewElement(),C=this.bindings,E=this.objectClass||coherent.KVO,J=[],L=[],M=N.options,K=M.length,G,H,B,F;if(N.name&&C.name&&!C.name.hasValue()){C.name.setValue(N.name)}if(!K||(C.content&&C.content.hasValue())){return }var I=C.displayValues&&C.displayValues.keyPath;var A=C.contentValues&&C.contentValues.keyPath;var D=C.content&&C.content.keyPath;if(I&&I.beginsWith(D)){I=I.substring(D.length+1)}else{I=null}if(A&&A.beginsWith(D)){A=A.substring(D.length+1)}else{A=null}for(G=0;G<K;++G){H=M[G];B=Element.assignId(H);F=L[G]=new E();if(I){F.setValueForKeyPath(H.text,I)}if(A){F.setValueForKeyPath(H.value,A)}if(H.selected){J.push(G)}}this.__content=L;this.__selectionIndexes=J;this.selectedIndex=J.length?J[0]:-1;if(C.content){C.content.setValue(L)}if(J.length){if(C.selectionIndexes){C.selectionIndexes.setValue(J)}if(C.selectedObject){C.selectedObject.setValue(this.selectedIndex)}if(C.selectedIndex){C.selectedIndex.setValue(this.selectedIndex)}if(C.selectedValue){C.selectedValue.setValue(M[this.selectedIndex].value)}}},observeContentChange:function(G){var H=this.viewElement(),D,I,E=[],J,B;switch(G.changeType){case coherent.ChangeType.setting:var F=this.__content=G.newValue||[],C=F.length;J=this.selectedObjects();while(H.options.length>C){H.remove(H.options.length-1)}for(D=0;D<C;++D){if(-1!==J.indexOf(F[D])){E.push(D)}if(D==H.options.length){if(coherent.Browser.IE){H.add(new Option())}else{H.add(new Option(),null)}}}break;case coherent.ChangeType.insertion:for(D=0;D<G.indexes.length;++D){I=G.indexes[D];if(!coherent.Browser.IE){I=H.options[I]}H.add(new Option(),I)}break;case coherent.ChangeType.replacement:for(D=0;D<G.indexes.length;++D){H.options[G.indexes[D]]=new Option()}break;case coherent.ChangeType.deletion:E=this.selectionIndexes();for(D=G.indexes.length-1;D>=0;--D){var A=G.indexes[D];H.remove(A);E.removeObject(A)}this.setSelectionIndexes(E);break;default:console.log("Unknown change type: "+G.changeType);break}if(this.bindings.displayValues){this.bindings.displayValues.update()}if(this.bindings.contentValues){this.bindings.contentValues.update()}this.setSelectionIndexes(E)},observeContentValuesChange:function(G){var B=this.viewElement();var E;var D;var F=B.options;var A=F.length;switch(G.changeType){case coherent.ChangeType.setting:if(!G.newValue){break}for(E=0;E<A;++E){F[E].value=G.newValue[E]}break;case coherent.ChangeType.insertion:case coherent.ChangeType.replacement:var C;for(C=0;C<G.indexes.length;++C){E=G.indexes[C];D=F[E];D.value=G.newValue[C]}break;default:console.log("Unknown change type: "+G.changeType);break}},observeDisplayValuesChange:function(G){var B=this.viewElement();var E;var D;var F=B.options;var A=F.length;switch(G.changeType){case coherent.ChangeType.setting:if(!G.newValue){break}for(E=0;E<A;++E){F[E].innerHTML=G.newValue[E]}break;case coherent.ChangeType.insertion:case coherent.ChangeType.replacement:var C;for(C=0;C<G.indexes.length;++C){E=G.indexes[C];D=F[E];D.innerHTML=G.newValue[C]}break;default:console.log("Unknown change type: "+G.changeType);break}},observeSelectedValueChange:function(F,H,B){if(this.bindings.content&&!this.bindings.content.value()){return }var G=this.viewElement();var I=G.options;var E=I.length;var A=F.newValue;G.disabled="undefined"===typeof (A)||coherent.Markers.MultipleValues===A||coherent.Markers.NoSelection===A;var D=[];A=A||"";for(var C=0;C<E;++C){if(I[C].value==A){D=[C];break}}this.setSelectionIndexes(D)},observeNameChange:function(D,C,B){var A=this.viewElement();A.name=D.newValue},observeErrorMessageChange:function(C){var B=C.newValue;if(!B){this.clearAllErrors();return }var A=new coherent.Error({description:C.newValue});this.presentError(A)},onkeydown:function(A){},presentError:function(A){this.validationError=A;Element.addClassName(this.viewElement(),coherent.Style.kInvalidValueClass);return this.base.apply(this,arguments)},clearAllErrors:function(){this.validationError=null;Element.removeClassName(this.viewElement(),coherent.Style.kInvalidValueClass);return this.base.apply(this,arguments)}});coherent.TableHeaderView=Class.create(coherent.View,{__viewClassName__:"TableHeader",exposedBindings:["sortDescriptors"],init:function(){this.base();var A=this.viewElement();if(!A.rows.length){return }var E=A.rows[0];var D=E.cells;var F=D.length;var C;this.__selectedColumn=-1;this.__sortKeyIndex={};for(var B=0;B<F;++B){C=D[B].getAttribute("sortKey");if(!C){continue}this.__sortKeyIndex[C]=B}},selectedColumn:function(){return this.__selectedColumn},setSelectedColumn:function(C){var B=this.viewElement();if(!B.rows.length){return }if(this.__selectedColumn===C){return }var E;var D=B.rows[0];if(-1!==this.__selectedColumn){E=D.cells[this.__selectedColumn];var A=E.__ascending?coherent.Style.kAscendingClass:coherent.Style.kDescendingClass;Element.updateClass(E,[],[coherent.Style.kSelectedClass,A])}this.__selectedColumn=C;if(-1!==this.__selectedColumn){E=D.cells[this.__selectedColumn];var F=E.__ascending?coherent.Style.kAscendingClass:coherent.Style.kDescendingClass;var G=E.__ascending?coherent.Style.kDescendingClass:coherent.Style.kAscendingClass;Element.updateClass(E,[coherent.Style.kSelectedClass,F],G)}},onclick:function(E){var A=this.viewElement();var B;var H=E.target||E.srcElement;while(H&&!(B=H.getAttribute("sortKey"))){if(H.parentNode==A){return }H=H.parentNode}if(!H){return }var D=this.__sortKeyIndex[B];if(this.__selectedColumn==D){H.__ascending=H.__ascending?false:true;var C=coherent.Style.kAscendingClass;var G=coherent.Style.kDescendingClass;if(H.__ascending){Element.updateClass(H,C,G)}else{Element.updateClass(H,G,C)}}else{this.setSelectedColumn(D)}var F=new coherent.SortDescriptor(B,H.__ascending?true:false);if(this.bindings.sortDescriptors){this.bindings.sortDescriptors.setValue([F])}},observeSortDescriptorsChange:function(C){var B=C.newValue;if(!B||!B.length||B.length>1){this.setSelectedColumn(-1);return }var A=this.__sortKeyIndex[B[0].keyPath];if("undefined"===typeof (A)||null===A){A=-1}this.setSelectedColumn(A)}});coherent.ToggleButton=Class.create(coherent.FormControl,{exposedBindings:["checked","selection"],__viewClassName__:"ToggleButton",__tagSpec__:["input[type=checkbox]","input[type=radio]"],init:function(){this.base();var A=this.viewElement();var B=this.bindings;if(B.checked&&!B.checked.hasValue()){B.checked.setValue(A.checked)}if(B.selection&&!B.selection.hasValue()&&A.checked&&A.value){B.selection.setValue(A.value)}},onclick:function(C){var A=this.viewElement();var B=A.checked;if(this.bindings.selection){this.bindings.selection.setValue(A.value)}if(this.bindings.checked){this.bindings.checked.setValue(B)}this.sendAction()},observeValueChange:function(C){this.base(C);var A=this.viewElement();var B=C.newValue;A.value=B;if(!this.bindings.selection){return }A.checked=(this.bindings.selection.value()==B);if(this.bindings.checked){this.bindings.checked.setValue(A.checked)}},observeCheckedChange:function(E,D,B){var A=this.viewElement();var C=!!E.newValue;A.checked=C;if(this.bindings.selection){this.bindings.selection.setValue(A.value)}},observeSelectionChange:function(E,D,B){var A=this.viewElement();var C=(E.newValue===A.value);A.checked=C;if(this.bindings.checked){this.bindings.checked.setValue(C)}}});coherent.ViewController=Class.create(coherent.Responder,{view:null,title:null,automaticallySetupBindings:false,constructor:function(B,C){this.base(C);if("string"===typeof (B)){this.__viewId=B}else{if(B&&1===B.nodeType){this.__viewId=Element.assignId(B)}else{this.__viewId=B.id}}var A=document.getElementById(this.__viewId);this.viewElement=function(){return A}},registerWithName:function(A){if(!A){return }this.name=A;coherent.registerModelWithName(this,A)},nextResponder:function(){return this.view.superview()},structure:function(){return this.__structure__},viewElement:function(){return this.view.viewElement()},addTrackingInfo:function(A,B){coherent.page.addTrackingInfo(A,B)},__postConstruct:function(){var A=document.getElementById(this.__viewId);if(A){this.__init()}else{Event.onDomReady(this.__init.bind(this))}},__init:function(){this.__initialising=true;var D=document.getElementById(this.__viewId);if(!D){throw new Error("Unable to locate node with ID: "+this.__viewId)}var F=this.__context;var A=coherent.dataModel;this.__context=coherent.dataModel=this;var C=this.structure()||{};var G={};var E;var H;this.__copyParameters(this.__parameters||{});var B=coherent.View.fromNode(D);for(H in C){E=C[H];if(E&&"function"==typeof (E)&&(E=E.valueOf()).__factoryFn__){G[H]=E;E.call(this,H,true)}}for(H in G){G[H].call(this,H,false)}if(!B){coherent.View.createViewsForNodeTree(D,null,this);B=coherent.View.createViewForNode(D)}this.view=B;this.view.setNextResponder(this);coherent.dataModel=A;this.__context=F;this.setupBindings();this.init();this.updateBindings();this.createObservers();delete this.__initialising;delete this.viewElement},init:function(){}});coherent.ViewController.__subclassCreated__=function(A){var B=A.prototype;var C=A.superclass.prototype;if(B.__structure__!==C.__structure__){Object.applyDefaults(B.__structure__,C.__structure__)}};
