/* @license
==========================================================================
Tn Js Framework
Copyright ©2008, Till Niese.

Permission is hereby granted, free of charge, to any person obtaining a 
copy of this software and associated documentation files (the "Software"), 
to deal in the Software without restriction, including without limitation 
the rights to use, copy, modify, merge, publish, distribute, sublicense, 
and/or sell copies of the Software, and to permit persons to whom the 
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in 
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
DEALINGS IN THE SOFTWARE.

==========================================================================
@license */
var $j=jQuery;if($j().jquery<"1.4"){alert("This library requries jquery 1.4 or newer")}var include=include||function include(){};var YES=true;var NO=false;var EMPTY;var Tn=Tn||{};Tn.ns=function(c,b){var a,d;a=window[c];for(d in b){if(b.hasOwnProperty(d)){a[d]=b[d]}}};Tn.Exception=function(b,c){this.message=c};Tn.Exception.prototype.toString=function(){return this.message};Tn.ns("Tn",{guidKey:"$guid",_nextGUID:1,T_UNDEFINED:"undefined",T_NULL:"null",T_ARRAY:"array",T_EXCEPTION:"exception",T_CLASS:"class",T_MIXIN:"mixin",T_INTERFACE:"interface",T_FUNCTION:"function",T_OBJECT:"object",T_HASH:"hash",T_BOOL:"boolean",T_NUMBER:"number",T_STRING:"string",T_JQUERY:"jquery",T_DOMELEMENT:"domelement",typeOf:function _(b){if(b===undefined){return Tn.T_UNDEFINED}if(b===null){return Tn.T_NULL}var a=typeof(b);if(a==="object"){if(!Tn.none(b.nodeType)){a=Tn.T_DOMELEMENT}else{if(b.jquery){a=Tn.T_JQUERY}else{if(b instanceof String){a=Tn.T_STRING}else{if(b instanceof Array){a=Tn.T_ARRAY}else{if(b instanceof Function){a=(b.$isClass)?Tn.T_CLASS:Tn.T_FUNCTION}else{if(Tn.Exception&&(b instanceof Tn.Exception)){a=Tn.T_EXCEPTION}else{if(b.$isObject===true){a=Tn.T_OBJECT}else{if(b.$isMixin===true){a=Tn.T_MIXIN}else{if(b.$isInterface===true){a=Tn.T_INTERFACE}else{a=Tn.T_HASH}}}}}}}}}}else{if(a===Tn.T_FUNCTION){a=(b.$isClass)?Tn.T_CLASS:Tn.T_FUNCTION}}return a},none:function _(a){return a===null||a===undefined},empty:function _(a){return a===null||a===undefined||a===""||a===""},isInteger:function _(b){var a;a=parseInt(b,10);if(a===b){return YES}a+="";return a===b},isFunction:function _(a){return(Tn.typeOf(a)===Tn.T_FUNCTION)},isArray:function _(c){if(c&&c.objectAt){return YES}var a=(c?c.length:null),b=Tn.typeOf(c);return(b===Tn.T_ARRAY)},makeArray:function _(a){return Tn.isArray(a)?a:Tn.$A(a)},$A:function _(d){var b,c,a;a=[];c=d.length;for(b=0;b<c;b++){a.push(d[b])}return a},guidFor:function _(c){var a,b;if(c===undefined){return"(undefined)"}else{if(c===null){return"(null)"}else{if(c===Object){return"(Object)"}else{if(c===Array){return"(Array)"}}}}if(c[this.guidKey]){return c[this.guidKey]}b=(typeof c);if(b===Tn.T_NUMBER){return("nu."+c)}else{if(b===Tn.T_STRING){return("st."+c)}else{if(b===Tn.T_BOOL){return(c)?"(true)":"(false)"}else{return this.generateGuid(c)}}}return a},generateGuid:function _(b){var a=("guid."+(this._nextGUID++))+".["+window.$uuid+"]";if(b){b[this.guidKey]=a}return a},hashFor:function _(a){return(a&&a.hash&&(typeof a.hash===Tn.T_FUNCTION))?a.hash():this.guidFor(a)},isEqual:function _(d,c){if(d===null){return c===null}else{if(d===undefined){return c===undefined}else{return this.hashFor(d)===this.hashFor(c)}}}});if(typeof window.console==="undefined"){window.console={};window.console.log=window.console.info=window.console.warn=window.console.dir=window.console.error=function(){};window.console.$fake=YES}Tn.ns=function(d,l){var j,g,f,m,b,n,a,k,c;k=NO;n=!Tn.none(l);a=Tn.typeOf(l);j=window;d=d.split(".");g=d.length;if(n){g--}for(f=0;f<g;f++){m=Tn.typeOf(j[d[f]]);if(Tn.none(j[d[f]])){j[d[f]]={}}else{if(m!==Tn.T_HASH&&m!==Tn.T_CLASS&&m!==Tn.T_FUNCTION){throw new Error("'"+d.join(".")+"' did not work")}}if(m===Tn.T_CLASS){k=YES}j=j[d[f]]}if(n){m=Tn.typeOf(j[d[f]]);if(m===Tn.T_CLASS&&a===Tn.T_CLASS){throw new Error("'"+d.join(".")+"' already is a class an can't be replaced.")}if(m===Tn.T_CLASS){k=YES}if(k&&a!==Tn.T_CLASS){if(a===Tn.T_HASH){for(b in l){if(l.hasOwnProperty(b)){Tn.ns(d.join(".")+"."+b,l[b])}}}else{throw new Error("'"+d.join(".")+"' must be a class or a hash.")}}else{if(Tn.none(j[d[f]])){j[d[f]]=l}else{if(a===Tn.T_CLASS){c=j[d[f]];j[d[f]]=l;try{Tn.ns(d.join("."),c)}catch(h){throw new Error("Creating Class '"+d.join(".")+"' failed cause of childs.")}}else{for(b in l){if(Tn.none(j[d[f]][b])){j[d[f]][b]=l[b]}else{throw new Error("Property '"+d.join(".")+"."+b+"' already exists.")}}}}}j=j[d[f]]}return j};Tn.$Debugging=YES;Tn.$Profiling=YES;Tn.clone=function(c){var d,a,b,e;d=Tn.typeOf(c);if(c===window){return c}else{if(d===Tn.T_HASH){a={};for(b in c){if(c.hasOwnProperty(b)){a[b]=Tn.clone(c[b])}}return a}else{if(d===Tn.T_ARRAY){a=[];for(b=0,e=c.length;b<e;++b){a[b]=Tn.clone(c[b])}return a}else{if(d===Tn.T_OBJECT){return c.clone()}}}}return c};Tn.randomUUID=function(){var b=[],c="0123456789abcdef",a;for(a=0;a<36;a++){b[a]=Math.floor(Math.random()*16)}b[14]=4;b[19]=(b[19]&3)|8;for(a=0;a<36;a++){b[a]=c[b[a]]}b[8]=b[13]=b[18]=b[23]="-";return b.join("")};window.$uuid=Tn.randomUUID();window.ABSTRACT_METHODE=function(){};window.$__toUpdateDescriptors=[];Tn.Class=function(a){var b,j,d,c,f,e,g,h;c=Tn.Class.Utils.$__buildConstructor();c.$description=Tn.Class.Utils.$__analysateDescriptor(a);c.$description.members=Tn.Class.Utils.$__analysateMembers(a,c);c.$description.observerList=[];c.$description.mixinIntitalizers=[];c.$description.subclasses=EMPTY;c.$description.superclass=EMPTY;Tn.Class.Utils.$__processMembers(c);if(Tn.typeOf(Tn.Set)!==Tn.T_CLASS){window.$__toUpdateDescriptors.push(c)}else{c.$description.subclasses=new Tn.Set();Tn.Class.Utils.$__setSuperClassInfo(c)}b=Tn.ns(c.$description.name,c);if(b.$description.members.bootstrap){b.$description.members.bootstrap.apply(b)}if(c.$description.isAutoInitialize){f=new b()}};Tn.Class.unload=function(b){var e,a,d,c,f;if(Tn.typeOf(b)===Tn.T_CLASS){e=b.getClassName()}else{e=b}d=e.split(".");c=d.pop();f=d.join(".");delete Tn.ns(f)[c]};Tn.ns("Tn.Class.Utils",{$__updateDescriptors:function _(){var a=this;$j.each(window.$__toUpdateDescriptors,function(){this.$description.subclasses=new Tn.Set()});$j.each(window.$__toUpdateDescriptors,function(){a.$__setSuperClassInfo(this)})},$__setSuperClassInfo:function _(a){var b=Tn.ns(a.$description.Extends);if(a!==b){a.$description.superclass=b;b.$description.subclasses.add(a)}},$__buildConstructor:function _(){var a;a=function(){var d,f,b,c,e,g;c=this;d=arguments;if(a.$description.isSingelton&&a.$instance){return a.$instance}if(a.$___arrayInit===YES){a.$___arrayInit=NO;d=d[0]}if(!(this instanceof a)){a.$___arrayInit=YES;c=new a(arguments);return c}else{if(a.$description.isAbstract){throw new Tn.Exception("Class '%@' is abstract and can't be intitialized.".format([a.$description.name]))}b=a.$description.members;for(f in b){if(Tn.typeOf(b[f])!==Tn.T_FUNCTION){if(Tn.Class.Utils.$__isNotStatic(b[f])){this[f]=Tn.clone(b[f].$initValue)}}}g=a.$description.observerList.length;for(e=0;e<g;e++){this.addObserver(a.$description.observerList[e][0],this,a.$description.observerList[e][1],a.$description.observerList[e][2])}if(this.initialize){this.initialize.apply(this,d)}c=this}if(a.$description.isSingelton){a.$instance=c}return c};a.$isClass=YES;return a},$__copyMembers:function _(b){var a=this;this.each(b.$description.members,function(e){var g,d,f,c;g=this;if(Tn.isFunction(g)){if(g.$isCachable){f=g.$bridge.$cacheObservesProps.length;for(c=0;c<f;c++){b.$description.observerList.push([g.$bridge.$cacheObservesProps[c],"__invalidateCache",g.$bridge])}}if(a.$__isStatic(g)){b[e]=g;b.prototype[e]=g.$staticBridge}if(a.$__isNotStatic(g)){b.prototype[e]=g}}else{if(a.$__isStatic(g)){if(g.$info.owner===b||g.$info.owner.$description.isMixin){b[e]=Tn.clone(g.$initValue)}}}})},$__mergeMembers:function _(e,b,d){var a,c;a=this;this.each(e,function(f){if(!Tn.none(b[f])){if(a.$__checkIfOverwriteAble(this,b[f])){c=Tn.typeOf(this);if(c===Tn.T_FUNCTION){if(b[f].$info&&!b[f].$info.isAbstract){this.$super=b[f]}b[f]=this}else{b[f]=this}}else{console.warn(f+" is not overwrite able cause of differnt types")}}else{b[f]=this}})},$__processMembers:function _(b){var c,a,d;c=b.$description.members;b.$description.members={};if(b.$description.Extends!==b.$description.name){a=Tn.ns(b.$description.Extends);if(Tn.none(a.$description)){throw new Exception(b.$description.Extends+" not loaded.")}this.$__mergeMembers(a.$description.members,b.$description.members,b)}this.$__mergeMembers(c,b.$description.members,b);d=NO;this.each(b.$description.members,function(){if(this.$info.isAbstract){d=YES}});if(d&&!b.$description.isAbstract){throw new Tn.Exception("Class '%@' should be defined as abstract, cause it has abstract methodes.".format([b.$description.name]))}this.$__copyMembers(b)},each:function _(b,e){var c,d,a;d=NO;a=NO;for(c in b){if(b.hasOwnProperty(c)){if(c==="toString"){d=YES}else{if(c==="valueOf"){a=YES}}e.call(b[c],c)}}if(!a&&b.valueOf!==Object.prototype.valueOf){e.call(b.valueOf,"valueOf")}if(!d&&b.toString!==Object.prototype.toString){e.call(b.toString,"toString")}}});Tn.ns("Tn.Class.Utils",{$__isStatic:function _(a){return a.$info.isHybrid||a.$info.isStatic},$__isNotStatic:function _(a){return a.$info.isHybrid||!a.$info.isStatic},$__checkIfOverwriteAble:function _(d,a){var b,c;b=Tn.typeOf(d);c=Tn.typeOf(a);if(c===Tn.T_FUNCTION){if(a.$info){if(a.$info.isFinal){throw new Tn.Exception("Methode '%@' of Class '%@' cannot be overwritten by '%@' cause its final.".format([d.$info.name,a.$info.owner.$description.name,d.$info.owner.$description.name]))}else{if(d.$info.isStatic!==a.$info.isStatic){throw new Tn.Exception("Methode '%@' of Class '%@' cannot be overwritten by '%@' cause they differn in static info.".format([d.$info.name,a.$info.owner.$description.name,d.$info.owner.$description.name]))}else{if(d.$info.isHybrid!==a.$info.isHybrid){throw new Tn.Exception("Methode '%@' of Class '%@' cannot be overwritten by '%@' cause they differn in hybrid info.".format([d.$info.name,a.$info.owner.$description.name,d.$info.owner.$description.name]))}}}}else{if(d.$info.isStatic||d.$info.isHybrid){throw new Tn.Exception("Static/Hybrid Methode '%@' of Class '%@' cannot overwrtie native methode.".format([d.$info.name,d.$info.owner.$description.name]))}}}return(b===c)},$__analysateDescriptor:function _(d,b){var c,a;a=NO;c={};if(Tn.typeOf(d.Mixin)===Tn.T_STRING){c.isMixin=YES;c.name=d.Mixin;delete d.Mixin}else{if(Tn.typeOf(d.Class)===Tn.T_STRING){c.isClass=YES;c.name=d.Class;c.isAbstract=d.Abstract||NO;c.isSingelton=d.Singelton||NO;c.isAutoInitialize=d.AutoInitialize||NO;c.isFinal=d.Final||NO;c.Extends=d.Extends||"Tn.Object";c.Implements=d.Implements||[];c.Mixins=d.Mixins||[];delete d.Class;delete d.Abstract;delete d.Singelton;delete d.AutoInitialize;delete d.Final;delete d.Extends;delete d.Implements;delete d.Mixins}else{if(Tn.typeOf(d.Interface)===Tn.T_STRING){c.isInterface=YES;c.name=d.Interface;a=YES;delete d.Interface}}}return c},$__analysateMembers:function _(e,a){var b,c,f,d;d={};b={};this.each(e,function(g){f=Tn.Class.Utils.$__analysateMember(g,e[g],a);if(d[f.$info.name]===YES){throw new Tn.Exception("'%@' is already defined in Class '%@'.".format([f.$info.name,f.$info.owner.$description.name]))}if(f.$info.isStatic&&f.$info.isHybrid){throw new Tn.Exception("Methode '%@' of Class '%@' is defined as hybrid and static which is invalid.".format([f.$info.name,f.$info.owner.$description.name]))}if(f.$info.isFinal&&f.$info.isAbstract){throw new Tn.Exception("Methode '%@' of Class '%@' is defined as final and abstract which is invalid.".format([f.$info.name,f.$info.owner.$description.name]))}d[f.$info.name]=YES;b[f.$info.name]=f});return b},$__analysateMember:function _(a,d,b){var g,h,c,e,f;c={};c.owner=b;h=Tn.typeOf(d);if(a.indexOf(".")!==-1){throw new Tn.Exception("'%@' is an invalid propertyname".format([a]))}if(a.charAt(0)==="$"){a=a.split("$");if(a.length===2){c.name=a.join("$")}else{for(e=1;e<a.length-1;++e){if(a[e]===""){break}f=a[e];f=f.charAt(0).toUpperCase()+f.substr(1);c["is"+f]=YES}c.name=a.slice(e).join("$")}}else{c.name=a}if(h===Tn.T_FUNCTION){if(c.isAbstract&&d!==ABSTRACT_METHODE){throw new Tn.Exception("Methode '%@' of Class '%@' is defined abstract but has function body use EMPTY or ABSTRACT_METHODE.".format([c.name,c.owner.$description.name]))}if(d.$isCachable){f=function(){var k,i;k=Tn.guidFor(arguments.callee.$bridge);if(Tn.none(this.$_observAble.caches[k])){this.$_observAble.caches[k]=arguments.callee.$bridge.apply(this,arguments)}return this.$_observAble.caches[k]};d.$info=c;f.$isCachable=YES;f.$isCachableProxy=YES;f.$bridge=d;d=f}if(c.isStatic){f=function(){return arguments.callee.$bridge.apply(this.constructor,arguments)};f.$bridge=d;d.$staticBridge=f}g=d}else{if(c.isAbstract){g=ABSTRACT_METHODE}else{if(c.isDeprecated){g=function j(){throw new Tn.Exception("Methode '%@' of Class '%@' is deprecated.".format([j.$info.name,j.$info.owner.$description.name]))}}else{g={};g.$initValue=d}}}g.$info=c;return g}});Tn.Interface=function(a){};Tn.Mixin=function(b){var a={};a.$description=Tn.Class.Utils.$__analysateDescriptor(b);a.$description.members=Tn.Class.Utils.$__analysateMembers(b,a);Tn.ns(a.$description.name,a)};Tn.mixin=function(a,b){a=Tn.ns(a);b=Tn.ns(b);delete b.$description.members.bootstrap;delete b.$description.members.intitialize;Tn.Class.Utils.each(b.$description.members,function(c){var d=Tn.typeOf(this);a.$description.members[c]=this;if(d===Tn.T_FUNCTION){if(Tn.Class.Utils.$__isStatic(this)){a[c]=this}if(Tn.Class.Utils.$__isNotStatic(this)){a.prototype[c]=this}}})};Tn.Class({Class:"Tn.Object",$isObject:YES,$guid:EMPTY,$window:window,initialize:function _(){},$hybrid$call:function _(b,a){if((Tn.typeOf(this)===Tn.T_CLASS)){}else{if(!Tn.isFunction(this[b])){throw new Tn.Exception(b+" does not exist")}return this[b].apply(this,a)}},$final$hybrid$getClassName:function _(){if((Tn.typeOf(this)===Tn.T_CLASS)){return this.$description.name}else{return this.constructor.$description.name}},$final$getClass:function _(){return this.constructor},$final$getGuid:function _(){if(!this[Tn.guidKey]){Tn.guidFor(this)}return this[Tn.guidKey]},$final$hybrid$isInstanceOf:function _(c){var a,b;a=Tn.typeOf(c);if(!(a===Tn.T_OBJECT||a===Tn.T_CLASS)){return NO}b=this;if(Tn.typeOf(b)===Tn.T_OBJECT){b=b.getClass()}if(a===Tn.T_OBJECT){c=c.getClass()}while(b!==c&&!Tn.none(b)){b=b.getSuperClass()}return b===c},$final$hybrid$isSuperClassOf:function _(c,b){var a;if(Tn.none(b)){b=NO}else{b=YES}a=Tn.typeOf(c);if(((a===Tn.T_CLASS&&!b)||a===Tn.T_OBJECT)){return c.isInstanceOf(this)}return NO},$final$hybrid$getSuperClass:function _(){if((Tn.typeOf(this)===Tn.T_CLASS)){return this.$description.superclass}else{return this.getClass().getSuperClass()}},clone:function _(){throw new Tn.Exception("Clone is not implemented")},$final$getObjectWindow:function _(){return this.$window},$final$getObjectWindowUUID:function _(){return this.$window.$uuid},toString:function _(){return"["+this.getClassName()+":"+this.getGuid+"]"}});Tn.Mixin({Mixin:"Tn.Observeable",$hybrid$$_observAble:{observers:{},caches:{},pathObserverHelper:{},changes:EMPTY,changeLevel:0},bootstrap:function _(){},intitialize:function _(){},$hybrid$set:function _(a,k){var f,c,d,g,j,b,e,h,l;if(arguments.length===1){this.set("value",arguments[0])}else{if(Tn.Profiler){Tn.Profiler.start("Set '[%@]'".format([a]))}if((e=a.indexOf("."))!==-1){b=a.substr(e+1);a=a.substr(0,e);if(Tn.typeOf(this[a])===Tn.T_OBJECT){this[a].set(b,k)}else{}}else{l=this.automaticallyNotifiesObserversFor(a);if(this[a]===k){if(Tn.Profiler){Tn.Profiler.stop()}return}if(l){this.propertyWillChange(a)}if((Tn.typeOf(this)===Tn.T_CLASS)){f=this.$description}else{f=this.constructor.$description}if(Tn.none(f.members[a])){throw new Tn.Exception(a+" does not exist.")}if((Tn.typeOf(this)===Tn.T_CLASS)){if(!f.members[a].$info.isStatic&&!f.members[a].$info.isHybrid){throw new Tn.Exception(a+" is neither static nor hybrid")}if(f.members[a].$info.owner.$description.name===this.getClassName()){this[a]=k}else{f.members[a].$info.owner.set(a,k)}}else{if(!f.members[a].$info.isStatic){this[a]=k}else{f.members[a].$info.owner.set(a,k)}}if(l){this.propertyDidChange(a)}}if(Tn.Profiler){Tn.Profiler.stop()}}return this},$hybrid$get:function _(e){var a,d,c,b;if(arguments.length===0){return this.get("value")}else{if((c=e.indexOf("."))!==-1){d=e.substr(c+1);e=e.substr(0,c)}if((Tn.typeOf(this)===Tn.T_CLASS)){a=this.$description.members}else{a=this.constructor.$description.members}if(Tn.none(a[e])){throw new Tn.Exception(e+" does not exists.")}if(Tn.isFunction(a[e])){return this[e]()}if(!a[e].$info.isStatic&&(Tn.typeOf(this)===Tn.T_CLASS)){throw new Tn.Exception(e+" is not accessable form static context.")}if((Tn.typeOf(this)===Tn.T_CLASS)||((Tn.typeOf(this)!==Tn.T_CLASS)&&a[e].$info.isStatic)){b=a[e].$info.owner[e]}else{b=this[e]}if(!Tn.none(d)){if(Tn.typeOf(b)===Tn.T_OBJECT){b=b.get(d)}else{return EMPTY}}return b}},$hybrid$automaticallyNotifiesObserversFor:function _(a){return YES},$hybrid$beginPropertyChanges:function _(){this.$_observAble.changeLevel=(this.$_observAble.changeLevel||0)+1;return this},$hybrid$endPropertyChanges:function _(){var b,a;b=this.$_observAble.changeLevel=(this.$_observAble.changeLevel||0)-1;a=this.$_observAble.changes;if((b<=0)&&a&&(a.length>0)){this.__notifyPropertyObservers()}return this},$hybrid$propertyWillChange:function _(a){},$hybrid$propertyDidChange:function _(e,c){var d,a,b;a=NO;d=this.$_observAble.changeLevel;if((d>0)||a){b=this.$_observAble.changes;if(!b){b=this.$_observAble.changes=new Tn.Set()}b.add(e)}else{this.__notifyPropertyObservers(e)}},allPropertiesDidChange:function _(){this.__notifyPropertyObservers("*");return this},$hybrid$__notifyPropertyObservers:function _(k){var e,d,c,h,b,f,g,a;this.$_observAble.changeLevel++;h=this.$_observAble.changes;if(!h){h=this.$_observAble.changes=new Tn.Set()}h.add("*");if(k==="*"){Tn.Class.Utils.each(this.$_observAble.observers,function(i){h.add(i)})}else{if(k){h.add(k)}}a=[];c=h.length;for(e=0;e<c;e++){b=h[e];this.___notifyPropertyObservers(b,a)}a.sort(this.$___sortObservers);c=a.length;for(e=0;e<c;e++){g=a[e].member[0]||this;a[e].member[1].call(g,this,a[e].prop,a[e].member[2])}h.empty();this.$_observAble.changeLevel--;if(this.$_observAble.changeLevel==0&&h.length>0){this.propertyDidChange()}},$final$static$$___sortObservers:function _(d,c){if(d.member[1].$info.name===c.member[1].$info.name){if(!d.member[0]){return -1}return 0}else{if(d.member[1].$info.name==="__invalidateCache"){return -1}else{return 1}}},$hybrid$___notifyPropertyObservers:function _(f,c){var a,b,d,e;if(!Tn.none(this.$_observAble.observers[f])){a=this.$_observAble.observers[f].getMembers();d=a.length;for(b=0;b<d;b++){c.push({member:a[b],prop:f})}}},$hybrid$__invalidateCache:function _(g,h,d){var b,a,e,c,f;if(d){b=Tn.guidFor(d);delete this.$_observAble.caches[b];h=d.$info.name;if(!Tn.none(this.$_observAble.observers[h])){a=this.$_observAble.observers[h].getMembers();e=a.length;for(c=0;c<e;c++){f=a[c][0]||this;a[c][1].call(f,this,h,a[c][2])}}}},$hybrid$addObserver:function _(e,g,h,d,b){var c,f,a;if(b===undefined){b=(new Date()).getTime()}if(h===undefined){h=g;g=this}if(!g){g=this}if(Tn.typeOf(h)===Tn.T_STRING){h=g[h]}e=e.toString();if(g===this){g=null}if(Tn.none(this.$_observAble.observers[e])){this.$_observAble.observers[e]=new Tn.Core.ObserverSet()}if(!this.$_observAble.observers[e].contains(g,h)){if(e.indexOf(".")!==-1){if(Tn.none(this.$_observAble.pathObserverHelper[e])){this.$_observAble.pathObserverHelper[e]={}}a=Tn.guidFor(g)+":"+Tn.guidFor(h);if(Tn.none(this.$_observAble.pathObserverHelper[e][a])){this.$_observAble.pathObserverHelper[e][a]=new Tn.Core.PathObserver(this,e,g,h,d)}}this.$_observAble.observers[e].add(g,h,d,b)}},$hybrid$removeObserver:function _(b,c,d){var a;if(d===undefined){d=c;c=this}if(!c){c=this}if(Tn.typeOf(d)===Tn.T_STRING){d=c[d]}b=b.toString();if(c===this){c=null}if(!Tn.none(this.$_observAble.observers[b])){this.$_observAble.observers[b].remove(c,d);if(b.indexOf(".")!==-1){if(Tn.none(this.$_observAble.pathObserverHelper[b])){return}a=Tn.guidFor(c)+":"+Tn.guidFor(d);if(!Tn.none(this.$_observAble.pathObserverHelper[b][a])){this.$_observAble.pathObserverHelper[b][a].destroy();delete this.$_observAble.pathObserverHelper[b][a]}}}}});Tn.mixin("Tn.Object","Tn.Observeable");Function.prototype.property=function(){this.$isProperty=YES;return this};Function.prototype.cacheable=function(){this.$isCachable=YES;this.$cacheObservesProps=Tn.$A(arguments);return this};Tn.Class({Class:"Tn.Set.Proxy",_object:EMPTY,_context:EMPTY,initialize:function _(a,b){this._object=a;this._context=b},getObjectGuid:function _(){return Tn.guidFor(this._object)},getObject:function _(){return this._object},getContext:function _(){return this._context}});Tn.Class({Class:"Tn.Set",_idx:{},_set:[],length:0,initialize:function _(){},add:function _(d){var b,a,c;if(Tn.none(d)){return this}b=Tn.hashFor(d);a=this._idx[b];c=this.length;if(Tn.none(a)||(a>=c)||(this[a]!==d)){this[c]=d;this._idx[b]=c;this.length=c+1}return this},empty:function _(){var a,b;b=this.length;for(a=0;a<b;a++){delete this[a]}this.length=0},remove:function _(d){var b,a,c;if(Tn.none(d)){return this}b=Tn.hashFor(d);a=this._idx[b];c=this.length;if(Tn.none(a)||(a>=c)||(this[a]!==d)){return this}if(a<(c-1)){d=this[a]=this[c-1];this._idx[Tn.hashFor(d)]=a;this[c-1]=null}else{this[a]=null}delete this._idx[b];this.length=c-1},contains:function _(d){var b,a,c;if(Tn.none(d)){return NO}a=this._idx[Tn.hashFor(d)];return(!Tn.none(a)&&(a<this.length)&&(this[a]===d))},isEqual:function _(b){var a;if(!b||(b.get("length")!==this.get("length"))){return NO}a=this.get("length");while(--a>=0){if(!b.contains(this[a])){return NO}}return YES}});Tn.Class.Utils.$__updateDescriptors();delete Tn.Exception;Tn.Class({Class:"Tn.Exception",message:"",$final$initialize:function _(a){this.set("message",a)},toString:function _(){return this.get("message")}});Number.prototype.format=function(e,b,h,f){var i,g,c,a,j;i=b||".";g=h||"";c=this;if(!Tn.none(e)){c=c.toFixed(e)}c=c.split(".");a=[];while(c[0].length>3){j=c[0].substr(c[0].length-3);a.unshift(j);c[0]=c[0].substr(0,c[0].length-3)}a.unshift(c[0]);c[0]=a.join(g);c=c.join(i);if(f){c=f.format(c)}return c};Date.prototype.format=function(b){b=b||"dd-MM-yyy";var a=this;return b.replace(/(M+|d+|y+)/g,function(d){var c=d;switch(d){case"d":return a.getDate();case"dd":c=a.getDate();if(c<=10){c="0"+c}break;case"M":return a.getMonth()+1;case"MM":c=a.getMonth()+1;if(c<=10){c="0"+c}break;case"y":case"yy":case"yyy":case"yyyy":case"yyyyy":return a.getFullYear()}return c})};Tn.Class({Class:"Tn.Array",length:0,$array:[],push:function _(a){this.insertAt(this.length,a);return this},pop:function _(){var b,a;b=this.get("length");if(b===0){return null}a=this.objectAt(b-1);this.removeAt(b-1);return a},removeAt:function _(a,b){},objectAt:function _(a){if(a<0){return undefined}if(a>=this.get("length")){return undefined}return this.$array[a]},insertAt:function _(b,a){if(b>this.length){throw new Tn.Exception("Out of range")}this.$array[b]=a;this.length=this.$array.length;this.notifyPropertyChange("length");this.notifyPropertyChange("[]");return this}});Tn.Class({Class:"Tn.String",value:"",initialize:function _(a){this.set(a)},append:function _(a){this.value+=a;return this},format:function _(){return new Tn.String(this.value.format.apply(this.value,arguments))},toString:function _(){return this.get("value")}});String.prototype.format=function(b){var a=0;return this.replace(/%@([0-9a-z]+)?/gi,function(c,d){if(Tn.empty(d)){d=a++}else{if(Tn.isInteger(d)){d=parseInt(d,10)-1}}c=b[d];return((c===null)?"(null)":(c===undefined)?"":c).toString()})};Tn.Class({Class:"Tn.Core.ObserverSet",_methods:{},_targets:0,_cache:EMPTY,initialize:function _(){},contains:function _(c,d){var b,a;b=(c)?Tn.guidFor(c):"__this__";a=this._methods[b];if(!a){return NO}return a.contains(d)},add:function _(f,h,d,a){var e,b,g,c;e=(f)?Tn.guidFor(f):"__this__";b=this._methods[e];if(!b){b=this[e]=new Tn.Set();b.target=f;this._targets++;this._methods[e]=b}b.add(h);this._cache=EMPTY;if(d!==undefined){g=b.contexts;if(!g){g=b.contexts={}}g[Tn.guidFor(h)]=d}},remove:function _(c,d){var b,a;b=(c)?Tn.guidFor(c):"__this__";a=this._methods[b];if(!a){return NO}a.remove(d);this._cache=EMPTY;if(a.length<=0){a.target=null;delete this._methods[b];this._targets--}else{if(!Tn.none(a.contexts)){delete a.contexts[Tn.guidFor(d)]}}return YES},getMembers:function _(){var j,c,h,g,e,f,a,b,d;if(!Tn.none(this._cache)){return this._cache}c=[];for(j in this._methods){if(this._methods.hasOwnProperty(j)){h=this._methods[j];d=h.contexts;g=h.target;f=h.length;for(e=0;e<f;e++){a=h[e];b=null;if(d){b=d[Tn.guidFor(a)]}c.push([g,a,b])}}}this._cache=c;return this._cache}});Tn.Class({Class:"Tn.Core.PathObserver",_key:EMPTY,_path:EMPTY,_pathLength:EMPTY,_object:EMPTY,_target:EMPTY,_method:EMPTY,_context:EMPTY,_objects:[],_guidIndex:{},initialize:function _(a,c,d,e,b){this._key=c;this._path=c.split(".");this._pathLength=this._path.length;this._originalTarget=d;this._target=d||a;this._object=a;this._method=e;this._context=b;this._objects[0]=a;this._guidIndex[a.getGuid()]=0;a.addObserver(this._path[0],this,"_propertyChanged");this._clearObserversFromIndex(0);this._rebuildObserversFormIndex(0)},getTarget:function _(){return this._originalTarget},destroy:function _(){this._clearObserversFromIndex(0);this._objects[0].removeObserver(this._path[0],this,"_propertyChanged")},_propertyChanged:function _(c,d){var b,a;b=c.getGuid();a=this._guidIndex[b];if(a===this._pathLength-1){this._method.call(this._target,this._object,this._key,this._context)}else{this._clearObserversFromIndex(a);this._rebuildObserversFormIndex(a);this._method.call(this._target,this._object,this._key,this._context)}},_clearObserversFromIndex:function _(a){var c,b,d;a=Math.max(1,a);c=this._objects.length;for(b=a;b<c;b++){d=this._objects[b];if(Tn.typeOf(d)!==Tn.T_OBJECT){break}d.removeObserver(this._path[b],this,"_propertyChanged");this._objects[b]=null;delete this._guidIndex[d.getGuid()]}this._objects.length=a+1},_rebuildObserversFormIndex:function _(a){var c,b,d;for(b=a;b<this._pathLength-1;b++){d=this._objects[b].get(this._path[b]);if(Tn.typeOf(d)!==Tn.T_OBJECT){break}d.addObserver(this._path[b+1],this,"_propertyChanged");this._objects[b+1]=d;this._guidIndex[d.getGuid()]=b+1}}});Tn.Class({Class:"Tn.Binding",_fromRoot:EMPTY,_toRoot:EMPTY,_fromPropertyPath:EMPTY,_toPropertyPath:EMPTY,_oneWay:NO,initialize:function _(){},from:function _(b,a){this._fromRoot=a;this._fromPropertyPath=b;return this},to:function _(b,a){this._toRoot=a;this._toPropertyPath=b;return this},setOneWay:function _(a){this._oneWay=a;return this},_changed:function _(e,c){var b,a,d,f;if(this._oneWay&&e===this._toRoot){return this}if(e===this._fromRoot){d=this._toRoot;a=this._toPropertyPath;f=this._fromRoot}else{f=this._toRoot;d=this._fromRoot;a=this._fromPropertyPath}if(Tn.Profiler){Tn.Profiler.start("Binding '[%@:%@]'".format([a,d.getGuid()]))}b=d.get(a);if(b!==f.get(c)){d.set(a,f.get(c))}if(Tn.Profiler){Tn.Profiler.stop()}},connect:function _(){this._fromRoot.addObserver(this._fromPropertyPath,this,"_changed");this._toRoot.addObserver(this._toPropertyPath,this,"_changed");this._changed(this._fromRoot,this._fromPropertyPath)},disconnect:function _(){}});Tn.Class({Class:"Tn.Url",protocol:EMPTY,host:EMPTY,port:EMPTY,params:{},hash:"",pathname:EMPTY,_autoRemoveIndex:EMPTY,_makeAbsolute:EMPTY,_baseUrl:EMPTY,$static$_autoRemoveIndexGlobal:YES,$static$_makeAbsoluteGlobal:NO,$static$_baseUrlGlobal:EMPTY,$static$_urlRegex:EMPTY,$static$bootstrap:function _(){var a,b,e,d,c;a="(?:([a-z]+:)//(?:([^:]*):([^@]*)@)?([^:/]+)(?::([0-9]+))?)?";b="([^\\?]+)?";e="(?:\\?([^#]*))?";d="(?:#(.*))?";c=new RegExp("^"+a+b+e+d+"$","i");this.set("_urlRegex",c);Tn.Url.setBaseUrl(new Tn.Url(window.location+""))},initialize:function _(b,d){var a,c,e;if(!Tn.none(d)){this.setBaseUrl(d)}if(Tn.none(b)){b=""}c=this.get("_urlRegex");a=b.match(c);this.set("protocol",a[1]);this.set("host",a[4]);if(!Tn.none(a[5])){this.set("port",parseInt(a[5],10))}e=a[6];if(e){e=this._preparePathname(a[6])}this.set("pathname",e);if(!Tn.empty(a[7])){this._parseParams(a[7])}if(!Tn.empty(a[8])){this.set("hash",Tn.Url.unescape(a[8]))}},$hybrid$setBaseUrl:function _(a){if((Tn.typeOf(this)===Tn.T_CLASS)){this.set("_baseUrlGlobal",a)}else{this.set("_baseUrl",a)}},$hybrid$setAutoRemoveIndex:function _(a){if((Tn.typeOf(this)===Tn.T_CLASS)){this.set("_autoRemoveIndexGlobal",a)}else{this.set("_autoRemoveIndex",a)}},getBaseUrl:function _(){return !Tn.none(this.get("_baseUrl"))?this.get("_baseUrl"):this.get("_baseUrlGlobal")},autoRemoveIndex:function _(){return !Tn.none(this.get("_autoRemoveIndex"))?this.get("_autoRemoveIndex"):this.get("_autoRemoveIndexGlobal")},makeAbsolute:function _(){return !Tn.none(this.get("_makeAbsolute"))?this.get("_makeAbsolute"):this.get("_makeAbsoluteGlobal")},$hybrid$setMakeAbsolute:function _(a){if((Tn.typeOf(this)===Tn.T_CLASS)){this.set("_makeAbsoluteGlobal",a)}else{this.set("_makeAbsolute",a)}},getHost:function _(){return this.get("host")||this.getBaseUrl().get("host")},getPort:function _(){return this.get("port")||this.getBaseUrl().get("port")},getProtocol:function _(){return this.get("protocol")||this.getBaseUrl().get("protocol")},getAbsolutePathName:function _(){var b,c,a,d;d=this.get("pathname");if(d.charAt(0)!=="/"){c=this.getBaseUrl();b=c.get("pathname").split("/");b.pop();d=this._preparePathname(b.join("/")+"/"+d)}return d},_hasSameDomain:function _(a){if(a.getHost()===this.getHost()&&a.getProtocol()===this.getProtocol()&&a.getPort()===this.getPort()){return YES}return NO},compose:function _(b){var l,d,a,c,f,m,g,k,e,h,j;m="";l=this.getHost();d=this.getPort();j=this.getProtocol();a=this.get("pathname");c=this.autoRemoveIndex();f=this.makeAbsolute();if(f||!Tn.none(b)){a=this.getAbsolutePathName();if(!Tn.none(b)&&!f&&this._hasSameDomain(b)){k=b.getAbsolutePathName().split("/");g=a.split("/");h=Math.min(k.length,g.length);for(e=0;e<h;e++){if(k[e]!==g[e]){break}}k.splice(0,e);g.splice(0,e);for(e=0,h=k.length-1;e<h;e++){g.splice(0,0,"..")}a=g.join("/")}else{m=j+"//"+l;if(d){m+=":"+d}}}if(c&&a){g=a.split("/");if(g[g.length-1].match(/^index\.(php|html|htm)$/i)){g[g.length-1]=""}a=g.join("/")}if(a){m+=a}if(this.get("hash")){m+="#"+Tn.Url.escape(this.get("hash"))}return m},_preparePathname:function _(e){var c,a,b,d;a=[];c=e.split("/");for(b=0,d=c.length;b<d;b++){if(c[b]===".."){if(a.length>0&&a[a.length-1]!==".."&&a[a.length-1]!==""){a.pop();continue}}a.push(c[b])}if(a.length>=2&&a[0]===""&&a[1]===".."){throw new Tn.Exception("Url not well formed")}return a.join("/")},_parseParams:function _(d){var b,c,a;a={};d=d.split("&");for(b=0,c=d.length;b<c;b++){this._parseParam(d[b],a)}this.params=a},_parseParam:function _(d,a){var b,c;d=d.split("=");b=Tn.Url.unescape(d[0]);if(!Tn.none(d[1])){c=Tn.Url.unescape(d[1])}b=b.replace(/\]/g,"");b=b.split("[");this._populateParamList(b,c,a)},_populateParamList:function _(d,c,b){var a;a=d.splice(0,1)[0];if(d.length===0){if(Tn.empty(a)){b.push(c)}else{b[a]=c}}else{if(Tn.none(b[a])){if(Tn.empty(d[0])||Tn.isInteger(d[0])){b[a]=[]}else{b[a]={}}}this._populateParamList(d,c,b[a])}},$static$unescape:function _(b){var a=unescape(b);a=a.replace(/\+/gi," ");return a},$static$escape:function _(b){var a=escape(b);a=a.replace(/\+/g,"%2B");a=a.replace(/%20/g,"+");return a},toString:function _(){return this.compose()}});Tn.Class({Class:"Tn.Cookie",Singelton:true,cookies:{},initialize:function _(){var c,d,a,b;b=document.cookie;b=b.split(";");for(c=0,d=b.length;c<d;c++){a=b[c].match(/^\s*([^=]*)=(.*)$/i);a[2]=a[2].replace(/\+/g," ");this.cookies[a[1]]=unescape(a[2])}},setCookie:function _(b,c,a){if(Tn.none(a)){a="Thu, 01-Jan-70 00:00:01 GMT"}this.cookies[b]=c;c=escape(c);c=c.replace(/\+/g,"%2B");c=c.replace(/%20/g,"+");document.cookie=b+"="+c+"; expires="+a+";"},getCookie:function _(a){return this.cookies[a]},deleteCookie:function _(a){document.cookie=a+"=; expires=Thu, 01-Jan-70 00:00:01 GMT;";delete this.cookies[a]}});Tn.Class({Class:"Tn.Core.Loader",Singelton:YES,AutoInitialize:YES,failedLoads:[],initialize:function _(){$j(function(){});this.failedLoads=[]},failedLoading:function _(a){this.failedLoads.push("js/"+a)},loadClass:function _(d){var c,e,b,a;c=Tn.ns(d);if(Tn.typeOf(c)!==Tn.T_CLASS){e="js/"+d.replace(/\./g,"/")+".js";b=$j("<script>",{type:"text/javascript",charset:"utf-8"});a=this;b.load(function(){var f=$j.inArray(e,a.failedLoads)===-1;if(f){console.log(d+" loaded")}b.remove()});b.attr("src",e);$j("head").get(0).appendChild(b.get(0))}}});Tn.Class({Class:"Tn.Application",Singelton:YES,AutoInitialize:YES,initialize:function _(){console.log("initialize application")},registratePageController:function _(a,b){if(!b){b=new Tn.Url()}}});Tn.Class({Class:"Tn.Core.Controller",inititalize:function _(){}});Tn.Class({Class:"Tn.Page.Controller",Extends:"Tn.Core.Controller",inititalize:function _(){}});
