/*
// ==========================================================================
// SproutCore -- JavaScript Application Framework
// copyright 2006-2008, Sprout Systems, Inc. and contributors.
//
// 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.
//
// For more information about SproutCore, visit http://www.sproutcore.com
//
//
// ==========================================================================
*/
String.English={};Object.extend(String.English,{"Invalid.CreditCard(%@)":"%@ is not a valid credit card number","Invalid.Email(%@)":"%@ is not a valid email address","Invalid.NotEmpty(%@)":"%@ must not be empty","Invalid.Password":"Your passwords do not match.  Please try typing them again.","Invalid.General(%@)":"%@ is invalid.  Please try again.","Invalid.Number(%@)":"%@ is not a number."});var require=require||function require(){};require("license");var YES=true;var NO=false;if(typeof console==="undefined"){var console=console||window.console||{};console.log=console.info=console.warn=console.error=function(){}}var SC=SC||{};var SproutCore=SproutCore||SC;SC.mixin=function(){var g=arguments[0]||{};var a=1;var e=arguments.length;var b=NO;var c;if(e===1){g=this||{};a=0}else{if((g===YES)||(g===NO)){b=g;g=arguments[1]||{};a=2}}if(typeof g!="object"&&typeof g!="function"){g={}}if(e===a){g=this;a=a-1}for(;a<e;a++){if(!(c=arguments[a])){continue}for(var d in c){if(!c.hasOwnProperty(d)){continue}var h=g[d];var j=c[d];if(g===j){continue}if(b&&j&&(typeof j==="object")&&!j.nodeType){j=SC.extend(b,h||(j.length!=null?[]:{}),j)}if(j!==undefined){g[d]=j}}}return g};SC.extend=SC.mixin;SC.mixin({T_ERROR:"error",T_OBJECT:"object",T_NULL:"null",T_CLASS:"class",T_HASH:"hash",T_FUNCTION:"function",T_UNDEFINED:"undefined",T_NUMBER:"number",T_BOOL:"boolean",T_ARRAY:"array",T_STRING:"string",clone:function(b){var a=b;switch(SC.typeOf(b)){case T_ARRAY:if(b.clone&&SC.typeOf(b.clone)===SC.T_FUNCTION){a=b.clone()}else{a=b.slice()}break;case T_HASH:case T_OBJECT:if(b.clone&&SC.typeOf(b.clone)===SC.T_FUNCTION){a=b.clone()}else{a={};for(var c in b){a[c]=b[c]}}}return a},callOnLoad:function(b,c){if(c===undefined){c=b;b=null}if(typeof(c)==="string"){if(b){c=b[c]}else{throw"You must pass a function to callOnLoad() (got: "+c+")"}}if(SC._onloadQueueFlushed){c.apply(b||window.document)}var a=SC._onloadQueue=(SC._onloadQueue||[]);a.push([b,c])},didLoad:function(){SC.app=SC.Application.create();SC.app.run();var c=$tag("body");Element.addClassName(c,String.currentLanguage().toLowerCase());var a;SC.runLoop.beginRunLoop();if(window.callOnLoad){if(window.callOnLoad instanceof Array){a=window.callOnLoad}else{if(window.callOnLoad instanceof Function){a=[window,window.callOnLoad]}}}else{a=[]}a=a.concat(SC._onloadQueue);var d=null;while(d=a.shift()){if(SC.typeOf(d)===T_FUNCTION){d.call(document)}else{d[1].call(d[0]||document)}}SC._onloadQueueFlushed=true;if(window.main&&(main instanceof Function)){main()}if(typeof Routes!="undefined"){Routes.doRoutes()}else{if(typeof SC.Routes!="undefined"){SC.Routes.ping()}}SC.runLoop.endRunLoop();c=null;a=null;d=null},typeOf:function(b){if(b===undefined){return T_UNDEFINED}if(b===null){return T_NULL}var a=typeof(b);if(a=="object"){if(b instanceof Array){a=T_ARRAY}else{if(b instanceof Function){a=(b.isClass)?T_CLASS:T_FUNCTION}else{if(SC.Error&&(b instanceof SC.Error)){a=T_ERROR}else{if(b.isObject===true){a=T_OBJECT}else{a=T_HASH}}}}}else{if(a===T_FUNCTION){a=(b.isClass)?T_CLASS:T_FUNCTION}}return a},isArray:function(a){return($type(a)===T_ARRAY)||(a&&((a.length!==undefined)||a.objectAt))},$A:function(d){if(d==null){return[]}if(d.slice instanceof Function){return d.slice()}if(d.toArray){return d.toArray()}if(d.length===undefined||$type(d)===SC.T_FUNCTION){return[d]}var b=d.length;var c=[];for(var a=0;a<b;a++){c[a]=d[a]}return c},guidFor:function(a){if(a===undefined){return"(undefined)"}if(a===null){return"(null)"}if(a._guid){return a._guid}switch($type(a)){case T_NUMBER:return this._numberGuids[a]=this._numberGuids[a]||("#"+a);break;case T_STRING:return this._stringGuids[a]=this._stringGuids[a]||("$"+a);break;case T_BOOL:return(a)?"(true)":"(false)";break;default:return a._guid=SC.generateGuid()}},generateGuid:function(){return("@"+(SC._nextGUID++))},_nextGUID:0,_numberGuids:[],_stringGuids:{},hashFor:function(a){return(a&&a.hash&&$type(a.hash)===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 SC.hashFor(d)===SC.hashFor(c)}}},inspect:function(a){return $H(a).inspect()},Platform:{IE:function(){if(Prototype.Browser.IE){return(navigator.appVersion.match(/\bMSIE.*7\.\b/))?7:6}else{return 0}}(),Safari:function(){if(Prototype.Browser.WebKit){var a=parseInt(navigator.appVersion.replace(/^.*?AppleWebKit\/(\d+).*?$/,"$1"),0);return(a>420)?3:2}return 0}(),Firefox:function(){var a=0;if(Prototype.Browser.Gecko){if(navigator.userAgent.indexOf("Firefox")!=-1){a=parseFloat((navigator.userAgent.match(/Firefox\/(.)/)[1])||0)}if(a<1){a=2}}return a}(),isWindows:function(){return !!(navigator.appVersion.match(/(Windows)/))}(),isMac:function(){if(Prototype.Browser.Gecko){return !!(navigator.appVersion.match(/(Macintosh)/))}else{return !!(navigator.appVersion.match(/(Mac OS X)/))}}()},isIE:function(){return SC.Platform.IE>0},isSafari:function(){return SC.Platform.Safari>0},isSafari3:function(){return SC.Platform.Safari>=3},isIE7:function(){return SC.Platform.IE>=7},isIE6:function(){return(SC.Platform.IE>=6)&&(SC.Platform.IE<7)},isWindows:function(){return SC.Platform.isWindows},isMacOSX:function(){return SC.Platform.isMac},isFireFox:function(){return SC.Platform.Firefox>0},isFireFox2:function(){return SC.Platform.Firefox>=2}});SC.$type=SC.typeOf;SC.getGUID=SC.guidFor;SC.Platform.Browser=function(){if(SC.Platform.IE>0){return"IE"}else{if(SC.Platform.Safari>0){return"Safari"}else{if(SC.Platform.Firefox>0){return"Firefox"}}}}();var T_ERROR=SC.T_ERROR;var T_OBJECT=SC.T_OBJECT;var T_NULL=SC.T_NULL;var T_CLASS=SC.T_CLASS;var T_HASH=SC.T_HASH;var T_FUNCTION=SC.T_FUNCTION;var T_UNDEFINED=SC.T_UNDEFINED;var T_NUMBER=SC.T_NUMBER;var T_BOOL=SC.T_BOOL;var T_ARRAY=SC.T_ARRAY;var T_STRING=SC.T_STRING;$type=SC.typeOf;$I=SC.inspect;SC.mixin(Object,{serialize:function(d){var a=[];for(var b in d){var c=d[b];if(typeof c=="number"){c=""+c}if(!(typeof c=="string")){c=c.join(",")}a.push(encodeURIComponent(b)+"="+encodeURIComponent(c))}return a.join("&")}});Element.setClassName=function(b,c,a){if(SC.isIE()){if(a){Element.addClassName(b,c)}else{Element.removeClassName(b,c)}}else{if(a){b.addClassName(c)}else{b.removeClassName(c)}}};Object.extend(Event,{getCharCode:function(a){return(a.keyCode)?a.keyCode:((a.which)?a.which:0)},getCharString:function(a){return String.fromCharCode(Event.getCharCode(a))},pointerLocation:function(b){var a={x:b.pageX||(b.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)),y:b.pageY||(b.clientY+(document.documentElement.scrollTop||document.body.scrollTop))};return a},ALT_KEY:"_ALT",CTRL_KEY:"_CTRL",SHIFT_KEY:"_SHIFT"});SC.DelegateSupport={invokeDelegateMethod:function(c,a,b){b=SC.$A(arguments);b=b.slice(2,b.length);if(!c||!c[a]){c=this}return c[a].apply(c,b)},getDelegateProperty:function(b,a){return(b&&(b[a]!=null))?b.get(a):this.get(a)}};var MONTH_NAMES=new Array("January","February","March","April","May","June","July","August","September","October","November","December","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");var DAY_NAMES=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sun","Mon","Tue","Wed","Thu","Fri","Sat");function LZ(a){return(a<0||a>9?"":"0")+a}Object.extend(Date,{now:function(){return new Date().getTime()},isDate:function(c,b){var a=Date.getDateFromFormat(c,b);if(a==0){return false}return true},compareDates:function(e,g,c,d){var b=Date.getDateFromFormat(e,g);var a=Date.getDateFromFormat(c,d);if(b==0||a==0){return -1}else{if(b>a){return 1}}return 0},getDateFromFormat:function(A,r){A=A+"";r=r+"";var z=0;var m=0;var t="";var g="";var w="";var j,h;var b=new Date();var k=b.getFullYear();var v=b.getMonth()+1;var u=1;var d=b.getHours();var s=b.getMinutes();var p=b.getSeconds();var l="";while(m<r.length){t=r.charAt(m);g="";while((r.charAt(m)==t)&&(m<r.length)){g+=r.charAt(m++)}if(g=="yyyy"||g=="yy"||g=="y"){if(g=="yyyy"){j=4;h=4}if(g=="yy"){j=2;h=2}if(g=="y"){j=2;h=4}k=Date._getInt(A,z,j,h);if(k==null){return 0}z+=k.length;if(k.length==2){if(k>70){k=1900+(k-0)}else{k=2000+(k-0)}}}else{if(g=="MMM"||g=="NNN"){v=0;for(var q=0;q<MONTH_NAMES.length;q++){var e=MONTH_NAMES[q];if(A.substring(z,z+e.length).toLowerCase()==e.toLowerCase()){if(g=="MMM"||(g=="NNN"&&q>11)){v=q+1;if(v>12){v-=12}z+=e.length;break}}}if((v<1)||(v>12)){return 0}}else{if(g=="EE"||g=="E"){for(var q=0;q<DAY_NAMES.length;q++){var o=DAY_NAMES[q];if(A.substring(z,z+o.length).toLowerCase()==o.toLowerCase()){z+=o.length;break}}}else{if(g=="MM"||g=="M"){v=Date._getInt(A,z,g.length,2);if(v==null||(v<1)||(v>12)){return 0}z+=v.length}else{if(g=="dd"||g=="d"){u=Date._getInt(A,z,g.length,2);if(u==null||(u<1)||(u>31)){return 0}z+=u.length}else{if(g=="hh"||g=="h"){d=Date._getInt(A,z,g.length,2);if(d==null||(d<1)||(d>12)){return 0}z+=d.length}else{if(g=="HH"||g=="H"){d=Date._getInt(A,z,g.length,2);if(d==null||(d<0)||(d>23)){return 0}z+=d.length}else{if(g=="KK"||g=="K"){d=Date._getInt(A,z,g.length,2);if(d==null||(d<0)||(d>11)){return 0}z+=d.length}else{if(g=="kk"||g=="k"){d=Date._getInt(A,z,g.length,2);if(d==null||(d<1)||(d>24)){return 0}z+=d.length;d--}else{if(g=="mm"||g=="m"){s=Date._getInt(A,z,g.length,2);if(s==null||(s<0)||(s>59)){return 0}z+=s.length}else{if(g=="ss"||g=="s"){p=Date._getInt(A,z,g.length,2);if(p==null||(p<0)||(p>59)){return 0}z+=p.length}else{if(g=="a"){if(A.substring(z,z+2).toLowerCase()=="am"){l="AM"}else{if(A.substring(z,z+2).toLowerCase()=="pm"){l="PM"}else{return 0}}z+=2}else{if(A.substring(z,z+g.length)!=g){return 0}else{z+=g.length}}}}}}}}}}}}}}if(z!=A.length){return 0}if(v==2){if(((k%4==0)&&(k%100!=0))||(k%400==0)){if(u>29){return 0}}else{if(u>28){return 0}}}if((v==4)||(v==6)||(v==9)||(v==11)){if(u>30){return 0}}if(d<12&&l=="PM"){d=d-0+12}else{if(d>11&&l=="AM"){d-=12}}var a=new Date(k,v-1,u,d,s,p);return a.getTime()},parseDate:function(m){var h=(arguments.length==2)?arguments[1]:false;generalFormats=new Array("E NNN dd HH:mm:ss UTC yyyy","y-M-d","y-M-d","MMM d, y","MMM d,y","y-MMM-d","d-MMM-y","MMM d","d MMM y","d.MMM.y","y MMM d","y.MMM.d");monthFirst=new Array("M/d/y","M-d-y","M.d.y","MMM-d","M/d","M-d");dateFirst=new Array("d/M/y","d-M-y","d.M.y","d-MMM","d/M","d-M");var b=new Array("generalFormats",h?"dateFirst":"monthFirst",h?"monthFirst":"dateFirst");var k=null;k=0;var e=new Date().getTime();switch(m.toLowerCase()){case"yesterday".loc():k=e-(24*60*60*1000);break;case"today".loc():case"now".loc():k=e;break;case"tomorrow".loc():k=e+(24*60*60*1000);break}if(k>0){return new Date(k)}for(var g=0;g<b.length;g++){var a=window[b[g]];for(var c=0;c<a.length;c++){k=Date.getDateFromFormat(m,a[c]);if(k==0){k=Date.getDateFromFormat(m,a[c]+" H:m:s")}if(k==0){k=Date.getDateFromFormat(m,a[c]+" h:m:s a")}if(k!=0){return new Date(k)}}}return null},_isInteger:function(c){var b="1234567890";for(var a=0;a<c.length;a++){if(b.indexOf(c.charAt(a))==-1){return false}}return true},_getInt:function(g,d,e,c){for(var a=c;a>=e;a--){var b=g.substring(d,d+a);if(b.length<e){return null}if(Date._isInteger(b)){return b}}return null}});Object.extend(Date.prototype,{format:function(I){I=I+"";var N=this;var p="";var z=0;var L="";var g="";var o=N.getFullYear()+"";var j=N.getMonth()+1;var J=N.getDate();var r=N.getDay();var q=N.getHours();var B=N.getMinutes();var u=N.getSeconds();var w,x,b,v,O,e,G,F,C,t,Q,q,P,l,a,D;var A=new Object();if(o.length<4){o=""+(o-0+1900)}A.y=""+o;A.yyyy=o;A.yy=o.substring(2,4);A.M=j;A.MM=LZ(j);A.MMM=MONTH_NAMES[j-1];A.NNN=MONTH_NAMES[j+11];A.d=J;A.dd=LZ(J);A.E=DAY_NAMES[r+7];A.EE=DAY_NAMES[r];A.H=q;A.HH=LZ(q);if(q==0){A.h=12}else{if(q>12){A.h=q-12}else{A.h=q}}A.hh=LZ(A.h);if(q>11){A.K=q-12}else{A.K=q}A.k=q+1;A.KK=LZ(A.K);A.kk=LZ(A.k);if(q>11){A.a="PM"}else{A.a="AM"}A.m=B;A.mm=LZ(B);A.s=u;A.ss=LZ(u);while(z<I.length){L=I.charAt(z);g="";while((I.charAt(z)==L)&&(z<I.length)){g+=I.charAt(z++)}if(A[g]!=null){p=p+A[g]}else{p=p+g}}return p},utcFormat:function(){return(new Date(this.getTime()+(this.getTimezoneOffset()*60*1000))).format("E NNN dd HH:mm:ss UTC yyyy")}});SC.STRING_TITLEIZE_REGEXP=(/([\s|\-|\_|\n])([^\s|\-|\_|\n]?)/g);SC.String={fmt:function(){var d=arguments;var h=this.gsub(/%@([0-9]+)/,function(j){return(d[parseInt(j[1],0)-1]||"").toString()});var c=[];var a=-1;var g=0;var b=0;while((a=h.indexOf("%@",g))>=0){c.push(h.slice(g,a));g=a+2;var e=d[b++];if(e&&e.toString){e=e.toString()}c.push(e)}if(g<h.length){c.push(h.slice(g,h.length))}return(c.length>1)?c.join(""):c[0]},loc:function(){var a=String[String.currentLanguage()];var b=a[this];if(!b){b=String.English[this]||this}return b.fmt.apply(b,arguments)},locWithDefault:function(c){var b=String[String.currentLanguage()];var d=b[this];if(!d){d=String.English[this]||c}var a=SC.$A(arguments);a.shift();return d.fmt.apply(d,a)},capitalize:function(){return this.charAt(0).toUpperCase()+this.substring(1)},titleize:function(){return this.replace(SC.STRING_TITLEIZE_REGEXP,function(b,c,a){return(a)?(" "+a.toUpperCase()):" "}).capitalize()},camelize:function(){var d=this.split("-"),a=d.length;if(a==1){return d[0]}var c=this.charAt(0)=="-"?d[0].charAt(0).toUpperCase()+d[0].substring(1):d[0];for(var b=1;b<a;b++){c+=d[b].charAt(0).toUpperCase()+d[b].substring(1)}return c},classify:function(){return this.camelize().capitalize()},decamelize:function(){return this.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase()},dasherize:function(){return this.decamelize().replace(/[ _]/g,"-")},humanize:function(){return this.decamelize().replace(/[-_]/g," ")},trim:function(){return this.replace(/^\s+|\s+$/g,"")},toArray:function(){return this.split("")}};SC.String.format=SC.String.fmt;SC.String.strip=SC.String.trim;SC.mixin(String.prototype,SC.String);Object.extend(String,{browserLanguage:((navigator.language||navigator.browserLanguage).split("-",1)[0]),useAutodetectedLanguage:NO,preferredLanguage:null,currentLanguage:function(){var a=(this.useAutodetectedLanguage)?(this.browserLanguage||this.preferredLanguage||"en"):(this.preferredLanguage||this.browserLanguage||"en");if(!this[a]){a=this.normalizedLanguage(a)}return a},normalizedLanguage:function(a){switch(a){case"fr":a="French";break;case"de":a="German";break;case"ja":case"jp":a="Japanese";break;case"en":a="English";break;case"es":a="Spanish";break;default:a="English";break}return a},addStringsFor:function(b,a){b=String.normalizedLanguage(b);if(!String[b]){String[b]={}}Object.extend(String[b],a||{});return this}});String.English=String.English||{};String.French=String.French||{};String.German=String.German||{};String.Japanese=String.Japanese||{};require("core");require("foundation/date");require("foundation/string");SC.Benchmark={verbose:NO,enabled:YES,stats:{},start:function(a,c,d){if(!this.enabled){return}var b=this._statFor(a);if(c&&b._starts.length>0){b._starts.push("ignore")}else{b._starts.push(d||Date.now())}},end:function(a,c,d){if(!this.enabled){return}var b=this._statFor(a);var e=b._starts.pop();if(!e){console.log('SC.Benchmark "%@" ended without a matching start.  No information was saved.'.fmt(a));return}if(e=="ignore"){return}b.amt+=(c||Date.now())-e;b.runs+=(d||1);if(this.verbose){this.log(a)}},bench:function(e,d,a,c){if(!d){d="bench%@".fmt(this._benchCount++)}if(!a){a=1}var b;var g=a;SC.Benchmark.start(d);while(--a>=0){b=e(c)}SC.Benchmark.end(d,null,g);return b},install:function(a,d,b){var c=a["b__"+d]=a[d];a[d]=function(){var g="%@(%@)".fmt(d,SC.$A(arguments).join(", "));SC.Benchmark.start(g,b);var e=c.apply(this,arguments);SC.Benchmark.end(g);return e}},restore:function(a,b){a[b]=a["b__"+b]},report:function(e){if(e){return this._genReport(e)}var d=[];var c=0;for(var e in this.stats){if(!this.stats.hasOwnProperty(e)){continue}if(e.length>c){c=e.length}}var g=[];for(var e in this.stats){if(!this.stats.hasOwnProperty(e)){continue}g.push(e)}g=g.sort();var b=g.length;for(var a=0;a<b;a++){d.push(this._genReport(g[a],c))}return d.join("\n")},log:function(a){console.log(this.report(a))},startProfile:function(a){if(!this.enabled){return}if(console&&console.profile){console.profile(a)}},endProfile:function(a){if(!this.enabled){return}if(console&&console.profileEnd){console.profileEnd(a)}},_genReport:function(b,g){var c=this._statFor(b);var e=(c.runs>0)?(Math.floor(c.amt*100000/c.runs)/100000):0;var a=(c.name||b);g=(g)?g:0;if(g>a.length){var d=[a];g-=a.length;while(--g>=0){d.push(" ")}a=d.join("")}return"BENCH | %@1 | avg: %@4 msec | total: %@2 msec | reps: %@3x ".fmt(a,c.amt,c.runs,e)},_statFor:function(b){var a=this.stats[b];if(!a){a=this.stats[b]={runs:0,amt:0,name:b,_starts:[]}}return a},reset:function(){this.stats={}},_bench:function(b,a){SC.Benchmark.bench(b,a,1)},_benchCount:1};SC.Observable={automaticallyNotifiesObserversFor:function(a){return YES},get:function(b){var a=this[b];if(a===undefined){return this.unknownProperty(b)}else{if(a&&a.isProperty){return a.call(this,b)}else{return a}}},set:function(c,e){var d=this[c];var a=e;var b=this.automaticallyNotifiesObserversFor(c);if(b){this.propertyWillChange(c)}if(d&&d.isProperty){a=d.call(this,c,e)}else{if(d===undefined){a=this.unknownProperty(c,e)}else{a=this[c]=e}}if(b){this.propertyDidChange(c,a)}return this},bind:function(a,g){var d=SC.idt.active;var h;var c={to:[this,a]};var e=$type(g);if(e==T_STRING||e==T_ARRAY){h=this[a+"BindingDefault"]||SC.Binding.From;h=h(g)}else{h=g}var b=h.prototype.from;if($type(b)==T_STRING){switch(b.slice(0,1)){case"*":case".":b=[this,b.slice(1,b.length)]}}if(d){bt=new Date().getTime()}h=h.create(c,{from:b});this.bindings.push(h);if(d){SC.idt.b1_t+=(new Date().getTime())-bt}return h},didChangeFor:function(b){var j=SC.$A(arguments);b=j.shift();var g=false;if(!this._didChangeCache){this._didChangeCache={}}if(!this._didChangeRevisionCache){this._didChangeRevisionCache={}}var a=this._didChangeCache[b]||{};var k=this._didChangeRevisionCache[b]||{};var e=j.length;var d=this._kvo().revision;while(--e>=0){var h=j[e];if(k[h]!=d){var c=this.get(h);if(a[h]!==c){g=true}a[h]=c}k[h]=d}this._didChangeCache[b]=a;this._didChangeRevisionCache[b]=k;return g},setIfChanged:function(a,b){return(this.get(a)!==b)?this.set(a,b):this},getPath:function(b){var a=SC.Object.tupleForPropertyPath(b,this);if(a[0]===null){return undefined}return a[0].get(a[1])},setPath:function(c,b){var a=SC.Object.tupleForPropertyPath(c,this);if(a[0]==null){return null}a[0].set(a[1],b);return this},getEach:function(){var c=SC.$A(arguments).flatten();var b=[];for(var a=0;a<c.length;a++){b[b.length]=this.getPath(c[a])}return b},incrementProperty:function(a){this.set(a,(this.get(a)||0)+1);return this.get(a)},decrementProperty:function(a){this.set(a,(this.get(a)||0)-1);return this.get(a)},toggleProperty:function(a,b,c){if(b===undefined){b=true}if(c==undefined){c=false}b=(this.get(a)==b)?c:b;this.set(a,b);return this.get(a)},unknownProperty:function(a,b){if(!(b===undefined)){this[a]=b}return b},propertyObserver:function(a,d,b,c){},beginPropertyChanges:function(){this._kvo().changes++;return this},endPropertyChanges:function(){var a=this._kvo();a.changes--;if(a.changes<=0){this._notifyPropertyObservers()}return this},propertyWillChange:function(a){this._kvo().changes++;return this},propertyDidChange:function(b,c){this._kvo().changed[b]=c;var a=this._kvo();a.changes--;a.revision++;if(a.changes<=0){this._notifyPropertyObservers()}return this},notifyPropertyChange:function(a,b){this.propertyWillChange(a);this.propertyDidChange(a,b);return this},allPropertiesDidChange:function(){this._notifyPropertyObservers(true);return this},addObserver:function(j,a){var c=this._kvo();j=j.toString();var b=j.split(".");if(b.length>1){var h=SC._ChainObserver.createChain(this,b,a);h.masterFunc=a;var g=c.chainObservers[j]||[];g.push(h);c.chainObservers[j]=g}else{if(this.reducedProperty&&(j.charAt(0)==="@")){this.reducedProperty(j,undefined)}var d=c.observers[j]=(c.observers[j]||[]);var k=false;var e=d.length;while(!k&&--e>=0){k=(d[e]==a)}if(!k){d.push(a)}}return this},removeObserver:function(d,e){var c=this._kvo();d=d.toString();var g=d.split(".");if(g.length>1){var b=c.chainObserver[d]||[];var a=[];b.each(function(j){if(j.masterFunc!=e){a.push(j)}});c.chainObservers[d]=a}else{var h=c.observers[d]||[];h=h.without(e);c.observers[d]=h}return this},addProbe:function(a){this.addObserver(a,logChange)},removeProbe:function(a){this.removeObserver(a,logChange)},logProperty:function(){var b=SC.$A(arguments);for(var a=0;a<b.length;a++){var c=b[a];console.log("%@:%@: ".fmt(this._guid,c),this.get(c))}},observeOnce:function(a,c,d){var g=null;var e=this;var b=function(h,k,l,j){c(h,k,l,j);e.removeObserver(a,b);if(g){g.invalidate()}};e.addObserver(a,b);if(d){g=function(){b(e,a,e.get(a),true)}.invokeLater(this,d)}b.cancel=function(){e.removeObserver(a,b)};return b},registerDependentKey:function(b){var d=SC.$A(arguments);var c=d.shift();var a=this._kvo();for(var e=0;e<d.length;e++){var b=d[e];if(b instanceof Array){b.push(c);this.registerDependentKey.apply(this,b)}else{var g=a.dependents[b]||[];g.push(c);a.dependents[b]=g}}},_kvo:function(){if(!this._kvod){this._kvod={changes:0,changed:{},observers:{},dependents:{},chainObservers:{},revision:0}}return this._kvod},propertyRevision:1,_notifyPropertyObservers:function(g){var s;var e;var t=[];var j;var l;var r;var c=this._kvo();SC.Observers.flush();this.propertyRevision++;var b=(g)?c.observers:c.changed;var p={};var a=function(u){if(p[u]!==undefined){return}p[u]=u;if(g){return}var x=c.dependents[u];if(x&&x.length>0){var w=x.length;while(--w>=0){var v=x[w];a(v)}}};for(s in b){if(!b.hasOwnProperty(s)){continue}a(s)}for(s in p){if(!p.hasOwnProperty(s)){continue}t.push(s)}var h=c.observers["*"];var d=c.changed;c.changed={};var k=this;j=t.length;var q={};while(--j>=0){s=t[j];e=c.observers[s];if(!q[s]){q[s]=s;r=(g||(!d[s]))?this.get(s):d[s];if(h){e=(e)?e.concat(h):h}if(e){l=e.length;var o=[k,s,r,this.propertyRevision];while(--l>=0){var m=e[l];SC.NotificationQueue.add(null,m,o)}}if(this.propertyObserver!=SC.Object.prototype.propertyObserver){SC.NotificationQueue.add(this,this.propertyObserver,[null,k,s,r,this.propertyRevision])}}}SC.NotificationQueue.flush()}};SC.mixin(Array.prototype,SC.Observable);SC.mixin(Function.prototype,{property:function(){this.dependentKeys=SC.$A(arguments);this.isProperty=true;return this},observes:function(a){this.propertyPaths=SC.$A(arguments);return this},typeConverter:function(){this.isTypeConverter=true;return this},invokeLater:function(d,a){if(a===undefined){a=1}var c=this;if(arguments.length>2){var b=SC.$A(arguments).slice(2,arguments.length);b.unshift(d);c=c.bind.apply(c,b)}return SC.Timer.schedule({target:d,action:c,interval:a})}});SC.Observers={queue:{},addObserver:function(d,c){if(typeof(d)=="string"){var a=SC.Object.tupleForPropertyPath(d)}else{var a=d}if(a){a[0].addObserver(a[1],c)}else{var b=this.queue[d]||[];b.push(c);this.queue[d]=b}},removeObserver:function(d,c){var a=SC.Object.tupleForPropertyPath(d);if(a){a[0].removeObserver(a[1],c)}var b=this.queue[d];if(b){b=b.without(c);this.queue[d]=b}},flush:function(){var b={};for(var e in this.queue){var c=this.queue[e];var a=SC.Object.tupleForPropertyPath(e);if(a){var g=c.length;while(--g>=0){var d=c[g];a[0].addObserver(a[1],d)}}else{b[e]=c}}this.queue=b}};SC.NotificationQueue={queue:[],maxFlush:5000,_flushing:false,add:function(c,b,a){this.queue.push([c,b,a])},flush:function(c){if(this._flushing&&!c){return}this._flushing=true;var e=new Date().getTime();var a=e;var d=null;while(((a-e)<this.maxFlush)&&(d=this.queue.pop())){var b=d[0]||d[1];d[1].apply(b,d[2]);a=Date.now()}this._flushing=false;if(this.queue.length>0){SC.NotificationQueue.flush.invokeLater(SC.NotificationQueue,1)}}};require("core");SC.Enumerable={nextObject:function(a,c,b){return(this.objectAt)?this.objectAt(a):this[a]},enumerator:function(){return SC.Enumerator.create(this)},forEach:function(h,g){if(typeof h!=="function"){throw new TypeError()}var b=(this.get)?this.get("length"):this.length;if(g===undefined){g=null}var e=null;var c=SC.Enumerator._popContext();for(var a=0;a<b;a++){var d=this.nextObject(a,e,c);h.call(g,d,a,this);e=d}e=null;c=SC.Enumerator._pushContext(c);return this},map:function(j,h){if(typeof j!=="function"){throw new TypeError()}var b=(this.get)?this.get("length"):this.length;if(h===undefined){h=null}var c=[];var g=null;var d=SC.Enumerator._popContext();for(var a=0;a<b;a++){var e=this.nextObject(a,g,d);c[a]=j.call(h,e,a,this);g=e}g=null;d=SC.Enumerator._pushContext(d);return c},mapProperty:function(e){var b=(this.get)?this.get("length"):this.length;var c=[];var h=null;var d=SC.Enumerator._popContext();for(var a=0;a<b;a++){var g=this.nextObject(a,h,d);c[a]=(g)?((g.get)?g.get(e):g[e]):null;h=g}h=null;d=SC.Enumerator._pushContext(d);return c},filter:function(j,h){if(typeof j!=="function"){throw new TypeError()}var b=(this.get)?this.get("length"):this.length;if(h===undefined){h=null}var c=[];var g=null;var d=SC.Enumerator._popContext();for(var a=0;a<b;a++){var e=this.nextObject(a,g,d);if(j.call(h,e,a,this)){c.push(e)}g=e}g=null;d=SC.Enumerator._pushContext(d);return c},filterProperty:function(l,g){var d=(this.get)?this.get("length"):this.length;var e=[];var k=null;var b=SC.Enumerator._popContext();for(var h=0;h<d;h++){var c=this.nextObject(h,k,b);var j=(c)?((c.get)?c.get(l):c[l]):null;var a=(g===undefined)?!!j:SC.isEqual(j,g);if(a){e.push(c)}k=c}k=null;b=SC.Enumerator._pushContext(b);return e},every:function(j,h){if(typeof j!=="function"){throw new TypeError()}var b=(this.get)?this.get("length"):this.length;if(h===undefined){h=null}var c=YES;var g=null;var d=SC.Enumerator._popContext();for(var a=0;c&&(a<b);a++){var e=this.nextObject(a,g,d);if(!j.call(h,e,a,this)){c=NO}g=e}g=null;d=SC.Enumerator._pushContext(d);return c},everyProperty:function(k,e){var c=(this.get)?this.get("length"):this.length;var d=YES;var j=null;var a=SC.Enumerator._popContext();for(var g=0;d&&(g<c);g++){var b=this.nextObject(g,j,a);var h=(b)?((b.get)?b.get(k):b[k]):null;d=(e===undefined)?!!h:SC.isEqual(h,e);j=b}j=null;a=SC.Enumerator._pushContext(a);return d},some:function(j,h){if(typeof j!=="function"){throw new TypeError()}var b=(this.get)?this.get("length"):this.length;if(h===undefined){h=null}var c=NO;var g=null;var d=SC.Enumerator._popContext();for(var a=0;(!c)&&(a<b);a++){var e=this.nextObject(a,g,d);if(j.call(h,e,a,this)){c=YES}g=e}g=null;d=SC.Enumerator._pushContext(d);return c},someProperty:function(k,e){var c=(this.get)?this.get("length"):this.length;var d=NO;var j=null;var a=SC.Enumerator._popContext();for(var g=0;!d&&(g<c);g++){var b=this.nextObject(g,j,a);var h=(b)?((b.get)?b.get(k):b[k]):null;d=(e===undefined)?!!h:SC.isEqual(h,e);j=b}j=null;a=SC.Enumerator._pushContext(a);return d},reduce:function(h,j,k){if(typeof h!=="function"){throw new TypeError()}var c=(this.get)?this.get("length"):this.length;if(c===0&&j===undefined){throw new TypeError()}var d=j;var g=null;var a=SC.Enumerator._popContext();for(var e=0;e<c;e++){var b=this.nextObject(e,g,a);if(b!=null){if(d===undefined){d=b}else{d=h.call(null,d,b,e,this,k)}}g=b}g=null;a=SC.Enumerator._pushContext(a);if(d===undefined){throw new TypeError()}return d},invoke:function(j){var e=(this.get)?this.get("length"):this.length;if(e<=0){return[]}var h=[];var c=arguments.length;if(c>1){for(var k=1;k<c;k++){h.push(arguments[k])}}var g=[];var l=null;var b=SC.Enumerator._popContext();for(var k=0;k<e;k++){var d=this.nextObject(k,l,b);var a=(d)?d[j]:null;if(a){g[k]=a.apply(d,h)}l=d}l=null;b=SC.Enumerator._pushContext(b);return g},invokeWhile:function(d,k){var g=(this.get)?this.get("length"):this.length;if(g<=0){return null}var j=[];var c=arguments.length;if(c>2){for(var l=2;l<c;l++){j.push(arguments[l])}}var h=d;var m=null;var b=SC.Enumerator._popContext();for(var l=0;(h===d)&&(l<g);l++){var e=this.nextObject(l,m,b);var a=(e)?e[k]:null;if(a){h=a.apply(e,j)}m=e}m=null;b=SC.Enumerator._pushContext(b);return h},toArray:function(){var b=(this.get)?this.get("length"):this.length;if(b<=0){return[]}var c=[];var g=null;var d=SC.Enumerator._popContext();for(var a=0;a<b;a++){var e=this.nextObject(a,g,d);c.push(e);g=e}g=null;d=SC.Enumerator._pushContext(d);return c}};SC._buildReducerFor=function(a,b){return function(c,d){var e=this[a];if(SC.typeOf(e)!==T_FUNCTION){return(this.unknownProperty)?this.unknownProperty(c,d):null}else{return SC.Enumerable.reduce.call(this,e,null,b)}}.property("[]")};SC.Reducers={"[]":function(a,b){return this}.property(),enumerableContentDidChange:function(){this.notifyPropertyChange("[]");if(this.ownerRecord&&this.ownerRecord.recordDidChange){this.ownerRecord.recordDidChange(this)}},reducedProperty:function(j,g,e){if(j[0]!=="@"){return undefined}var d=j.match(/^@([^(]*)(\(([^)]*)\))?$/);if(!d||d.length<2){return undefined}var h=d[1];var k=d[3];var h="reduce%@".fmt(h.capitalize());var a=this[h];if(SC.typeOf(a)!==T_FUNCTION){return undefined}if(e===NO){return SC.Enumerable.reduce.call(this,a,null,k)}var c=SC._buildReducerFor(h,k);var b=(this._type)?this._type:this.constructor.prototype;if(b){b[j]=c;this.registerDependentKey(j,"[]")}return SC.Enumerable.reduce.call(this,a,null,k)},reduceMax:function(a,d,b,g,c){if(c&&d){d=(d.get)?d.get(c):d[c]}if(a==null){return d}return(d>a)?d:a},reduceMaxObject:function(b,g,c,h,d){var a=b,j=g;if(d){if(g){j=(g.get)?g.get(d):g[d]}if(b){previousItemValue=(b.get)?b.get(d):b[d]}}if(a==null){return g}return(j>a)?g:b},reduceMin:function(a,d,b,g,c){if(c&&d){d=(d.get)?d.get(c):d[c]}if(a==null){return d}return(d<a)?d:a},reduceMinObject:function(b,g,c,h,d){var a=b,j=g;if(d){if(g){j=(g.get)?g.get(d):g[d]}if(b){previousItemValue=(b.get)?b.get(d):b[d]}}if(a==null){return g}return(j<a)?g:b},reduceAverage:function(b,h,d,j,g){if(g&&h){h=(h.get)?h.get(g):h[g]}var c=(b||0)+h;var a=(j.get)?j.get("length"):j.length;if(d>=a-1){c=c/a}return c},reduceSum:function(a,d,b,g,c){if(c&&d){d=(d.get)?d.get(c):d[c]}return(a==null)?d:a+d}};SC.mixin(SC.Enumerable,SC.Reducers);SC.mixin(Array.prototype,SC.Reducers);(function(){var a={nextObject:SC.Enumerable.nextObject,enumerator:SC.Enumerable.enumerator,mapProperty:function(h){var e=this.length;var g=[];for(var d=0;d<e;d++){var j=this[d];g[d]=(j)?((j.get)?j.get(h):j[h]):null}return g},filterProperty:function(j,l){var g=this.length;var h=[];for(var e=0;e<g;e++){var k=this[e];var m=(k)?((k.get)?k.get(j):k[j]):null;var d=(l===undefined)?!!m:SC.isEqual(m,l);if(d){h.push(k)}}return h},everyProperty:function(h,k){var e=this.length;var g=YES;for(var d=0;g&&(d<e);d++){var j=this[d];var l=(j)?((j.get)?j.get(h):j[h]):null;g=(k===undefined)?!!l:SC.isEqual(l,k)}return g},someProperty:function(h,k){var e=this.length;var g=NO;for(var d=0;!g&&(d<e);d++){var j=this[d];var l=(j)?((j.get)?j.get(h):j[h]):null;g=(k===undefined)?!!l:SC.isEqual(l,k)}return g},invoke:function(g){var e=this.length;if(e<=0){return[]}var j=[];var l=arguments.length;if(l>1){for(var d=1;d<l;d++){j.push(arguments[d])}}var h=[];for(var d=0;d<e;d++){var k=this[d];var m=(k)?k[g]:null;if(m){h[d]=m.apply(k,j)}}return h},invokeWhile:function(g,m){var j=this.length;if(j<=0){return null}var l=[];var e=arguments.length;if(e>2){for(var o=2;o<e;o++){l.push(arguments[o])}}var k=g;for(var o=0;(k===g)&&(o<j);o++){var h=this[o];var d=(h)?h[m]:null;if(d){k=d.apply(h,l)}}return k},toArray:function(){var e=this.length;if(e<=0){return[]}var g=[];for(var d=0;d<e;d++){var h=this[d];g.push(h)}return g}};var c={forEach:function(j,h){if(typeof j!=="function"){throw new TypeError()}var e=this.length;if(h===undefined){h=null}for(var d=0;d<e;d++){var g=this[d];j.call(h,g,d,this)}return this},map:function(k,j){if(typeof k!=="function"){throw new TypeError()}var e=this.length;if(j===undefined){j=null}var g=[];for(var d=0;d<e;d++){var h=this[d];g[d]=k.call(j,h,d,this)}return g},filter:function(k,j){if(typeof k!=="function"){throw new TypeError()}var e=this.length;if(j===undefined){j=null}var g=[];for(var d=0;d<e;d++){var h=this[d];if(k.call(j,h,d,this)){g.push(h)}}return g},every:function(k,j){if(typeof k!=="function"){throw new TypeError()}var e=this.length;if(j===undefined){j=null}var g=YES;for(var d=0;g&&(d<e);d++){var h=this[d];if(!k.call(j,h,d,this)){g=NO}}return g},some:function(k,j){if(typeof k!=="function"){throw new TypeError()}var e=this.length;if(j===undefined){j=null}var g=NO;for(var d=0;(!g)&&(d<e);d++){var h=this[d];if(k.call(j,h,d,this)){g=YES}}return g},reduce:function(l,g,k){if(typeof l!=="function"){throw new TypeError()}var e=this.length;if(e===0&&g===undefined){throw new TypeError()}var h=g;for(var d=0;d<e;d++){var j=this[d];if(j!=null){if(h===undefined){h=j}else{h=l.call(null,h,j,d,this,k)}}}if(h===undefined){throw new TypeError()}return h}};for(var b in c){if(!c.hasOwnProperty(b)){continue}if(!Array.prototype[b]||(Prototype&&Prototype.Version.match(/^1\.6/))){Array.prototype[b]=c[b]}}SC.mixin(Array.prototype,a)})();require("mixins/enumerable");SC.OUT_OF_RANGE_EXCEPTION="Index out of range";SC.Array={replace:function(a,c,b){throw"replace() must be implemented to support SC.Array"},objectAt:function(a){if(a<0){return undefined}if(a>=this.get("length")){return undefined}return this.get(a)},"[]":function(a,b){if(b!==undefined){this.replace(0,this.get("length"),b)}return this}.property(),insertAt:function(a,b){if(a>this.get("length")){throw SC.OUT_OF_RANGE_EXCEPTION}this.replace(a,0,[b]);return this},removeAt:function(a){if((a<0)||(a>=this.get("length"))){throw SC.OUT_OF_RANGE_EXCEPTION}var b=this.objectAt(a);this.replace(a,1,[]);return b},removeObject:function(b){var c=this.get("length")||0;while(--c>=0){var a=this.objectAt(c);if(a==b){this.removeAt(c)}}return this},pushObject:function(a){this.insertAt(this.get("length"),a);return a},popObject:function(){var a=this.get("length");if(a==0){return null}var b=this.objectAt(a-1);this.removeAt(a-1);return b},shiftObject:function(){if(this.get("length")==0){return null}var a=this.objectAt(0);this.removeAt(0);return a},unshiftObject:function(a){this.insertAt(0,a);return a},isEqual:function(a){if(!a){return false}if(a==this){return true}var b=a.get("length");if(b!=this.get("length")){return false}while(--b>=0){if(!SC.isEqual(a.objectAt(b),this.objectAt(b))){return false}}return true}};SC.mixin(Array.prototype,SC.Array);SC.Array=SC.mixin({},SC.Enumerable,SC.Array);SC.Array.slice=function(b,d){var a=[];var c=this.get("length");if(b==null){b=0}if((d==null)||(d>c)){d=c}while(b<d){a[a.length]=this.objectAt(b++)}return a};(function(){SC.mixin(Array.prototype,{replace:function(a,d,c){if(!c||c.length==0){this.splice(a,d)}else{var b=[a,d].concat(c);this.splice.apply(this,b)}this.enumerableContentDidChange();return this},unknownProperty:function(b,c){var a=this.reducedProperty(b,c);if(a===undefined){a=(c===undefined)?this.invoke("get",b):null}return a}})})();Array.from=SC.$A;require("core");require("foundation/benchmark");require("mixins/observable");require("mixins/array");SC.BENCHMARK_OBJECTS=NO;SC.Object=function(b){if(b===SC.Object._noinit_){return this}var a=SC.Object._init.apply(this,SC.$A(arguments));return a};SC.mixin(SC.Object,{_noinit_:"__noinit__",mixin:function(b){var a=SC.$A(arguments);for(var c=0;c<a.length;c++){Object.extend(this,a[c])}return this},extend:function(c){if(SC.BENCHMARK_OBJECTS){SC.Benchmark.start("SC.Object.extend")}var a=function(j){if(j&&(typeof(j)=="string")&&(j==SC.Object._noinit_)){return this}var h=SC.Object._init.apply(this,SC.$A(arguments));return h};for(var g in this){a[g]=this[g]}var d=new this(SC.Object._noinit_);var b=SC.$A(arguments);for(var e=0;e<b.length;e++){d=SC.Object._extend(d,b[e])}a.prototype=d;a._guid=SC.generateGuid();a._type=this;if(SC.BENCHMARK_OBJECTS){SC.Benchmark.end("SC.Object.extend")}return a},create:function(b){var a=new this(SC.$A(arguments),this);return a},createArray:function(b){var a=this;return b.map(function(c){return a.create(c)})},outlet:function(){var a=this;return function(){var b=a.create();b.owner=this;return b}},isClass:YES,objectClassName:function(){if(!SC._onloadQueueFlushed){return""}if(!this._objectClassName){this._findObjectClassNames()}if(this._objectClassName){return this._objectClassName}var a=this;while(a&&!a._objectClassName){a=a._type}return(a&&a._objectClassName)?a._objectClassName:"Anonymous"},_findObjectClassNames:function(){if(SC._foundObjectClassNames){return}SC._foundObjectClassNames=true;var a=[];var g=function(l,m,q){q--;if(a.indexOf(m)>=0){return}a.push(m);for(var o in m){if(o=="__scope__"){continue}if(o=="_type"){continue}if(!o.match(/^[A-Z0-9]/)){continue}var r=(l)?[l,o].join("."):o;var p=m[o];switch($type(p)){case T_CLASS:if(!p._objectClassName){p._objectClassName=r}if(q>=0){g(r,p,q)}break;case T_OBJECT:if(q>=0){g(r,p,q)}break;case T_HASH:if(((l!=null)||(r=="SC"))&&(q>=0)){g(r,p,q)}break;default:break}}};g(null,window,2);if(SC.isIE()){g("SC",SC,2);for(var e=0;e<SC.Server.servers.length;e++){var c=SC.Server.servers[e];if(c.prefix){for(var b=0;b<c.prefix.length;b++){var k=c.prefix[b].split(".");var d=window;var j;for(var h=0;h<k.length;h++){d=d[k[h]];namepaceName=k[h]}g(namepaceName,d,2)}}}}},toString:function(){return this.objectClassName()},tupleForPropertyPath:function(e,a){if(e.constructor==Array){return e}var d=e.split("*");var b=null;if(d&&d.length>1){b=d.pop();e=d.join("*")}d=e.split(".");if(!b){b=d.pop()}var c=this.objectForPropertyPath(d,a);return(c&&b)?[c,b]:null},objectForPropertyPath:function(e,b){var d=($type(e)===T_STRING)?e.split("."):e;if(!b){b=window}var g=0,a=d.length,c=null;while((g<a)&&(b)){c=d[g++];if(c){b=(b.get)?b.get(c):b[c]}}return(g<a)?undefined:b},_init:function(c,b){var a=this;for(var d=0;d<c.length;d++){a=SC.Object._extend(a,c[d])}a._guid=SC.generateGuid();a._type=b;a.init();return a},_extend:function(b,a){return this._extendAllProps(false,b,a)},_extendAllProps:function(r,g,h){var b=g._cprops;var l=Prototype.emptyFunction;var d={};if(b){for(var o=0;o<b.length;o++){var e=b[o];var u=g[e];var t=h[e];u=(u&&t)?Array.from(u).concat(t):(u||t);d[e]=u}}var c=(h._bindings)?null:(g._bindings||[]).slice();var k=(h._observers)?null:(g._observers||[]).slice();var m=(h._properties)?null:(g._properties||[]).slice();var j=(h.outlets)?null:(g.outlets||[]).slice();for(var s in h){if(!r&&!h.hasOwnProperty(s)){continue}var q=(d.hasOwnProperty(s)?d[s]:null)||h[s];if(q&&(q instanceof Function)&&(!q.base)){if(q!=g[s]){q.base=g[s]||l}}var a=s.length;if(c&&(s.slice(a-7,a)=="Binding")){c.push(s)}else{if(q&&(q instanceof Function)){if(k&&q.propertyPaths){k.push(s)}else{if(m&&q.dependentKeys){m.push(s)}else{if(j&&q.autoconfiguredOutlet){j.push(s)}}}}}g[s]=q}if(c){g._bindings=c}if(k){g._observers=k}if(m){g._properties=m}if(j&&j.length>0){g.outlets=j}return g},subclassOf:function(b){if(this==b){return false}var a=this._type;while(a){if(a==b){return true}a=a._type}return false},kindOf:function(a){if(this==a){return true}return this.subclassOf(a)}});SC.idt={count:0,t:0,keys:0,observers:0,bindings:0,pv:0,observers_t:0,bindings_t:0,pv_t:0,conf_t:0,b1_t:0,b2_t:0,b3_t:0,e_count:0,e_t:0,v_count:0,v_t:0,vc_t:0,active:false};SC.report=function(){var g=SC.idt.count;var d=SC.idt.e_count;var a=SC.idt.v_count;var b=[];b.push("CREATED: "+g+" (avg time: "+(Math.floor(SC.idt.t*100/g)/100)+" msec)");b.push("EXTENDED: "+d+" (avg time: "+(Math.floor(SC.idt.e_t*100/d)/100)+" msec)");b.push("AVG KEYS: "+(Math.floor(SC.idt.keys*100/g)/100));b.push("AVG OBSERVERS: "+(Math.floor(SC.idt.observers*100/g)/100)+" ("+(Math.floor(SC.idt.observers_t*100/g)/100)+" msec)");b.push("AVG BINDINGS: "+(Math.floor(SC.idt.bindings*100/g)/100)+" ("+(Math.floor(SC.idt.bindings_t*100/g)/100)+" msec)");b.push("AVG PV: "+(Math.floor(SC.idt.pv*100/g)/100)+" ("+(Math.floor(SC.idt.pv_t*100/g)/100)+" msec)");b.push("AVG CONFIGURE OUTLETS: "+(Math.floor(SC.idt.conf_t*100/g)/100)+" msec");b.push("AVG B1: "+(Math.floor(SC.idt.b1_t*100/g)/100)+" msec");b.push("EXT: "+SC.idt.ext_c+" (avg time: "+(Math.floor(SC.idt.ext_t*100/SC.idt.ext_c)/100)+" msec)");b.push("VIEWS: "+a+" (avg time: "+(Math.floor(SC.idt.v_t*100/a)/100)+" msec)");b.push("VIEW CREATE: "+(Math.floor(SC.idt.vc_t*100/a)/100)+" msec)");console.log(b.join("\n"));return b.join("\n")};SC.Object.prototype={isObject:true,respondsTo:function(a){return !!(a&&this[a]&&($type(this[a])==T_FUNCTION))},tryToPerform:function(a,c){if(!a){return false}var c=SC.$A(arguments);var b=c.shift();if(this.respondsTo(b)){return this[b].apply(this,c)}return false},init:function(){var c=this.viewType||this;var l;var q;var p;var o;var a=SC.idt.active;var s;var b;if(a){SC.idt.count++;s=new Date().getTime()}if(q=c._observers){for(l=0;l<q.length;l++){p=q[l];o=this[p];if(a){SC.idt.keys++;SC.idt.observers++;b=new Date().getTime()}var k=null;if((o instanceof Function)&&o.propertyPaths){k=o.propertyPaths;o=o.bind(this)}else{if(typeof(o)=="string"){k=[o];o=this.propertyObserver.bind(this,p.slice(0,-8))}}if(k){for(var g=0;g<k.length;g++){var j=k[g];var e=null;if(j.indexOf(".")==-1){this.addObserver(j,o)}else{switch(j.slice(0,1)){case"*":case".":j=j.slice(1,j.length);this.addObserver(j,o);break;default:SC.Observers.addObserver(j,o)}}}}if(a){SC.idt.observers_t+=(new Date().getTime())-b}}}this.bindings=[];if(q=c._bindings){for(l=0;l<q.length;l++){p=q[l];o=this[p];if(a){SC.idt.keys++;SC.idt.bindings++;b=new Date().getTime()}var h=p.slice(0,-7);this[p]=this.bind(h,o);if(a){SC.idt.bindings_t+=(new Date().getTime())-b}}}if(q=c._properties){for(l=0;l<q.length;l++){p=q[l];o=this[p];if(o&&o.dependentKeys&&(o.dependentKeys.length>0)){args=o.dependentKeys.slice();args.unshift(p);this.registerDependentKey.apply(this,args)}}}if(this.initMixin){var d=Array.from(this.initMixin);for(var m=0;m<d.length;m++){d[m].call(this)}}if(a){SC.idt.t+=((new Date().getTime())-s)}},$super:function(b){var a=SC.Object.prototype.$super.caller;if(!a){throw"$super cannot determine the caller method"}if(a.base){a.base.apply(this,arguments)}},mixin:function(){return SC.Object.mixin.apply(this,arguments)},keys:function(c){var a=[];for(var b in this){if(c||a.hasOwnProperty(b)){a.push(b)}}return a},instanceOf:function(a){return this._type==a},kindOf:function(b){var a=this._type;while(a){if(a==b){return true}a=a._type}return false},toString:function(){if(!this.__toString){this.__toString="%@:%@".fmt(this._type.objectClassName(),this._guid)}return this.__toString},awake:function(c){if(c!==undefined){var e=this.outlet(c);if(e){e.awake()}return}if(this._awake){return}this._awake=true;this.bindings.invoke("relay");if(this.outlets&&this.outlets.length){var b=[];var a=[this,this.outlets.slice()];while(a){var d=a[1].pop();var e=a[0];if(d){d=e[d];if(d){if(d.bindings){d.bindings.invoke("relay")}if(d.outlets&&d.outlets.length>0){b.push(a);a=[d,d.outlets.slice()]}}}else{a=b.pop()}}}},outlets:[],outlet:function(a){var b=this[a];if(b&&(b instanceof Function)&&b.isOutlet==true){if(!this._originalOutlets){this._originalOutlets={}}this._originalOutlets[a]=b;b=b.call(this);this.set(a,b)}else{if(typeof(b)=="string"){if(!this._originalOutlets){this._originalOutlets={}}this._originalOutlets[a]=b;b=(this.$$sel)?this.$$sel(b):$$sel(b);if(b){b=(b.length>0)?((b.length==1)?b[0]:b):null}this.set(a,b)}}return b},invokeLater:function(b,a){if(a===undefined){a=1}var d=b;if(arguments.length>2){var c=SC.$A(arguments).slice(2,arguments.length);c.unshift(this);if($type(d)===T_STRING){d=this[b]}d=d.bind.apply(d,c)}return SC.Timer.schedule({target:this,action:d,interval:a})},_cprops:["_cprops","outlets","_bindings","_observers","_properties","initMixin"]};Object.extend(SC.Object.prototype,SC.Observable);function logChange(c,a,b){console.log("CHANGE: "+c+"["+a+"]="+b)}SC._ChainObserver=SC.Object.extend({isChainObserver:true,target:null,property:null,next:null,func:null,propertyObserver:function(e,d,a,c){if((a=="target")&&(c!=this._target)){var b=this.boundObserver();if(this._target&&this._target.removeObserver){this._target.removeObserver(this.property,b)}this._target=c;if(this._target&&this._target.addObserver){this._target.addObserver(this.property,b)}if(!(e=="init")){this.targetPropertyObserver()}}},boundObserver:function(){if(!this._boundObserver){this._boundObserver=this.targetPropertyObserver.bind(this)}return this._boundObserver},targetPropertyObserver:function(){var a=(this.target&&this.target.get&&this.property)?this.target.get(this.property):null;if(a!==this._lastTargetProperty){this._lastTargetProperty=a;if(this.next){this.next.set("target",a)}else{if(this.func){this.func(this.target,this.property,a)}}}},init:function(){arguments.callee.base.call(this);this.propertyObserver("init",this,"target",this.get("target"))}});SC._ChainObserver.mixin({createChain:function(g,d,c){var e=d.shift();var a=(g&&e&&g.get)?g.get(e):null;var b=(d&&d.length>0)?this.createChain(a,d,c):null;return this.create({target:g,property:e,next:b,func:((b)?null:c)})}});require("foundation/object");SC.Validator=SC.Object.extend({fieldValueForObject:function(b,c,a){return b},objectForFieldValue:function(c,b,a){return c},validate:function(a,b){return true},validateError:function(a,b){return $error("Invalid.General(%@)".loc(b.get("fieldValue")),b.get("fieldKey"))},validateChange:function(b,c,a){return(this.validate(b,c))?SC.Validator.OK:this.validateError(b,c)},validateSubmit:function(a,b){return(this.validate(a,b))?SC.Validator.OK:this.validateError(a,b)},validatePartial:function(a,b){if(!b.get("isValid")){return(this.validate(a,b))?SC.Validator.OK:this.validateError(a,b)}else{return SC.Validator.NO_CHANGE}},validateKeypress:function(b,c,a){return true},attachTo:function(a,b){},detachFrom:function(a,b){}});SC.Validator.mixin({OK:true,NO_CHANGE:false,findFor:function(e,h,g){var c;if(!g){return}if(g instanceof SC.Validator){c=g}else{if(g.isClass){c=g.create()}else{if($type(g)==T_STRING){var b=null;var a=g.match(/^(.+)\[(.*)\]/);if(a){g=a[1];b=a[2]}g=("-"+g).camelize();var d=SC.Validator[g];if(d==null){throw"validator %@ not found for %@".fmt(g,h);return null}else{if(b){if(!e){throw"named validator (%@) could not be found for field %@ because the field does not belong to a form".fmt(b,h);return null}if(!e._validatorHash){e._validatorHash={}}var c=(b)?e._validatorHash[b]:null;if(!c){c=d.create()}if(b){e._validatorHash[b]=c}}else{c=d.create()}}}}}return c},fieldValueForObject:function(a,b,c){return this.prototype.fieldValueForObject(a,b,c)},objectForFieldValue:function(b,a,c){return this.prototype.objectForFieldValue(b,a,c)}});require("validators/validator");SC.Validator.Number=SC.Validator.extend({places:0,fieldValueForObject:function(a,b,c){switch($type(a)){case T_NUMBER:a=a.toFixed(this.get("places"));break;case T_NULL:case T_UNDEFINED:a="";break}return a},objectForFieldValue:function(b,a,c){switch($type(b)){case T_STRING:if(b.length==""){b=null}else{if(this.get("places")>0){b=parseFloat(b)}else{b=parseInt(b,0)}}break;case T_NULL:case T_UNDEFINED:b=null;break}return b},validate:function(a,c){var b=c.get("fieldValue");return(b=="")||!(isNaN(b)||isNaN(parseFloat(b)))},validateError:function(b,c){var a=c.get("errorLabel")||"Field";return $error("Invalid.Number(%@)".loc(a),a)}});require("foundation/object");SC.Record=SC.Object.extend({properties:["guid"],primaryKey:"guid",newRecord:false,changeCount:0,isDeleted:false,resourceURL:null,dataSource:SC.Store,refreshURL:null,updateURL:null,destroyURL:null,init:function(){arguments.callee.base.apply(this,arguments);var a=this.get("primaryKey");if(!this.get(a)){var b=this.generateTempPrimaryKey();if(b){this.set(a,b)}}},generateTempPrimaryKey:function(){return"@"+SC.getGUID(this)},refresh:function(){if(!this.get("newRecord")){this.dataSource.refreshRecords([this])}},commit:function(){if(this.get("newRecord")){this.dataSource.createRecords([this])}else{this.dataSource.commitRecords([this])}},destroy:function(){this.dataSource.destroyRecords([this])},readAttribute:function(c){if(!this._cachedAttributes){this._cachedAttributes={}}var b=this._cachedAttributes[c];if(b===undefined){var a=this._attributes;b=(a)?a[c]:undefined;b=b||this[c];if(b!==undefined){var d=this._getRecordType(c+"Type");b=this._propertyFromAttribute(b,d)}this._cachedAttributes[c]=b}return(b===undefined)?null:b},writeAttribute:function(b,c){var d=this._getRecordType(b+"Type");var a=this._attributeFromProperty(c,d);if(!this._attributes){this._attributes={}}this._attributes[b]=a;if(this._cachedAttributes){delete this._cachedAttributes[b]}this.recordDidChange();return c},recordDidChange:function(){this.incrementProperty("changeCount")},updateAttributes:function(d,c,a){var e=false;if(this._attributes&&(c!==true)){for(var b in d){if(!d.hasOwnProperty(b)){continue}if(!e){e=(this._attributes[b]!=d[b])}this._attributes[b]=d[b]}}else{this._attributes=d;e=true}this._cachedAttributes={};if(e){this.beginPropertyChanges();this.set("changeCount",0);this.set("isLoaded",a);this.allPropertiesDidChange();this.endPropertyChanges();if(SC.Store){SC.Store.recordDidChange(this)}}},attributes:function(){return Object.clone(this._attributes)}.property(),unknownProperty:function(c,d){if(d!==undefined){var b=this.get("primaryKey");if(c==b){var a=this.get(c);var e=d}this.writeAttribute(c,d);if((c==b)&&a){SC.Store.relocateRecord(a,e,this)}}else{d=this.readAttribute(c)}return d},_attributeFromProperty:function(c,d){if(c&&c instanceof Array){var b=this;return c.map(function(e){return b._attributeFromProperty(e,d)})}else{var a=this._pickTypeConverter(d);if(a){return a(c,"out")}if(d){return(c)?c.get(d.primaryKey()):null}else{return c}}},_propertyFromAttribute:function(g,h){if(g&&g instanceof Array){var b=g.get("length");var e=new Array(b);for(var a=0;a<b;a++){var d=g.objectAt(a);e[a]=this._propertyFromAttribute(d,h)}e.ownerRecord=this;return e}else{var c=this._pickTypeConverter(h);if(c){return c(g,"in")}if(h){if(!g){return null}return SC.Store.getRecordFor(g,h)}else{return g}}},_getRecordType:function(recordTypeKey){var type=this[recordTypeKey];if(type&&(typeof(type)=="string")){type=eval(type);if(type){this[recordTypeKey]=type}}return type},valueForSortKey:function(a){return this.get(a)},compareTo:function(c,h){if(!h){h=[this.get("primaryKey")]}var e=SC.Record.SORT_SAME;var d;for(d=0;(e==SC.Record.SORT_SAME&&d<h.length);d++){var l=h[d];var j=true;if(l.match(/ DESC$/)){j=false;l=l.slice(0,-5)}else{if(l.match(/ ASC$/)){j=true;l=l.slice(0,-4)}}var m=l.split(".");l=m.shift();var k=this.valueForSortKey(l);var g=c.valueForSortKey(l);k=this._comparableValueFor(k,m);g=this._comparableValueFor(g,m);if(j){e=(k<g)?SC.Record.SORT_BEFORE:((k>g)?SC.Record.SORT_AFTER:SC.Record.SORT_SAME)}else{e=(k>g)?SC.Record.SORT_BEFORE:((k<g)?SC.Record.SORT_AFTER:SC.Record.SORT_SAME)}}return e},_comparableValueFor:function(c,b){if(b&&b.length>0){var a;var d=0;while(c&&(d<b.length)){a=b[d];c=(c.get)?c.get(a):c[a];d++}}else{c=(c&&c._guid)?c._guid:c}return c},matchConditions:function(d){for(var a in d){var c=d[a];if(c instanceof Array){var e=c.length;var b=false;while(--e>=0){if(this.matchCondition(a,c[e])){b=true}}if(!b){return false}}else{if(!this.matchCondition(a,c)){return false}}}return true},matchCondition:function(b,d){var a=this.get(b);var c;var e;if(d&&d.primaryKey){if($type(a)===T_ARRAY){e=a.length;while(--e>=0){if(a===d){return true}}}else{return a===d}}else{if($type(a)===T_ARRAY){e=a.length;while(--e>=0){if(this._matchValue(a[e],d)){return true}}}else{return this._matchValue(a,d)}}return false},_matchValue:function(a,b){if(a&&a.primaryKey){a=a.get(a.get("primaryKey"))}var c=(b instanceof RegExp);if(c){if(a==null){return false}return a.toString().match(b)}else{return a==b}},toString:function(){var b=this;var a=this.get("properties").map(function(c){var d=b.get(c);if(typeof(d)=="string"){d='"'+d+'"'}if(d===undefined){d="(undefined)"}if(d===null){d="(null)"}return[c,d].join("=")});return this._type.toString()+"({ "+a.join(", ")+" })"},propertyObserver:function(d,c,a,b){},_cprops:["properties"],updateProperties:function(l,b){var k=this;this.beginPropertyChanges();if(b){this.set("isLoaded",true)}try{var m=this.properties.length;while(--m>=0){var c=this.properties[m];var d=l[c];if(d===null){if(k.get(c)!=null){k.set(c,null)}}else{if(d!==undefined){var a=k.get(c);var j=k.get(c+"Type");var g=this._pickTypeConverter(j);if(g){j=null}var h;var k=this;if(d instanceof Array){d=d.map(function(e){return k._convertValueIn(e,g,j)});h=d.isEqual(a)}else{d=this._convertValueIn(d,g,j);h=d==a}if(!h){this.set(c,d)}}}}}catch(o){console.log(this._guid+": Exception raised on UPDATE: "+o)}this.endPropertyChanges();this.set("changeCount",0)},getPropertyData:function(){var e={};var g=this.get("properties")||[];var d=g.length;while(--d>=0){var l=g[d];var j=this.get(l);var c=this[l+"Type"];var b=this._pickTypeConverter(c);if(b){c=null}if(j instanceof Array){var a=[];for(var h=0;h<j.length;h++){var k=j[h];a.push(this._convertValueOut(k,b,c))}j=a}else{j=this._convertValueOut(j,b,c)}e[l]=j}return e},_pickTypeConverter:function(b){var a=null;if(b&&b.isTypeConverter){a=b;b=null}else{if(b){switch(b){case Date:a=SC.Record.Date;b=null;break;case Number:a=SC.Record.Number;b=null;break;case String:a=null;b=null;break}}}return a},_convertValueOut:function(b,a,c){if(a){return a(b,"out")}if(c){return(b)?b.get(c.primaryKey()):null}else{return b}},_convertValueIn:function(b,a,c){if(a){return a(b,"in")}if(c){return SC.Store.getRecordFor(b,c)}else{return b}},_storeKey:function(){return this._type._storeKey()}});SC.Record.mixin({SORT_BEFORE:-1,SORT_AFTER:1,SORT_SAME:0,find:function(c){var b;if(typeof(c)=="object"){b=SC.$A(arguments);b.push(this);var a=SC.Store.findRecords.apply(SC.Store,b);return(a&&a.length>0)?a[0]:null}else{return SC.Store._getRecordFor(c,this)}},findOrCreate:function(b){var a=this.find(b);if(!a){var c=(typeof(b)=="object")?b:{guid:b};a=this.create(c);SC.Store.addRecord(a)}return a},findAll:function(a){if(!a){a={}}args=SC.$A(arguments);args.push(this);return SC.Store.findRecords.apply(SC.Store,args)},collection:function(a){if(!a){a={}}a.recordType=this;return SC.Collection.create(a)},extend:function(){var a=SC.Object.extend.apply(this,arguments);if(a.coreRecordType==null){a.coreRecordType=a}return a},_storeKey:function(){return(this.coreRecordType)?this.coreRecordType._guid:this._guid},primaryKey:function(){return this.prototype.primaryKey},coreRecordType:null,resourceURL:function(){return this.prototype.resourceURL},hasMany:function(recordTypeString,conditionKey,opts){opts=(opts===undefined)?{}:Object.clone(opts);var conditions=opts.conditions||{};opts.conditions=conditions;var privateKey="_"+conditionKey+SC.generateGuid();return function(){if(!this[privateKey]){var recordType=eval(recordTypeString);conditions[conditionKey]=this;this[privateKey]=recordType.collection(opts);this[privateKey].refresh()}return this[privateKey]}.property()},newRecord:function(a,d){if(!d){d=SC.Store}var c=this.create({dataSource:d});c.beginPropertyChanges();c.set("newRecord",true);for(var b in a){if(a.hasOwnProperty(b)){c.set(b,a[b])}}c.endPropertyChanges();SC.Store.addRecord(c);return c}});SC.Record.newObject=SC.Record.newRecord;SC.Record.Date=function(b,c){if(c=="out"){if(b instanceof Date){b=b.utcFormat()}}else{if(typeof(b)=="string"){var a=Date.parseDate(b.replace(/\.\d+$/,""));if(!a){a=new Date(b)}if(a){b=a}}}return b}.typeConverter();SC.Record.Number=function(b,c){if(c=="out"){if(typeof(b)=="number"){b=b.toString()}}else{if(typeof(b)=="string"){var a=(b.match("."))?parseFloat(b):parseInt(b,0);if(a){b=a}}}return b}.typeConverter();SC.Record.Flag=function(a,b){if(b=="out"){return a=(a)?"t":"f"}else{if(typeof(a)=="string"){return !("false0".match(a.toLowerCase()))}else{return(a)?true:false}}}.typeConverter();SC.Record.Bool=SC.Record.Flag;require("foundation/object");SC.Routes=SC.Object.create({location:function(b,c){if(c!==undefined){if(c===null){c=""}if(typeof(c)=="object"){var d=(c.route)?c.route.split("&"):[""];var a=d.shift();var e={};d.each(function(h){var g=h.split("=");e[g[0]]=g[1]});for(var b in c){if(!c.hasOwnProperty(b)){continue}if(b!="route"){e[b]=encodeURIComponent(""+c[b])}}d=[a];for(var b in e){if(!e.hasOwnProperty(b)){continue}d.push([b,e[b]].join("="))}c=d.join("&")}if(this._location!=c){this._location=c;this._setWindowLocation(c)}}return this._location}.property(),ping:function(){if(!this._didSetupHistory){this._didSetupHistory=true;this._setupHistory()}this._checkWindowLocation()},addRoute:function(a,b){var c=a.split("/");if(!this._routes){this._routes=SC.Routes._Route.create()}this._routes.addRoute(c,b)},gotoRoute:function(a){var d={};var c,a,b;this._lastRoute=a;var c=a.split("&");if(c&&c.length>0){a=c.shift();c.each(function(e){var g=e.split("=");if(g&&g.length>1){d[g[0]]=decodeURIComponent(g[1])}})}else{a=""}c=a.split("/");if(!this._routes){this._routes=SC.Routes._Route.create()}b=this._routes.functionForRoute(c,d);if(b){b(d)}},init:function(){arguments.callee.base.call(this);if(SC.isSafari()&&!SC.isSafari3()){Object.extend(this,this.browserFuncs.safari)}else{if(SC.isIE()){Object.extend(this,this.browserFuncs.ie)}}this._didSetupHistory=false},browserFuncs:{safari:{_setupHistory:function(){var a=location.hash;a=(a&&a.length>0)?a.slice(1,a.length):"";this._cloc=a;this._backStack=[];this._backStack.length=history.length;this._backStack.push(a);this._forwardStack=[];this.invokeLater(this._checkWindowLocation,1000)},_checkWindowLocation:function(){var b=(history.length-this._lastLength)!=0;var e=(b)?(history.length-this._backStack.length):0;this._lastLength=history.length;if(b){console.log("historyDidChange")}if(e){if(e<0){this._forwardStack.push(this._cloc);for(var a=0;a<Math.abs(e+1);a++){this._forwardStack.push(this._backStack.pop())}this._cloc=this._backStack.pop()}else{this._backStack.push(this._cloc);for(var a=0;a<(e-1);a++){this._backStack.push(this._forwardStack.pop())}this._cloc=this._forwardStack.pop()}}else{if(b&&this._locationDidChange){this.gotoRoute(this._cloc);this._locationDidChange=false}}var d=this._cloc;var c=this.get("location");if(d!=c){this.set("location",(d)?d:"");this.gotoRoute(d)}this.invokeLater(this._checkWindowLocation,50)},_setWindowLocation:function(b){var a=this._cloc;if(a!=b){this._backStack.push(this._cloc);this._forwardStack.length=0;this._cloc=b;location.hash=(b&&b.length>0)?b:"";this._locationDidChange=true}}},ie:{_setupHistory:function(){this.invokeLater(this._checkWindowLocation,1000)},_checkWindowLocation:function(){var b=this.get("location");var a=location.hash;a=(a&&a.length>0)?a.slice(1,a.length):"";if(a!=b){this.set("location",(a)?a:"")}this.invokeLater(this._checkWindowLocation,100)},_setWindowLocation:function(b){var a=location.hash;a=(a&&a.length>0)?a.slice(1,a.length):"";if(a!=b){location.hash=(b&&b.length>0)?b:"#"}this.gotoRoute(b)}}},_setupHistory:function(){this.invokeLater(this._checkWindowLocation,1000)},_checkWindowLocation:function(){var b=this.get("location");var a=location.hash;a=(a&&a.length>0)?a.slice(1,a.length):"";if(a!=b){this.set("location",(a)?a:"")}this.invokeLater(this._checkWindowLocation,100)},_setWindowLocation:function(b){var a=location.hash;a=(a&&a.length>0)?a.slice(1,a.length):"";if(a!=b){location.hash=(b&&b.length>0)?b:"#"}this.gotoRoute(b)},_routes:null,_Route:SC.Object.extend({_func:null,_static:null,_dynamic:null,_wildcard:null,addRoute:function(d,c){if(!d||d.length==0){this._func=c}else{var b=d.shift();var e=null;switch(b.slice(0,1)){case":":b=b.slice(1,b.length);var a=this._dynamic[b]||[];e=SC.Routes._Route.create();a.push(e);this._dynamic[b]=a;break;case"*":b=b.slice(1,b.length);this._wildcard=b;this._func=c;break;default:var a=this._static[b]||[];e=SC.Routes._Route.create();a.push(e);this._static[b]=a}if(e){e.addRoute(d,c)}}},functionForRoute:function(c,b){if(!c||c.length==0){return this._func}else{var a=c.shift();var k,h,e,d;k=this._static[a];if(k){for(d=0;(d<k.length)&&(e==null);d++){var g=c.slice();e=k[d].functionForRoute(g,b)}}if(e==null){for(var j in this._dynamic){k=this._dynamic[j];if(k){for(d=0;(d<k.length)&&(e==null);d++){var g=c.slice();e=k[d].functionForRoute(g,b);if(e&&b){b[j]=a}}}if(e){break}}}if((e==null)&&this._wildcard){c.unshift(a);if(b){b[this._wildcard]=c.join("/")}e=this._func}return e}},init:function(){arguments.callee.base.call(this);this._static={};this._dynamic={}}})});require("core");require("foundation/object");SC.InputManager=SC.Object.extend({interpretKeyEvents:function(e,c){var b=this.codesForEvent(e);var g=b[0];var d=b[1];if(!g&&!d){return false}if(g){var a=SC.MODIFIED_COMMAND_MAP[g]||SC.BASE_COMMAND_MAP[g.split("_").last()];if(a&&c.respondsTo(a)){return c[a](e)}}if(d&&c.respondsTo("insertText")){return c.insertText(d)}return false},codesForEvent:function(h){var g=h.keyCode;var b=null;var c=null;var a="";if(g){b=SC.FUNCTION_KEYS[g];if(!b&&(h.altKey||h.ctrlKey)){b=SC.PRINTABLE_KEYS[g]}if(b){if(h.altKey){a+="alt_"}if(h.ctrlKey){a+="ctrl_"}if(h.shiftKey){a+="shift_"}}}if(!b){var g=h.charCode||h.keyCode;c=b=String.fromCharCode(g);var d=b.toLowerCase();if(b!=d){a="shift_";b=d}else{b=null}}if(b){b=a+b}return[b,c]}});SC.MODIFIED_COMMAND_MAP={"ctrl_.":"cancel",shift_tab:"insertBacktab",shift_left:"moveLeftAndModifySelection",shift_right:"moveRightAndModifySelection",shift_up:"moveUpAndModifySelection",shift_down:"moveDownAndModifySelection",alt_left:"moveLeftAndModifySelection",alt_right:"moveRightAndModifySelection",alt_up:"moveUpAndModifySelection",alt_down:"moveDownAndModifySelection",ctrl_a:"selectAll"};SC.BASE_COMMAND_MAP={escape:"cancel",backspace:"deleteBackward","delete":"deleteForward","return":"insertNewline",tab:"insertTab",left:"moveLeft",right:"moveRight",up:"moveUp",down:"moveDown",home:"moveToBeginningOfDocument",end:"moveToEndOfDocument",pagedown:"pageDown",pageup:"pageUp"};SC.MODIFIER_KEYS={16:"shift",17:"ctrl",18:"alt"};SC.FUNCTION_KEYS={8:"backspace",9:"tab",13:"return",19:"pause",27:"escape",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",44:"printscreen",45:"insert",46:"delete",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scrolllock"};SC.PRINTABLE_KEYS={32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",188:",",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:'"'};SC.KEY_CODES={};for(var i=0,n=256;i<n;i++){if(SC.MODIFIER_KEYS[i]!==undefined){SC.KEY_CODES[SC.MODIFIER_KEYS[i]]=i}else{if(SC.FUNCTION_KEYS[i]!==undefined){SC.KEY_CODES[SC.FUNCTION_KEYS[i]]=i}else{if(SC.PRINTABLE_KEYS[i]!==undefined){SC.KEY_CODES[SC.PRINTABLE_KEYS[i]]=i}}}}require("core");require("foundation/object");require("foundation/input_manager");SC.Responder=SC.Object.extend({acceptsFirstResponder:false,nextResponder:null,isFirstResponder:false,pane:null,becomeFirstResponder:function(){if(!this.get("acceptsFirstResponder")){return false}var a=this.get("pane");if(!a){return false}if(a.get("firstResponder")==this){return true}a.set("firstResponder",this);return true},resignFirstResponder:function(){var a=this.get("pane");if(!a){return false}if(a.get("firstResponder")!=this){return false}a.set("firstResponder",null);return true},noResponderFor:function(){},didBecomeFirstResponder:function(){},willLoseFirstResponder:function(){},inputManager:function(){return SC.Responder.inputManager}.property(),keyDown:function(a){var b=this.get("nextResponder");return(b&&b.keyDown)?b.keyDown(a):false},keyUp:function(a){var b=this.get("nextResponder");return(b&&b.keyUp)?b.keyUp(a):false},flagsChanged:function(b,a){var c=this.get("nextResponder");return(c&&c.flagsChanges)?c.flagsChanges(b,a):false},performKeyEquivalent:function(b,a){return false},interpretKeyEvents:function(a){var b=this.get("inputManager");if(b){return b.interpretKeyEvents(a,this)}return false},doCommand:function(h){var b=this;var c=SC.$A(arguments);var h=c.shift();var a=this._commandAliases[h];var e=false;do{if(this._responderHandledCommand(b,h,c)){return b}if(a){for(var d=0,g=a.length;d<g;d++){if(this._responderHandledCommand(b,a[d],c)){return b}}}}while(b=b.get("nextResponder"));return false},_responderHandledCommand:function(a,c,b){return(a.respondsTo(c)&&(a[c].apply(a,b)!=false))},_commandAliases:{mouseDown:["didMouseDown"],mouseUp:["didMouseUp"],doubleClick:["didDoubleClick"],click:["didClick"],mouseDown:["didMouseDown"]}});SC.Responder.mixin({inputManager:SC.InputManager.create()});require("core");SC.NodeDescriptor={create:function(c,a){if(!a){a={}}var o=a.tag||c.tag||"div";var k=a.cssClass||c.cssClass;var e=a.id||c.id;var d=a.style||c.style;var l=a.innerHTML||c.innerHTML;if(!l){var m=a.childNodes||c.childNodes}var j=$(document.createElement(o));if(k){j.className=k}if(e){j.id=e}if(d){for(var b in d){element.style[b.camelize()]=d[b]}}for(var h in c){if(this.ignoredProperties.indexOf(h)==-1){j.setAttribute(h,c[h])}}if(l){j.innerHTML=l}else{if(m){var g=this;m.each(function(p){j.appendChild(g.create(p))});g=null;m=null}}try{return j}finally{o=null;k=null;e=null;d=null;l=null;j=null}},ignoredProperties:["tag","cssClass","id","style","childNodes","innerHTML"]};require("foundation/object");SC.Binding=SC.Object.extend({from:"",to:"",oneWay:false,emptyPlaceholder:null,nullPlaceholder:null,multiplePlaceholder:null,transform:null,connect:function(){if(this._connected){return}var a=this._boundObservers();SC.Observers.addObserver(this.get("from"),a.from);SC.Observers.addObserver(this.get("to"),a.to);this._connected=true;return this},disconnect:function(){if(!this._connected){return}var a=this._boundObservers();SC.Observers.removeObserver(this.get("from"),a.from);SC.Observers.removeObserver(this.get("to"),a.to);this._connected=false;return this},relay:function(){var a=SC.Object.tupleForPropertyPath(this.get("from"));if(a){a=this._walkTuple(a)}if(a){this._fromObserver(a[0],a[1],a[0].get(a[1]))}},init:function(){arguments.callee.base.call(this);this.connect()},_boundObservers:function(){var a=this._boundObserverFuncs;if(!a){this._boundObserverFuncs=a={from:this._fromObserver.bind(this),to:this._toObserver.bind(this)}}return a},_fromObserver:function(h,d,g,c){if(c<=this._lastFromPropertyRevision){return}this._lastFromPropertyRevision=c;if(!this._didChange(this._lastFromValue,g)){return}this._lastFromValue=g;var a=SC.Object.tupleForPropertyPath(this.get("to"));if(a){a=this._walkTuple(a)}if(a){var e=this.transform;if(e){g=e("to",d,g)}this._lastToValue=g;var b;if(g&&(g==[])&&(b=this.get("emptyPlaceholder"))){g=b}else{if(g&&(g instanceof Array)&&(b=this.get("multiplePlaceholder"))){g=(g.length==1)?g[0]:b}}if((g==null)&&(b=this.get("nullPlaceholder")||this.get("emptyPlaceholder"))){g=b}a[0].set(a[1],g);this._lastToPropertyRevision=a[0].propertyRevision}},_toObserver:function(h,d,g,c){if(this.get("oneWay")){return}if(c<=this._lastToPropertyRevision){return}this._lastToPropertyRevision=c;if(!this._didChange(this._lastToValue,g)){return}this._lastToValue=g;var b=SC.Object.tupleForPropertyPath(this.get("from"));if(b){b=this._walkTuple(b)}if(b){var e=this.get("transform");if(e){g=e("from",d,g)}this._lastFromValue=g;b[0].set(b[1],g);var a=b[0].get(b[1]);if(a){this._lastFromPropertyRevision=a.propertyRevision}if(a!=g){h.set(d,a);this._lastToPropertyRevision=h.propertyRevision}}},_didChange:function(a,b){if(b&&a){if(typeof(b)==typeof(a)){if(a==b){return false}}}else{if(((b===null)&&(a===null))||((b===undefined)&&(a===undefined))){return false}}return true},_lastToPropertyRevision:0,_lastFromPropertyRevision:0,_walkTuple:function(a){var c=a[1].split(".");if(c.length>1){a=a.slice();var b=a[0];a[1]=c.pop();for(var d=0;(b&&(d<c.length));d++){b=b.get(c[d])}a[0]=b}return(a[0]&&a[1])?a:null}});SC.Binding.mixin({MULTIPLE_PLACEHOLDER:"@@MULT@@",NULL_PLACEHOLDER:"@@NULL@@",EMPTY_PLACEHOLDER:"@@EMPTY@@"});SC.Binding.From=function(c,b){if(!b){b={}}if(($type(c)==T_STRING)||($type(c)==T_ARRAY)){b.from=c}else{Object.extend(b,c)}var a=SC.Binding.extend(b);return a};SC.Binding.build=function(a){return function(b){return SC.Binding.From(b,{transform:a})}};SC.Binding.NoChange=SC.Binding.From;SC.Binding.NoError=SC.Binding.build(function(a,b,c){return($type(c)==T_ERROR)?null:c});SC.Binding.NoError.ext=function(a){return function(e,c,b){return($type(value)==T_ERROR)?null:a(e,c,b)}};SC.Binding.Single=SC.Binding.build(function(c,b,a){if($type(a)==T_ARRAY){switch(a.length){case 0:a=null;break;case 1:a=a[0];break;default:a=SC.Binding.MULTIPLE_PLACEHOLDER}}return a});SC.Binding.SingleNull=SC.Binding.build(function(c,b,a){if($type(a)==T_ARRAY){switch(a.length){case 0:a=null;break;case 1:a=a[0];break;default:a=null}}return a});SC.Binding.SingleNoError=SC.Binding.NoError.ext(SC.Binding.Single);SC.Binding.SingleNullNoError=SC.Binding.NoError.ext(SC.Binding.SingleNull);SC.Binding.Multiple=SC.Binding.build(function(e,b,a){var c=$type(a);if(c!=T_ARRAY){if(c==null){a=[]}else{if(c!=T_ERROR){a=[a]}}}return a});SC.Binding.MultipleNoError=SC.Binding.NoError.ext(SC.Binding.Multiple);SC.Binding.Bool=SC.Binding.build(function(c,b,a){return($type(a)==T_ARRAY)?(a.length>0):!!a});SC.Binding.NotNull=SC.Binding.build(function(c,b,a){return(a!=null)});SC.Binding.Not=SC.Binding.build(function(c,b,a){return !(($type(a)==T_ARRAY)?(a.length>0):!!a)});SC.Binding.IsNull=SC.Binding.build(function(c,b,a){return(a==null)});SC.Binding.BoolNoError=SC.Binding.NoError.ext(SC.Binding.Bool);SC.Binding.NotNullNoError=SC.Binding.NoError.ext(SC.Binding.NotNull);SC.Binding.NotNoError=SC.Binding.NoError.ext(SC.Binding.Not);SC.Binding.IsNullNoError=SC.Binding.NoError.ext(SC.Binding.IsNull);SC.Binding.Multiple=function(a){return SC.Binding.From(a,{transform:function(b,c,d){return(d)?(SC.isArray(d)?d:[d]):d}})};SC.Binding.MultipleNotEmpty=function(a){return SC.Binding.From(a,{transform:function(b,c,d){return(d)?(SC.isArray(d)?d:[d]):[]}})};SC.Binding.SingleNotEmpty=function(a){return SC.Binding.From(a,{multiplePlaceholder:SC.Binding.MULTIPLE_PLACEHOLDER,emptyPlaceholder:SC.Binding.EMPTY_PLACEHOLDER,nullPlaceholder:SC.Binding.NULL_PLACEHOLDER})};SC.Binding.OneWay=function(a){return SC.Binding.From(a,{oneWay:true})};SC.Binding.Flag=function(a){return SC.Binding.From(a,{transform:function(b,c,d){return(d&&(d instanceof Array))?(d.length==0):!!d}})};SC.Binding.OneWayFlag=function(b){var a=SC.Binding.Flag(b);a.oneWay=true;return a};require("core");require("foundation/benchmark");SC.BENCHMARK_SELECTOR=NO;NO_LIMIT=10000;SC.PathModule={$$func:function(d,e,a,c){var b=(this.rootElement)?this.rootElement:(this===document)?document:null;return SC._PathModule.$$func(b,d,e,a,c)},$$C:function(c,e,a,d){var b=(this.rootElement)?this.rootElement:(this===document)?document:null;return SC._PathModule.$$C(b,c,e,a,d)},$$T:function(b,e,a,d){var c=(this.rootElement)?this.rootElement:(this===document)?document:null;return SC._PathModule.$$T(c,b,e,a,d)},$$P:function(g,e,d,a,c){var b=(this.rootElement)?this.rootElement:(this===document)?document:null;return SC._PathModule.$$P(b,g,e,d,a,c)},$$S:function(b,e,a,d){var c=(this.rootElement)?this.rootElement:(this===document)?document:null;return SC._PathModule.$$S(c,b,e,a,d)},$func:function(b,c){var a=(this.rootElement)?this.rootElement:(this===document)?document:null;return SC._PathModule.$func(a,b,c)},$C:function(b,c){var a=(this.rootElement)?this.rootElement:(this===document)?document:null;return SC._PathModule.$C(a,b,c)},$T:function(a,c){var b=(this.rootElement)?this.rootElement:(this===document)?document:null;return SC._PathModule.$T(b,a,c)},$P:function(a,d,c){var b=(this.rootElement)?this.rootElement:(this===document)?document:null;return SC._PathModule.$P(b,a,d,c)},$S:function(a,c){var b=(this.rootElement)?this.rootElement:(this===document)?document:null;return SC._PathModule.$S(b,a,c)},$$view:function(b,g,e,a,d){var c=(this.rootElement)?this.rootElement:(this===document)?document:null;return SC._PathModule.$$view(c,b,g,e,a,d)},$view:function(a,d,c){var b=(this.rootElement)?this.rootElement:(this===document)?document:null;return SC._PathModule.$view(b,a,d,c)}};SC._PathModule={$$func:function(c,e,g,a,d){g=g||NO_LIMIT;a=a||NO_LIMIT;d=d||false;var b=function(l,o,p,h){var k=[];var j=(h)?e(l):false;if(j){k.push(l);p--}o--;if((j&&!d)||(p<=0)||(o<=0)){return k}l=l.firstChild;while(l&&(p>0)){var m=b(l,o,p,true);p-=m.length;k=k.concat(m);l=l.nextSibling}return k};return b(c||document,g+1,a,false)},$$C:function(c,b,e,a,d){return SC._PathModule.$$func(c,function(g){return Element.hasClassName(g,b)},e,a,d)},$$T:function(c,b,e,a,d){b=b.toUpperCase();return SC._PathModule.$$func(c,function(g){return g.tagName==b},e,a,d)},$$P:function(b,g,e,d,a,c){return SC._PathModule.$$func(b,function(h){var j=(h.getAttribute)?h.getAttribute(g):h[g];return j==e},d,a,c)},$$S:function(c,e,o,l,d){var h=e.split(" ");var j=[c];var k=null;var m;var p;var b;var a;var g;h.each(function(q){if(q=="?"){k=1;return}p=o;b=(k)?k:l;k=null;if(q.slice(q.length-1,q.length)=="]"){m=q.split("[");q=m.shift();g=m.map(function(u){return parseInt(u.slice(0,-1),0)})}else{g=null}m=q.split("?");q=m[0];if(m.length>1){b=(m[1].length==0)?1:parseInt(m[1],0)}m=q.split(":");q=m[0];if(m.length>1){p=(m[1]=="*")?"*":parseInt(m[1],0)}if(m.length>2){b=(m[2]=="*")?"*":parseInt(m[2],0)}if(p=="*"){p=NO_LIMIT}if(b=="*"){b=NO_LIMIT}if(q&&q.length>0){a=q.slice(0,1);if([".","#"].indexOf(a)>=0){q=q.slice(1,q.length)}m=q.split(".");q=m[0];m=m.slice(1,m.length);var s=null;if(a=="#"){s=$(q);s=(s)?[s]:null;if(s){j=s}}if(s==null){s=[];for(var r=0;r<j.length;r++){var t=SC._PathModule.$$func(j[r],function(x){var u;switch(a){case".":NODE=x;var y=x.className;if(y&&(y.length>0)){u=(y==q||y.match(new RegExp("(^|\\s)"+q+"(\\s|$)")))}else{u=false}break;case"#":u=x.id==q;break;default:if(x.tagName){u=(x.tagName.toLowerCase()==q.toLowerCase())}else{u=false}}var w=m.length;for(var v=0;u&&v<w;v++){if(!Element.hasClassName(x,m[v])){u=false}}return u},p,b,d);s=s.concat(t)}j=s}}else{if($type(j)!=T_ARRAY){j=[j]}}if(g&&g.length>0&&j){j=j.map(function(v){var w=g.length;for(var u=0;v&&(u<w);u++){v=v.childNodes[g[u]]}return v})}});return j},$func:function(b,c,d){var a=SC._PathModule.$$func(b,c,d,1,false);return(a.length>0)?a[0]:null},$C:function(c,b,d){var a=SC._PathModule.$$C(c,b,d,1,false);return(a.length>0)?a[0]:null},$T:function(c,b,d){var a=SC._PathModule.$$T(c,b,d,1,false);return(a.length>0)?a[0]:null},$P:function(c,a,e,d){var b=SC._PathModule.$$P(c,a,e,d,1,false);return(b.length>0)?b[0]:null},$S:function(c,a,d){var b=SC._PathModule.$$S(c,a,d,1,false);return(b.length>0)?b[0]:null},$$view:function(d,b,h,g,a,e){var c;if(b&&(typeof(b)!="string")){c=[b]}else{c=SC._PathModule.$$S(d,b,g,a,e)}if(c){c=c.map(function(j){return(h)?h.viewFor(j):SC.View.findViewForElement(j)})}return c},$view:function(c,a,e,d){var b=SC._PathModule.$$view(c,a,e,d,1,false);return(b.length>0)?b[0]:null}};if(SC.BENCHMARK_SELECTOR){["$$S","$$C","$$T","$S","$C","$T"].each(function(a){SC.Benchmark.install(SC._PathModule,a)});SC.Benchmark.install(window,"$$$")}Object.extend(SC._PathModule,{$$class:SC._PathModule.$$C,$$tag:SC._PathModule.$$T,$$sel:SC._PathModule.$$S,$$prop:SC._PathModule.$$P,$class:SC._PathModule.$C,$tag:SC._PathModule.$T,$sel:SC._PathModule.$S,$prop:SC._PathModule.$P});Object.extend(SC.PathModule,{$$class:SC.PathModule.$$C,$$tag:SC.PathModule.$$T,$$sel:SC.PathModule.$$S,$$prop:SC.PathModule.$$P,$class:SC.PathModule.$C,$tag:SC.PathModule.$T,$sel:SC.PathModule.$S,$prop:SC.PathModule.$P});Object.extend(Element.Methods,SC._PathModule);Object.extend(Element,SC._PathModule);if(typeof HTMLElement!="undefined"){Object.extend(HTMLElement.prototype,SC.PathModule)}Object.extend(document,SC.PathModule);Object.extend(Object.extend(window,SC.PathModule),{$$func:function(c,d,a,b){return document.$$func(c,d,a,b)}});Object.extend(Object.extend(Array.prototype,SC.PathModule),{$$func:function(d,e,a,c){var b=[];for(var g=0;g<this.length;g++){b=b.concat(this[g].$$func(d,e,a,c))}return b}});require("foundation/object");require("foundation/responder");require("foundation/node_descriptor");require("foundation/binding");require("foundation/path_module");require("mixins/delegate_support");SC.BENCHMARK_OUTLETS=NO;SC.BENCHMARK_CONFIGURE_OUTLETS=NO;SC.View=SC.Responder.extend(SC.PathModule,SC.DelegateSupport,{insertBefore:function(a,b){this._insertBefore(a,b,true)},_insertBefore:function(a,d,b){if(d){if(d.parentNode!=this){throw"insertBefore() beforeView must belong to the receiver"}if(d==a){throw"insertBefore() views cannot be the same"}}if(a.parentNode){a.removeFromParent()}this.willAddChild(this,d);a.willAddToParent(this,d);if(d){a.set("previousSibling",d.previousSibling);a.set("nextSibling",d);d.set("previousSibling",a)}else{a.set("previousSibling",this.lastChild);a.set("nextSibling",null);this.set("lastChild",a)}if(a.previousSibling){a.previousSibling.set("nextSibling",a)}if(a.previousSibling==null){this.set("firstChild",a)}a.set("parentNode",this);if(b){var c=(d)?d.rootElement:null;(this.containerElement||this.rootElement).insertBefore(a.rootElement,c);this._rebuildChildNodes()}a._updateIsVisibleInWindow();a._flushInternalCaches();a._invalidateClippingFrame();a.didAddToParent(this,d);this.didAddChild(a,d);try{return this}finally{if(c){c=null}}},removeChild:function(a){if(!a){return}if(a.parentNode!=this){throw"removeChild: view must belong to parent"}a.willRemoveFromParent();this.willRemoveChild(a);if(a.previousSibling){a.previousSibling.set("nextSibling",a.nextSibling)}else{this.set("firstChild",a.nextSibling)}if(a.nextSibling){a.nextSibling.set("previousSibling",a.previousSibling)}else{this.set("lastChild",a.previousSibling)}var b=(this.containerElement||this.rootElement);if(b&&(a.rootElement.parentNode==b)&&(b!=document)){b.removeChild(a.rootElement)}this._rebuildChildNodes();a.set("nextSibling",null);a.set("previousSibling",null);a.set("parentNode",null);a._updateIsVisibleInWindow();a._flushInternalCaches();a._invalidateClippingFrame();a.didRemoveFromParent(this);this.didRemoveChild(a);try{return this}finally{b=null}},replaceChild:function(a,b){this.insertBefore(a,b);this.removeChild(b);return this},removeFromParent:function(){if(this.parentNode){this.parentNode.removeChild(this)}return null},destroy:function(){this.removeFromParent();delete SC.View._view[SC.guidFor(this)];return null},appendChild:function(a){this.insertBefore(a,null);return this},childNodes:[],firstChild:null,lastChild:null,nextSibling:null,previousSibling:null,parentNode:null,pane:function(){var a=this;while(a=a.get("parentNode")){if(a.get("isPane")){break}}return a}.property(),clear:function(){while(this.firstChild){this.removeChild(this.firstChild)}},willAddToParent:function(a,b){},didAddToParent:function(a,b){},willRemoveFromParent:function(){},didRemoveFromParent:function(a){},willAddChild:function(b,a){},didAddChild:function(b,a){},willRemoveChild:function(a){},didRemoveChild:function(a){},nextKeyView:null,previousKeyView:null,nextValidKeyView:function(){var a=this;while(a=a.get("nextKeyView")){if(a.get("isVisible")&&a.get("acceptsFirstResponder")){return a}}return null},previousValidKeyView:function(){var a=this;while(a=a.get("previousKeyView")){if(a.get("isVisible")&&a.get("acceptsFirstResponder")){return a}}return null},_flushInternalCaches:function(){if((this._needsClippingFrame!=null)||(this._needsFrameChanges!=null)){this._needsClippingFrame=this._needsFrameChanges=null;if(this.parentNode){this.parentNode._flushInternalCaches()}}},nextResponder:function(){return this.parentNode}.property("parentNode"),performKeyEquivalent:function(b,a){var c=this.get("firstChild");while(c){if(c.performKeyEquivalent(b,a)){return true}c=c.get("nextSibling")}return false},classNames:function(a,b){if(b!==undefined){b=Array.from(b);if(this.rootElement){this.rootElement.className=b.join(" ")}this._classNames=b.slice()}if(!this._classNames){var c=this.rootElement.className;this._classNames=(c&&c.length>0)?c.split(" "):[]}return this._classNames}.property(),hasClassName:function(a){return(this._classNames||this.get("classNames")).indexOf(a)>=0},addClassName:function(a){if(this.hasClassName(a)){return}var b=this._classNames||this.get("classNames");b.push(a);this.set("classNames",b);return a},removeClassName:function(a){if(!this.hasClassName(a)){return}var b=this._classNames||this.get("classNames");b=this._classNames=b.without(a);this.set("classNames",b);return a},setClassName:function(b,a){return(!!a)?this.addClassName(b):this.removeClassName(b)},toggleClassName:function(a){return this.setClassName(a,!this.hasClassName(a))},getStyle:function(b){var a=this.rootElement;if(!this._computedStyle){this._computedStyle=document.defaultView.getComputedStyle(a,null)}b=(b==="float")?"cssFloat":b.camelize();var c=a.style[b];if(!c){c=this._computedStyle?this._computedStyle[b]:null}if(b==="opacity"){c=c?parseFloat(c):1}if(c==="auto"){c=null}return c},setStyle:function(b,a){return Element.setStyle(this.rootElement,b,a)},update:function(a){Element.update((this.containerElement||this.rootElement),a);this.propertyDidChange("innerHTML")},getAttribute:function(a){return Element.readAttribute(this.rootElement,a)},setAttribute:function(a,b){this.rootElement.setAttribute(a,b)},hasAttribute:function(a){return Element.hasAttribute(this.rootElement,a)},unknownProperty:function(b,d){if(b&&b.match&&b.match(/^style/)){b=b.slice(5,b.length).replace(/^./,function(e){return e.toLowerCase()});var a=null;if(b.match(/height$|width$|top$|bottom$|left$|right$/i)){if(d!==undefined){this.viewFrameWillChange();var c={};c[b]=(d)?d+"px":"auto";this.setStyle(c);this.viewFrameDidChange()}a=this.getStyle(b);a=(a==="auto")?null:Math.round(parseFloat(a))}else{if(d!==undefined){var c={};c[b]=d;this.setStyle(c)}a=this.getStyle(b)}return a}else{return arguments.callee.base.call(this,b,d)}},rootElement:null,containerElement:null,needsClippingFrame:function(){if(this._needsClippingFrame==null){var b=this.clippingFrameDidChange!=SC.View.prototype.clippingFrameDidChange;var a=this.get("firstChild");while(!b&&a){b=a.get("needsClippingFrame");a=a.get("nextSibling")}this._needsClippingFrame=b}return this._needsClippingFrame}.property(),needsFrameChanges:function(){if(this._needsFrameChanges==null){var b=this.get("needsClippingFrame")||this.get("hasManualLayout");var a=this.get("firstChild");while(!b&&a){b=a.get("needsFrameChanges");a=a.get("nextSibling")}this._needsFrameChanges=b}return this._needsFrameChanges}.property(),hasManualLayout:function(){return(this.resizeChildrenWithOldSize!=SC.View.prototype.resizeChildrenWithOldSize)||(this.resizeWithOldParentSize!=SC.View.prototype.resizeWithOldParentSize)||(this.clippingFrameDidChange!=SC.View.prototype.clippingFrameDidChange)}.property(),convertFrameFromView:function(e,d){var g=SC.viewportOffset(this.get("offsetParent"));var c=(d)?SC.viewportOffset(d.get("offsetParent")):SC.ZERO_POINT;var b=c.x-g.x;var a=c.y-g.y;return{x:(e.x+b),y:(e.y+a),width:e.width,height:e.height}},convertFrameToView:function(e,b){var g=SC.viewportOffset(this.get("offsetParent"));var d=(b)?SC.viewportOffset(b.get("offsetParent")):SC.ZERO_POINT;var c=g.x-d.x;var a=g.y-d.y;return{x:(e.x+c),y:(e.y+a),width:e.width,height:e.height}},offsetParent:function(){var b=this.rootElement;if(!b||b===document.body){return b}if(b.offsetParent){return b.offsetParent}var a=null;while(!a&&(b=b.parentNode)&&(b.nodeType!==11)&&(b!==document.body)){if(Element.getStyle(b,"position")!=="static"){a=b}}if(!a&&(b===document.body)){a=b}return a}.property(),innerFrame:function(l,j){var e;if(this._innerFrame==null){var a=this.rootElement;e=this._collectFrame(SC.View._collectInnerFrame);if(SC.Platform.Firefox){var k=a.offsetParent;var c=(k)?Element.getStyle(k,"overflow"):"visible";if(c&&c!=="visible"){var b=parseInt(Element.getStyle(k,"borderLeftWidth"),0)||0;var h=parseInt(Element.getStyle(k,"borderTopWidth"),0)||0;e.x+=b;e.y+=h}}var g,d;if(SC.Platform.IE){if(!a.width){g=parseInt(this.getStyle("border-left-width"),0)||0}else{g=a.clientLeft}if(!a.height){d=parseInt(this.getStyle("border-top-width"),0)||0}else{d=a.clientTop}e.x+=g;e.y+=d}else{if(a.clientLeft==null){g=parseInt(this.getStyle("border-left-width"),0)||0}else{g=a.clientLeft}if(a.clientTop==null){d=parseInt(this.getStyle("border-top-width"),0)||0}else{d=a.clientTop}e.x+=g;e.y+=d}this._innerFrame=SC.cloneRect(e)}else{e=SC.cloneRect(this._innerFrame)}return e}.property("frame"),frame:function(o,l){if(l!==undefined){this.viewFrameWillChange();var g=l;var a={};var q=false;if(l.x!==undefined){a.left=Math.floor(g.x)+"px";a.right="auto"}if(l.y!==undefined){a.top=Math.floor(g.y)+"px";a.bottom="auto"}if(l.width!==undefined){q=true;var j=0;var m=SC.View.WIDTH_PADDING_STYLES.length;while(--m>=0){j+=parseInt(this.getStyle(SC.View.WIDTH_PADDING_STYLES[m]),0)||0}var b=Math.floor(g.width)-j;if(!isNaN(b)){a.width=b.toString()+"px"}}if(l.height!==undefined){q=true;var j=0;var m=SC.View.HEIGHT_PADDING_STYLES.length;while(--m>=0){j+=parseInt(this.getStyle(SC.View.HEIGHT_PADDING_STYLES[m]),0)||0}var p=Math.floor(g.height)-j;if(!isNaN(p)){a.height=p.toString()+"px"}}this.setStyle(a);this.viewFrameDidChange()}var g;if(this._frame==null){var c=this.rootElement;g=this._collectFrame(function(){return{x:c.offsetLeft,y:c.offsetTop,width:c.offsetWidth,height:c.offsetHeight}});if(SC.Platform.Firefox){var k=c.offsetParent;var e=(k)?Element.getStyle(k,"overflow"):"visible";if(e&&e!=="visible"){var d=parseInt(Element.getStyle(k,"borderLeftWidth"),0)||0;var h=parseInt(Element.getStyle(k,"borderTopWidth"),0)||0;g.x+=d;g.y+=h}}this._frame=SC.cloneRect(g)}else{g=SC.cloneRect(this._frame)}return g}.property(),size:function(a,b){if(b!==undefined){this.set("frame",{width:b.width,height:b.height})}return this.get("frame")}.property("frame"),origin:function(a,b){if(b!==undefined){this.set("frame",{x:b.x,y:b.y})}return this.get("frame")}.property("frame"),viewFrameWillChange:function(){if(this._frameChangeLevel++<=0){this._frameChangeLevel=1;if(this.get("needsFrameChanges")){this._cachedFrames=this.getEach("innerFrame","clippingFrame","frame")}else{this._cachedFrames=null}this.beginPropertyChanges()}},viewFrameDidChange:function(c){this.recacheFrames();if(--this._frameChangeLevel<=0){this._frameChangeLevel=0;if(this._cachedFrames){var e=this.getEach("innerFrame","clippingFrame");var b=e[1];var d=this._cachedFrames[1];if(c||(b.width!=d.width)||(b.height!=d.height)){this._invalidateClippingFrame()}var b=e[0];var d=this._cachedFrames[0];if(c||(b.width!=d.width)||(b.height!=d.height)){this.resizeChildrenWithOldSize(this._cachedFrames.last())}var a=this.parentNode;while(a&&a!=SC.window){if(a._scrollFrame){a._scrollFrame=null}a=a.parentNode}this.notifyPropertyChange("frame")}this.endPropertyChanges()}},recacheFrames:function(){this._innerFrame=this._frame=this._clippingFrame=this._scrollFrame=null},isScrollable:false,scrollFrame:function(a,e){if(e!=undefined){var b=this.rootElement;if(e.x!=null){b.scrollLeft=0-e.x}if(e.y!=null){b.scrollTop=0-e.y}this._scrollFrame=null;this._invalidateClippingFrame()}var d;if(this._scrollFrame==null){var b=this.rootElement;var c;if(SC.isIE()){c=function(){var k=0;var h=0;var g=0;var j=0;var l=b.currentStyle.overflow;if(l!="hidden"&&l!="auto"){k=parseInt(b.currentStyle.borderTopWidth,0)||0;h=parseInt(b.currentStyle.borderBottomWidth,0)||0;g=parseInt(b.currentStyle.borderLeftWidth,0)||0;j=parseInt(b.currentStyle.borderRightWidth,0)||0}return{x:0-b.scrollLeft,y:0-b.scrollTop,width:b.scrollWidth+g+j,height:Math.max(b.scrollHeight,b.clientHeight)+k+h}}}else{c=function(){return{x:0-b.scrollLeft,y:0-b.scrollTop,width:b.scrollWidth,height:b.scrollHeight}}}d=this._collectFrame(c);this._scrollFrame=SC.cloneRect(d)}else{d=SC.cloneRect(this._scrollFrame)}return d}.property("frame"),clippingFrame:function(){var d;if(this._clippingFrame==null){d=this.get("frame");if(this.parentNode){var a=this.parentNode;var c=SC.intersectRects(a.get("clippingFrame"),a.get("innerFrame"));c=this.convertFrameFromView(c,a);if(this.parentNode.get("isScrollable")){var b=this.get("scrollFrame");c.x-=b.x;c.y-=b.y}d=SC.intersectRects(d,c)}else{d.width=d.height=0}this._clippingFrame=SC.cloneRect(d)}else{d=SC.cloneRect(this._clippingFrame)}return d}.property("frame","scrollFrame"),clippingFrameDidChange:function(){},resizeChildrenWithOldSize:function(a){var b=this.get("firstChild");while(b){b.resizeWithOldParentSize(a);b=b.get("nextSibling")}},resizeWithOldParentSize:function(a){this.viewFrameWillChange();this.viewFrameDidChange(YES)},_onscroll:function(){this._scrollFrame=null;this.notifyPropertyChange("scrollFrame");SC.Benchmark.start("%@.onscroll".fmt(this));this._invalidateClippingFrame();SC.Benchmark.end("%@.onscroll".fmt(this))},_frameChangeLevel:0,_collectFrame:function(d){var c=this.rootElement;var m=this.get("isVisibleInWindow");if(!m){var e=c.parentNode||c;if(e===SC.window.rootElement){e=c}var j=e.parentNode;var o=e.nextSibling;SC.window.rootElement.insertBefore(e,null)}var l=this.getStyle("display");var b=!(l!="none"&&l!=null);if(b){var g=this.rootElement.style;var p=g.visibility;var h=g.position;var a=g.display;g.visibility="hidden";g.position="absolute";g.display="block"}var k=d.call(this);if(b){g.display=a;g.position=h;g.visibility=p}if(!m){if(j){j.insertBefore(e,o)}else{if(e.parentNode){SC.window.rootElement.removeChild(e)}}}return k},_invalidateChildrenClippingFrames:function(){var a=this.get("firstChild");while(a){a._invalidateClippingFrame();a=a.get("nextSibling")}},_invalidateClippingFrame:function(){if(this.get("needsClippingFrame")){this._clippingFrame=null;this.clippingFrameDidChange();this.notifyPropertyChange("clippingFrame");this._invalidateChildrenClippingFrames()}},isVisible:true,isVisibleBindingDefault:SC.Binding.Bool,displayIsVisible:true,isVisibleInWindow:NO,localize:false,toolTip:"",emptyElement:"<div></div>",isPanel:false,isModal:true,isAnimationEnabled:true,transitionTo:function(e,a,b){var d=b||{};if(a&&!a._isAnimator){var c=a;if(!this.get("isAnimationEnabled")){d=Object.clone(d);d.duration=1}if(d.duration){d.duration=parseInt(d.duration,0)}a=Animator.apply(this.rootElement,c,d);a._isAnimator=true}if(a){a.jumpTo(a.state);a.seekTo(e)}return a},innerHTML:function(b,e){if(e!==undefined){this._textNode=null;if(SC.isSafari()&&!SC.isSafari3()){var c=(this.containerElement||this.rootElement);var a=0;var d=function(){c.innerHTML="";c.innerHTML=e;if((a++<5)&&(e.length>0)&&(c.innerHTML=="")){d.invokeLater()}};d()}else{(this.containerElement||this.rootElement).innerHTML=e}}else{e=(this.containerElement||this.rootElement).innerHTML}return e}.property(),innerText:function(a,c){if(c!==undefined){if(c==null){c=""}if(this._textNode==null){this._textNode=document.createTextNode(c);var b=this.rootElement||this.containerElement;while(b.firstChild){b.removeChild(b.firstChild)}b.appendChild(this._textNode)}else{this._textNode.data=c}}return(this._textNode)?this._textNode.data:this.innerHTML().unescapeHTML()}.property(),init:function(){arguments.callee.base.call(this);if(SC.BENCHMARK_CONFIGURE_OUTLETS){SC.Benchmark.start("SC.View.configureOutlets")}this.configureOutlets();if(SC.BENCHMARK_CONFIGURE_OUTLETS){SC.Benchmark.end("SC.View.configureOutlets")}var a=this.get("toolTip");if(a&&(a!="")){this._updateToolTipObserver()}if(this.containerElement&&($type(this.containerElement)===T_STRING)){this.containerElement=this.$sel(this.containerElement)}if(this.get("isDropTarget")){SC.Drag.addDropTarget(this)}if(this.get("isScrollable")){SC.Drag.addScrollableView(this)}if(this.isScrollable){this.rootElement.onscroll=SC.View._onscroll}this.isVisibleInWindow=(this.parentNode)?this.parentNode.get("isVisibleInWindow"):NO},configureOutlets:function(){if(!this.outlets||(this.outlets.length<=0)){return}this.beginPropertyChanges();for(var b=0;b<this.outlets.length;b++){var a=this.outlet(this.outlets[b])}this.endPropertyChanges()},show:function(){Element.show(this.rootElement);this.removeClassName("hidden");this.set("displayIsVisible",true)},hide:function(){Element.hide(this.rootElement);this.addClassName("hidden");this.set("displayIsVisible",false)},animateVisible:function(a,b){if(b!==undefined){return this.set("isAnimationEnabled",b)}return this.get("isAnimationEnabled")}.property("isAnimationEnabled"),_attachRootElement:function(a){if(this.rootElement){this.rootElement._configured=null}this.rootElement=a;a._configured=this._guid},_rebuildChildNodes:function(){var b=[];var a=this.firstChild;while(a){b.push(a);a=a.nextSibling}this.set("childNodes",b)},_toolTipObserver:function(){var a=this.get("toolTip");if(this.get("localize")){a=a.loc()}this.rootElement.title=a}.observes("toolTip"),_isVisibleObserver:function(){var a=this.get("isVisible");if((this._isVisible===undefined)||(a!=this._isVisible)){this._isVisible=a;if(a){this._show()}else{this._hide()}this._updateIsVisibleInWindow()}}.observes("isVisible"),_updateIsVisibleInWindow:function(c){if(c===undefined){var a=this.get("parentNode");c=(a)?a.get("isVisibleInWindow"):false}var b=c&&this.get("isVisible");if(b!=this.get("isVisibleInWindow")){this.set("isVisibleInWindow",b);this.recacheFrames();var d=this.get("firstChild");while(d){d._updateIsVisibleInWindow(b);d=d.get("nextSibling")}}},_show:function(c,b){if(this.showView){return this.showView()}var a=this.get("paneType");if(this.get("isPanel")){a=SC.PANEL_PANE}if(a){if(c===undefined){c=null}if(b===undefined){b=null}SC.PaneManager.manager().showPaneView(this,a,c,b);this.set("displayIsVisible",true)}else{if(this.visibleAnimation&&this.get("isAnimationEnabled")){this._transitionVisibleTo(1);this.show()}else{this._visibleAnimator=null;this.show()}}return this},_hide:function(){if(this.hideView){return this.hideView()}var a=(!!this.get("paneType"))||this.get("isPanel");if(a){SC.PaneManager.manager().hidePaneView(this);this.set("displayIsVisible",false)}else{if(this.visibleAnimation&&this.get("isAnimationEnabled")){this._transitionVisibleTo(0)}else{this._visibleAnimator=null;this.hide()}}return this},_transitionVisibleTo:function(e){var b;if(this._visibleAnimator){this.transitionTo(e,this._visibleAnimator)}else{var d=this.visibleAnimation;var c=[d.hidden,d.visible];d.onComplete=this._animateVisibleDidComplete.bind(this,d.onComplete);this._visibleAnimator=this.transitionTo(e,c,d)}},_animateVisibleDidComplete:function(a){if(!this.get("isVisible")){this.hide()}if(a){a(this)}},_firstResponderObserver:function(c,a,b){this.setClassName("focus",b)}.observes("isFirstResponder"),_dropTargetObserver:function(){if(this.get("isDropTarget")){SC.Drag.addDropTarget(this)}else{SC.Drag.removeDropTarget(this)}}.observes("isDropTarget"),popup:function(b,a){this._isVisible=true;this._show(b,a);this.set("isVisible",true)},configureObserverMethods:function(c){for(var a in c){if(!c.hasOwnProperty(a)){continue}if(this[a]){var b=this[a].bindAsEventListener(this);Event.observe(this.rootElement,c[a],b)}}}});SC.View.mixin({_view:{},findViewForElement:function(b){var a=b._configured;return(a)?SC.View._view[a]:null},viewFor:function(e,d){if(e){e=$(e)}var g=SC.idt.active;var j;if(g){SC.idt.v_count++}if(g){j=new Date().getTime()}if(!e){var h=this.prototype._cachedEmptyElement||this.prototype.emptyElement;var a=typeof(h)=="string";if(a&&(h.slice(0,1)!="<")){var e=$sel(h);if(e){this.prototype.emptyElement=h=e;a=false}}if(a){SC._ViewCreator.innerHTML=h;e=$(SC._ViewCreator.firstChild);SC.NodeCache.appendChild(e);this.prototype._cachedEmptyElement=e.cloneNode(true)}else{if(typeof(h)=="object"){if(h.tagName){e=h.cloneNode(true)}else{e=SC.NodeDescriptor.create(h)}}}}if(g){SC.idt.vc_t+=(new Date().getTime())-j}if(e&&e._configured){return SC.View.findViewForElement(e)}var c=SC.$A(arguments);c[0]={rootElement:e};if(g){j=new Date().getTime()}var b=new this(c,this);if(g){SC.idt.v_t+=(new Date().getTime())-j}e._configured=b._guid;SC.View._view[b._guid]=b;return b},create:function(b){var a=SC.$A(arguments);a.unshift(null);return this.viewFor.apply(this,a)},extend:function(b){var a=SC.Object.extend.apply(this,arguments);a.prototype._cachedEmptyElement=null;return a},outletFor:function(c){var b=this;var a=function(){if(SC.BENCHMARK_OUTLETS){SC.Benchmark.start("OUTLET(%@)".format(c))}if(c==null){var h=b.viewFor(null)}else{var h=(this.$$sel)?this.$$sel(c):$$sel(c);if(h){var d=this;var g=[];for(var l=0;l<h.length;l++){var e=b.viewFor(h[l],{owner:d});if(e&&e.rootElement&&e.rootElement.parentNode){var k=e.rootElement.parentNode;var j=null;while(k&&!j){switch(k){case this.rootElement:j=this;break;case SC.page.rootElement:j=SC.page;break;case SC.window.rootElement:j=SC.window;break;default:k=k.parentNode}}if(j){j._insertBefore(e,null,false);j._rebuildChildNodes();e._updateIsVisibleInWindow()}}g[g.length]=e}h=g;h=(h.length==0)?null:((h.length==1)?h[0]:h)}}if(SC.BENCHMARK_OUTLETS){SC.Benchmark.end("OUTLET(%@)".format(c))}return h};a.isOutlet=true;return a},automaticOutletFor:function(){var a=this.outletFor.apply(this,arguments);a.autoconfiguredOutlet=YES;return a}});if(SC.Platform.IE){SC.View.prototype.getStyle=function(b){var h=this.rootElement;b=(b=="float"||b=="cssFloat")?"styleFloat":b.camelize();var k=h.style[b];if(!k&&h.currentStyle){k=h.currentStyle[b]}if(b==="opacity"){if(k=(this.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(k[1]){k=parseFloat(k[1])/100}}k=1}if(k==="auto"){switch(b){case"width":if(this.getStyle("display")==="none"){k=null}else{if(h.currentStyle){var g=parseInt(h.currentStyle.paddingLeft,0)||0;var e=parseInt(h.currentStyle.paddingRight,0)||0;var l=parseInt(h.currentStyle.borderLeftWidth,0)||0;var a=parseInt(h.currentStyle.borderRightWidth,0)||0;k=(h.offsetWidth-g-e-l-a)+"px"}}break;case"height":if(this.getStyle("display")==="none"){k=null}else{if(h.currentStyle){var m=parseInt(h.currentStyle.paddingTop,0)||0;var d=parseInt(h.currentStyle.paddingBottom,0)||0;var j=parseInt(h.currentStyle.borderTopWidth,0)||0;var c=parseInt(h.currentStyle.borderBottomWidth,0)||0;k=(h.offsetHeight-m-d-j-c)+"px"}}break;default:k=null}}return k};SC.View._collectInnerFrame=function(){var d=this.rootElement;var a=(d.currentStyle)?d.currentStyle.hasLayout:false;var e=parseInt(d.currentStyle.borderTopWidth,0)||0;var b=parseInt(d.currentStyle.borderBottomWidth,0)||0;var c=d.offsetHeight-e-b;if(d.clientWidth>d.scrollWidth){c-15}return{x:d.offsetLeft,y:d.offsetTop,width:(a)?Math.min(d.scrollWidth,d.clientWidth):d.scrollWidth,height:(a)?Math.min(c,d.clientHeight):c}}}else{SC.View._collectInnerFrame=function(){var a=this.rootElement;return{x:a.offsetLeft,y:a.offsetTop,width:Math.min(a.scrollWidth,a.clientWidth),height:Math.min(a.scrollHeight,a.clientHeight)}}}SC.View._onscroll=function(a){$view(this)._onscroll(a)};SC.View.WIDTH_PADDING_STYLES=["paddingLeft","paddingRight","borderLeftWidth","borderRightWidth"];SC.View.HEIGHT_PADDING_STYLES=["paddingTop","paddingBottom","borderTopWidth","borderBottomWidth"];SC.View.SCROLL_WIDTH_PADDING_STYLES=["borderLeftWidth","borderRightWidth"];SC.View.SCROLL_HEIGHT_PADDING_STYLES=["borderTopWidth","borderBottomWidth"];SC.View.elementFor=SC.View.viewFor;SC._ViewCreator=document.createElement("div");SC.NodeCache=document.createElement("div");require("views/view");SC.KEYVIEW_SELECTING_NONE=0;SC.KEYVIEW_SELECTING_NEXT=1;SC.KEYVIEW_SELECTING_PREVIOUS=2;SC.PaneView=SC.View.extend({pane:null,isPane:true,isModal:false,canBecomeKeyPane:true,isKeyPane:false,makeKeyPane:function(){if(!this.get("canBecomeKeyPane")){return false}if(this.get("isKeyPane")){return false}SC.app.set("keyPane",this);return true},didBecomeKeyPane:function(){},willResignKeyPane:function(){},canBecomeMainPane:true,isMainPane:false,makeMainPane:function(){if(!this.get("canBecomeMainPane")){return false}if(this.get("isMainPane")){return false}SC.app.set("mainPane",this);return true},didBecomeMainPane:function(){},willResignMainPane:function(){},performKeyInterfaceControl:function(b,a){return false},keyViewSelectionDirection:SC.KEYVIEW_SELECTING_NONE,selectPreviousKeyView:function(){},selectNextKeyView:function(){},autorecalculatesKeyViewLoop:false,recalculateKeyViewLoop:function(){},nextResponder:null,_firstResponder:null,firstResponder:function(a,b){if(b!==undefined){if(this._firstResponder){this._firstResponder.willLoseFirstResponder()}if(this._firstResponder){this._firstResponder.set("isFirstResponder",false)}this._firstResponder=b;if(this._firstResponder){this._firstResponder.set("isFirstResponder",true)}if(this._firstResponder){this._firstResponder.didBecomeFirstResponder()}}return this._firstResponder}.property(),defaultResponder:null});require("views/view");SC.ContainerView=SC.View.extend({content:null,contentBindingDefault:SC.Binding.Single,rootView:null,replaceContent:function(a){var b=this.get("rootView")||this;b.clear();var c=a;if(c){c.viewFrameWillChange();b.appendChild(c);c.viewFrameDidChange()}},_contentObserver:function(){this.replaceContent(this.get("content"))}.observes("content")});require("panes/pane");require("views/container");SC.OverlayPaneView=SC.PaneView.extend({content:null,layer:0,anchorView:null,triggerEvent:null,isModal:true,positionPane:function(){},fitPositionToScreen:function(h,c,d){var e=c.get("frame");e.x=h.x;e.y=h.y;e=c.convertFrameToView(e,null);var b=d.convertFrameToView(d.get("frame"),null);var a=SC.window.get("frame");if(SC.maxX(e)>a.width){var g=Math.max(SC.maxX(b),e.width);e.x=Math.min(g,a.width)-e.width}if(SC.minX(e)<0){e.x=SC.minX(Math.max(b,0));if(SC.maxX(e)>a.width){e.x=Math.max(0,a.width-e.width)}}if(SC.maxY(e)>a.height){var g=Math.max((b.y-e.height),0);if(g>a.height){e.y=Math.max(0,a.height-e.height)}else{e.y=g}}if(SC.minY(e)<0){var g=Math.min(SC.maxY(b),(a.height-b.height));e.y=Math.max(g,0)}return e},resizeWithOldParentSize:function(a){this.positionPane()},acceptsFirstResponder:true,keyDown:function(a){if(!this.interpretKeyEvents(a)){return arguments.callee.base.apply(this,arguments)}},insertNewline:function(c,a){var b=this._findViewWithKeyIn("isDefault",SC.ButtonView,this);if(b){b.triggerAction(a);return true}else{return false}},cancel:function(c,a){var b=this._findViewWithKeyIn("isCancel",SC.ButtonView,this);if(b){b.triggerAction(a);return true}else{return false}},_findViewWithKeyIn:function(c,b,d,g){if(!g){if((d instanceof b)&&d.get(c)){return d}}var e=d.get("firstChild");while(e){var a=this._findViewWithKeyIn(c,b,e);if(a){return a}e=e.get("nextSibling")}return null},focusFirstKeyView:function(){var a=this._findViewWithKeyIn("acceptsFirstResponder",SC.Responder,this,true);if(!a){a=this}a.becomeFirstResponder()},click:function(a){if(!this.get("isModal")){var b=this.containerView.get("content");if(b){b.set("isVisible",false)}}return true},_contentDidChange:function(){var a=this.get("containerView");if(a){a.set("content",this.get("content"))}}.observes("content"),outlets:["containerView"],containerView:SC.ContainerView.extend({outlets:["rootView"],rootView:SC.View.extend({click:function(){return true}}).outletFor(".pane-root?"),_fixWidth:function(){var a=this.get("content");if(a){a.resizeWithOldParentSize(this.get("size"));var b=0;this.getEach("styleBorderLeftWidth","styleBorderRightWidth","stylePaddingLeft","stylePaddingRight").each(function(c){b+=c||0});this.recacheFrames();a.recacheFrames();this.set("size",{width:(a.get("size").width+b)});this.owner.positionPane();this.owner.setStyle({visibility:"visible"})}if(this.get("isVisibleInWindow")){this.owner.focusFirstKeyView()}}.observes("content"),init:function(){arguments.callee.base.apply(this,arguments);if(SC.isSafari()){this.visibleAnimation={visible:"opacity: 1.0",hidden:"opacity: 0.0",duration:100}}},click:function(a){return false}}).outletFor(".pane-wrapper?"),show:function(){this.containerView._fixWidth();arguments.callee.base.apply(this,arguments)}});require("panes/overlay");SC.PANEL_PANE="panel";SC.PanelPaneView=SC.OverlayPaneView.extend({emptyElement:'<div class="pane panel-pane"><div class="shadow pane-wrapper"><div class="pane-root"></div><div class="top-left-edge"></div><div class="top-edge"></div><div class="top-right-edge"></div><div class="right-edge"></div><div class="bottom-right-edge"></div><div class="bottom-edge"></div><div class="bottom-left-edge"></div><div class="left-edge"></div></div></div>',layer:100});require("views/view");require("mixins/delegate_support");SC.HORIZONTAL="horizontal";SC.VERTICAL="vertical";SC.SplitView=SC.View.extend(SC.DelegateSupport,{emptyElement:'<div class="sc-split-view"></div>',delegate:null,layoutDirection:SC.HORIZONTAL,canCollapseViews:YES,canCollapseView:function(a){return this.invokeDelegateMethod(this.delegate,"splitViewCanCollapse",this,a)},getThicknessForView:function(a){var c=this.get("layoutDirection");var b=a.get("frame");return(c===SC.HORIZONTAL)?b.width:b.height},setThicknessForView:function(m,c){if(m.get("parentNode")!=this){throw"view must belong to receiver (view: %@)".fmt(m)}var r=this.get("childNodes");var g=r[0];var o=r[2];var a=this.getThicknessForView(g);var b=this.getThicknessForView(o);var k=this.getThicknessForView(r[1]);var j=0;if(!g.get("isCollapsed")){j+=this.getThicknessForView(g)}if(!o.get("isCollapsed")){j+=this.getThicknessForView(o)}if(m==o){c=j-c;m=g}else{if(m!=g){throw"You can only set the thickness for the top/left or bottom/right views"}}var q=c;var p=this.get("layoutDirection");var s=this.canCollapseView(o);var l=g.get("maxThickness");var d=g.get("minThickness");if(l!=null){q=Math.min(l,q)}if(d!=null){q=Math.max(d,q)}l=o.get("maxThickness");d=o.get("minThickness");bottomRightThickness=j-q;if(l!=null){bottomRightThickness=Math.min(l,bottomRightThickness)}if(d!=null){bottomRightThickness=Math.max(d,bottomRightThickness)}q=j-bottomRightThickness;q=this.invokeDelegateMethod(this.delegate,"splitViewConstrainThickness",this,g,q);q=Math.min(q,j);q=Math.max(0,q);var h=g.get("collapseAtThickness");if(!h){h=0}var t=o.get("collapseAtThickness");t=(t==null)?j:(j-t);if((c<=h)&&this.canCollapseView(g)){l=o.get("maxThickness");if(!l||(k+j)<=l){q=0}}else{if(c>=t&&this.canCollapseView(o)){l=g.get("maxThickness");if(!l||(k+j)<=l){q=j}}}if(q!=this.getThicknessForView(g)){g.set("isCollapsed",q==0);o.set("isCollapsed",q>=j);var e=(p===SC.HORIZONTAL)?{width:q}:{height:q};g.set("frame",e);this.layout()}return q},layout:function(){var b=this.get("childNodes");var e=this.getThicknessForView(b[0]);var d=this.getThicknessForView(b[1]);var g=this.get("layoutDirection");var a=b[0];var c=a.get("isCollapsed")||NO;a.setIfChanged("isVisible",!c);a=b[1];a.viewFrameWillChange();if(g==SC.HORIZONTAL){a.setIfChanged("styleLeft",e)}else{a.setIfChanged("styleTop",e)}a.viewFrameDidChange();a=b[2];var c=a.get("isCollapsed")||NO;a.setIfChanged("isVisible",!c);if(!c){a.viewFrameWillChange();if(g==SC.HORIZONTAL){a.setIfChanged("styleLeft",e+d);a.setIfChanged("styleRight",0);a.setIfChanged("styleWidth",null)}else{a.setIfChanged("styleTop",e+d);a.setIfChanged("styleBottom",0);a.setIfChanged("styleHeight",null)}a.viewFrameDidChange()}},splitViewCanCollapse:function(b,a){if(b.get("canCollapseViews")===NO){return NO}if(a.get("canCollapse")===NO){return NO}return YES},splitViewConstrainThickness:function(c,a,b){return b},init:function(){arguments.callee.base.apply(this,arguments);this.addClassName(this.get("layoutDirection"))}});require("views/view");require("views/split");SC.SplitDividerView=SC.View.extend({emptyElement:'<div class="sc-split-divider-view"></div>',mouseDown:function(a){this._mouseDownLocation=Event.pointerLocation(a);this._splitView=this.get("parentNode");this._tlView=this.get("previousSibling");this._brView=this.get("nextSibling");this._originalTopLeftThickness=this._splitView.getThicknessForView(this._tlView);this._direction=this._splitView.get("layoutDirection");return true},mouseDragged:function(a){var d=Event.pointerLocation(a);if(this._direction==SC.HORIZONTAL){var c=d.x-this._mouseDownLocation.x}else{var c=d.y-this._mouseDownLocation.y}var b=this._originalTopLeftThickness+c;this._splitView.setThicknessForView(this._tlView,b);this._setCursorStyle();return true},mouseUp:function(a){this._mouseDownLocation=this._originalTopLeftThickness=null},doubleClick:function(b){var a=this._tlView;var c=a.get("isCollapsed")||NO;if(!c&&!this._splitView.canCollapseView(a)){a=this._brView;c=a.get("isCollapsed")||NO;if(!c&&!this._splitView.canCollapseView(a)){return}}if(!c){a._uncollapsedThickness=this._splitView.getThicknessForView(a);this._splitView.setThicknessForView(a,0);if(!a.get("isCollapsed")){a._uncollapsedThickness=null}}else{this._splitView.setThicknessForView(a,a._uncollapsedThickness);a._uncollapsedThickness=null}this._setCursorStyle();return true},_setCursorStyle:function(){tlThickness=this._splitView.getThicknessForView(this._tlView);brThickness=this._splitView.getThicknessForView(this._brView);if(this._tlView.get("isCollapsed")||tlThickness==this._tlView.get("minThickness")||brThickness==this._brView.get("maxThickness")){this.setStyle({cursor:this._direction==SC.HORIZONTAL?"e-resize":"s-resize"})}else{if(this._brView.get("isCollapsed")||tlThickness==this._tlView.get("maxThickness")||brThickness==this._brView.get("minThickness")){this.setStyle({cursor:this._direction==SC.HORIZONTAL?"w-resize":"n-resize"})}else{this.setStyle({cursor:this._direction==SC.HORIZONTAL?"ew-resize":"ns-resize"})}}}});require("views/view");SC.PopupMenuView=SC.View.extend({emptyElement:"<ul></ul>",acceptsFirstResponder:true,keyDown:function(a){return this.interpretKeyEvents(a)},cancel:function(){this.set("currentSelectedMenuItem",null);this.set("isVisible",false)},moveUp:function(){this.selectPreviousMenuItem()},moveDown:function(){this.selectNextMenuItem()},_currentSelectedMenuItem:null,currentSelectedMenuItem:function(a,b){if(b!==undefined){if(this._currentSelectedMenuItem){this._currentSelectedMenuItem.set("isDefault",false)}this._currentSelectedMenuItem=b;if(this._currentSelectedMenuItem){this._currentSelectedMenuItem.set("isDefault",true)}}return this._currentSelectedMenuItem}.property(),selectPreviousMenuItem:function(){var a=this.previousValidMenuItem();if(!a){return false}this.set("currentSelectedMenuItem",a)},selectNextMenuItem:function(){var a=this.nextValidMenuItem();if(!a){return false}this.set("currentSelectedMenuItem",a)},previousValidMenuItem:function(){return this._validMenuItemInDirection("previousSibling","lastChild")},nextValidMenuItem:function(){return this._validMenuItemInDirection("nextSibling","firstChild")},_validMenuItemInDirection:function(d,b){var c=this.get("currentSelectedMenuItem");var a=c?c.get(d):this.get(b);if(!a){return null}do{if(a.get("isEnabled")){return a}}while(a=a.get(d));return null},_show:function(){this.set("currentSelectedMenuItem",null);var c=this.get("childNodes");for(var b=0,g=c.length;b<g;b++){var a=c[b];if(a._hasLegacyActionHandler()){continue}var d=a.get("action");var e=SC.app.targetForAction(d,a.get("target"),a);if(e&&e.respondsTo("validateMenuItem")){a.set("isEnabled",e.validateMenuItem(a))}if(e&&!e.respondsTo("validateMenuItem")){a.set("isEnabled",true)}if(!e){a.set("isEnabled",false)}}arguments.callee.base.apply(this,arguments)},resizeWithOldParentSize:function(){var a=0;var e=this.get("firstChild");while(e){var c=(e.computedRequiredWidth)?e.computedRequiredWidth():0;if(c>a){a=c}e=e.get("nextSibling")}var b=this.get("size").width;if(a!=b){var d={width:a};this.set("size",d)}}});SC.MIXED_STATE="__MIXED__";SC.Control={initMixin:function(){this._contentObserver();this.isSelectedObserver();this.isEnabledObserver();this.isFocusedObserver()},isSelected:false,isSelectedBindingDefault:SC.Binding.OneWayBool,isEnabled:true,isEnabledBindingDefault:SC.Binding.OneWayBool,value:null,content:null,contentValueKey:null,contentPropertyDidChange:function(d,a){if(!!this._contentValueKey&&((a==this._contentValueKey)||(a=="*"))){var b=this.get("content");var c=(b)?b.get(this._contentValueKey):null;if(c!=this._contentValue){this._contentValue=c;this.set("value",c)}}},updateContentWithValueObserver:function(){if(!this._contentValueKey){return}var b=this.get("value");if(b==this._contentValue){return}var a=this.get("content");if(!a){return}this._contentValue=b;a.set(this._contentValueKey,b)}.observes("value"),isSelectedObserver:function(){var a=this.get("isSelected");this.setClassName("mixed",a==SC.MIXED_STATE);this.setClassName("sel",a&&(a!=SC.MIXED_STATE))}.observes("isSelected"),isEnabledObserver:function(){var a=!this.get("isEnabled");this.setClassName("disabled",a);if(this.rootElement&&(this.rootElement.disabled!==undefined)&&(this.rootElement.disabled!=a)){this.rootElement.disabled=a}}.observes("isEnabled"),isFocusedObserver:function(){this.setClassName("focus",!!this.get("isFirstResponder"))}.observes("isFirstResponder"),_content:null,_contentObserver:function(){var b=this.get("content");if(this._content==b){return}if(!this._boundContentPropertyDidChangeObserver){this._boundContentPropertyDidChangeObserver=this.contentPropertyDidChange.bind(this)}var c=this._boundContentPropertyDidChangeObserver;if(this._content&&this._content.removeObserver){this._content.removeObserver("*",c)}var a=this.displayDelegate;this._contentValueKey=this.getDelegateProperty(a,"contentValueKey");this._content=b;if(this._content&&this._content.addObserver){this._content.addObserver("*",c)}this.contentPropertyDidChange(this._content,"*")}.observes("content")};SC.Validatable={initMixin:function(){this._validatorObserver()},validator:null,errorLabel:null,isValid:function(){return $type(this.get("value"))!=T_ERROR}.property("value"),ownerForm:null,performValidate:function(c){var a=SC.Validator.OK;if(this._validator){var b=this.get("ownerForm");if(c){a=this._validator.validatePartial(b,this);if((a==SC.Validator.NO_CHANGE)&&(this._validator.validateChange(b,this)==SC.Validator.OK)){a=SC.Validator.OK}}else{a=this._validator.validateChange(b,this)}}return a},performValidateSubmit:function(){return(this._validator)?this._validator.validateSubmit(this.get("ownerForm"),this):SC.Validator.OK},validateSubmit:function(){return this.performValidateSubmit()},objectForFieldValue:function(a){return(this._validator)?this._validator.objectForFieldValue(a,this.get("ownerForm"),this):a},fieldValueForObject:function(a){return(this._validator)?this._validator.fieldValueForObject(a,this.get("ownerForm"),this):a},isValidObserver:function(){var a=!this.get("isValid");this.setClassName("invalid",a)}.observes("isValid"),_validatorObserver:function(){var a=this.get("ownerForm");var b=SC.Validator.findFor(a,this,this.get("validator"));if(b!=this._validator){if(this._validator){this._validator.detachFrom(a,this)}this._validator=b;if(this._validator){this._validator.attachTo(a,this)}}}.observes("validator","ownerForm")};require("views/view");require("mixins/control");require("mixins/validatable");SC.FieldView=SC.View.extend(SC.Control,SC.Validatable,{value:null,fieldKey:null,fieldLabel:null,errorLabel:function(){var a=this.get("fieldLabel");if(a){return a}var c=this.get("fieldKey");var b=(c||"").humanize().capitalize();return"FieldKey.%@".fmt(c).locWithDefault(b)}.property("fieldLabel","fieldKey"),fieldValue:function(a,b){if(b!==undefined){this._setFieldValue(b)}return this._getFieldValue()}.property("value"),validateSubmit:function(){var a=this.performValidateSubmit();var b=($ok(a))?this._getFieldValue():a;if(b!=this.get("value")){this.set("value",b)}return a},setFieldValue:function(a){if(this.rootElement.value!=a){this.rootElement.value=a}},getFieldValue:function(){return this.rootElement.value},fieldValueDidChange:function(b){var a=this.performValidate(b);if(a==SC.Validator.NO_CHANGE){return a}var c=($ok(a))?this._getFieldValue():a;if(!b&&$ok(a)){this._setFieldValue(c)}if(c!=this.get("value")){this.set("value",c)}return a},enableField:function(){this.rootElement.disabled=NO},disableField:function(){this.rootElement.disabled=YES},isEnabledObserver:function(){isEnabled=this.get("isEnabled");arguments.callee.base.apply(this,arguments);(isEnabled)?this.enableField():this.disableField()}.observes("isEnabled"),init:function(){arguments.callee.base.call(this);if(this.rootElement){this._setFieldValue(this.get("value"))}},_valueObserver:function(){var b=this.get("value");var a=$type(b)==T_ERROR;if(!a&&(b!=this._getFieldValue())){this._setFieldValue(b)}}.observes("value"),_setFieldValue:function(a){return this.setFieldValue(this.fieldValueForObject(a))},_getFieldValue:function(){return this.objectForFieldValue(this.getFieldValue())}});SC.Editable={isEditable:NO,isEditing:NO,beginEditing:function(){if(!this.get("isEditable")){return NO}if(this.get("isEditing")){return YES}this.set("isEditing",YES);this.becomeFirstResponder();return YES},discardEditing:function(){return !this.get("isEditing")},commitEditing:function(){if(!this.get("isEditing")){return YES}this.set("isEditing",NO);this.resignFirstResponder();return YES}};require("views/field/field");require("mixins/editable");SC.TextFieldView=SC.FieldView.extend(SC.Editable,{emptyElement:'<input type="text" value="" />',hint:null,isHintShowing:false,isEditing:NO,init:function(){if(this.hint==null){this.hint=this.rootElement.getAttribute("hint")}if(this.validator==null){this.validator=this.rootElement.getAttribute("validate")}arguments.callee.base.call(this);var a=this._fieldDidFocus.bindAsEventListener(this);Event.observe(this.rootElement,"focus",a);var b=this._fieldDidBlur.bindAsEventListener(this);Event.observe(this.rootElement,"blur",b);this._updateFieldHint()},_fieldDidFocus:function(){if(!this._isFocused){this._isFocused=true;this.becomeFirstResponder()}},_fieldDidBlur:function(){if(this._isFocused){this._isFocused=false;this.resignFirstResponder()}},acceptsFirstResponder:function(){return this.get("isEnabled")}.property("isEnabled"),didBecomeFirstResponder:function(){if(!this._isFocused){this._isFocused=true;if(this.get("isVisibleInWindow")){this.rootElement.focus();this.invokeLater(this._selectRootElement,1)}}this._updateFieldHint()},_selectRootElement:function(){this.rootElement.select()},willLoseFirstResponder:function(){if(this._isFocused){this._isFocused=false;this._updateFieldHint();return this.rootElement.blur()}else{this._value=this.rootElement.value;this.fieldValueDidChange();this._updateFieldHint();return true}},_isFocused:false,_updateFieldHint:function(){var b=this.get("hint");var a=!!(!this._isFocused&&((this._value==null)||this._value=="")&&(b));this.setClassName("show-hint",a);this.rootElement.value=(a)?b:(this._value||"");this.set("isHintShowing",a)},getFieldValue:function(){return this._value},setFieldValue:function(a){if(this._value==a){return}this._value=a;this._updateFieldHint()},mouseDown:function(a){a._stopWhenHandled=false;return false},keyDown:function(a){if(this._value!=this.rootElement.value){this._value=this.rootElement.value;this.fieldValueDidChange(true)}return this.interpretKeyEvents(a)},keyUp:function(){if(this._value!=this.rootElement.value){this._value=this.rootElement.value;this.fieldValueDidChange(true)}},_focusOnVisible:function(){if(this.get("isVisibleInWindow")&&this._isFocused){this.rootElement.focus();if(SC.isIE()){var a=function(){Element.select(arguments.callee.it)};a.it=this.rootElement;setTimeout(a,0.05)}else{this.rootElement.select.bind(this.rootElement).delay(0.05)}}}.observes("isVisibleInWindow"),deleteBackward:function(a){a._stopWhenHandled=false;return true},deleteForward:function(a){a._stopWhenHandled=false;return true},moveLeft:function(a){a._stopWhenHandled=false;return true},moveRight:function(a){a._stopWhenHandled=false;return true},moveUp:function(a){a._stopWhenHandled=false;return true},moveDown:function(a){a._stopWhenHandled=false;return true},moveLeftAndModifySelection:function(a){a._stopWhenHandled=false;return true},moveRightAndModifySelection:function(a){a._stopWhenHandled=false;return true},moveUpAndModifySelection:function(a){a._stopWhenHandled=false;return true},moveDownAndModifySelection:function(a){a._stopWhenHandled=false;return true},moveToBeginningOfDocument:function(a){a._stopWhenHandled=false;return true},moveToEndOfDocument:function(a){a._stopWhenHandled=false;return true},selectAll:function(a){a._stopWhenHandled=false;return true}});require("views/field/text_field");SC.TextareaFieldView=SC.TextFieldView.extend({emptyElement:"<textarea></textarea>",didBecomeFirstResponder:function(){if(this.get("isVisibleInWindow")){this.rootElement.focus();this.invokeLater(this._selectRootElement,1)}this._updateFieldHint()},insertNewline:function(a){a._stopWhenHandled=false;return true}});SC.InlineEditorDelegate={inlineEditorClassName:"",inlineEditorWillBeginEditing:function(a){},inlineEditorDidBeginEditing:function(a){},inlineEditorShouldEndEditing:function(a,b){return YES},inlineEditorDidEndEditing:function(a,b){}};require("views/view");require("mixins/delegate_support");require("views/field/text_field");require("views/field/textarea_field");require("mixins/inline_editor_delegate");SC.InlineTextFieldView=SC.View.extend(SC.DelegateSupport,SC.InlineEditorDelegate,{beginEditing:function(b){this.beginPropertyChanges();if(this.get("isEditing")&&!this.blurEditor()){this.endPropertyChanges();return NO}this._optframe=b.frame;this._exampleElement=b.exampleElement;this._delegate=b.delegate;if(!this._optframe||!this._delegate){throw"At least frame and delegate options are required for inline editor"}this._originalValue=b.value||"";this._multiline=(b.multiline!==undefined)?b.multiline:NO;this._commitOnBlur=(b.commitOnBlur!==undefined)?b.commitOnBlur:YES;var c=this.outlet("field");c.set("validator",b.validator);c.set("value",this._originalValue);c.set("selectedRange",b.selectedRange||{start:this._originalValue.length,length:0});this.set("isEditing",YES);SC.app.get("keyPane").appendChild(this);this.updateViewStyle();var a=this._delegate;this._className=this.getDelegateProperty(a,"inlineEditorClassName");if(this._className&&!this.hasClassName(this._className)){this.setClassName(this._className,true)}this.invokeDelegateMethod(a,"inlineEditorWillBeginEditing",this);this.resizeToFit(c.getFieldValue());this.endPropertyChanges();this.field.becomeFirstResponder();this.invokeDelegateMethod(a,"inlineEditorDidBeginEditing",this)},commitEditing:function(){var a=this.outlet("field");if(!$ok(a.validateSubmit())){return NO}return this._endEditing(a.get("value"))},discardEditing:function(){return this._endEditing(this._originalValue)},blurEditor:function(){if(!this.get("isEditing")){return YES}return(this._commitOnBlur)?this.commitEditing():this.discardEditing()},_endEditing:function(b){if(!this.get("isEditing")){return YES}var a=this._delegate;if(!this.invokeDelegateMethod(a,"inlineEditorShouldEndEditing",this,b)){return NO}this.invokeDelegateMethod(a,"inlineEditorDidEndEditing",this,b);if(this._className){this.setClassName(this._className,false)}this._originalValue=this._delegate=this._exampleElement=this._optframe=this._className=null;this.set("isEditing",NO);if(this.field.get("isFirstResponder")){this.field.resignFirstResponder()}if(this.get("parentNode")){this.removeFromParent()}return YES},isEditing:NO,emptyElement:['<div class="sc-inline-text-field-view">','<div class="sizer"></div>','<textarea class="inner-field" wrap="virtual"></textarea>',"</div>"].join(""),updateViewStyle:function(){var d=this._optframe;var a=this._exampleElement;var b={fontSize:Element.getStyle(a,"font-size"),fontFamily:Element.getStyle(a,"font-family"),fontWeight:Element.getStyle(a,"font-weight"),paddingLeft:Element.getStyle(a,"padding-left"),paddingRight:Element.getStyle(a,"padding-right"),paddingTop:Element.getStyle(a,"padding-top"),paddingBottom:Element.getStyle(a,"padding-bottom"),lineHeight:Element.getStyle(a,"line-height"),textAlign:Element.getStyle(a,"text-align")};var e=this.outlet("field");var c=this.outlet("sizer");e.setStyle(b);b.opacity=0;c.setStyle(b);c.recacheFrames();this.set("frame",d)},resizeToFit:function(d){var b=this.outlet("sizer");var c=this.outlet("field");var e=(d||"").escapeHTML();e=e.replace(/  /g,"&nbsp; ").replace(/\n/g,"<br />&nbsp;");b.set("innerHTML",e||"&nbsp;");b.recacheFrames();var a=b.get("frame").height;this.set("frame",{height:a})},field:SC.TextareaFieldView.extend({mouseDown:function(a){arguments.callee.base.call(this,a);return this.owner.get("isEditing")},willRemoveFromParent:function(){this.get("rootElement").blur()},willLoseFirstResponder:function(){this.get("rootElement").blur();return this.owner.blurEditor()},cancel:function(){this.owner.discardEditing();return YES},fieldValueDidChange:function(a){arguments.callee.base.call(this,a);this.owner.resizeToFit(this.getFieldValue())},insertNewline:function(a){if(this.owner._multiline){return arguments.callee.base.call(this,a)}else{this.owner.commitEditing();return YES}},insertTab:function(a){var b=this.get("owner")._delegate.nextValidKeyView();this.owner.commitEditing();if(b){b.beginEditing()}return YES},insertBacktab:function(a){var b=this.get("owner")._delegate.previousValidKeyView();this.owner.commitEditing();if(b){b.beginEditing()}return YES}}).outletFor(".inner-field?"),sizer:SC.View.outletFor(".sizer?")});SC.InlineTextFieldView.mixin({beginEditing:function(a){if(!this.sharedEditor){this.sharedEditor=this.create()}return this.sharedEditor.beginEditing(a)},commitEditing:function(){return(this.sharedEditor)?this.sharedEditor.commitEditing():YES},discardEditing:function(){return(this.sharedEditor)?this.sharedEditor.discardEditing():YES},sharedEditor:null});require("views/view");require("mixins/control");require("mixins/delegate_support");require("views/inline_text_field");require("mixins/inline_editor_delegate");SC.LabelView=SC.View.extend(SC.DelegateSupport,SC.Control,SC.InlineEditorDelegate,{emptyElement:'<span class="sc-label-view"></span>',escapeHTML:true,localize:false,formatter:null,value:"",displayValue:function(){var g=this.get("value");var d=this.getDelegateProperty(this.displayDelegate,"formatter");if(d){var e=($type(d)==T_FUNCTION)?d(g,this):d.fieldValueForObject(g,this);if(e!=null){g=e}}if($type(g)==T_ARRAY){var c=[];for(var b=0;b<g.get("length");b++){var a=g.objectAt(b);if(a!=null&&a.toString){a=a.toString()}c.push(a)}g=c.join(",")}if(g!=null&&g.toString){g=g.toString()}if(g&&this.getDelegateProperty(this.displayDelegate,"localize")){g=g.loc()}return g}.property("value"),isEditable:NO,isEditing:NO,localize:false,validator:null,doubleClick:function(a){return this.beginEditing()},beginEditing:function(){if(this.get("isEditing")){return YES}if(!this.get("isEditable")){return NO}var c=this.get("value")||"";var b=this.convertFrameToView(this.get("frame"),null);var a=this.rootElement;SC.InlineTextFieldView.beginEditing({frame:b,delegate:this,exampleElement:a,value:c,multiline:NO,validator:this.get("validator")})},discardEditing:function(){if(!this.get("isEditing")){return YES}return SC.InlineTextFieldView.discardEditing()},commitEditing:function(){if(!this.get("isEditing")){return YES}return SC.InlineTextFieldView.commitEditing()},inlineEditorWillBeginEditing:function(a){this.set("isEditing",YES)},inlineEditorDidBeginEditing:function(a){this._oldOpacity=this.getStyle("opacity");this.setStyle({opacity:0})},inlineEditorShouldEndEditing:function(a,b){return YES},inlineEditorDidEndEditing:function(a,b){this.setIfChanged("value",b);this.setStyle({opacity:this._oldOpacity});this._oldOpacity=null;this.set("isEditing",NO)},_valueDidChange:function(){var a=this.get("value");if(a===this._value){return}this._value=a;a=this.get("displayValue");if(this.getDelegateProperty(this.displayDelegate,"escapeHTML")){this.set("innerText",a||"")}else{this.set("innerHTML",a||"")}}.observes("value")});SC.DROP_ON=1;SC.DROP_BEFORE=2;SC.DROP_ANY=3;SC.CollectionViewDelegate={collectionViewSelectionForProposedSelection:function(a,b){return b},collectionViewShouldBeginDrag:function(a){return YES},collectionViewDragDataTypes:function(a){return[]},collectionViewDragDataForType:function(a,b,c){return null},collectionViewValidateDrop:function(a,d,e,c,b){return b},collectionViewAcceptDrop:function(b,d,e,c,a){return SC.DRAG_NONE},collectionViewShouldDeleteContent:function(a,b){return b},collectionViewDeleteContent:function(a,b){return NO}};require("views/view");require("views/label");require("mixins/collection_view_delegate");SC.BENCHMARK_UPDATE_CHILDREN=NO;SC.VALIDATE_COLLECTION_CONSISTANCY=NO;SC.DRAG_REORDER=268369921;SC.HORIZONTAL_ORIENTATION="horizontal";SC.VERTICAL_ORIENTATION="vertical";SC.ZOMBIE_GROUPS_ENABLED=YES;SC.REMOVE_COLLECTION_ROOT_ELEMENT_DURING_RENDER=NO;SC.CollectionView=SC.View.extend(SC.CollectionViewDelegate,{content:[],contentBindingDefault:SC.Binding.MultipleNotEmpty,selection:[],selectionBindingDefault:SC.Binding.Multiple,delegate:null,isSelectable:true,isSelectableBindingDefault:SC.Binding.Bool,isEnabled:true,isEnabledBindingDefault:SC.Binding.Bool,isEditable:true,isEditableBindingDefault:SC.Binding.Bool,canReorderContent:false,canReorderContentBindingDefault:SC.Binding.Bool,canDeleteContent:NO,canDeleteContentBindingDefault:SC.Binding.Bool,isDropTarget:NO,useToggleSelection:NO,actOnSelect:false,selectOnMouseDown:true,groupBy:null,exampleView:SC.View,exampleGroupView:SC.View.extend({emptyElement:'<div><h1></h1><div class="well"></div></div>',outlets:["labelView","itemView"],labelView:SC.LabelView.outletFor("h1?"),itemView:SC.View.outletFor(".well?")}),action:null,target:null,isDirty:false,maxRenderTime:0,contentValueKey:null,acceptsFirstResponder:false,itemsPerRow:1,itemViews:function(){if(!this._itemViews){var b=this.get("nowShowingRange");var c=this.get("content")||[];this._itemViews=[];for(var a=0;a<b.length;a++){var d=c.objectAt(a);this._itemViews.push(this.itemViewForContent(d))}}return this._itemViews}.property(),groupViews:function(){if(!this._groupViews){var d=this.get("groupBy");if(d){var c=this.get("nowShowingRange");var g=this.get("content")||[];var b=undefined;this._groupViews=[];for(var a=0;a<c.length;a++){var h=g.objectAt(a);var e=(h)?h.get(d):null;if(e!=b){b=e;this._groupViews.push(this.groupViewForGroupValue(b))}}}}return this._groupViews}.property(),hasItemView:function(a){if(!this._itemViewsByGuid){this._itemViewsByGuid={}}return !!this._itemViewsByGuid[SC.guidFor(a)]},itemViewAtLocation:function(c){var a=this._itemViewRoot;while(a){var b=a.get("frame");if(SC.pointInRect(c,b)){return a}}return null},itemViewForEvent:function(b){var a=SC.window.firstViewForEvent(b);if(!a){return null}do{if(a==this){return null}if(this.hasItemView(a)&&(!a.hitTest||a.hitTest(b))){return a}}while(a=a.get("parentNode"));return null},itemViewForContent:function(b){var a=(b)?SC.guidFor(b):"0";return this._itemViewsByContent[a]},groupViewForGroupValue:function(a){return this._groupViewsByValue[a]},groupValueForGroupView:function(b){if(!b){return null}var a;if(b.groupValue===undefined){a=b.get("content")}else{a=b.get("groupValue")}return a},groupRangeForContentIndex:function(c){var g=Array.from(this.get("content"));var e=g.get("length");var k=this.get("groupBy");if(!k){return{start:0,length:e}}var b=c,h=c;var j=g.objectAt(c);var a=(j)?j.get(k):null;while(--b>=0){var j=g.objectAt(b);var d=(j)?j.get(k):null;if(d!==a){break}}b++;while(++h<e){var j=g.objectAt(h);var d=(j)?j.get(k):null;if(d!==a){break}}return{start:b,length:h-b}},groupValueAtContentIndex:function(c){var a=this.get("groupBy");var b=Array.from(this.get("content")).objectAt(c);return(a&&b&&b.get)?b.get(a):null},updateChildren:function(d){var j;if(!this.get("isVisibleInWindow")){this.set("isDirty",true);this._needsFullUpdate=this._needsFullUpdate||d;return}if(SC.BENCHMARK_UPDATE_CHILDREN){var e="%@.updateChildren(%@)".fmt(this,(d)?"FULL":"FAST");SC.Benchmark.start(e)}this.beginPropertyChanges();var j;if((j=this.computeFrame())&&!SC.rectsEqual(j,this.get("frame"))){var r=this.get("parentNode");if(r){r.viewFrameWillChange()}this.set("frame",j);if(r){r.viewFrameDidChange()}if((j=this.computeFrame())&&!SC.rectsEqual(j,this.get("frame"))){this.set("frame",j)}}var p=this._lastClippingFrame=this.get("clippingFrame");var g=this.contentRangeInFrame(p);var l=Array.from(this.get("content"));g.length=Math.min(SC.maxRange(g),l.get("length"))-g.start;var u=this.get("nowShowingRange");d=d||(this.get("isDirty")&&this._needsFullUpdate)||(SC.intersectRanges(g,u).length<=0);this.set("nowShowingRange",g);var t=this.get("groupBy");var h=false;if(d){var k={};var q=SC.maxRange(g);while(--q>=g.start){var o=l.objectAt(q);var s=SC.guidFor(o);var m=this._insertItemViewFor(o,t,q);if(m){k[s]=m;delete this._itemViewsByContent[s]}}for(var s in this._itemViewsByContent){if(!this._itemViewsByContent.hasOwnProperty(s)){continue}var m=this._itemViewsByContent[s];this._removeItemView(m,t)}this._itemViewsByContent=k;h=true}else{var a=g.start;var b=(u.start-a);if(b!=0){this._insertOrRemoveItemViewsInRange(a,b,t);h=true}var a=SC.maxRange(u);var b=SC.maxRange(g)-a;if(b!=0){this._insertOrRemoveItemViewsInRange(a,b,t);h=true}}this.recacheFrames();this._hasChildren=g.length>0;this.set("isDirty",false);if(h){this._flushZombieGroupViews();this.updateSelectionStates();this._itemViews=null;this.notifyPropertyChange("itemViews");this._groupViews=null;this.notifyPropertyChange("groupViews")}this.endPropertyChanges();if(SC.BENCHMARK_UPDATE_CHILDREN){SC.Benchmark.end(e)}},rebuildChildren:function(){this.beginPropertyChanges();while(this._itemViewRoot){this._removeItemViewFromChain(this._itemViewRoot)}while(this._groupViewRoot){this._removeGroupView(this._groupViewRoot)}this._hasChildren=false;this.updateChildren();this.endPropertyChanges()},updateSelectionStates:function(){if(!this._hasChildren){return}var e=this.get("selection")||[];var g=this._selectionHash;if(!g){g={};var a=e.get("length");while(--a>=0){var h=e.objectAt(a);var c=SC.guidFor(h);g[c]=true}this._selectionHash=g}for(var c in this._itemViewsByContent){if(!this._itemViewsByContent.hasOwnProperty(c)){continue}var d=this._itemViewsByContent[c];var b=(c)?g[c]:false;if(d.get("isSelected")!=b){d.set("isSelected",b)}}},resizeChildrenWithOldSize:function(a){if(!this._hasChildren){return}this.updateChildren();this.layoutResize()},clippingFrameDidChange:function(){if(!this._hasChildren){return}SC.Benchmark.start("%@.clippingFrameDidChange".fmt(this.toString()));if(!SC.rectsEqual(this._lastClippingFrame,this.get("clippingFrame"))){if(this._hasChildren){this.updateChildren()}}SC.Benchmark.end("%@.clippingFrameDidChange".fmt(this.toString()))},computeFrame:function(){return null},contentRangeInFrame:function(c){var b=this.get("content");var a=((b&&b.get)?b.get("length"):0)||0;return{start:0,length:a}},layoutGroupView:function(c,a,b,d){},layoutItemView:function(a,c,b){},layoutResize:function(){if(!this._hasChildren){return}var g=this.get("nowShowingRange");var c=this.get("groupBy");var b=undefined;var e=this.get("content")||[];var a=SC.maxRange(g);while(--a>=g.start){var j=e.objectAt(a);var d=this.itemViewForContent(j);if(!d){continue}if(c&&((curGroupValue=(j)?j.get(c):null)!==b)){b=curGroupValue;var h=this.groupViewForGroupValue(b);if(h){this.layoutGroupView(h,b,a,false)}}this.layoutItemView(d,a,false)}},_itemViews:null,_groupViews:null,_visibleContentRange:null,_itemViewsByContent:null,_groupViewsByValue:null,_groupViewCounts:null,_itemViewPool:null,_groupViewPool:null,_zombieGroupViews:null,_insertItemViewFor:function(e,k,d){var j=SC.guidFor(e);var g=this._itemViewsByContent[j];var h=false;if(!g){g=this._itemViewPool.pop()||this.get("exampleView").create({owner:this,displayDelegate:this});g.addClassName("sc-collection-item");g.set("content",e);this._itemViewsByContent[j]=g;this._itemViewsByGuid[SC.guidFor(g)]=g;h=true}if(!g){throw"Could not create itemView for content: %@".fmt(e)}var a=!!(k&&e);var b=(a)?e.get(k):null;var l=(a)?this._insertGroupViewFor(b,d):this;var c=g.get("parentNode");if(c!=l){if(k&&c){if(--this._groupViewCounts[SC.guidFor(c)]<=0){this._removeGroupView(c,b)}}l.appendChild(g);if(k){this._groupViewCounts[SC.guidFor(l)]++}}this.layoutItemView(g,d,h);return g},_removeItemView:function(d,b){var g=null;var a;if(b&&(g=d.get("parentNode"))){if(--this._groupViewCounts[SC.guidFor(g)]>0){g=null}if(g){var e=d.get("content");a=(e)?e.get(b):null}}var e=d.get("content");var c=SC.guidFor(e);delete this._itemViewsByContent[c];delete this._itemViewsByGuid[SC.guidFor(d)];d.removeFromParent();d.set("content",null);this._itemViewPool.push(d);if(g){this._removeGroupView(g,a)}return d},_insertOrRemoveItemViewsInRange:function(h,e,b){if(e==0){return}var d=this.get("content")||[];if(e<0){}else{if(e>0){while(--e>=0){var a=h+e;var g=d.objectAt(a);this._insertItemViewFor(g,b,a)}}}},_insertGroupViewFor:function(a,d){var b=this._groupViewsByValue[a];var c=false;if(!b&&this._zombieGroupViews){b=this._zombieGroupViews[a];if(b){delete this._zombieGroupViews[a];this._groupViewsByValue[a]=b;this._groupViewCounts[SC.guidFor(b)]=0}}if(!b){b=this._groupViewPool.pop()||this.get("exampleGroupView").create({owner:this,displayDelegate:this});b.addClassName("sc-collection-group");if(b.groupValue!==undefined){b.set("groupValue",a)}else{b.set("content",a)}this._groupViewsByValue[a]=b;this._groupViewCounts[SC.guidFor(b)]=0;c=true}if(!b){throw"Could not create a groupView for value: %@".fmt(a)}if(b.get("parentNode")!=this){this.appendChild(b)}this.layoutGroupView(b,a,d,c);return b},_removeGroupView:function(b,a){if(SC.ZOMBIE_GROUPS_ENABLED){this._zombieGroupViews[a]=b}else{this._finalRemoveGroupView(b)}delete this._groupViewsByValue[a];delete this._groupViewCounts[SC.guidFor(b)];return b},_flushZombieGroupViews:function(){if(!SC.ZOMBIE_GROUPS_ENABLED){return}for(var a in this._zombieGroupViews){if(!this._zombieGroupViews.hasOwnProperty(a)){continue}var b=this._zombieGroupViews[a];this._finalRemoveGroupView(b)}this._zombieGroupViews={}},_finalRemoveGroupView:function(a){a.removeFromParent();if(a.groupValue!==undefined){a.set("groupValue",null)}else{a.set("content",null)}this._groupViewPool.push(a);return a},_removeRootElementFromDom:function(){if(!SC.REMOVE_COLLECTION_ROOT_ELEMENT_DURING_RENDER){return}if(this._cachedRootElementParent===undefined){var a=this._cachedRootElementParent=this.rootElement.parentNode;this._cachedRootElementNextSibling=this.rootElement.nextSibling;if(a){a.removeChild(this.rootElement)}}},_restoreRootElementInDom:function(){if(!SC.REMOVE_COLLECTION_ROOT_ELEMENT_DURING_RENDER){return}if(this._cachedRootElementParent){this._cachedRootElementParent.insertBefore(this.rootElement,this._cachedRootElementNextSibling)}this._cachedRootElementParent=this._cachedRootElementNextSibling=null},_indexOfSelectionTop:function(){var e=this.get("content");var g=this.get("selection");if(!e||!g){return -1}var b=e.get("length");var d=b;var a=g.length;while(--a>=0){var c=e.indexOf(g[a]);if((c>=0)&&(c<d)){d=c}}return(d>=b)?-1:d},_indexOfSelectionBottom:function(){var d=this.get("content");var e=this.get("selection");if(!d||!e){return -1}var c=-1;var a=e.length;while(--a>=0){var b=d.indexOf(e[a]);if(b>c){c=b}}return(c<0)?-1:c},selectPreviousItem:function(j,c){if(c==null){c=1}if(j==null){j=false}var g=this.get("content");var b=g.get("length");var h,a,e;if(j){h=this._indexOfSelectionTop();a=this._indexOfSelectionBottom();e=(this._selectionAnchor==null)?h:this._selectionAnchor;this._selectionAnchor=e;if(a>e){a=a-c}else{h=h-c}if(h<0){h=0}if(a<h){a=h}}else{h=this._indexOfSelectionTop()-c;if(h<0){h=0}a=h;e=null}var d=[];while(h<=a){d[d.length]=g.objectAt(h++)}if(d.length>0){this.scrollToContent(d.first());this.selectItems(d)}this._selectionAnchor=e},selectNextItem:function(j,c){if(c==null){c=1}if(j==null){j=false}var g=this.get("content");var b=g.get("length");var h,a,e;if(j){h=this._indexOfSelectionTop();a=this._indexOfSelectionBottom();e=(this._selectionAnchor==null)?h:this._selectionAnchor;this._selectionAnchor=e;if(h<e){h=h+c}else{a=a+c}if(a>=b){a=b-1}if(h>a){h=a}}else{a=this._indexOfSelectionBottom()+c;if(a>=b){a=b-1}h=a;e=null}var d=[];while(h<=a){d[d.length]=g.objectAt(h++)}if(d.length>0){this.scrollToContent(d.first());this.selectItems(d)}this._selectionAnchor=e},scrollToContent:function(a){var d=Array.from(this.get("content"));if(d.indexOf(a)<0){return}var c=this.itemViewForContent(a);if(!c){var d=Array.from(this.get("content"));var e=d.indexOf(a);var b=this.get("groupBy");c=this._insertItemViewFor(a,b,e)}if(c){this.scrollToItemView(c)}},scrollToItemView:function(a){var b=this;while(b&&(b!=SC.window)&&(!b.get("isScrollable"))){b=b.get("parentNode")}if(!b||(b==SC.window)){return}b.scrollToVisible(a)},selectItems:function(a,d){var c=(d)?this.get("selection"):[];var b=[a].concat(c).flatten().uniq();this._selectionAnchor=null;this.set("selection",b)},deselectItems:function(a){a=[a].flatten();var c=this.get("selection")||[];var b=c.map(function(d){return(a.include(d))?null:d});b=b.compact();this.set("selection",b)},deleteSelection:function(){if(!this.get("canDeleteContent")){return NO}var a=Array.from(this.get("selection"));if(!a||a.get("length")===0){return NO}a=this.invokeDelegateMethod(this.delegate,"collectionViewShouldDeleteContent",this,a);a=Array.from(a);if(!a||a.get("length")===0){return YES}this.invokeDelegateMethod(this.delegate,"collectionViewDeleteContent",this,a);return YES},collectionViewDeleteContent:function(b,g){var e=this.get("content");if(!e){return NO}var d=$type(e.destroyObject)===T_FUNCTION;var h=$type(e.removeObject)===T_FUNCTION;if(!d&&!h){return NO}if(e.beginPropertyChanges){e.beginPropertyChanges()}var a=g.get("length");while(--a>=0){var c=g.objectAt(a);(d)?e.destroyObject(c):e.removeObject(c)}if(e.endPropertyChanges){e.endPropertyChanges()}return YES},keyDown:function(a){return this.interpretKeyEvents(a)},keyUp:function(){return true},selectAll:function(a){var b=(this.get("content")||[]).slice();this.selectItems(b,NO);return YES},deleteBackward:function(a){return this.deleteSelection()},deleteForward:function(a){return this.deleteSelection()},moveDown:function(b,a){this.selectNextItem(false,this.get("itemsPerRow")||1);return true},moveUp:function(b,a){this.selectPreviousItem(false,this.get("itemsPerRow")||1);return true},moveLeft:function(b,a){if((this.get("itemsPerRow")||1)>1){this.selectPreviousItem(false,1)}return true},moveRight:function(b,a){if((this.get("itemsPerRow")||1)>1){this.selectNextItem(false,1)}return true},moveDownAndModifySelection:function(b,a){this.selectNextItem(true,this.get("itemsPerRow")||1);return true},moveUpAndModifySelection:function(b,a){this.selectPreviousItem(true,this.get("itemsPerRow")||1);return true},moveLeftAndModifySelection:function(b,a){if((this.get("itemsPerRow")||1)>1){this.selectPreviousItem(true,1)}return true},moveRightAndModifySelection:function(b,a){if((this.get("itemsPerRow")||1)>1){this.selectNextItem(true,1)}return true},mouseDown:function(g){this._mouseDownEvent=g;if(this.useToggleSelection){return true}this._mouseDownAt=this._shouldSelect=this._shouldDeselect=this._shouldReselect=this._refreshSelection=false;var d=this._mouseDownView=this.itemViewForEvent(g);var c=this._mouseDownContent=(d)?d.get("content"):null;this.becomeFirstResponder();if(!d){if(this.get("allowDeselectAll")){this.selectItems([],false)}return true}var e=this.get("selection")||[];var b=e.include(c);var a=g.ctrlKey||g.metaKey;if(d.checkboxView&&(Event.element(g)==el.checkboxView.rootElement)){a=true}this._modifierKeyPressed=a;this._mouseDownAt=Date.now();if(a&&b){this._shouldDeselect=c}else{if(g.shiftKey&&e.get("length")>0){e=this._findSelectionExtendedByShift(e,c);this.selectItems(e)}else{if(!a&&b){this._shouldReselect=c}else{if(this.get("selectOnMouseDown")){this.selectItems(c,a)}else{this._shouldSelect=c}}}}this._previousMouseDownContent=c;return true},mouseUp:function(g){var k=this.get("actOnSelect");var h=this.itemViewForEvent(g);if(this.useToggleSelection){if(!h){return}var j=this.get("selection")||[];var d=(h)?h.get("content"):null;var a=j.include(d);if(a){this.deselectItems([d])}else{this.selectItems([d],true)}}else{var d=(h)?h.get("content"):null;if(this._shouldSelect){this.selectItems(this._shouldSelect,this._modifierKeyPressed)}if(this._shouldDeselect){this.deselectItems(this._shouldDeselect)}if(this._shouldReselect){var b=this.get("contentValueIsEditable");if(b){var c=this.get("selection");b=c&&(c.get("length")===1)&&(c.objectAt(0)===this._shouldReselect)}if(b){var e=this.itemViewForContent(this._shouldReselect);b=e&&(!e.contentHitTest||e.contentHitTest(g));b=(b&&e.beginEditing)?e.beginEditing():NO}if(!b){this.selectItems(this._shouldReselect,false)}}this._cleanupMouseDown()}this._mouseDownEvent=null;if(k){this._action(g,h)}return false},_cleanupMouseDown:function(){this._mouseDownAt=this._shouldDeselect=this._shouldReselect=this._refreshSelection=this._shouldSelect=false;this._mouseDownEvent=this._mouseDownContent=this._mouseDownView=null},mouseMoved:function(b){var a=this.itemViewForEvent(b);if(this._lastHoveredItem&&((a===null)||(a!=this._lastHoveredItem))&&this._lastHoveredItem.mouseOut){this._lastHoveredItem.mouseOut(b)}this._lastHoveredItem=a;if(a&&a.mouseOver){a.mouseOver(b)}},mouseOut:function(b){var a=this._lastHoveredItem;this._lastHoveredItem=null;if(a&&a.didMouseOut){a.didMouseOut(b)}},doubleClick:function(b){var a=this.itemViewForEvent(b);if(a){this._action(a,b);return true}else{return false}},_findSelectionExtendedByShift:function(j,b){var a=this.get("content");var e=0;var d=(a.get("length")-1);var k=a.indexOf(j.first());var h=a.indexOf(j.last());var g=a.indexOf(this._previousMouseDownContent);if(g==-1){g=k}var c=a.indexOf(b);if(c==-1){throw"Unable to extend selection to an item that's not in the content array!"}if(c<k){k=c}if(c>h){h=c}if((c>k)&&(c<h)){if(c===g){k=c;h=c}else{if(c>g){k=g;h=c}else{if(c<g){k=c;h=g}}}}h++;return a.slice(k,h)},insertNewline:function(){if(this.get("contentValueIsEditable")){var b=this.get("selection");if(b&&b.get("length")===1){var a=this.itemViewForContent(b.objectAt(0));if(a&&a.beginEditing){this.scrollToItemView(a);a.beginEditing()}}}else{var b=this.get("selection");var a=(b&&b.get("length")===1)?this.itemViewForContent(b.objectAt(0)):null;this._action(a,null)}return YES},didBecomeFirstResponder:function(){this.addClassName("focus")},willLoseFirstResponder:function(){this.removeClassName("focus")},reorderDataType:function(){if(!this._reorderDataTypeKey){this._reorderDataTypeKey="SC.CollectionView.Reorder.%@".fmt(SC.guidFor(this))}return this._reorderDataTypeKey}.property(),_reorderDataType:function(){return this.get("reorderDataType")},dragContent:null,proposedInsertionIndex:null,proposedDropOperation:null,mouseDragged:function(d){if(this._mouseDownEvent===null){return YES}if((Date.now()-this._mouseDownAt)<123){return YES}if(this.invokeDelegateMethod(this.delegate,"collectionViewShouldBeginDrag",this)){var c=this.get("content")||[];var b;if(!this.get("selectOnMouseDown")){b=[this._mouseDownContent]}else{b=this.get("selection").sort(function(g,e){g=c.indexOf(g);e=c.indexOf(e);return(g<e)?-1:((g>e)?1:0)})}this.set("dragContent",b);if(this.get("dragDataTypes").get("length")>0){var a=this.ghostViewFor(b);SC.Drag.start({event:this._mouseDownEvent,source:this,dragView:a,ghost:NO,slideBack:YES,dataSource:this});this._cleanupMouseDown();this._lastInsertionIndex=null}else{this.set("dragContent",null)}return YES}},dragDataTypes:function(){var b=this.invokeDelegateMethod(this.delegate,"collectionViewDragDataTypes",this);var a=this.get("canReorderContent");if((!b||b.get("length")===0)&&!a){return[]}if(a){b=(b)?b.slice():[];var c=this.get("reorderDataType");if(b.indexOf(c)<0){b.push(c)}}return b}.property(),dragDataForType:function(a,b){if(this.get("canReorderContent")){if(a===this.get("reorderDataType")){return this.get("dragContent")}}return this.invokeDelegateMethod(this.delegate,"collectionViewDragDataForType",this,a,b)},dragEntered:function(c,a){var d=SC.DRAG_NONE;if(this.get("canReorderContent")){var b=c.get("dataTypes");if(b.indexOf(this.get("reorderDataType"))>=0){d=SC.DRAG_REORDER}}d=this.invokeDelegateMethod(this.delegate,"collectionViewValidateDrop",this,c,SC.DROP_ANY,-1,d);if(d===SC.DRAG_REORDER){d=SC.DRAG_MOVE}return d},_computeDropOperationState:function(c,m){var e=c.get("location");e=this.convertFrameFromView(e,null);var k=SC.DROP_BEFORE;var d=SC.DRAG_NONE;var l=this.insertionIndexForLocation(e,SC.DROP_ON);if($type(l)===T_ARRAY){k=l[1];l=l[0]}if(k===SC.DROP_ON){this.set("proposedInsertionIndex",l);this.set("proposedDropOperation",k);d=this.invokeDelegateMethod(this.delegate,"collectionViewValidateDrop",this,c,k,l,d);l=this.get("proposedInsertionIndex");k=this.get("proposedDropOperation");this._dropInsertionIndex=this._dropOperation=null;if(d!==SC.DRAG_NONE){return[l,k,d]}else{k=SC.DROP_BEFORE;l=this.insertionIndexForLocation(e,SC.DROP_BEFORE);if($type(l)===T_ARRAY){k=l[1];l=l[0]}}}if((l>=0)&&this.get("canReorderContent")&&(k===SC.DROP_BEFORE)){var o=c.dataForType(this.get("reorderDataType"));if(o){var g=this.get("content")||[];var j=(l>0)?g.objectAt(l-1):null;var a=(l<g.get("length"))?g.objectAt(l):null;var b=(j)?o.indexOf(j)>=0:NO;var h=(a)?o.indexOf(a)>=0:NO;if(b&&h){if(this._lastInsertionIndex==null){while((l>=0)&&(o.indexOf(g.objectAt(l))>=0)){l--}}else{l=this._lastInsertionIndex}}if(l>=0){d=SC.DRAG_REORDER}}}this.set("proposedInsertionIndex",l);this.set("proposedDropOperation",k);d=this.invokeDelegateMethod(this.delegate,"collectionViewValidateDrop",this,c,k,l,d);l=this.get("proposedInsertionIndex");k=this.get("proposedDropOperation");this._dropInsertionIndex=this._dropOperation=null;return[l,k,d]},dragUpdated:function(g,b){var h=this._computeDropOperationState(g,b);var a=h[0],c=h[1],e=h[2];if(e!==SC.DRAG_NONE){if((this._lastInsertionIndex!==a)||(this._lastDropOperation!==c)){var d=this.itemViewForContent(this.get("content").objectAt(a));this.showInsertionPoint(d,c)}this._lastInsertionIndex=a;this._lastDropOperation=c}else{this.hideInsertionPoint();this._lastInsertionIndex=this._lastDropOperation=null}return(e===SC.DRAG_REORDER)?SC.DRAG_MOVE:e},dragExited:function(){this.hideInsertionPoint();this._lastInsertionIndex=this._lastDropOperation=null},dragEnded:function(){this.hideInsertionPoint();this._lastInsertionIndex=this._lastDropOperation=null},prepareForDragOperation:function(b,a){return YES},performDragOperation:function(g,e){var a=this._computeDropOperationState(e,null,g);var l=a[0],k=a[1],h=a[2];if(h===SC.DRAG_REORDER){g=(g&SC.DRAG_MOVE)?SC.DRAG_REORDER:SC.DRAG_NONE}else{g=g&h}if(g===SC.DRAG_NONE){return g}var c=this.invokeDelegateMethod(this.delegate,"collectionViewAcceptDrop",this,e,k,l,g);if((c===SC.DRAG_NONE)&&(g===SC.DRAG_REORDER)){var o=e.dataForType(this.get("reorderDataType"));if(!o){return SC.DRAG_NONE}var j=this.get("content");j.beginPropertyChanges();var m=o.get("length");while(--m>=0){var d=o.objectAt(m);var b=j.indexOf(d);if(b>=0){j.removeAt(b)}if((b>=0)&&(b<l)){l--}}j.replace(l,0,o);j.endPropertyChanges();g=SC.DRAG_MOVE}return g},collectionViewShouldBeginDrag:function(a){return this.get("canReorderContent")},concludeDragOperation:function(b,a){this.hideInsertionPoint();this._lastInsertionIndex=null},insertionOrientation:SC.HORIZONTAL_ORIENTATION,insertionIndexForLocation:function(c,h){var g=this.get("content");var d,j,k,b=null;var a=this.get("insertionOrientation");var e=null;for(var l=0;((e==null)&&(l<g.length));l++){j=this.itemViewForContent(g.objectAt(l));d=this.convertFrameFromView(j.get("frame"),j);if(a==SC.HORIZONTAL_ORIENTATION){if(SC.maxY(d)>c.y){k=(SC.maxX(d)<c.x)?-1:1}else{k=null}}else{if(SC.minX(d)<c.x){k=(SC.maxY(d)<c.y)?-1:1}else{k=null}}if(k!==null){if((b!==null)&&(k!=b)){e=l;if(a==SC.HORIZONTAL_ORIENTATION){if(SC.midX(d)<c.x){e++}}else{if(SC.midY(d)<c.y){e++}}}b=k}}if((e==null)||(e<0)){e=0}if(e>g.length){e=g.length}return e},showInsertionPoint:function(a,b){return(b===SC.DROP_BEFORE)?this.showInsertionPointBefore(a):this.hideInsertionPoint()},showInsertionPointBefore:function(a){},hideInsertionPoint:function(){},ghostViewFor:function(h){var m=SC.View.create();m.setStyle({position:"absolute",overflow:"hidden"});var j=this.convertFrameToView(this.get("frame"),null);m.set("frame",j);var o=h.length;var c=0;var a=0;var e=100000;var d=100000;while(--o>=0){var l=this.itemViewForContent(h[o]);if(!l){continue}var k=l.get("frame");k=this.convertFrameFromView(k,l);var g=l.rootElement;if(!g){continue}if(SC.maxX(k)>c){c=SC.maxX(k)}if(SC.maxY(k)>a){a=SC.maxY(k)}if(SC.minX(k)<e){e=SC.minX(k)}if(SC.minY(k)<d){d=SC.minY(k)}g=g.cloneNode(true);Element.setStyle(g,{position:"absolute",left:"%@px".fmt(k.x),top:"%@px".fmt(k.y),width:"%@px".fmt(k.width),height:"%@px".fmt(k.height)});m.rootElement.appendChild(g)}var b=SC.View.create();b.setStyle({position:"absolute",overflow:"hidden"});b.set("frame",{x:j.x+e,y:j.y+d,width:(c-e+1),height:(a-d+1)});b.appendChild(m);m.set("frame",{x:0-e,y:0-d});return b},init:function(){this._itemViewsByContent={};this._groupViewsByValue={};this._groupViewCounts={};this._zombieGroupViews={};this._itemViewsByGuid={};this._itemViewPool=[];this._groupViewPool=[];arguments.callee.base.apply(this,arguments);this._dropTargetObserver()},_action:function(b,a){var c=this.get("action");var d=this.get("target")||null;if(c){if($type(c)==T_FUNCTION){return this.action(b,a)}SC.app.sendAction(c,d,this)}else{if(!b){return}else{if($type(b._action)==T_FUNCTION){return b._action(a)}else{if($type(b.action)==T_FUNCTION){return b.action(a)}}}}},_dropTargetObserver:function(){var a=this.get("canReorderContent")||this.get("isDropTarget");if(a){SC.Drag.addDropTarget(this)}else{SC.Drag.removeDropTarget(this)}}.observes("canReorderContent","isDropTarget"),_contentObserver:function(){var c=this.get("content");if(SC.isEqual(c,this._content)){return}if(!this._boundContentPropertyObserver){this._boundContentPropertyObserver=this._contentPropertyObserver.bind(this)}var b=this._boundContentPropertyObserver;if(this._content){this._content.removeObserver("[]",b)}if(c){c.addObserver("[]",b)}this._content=c;this._contentPropertyRevision=null;var a=(c)?c.propertyRevision:-1;this._contentPropertyObserver(this,"[]",c,a)}.observes("content"),_selectionObserver:function(){var c=this.get("selection");if(SC.isEqual(c,this._selection)){return}if(!this._boundSelectionPropertyObserver){this._boundSelectionPropertyObserver=this._selectionPropertyObserver.bind(this)}var b=this._boundSelectionPropertyObserver;if(this._selection){this._selection.removeObserver("[]",b)}if(c){c.addObserver("[]",b)}this._selection=c;this._selectionPropertyRevision=null;var a=(c)?c.propertyRevision:null;this._selectionPropertyObserver(this,"[]",c,a)}.observes("selection"),_contentPropertyObserver:function(d,b,c,a){if(!this._updatingContent&&(!a||(a!=this._contentPropertyRevision))){this._contentPropertyRevision=a;this._updatingContent=true;this._hasChildren=false;this.updateChildren(true);this._updatingContent=false}},_selectionPropertyObserver:function(d,b,c,a){if(!this._updatingSel&&(!a||(a!=this._selectionPropertyRevision))){this._selectionPropertyRevision=a;this._updatingSel=true;this._selectionHash=null;this.updateSelectionStates();this._updatingSel=false}},_isVisibleInWindowObserver:function(){if(this.get("isDirty")){this.updateChildren()}}.observes("isVisibleInWindow"),allowDeselectAll:true,itemExistsInCollection:function(a){return this.hasItemView(a)},viewForContentRecord:function(a){return this.itemViewForContent(a)}});require("views/collection/collection");require("views/label");SC.TableView=SC.CollectionView.extend({emptyElement:'<div class="sc-table-view"></div>',rowHeight:20,exampleView:SC.LabelView,insertionOrientation:SC.VERTICAL_ORIENTATION,contentRangeInFrame:function(e){var d=this.get("rowHeight")||0;var c=Math.max(0,Math.floor(SC.minY(e)/d)-1);var a=Math.ceil(SC.maxY(e)/d);var b={start:c,length:a-c};return b},layoutItemView:function(a,g,e){SC.Benchmark.start("SC.TableView.layoutItemViewsFor");var c=this.get("rowHeight")||0;var b=a.get("parentView");var d={x:0,y:g*c,height:c,width:(b||this).get("innerFrame").width};if(e||!SC.rectsEqual(a.get("frame"),d)){a.set("frame",d)}SC.Benchmark.end("SC.TableView.layoutItemViewsFor")},computeFrame:function(){var c=this.get("content");var e=(c)?c.get("length"):0;var b=this.get("rowHeight")||20;var a=this.get("parentNode");var d=(a)?a.get("innerFrame"):{width:100,height:100};d.x=d.y=0;d.height=Math.max(d.height,e*b);return d},insertionPointClass:SC.View.extend({emptyElement:'<div class="list-insertion-point"><span class="anchor"></span></div>'}),showInsertionPointBefore:function(b){if(!b){return}if(!this._insertionPointView){this._insertionPointView=this.insertionPointClass.create()}var a=this._insertionPointView;f={height:0,x:8,y:b.get("frame").y,width:b.owner.get("frame").width};a.set("frame",f);if(a.parentNode!=b.parentNode){b.parentNode.appendChild(a)}},hideInsertionPoint:function(){var a=this._insertionPointView;if(a){a.removeFromParent()}},insertionIndexForLocation:function(d){var c=this.get("innerFrame");var b=this.get("scrollFrame");var a=Math.floor(((d.y-c.y-b.y)/this.get("rowHeight"))+0.4);return a}});require("views/view");require("views/label");require("mixins/control");SC.TOGGLE_BEHAVIOR="toggle";SC.PUSH_BEHAVIOR="push";SC.TOGGLE_ON_BEHAVIOR="on";SC.TOGGLE_OFF_BEHAVIOR="off";SC.ButtonView=SC.View.extend(SC.Control,{emptyElement:'<a href="javascript:;" class="sc-button-view regular"><span class="button-inner"><span class="label"></span></span></a>',value:false,toggleOnValue:true,toggleOffValue:false,theme:"regular",buttonBehavior:SC.PUSH_BEHAVIOR,isEnabled:YES,isSelected:NO,isDefault:NO,isDefaultBindingDefault:SC.Binding.OneWayBool,isCancel:NO,isCancelBindingDefault:SC.Binding.OneWayBool,localize:NO,titleSelector:".label",title:function(b,d){if(d!==undefined){if(this._title!=d){var e=this._title=d;var a=this.get("titleSelector");var c=(a)?this.$sel(a):this.rootElement;if(this.get("localize")){e=e.loc()}c.innerHTML=e}}if(!this._title){var c=this.$sel(this.get("titleSelector"));this._title=(c)?c.innerHTML:""}return this._title}.property(),href:function(a,c){var b=this.rootElement;if(c!==undefined){if(b){b.setAttribute("href",c)}}return(b)?b.getAttribute("href"):null}.property(),action:null,target:null,keyEquivalent:null,_defaultKeyEquivalent:null,performKeyEquivalent:function(b,a){if(!this.get("isEnabled")){return false}var c=this.get("keyEquivalent");if(c&&(c==b)){return this.triggerAction(a)}return false},triggerAction:function(a){if(!this.get("isEnabled")){return false}this.setClassName("active",true);this.didTriggerAction();this._action(a);this.invokeLater("setClassName",200,"active",false);return true},didTriggerAction:function(){},init:function(){arguments.callee.base.call(this);if(this.get("keyEquivalent")){this._defaultKeyEquivalent=this.get("keyEquivalent")}this._isDefaultOrCancelObserver();var a;var b=this.get("titleSelector");if(this.get("localize")&&b&&(a=this.$sel(b))){this._title=(a.innerHTML||"").strip();a.innerHTML=this._title.loc()}},_selectedStateFromValue:function(c){var a=this.get("toggleOnValue");var b;if($type(c)==T_ARRAY){if(c.length==1){b=(c[0]==a)}else{b=(c.indexOf(a)>=0)?SC.MIXED_STATE:false}}else{b=(c==a)}return b},propertyObserver:function(j,h,a,d){if(h!=this){return}switch(a){case"value":d=this.get("value");if(d==this._value){return}this._value=d;var c=this._selectedStateFromValue(d);this.setIfChanged("isSelected",c);break;case"isSelected":var g=this.get("isSelected");var e=this._selectedStateFromValue(this.get("value"));if(e!=g){var b=(g)?"toggleOnValue":"toggleOffValue";this.set("value",this.get(b))}break;default:break}},_isDefaultOrCancelObserver:function(){var a=!!this.get("isDefault");var b=!a&&this.get("isCancel");if(this.didChangeFor("defaultCancelChanged","isDefault","isCancel")){this.setClassName("def",a);if(a){this.setIfChanged("keyEquivalent","return")}else{if(b){this.setIfChanged("keyEquivalent","escape")}else{this.set("keyEquivalent",this._defaultKeyEquivalent)}}}}.observes("isDefault","isCancel"),isMouseDown:false,mouseDown:function(a){this.setClassName("active",this.get("isEnabled"));this._isMouseDown=true;return true},mouseOut:function(a){this.setClassName("active",false);return true},mouseOver:function(a){this.setClassName("active",this._isMouseDown);return true},mouseUp:function(b){this.setClassName("active",false);this._isMouseDown=false;var c=Event.element(b);var a=false;while(c&&(c!=this.rootElement)){c=c.parentNode}if(c==this.rootElement){a=true}if(a&&this.get("isEnabled")){this._action(b)}return true},_action:function(a){switch(this.get("buttonBehavior")){case SC.TOGGLE_BEHAVIOR:var c=this.get("isSelected");if(c==true){this.set("value",this.get("toggleOffValue"))}else{this.set("value",this.get("toggleOnValue"))}break;case SC.TOGGLE_ON_BEHAVIOR:this.set("value",this.get("toggleOnValue"));break;case SC.TOGGLE_OFF_BEHAVIOR:this.set("value",this.get("toggleOffValue"));break;default:var b=this.get("action");var d=this.get("target")||null;if(b){if(this._hasLegacyActionHandler()){this._triggerLegacyActionHandler(a)}else{SC.app.sendAction(b,d,this)}}}},_hasLegacyActionHandler:function(){var a=this.get("action");if(a&&($type(a)==T_FUNCTION)){return true}if(a&&($type(a)==T_STRING)&&(a.indexOf(".")!=-1)){return true}return false},_triggerLegacyActionHandler:function(evt){if(!this._hasLegacyActionHandler()){return false}var action=this.get("action");if($type(action)==T_FUNCTION){this.action(evt)}if($type(action)==T_STRING){eval("this.action = function(e) { return "+action+"(this, e); };");this.action(evt)}}});require("views/button/button");SC.DisclosureView=SC.ButtonView.extend({emptyElement:'<a href="javascript:;" class="sc-disclosure-view sc-button-view button disclosure"><img src="%@" class="button" /><span class="label"></span></a>'.fmt("/beta/sproutcore/en/702d7e042eec94e801ded1c7a09dabe677868b3e/blank.gif"),buttonBehavior:SC.TOGGLE_BEHAVIOR,toggleOnValue:YES,toggleOffValue:NO,valueBindingDefault:SC.Binding.Bool,init:function(){arguments.callee.base.apply(this,arguments);if(this.get("value")==this.get("toggleOnValue")){this.set("isSelected",true)}}});require("panes/overlay");SC.DIALOG_PANE="dialog";SC.DialogPaneView=SC.OverlayPaneView.extend({emptyElement:'<div class="pane dialog-pane"><div class="shadow pane-wrapper"><div class="pane-root"></div><div class="top-left-edge"></div><div class="top-edge"></div><div class="top-right-edge"></div><div class="right-edge"></div><div class="bottom-right-edge"></div><div class="bottom-edge"></div><div class="bottom-left-edge"></div><div class="left-edge"></div></div></div>',layer:200});require("core");require("foundation/object");SC.Timer=SC.Object.extend({target:null,action:null,interval:0,startTime:null,repeats:NO,until:null,isPaused:NO,isScheduled:NO,isValid:function(){return !this._invalid}.property("isPaused"),fireTime:null,invalidate:function(){this.propertyWillChange("isValid");this._invalid=YES;SC.runLoop.cancelTimer(this);this.propertyDidChange("isValid");this.action=this.target=null;return this},fire:function(){var a=this._computeNextFireTime();if(!this.get("isPaused")){this.performAction()}(a>0)?this.schedule():this.invalidate()},performAction:function(){if($type(this.action)==T_FUNCTION){this.action.call((this.target||this),this)}else{if(this.action.indexOf(".")>=0){var d=this.action.split(".");var b=d.pop();var c=SC.Object.objectForPropertyPath(d,window);var a=(c.get)?c.get(b):c[b];if(a&&$type(a)==T_FUNCTION){a.call(c,this)}else{throw"%@: Timer could not find a function at %@".fmt(this,this.action)}}else{SC.app.sendAction(this.action,this.target,this)}}},schedule:function(){this.beginPropertyChanges();if(!this.startTime){this.set("startTime",SC.runLoop.get("startTime"))}var a=(this.fireTime)?this.get("fireTime"):this._computeNextFireTime();if(!this._invalid){this.set("isScheduled",YES);SC.runLoop.scheduleTimer(this,a)}this.endPropertyChanges();return this},init:function(){arguments.callee.base.call(this);if(this.startTime instanceof Date){this.startTime=this.startTime.getTime()}if(this.until instanceof Date){this.until=this.until.getTime()}},_isPausedObserver:function(){SC.runLoop.timerPausedStateDidChange(this)}.observes("isPaused"),_computeNextFireTime:function(){var g=0;if(!this._invalid&&this.get("isValid")){var c=Date.now();var h=this.get("startTime")||c;var e=this.get("until");if((!e)||(e===0)||(c<e)){var b=this.get("interval");var a=this.get("repeats");var d=Math.ceil(((c-h)/b)+0.01);if(d<1){d=1}g=((d<=1)||a)?h+(d*b):0}}this.setIfChanged("fireTime",g);return g}});SC.Timer.schedule=function(a){return this.create(a).schedule()};require("views/collection/collection");require("views/label");SC.GridView=SC.CollectionView.extend({emptyElement:'<div class="grid-view"></div>',rowHeight:48,columnWidth:64,exampleView:SC.LabelView,insertionOrientation:SC.HORIZONTAL_ORIENTATION,itemsPerRow:function(){var a=this._computeItemsPerRow();return a}.property(),_computeItemsPerRow:function(){var b=this.get("innerFrame");var a=this.get("columnWidth")||0;return(a<=0)?1:Math.floor(b.width/a)},contentRangeInFrame:function(g){var e=this.get("rowHeight")||48;var b=this._computeItemsPerRow();var d=Math.floor(SC.minY(g)/e)*b;var a=Math.ceil(SC.maxY(g)/e)*b;var c={start:d,length:a-d};return c},layoutItemView:function(g,d,j){SC.Benchmark.start("SC.GridView.layoutItemViewsFor");var a=this.get("rowHeight")||0;var l=g.get("parentView");var k=this.get("innerFrame").width;var h=this._computeItemsPerRow();var b=Math.floor(k/h);var m=Math.floor(d/h);var c=d-(h*m);var e={x:c*b,y:m*a,height:a,width:b};if(j||!SC.rectsEqual(g.get("frame"),e)){g.set("frame",e)}SC.Benchmark.end("SC.GridView.layoutItemViewsFor")},layoutItemViewsFor:function(l,h){SC.Benchmark.start("SC.GridView.layoutItemViewsFor");var a=this.get("rowHeight");var b=this.get("columnWidth");if((a==null)||(b==null)){return false}l=l||this;var d=l.get("innerFrame");d.x=d.y=0;var g=Math.floor(d.width/(b||1));if(this.get("itemsPerRow")!=g){this.set("itemsPerRow",g)}b=Math.floor((d.width-20)/g);var j=h||l.firstChild;var e=this.get("content")||[];var k=(j)?e.indexOf(j.get("content")):0;d={x:0,y:0,height:a,width:b};while(j){var m=Math.floor(k/g);var c=k-(m*g);d.x=c*b;d.y=m*a;if(!SC.rectsEqual(j.get("frame"),d)){j.set("frame",d)}j=j.nextSibling;k++}SC.Benchmark.end("SC.GridView.layoutItemViewsFor");return true},computeFrame:function(){var e=this.get("content");var d=(e)?e.get("length"):0;var c=this.get("rowHeight")||0;var j=this.get("columnWidth")||0;var b=this.get("parentNode");var h=(b)?b.get("innerFrame"):{width:0,height:0};var a=(j<=0)?1:(h.width/j);var g=Math.ceil(d/a);h.x=h.y=0;h.height=Math.max(h.height,g*c);return h},insertionPointClass:SC.View.extend({emptyElement:'<div class="grid-insertion-point"><span class="anchor"></span></div>'}),showInsertionPoint:function(c,d){if(!c){return}if(d===SC.DROP_ON){if(c!==this._dropOnInsertionPoint){this.hideInsertionPoint();c.addClassName("drop-target");this._dropOnInsertionPoint=c}}else{if(this._dropOnInsertionPoint){this._dropOnInsertionPoint.removeClassName("drop-target");this._dropOnInsertionPoint=null}if(!this._insertionPointView){this._insertionPointView=this.insertionPointClass.create()}var b=this._insertionPointView;var a=c.get("frame");f={height:a.height-6,x:a.x,y:a.y+6,width:0};if(!SC.rectsEqual(b.get("frame"),f)){b.set("frame",f)}if(b.parentNode!=c.parentNode){c.parentNode.appendChild(b)}}},hideInsertionPoint:function(){var a=this._insertionPointView;if(a){a.removeFromParent()}if(this._dropOnInsertionPoint){this._dropOnInsertionPoint.removeClassName("drop-target");this._dropOnInsertionPoint=null}},insertionIndexForLocation:function(d,k){var e=this.get("frame");var g=this.get("scrollFrame");var l=this._computeItemsPerRow();var a=Math.floor(e.width/l);var o=Math.floor((d.y-e.y-g.y)/this.get("rowHeight"));var j=SC.DROP_BEFORE;var c=(d.x-e.x-g.x);var b=Math.floor(c/a);var m=(c/a)-b;if(k===SC.DROP_ON){if(m>0.8){b++}if((m>=0.2)&&(m<=0.8)){j=SC.DROP_ON}}else{if(m>0.45){b++}}var h=(o*l)+b;return[h,j]}});SC.SelectionSupport={updateSelectionAfterContentChange:function(){var e=Array.from(this.get("arrangedObjects"));var c=Array.from(this.get("selection"));var d=[];var b=c.get("length");if(this.get("allowsSelection")){for(var a=0;a<b;a++){var g=c.objectAt(a);if(e.indexOf(g)>=0){d.push(g)}}}var h=d.get("length");if((h>1)&&!this.get("allowsMultipleSelection")){d=[d.objectAt(0)]}if((h==0)&&!this.get("allowsEmptySelection")){if(e.get("length")>0){d=[e.objectAt(0)]}}this.set("selection",d)},arrangedObjects:function(){return this}.property(),selection:function(c,e){if(e!==undefined){e=Array.from(e);var b=this.get("allowsSelection");var g=this.get("allowsEmptySelection");var a=this.get("allowsMultipleSelection");if(!b){return this._selection}switch(e.get("length")){case 0:if(!g){var d=this.get("arrangedObjects");if(d.get("length")>0){e=[d.objectAt(0)]}}this._selection=e;break;case 1:this._selection=e;break;default:this._selection=a?e:this._selection;break}}return this._selection}.property(),allowsSelection:true,allowsMultipleSelection:true,allowsEmptySelection:true,hasSelection:function(){var a=this.get("selection");return !!a&&(a.get("length")>0)}.property("selection")};require("foundation/object");SC.Controller=SC.Object.extend({hasChanges:false,context:null,commitChangesImmediately:true,init:function(){arguments.callee.base.apply(this,arguments);this._contextObserver()},_contextObserver:function(){if(this.context){this.commitChangesImmediately=this.context.commitChangesImmediately}}.observes("context"),commitChanges:function(){this._commitTimeout=null;var a=this._canCommitChanges();if(!$ok(a)){return a}return this._performCommitChanges()},discardChanges:function(){var a=this._canDiscardChanges();if(!$ok(a)){return a}return this._performDiscardChanges()},controllerForValue:function(b){var a=null;switch($type(b)){case T_OBJECT:if(b.kindOf(SC.Collection)){a=SC.CollectionController}else{a=SC.ObjectController}break;case T_ARRAY:a=SC.ArrayController;break;default:a=null}return(a)?a.create({content:b,context:this}):b},editorDidChange:function(a){if(!a){a=this}if(a!=this){if(!this._dirtyEditors){this._dirtyEditors=SC.Set.create()}this._dirtyEditors.add(a)}else{this._hasLocalChanges=true}if(!this.get("hasChanges")){this.set("hasChanges",true);if(this.context){this.context.editorDidChange(this)}else{if(this.get("commitChangesImmediately")){if(!this._commitTimeout){this._commitTimeout=this.commitChanges.bind(this).defer()}}}}},editorDidClearChanges:function(b){if(!b){b=this}if(b!=this){if(this._clearingChanges){return}if(this._dirtyEditors){this._dirtyEditors.remove(b)}}else{this._hasLocalChanges=false}var a=!!(this._hasLocalChanges||(this._dirtyEditors&&this._dirtyEditors.length>0));if(this.get("hasChanges")!=a){this.set("hasChanges",a);if(this.context){this.context.editorDidClearChanges(b)}}},canCommitChanges:function(){return true},performCommitChanges:function(){return $error("performCommitChanges is not implemented")},canDiscardChanges:function(){return true},performDiscardChanges:function(){return $error("performDiscardChanges is not implemented")},_canCommitChanges:function(){if(!this.get("hasChanges")){return false}var a=true;if(this._dirtyEditors){a=this._dirtyEditors.invokeWhile(true,"_canCommitChanges");if(!$ok(a)){return a}}return this.canCommitChanges()},_performCommitChanges:function(){if(!this.get("hasChanges")){return true}var a=true;if(this._dirtyEditors){this._clearingChanges=true;a=this._dirtyEditors.invokeWhile(true,"_performCommitChanges");this._clearingChanges=false;if($ok(a)){this._dirtyEditors=null}else{return a}}a=this.performCommitChanges();if($ok(a)){this.editorDidClearChanges()}return a},_canDiscardChanges:function(){if(!this.get("hasChanges")){return false}var a=true;if(this._dirtyEditors){a=this._dirtyEditors.invokeWhile(true,"_canDiscardChanges");if(!$ok(a)){return a}}return this.canDiscardChanges()},_performDiscardChanges:function(){if(!this.get("hasChanges")){return true}var a=true;if(this._dirtyEditors){this._clearingChanges=true;a=this._dirtyEditors.invokeWhile(true,"_performDiscardChanges");this._clearingChanges=false;if($ok(a)){this._dirtyEditors=null}else{return a}}a=this.performDiscardChanges();if($ok(a)){this.editorDidClearChanges()}return a}});require("controllers/controller");SC.ObjectController=SC.Controller.extend({content:null,hasNoContent:true,hasSingleContent:false,hasMultipleContent:false,hasContent:function(){return this.get("content")!=null}.property("content"),allowsMultipleContent:true,destroy:function(){var a=this.get("content");if(a&&$type(a.destroy)===T_FUNCTION){a.destroy()}this.set("content",null)},performCommitChanges:function(){var h=this.get("content");var j=true;var d=false;if(this._isArray(h)){var g=this._lengthFor(h);if(g==0){h=null}else{if(g==1){h=this._objectAt(0,h)}else{if(this.get("allowsMultipleContent")){d=true}else{h=null}}}}if(!this._changes){this._changes={}}if(!h){return $error("No Content")}else{if(d){var e=this._lengthFor(h);while(--e>=0){var c=this._objectAt(e,h);if(!c){continue}if(c.beginPropertyChanges){c.beginPropertyChanges()}for(var m in this._changes){if(!this._changes.hasOwnProperty(m)){continue}var l=this._changes[m];if(this._isArray(l)){l=this._objectAt(e,l)}if(c.set){c.set(m,l)}else{c[m]=l}}if(c.endPropertyChanges){c.endPropertyChanges()}if(c.commitChanges){j=c.commitChanges()}}}else{if(h.beginPropertyChanges){h.beginPropertyChanges()}var k=this._changes;for(var m in k){if(!k.hasOwnProperty(m)){continue}var a=h.get?h.get(m):h[m];var b=k[m];if(a==null&&b==""){b=null}if(b!=a){(h.set)?h.set("isDirty",YES):(h.isDirty=YES)}if(h.set){h.set(m,b)}else{h[m]=b}}if(h.endPropertyChanges){h.endPropertyChanges()}if(h.commitChanges){j=h.commitChanges()}}}if($ok(j)){this._changes={};this.editorDidClearChanges()}return j},performDiscardChanges:function(){this._changes={};this._valueControllers={};this.editorDidClearChanges();this.allPropertiesDidChange();return true},unknownProperty:function(a,b){if(a=="content"){if(!(b===undefined)){this[a]=b}return this[a]}else{if(!this._changes){this._changes={}}if(!this._valueControllers){this._valueControllers={}}if(b!==undefined){this._changes[a]=b;if(this._valueControllers[a]){this._valueControllers[a]=null}this.propertyWillChange(a+"Controller");this.propertyDidChange(a+"Controller");this.editorDidChange()}else{if(a.slice(a.length-10,a.length)=="Controller"){a=a.slice(0,-10);if(!this._valueControllers[a]){this._valueControllers[a]=this.controllerForValue(this._getValueForPropertyKey(a))}b=this._valueControllers[a]}else{b=this._getValueForPropertyKey(a)}}return b}},_getValueForPropertyKey:function(c){var e=this._changes[c];if(e!==undefined){return e}var g=this.get("content");if(!g){return null}if(this._isArray(g)){var e=[];var b=this._lengthFor(g);if(b>1){if(this.get("allowsMultipleContent")){for(var a=0;a<b;a++){var d=this._objectAt(a,g);e.push((d)?((d.get)?d.get(c):d[c]):null)}}else{e=null}}else{if(b==1){g=this._objectAt(0,g);e=(g.get)?g.get(c):g[c]}else{e=null}}}else{e=(g.get)?g.get(c):g[c]}return e},_lastPropertyRevision:0,propertyObserver:function(h,g,k,j,a){if(a<=this._lastPropertyRevision){return}this._lastPropertyRevision=a;if(!this._boundObserver){this._boundObserver=this._contentPropertyObserver.bind(this)}if(g!=this){return}if((k=="content")&&(j!=this._content)){var e=this._boundObserver;if(this.get("hasChanges")){var l=this.discardChanges();if(!$ok(l)){throw (l)}}else{this._valueControllers={}}if(this._content){var m=Array.from(this._content);var d=m.length;while(--d>=0){var b=m[d];if(b&&b.removeObserver){b.removeObserver("*",e)}}}this._content=j;if(this._content){var m=Array.from(this._content);var d=m.length;while(--d>=0){var b=m[d];if(b&&b.addObserver){b.addObserver("*",e)}}}var c=0;if(this._content){c=(this._isArray(this._content))?this._lengthFor(this._content):1}this.beginPropertyChanges();this.set("hasNoContent",c==0);this.set("hasSingleContent",c==1);this.set("hasMultipleContent",c>1);this.allPropertiesDidChange();this.endPropertyChanges()}},_contentPropertyObserver:function(c,a,b){this._changeFromContent=true;if(a=="*"){this.allPropertiesDidChange()}else{this.propertyWillChange(a);this.propertyDidChange(a,b)}this._changeFromContent=false},_lengthFor:function(a){return((a.get)?a.get("length"):a.length)||0},_objectAt:function(a,b){return(b.objectAt)?b.objectAt(a):((b.get)?b.get(a):b[a])},_isArray:function(a){return($type(a)==T_ARRAY)||(a&&a.objectAt)}});require("mixins/selection_support");require("controllers/object");SC.CollectionController=SC.ObjectController.extend(SC.SelectionSupport,{arrangedObjects:[],canEditCollection:false,pageSize:0,pageCount:function(){var a=this.get("pageSize");if(a<=0){return 1}var c=this.get("content");var b=(c&&c.get)?c.get("count"):0;if(b===null){b=0}return Math.ceil(b/a)}.property(),currentPage:function(b,c){if(c!==undefined){if(this._currentPage!=c){var a=Math.max(this.get("pageCount")-1,0);if(c>a){c=a}if(c<0){c=0}this._currentPage=c}}return this._currentPage||0}.property(),newObject:function(b){var c=this.get("content");if(!c||!this.get("canEditCollection")){return}try{if(c.newRecord){var g=c.newRecord(b);var a=function(){this.set("selection",(g)?[g]:[]);this._editingNewRecord=g}.invokeLater(this,1);return g}}catch(d){}},addObjects:function(b){var a=this.get("content");if(!a||!this.get("canEditCollection")){return}try{b=SC.$A(arguments).flatten();if(a.addRecords){a.addRecords(b);this.set("selection",(b)?b:[])}}catch(c){}},addSelection:function(){return this.addObjects(this.get("selection"))},removeObjects:function(c){var a=this.get("content");if(!a||!this.get("canEditCollection")){return}try{c=SC.$A(arguments).flatten();if(a.removeRecords){var g=a.removeRecords(c);var b=(this.get("selection")||[]).without(c);this.set("selection",(b)?b:[])}}catch(d){}},removeSelection:function(){return this.removeObjects(this.get("selection"))},newObjectDidLoseFocus:function(a){a.destroy()},_newRecordDidLoseFocus:function(a){if(a.get("newRecord")){this.newObjectDidLoseFocus(a)}},_pageObserver:function(){var g=this.get("content");if(g instanceof Array){g=g[0]}if(!g){return}var h=g.get("offset")||0;var c=g.get("limit")||0;var e=g.get("count")||0;var d=this.get("currentPage");var a=this.get("pageSize");var j,b;if(a==0){j=0;b=0}else{j=d*a;b=a}if((j!=h)||(b!=c)){g.beginPropertyChanges();g.set("offset",j);g.set("limit",b);g.endPropertyChanges()}}.observes("currentPage","pageCount","pageSize"),_recordsObserver:function(d,b,c){var a=this.get("arrangedObjects");c=Array.from(d.get(b));this.set("arrangedObjects",c.slice());this.updateSelectionAfterContentChange()}.observes("records")});require("views/view");require("controllers/collection");require("views/button/button");SC.PaginationView=SC.View.extend({pageSize:0,pageCount:0,currentPage:0,currentPageString:"_%@-%@ of %@",pageOptionString:"_Page %@: %@-%@",hasPreviousPage:function(){return this.get("currentPage")>0}.property(),hasNextPage:function(){return this.get("currentPage")<this.get("pageCount")}.property(),emptyElement:'<div class="pagination">    <button class="prev">«</button>    <button class="page"></button>    <button class="next">»</button>  </div>',outlets:["prevButton","nextButton","pageButton"],prevButton:SC.ButtonView.extend({action:function(){this.owner.decrementProperty("currentPage")},isEnabledBinding:"*owner.hasPreviousPage"})});require("views/view");SC.MenuItemView=SC.ButtonView.extend({emptyElement:['<li class="button menu-item">','<a href="javascript:;">','<span class="sel">&#x2713;</span>','<span class="mixed">-</span>','<span class="inner">','<span class="label"></span>',"</span>",'<span class="shortcut"></span>',"</a>","</li>"].join(""),computedRequiredWidth:function(){var b=0;var c=this.$sel(".inner");if(c){b=c.offsetLeft;b+=parseInt(Element.getStyle(c,"padding-left"),0);b+=parseInt(Element.getStyle(c,"padding-right"),0)}var a=Element.$sel(c,"img");if(a){b+=Element.getDimensions(a).width}c=Element.$sel(c,".label");if(c){b+=Element.getDimensions(c).width}c=this.$sel(".shortcut");if(c){b+=Element.getDimensions(c).width}return b},mouseMoved:function(a){if(!this.get("isDefault")){this.get("parentNode").set("currentSelectedMenuItem",this)}},mouseOut:function(a){this.set("isDefault",false);this.setClassName("active",false)},mouseUp:function(a){arguments.callee.base.apply(this,arguments);this._closeParentMenu()},didTriggerAction:function(){this._closeParentMenu()},_closeParentMenu:function(){var a=this.get("parentNode");if(a){a.set("isVisible",false)}}});require("core");require("foundation/responder");require("panes/pane");SC.CAPTURE_BACKSPACE_KEY=NO;SC.window=SC.PaneView.extend({firstViewForEvent:function(a){var b=Event.element(a);while(b&&(b!=document)&&(!b._configured)){b=b.parentNode}if(b){b=SC.View.findViewForElement(b)}if(b==this){b=null}return b},innerFrame:function(){return this.frame()}.property("frame"),clippingFrame:function(){return this.frame()}.property("frame"),scrollFrame:function(){return this.frame()}.property("frame"),frame:function(){var a=this.get("size");return{x:0,y:0,width:a.width,height:a.height}}.property("size"),size:function(){if(!this._size){if(window.innerHeight){this._size={width:window.innerWidth,height:window.innerHeight}}else{if(document.documentElement&&document.documentElement.clientHeight){this._size={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}else{if(document.body){this._size={width:document.body.clientWidth,height:document.body.clientHeight}}}}}return this._size}.property(),autoresizesChildViews:true,_onresize:function(a){SC.runLoop.beginRunLoop();var c=Object.clone(this.get("size"));this._size=null;var b=this.get("size");if((b.width!=c.width)||(b.height!=c.height)){this.resizeChildrenWithOldSize(c)}SC.runLoop.endRunLoop()},_lastModifiers:null,_handleModifierChanges:function(b){var a=this._lastModifiers=this._lastModifiers||{alt:false,ctrl:false,shift:false};var c=false;if(b.altKey!=a.alt){a.alt=b.altKey;c=true}if(b.ctrlKey!=a.ctrl){a.ctrl=b.ctrlKey;c=true}if(b.shiftKey!=a.shift){a.shift=b.shiftKey;c=true}if(c){b._type="flagsChanged";b._modifiers=a;SC.app.sendEvent(b)}},_onkeydown:function(a){if(SC.Platform.Firefox>0&&(a.which===8)){return true}this._handleModifierChanges(a);if(this._isModifierKey(a)){return false}if(!this._isFunctionOrNonPrintableKey(a)){return true}var b=this._sendEvent("keyDown",a);return b},_onkeypress:function(a){if(SC.Platform.Firefox>0&&(a.which===8)){var b=this._sendEvent("keyDown",a)}else{if(this._isFunctionOrNonPrintableKey(a)){return true}if(a.charCode!=undefined&&a.charCode==0){return true}var b=this._sendEvent("keyDown",a)}return b},_onkeyup:function(a){this._handleModifierChanges(a);if(this._isModifierKey(a)){return}return this._sendEvent("keyUp",a)},_sendEvent:function(b,a){SC.runLoop.beginRunLoop();a._type=b;a._stopWhenHandled=(a._stopWhenHandled!==undefined)?a._stopWhenHandled:true;var d=SC.app.sendEvent(a);var c=true;if(d&&a._stopWhenHandled){Event.stop(a);c=false}SC.runLoop.endRunLoop();return c},_isFunctionOrNonPrintableKey:function(a){return !!(a.altKey||a.ctrlKey||SC.FUNCTION_KEYS[a.keyCode])},_isModifierKey:function(a){return !!SC.MODIFIER_KEYS[a.keyCode]},_mouseDownView:null,_clickCount:0,_lastMouseUpAt:null,dragDidStart:function(a){this._mouseDownView=a},_onmousedown:function(a){SC.runLoop.beginRunLoop();this._onfocus();this._clickCount=this._clickCount+1;if(!this._lastMouseUpAt||((Date.now()-this._lastMouseUpAt)>200)){this._clickCount=1}a.clickCount=this._clickCount;a._type="mouseDown";a._stopWhenHandled=(a._stopWhenHandled!==undefined)?a._stopWhenHandled:true;this._mouseDownView=SC.app.sendEvent(a);var b=true;if(this._mouseDownView&&a._stopWhenHandled){Event.stop(a);b=false;if(this._mouseDownView.mouseDragged&&$type(this._mouseDownView.mouseDragged)==T_FUNCTION){this._mouseCanDrag=true}}SC.runLoop.endRunLoop();return b},_onmouseup:function(a){SC.runLoop.beginRunLoop();var b=null;this._lastMouseUpAt=Date.now();a.clickCount=this._clickCount;if(this._mouseDownView){a._type="mouseUp";b=SC.app.sendEvent(a,this._mouseDownView)}if(!b&&(this._clickCount==2)){a._type="doubleClick";b=SC.app.sendEvent(a,this._mouseDownView)}if(!b){a._type="click";b=SC.app.sendEvent(a,this._mouseDownView)}this._mouseCanDrag=false;this._mouseDownView=null;SC.runLoop.endRunLoop()},_ondblclick:function(a){if(SC.isIE()){this._clickCount=2;this._onmouseup(a)}},_lastHovered:null,_onmousemove:function(c){SC.runLoop.beginRunLoop();this._onfocus();var b=this._lastHovered||[];var e=[];var a=this.firstViewForEvent(c);while(a&&(a!=this)){var g=a.mouseOver||a.didMouseOver||a.mouseEntered;var d=a.mouseMoved||a.mouseDidMove;if(b.include(a)){if(d){d.call(a,c)}e.push(a)}else{if(g){g.call(a,c)}e.push(a)}a=a.get("nextResponder")}for(var j=0;j<b.length;j++){a=b[j];var h=a.mouseOut||a.didMouseOut||a.mouseExited;if(h&&!e.include(a)){h.call(a,c)}}this._lastHovered=e;if(this._mouseDownView&&this._mouseDownView.mouseDragged){this._mouseDownView.mouseDragged(c)}SC.runLoop.endRunLoop()},_onunload:function(){this._listenerCache.each(function(a){Event.stopObserving.apply(Event,a)})},_onfocus:function(){if(!this._hasFocus){this._hasFocus=YES;this.addClassName("focus");this.removeClassName("blur")}},_onblur:function(){if(this._hasFocus){this._hasFocus=NO;this.removeClassName("focus");this.addClassName("blur")}},_mouseCanDrag:true,_onselectstart:function(){if(this._mouseCanDrag){return false}else{return true}},_ondrag:function(){return false},_hasFocus:NO,_EVTS:["mousedown","mouseup","click","dblclick","keydown","keyup","keypress","mouseover","mouseout","mousemove","resize","unload","focus","blur","drag","selectstart"],_listenerCache:[],setup:function(){var a=this;a._EVTS.each(function(g){var b=a["_on"+g];var d=(g!="resize")?document:window;if(b){var c=b.bindAsEventListener(a);if(g==="keypress"&&SC.CAPTURE_BACKSPACE_KEY&&SC.Platform.Firefox>0){document.onkeypress=c}else{if(g==="selectstart"&&SC.Platform.IE>0){document.body.onselectstart=c}else{if(g==="drag"&&SC.Platform.IE>0){document.body.ondrag=c}else{Event.observe(d,g,c)}}}a._listenerCache.push([d,g,c])}});this.get("size");this.set("isVisibleInWindow",true);this._onfocus()}}).viewFor($tag("body"));require("core");require("views/view");SC.DRAG_LINK=4;SC.DRAG_COPY=1;SC.DRAG_MOVE=2;SC.DRAG_NONE=0;SC.DRAG_ANY=7;SC.DRAG_AUTOSCROLL_ZONE_THICKNESS=20;SC.Drag=SC.Object.extend({source:null,ghostView:null,dragView:null,ghost:YES,slideBack:YES,mouseDownEvent:null,ghostOffset:{x:0,y:0},location:null,dataTypes:function(){if(this.dataSource){return this.dataSource.get("dragDataTypes")}if(this.data){var a=[];for(var b in this._data){if(this.data.hasOwnProperty(b)){a.push(b)}}return a}var c=this.get("source");if(c&&c.dragDataTypes){return c.get("dragDataTypes")}return[]}.property(),hasDataType:function(a){var b=this.get("dataTypes")||[];return(b.indexOf(a)>=0)},dataForType:function(a){if(this.dataSource){return this.dataSource.dragDataForType(a,this)}else{if(this.data){return this.data[a]}else{var b=this.get("source");if(b&&$type(b.dragDataForType)==T_FUNCTION){return b.dragDataForType(a,this)}else{return null}}}},dataSource:null,data:null,_dragInProgress:YES,startDrag:function(){this._createGhostView();var a=this.dragView.convertFrameToView(this.dragView.get("frame"),null);var b=Event.pointerLocation(this.event);window.dragEvent=this.event;this.ghostOffset={x:(b.x-a.x),y:(b.y-a.y)};this._positionGhostView(this.event);SC.window.dragDidStart(this);if(this.source&&this.source.dragDidBegin){this.source.dragDidBegin(this,b)}},_lastLoc:{},mouseDragged:function(a){var e=Event.pointerLocation(a);var b=this._autoscroll(a);if(!b&&(e.x==this._lastLoc.x)&&(e.y==this._lastLoc.y)){return}this._lastLoc=e;this.set("location",e);this._positionGhostView(a);var c=this._lastTarget;var d=this._findDropTarget(a);var g=SC.DRAG_NONE;while(d&&(d!=c)&&(g==SC.DRAG_NONE)){if(d&&this.source&&this.source.dragSourceOperationMaskFor){g=this.source.dragSourceOperationMaskFor(d,this)}else{g=SC.DRAG_ANY}if((g!=SC.DRAG_NONE)&&d&&d.dragEntered){g=g&d.dragEntered(this,a)}else{g=SC.DRAG_NONE}if(g==SC.DRAG_NONE){d=this._findNextDropTarget(d)}}if(d!=c){if(c&&c.dragExited){c.dragExited(this,a)}if(d&&this.source&&this.source.dragSourceOperationMaskFor){g=this.source.dragSourceOperationMaskFor(d,this)}else{g=SC.DRAG_ANY}this.sourceDropOperations=g;if(d&&d.dragEntered){this.dropOperations=g&d.dragEntered(this,a)}else{this.dropOperations=SC.DRAG_NONE}if(this.dropOperations==SC.DRAG_NONE){d=null}}else{if(d&&d.dragUpdated){d.dragUpdated(this,a)}}if(this.source&&this.source.dragDidMove){this.source.dragDidMove(this,e)}this._lastTarget=d},mouseUp:function(a){var e=Event.pointerLocation(a);var d=this._lastTarget;var g=this.dropOperations;if(d&&d.prepareForDragOperation(g,this)){g=d.performDragOperation(g,this)}else{g=SC.DRAG_NONE}var b=this;var c=function(){if(d){d.concludeDragOperation(g,this)}b._destroyGhostView()};if(d&&d.dragEnded){d.dragEnded(this,a)}this._lastTarget=null;if((g==SC.DRAG_NONE)&&this.get("slideBack")){var e=this.dragView.convertFrameToView(this.dragView.get("origin"),null);this._ghostView.transitionTo(1,"left: %@px; top: %@px".fmt(e.x,e.y),{duration:200,onComplete:c})}else{c()}if(this.source&&this.source.dragDidEnd){this.source.dragDidEnd(this,e,g)}this._dragInProgress=NO},_ghostViewClass:SC.View.extend({emptyElement:'<div class="sc-ghost-view"></div>'}),_positionGhostView:function(a){var b=Event.pointerLocation(a);b.x-=this.ghostOffset.x;b.y-=this.ghostOffset.y;b=this._ghostView.convertFrameFromView(b,null);this._ghostView.set("origin",b)},_createGhostView:function(){var a=this.dragView.rootElement.cloneNode(true);this._ghostView=this._ghostViewClass.viewFor(a);this._ghostView.owner=this;this._ghostView.addClassName("sc-ghost-view");SC.window.appendChild(this._ghostView)},_destroyGhostView:function(){if(this._ghostView){this._ghostView.removeFromParent();this._ghostView=null}},_ghostView:null,_getOrderedDropTargets:function(){if(this._cachedDropTargets){return this._cachedDropTargets}var b=[];var d=SC.Drag._dropTargets;for(var c in d){if(!d.hasOwnProperty(c)){continue}b.push(d[c])}var e={};var a=function(g){if(!g){return 0}var j=SC.guidFor(g);var h=e[j];if(!h){h=1;while((g=g.parentNode)&&(g!==SC.window)){if(d[SC.guidFor(g)]!==undefined){h++}}e[j]=h}return h};b.sort(function(h,g){if(h===g){return 0}h=a(h);g=a(g);return(h>g)?-1:1});this._cachedDropTargets=b;return b},_findDropTarget:function(b){var e=this._getOrderedDropTargets();var h=Event.pointerLocation(b);var c=null;for(var a=0;a<e.length;a++){var d=e[a];if(!d.get("isVisibleInWindow")){continue}var g=d.convertFrameToView(d.get("clippingFrame"),null);if(SC.pointInRect(h,g)){return d}}return null},_findNextDropTarget:function(a){while((a=a.parentNode)&&(a!=SC.window)){if(SC.Drag._dropTargets[a._guid]){return a}}return null},_autoscroll:function(m){if(!this._dragInProgress){return}var g=(m)?Event.pointerLocation(m):this._lastMouseLocation;if(!g){return false}this._lastMouseLocation=g;var j=this._findScrollableView(g);var b,p;var c,k,a;var o=null;while(j&&!o){b=j.get("hasVerticalScroller")?1:0;p=j.get("hasHorizontalScroller")?1:0;if((b!=0)||(p!=0)){var e=j.convertFrameToView(j.get("frame"),null);var h=j.get("innerFrame");var d=j.get("scrollFrame")}if(b!=0){k=SC.maxY(e);c=k-SC.DRAG_AUTOSCROLL_ZONE_THICKNESS;a=SC.maxY(d);if((a>=h.height)&&(g.y>=c)&&(g.y<=k)){b=1}else{c=SC.minY(e);k=c+SC.DRAG_AUTOSCROLL_ZONE_THICKNESS;a=SC.minY(d);if((a<=h.height)&&(g.y>=c)&&(g.y<=k)){b=-1}else{b=0}}}if(p!=0){k=SC.maxX(e);c=k-SC.DRAG_AUTOSCROLL_ZONE_THICKNESS;a=SC.maxX(d);if((a>=h.width)&&(g.x>=c)&&(g.x<=k)){p=1}else{c=SC.minY(e);k=c+SC.DRAG_AUTOSCROLL_ZONE_THICKNESS;a=SC.minY(d);if((a<=h.width)&&(g.x>=c)&&(g.x<=k)){p=-1}else{p=0}}}if((b!=0)||(p!=0)){o=j}else{j=this._findNextScrollableView(j)}}if(o&&(this._lastScrollableView==o)){if((Date.now()-this._hotzoneStartTime)>100){this._horizontalScrollAmount*=1.05;this._verticalScrollAmount*=1.05}}else{this._lastScrollableView=o;this._horizontalScrollAmount=15;this._verticalScrollAmount=15;this._hotzoneStartTime=(o)?Date.now():null;p=b=0}if(o&&((p!=0)||(b!=0))){var l={x:p*this._horizontalScrollAmount,y:b*this._verticalScrollAmount};o.scrollBy(l)}if(o){this.invokeLater("_autoscroll",100,null);return true}else{return false}},_scrollableViews:function(){if(this._cachedScrollableView){return this._cachedScrollableView}var a=[];var c=SC.Drag._scrollableViews;for(var b in c){if(!c.hasOwnProperty(b)){continue}a.push(c[b])}a=a.sort(function(g,d){var e=g;while((e=e.parentNode)&&(e!=SC.window)){if(d==e){return -1}}return 1});this._cachedScrollableView=a;return a},_findScrollableView:function(g){var d=this._scrollableViews();var b=null;for(var a=0;a<d.length;a++){var c=d[a];if(!c.get("isVisibleInWindow")){continue}var e=c.convertFrameToView(c.get("frame"),null);if(SC.pointInRect(g,e)){return c}}return null},_findNextScrollableView:function(a){while((a=a.parentNode)&&(a!=SC.window)){if(SC.Drag._scrollableViews[a._guid]){return a}}return null}});SC.Drag.mixin({start:function(b){var a=this.create(b);a.startDrag();return a},_dropTargets:{},_scrollableViews:{},addScrollableView:function(a){this._scrollableViews[a._guid]=a},removeScrollableView:function(a){delete this._scrollableViews[a._guid]},addDropTarget:function(a){this._dropTargets[a._guid]=a},removeDropTarget:function(a){delete this._dropTargets[a._guid]},inspectOperation:function(b){var a=[];if(b===SC.DRAG_NONE){a=["DRAG_NONE"]}else{if(b===SC.DRAG_ANY){a=["DRAG_ANY"]}else{if(b&SC.DRAG_LINK){a.push("DRAG_LINK")}if(b&SC.DRAG_COPY){a.push("DRAG_COPY")}if(b&SC.DRAG_MOVE){a.push("DRAG_MOVE")}}}return a.join("|")}});require("drag/drag");SC.DragDataSource={dragDataTypes:[],dragDataForType:function(a,b){return null}};SC.Scrollable={isScrollable:true,verticalLineScroll:20,horizontalLineScroll:20,verticalPageScroll:function(){return this.get("innerFrame").height}.property("innerFrame"),horizontalPageScroll:function(){return this.get("innerFrame").width}.property("innerFrame"),hasVerticalScroller:function(){return this.get("scrollFrame").height>this.get("innerFrame").height}.property("scrollFrame"),hasHorizontalScroller:function(){return this.get("scrollFrame").width>this.get("innerFrame").width}.property("scrollFrame"),scrollBy:function(a){var b=this.get("scrollFrame");var c=this.get("innerFrame");if(!this.get("hasVerticalScroller")){a.y=0}if(b.height<=c.height){a.y=0}if(!this.get("hasHorizontalScroller")){a.x=0}if(b.width<=c.width){a.x=0}var d={x:b.x-(a.x||0),y:b.y-(a.y||0)};this.set("scrollFrame",d);d=this.get("scrollFrame");return{x:d.x-b.x,y:d.y-b.y}},scrollTo:function(a,b){this.set("scrollFrame",{x:0-a,y:0-b})},scrollToVisible:function(b){var e=this.get("innerFrame");var d=this.get("scrollFrame");var a=this.convertFrameFromView(b.get("frame"),b);a.x-=(e.x+d.x);a.y-=(e.y+d.y);var c={x:0-d.x,y:0-d.y,width:e.width,height:e.height};c.y-=Math.max(0,SC.minY(c)-SC.minY(a));c.x-=Math.max(0,SC.minX(c)-SC.minX(a));c.y+=Math.max(0,SC.maxY(a)-SC.maxY(c));c.x+=Math.max(0,SC.maxX(a)-SC.maxX(c));this.scrollTo(c.x,c.y)},scrollDownLine:function(a){if(a===undefined){a=1}return this.scrollBy({y:this.get("verticalLineScroll")*a}).y},scrollUpLine:function(a){if(a===undefined){a=1}return 0-this.scrollBy({y:0-this.get("verticalLineScroll")*a}).y},scrollRightLine:function(a){if(a===undefined){a=1}return this.scrollTo({y:this.get("horizontalLineScroll")*a}).x},scrollLeftLine:function(a){if(a===undefined){a=1}return 0-this.scrollTo({y:0-this.get("horizontalLineScroll")*a}).x},scrollDownPage:function(a){if(a===undefined){a=1}return this.scrollBy({y:this.get("verticalPageScroll")*a}).y},scrollUpPage:function(a){if(a===undefined){a=1}return 0-this.scrollBy({y:0-this.get("verticalPageScroll")*a}).y},scrollRightPage:function(a){if(a===undefined){a=1}return this.scrollTo({y:this.get("horizontalPageScroll")*a}).x},scrollLeftPage:function(a){if(a===undefined){a=1}return 0-this.scrollTo({y:0-this.get("horizontalPageScroll")*a}).x}};require("mixins/scrollable");require("views/container");SC.ScrollView=SC.ContainerView.extend(SC.Scrollable,{emptyElement:'<div class="sc-scroll-view"></div>',canScrollVertical:YES,canScrollHorizontal:NO,_canScrollVerticalObserver:function(){this.setClassName("sc-scroll-vertical",this.get("canScrollVertical"))}.observes("canScrollVertical"),_canScrollHorizontalObserver:function(){this.setClassName("sc-scroll-horizontal",this.get("canScrollHorizontal"))}.observes("canScrollHorizontal"),init:function(){arguments.callee.base.apply(this,arguments);this._canScrollVerticalObserver();this._canScrollHorizontalObserver()},resizeChildrenWithOldSize:function(c){var a=this.get("firstChild");if(a){var d=a.get("frame");var e=Object.clone(d);var b=this.get("innerFrame");d.x=d.y=0;if(!this.get("canScrollHorizontal")){d.width=b.width}if(!this.get("canScrollVertical")){d.height=b.height}if(!SC.rectsEqual(d,e)){a.set("frame",d)}}}});require("views/view");SC.ProgressView=SC.View.extend({minimum:0,maximum:1,value:0.5,valueBindingDefault:SC.Binding.SingleNotEmpty,isIndeterminate:function(a,b){if(b!==undefined){this._isIndeterminate=b}return this._isIndeterminate&&(this.value!=SC.Binding.EMPTY_PLACEHOLDER)}.property(),isEnabled:function(a,b){if(b!==undefined){this._isEnabled=b}return this._isEnabled&&(this.value!=SC.Binding.MULTIPLE_PLACEHOLDER)}.property(),_isIndeterminate:false,_isEnabled:true,emptyElement:'<div class="progress outer"><div class="outer-head"></div><div class="inner"><div class="inner-head"></div><div class="inner-tail"></div></div><div class="outer-tail"></div></div>',outlets:["innerView"],innerView:SC.View.outletFor(".inner?"),propertyObserver:function(h,g,b,e){if(["value","minimum","maximum","isIndeterminate","isEnabled"].include(b)){var a=this.get("isIndeterminate");var c=this.get("isEnabled");this.setClassName("indeterminate",a);this.setClassName("disabled",!c);var e;if(!c){e=0}else{if(a){e=1}else{var d=this.get("minimum")||0;var j=this.get("maximum")||1;e=this.get("value")||0;e=(e-d)/(j-d);if(e>1){e=1}}}if(isNaN(e)){e=0}e=e*100;if(this.innerView){this.innerView.setStyle({width:(e+"%")})}}}});function Animator(a){this.setOptions(a);var b=this;this.timerDelegate=function(){b.onTimerEvent()};this.subjects=[];this.target=0;this.state=0;this.lastTime=null}Animator.prototype={setOptions:function(a){this.options=Animator.applyDefaults({interval:20,duration:400,onComplete:function(){},onStep:function(){},transition:Animator.tx.easeInOut},a)},seekTo:function(a){this.seekFromTo(this.state,a)},seekFromTo:function(b,a){this.target=Math.max(0,Math.min(1,a));this.state=Math.max(0,Math.min(1,b));this.lastTime=new Date().getTime();if(!this.intervalId){this.intervalId=SC.Timer.schedule({target:this,action:this.timerDelegate,interval:this.options.interval,repeats:YES})}},jumpTo:function(a){this.target=this.state=Math.max(0,Math.min(1,a));this.propagate()},toggle:function(){this.seekTo(1-this.target)},addSubject:function(a){this.subjects[this.subjects.length]=a;return this},clearSubjects:function(){this.subjects=[]},propagate:function(){var b=this.options.transition(this.state);for(var a=0;a<this.subjects.length;a++){if(this.subjects[a].setState){this.subjects[a].setState(b)}else{this.subjects[a](b)}}},onTimerEvent:function(){var c=new Date().getTime();var a=c-this.lastTime;this.lastTime=c;var b=(a/this.options.duration)*(this.state<this.target?1:-1);if(Math.abs(b)>=Math.abs(this.state-this.target)){this.state=this.target}else{this.state+=b}try{this.propagate()}finally{this.options.onStep.call(this);if(this.target==this.state){this.intervalId.invalidate();this.intervalId=null;this.options.onComplete.call(this)}}},play:function(){this.seekFromTo(0,1)},reverse:function(){this.seekFromTo(1,0)},inspect:function(){var b="#<Animator:\n";for(var a=0;a<this.subjects.length;a++){b+=this.subjects[a].inspect()}b+=">";return b}};Animator.applyDefaults=function(c,b){b=b||{};var d,a={};for(d in c){a[d]=b[d]!==undefined?b[d]:c[d]}return a};Animator.makeArray=function(c){if(c==null){return[]}if(!c.length){return[c]}var a=[];for(var b=0;b<c.length;b++){a[b]=c[b]}return a};Animator.camelize=function(c){var e=c.split("-");if(e.length==1){return e[0]}var b=c.indexOf("-")==0?e[0].charAt(0).toUpperCase()+e[0].substring(1):e[0];for(var d=1,a=e.length;d<a;d++){var g=e[d];b+=g.charAt(0).toUpperCase()+g.substring(1)}return b};Animator.apply=function(c,b,a){if(b instanceof Array){return new Animator(a).addSubject(new CSSStyleSubject(c,b[0],b[1]))}return new Animator(a).addSubject(new CSSStyleSubject(c,b))};Animator.makeEaseIn=function(b){return function(a){return Math.pow(a,b*2)}};Animator.makeEaseOut=function(b){return function(a){return 1-Math.pow(1-a,b*2)}};Animator.makeElastic=function(a){return function(b){b=Animator.tx.easeInOut(b);return((1-Math.cos(b*Math.PI*a))*(1-b))+b}};Animator.makeADSR=function(d,b,c,a){if(a==null){a=0.5}return function(e){if(e<d){return e/d}if(e<b){return 1-((e-d)/(b-d)*(1-a))}if(e<c){return a}return a*(1-((e-c)/(1-c)))}};Animator.makeBounce=function(a){var b=Animator.makeElastic(a);return function(c){c=b(c);return c<=1?c:2-c}};Animator.tx={easeInOut:function(a){return((-Math.cos(a*Math.PI)/2)+0.5)},linear:function(a){return a},easeIn:Animator.makeEaseIn(1.5),easeOut:Animator.makeEaseOut(1.5),strongEaseIn:Animator.makeEaseIn(2.5),strongEaseOut:Animator.makeEaseOut(2.5),elastic:Animator.makeElastic(1),veryElastic:Animator.makeElastic(3),bouncy:Animator.makeBounce(1),veryBouncy:Animator.makeBounce(3)};function NumericalStyleSubject(b,c,e,d,a){this.els=Animator.makeArray(b);if(c=="opacity"&&window.ActiveXObject){this.property="filter"}else{this.property=Animator.camelize(c)}this.from=parseFloat(e);this.to=parseFloat(d);this.units=a!=null?a:"px"}NumericalStyleSubject.prototype={setState:function(g){var d=this.getStyle(g);var a=(this.property=="opacity"&&g==0)?"hidden":"";var b=0;for(var c=0;c<this.els.length;c++){try{this.els[c].style[this.property]=d}catch(h){if(this.property!="fontWeight"){throw h}}if(b++>20){return}}},getStyle:function(a){a=this.from+((this.to-this.from)*a);if(this.property=="filter"){return"alpha(opacity="+Math.round(a*100)+")"}if(this.property=="opacity"){return a}return Math.round(a)+this.units},inspect:function(){return"\t"+this.property+"("+this.from+this.units+" to "+this.to+this.units+")\n"}};function ColorStyleSubject(a,b,d,c){this.els=Animator.makeArray(a);this.property=Animator.camelize(b);this.to=this.expandColor(c);this.from=this.expandColor(d);this.origFrom=d;this.origTo=c}ColorStyleSubject.prototype={expandColor:function(b){var c,e,d,a;c=ColorStyleSubject.parseColor(b);if(c){e=parseInt(c.slice(1,3),16);d=parseInt(c.slice(3,5),16);a=parseInt(c.slice(5,7),16);return[e,d,a]}if(window.DEBUG){alert("Invalid colour: '"+b+"'")}},getValueForState:function(a,b){return Math.round(this.from[a]+((this.to[a]-this.from[a])*b))},setState:function(c){var a="#"+ColorStyleSubject.toColorPart(this.getValueForState(0,c))+ColorStyleSubject.toColorPart(this.getValueForState(1,c))+ColorStyleSubject.toColorPart(this.getValueForState(2,c));for(var b=0;b<this.els.length;b++){this.els[b].style[this.property]=a}},inspect:function(){return"\t"+this.property+"("+this.origFrom+" to "+this.origTo+")\n"}};ColorStyleSubject.parseColor=function(d){var a="#",c;if(c=ColorStyleSubject.parseColor.rgbRe.exec(d)){var b;for(var e=1;e<=3;e++){b=Math.max(0,Math.min(255,parseInt(c[e],0)));a+=ColorStyleSubject.toColorPart(b)}return a}if(c=ColorStyleSubject.parseColor.hexRe.exec(d)){if(c[1].length==3){for(var e=0;e<3;e++){a+=c[1].charAt(e)+c[1].charAt(e)}return a}return"#"+c[1]}return false};ColorStyleSubject.toColorPart=function(a){if(a>255){a=255}var b=a.toString(16);if(a<16){return"0"+b}return b};ColorStyleSubject.parseColor.rgbRe=/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i;ColorStyleSubject.parseColor.hexRe=/^\#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/;function DiscreteStyleSubject(b,c,e,d,a){this.els=Animator.makeArray(b);this.property=Animator.camelize(c);this.from=e;this.to=d;this.threshold=a||0.5}DiscreteStyleSubject.prototype={setState:function(c){var a=0;for(var b=0;b<this.els.length;b++){this.els[b].style[this.property]=c<=this.threshold?this.from:this.to}},inspect:function(){return"\t"+this.property+"("+this.from+" to "+this.to+" @ "+this.threshold+")\n"}};function CSSStyleSubject(d,p,l){d=Animator.makeArray(d);this.subjects=[];if(d.length==0){return}var a,q,b;if(l){b=this.parseStyle(p,d[0]);q=this.parseStyle(l,d[0])}else{q=this.parseStyle(p,d[0]);b={};for(a in q){b[a]=CSSStyleSubject.getStyle(d[0],a)}}var a;for(a in b){if(b[a]==q[a]){delete b[a];delete q[a]}}var a,j,e,k,o,m;for(a in b){var h=String(b[a]);var c=String(q[a]);if(q[a]==null){if(window.DEBUG){alert("No to style provided for '"+a+'"')}continue}if(o=ColorStyleSubject.parseColor(h)){m=ColorStyleSubject.parseColor(c);k=ColorStyleSubject}else{if(h.match(CSSStyleSubject.numericalRe)&&c.match(CSSStyleSubject.numericalRe)){o=parseFloat(h);m=parseFloat(c);k=NumericalStyleSubject;e=CSSStyleSubject.numericalRe.exec(h);var g=CSSStyleSubject.numericalRe.exec(c);if(e[1]!=null){j=e[1]}else{if(g[1]!=null){j=g[1]}else{j=g}}}else{if(h.match(CSSStyleSubject.discreteRe)&&c.match(CSSStyleSubject.discreteRe)){o=h;m=c;k=DiscreteStyleSubject;j=0}else{if(window.DEBUG){alert("Unrecognised format for value of "+a+": '"+b[a]+"'")}continue}}}this.subjects[this.subjects.length]=new k(d,a,o,m,j)}}CSSStyleSubject.prototype={parseStyle:function(b,c){var h={};if(b.indexOf(":")!=-1){var k=b.split(";");for(var e=0;e<k.length;e++){var d=CSSStyleSubject.ruleRe.exec(k[e]);if(d){h[d[1]]=d[2]}}}else{var a,j,g;g=c.className;c.className=b;for(var e=0;e<CSSStyleSubject.cssProperties.length;e++){a=CSSStyleSubject.cssProperties[e];j=CSSStyleSubject.getStyle(c,a);if(j!=null){h[a]=j}}c.className=g}return h},setState:function(b){for(var a=0;a<this.subjects.length;a++){this.subjects[a].setState(b)}},inspect:function(){var b="";for(var a=0;a<this.subjects.length;a++){b+=this.subjects[a].inspect()}return b}};CSSStyleSubject.getStyle=function(b,c){var a;if(document.defaultView&&document.defaultView.getComputedStyle){a=document.defaultView.getComputedStyle(b,"").getPropertyValue(c);if(a){return a}}c=Animator.camelize(c);if(b.currentStyle){a=b.currentStyle[c]}return a||b.style[c]};CSSStyleSubject.ruleRe=/^\s*([a-zA-Z\-]+)\s*:\s*(\S(.+\S)?)\s*$/;CSSStyleSubject.numericalRe=/^-?\d+(?:\.\d+)?(%|[a-zA-Z]{2})?$/;CSSStyleSubject.discreteRe=/^\w+$/;CSSStyleSubject.cssProperties=["azimuth","background","background-attachment","background-color","background-image","background-position","background-repeat","border-collapse","border-color","border-spacing","border-style","border-top","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style","border-top-width","border-right-width","border-bottom-width","border-left-width","border-width","bottom","clear","clip","color","content","cursor","direction","display","elevation","empty-cells","css-float","font","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","height","left","letter-spacing","line-height","list-style","list-style-image","list-style-position","list-style-type","margin","margin-top","margin-right","margin-bottom","margin-left","max-height","max-width","min-height","min-width","orphans","outline","outline-color","outline-style","outline-width","overflow","padding","padding-top","padding-right","padding-bottom","padding-left","pause","position","right","size","table-layout","text-align","text-decoration","text-indent","text-shadow","text-transform","top","vertical-align","visibility","white-space","width","word-spacing","z-index","opacity","outline-offset","overflow-x","overflow-y"];function AnimatorChain(c,a){this.animators=c;this.setOptions(a);for(var b=0;b<this.animators.length;b++){this.listenTo(this.animators[b])}this.forwards=false;this.current=0}AnimatorChain.prototype={setOptions:function(a){this.options=Animator.applyDefaults({resetOnPlay:true},a)},play:function(){this.forwards=true;this.current=-1;if(this.options.resetOnPlay){for(var a=0;a<this.animators.length;a++){this.animators[a].jumpTo(0)}}this.advance()},reverse:function(){this.forwards=false;this.current=this.animators.length;if(this.options.resetOnPlay){for(var a=0;a<this.animators.length;a++){this.animators[a].jumpTo(1)}}this.advance()},toggle:function(){if(this.forwards){this.seekTo(0)}else{this.seekTo(1)}},listenTo:function(a){var b=a.options.onComplete;var c=this;a.options.onComplete=function(){if(b){b.call(a)}c.advance()}},advance:function(){if(this.forwards){if(this.animators[this.current+1]==null){return}this.current++;this.animators[this.current].play()}else{if(this.animators[this.current-1]==null){return}this.current--;this.animators[this.current].reverse()}},seekTo:function(a){if(a<=0){this.forwards=false;this.animators[this.current].seekTo(0)}else{this.forwards=true;this.animators[this.current].seekTo(1)}}};function Accordion(l){this.setOptions(l);var b=this.options.initialSection,h;if(this.options.rememberance){h=document.location.hash.substring(1)}this.rememberanceTexts=[];this.ans=[];var g=this;for(var c=0;c<this.options.sections.length;c++){var a=this.options.sections[c];var d=new Animator(this.options.animatorOptions);var k=this.options.from+(this.options.shift*c);var j=this.options.to+(this.options.shift*c);d.addSubject(new NumericalStyleSubject(a,this.options.property,k,j,this.options.units));d.jumpTo(0);var e=this.options.getActivator(a);e.index=c;e.onclick=function(){g.show(this.index)};this.ans[this.ans.length]=d;this.rememberanceTexts[c]=e.innerHTML.replace(/\s/g,"");if(this.rememberanceTexts[c]===h){b=c}}this.show(b)}Accordion.prototype={setOptions:function(a){this.options=Object.extend({sections:null,getActivator:function(b){return document.getElementById(b.getAttribute("activator"))},shift:0,initialSection:0,rememberance:true,animatorOptions:{}},a||{})},show:function(b){for(var a=0;a<this.ans.length;a++){this.ans[a].seekTo(a>b?1:0)}if(this.options.rememberance){document.location.hash=this.rememberanceTexts[b]}}};require("views/view");require("mixins/control");lc_cnt=0;SC.IMAGE_STATE_NONE="none";SC.IMAGE_STATE_LOADING="loading";SC.IMAGE_STATE_LOADED="loaded";SC.IMAGE_STATE_FAILED="failed";SC.BLANK_IMAGE_URL="/beta/sproutcore/en/702d7e042eec94e801ded1c7a09dabe677868b3e/blank.gif";SC.ImageView=SC.View.extend(SC.Control,{emptyElement:'<img src="%@" class="sc-image-view" />'.fmt(SC.BLANK_IMAGE_URL),status:SC.IMAGE_STATE_NONE,value:null,_value:null,transform:function(a){return a},valueObserver:function(){var c=this.get("value");if(this.transform!==SC.ImageView.prototype.transform){var b=this.get("content")||"";c=this.transform(b)}if(c==this._value){return}if(this._value&&this._value.length>0&&!SC.ImageView.valueIsUrl(this._value)){var d=this._value.split(" ");var a=d.length;while(--a>=0){this.removeClassName(d[a])}this.removeClassName("sc-sprite")}this._value=c;if(!c||c.length==0){this.rootElement.src=SC.BLANK_IMAGE_URL;this.set("status",SC.IMAGE_STATE_NONE);this._imageUrl=null}else{if(SC.ImageView.valueIsUrl(c)){this.beginPropertyChanges();this.set("status",SC.IMAGE_STATE_LOADING);this._imageUrl=c;SC.imageCache.loadImage(c,this,this._onLoadComplete);this.endPropertyChanges()}else{var d=c.split(" ");var a=d.length;while(--a>=0){this.addClassName(d[a])}this.addClassName("sc-sprite");this.rootElement.src=SC.BLANK_IMAGE_URL;this.set("status",SC.IMAGE_STATE_LOADED)}}}.observes("value"),_onLoadComplete:function(c,a,b){if(c!==this._imageUrl){return}this.beginPropertyChanges();this.set("imageWidth",parseInt(b.width,0));this.set("imageHeight",parseInt(b.height,0));this.set("status",a);this.endPropertyChanges();if(a==SC.IMAGE_STATE_LOADED){if(this.imageDidLoad){this.imageDidLoad(c)}this.rootElement.src=c}else{if(this.imageDidFail){this.imageDidFail(c,a)}}},init:function(){arguments.callee.base.apply(this,arguments);this.valueObserver();if(this.rootElement.src){this.set("imageWidth",parseInt(this.rootElement.width,0));this.set("imageHeight",parseInt(this.rootElement.height,0))}}});SC.ImageView.valueIsUrl=function(a){return(a.indexOf("/")>=0)||(a.indexOf(".")>=0)};SC.imageCache=SC.Object.create({loadLimit:4,loadImage:function(a,c,e){var d=this._images[a]=(this._images[a]||{url:a,img:null,handlers:[],status:"unknown"});if(d.img==null){this._queue.push(d);if(!this._imgTimeout){this._imgTimeout=this.invokeLater(this.loadNextImage,100)}}var b=(e)?[c,e]:[this,c];if(d.status=="unknown"){d.handlers.push(b)}else{if(b[1]){b[1].call(b[0],a,d.status,d.img)}}},loadNextImage:function(){this._imgTimeout=null;while((this._queue.length>0)&&(this._loading.length<this.loadLimit)){var b=this._queue.pop();var a=b.url;b.img=new Image();b.img.onabort=this._onAbort.bind(this,a);b.img.onerror=this._onError.bind(this,a);b.img.onload=this._onLoad.bind(this,a);b.img.src=b.url;this._loading.push(b.url)}},_onAbort:function(a){this._changeStatus(a,"aborted")},_onError:function(a){this._changeStatus(a,"error")},_onLoad:function(a){this._changeStatus(a,"loaded")},_changeStatus:function(b,a){var d=this._images[b];if(!d){return}d.status=a;var c;while(c=d.handlers.pop()){if(c[1]){c[1].call(c[0],b,d.status,d.img)}}this._loading=this._loading.without(d.url);this.loadNextImage()},_images:{},_loading:[],_queue:[]});require("foundation/object");SC.Store=SC.Object.create({updateRecords:function(d,e,g,a){this.set("updateRecordsInProgress",true);var b=this;var c=[];if(!g){g=SC.Record}this.beginPropertyChanges();d.each(function(k){var h=k.recordType||g;if(k.recordType!==undefined){delete k.recordType}var j=k[h.primaryKey()];var l=b.getRecordFor(j,h,true);l.dataSource=e;if(k.refreshURL){l.refreshURL=k.refreshURL}if(k.updateURL){l.updateURL=k.updateURL}if(k.destroyURL){l.destroyURL=k.destroyURL}l.updateAttributes(k,a,a);if(l.needsAddToStore){b.addRecord(l)}c.push(l)});this.endPropertyChanges();this.set("updateRecordsInProgress",false);return c},refreshRecords:function(a){},createRecords:function(a){a.invoke("set","newRecord","false");this.commitRecords(a)},commitRecords:function(a){a.invoke("set","isDirty","false")},destroyRecords:function(b){var a=this;b.each(function(c){c.set("isDeleted",true);a.removeRecord(c)})},addRecord:function(d){d.needsAddToStore=false;var b=d._storeKey();var a=this._records[b]||[];a.push(d);this._records[b]=a;if(!this._quickCache){this._quickCache={}}var a=this._quickCache[b]||{};var c=d.get(d.primaryKey);a[c]=d;this._quickCache[b]=a;d.addObserver("*",this._boundRecordObserver);this.recordDidChange(d)},removeRecord:function(d){var b=d._storeKey();var a=this._records[b]||[];a=a.without(d);this._records[b]=a;if(this._quickCache){var a=this._quickCache[b]||{};var c=d.get(d.primaryKey);delete a[c];this._quickCache[b]=a}d.removeObserver("*",this._boundRecordObserver);this.recordDidChange(d)},relocateRecord:function(b,d,e){if(!this._quickCache){return e}var a=e._storeKey();var c=this._quickCache[a]||{};c[d]=e;delete c[b];this._quickCache[a]=c;return e},findRecords:function(){var h=SC.$A(arguments);var j=h.pop();var c=j._storeKey();var a=this._records[c];while(h.length>0){var d=h.pop();var b=[];var g=(a)?a.length:0;while(--g>=0){var e=a[g];if((e._type==j)||(e._type.coreRecordType==j)){if(e.matchConditions(d)){b.push(e)}}}a=b}return SC.$A(a)},_getRecordFor:function(d,e){var c=e._storeKey();var a=(this._quickCache)?this._quickCache[c]:null;var b=(a)?a[d]:null;return b},getRecordFor:function(b,e,c){var a=this._getRecordFor(b,e);if(!a){var d={};d[e.primaryKey()]=b;a=e.create(d);if(c){a.needsAddToStore=true}else{this.addRecord(a)}}return a},records:function(){var a=[];if(this._quickCache){for(var b in this._quickCache){var c=this._quickCache[b];for(var d in c){a.push(c[d])}}}return a}.property(),addCollection:function(c){var a=c.recordType._storeKey();var b=this._collections[a]||[];b.push(c);this._collections[a]=b},removeCollection:function(c){var a=c.recordType._storeKey();var b=this._collections[a]||[];b=b.without(c);this._collections[a]=b},listFor:function(e){var g=e.conditions||{};var a=e.order||["guid"];var c=this.findRecords(g,e.recordType);var d=c.length;c=c.sort(function(k,j){return k.compareTo(j,a)});if(e.limit&&(e.limit>0)){var h=(e.offset)?e.offset:0;var b=h+e.limit;c=c.slice(h,b)}if(e.callback){e.callback(c,d)}},_records:{},_changedRecords:null,_collections:{},recordDidChange:function(d){var b=d._storeKey(),c=this.get("_changedRecords")||{},a=c[b]||{};a[d._guid]=d;c[b]=a;this.set("_changedRecords",c)},_changedRecordsObserver:function(){for(var h in this._changedRecords){var c=this._collections[h];if(c&&c.length>0){var b=[];for(var l in this._changedRecords[h]){b.push(this._changedRecords[h][l])}var j=c.length;while(--j>=0){var a=c[j];a.beginPropertyChanges();try{var k=b.length;while(--k>=0){var d=b[k];if(a.recordType==d._type){a.recordDidChange(d)}}}catch(g){console.log("EXCEPTION: While notifying collection")}a.endPropertyChanges()}}}this._changedRecords={}}.observes("_changedRecords"),init:function(){arguments.callee.base.call(this);this._boundRecordObserver=this.recordDidChange.bind(this)}});require("validators/validator");SC.Validator.Date=SC.Validator.extend({format:"NNN d, yyyy h:mm:ss a",fieldValueForObject:function(b,c,d){var a;if(typeof(b)=="number"){a=new Date(b)}else{if(b instanceof Date){a=b}}if(a){b=a.format(this.get("format"))}return b},objectForFieldValue:function(c,b,d){if(c){var a=Date.parseDate(c);c=(a)?a.getTime():null}return c}});require("views/field/field");SC.CheckboxFieldView=SC.FieldView.extend({emptyElement:'<input type="checkbox" value="1" />',setFieldValue:function(a){this.rootElement.checked=!!a},getFieldValue:function(){return this.rootElement.checked},valueBindingDefault:SC.Binding.Bool,init:function(){arguments.callee.base.apply(this,arguments);var a=this.fieldValueDidChange.bind(this,false);Event.observe(this.rootElement,"click",a)}});require("core");require("foundation/responder");SC.Application=SC.Responder.extend({keyPane:function(a,b){if(b!=undefined){if(this._keyPane){this._keyPane.willResignKeyPane()}if(this._keyPane){this._keyPane.set("isKeyPane",false)}this._keyPane=b;if(this._keyPane){this._keyPane.set("isKeyPane",true)}if(this._keyPane){this._keyPane.didBecomeKeyPane()}}return this._keyPane||null}.property(),mainPane:function(a,b){if(b!=undefined){if(this._mainPane){this._mainPane.willResignMainPane()}if(this._mainPane){this._mainPane.set("isMainPane",false)}this._mainPane=b;if(this._mainPane){this._mainPane.set("isMainPane",true)}if(this._mainPane){this._mainPane.didBecomeMainPane()}}return this._mainPane||null}.property(),run:function(){SC.window.setup();SC.window.makeMainPane();SC.window.makeKeyPane()},sendAction:function(b,c,a){var c=this.targetForAction(b,c,a);return(!!c&&(c.tryToPerform(b,a)!=false))},targetForAction:function(d,e,c){if(!d||($type(d)!=T_STRING)){return null}if(e){if($type(e)===T_STRING){e=SC.Object.objectForPropertyPath(e)}return e.respondsTo(d)?e:null}var a=this.get("keyPane");var b=this.get("mainPane");if(a){e=a.get("firstResponder")||a.get("defaultResponder")||a;do{if(e.respondsTo(d)){return e}}while(e=e.get("nextResponder"))}if(b&&(b!=a)){e=b.get("firstResponder")||b.get("defaultResponder")||b;do{if(e.respondsTo(d)){return e}}while(e=e.get("nextResponder"))}e=this;if(e.respondsTo(d)){return e}return null},sendEvent:function(a,c){var c=c||null;var b=null;if(c&&c.respondsTo(a._type)){return(c.tryToPerform(a._type,a))?c:false}switch(a._type){case"keyDown":case"keyUp":case"flagsChanged":var d=this.get("keyPane");if(!d){return null}c=d.get("firstResponder")||d.get("defaultResponder")||d;break;case"mouseOver":case"mouseOut":case"mouseMoved":case"mouseDown":case"mouseUp":case"click":case"doubleClick":c=SC.window.firstViewForEvent(a);break;default:return null}if(!c){return null}b=c.doCommand(a._type,a);if((a._type=="keyDown")&&!b){if(this._attemptKeyEquivalent(a)){return true}if(this._attemptKeyInterfaceControl(a)){return true}}return b},_attemptKeyEquivalent:function(b){var c=SC.Responder.inputManager.codesForEvent(b).first();if(!c){return false}var a=this.get("keyPane");var d=this.get("mainPane");if(a&&a.performKeyEquivalent(c,b)){return true}if(d&&(d!=a)&&d.performKeyEquivalent(c,b)){return true}return this.performKeyEquivalent(c,b)},_attemptKeyInterfaceControl:function(a){var b=SC.Responder.inputManager.codesForEvent(a).first();var c=this.get("keyPane");if(!c){return false}return c.performKeyInterfaceControl(b,a)}});require("panes/overlay");SC.MENU_PANE="menu";SC.MenuPaneView=SC.OverlayPaneView.extend({emptyElement:'<div class="pane menu-pane"><div class="shadow pane-wrapper"><div class="pane-root"></div><div class="top-left-edge"></div><div class="top-edge"></div><div class="top-right-edge"></div><div class="right-edge"></div><div class="bottom-right-edge"></div><div class="bottom-edge"></div><div class="bottom-left-edge"></div><div class="left-edge"></div></div></div>',layer:400,isModal:false,positionPane:function(){var d=this.anchorView;var c=this.containerView;var a;if(d){a=c.convertFrameFromView(d.get("frame"),d);a.y+=a.height;a=this.fitPositionToScreen(a,c,d)}else{var b=SC.window.get("size");var e=c.get("size");a={};a.x=(b.width-e.width)/2;a.y=(b.height-e.height)/2}c.set("origin",a)}});require("validators/validator");SC.Validator.NotEmpty=SC.Validator.extend({validate:function(b,d){var c=d.get("fieldValue");var a=!!c;if(a&&c.length){a=c.length>0}return a},validateError:function(b,c){var a=c.get("errorLabel")||"Field";return $error("Invalid.NotEmpty(%@)".loc(a.capitalize()),c.get("errorLabel"))}});SC.mixin({_downloadFrames:0,download:function(e){var a=document.createElement("iframe");var d="DownloadFrame_"+this._downloadFrames;a.setAttribute("id",d);a.style.border="10px";a.style.width="0px";a.style.height="0px";a.style.position="absolute";a.style.top="-10000px";a.style.left="-10000px";if(!(SC.isSafari())){a.setAttribute("src",e)}document.getElementsByTagName("body")[0].appendChild(a);if(SC.isSafari()){a.setAttribute("src",e)}this._downloadFrames=this._downloadFrames+1;if(!(SC.isSafari())){var c=function(){document.body.removeChild(document.getElementById(d));d=null};var b=c.invokeLater(null,2000)}a=null},normalizeURL:function(a){if(a.slice(0,1)=="/"){a=window.location.protocol+"//"+window.location.host+a}else{if((a.slice(0,5)=="http:")||(a.slice(0,6)=="https:")){}else{a=window.location.href+"/"+a}}return a},minX:function(a){return a.x},maxX:function(a){return a.x+a.width},midX:function(a){return a.x+(a.width/2)},minY:function(a){return a.y},maxY:function(a){return a.y+a.height},midY:function(a){return a.y+(a.height/2)},centerX:function(b,a){return(a.width-b.width)/2},centerY:function(b,a){return(a.width-b.width)/2},pointInRect:function(a,b){return(a.x>=SC.minX(b))&&(a.y>=SC.minY(b))&&(a.x<=SC.maxX(b))&&(a.y<=SC.maxY(b))},rectsEqual:function(b,a,c){if(!b||!a){return(b==a)}if(c==null){c=0.1}if(Math.abs(b.y-a.y)>c){return false}if(Math.abs(b.x-a.x)>c){return false}if(Math.abs(b.width-a.width)>c){return false}if(Math.abs(b.height-a.height)>c){return false}return true},intersectRects:function(b,a){var c={x:Math.max(SC.minX(b),SC.minX(a)),y:Math.max(SC.minY(b),SC.minY(a)),width:Math.min(SC.maxX(b),SC.maxX(a)),height:Math.min(SC.maxY(b),SC.maxY(a))};c.width=Math.max(0,c.width-c.x);c.height=Math.max(0,c.height-c.y);return c},unionRects:function(b,a){var c={x:Math.min(SC.minX(b),SC.minX(a)),y:Math.min(SC.minY(b),SC.minY(a)),width:Math.max(SC.maxX(b),SC.maxX(a)),height:Math.max(SC.maxY(b),SC.maxX(a))};c.width=Math.max(0,c.width-c.x);c.height=Math.max(0,c.height-c.y);return c},cloneRect:function(a){return{x:a.x,y:a.y,width:a.width,height:a.height}},viewportOffset:function(c){var j=0;var d=0;var h=c;var b=SC.Platform.Firefox>=3;while(h){d+=(h.offsetTop||0);if(!b||(h!==c)){d+=(h.clientTop||0)}j+=(h.offsetLeft||0);if(!b||(h!==c)){j+=(h.clientLeft||0)}if(SC.Platform.Firefox){var g=Element.getStyle(h,"overflow");if(g!=="visible"){var e=parseInt(Element.getStyle(h,"borderLeftWidth"),0)||0;var k=parseInt(Element.getStyle(h,"borderTopWidth"),0)||0;if(c!==h){e*=2;k*=2}j+=e;d+=k}var a=h.offsetParent;if((SC.Platform.Firefox>=3)&&a){d-=a.clientTop;j-=a.clientLeft}}if(h.offsetParent==document.body&&Element.getStyle(h,"position")=="absolute"){break}h=h.offsetParent}h=c;while(h){if(!Prototype.Browser.Opera||h.tagName=="BODY"){d-=h.scrollTop||0;j-=h.scrollLeft||0}h=h.parentNode}return{x:j,y:d}},ZERO_POINT:{x:0,y:0},ZERO_RANGE:{start:0,length:0},RANGE_NOT_FOUND:{start:0,length:-1},valueInRange:function(b,a){return(a>0)&&(b>=a.start)&&(b<(a.start+a.length))},minRange:function(a){return a.start},maxRange:function(a){return(a.length<0)?-1:(a.start+a.length)},unionRanges:function(c,b){if((c==null)||(c.length<0)){return b}if((b==null)||(b.length<0)){return c}var d=Math.min(c.start,b.start);var a=Math.max(SC.maxRange(c),SC.maxRange(b));return{start:d,length:a-d}},intersectRanges:function(c,b){if((c==null)||(b==null)){return SC.RANGE_NOT_FOUND}if((c.length<0)||(b.length<0)){return SC.RANGE_NOT_FOUND}var d=Math.max(SC.minRange(c),SC.minRange(b));var a=Math.min(SC.maxRange(c),SC.maxRange(b));if(a<d){return SC.RANGE_NOT_FOUND}return{start:d,length:a-d}},cloneRange:function(a){return{start:a.start,length:a.length}},rangesEqual:function(b,a){if(b===a){return true}if(b==null){return a.length<0}if(a==null){return b.length<0}return(b.start==a.start)&&(b.length==a.length)}});require("core");SC.URL_ENCODED_FORMAT="url-encoded";SC.JSON_FORMAT="json";SC.Server=SC.Object.extend({prefix:null,urlFormat:"/%@/%@",postFormat:SC.URL_ENCODED_FORMAT,escapeJSON:true,preload:function(a){if((!a)||(a.size==0)){return}this.refreshRecordsWithData(a,SC.Record,null,false)},request:function(j,l,c,k,a){if(!k){k={}}var b={};var p=k.onSuccess;delete k.onSuccess;var q=k.onNotModified;delete k.onNotModified;var g=k.onFailure;delete k.onFailure;var e=k.requestContext;delete k.requestContext;var h=k.accept;delete k.accept;var o=k.cacheCode;delete k.cacheCode;var d=k.url;delete k.url;b.requestHeaders={Accept:"application/json, text/javascript, application/xml, text/xml, text/html, */*"};if(h){b.requestHeaders.Accept=h}if(o){b.requestHeaders["Sproutit-Cache"]=o}b.method=a||"get";if(!d){d=this.urlFor(j,l,c,k,b.method)}if(c&&c.length>1){k.ids=[c].flatten().join(",")}b.requestHeaders={"X-SproutCore-Version":"1.0"};var r=this._toQueryString(k);if(r&&r.length>0){b.parameters=r}var m=null;b.onSuccess=function(t){var s=m.getHeader("Last-Modified");if((t.status=="200")&&(t.responseText=="304 Not Modified")){if(q){q(t.status,t,s,e)}}else{if(p){p(t.status,t,s,e)}}};b.onFailure=function(t){var s=m.getHeader("Last-Modified");if(g){g(t.status,t,s,e)}};console.log("REQUEST: %@ %@".fmt(b.method,d));m=new Ajax.Request(d,b)},urlFor:function(d,c,b,e,g){var a=(b&&b.length==1)?b[0]:"";return this.urlFormat.format(d,c)+a},listFor:function(c){var g=c.recordType;var d=g.resourceURL();if(!d){return false}var a=c.order||"id";if(!(a instanceof Array)){a=[a]}a=a.map(function(h){return h.decamelize()}).join(",");params={};if(c.conditions){var e=this._decamelizeData(c.conditions);for(var b in e){params[b]=e[b]}}params.requestContext=c;params.onSuccess=this._listSuccess.bind(this);params.onNotModified=this._listNotModified.bind(this);params.onFailure=this._listFailure.bind(this);if(c.cacheCode){params.cacheCode=c.cacheCode}if(c.offset){params.offset=c.offset}if(c.limit){params.limit=c.limit}if(a){params.order=a}this.request(d,this._listForAction,null,params,this._listMethod)},_listForAction:"list",_listMethod:"get",_listSuccess:function(status,transport,cacheCode,context){var json=eval("json="+transport.responseText);if(!json){console.log("invalid json!");return}if(json.records){this.refreshRecordsWithData(json.records,context.recordType,cacheCode,false)}var recs=(json.ids)?json.ids.map(function(guid){return SC.Store.getRecordFor(guid,context.recordType)}):[];if(context.callback){context.callback(recs,json.count,cacheCode)}},_listNotModified:function(b,d,a,c){if(c.callback){c.callback(null,null,null)}},_listFailure:function(b,d,a,c){console.log("listFailed!")},createRecords:function(b){if(!b||b.length==0){return}b=this._recordsByResource(b);for(var e in b){if(e=="*"){continue}var a=b[e];var g=this;var c={};var d=a.map(function(j){var h=g._decamelizeData(j.getPropertyData());h._guid=j._guid;c[j._guid]=j;return h});this.request(e,this._createAction,null,{requestContext:c,onSuccess:this._createSuccess.bind(this),onFailure:this._createFailure.bind(this),records:d},this._createMethod)}},_createAction:"create",_createMethod:"post",_createSuccess:function(status,transport,cacheCode,context){var json=eval("json="+transport.responseText);if(!(json instanceof Array)){json=[json]}if(!context){context={}}json.each(function(data){var guid=data._guid;var rec=(guid)?context[guid]:null;if(rec){var pk=rec.get("primaryKey");var dataKey=(pk=="guid")?"id":pk.decamelize().toLowerCase().replace(/\-/g,"_");rec.set(pk,data[dataKey]);rec.set("newRecord",false)}});this.refreshRecordsWithData(json,context._recordType,cacheCode,true)},_createFailure:function(b,d,a,c){console.log("createFailed!")},refreshRecords:function(d){if(!d||d.length==0){return}d=this._recordsByResource(d);for(var h in d){if(h=="*"){continue}var c=d[h];var a=null;var g=[];var e={};var b=c[0].get("primaryKey");c.each(function(k){a=a||k._cacheCode;var j=k.get(b);if(j){g.push(j);e[j]=k}});e._recordType=this._instantiateRecordType(c[0].get("type"),this.prefix,null);params={requestContext:e,cacheCode:((a=="")?null:a),onSuccess:this._refreshSuccess.bind(this),onFailure:this._refreshFailure.bind(this)};if(g.length==1&&c[0].refreshURL){params.url=c[0].refreshURL}this.request(h,this._refreshAction,g,params,this._refreshMethod)}},_refreshAction:"show",_refreshMethod:"get",_refreshSuccess:function(status,transport,cacheCode,context){var json=eval("json="+transport.responseText);if(!(json instanceof Array)){json=[json]}this.refreshRecordsWithData(json,context._recordType,cacheCode,true)},_refreshFailure:function(b,d,a,c){console.log("refreshFailed!")},commitRecords:function(b){if(!b||b.length==0){return}b=this._recordsByResource(b);for(var d in b){if(d=="*"){continue}var g=b[d];var c=this;var e=null;switch(this.get("postFormat")){case SC.URL_ENCODED_FORMAT:e=g.map(function(l){return c._decamelizeData(l.getPropertyData())});break;case SC.JSON_FORMAT:var k=[];for(rec in g){if(!g.hasOwnProperty(rec)){continue}k.push(g[rec].get("attributes")||{})}if(this.get("escapeJSON")){e=escape(k.toJSONString())}else{e=k.toJSONString()}break;default:break}if(e){var a=[];if(g.length==1){var h=g[0].get("primaryKey");var j=g[0].get(h);if(j){a.push(j)}}params={requestContext:b,onSuccess:this._commitSuccess.bind(this),onFailure:this._commitFailure.bind(this),records:e};if(a.length==1&&g[0].updateURL){params.url=g[0].updateURL}this.request(d,this._commitAction,a,params,this._commitMethod)}}},_commitAction:"update",_commitMethod:"post",_commitSuccess:function(status,transport,cacheCode,context){var json=eval("json="+transport.responseText);if(!(json instanceof Array)){json=[json]}this.refreshRecordsWithData(json,context._recordType,cacheCode,true)},_commitFailure:function(b,d,a,c){console.log("commitFailed!")},destroyRecords:function(c){if(!c||c.length==0){return}c=this._recordsByResource(c);for(var g in c){var b=c[g];if(g=="*"){b.each(function(h){h.set("isDeleted",true);SC.Store.removeRecord(h)});continue}var e=[];var d;var a=b[0].get("primaryKey");b.each(function(h){if((d=h.get(a))&&(!h.get("newRecord"))){e.push(d)}h.set("isDeleted",true);SC.Store.removeRecord(h)});if(e&&e.length>0){params={requestContext:c,onSuccess:this._destroySuccess.bind(this),onFailure:this._destroyFailure.bind(this)};if(e.length==1&&b[0].destroyURL){params.url=b[0].destroyURL}this.request(g,this._destroyAction,e,params,this._destroyMethod)}}},_destroyAction:"destroy",_destroyMethod:"post",_destroySuccess:function(b,d,a,c){console.log("destroySuccess!")},_destroyFailure:function(b,d,a,c){console.log("destroyFailed!")},refreshRecordsWithData:function(h,j,d,e){var g=this;var c=[];for(var b=0;b<h.length;b++){var a=g._prepareDataForRecords(h[b],g,j);if(a!==null){c.push(a)}}SC.Store.updateRecords(c,g,j,e)},_prepareDataForRecords:function(b,c,d){if(b===null){return null}else{if($type(b)==T_ARRAY){var a=this;return b.map(function(e){return a._prepareDataForRecords(e,c,d)})}else{if($type(b)==T_HASH){b=c._camelizeData(b);if(b.id){b.guid=b.id;delete b.id}b.recordType=c._instantiateRecordType(b.type,c.prefix,d);if(b.recordType){return b}else{console.log("Data RecordType could not be instantiated!: "+b.type);return null}}else{console.log("Unknown data type in SC.Server#_prepareDataForRecords. Should be array or hash.");return null}}}},_instantiateRecordType:function(j,e,h){if(j){var g=j.capitalize();if(e){for(var a=0;a<e.length;a++){var b=e[a].split(".");var d=window;for(var c=0;c<b.length;c++){var d=d[b[c]]}if(d!==window){return d[g]}}}else{return window[g]}}else{return h}},_recordsByResource:function(a){var b={};a.each(function(d){var c=b[d.resourceURL||"*"]||[];c.push(d);b[d.resourceURL||"*"]=c});return b},_camelizeData:function(e){if(e==null){return e}var c=this;if(e instanceof Array){return e.map(function(g){return c._camelizeData(g)})}if(typeof(e)=="object"){var a={};for(var b in e){var d=c._camelizeData(e[b]);if(b=="id"){b="guid"}a[b.replace(/_/g,"-").camelize()]=d}return a}return e},_decamelizeData:function(e){if(e==null){return e}var c=this;if(e instanceof Array){return e.map(function(g){return c._decamelizeData(g)})}if(typeof(e)=="object"){var a={};for(var b in e){var d=c._decamelizeData(e[b]);if(b=="guid"){b="id"}a[b.decamelize()]=d}return a}return e},_toQueryString:function(g,b){if(g==null){return b+"="}else{if(g instanceof Array){var a=[];for(var e=0;e<g.length;e++){var c=(b)?(b+"["+e+"]"):e;a.push(this._toQueryString(g[e],c))}return a.join("&")}else{if(typeof(g)=="object"){var a=[];for(var d in g){var c=(b)?(b+"["+d+"]"):d;a.push(this._toQueryString(g[d],c))}return a.join("&")}else{return[b,g].join("=")}}}},init:function(){arguments.callee.base.apply(this,arguments);SC.Server.addServer(this)}});SC.Server.servers=[];SC.Server.addServer=function(b){var a=SC.Server.servers;a.push(b);SC.Server.servers=a};require("server/server");SC.RestServer=SC.Server.extend({urlFor:function(c,b,a,d,e){url=c;if(a&&a.length==1){url=url+"/"+a[0]}if(b&&b!=""){url=url+"/"+b}return url},_listForAction:"",_listForMethod:"get",_createAction:"",_createMethod:"post",_refreshAction:"",_refreshMethod:"get",_commitAction:"",_commitMethod:"put",_destroyAction:"",_destroyMethod:"delete"});require("views/view");SC.SegmentedView=SC.View.extend({value:null,segments:null,isEnabled:true,allowsEmptySelection:false,init:function(){arguments.callee.base.call(this);if(!this.segments){this.segments=this.outlets.slice()}var a=this;this.segments.each(function(c){var b=a[c];var d=c.slice(0,-6);if(b&&(b.action==SC.ButtonView.prototype.action)){b.action=function(){if(this.owner.get("allowsEmptySelection")){newKey=(this.owner.get("value")==d)?null:d}else{newKey=d}this.owner.set("value",newKey)}}});this._enabledObserver();this._valueObserver()},_valueObserver:function(){var b=this.get("value");if(b!=this._lastSelected){this._lastSelected=b;var a=this;this.segments.each(function(e){var c=(b)?(e.slice(0,-6)==b):false;var d=a[e];if(d){d.set("isSelected",c)}})}}.observes("value"),_enabledObserver:function(){var b=this.get("isEnabled");if(b!=this._lastEnabled){var a=this;this.segments.each(function(c){a[c].set("isEnabled",b)})}}.observes("isEnabled")});require("server/rest_server");SC.RailsServer=SC.RestServer.extend({urlFor:function(c,b,a,d,e){if(e!="get"&&SC.RAILS_AUTH_TOKEN_NAME){d[SC.RAILS_AUTH_TOKEN_NAME]=SC.RAILS_AUTH_TOKEN}return arguments.callee.base.apply(this,arguments)}});require("views/view");SC.PaneManager=SC.View.extend({emptyElement:'<div id="panes"></div>',showPaneView:function(a,c,e,d){this.hidePaneView(a);var h=this.getPaneFor(c);h._managedPaneType=c;h.set("anchorView",e);h.set("triggerEvent",d);h.set("isVisible",false);this._visiblePanes[a._guid]=h;var g=this.get("firstChild");var b=h.get("layer");while(g&&(g.get("layer")<=b)){g=g.get("nextSibling")}this.insertBefore(h,g);this.set("isVisible",true);h.setStyle({visibility:"hidden"});h.set("isVisible",true);this._setApplicationKeyPane();h.set("content",a)},hidePaneView:function(a){var b=this._visiblePanes[a._guid];if(!b){return}b.addObserver("displayIsVisible",this._boundPaneDidHide);b.set("isVisible",false)},getPaneFor:function(c){var b=this._paneCache[c];var d=(b)?b.pop():null;if(d){return d}var a=this._paneTypes[c];if(!a){a=SC[c.classify()+"PaneView"]}if(!a){throw"no matching class found for pane type '%@'".fmt(c)}d=a.viewFor(null);return d},returnToCache:function(c,b){var a=this._paneCache[b]||[];a.push(c);this._paneCache[b]=a},_paneDidHide:function(b){var a=b.get("displayIsVisible");if(a){return}b.removeObserver("displayIsVisible",this._boundPanelDidHide);b.removeFromParent();b.set("content",null);this.returnToCache(b,b._managedPaneType);if(this.get("firstChild")==null){this.set("isVisible",false)}this._setApplicationKeyPane()},_setApplicationKeyPane:function(){var a=this.get("lastChild");if(a&&a.get("isVisible")){a.makeKeyPane()}else{var b=SC.app.get("mainPane");if(b){b.makeKeyPane()}}},init:function(){arguments.callee.base.apply(this,arguments);var a=this.rootElement;if(!this.parentNode){$tag("body").insertBefore(a,null);SC.window.insertBefore(this,null)}this.set("isVisible",false);this._boundPaneDidHide=this._paneDidHide.bind(this)},_paneTypes:{},_paneCache:{},_visiblePanes:{}});SC.PaneManager.registerPaneType=function(b,a){SC.PaneManager.prototype._paneTypes[b]=a};SC.PaneManager.manager=function(){if(!this._manager){this._manager=SC.PaneManager.viewFor("panes")}return this._manager};require("views/button/button");SC.CheckboxView=SC.ButtonView.extend({emptyElement:'<a href="javascript:;" class="sc-checkbox-view sc-button-view button checkbox"><img src="%@" class="button" /><span class="label"></span></a>'.fmt("/beta/sproutcore/en/702d7e042eec94e801ded1c7a09dabe677868b3e/blank.gif"),buttonBehavior:SC.TOGGLE_BEHAVIOR});require("mixins/control");require("views/image");SC.ImageCellView=SC.View.extend(SC.Control,{emptyElement:'<div class="image-cell sc-collection-item"><img src="%@"  style="position:relative;" /></div>'.fmt("/beta/sproutcore/en/702d7e042eec94e801ded1c7a09dabe677868b3e/blank.gif"),value:null,owner:null,formatter:null,contentValueKey:null,imageMargin:2,imageView:SC.ImageView.extend({sizeToFit:function(){if(this.get("status")!="loaded"){return}var j=this.owner.get("frame");var g=this.owner.get("imageMargin");j.width-=g*2;j.height-=g*2;var a=this.get("imageWidth");var d=this.get("imageHeight");var c=(j.width/a);var b=(j.height/d);var e=(b<c)?b:c;a=a*e;d=d*e;var j=this.owner.get("frame");var k={width:a,height:d,x:Math.floor((j.width-a)/2),y:Math.floor((j.height-d)/2)};if(!SC.rectsEqual(k,this.get("frame"))){this.set("frame",k)}}.observes("status")}).outletFor("img?"),outlets:["imageView"],resizeChildrenWithOldSize:function(){if(this.get("content")){this.outlet("imageView").sizeToFit()}},_valueDidChange:function(){var d=this.get("value");var a=this.get("owner");var b=this.getDelegateProperty(this.displayDelegate,"formatter");if(b){var c=($type(b)==T_FUNCTION)?b(d,this):b.fieldValueForObject(d,this);if(c!=null){d=c}}if(d!=null&&d.toString){d=d.toString()}this.outlet("imageView").set("value",d)}.observes("value")});require("core");require("views/view");require("mixins/control");require("mixins/inline_editor_delegate");SC.LIST_ITEM_ACTION_CANCEL="sc-list-item-cancel-action";SC.LIST_ITEM_ACTION_REFRESH="sc-list-item-cancel-refresh";SC.LIST_ITEM_ACTION_EJECT="sc-list-item-cancel-eject";SC.ListItemView=SC.View.extend(SC.Control,SC.InlineEditorDelegate,{emptyElement:'<div class="sc-list-item-view sc-collection-item"></div>',content:null,hasContentIcon:NO,hasContentBranch:NO,contentCheckboxKey:null,contentIconKey:null,contentValueKey:null,contentUnreadCountKey:null,contentIsBranchKey:null,isEditing:NO,contentPropertyDidChange:function(){if(this.get("isEditing")){this.discardEditing()}this.render()},render:function(){var e=[];var j=this.get("content");var q=this.displayDelegate;var m=this.getDelegateProperty(q,"contentCheckboxKey");if(m){var h=(j&&j.get)?j.get(m):false;e.push(this.renderCheckboxHtml(h))}if(this.getDelegateProperty(q,"hasContentIcon")){var o=this.getDelegateProperty(q,"contentIconKey");var k=(o&&j&&j.get)?j.get(o):null;e.push(this.renderIconHtml(k))}var b=this.getDelegateProperty(q,"contentValueKey");var l=(b&&j&&j.get)?j.get(b):null;e.push(this.renderLabelHtml(l));var a=this.getDelegateProperty(q,"contentUnreadCountKey");var g=(a&&j&&j.get)?j.get(a):null;if((g!=null)&&(g!=0)){e.push(this.renderCountHtml(g))}var r=this.getDelegateProperty(q,"listItemActionProperty");var d=(r&&j&&j.get)?j.get(r):null;if(d){e.push(this.renderActionHtml(d))}this.setClassName("sc-has-action",d);if(this.getDelegateProperty(q,"hasContentBranch")){var c=this.getDelegateProperty(q,"contentIsBranchKey");var p=(c&&j&&j.get)?j.get(c):false;e.push(this.renderBranchHtml(p));this.setClassName("sc-has-branch",true)}else{this.setClassName("sc-has-branch",false)}e=e.join("");if(e!=this._lastRenderedHtml){this._lastRenderedHtml=e;this.set("innerHTML",e)}},renderCheckboxHtml:function(b){var a;if(b===SC.MIXED_STATE){a=SC.ListItemView._mixedCheckboxHtml;if(!a){a=SC.CheckboxView.prototype.emptyElement;a=a.replace('class="','class="mixed ');SC.ListItemView._mixedCheckboxHtml=a}}else{if(b){a=SC.ListItemView._selectedCheckboxHtml;if(!a){a=SC.CheckboxView.prototype.emptyElement;a=a.replace('class="','class="sel ');SC.ListItemView._selectedCheckboxHtml=a}}else{a=SC.ListItemView._normalCheckboxHtml;if(!a){a=SC.CheckboxView.prototype.emptyElement;SC.ListItemView._normalCheckboxHtml=a}}}return a},renderIconHtml:function(d){var b=[];var a=null,c=null;if(d&&SC.ImageView.valueIsUrl(d)){a=d;c=""}else{c=d;a="/beta/sproutcore/en/702d7e042eec94e801ded1c7a09dabe677868b3e/blank.gif"}b.push('<img class="sc-icon ');b.push(c||"");b.push('" src="');b.push(a||"/beta/sproutcore/en/702d7e042eec94e801ded1c7a09dabe677868b3e/blank.gif");b.push('" />');b=b.join("");return b},renderLabelHtml:function(a){var b=[];b.push('<span class="sc-label">');b.push(a||"");b.push("</span>");return b.join("")},findLabelElement:function(){return this.$class("sc-label")},renderCountHtml:function(b){var a=[];a.push('<span class="sc-count"><span class="inner">');a.push(b.toString());a.push("</span></span>");return a.join("")},renderActionHtml:function(b){var a=[];a.push('<img src="');a.push("/beta/sproutcore/en/702d7e042eec94e801ded1c7a09dabe677868b3e/blank.gif");a.push('" class="sc-action" />');return a.join("")},renderBranchHtml:function(a){var b=[];b.push('<span class="sc-branch ');b.push(a?"sc-branch-visible":"sc-branch-hidden");b.push('">&nbsp;</span>');return b.join("")},_isInsideElementWithClassName:function(e,b){var d=Event.element(b);var a=this.rootElement;var c=NO;while(!c&&d&&(d!==a)){if(Element.hasClassName(d,e)){c=YES}d=d.parentNode}a=d=null;return c},mouseDown:function(b){var a=this.displayDelegate;var c=this.getDelegateProperty(a,"contentCheckboxKey");if(c){if(this._isInsideElementWithClassName("sc-checkbox-view",b)){this._addCheckboxActiveState();this._isMouseDownOnCheckbox=YES;this._isMouseInsideCheckbox=YES;return true}}return false},mouseUp:function(b){var c=NO;if(this._isMouseDownOnCheckbox){if(this._isMouseInsideCheckbox){var a=this.displayDelegate;var e=this.getDelegateProperty(a,"contentCheckboxKey");var d=this.get("content");if(d&&d.get){var g=d.get(e);g=(g===SC.MIXED_STATE)?YES:!g;d.set(e,g)}}this._removeCheckboxActiveState();c=YES}this._isMouseInsideCheckbox=this._isMouseDownOnCheckbox=NO;return c},mouseOut:function(a){if(this._isMouseDownOnCheckbox){this._removeCheckboxActiveState();this._isMouseInsideCheckbox=NO}return NO},mouseOver:function(a){if(this._isMouseDownOnCheckbox){this._addCheckboxActiveState();this._isMouseInsideCheckbox=YES}return NO},_addCheckboxActiveState:function(){var a=this.$sel(".sc-checkbox-view");if(this.get("isEnabled")){Element.addClassName(a,"active")}a=null},_removeCheckboxActiveState:function(){var a=this.$sel(".sc-checkbox-view");Element.removeClassName(a,"active");a=null},contentHitTest:function(b){var a=this.displayDelegate;var c=this.getDelegateProperty(a,"contentValueKey");if(!c){return NO}var d=this.findLabelElement();if(!d){return NO}var e=Event.element(b);while(e&&(e!=(this.rootElement))&&(e!=window)){if(e===d){return YES}e=e.parentNode}return NO},beginEditing:function(){if(this.get("isEditing")){return YES}var h=this.get("content");var l=this.displayDelegate;var d=this.getDelegateProperty(l,"contentValueKey");var k=(d&&h&&h.get)?h.get(d):null;var e=this.get("frame");var a=this.findLabelElement();if(!a){return NO}var c=Element.getStyle(a,"lineHeight");var o=parseInt(Element.getStyle(a,"fontSize"),0);var j=parseInt(c,0);var m=0;if(o&&j){var b=o*1.5;if(b<j){Element.setStyle(a,{lineHeight:"1.5"});m=(j-b)/2}else{c=null}}e.x+=a.offsetLeft;e.y+=a.offsetTop+m-2;e.height=a.offsetHeight;e.width=(e.width-30-a.offsetLeft);e=this.convertFrameToView(e,null);var g=SC.InlineTextFieldView.beginEditing({frame:e,exampleElement:a,delegate:this,value:k});if(c){Element.setStyle(a,{lineHeight:c})}return g},commitEditing:function(){if(!this.get("isEditing")){return YES}return SC.InlineTextFieldView.commitEditing()},discardEditing:function(){if(!this.get("isEditing")){return YES}return SC.InlineTextFieldView.discardEditing()},inlineEditorWillBeginEditing:function(a){this.set("isEditing",YES)},inlineEditorDidBeginEditing:function(b){var a=this.findLabelElement();this._oldOpacity=Element.getStyle(a,"opacity");Element.setStyle(a,{opacity:0})},inlineEditorShouldEndEditing:function(a,b){return YES},inlineEditorDidEndEditing:function(c,e){this.set("isEditing",NO);var d=this.get("content");var a=this.displayDelegate;var b=this.getDelegateProperty(a,"contentValueKey");if(b&&d&&d.set){d.set(b,e)}this._lastRenderedHtml=null;this.render()}});require("core");SC.runLoop=SC.Object.create({maxRunTime:3000,notifyObserver:function(c,b,a){if(!this._notifications){this._notifications=[]}this._notifications.push({target:c,action:b,args:a})},deliverNotifications:function(){if(!this._notifications||this._notifications.length<=0){return}if(this._notifying){return}this._notifying=YES;var e=this.get("startTime");var a=e+this.get("maxRunTime");var d=0;while((Date.now()<a)&&(d<this._notifications.length)){var c=this._notifications[d];this._notifications[d]=null;d++;if(c){var b=c.args;c.action.call(c.target,b[0],b[1],b[2],b[3])}}if(d>=this._notifications.length){this._notifications=[]}else{this.invokeLater(this.deliverNotifications)}this._notifying=NO},beginRunLoop:function(){this._start=Date.now()},endRunLoop:function(){this._flushExpiredTimers();this._start=null},startTime:function(){if(!this._start){this._start=Date.now()}return this._start}.property(),scheduleTimer:function(e,b){if(!e){throw"scheduleTimer requires a timer"}if(!this._timers){this._timers={}}var a=SC.guidFor(e);var c=this._timers[a];if(c){if(c.prev){c.prev.next=c.next}if(c.next){c.next.prev=c.prev}c.next=c.prev=null;c.at=b}else{c=this._timers[a]={timer:e,at:b,guid:a,next:null,prev:null}}var d=this._next;if(!d||d.at>b){this._next=c;c.next=d;if(d){d.prev=c.next}this._rescheduleTimeout()}else{while(d.next&&d.next.at<=b){d=d.next}c.next=d.next;if(d.next){d.next.prev=c}d.next=c;c.prev=d}},cancelTimer:function(c){if(!c){return}if(!this._timers){this._timers={}}var a=SC.guidFor(c);var b=this._timers[a];if(b){if(b.next){b.next.prev=b.prev}if(b.prev){b.prev.next=b.next}if(this._next===b){this._next=b.next;this._rescheduleTimeout()}b.next=b.prev=b.timer=null}},timerPausedStateDidChange:function(a){this._rescheduleTimeout()},_rescheduleTimeout:function(){if(this._flushing){return}if(!this._timers){this._timers={}}var b=this._next;while(b&&(!b.timer||b.timer.get("isPaused"))){b=b.next}if(!b){this._timeoutAt=0;if(this._timeout){clearTimeout(this._timeout)}this._timeout=null}else{if((this._timeoutAt===0)||(b.at!==this._timeoutAt)){if(this._timeout){clearTimeout(this._timeout)}var a=Math.max(b.at-Date.now(),0);this._timeout=setTimeout(this._timeoutAction,a);this.timeoutAt=b.at}}},_timeoutAction:function(){var a=SC.runLoop;a._timeout=null;a._timeoutAt=0;a.beginRunLoop();a._flushExpiredTimers();a.endRunLoop()},_flushExpiredTimers:function(){if(!this._timers){this._timers={}}var c=this.get("startTime");var a=c+this.get("maxRunTime");this._flushing=YES;var e={};var g=this._next;while(g&&(g.at<=c)&&(Date.now()<a)){var b=SC.guidFor(g.timer);if(e[b]){g=g.next}else{var d=g.next;if(this._next===g){this._next=g.next}if(g.next){g.next.prev=g.prev}if(g.prev){g.prev.next=g.next}delete this._timers[g.guid];e[b]=YES;if(g.timer){g.timer.fire()}g.next=g.prev=g.timer=null;g=d}}this._flushing=NO;this._rescheduleTimeout()}});SC.Toolbar=SC.View.extend({buttons:[],isEnabled:true,init:function(){arguments.callee.base.call(this);var a=this;this.buttons=this.buttons.map(function(b){return b(a)})},isEnabledObserver:function(){var a=this.get("isEnabled");this.get("buttons").each(function(b){b.set("isEnabled",a)})}.observes("isEnabled")});require("controllers/controller");require("mixins/array");require("mixins/selection_support");require("foundation/binding");SC.ArrayController=SC.Controller.extend(SC.Array,SC.SelectionSupport,{useControllersForContent:NO,arrangedObjects:function(){return this}.property("content"),content:null,contentBindingDefault:SC.Binding.Multiple,hasContent:function(){return this.get("content")!=null}.property("content"),destroyOnRemoval:NO,exampleContentObject:null,newObject:function(b,a){return this.insertNewObjectAt(null,b,a)},insertNewObjectAt:function(c,b,a){if(!a){a=this.get("exampleContentObject")}if($type(a)===T_STRING){a=SC.Object.objectForPropertyPath(a)}if(a==null){throw"Invalid object type was provided"}if($type(a.newObject)!==T_FUNCTION){throw"content object type does not support newRecord()"}var d=a.newObject(b);if(!this._createdObjects){this._createdObjects=[]}this._createdObjects.push(d);if(c){this.insertAt(c,d)}else{this.pushObject(d)}return d},_contentObserver:function(){var c=this.get("content");if(SC.isEqual(c,this._content)){return}if(!this._boundContentPropertyObserver){this._boundContentPropertyObserver=this._contentPropertyObserver.bind(this)}var b=this._boundContentPropertyObserver;if(this._content&&this._content.removeObserver){this._content.removeObserver("[]",b)}if(c&&c.addObserver){c.addObserver("[]",b)}this._content=c;this._contentPropertyRevision=null;var a=(c)?c.propertyRevision:-1;this._contentPropertyObserver(this,"[]",c,a)}.observes("content"),_contentPropertyObserver:function(d,b,c,a){if(!this._updatingContent&&(!a||(a!=this._contentPropertyRevision))){this._contentPropertyRevision=a;this._updatingContent=true;this.beginPropertyChanges();this.contentCloneReset();this.enumerableContentDidChange();this.notifyPropertyChange("length");this.updateSelectionAfterContentChange();this.endPropertyChanges();this._updatingContent=false}},contentClone:null,contentCloneReset:function(){this._changelog=[];this.set("contentClone",null)},replace:function(a,j,h){var g=this.get("content");var b=h.length;var e=h;if(b>0){e=[];while(--b>=0){e[b]=this._sourceObjectFor(h[b])}}var d=this.get("contentClone");if(!d){this.set("contentClone",d=g.clone())}if(this.get("destroyOnRemoval")){if(!this._deletions){this._deletions=[]}for(var c=0;c<j;c++){this._deletions.push(g.objectAt(a+c))}}if(!this._changelog){this._changelog=[]}this._changelog.push({idx:a,amt:j,objects:e});d.replace(a,j,e);this.editorDidChange();this.enumerableContentDidChange();this.updateSelectionAfterContentChange();return this},objectAt:function(a){var b=this._getSourceContent();b=(b&&b.objectAt)?b.objectAt(a):null;return this._objectControllerFor(b)},length:function(b,c){var a=this._getSourceContent();return(a&&a.get)?(a.get("length")||0):0}.property(),indexOf:function(a){return this._getSourceContent().indexOf(this._sourceObjectFor(a))},_getSourceContent:function(){return this.get("contentClone")||this.get("content")||[]},performCommitChanges:function(){var e=this.get("content");var c=true;if(!e){return $error("No Content")}if(e.beginPropertyChanges){e.beginPropertyChanges()}if(this._changelog){var d=this._changelog;var b=d.length;for(var a=0;a<b;a++){var h=d[a];e.replace(h.idx,h.amt,h.objects)}this._changelog.length=0}if(this.get("destroyOnRemoval")&&this._deletions&&this._deletions.length>0){var a=this._deletions.length;while(--a>=0){var g=this._deletions[a];if(g&&g.destroy&&(e.indexOf(g)<0)){g.destroy()}}this._deletions.length=0}if(this._createdObjects){this._createdObjects.length=0}if(e.endPropertyChanges){e.endPropertyChanges()}if(e.commitChanges){c=e.commitChanges()}if($ok(c)){this.contentCloneReset();this.editorDidClearChanges()}return c},performDiscardChanges:function(){this.contentCloneReset();this.editorDidClearChanges();if(this._createdObjects&&this._createdObjects.length>0){var a=this._createdObjects.length;while(--a>=0){var b=this._createdObjects[a];if($type(b.destroy)===T_FUNCTION){b.destroy()}}this._createdObjects.length=0}return true},_objectControllerFor:function(d){if(!this.useControllersForContent){return d}var c=this._objControllers=this._objControllers||{};var b=SC.getGUID(d);var a=c[b];if(!a){a=c[b]=this.controllerForValue(d);if(a){a.__isArrayController=true}}return a},_sourceObjectFor:function(a){return(a&&a.kindOf&&a.kindOf(SC.Controller))?a.get("content"):a},init:function(){arguments.callee.base.apply(this,arguments);if(this.get("content")){this._contentObserver()}}});require("views/view");require("views/button/button");require("views/field/text_field");SC.FormView=SC.View.extend({content:null,contentBindingDefault:SC.Binding.Single,isDirty:false,isCommitting:true,isEnabled:true,passThroughToContent:false,isValid:function(){return this.get("errors").length==0}.property("errors"),canCommit:function(){return this.get("isValid")&&this.get("isEnabled")}.property("isValid","isEnabled"),generalErrors:null,errors:function(){if(!this._fields){return[]}if(!this._errors){var a=this;this._errors=[];this.get("fieldKeys").each(function(b){var c=a.get(b);if($type(c)==T_ERROR){a._errors.push(c)}})}return this._errors.concat(this.get("generalErrors")||[])}.property("generalErrors"),fieldKeys:function(){if(!this._fieldKeys&&this._fields){var b=[];for(var a in this._fields){if(!this._fields.hasOwnProperty(a)){continue}b.push(a)}this._fieldKeys=b}return this._fieldKeys}.property(),validate:function(){if(!this._fields){return true}for(var a in this._fields){if(this._fields.hasOwnProperty(a)){var b=this._fields[a];if(b.validateSubmit){b.validateSubmit()}}}return this.get("isValid")},commit:function(){if(!this.validate()){return false}var a=true;var b=this.get("content");if(!b||!this._fields){return}var c=this.get("isEnabled");this.beginPropertyChanges();this.set("isEnabled",false);this.set("isCommitting",true);this.endPropertyChanges();a=this.get("passThroughToContent")?this._commitChanges():this._copyContentAndCommitChanges();this.beginPropertyChanges();this.set("isCommitting",false);this.set("isEnabled",c);this.endPropertyChanges();return a},_copyContentAndCommitChanges:function(){var a=true;var c=this.get("content");if(!c||!this._fields){return false}try{c.beginPropertyChanges();for(var b in this._fields){if(b.match(/Button$/)){continue}if(this._fields.hasOwnProperty(b)){var g=this.get(b);c.set(b,g)}}c.endPropertyChanges();a=this._commitChanges();this.set("isDirty",!a)}catch(d){console.log("commit() exception: "+d);a=false}return a},_commitChanges:function(){var a=this.get("content");var b=false;if(a&&a.commit){b=a.commit(this)}else{if(a&&a.commitChanges){b=a.commitChanges()}}return b},reset:function(){if(!this._fields){return}var b=this.get("content");if(b&&b.discardChanges){b.discardChanges()}this.beginPropertyChanges();for(var a in this._fields){if(this._fields.hasOwnProperty(a)){var c=(b)?b.get(a):null;this.set(a,c)}}this.set("isDirty",false);this.endPropertyChanges()},rebuildFields:function(){this.beginPropertyChanges();if(this._fields){for(var a in this._fields){if(this._fields.hasOwnProperty(a)){this.removeField(a)}}}this._fields={};this._buttons={};this._values={};this._rebuildFieldsForNode(this,true);this.endPropertyChanges()},addField:function(a,c){if(this[a]!==undefined){throw"FormView cannot add the field '%@' because that property already exists.  Try using another name.".fmt(a)}var b=this;if(a=="submitButton"&&(c.action==SC.ButtonView.prototype.action)){c.action=function(){b.commit()}}if(a=="resetButton"&&(c.action==SC.ButtonView.prototype.action)){c.action=function(){b.reset()}}this._fields[a]=c;if(a.substr(-6,6)=="Button"){this._buttons[a]=c}this.propertyWillChange(a);this.setValueForField(a,c.get("value"));this.propertyDidChange(a,this.getValueForField(a));c.addObserver("value",this._fieldValueObserver_b());c.set("ownerForm",this);this.propertyWillChange("fieldKeys");this._fieldKeys=null;this.propertyDidChange("fieldKeys",null)},removeField:function(a){var b=this._fields[a];if(b){b.removeObserver("value",this._fieldValueObserver_b());b.set("ownerForm",null)}this.propertyWillChange(a);delete this._fields[a];delete this._values[a];delete this._buttons[a];this.propertyDidChange(a,null);this.propertyWillChange("fieldKeys");this._fieldKeys=null;this.propertyDidChange("fieldKeys",null)},getField:function(a){return this._fields[a]},keyDown:function(a){return this.interpretKeyEvents(a)},keyUp:function(){},insertNewline:function(c,a){var b=this._findDefaultButton(this);if(!b&&this._fields&&this._fields.submitButton){b=this._fields.submitButton}if(b&&b.triggerAction){b.triggerAction(a)}return true},_findDefaultButton:function(a){if(a.triggerAction&&a.get("isDefault")){return a}a=a.firstChild;while(a){var b=this._findDefaultButton(a);if(b){return b}a=a.nextSibling}return null},unknownProperty:function(c,e){var g=(this._fields)?this._fields[c]:null;if(e!==undefined){if(g){var b=this.getValueForField(c);this.setValueForField(c,e);g.set("value",e);var d=$type(b)==T_ERROR;var a=$type(e)==T_ERROR;if(d!=a){this.propertyWillChange("errors");this._errors=null;this.propertyDidChange("errors",null)}}else{this[c]=e}}else{if(g){if(this.getValueForField(c)===undefined){this.setValueForField(c,g.get("value"))}return this.getValueForField(c)}}return e},getValueForField:function(a){if(this.get("passThroughToContent")){var b=this.get("content");return(b&&b.get)?b.get(a):undefined}else{return this._values[a]}},setValueForField:function(a,c){if(this.get("passThroughToContent")){var b=this.get("content");if(b&&b.get&&b.set&&(b.get(a)!==c)){b.set(a,c)}}else{this._values[a]=c}return c},init:function(){arguments.callee.base.apply(this,arguments);if(this.rootElement&&this.rootElement.tagName.toLowerCase()=="form"){this.rootElement.onsubmit=function(){return false}}this.rebuildFields()},_rebuildFieldsForNode:function(c,b){if(c.fieldKey){this.addField(c.fieldKey,c)}if((b!=true)&&(c instanceof SC.FormView)){return}var a=(c.childNodesForFormField)?c.childNodesForFormField():c.get("childNodes");var d=a.length;while(--d>=0){c=a[d];this._rebuildFieldsForNode(c,false)}},_fieldValueObserver:function(g,c,e){if(!(c=g.fieldKey)){return}var b=this.getValueForField(c);if(b==e){return}this.beginPropertyChanges();this.propertyWillChange(c);this.setValueForField(c,e);this.propertyDidChange(c,e);var d=$type(b)==T_ERROR;var a=$type(e)==T_ERROR;if(d!=a){this.propertyWillChange("errors");this._errors=null;this.propertyDidChange("errors",null)}if(!this.get("isDirty")){this.set("isDirty",true)}this.endPropertyChanges()},_fieldValueObserver_b:function(){return this._bound_fieldValueObserver=(this._bound_fieldValueObserver||this._fieldValueObserver.bind(this))},_contentPropertyObserver:function(c,b,d){if(!this._fields||!c){return}var a=this._fields;if(a[b]&&c.didChangeFor(this,b)){this.set(b,d)}else{if(b=="*"){for(var b in a){if(a.hasOwnProperty(b)&&c.didChangeFor(this,b)){this.set(b,c.get(b))}}}}},_contentPropertyObserver_b:function(){return this._bound_contentPropertyObserver=(this._bound_contentPropertyObserver||this._contentPropertyObserver.bind(this))},_isEnabledObserver:function(){var a=this._fields;if(!a){return}var b=this.get("isEnabled");var d=this.get("canCommit");for(var c in a){if(a.hasOwnProperty(c)){var e=a[c];if(e.set){if(c=="submitButton"){e.set("isEnabled",d)}else{e.set("isEnabled",b)}}}}}.observes("isEnabled"),_contentObserver:function(){var b=this.get("content");if(b==this._content){return}var a=this._contentPropertyObserver_b();if(this._content){this._content.removeObserver("*",a)}this._content=b;if(!b){return}b.addObserver("*",a);this.reset()}.observes("content"),_canCommitObserver:function(){var c=this._buttons;var b=this.get("canCommit");if(c&&c.submitButton){var a=c.submitButton;if(a.set){a.set("isEnabled",b)}}}.observes("canCommit")});require("views/button/button");SC.RadioView=SC.ButtonView.extend({emptyElement:'<a href="javascript:;" class="sc-radio-view sc-button-view button radio"><img src="%@" class="button" /><span class="label"></span></a>'.fmt("/beta/sproutcore/en/702d7e042eec94e801ded1c7a09dabe677868b3e/blank.gif"),buttonBehavior:SC.TOGGLE_ON_BEHAVIOR});require("models/record");require("models/store");SC.Collection=SC.Object.extend({orderBy:["guid"],limit:0,offset:0,conditions:{},records:function(){if(this._changedRecords){this._flushChangedRecords()}return this._records}.property(),count:function(a,b){if(b!==undefined){this._count=b}else{if(this._changedRecords){this._flushChangedRecords()}}return this._count||0}.property(),isDeleted:false,dataSource:SC.Store,recordType:SC.Record,isLoading:false,isDirty:false,refresh:function(){var c=this.get("recordType")||SC.Record;var b=(this._limit>0)?this._offset:0;if(!this._boundRefreshFunc){this._boundRefreshFunc=this._refreshDidComplete.bind(this)}if(!this.dataSource){throw"collection does not have dataSource"}this.beginPropertyChanges();if(!this.isLoading){this.set("isLoading",true)}this._refreshing=true;var a=this.get("orderBy");if(a&&!(a instanceof Array)){a=[a]}this.dataSource.listFor({recordType:c,offset:b,limit:this._limit,conditions:this.get("conditions"),order:a,callback:this._boundRefreshFunc,cacheCode:this._cacheCode});this.endPropertyChanges();return this},destroy:function(){SC.Store.removeCollection(this);return this},newRecord:function(b){if(!b){b={}}b.newRecord=true;b.dataSource=this.get("dataSource");var a=this.recordType.create(b);SC.Store.addRecord(a);return a},removeRecords:function(b){b=$A(arguments).flatten();for(var a=0;a<b.length;a++){b[a].destroy()}},_offset:0,_limit:0,_records:null,_members:null,_store:null,init:function(){arguments.callee.base.call(this);SC.Store.addCollection(this);this._computeInteralOffsetAndLimit()},_refreshDidComplete:function(b,c,a){if(a){this._cacheCode=a}if(b){this.beginPropertyChanges();if(this.get("count")!=c){this.set("count",c)}this.propertyWillChange("records");b=this._store=b.slice();this._reslice();this.propertyDidChange("records");this.endPropertyChanges()}this._refreshing=false},recordDidChange:function(a){if(!a&&!a._guid){return}if(!this._changedRecords){this._changedRecords={}}this._changedRecords[a._guid]=a;this.propertyWillChange("records");this.propertyDidChange("records");this.propertyWillChange("count");this.propertyDidChange("count")},_flushChangedRecords:function(){if(!this._changedRecords){return}if(this.dataSource!=SC.Store){throw"non-local data source is not supported"}var j=this._store||[];var b=this.get("orderBy")||[this.recordType.primaryKey()];if(!(b instanceof Array)){b=[b]}var o=this.get("conditions");var a=[];var e=this._changedRecords;for(var k in e){if(!e.hasOwnProperty(k)){continue}a.push(e[k])}a=a.sort(function(r,q){return r.compareTo(q,b)});this._changedRecords=null;var g=0;while(g<j.length){var p=j[g];var h,m;if(e[p._guid]){var l=(!p.get("isDeleted"))&&p.matchConditions(o);if(l){if(g>0){l=(p.compareTo(j[g-1],b)>=0)}if(l&&(g+1<j.length)){l=(p.compareTo(j[g+1],b)<=0)}}if(!l){j.splice(g,1);continue}}var c=true;while((a.length>0)&&c){var d=a[0];if((d!=p)&&!d.get("isDeleted")&&d.matchConditions(o)){if(d.compareTo(p,b)<0){j.splice(g,0,d);g++}else{c=false}}if(c){a.shift()}}g++}while(a.length>0){var d=a.shift();if(!d.get("isDeleted")&&d.matchConditions(o)){j.push(d)}}this._store=j;this._count=j.length;this._reslice()},propertyObserver:function(j,h,c,d){if(h!=this){return}var b=false;var a;d=this.get(c);switch(c){case"offset":case"limit":var g=this._offset;var e=this._limit;this._computeInteralOffsetAndLimit();if((this._offset==g)&&(this._limit==e)){this.propertyWillChange("records");this._reslice();this.propertyDidChange("records")}else{b=true}break;case"conditions":case"orderBy":b=true;break;default:break}if(b&&!this._refreshing){this._refreshing=true;this._cacheCode=null;this.set("isLoading",true);this.invokeLater(this.refresh)}},_computeInteralOffsetAndLimit:function(){if(this.dataSource!=SC.Store){var a;this._offset=((a=this.get("offset"))>this.MARGIN)?(a-this.MARGIN):0;this._limit=((a=this.get("limit"))>0)?(a+this.MARGIN):0}else{this._offset=this._limit=0}},_reslice:function(){var c=this.get("offset");var b=this.get("limit");if((c>0)||(b>0)){var d=c-this._offset;var a=d+((b<=0)?(this._store||[]).length:b);this._records=this._store.slice(d,a)}else{this._records=this._store}},MARGIN:10});require("views/collection/collection");require("views/label");require("views/list_item");SC.ListView=SC.CollectionView.extend({emptyElement:'<div class="list-view"></div>',rowHeight:20,exampleView:SC.ListItemView,insertionOrientation:SC.VERTICAL_ORIENTATION,contentRangeInFrame:function(e){var d=this.get("rowHeight")||0;var c=Math.max(0,Math.floor(SC.minY(e)/d)-1);var a=Math.ceil(SC.maxY(e)/d);var b={start:c,length:a-c};return b},layoutItemView:function(a,g,e){var c=this.get("rowHeight")||0;var b=a.get("parentView");var d={x:0,y:g*c,height:c,width:(b||this).get("innerFrame").width};if(e||!SC.rectsEqual(a.get("frame"),d)){a.set("frame",d);a.setStyle({zIndex:g.toString()})}},computeFrame:function(){var c=this.get("content");var e=(c)?c.get("length"):0;var b=this.get("rowHeight")||20;var a=this.get("parentNode");var d=(a)?a.get("innerFrame"):{width:100,height:100};d.x=d.y=0;d.height=Math.max(d.height,e*b);return d},insertionPointClass:SC.View.extend({emptyElement:'<div class="list-insertion-point"><span class="anchor"></span></div>'}),showInsertionPoint:function(b,c){if(!b){return}if(c===SC.DROP_ON){if(b!==this._dropOnInsertionPoint){this.hideInsertionPoint();b.addClassName("drop-target");this._dropOnInsertionPoint=b}}else{if(this._dropOnInsertionPoint){this._dropOnInsertionPoint.removeClassName("drop-target");this._dropOnInsertionPoint=null}if(!this._insertionPointView){this._insertionPointView=this.insertionPointClass.create()}var a=this._insertionPointView;f={height:0,x:8,y:b.get("frame").y,width:b.owner.get("frame").width};a.set("frame",f);if(a.parentNode!=b.parentNode){b.parentNode.appendChild(a)}}},hideInsertionPoint:function(){var a=this._insertionPointView;if(a){a.removeFromParent()}if(this._dropOnInsertionPoint){this._dropOnInsertionPoint.removeClassName("drop-target");this._dropOnInsertionPoint=null}},insertionIndexForLocation:function(c,j){var d=this.get("innerFrame");var e=this.get("scrollFrame");var a=this.get("rowHeight")||0;var b=c.y-d.y-e.y;var g=SC.DROP_BEFORE;var h=Math.floor(b/this.get("rowHeight"));var k=(b/a)-h;if(j===SC.DROP_ON){if(k>0.8){h++}if((k>=0.2)&&(k<=0.8)){g=SC.DROP_ON}}else{if(k>0.45){h++}}return[h,g]}});require("core");SC.UndoManager=SC.Object.extend({undoActionName:function(){return(this.undoStack)?this.undoStack.name:null}.property("undoStack"),redoActionName:function(){return(this.redoStack)?this.redoStack.name:null}.property("redoStack"),canUndo:function(){return this.undoStack!=null}.property("undoStack"),canRedo:function(){return this.redoStack!=null}.property("redoStack"),undo:function(){this._undoOrRedo("undoStack","isUndoing")},redo:function(){this._undoOrRedo("redoStack","isRedoing")},isUndoing:false,isRedoing:false,groupingLevel:0,registerUndo:function(b,a){this.beginUndoGroup(a);this._activeGroup.actions.push(b);this.endUndoGroup(a)},beginUndoGroup:function(b){if(this._activeGroup){this.groupingLevel++}else{var a=(this.isUndoing)?"redoStack":"undoStack";this._activeGroup={name:b,actions:[],prev:this.get(a)};this.set(a,this._activeGroup);this.groupingLevel=1}},endUndoGroup:function(a){if(!this._activeGroup){raise("endUndoGroup() called outside group.")}if(this.groupingLevel>1){this.groupingLevel--}else{this._activeGroup=null;this.groupingLevel=0}this.propertyDidChange((this.isUndoing)?"redoStack":"undoStack")},setActionName:function(a){if(!this._activeGroup){raise("setActionName() called outside group.")}this._activeGroup.name=a},_activeGroup:null,undoStack:null,redoStack:null,_undoOrRedo:function(a,c){if(this._activeGroup){return false}if(this.get(a)==null){return true}this.set(c,true);var e=this.get(a);this.set(a,e.prev);var b;var d=e.actions.length>1;if(d){this.beginUndoGroup(e.name)}while(b=e.actions.pop()){b()}if(d){this.endUndoGroup(e.name)}this.set(c,false)}});require("foundation/object");SC.Error=SC.Object.extend({code:-1,description:"",label:null});SC.Error.desc=function(d,a,c){var b={description:d};if(a!==undefined){b.label=a}if(c!==undefined){b.code=c}return this.create(b)};SC.$error=function(b,a,d){return SC.Error.desc(b,a,d)};var $error=SC.$error;SC.$ok=function(a){return(a!==false)&&($type(a)!=T_ERROR)};var $ok=SC.$ok;SC.Error.HAS_MULTIPLE_VALUES=-100;require("views/view");require("mixins/delegate_support");require("mixins/control");require("views/button/disclosure");SC.SourceListGroupView=SC.View.extend(SC.Control,SC.DelegateSupport,{emptyElement:['<div class="sc-source-list-group">','<a href="javascript:;" class="sc-source-list-label sc-disclosure-view sc-button-view button disclosure no-disclosure">','<img src="%@" class="button" />'.fmt("/beta/sproutcore/en/702d7e042eec94e801ded1c7a09dabe677868b3e/blank.gif"),'<span class="label"></span></a>',"</div>"].join(""),content:null,isGroupVisible:YES,hasGroupTitle:YES,groupTitleKey:null,groupVisibleKey:null,contentPropertyDidChange:function(g,c){var e=this.get("content");var j=this.outlet("labelView");if(e==null){j.setIfChanged("isVisible",NO);this.setIfChanged("hasGroupTitle",NO);return}else{j.setIfChanged("isVisible",YES);this.setIfChanged("hasGroupTitle",YES)}var b=this.getDelegateProperty(this.displayDelegate,"groupTitleKey");if((c=="*")||(b&&(c==b))){var h=(e&&e.get&&b)?e.get(b):e;if(h!=this._title){this._title=h;if(h){h=h.capitalize()}j.set("title",h)}}var d=this.getDelegateProperty(this.displayDelegate,"groupVisibleKey");if((c=="*")||(d&&(c==d))){if(d){j.removeClassName("no-disclosure");var a=(e&&e.get)?!!e.get(d):YES;if(a!=this.get("isGroupVisible")){this.set("isGroupVisible",a);j.set("value",a)}}else{j.addClassName("no-disclosure")}}},disclosureValueDidChange:function(c){if(c==this.get("isGroupVisible")){return}var b=this.get("content");var a=this.getDelegateProperty(this.displayDelegate,"groupVisibleKey");if(b&&b.set&&a){b.set(a,c)}this.set("isGroupVisible",c);if(this.owner&&this.owner.updateChildren){this.owner.updateChildren(true)}},labelView:SC.DisclosureView.extend({value:YES,_valueObserver:function(){if(this.owner){this.owner.disclosureValueDidChange(this.get("value"))}}.observes("value")}).outletFor(".sc-source-list-label:1:1")});SC.Enumerator=function(a){this.enumerable=a;this.reset();return this};SC.Enumerator.prototype={nextObject:function(){var c=this._index;var a=this._length;if(c>=a){return undefined}var b=this.enumerable.nextObject(c,this._previousObject,this._context);this._previousObject=b;this._index=c+1;if(c>=a){this._context=SC.Enumerator._pushContext(this._context)}return b},reset:function(){var b=this.enumerable;if(!b){throw $error("Enumerator has been destroyed")}var a=this._length=(b.get)?b.get("length"):b.length;this._index=0;this._previousObject=null;this._context=(a>0)?SC.Enumerator._popContext():null},destroy:function(){this.enumerable=this._length=this._index=this._previousObject=this._context=null}};SC.Enumerator.create=function(a){return new SC.Enumerator(a)};SC.Enumerator._popContext=function(){var a=(this._contextCache)?this._contextCache.pop():null;return a||{}};SC.Enumerator._pushContext=function(b){var a=this._contextCache=this._contextCache||[];a.push(b);return null};require("validators/validator");SC.Validator.Email=SC.Validator.extend({validate:function(a,b){return(b.get("fieldValue")||"").match(/.+@.+\...+/)},validateError:function(b,c){var a=c.get("errorLabel")||"Field";return $error("Invalid.Email(%@)".loc(a),a)}});SC.Validator.EmailOrEmpty=SC.Validator.Email.extend({validate:function(a,c){var b=c.get("fieldValue");return(b&&b.length>0)?b.match(/.+@.+\...+/):true}});require("views/collection/collection");require("views/button/disclosure");require("views/source_list_group");require("views/list_item");SC.BENCHMARK_SOURCE_LIST_VIEW=NO;SC.SourceListView=SC.CollectionView.extend({emptyElement:'<div class="sc-source-list-view"></div>',contentValueKey:null,contentValueIsEditable:NO,selectOnMouseDown:NO,hasContentIcon:NO,hasContentBranch:NO,contentIconKey:null,contentUnreadCountKey:null,contentIsBranchKey:null,groupTitleKey:null,groupVisibleKey:null,rowHeight:32,exampleView:SC.ListItemView,exampleGroupView:SC.SourceListGroupView,updateChildren:function(a){if(a){this._groupRows=null}return arguments.callee.base.apply(this,arguments)},groupAtContentIndexIsVisible:function(e){if(!this.get("groupBy")){return YES}var a=this.groupValueAtContentIndex(e);var d=this.groupViewForGroupValue(a);var b=YES;if(d){b=d.get("isGroupVisible")}if(((b===undefined)||(b===null)||!d)&&a&&a.get){var c=this.get("groupVisibleKey");if(c){b=!!a.get(c)}}if((b===undefined)||(b===null)){b=YES}return b},computedGroupRows:function(){if(this._groupRows){return this._groupRows}var h=0;var g=Array.from(this.get("content"));var c=g.get("length");var e={};while(h<c){var d=this.groupRangeForContentIndex(h);var b=this.groupAtContentIndexIsVisible(d.start);e[d.start]=(b)?d.length:0;var a=this.groupValueAtContentIndex(d.start);if(a!=null){e[d.start]++}h=(d.length<=0)?c:SC.maxRange(d)}return this._groupRows=e},countRowsInRange:function(b){var d=this.computedGroupRows();var a=SC.maxRange(b);var e=SC.minRange(b);var c=0;while(e<a){var b=this.groupRangeForContentIndex(e);e=(b.length<=0)?a:SC.maxRange(b);c+=d[b.start]||(b+1)}return c},computeFrame:function(){var c=this.get("content");var b=this.get("rowHeight")||20;var e=this.countRowsInRange({start:0,length:c.get("length")});if(e<=0){e=0}var a=this.get("parentNode");var d=(a)?a.get("innerFrame"):{width:100,height:100};d.x=d.y=0;d.height=Math.max(d.height,e*b);return d},contentRangeInFrame:function(d){var c=this.get("content");var a=(c)?c.get("length"):0;var b={start:0,length:a};return b},layoutItemView:function(c,h,g){if(SC.BENCHMARK_SOURCE_LIST_VIEW){SC.Benchmark.start("SC.SourceListView.layoutItemViewsFor")}if(!this.groupAtContentIndexIsVisible(h)){c.set("isVisible",false)}else{if(!c.get("isVisible")){g=YES;c.set("isVisible",true)}var d=this.get("rowHeight")||0;if(this.get("groupBy")){var b=this.groupRangeForContentIndex(h);h=(h-b.start);var a=this.groupValueAtContentIndex(b.start);if(a!=null){h++}}var e={x:0,y:h*d,height:d,width:this.get("innerFrame").width};if(g||!SC.rectsEqual(c.get("frame"),e)){c.set("frame",e)}}if(SC.BENCHMARK_SOURCE_LIST_VIEW){SC.Benchmark.end("SC.SourceListView.layoutItemViewsFor")}},layoutGroupView:function(h,b,j,k){if(SC.BENCHMARK_SOURCE_LIST_VIEW){SC.Benchmark.start("SC.SourceListView.layoutGroupView")}var c=this.groupRangeForContentIndex(j);var d=this.groupAtContentIndexIsVisible(c.start);var e=this.countRowsInRange({start:0,length:c.start});var a=this.get("rowHeight")||0;var l=h.get("parentView")||this;var m=(d)?c.length:0;if(b!=null){m++}var g={x:0,y:e*a,height:a*m,width:(l||this).get("innerFrame").width};if(k||!SC.rectsEqual(h.get("frame"),g)){h.set("frame",g)}if(SC.BENCHMARK_SOURCE_LIST_VIEW){SC.Benchmark.end("SC.SourceListView.layoutGroupView")}},insertionOrientation:SC.VERTICAL_ORIENTATION,insertionPointClass:SC.View.extend({emptyElement:'<div class="list-insertion-point"><span class="anchor"></span></div>'}),showInsertionPoint:function(b,d){if(!b){return}if(d===SC.DROP_ON){if(b!==this._dropOnInsertionPoint){this.hideInsertionPoint();b.addClassName("drop-target");this._dropOnInsertionPoint=b}}else{if(this._dropOnInsertionPoint){this._dropOnInsertionPoint.removeClassName("drop-target");this._dropOnInsertionPoint=null}if(!this._insertionPointView){this._insertionPointView=this.insertionPointClass.create()}var a=this._insertionPointView;var c=this.calculateInsertionPointFrame(b);a.set("frame",c);if(a.parentNode!=b.parentNode){b.parentNode.appendChild(a)}}},calculateInsertionPointFrame:function(a){return{height:0,x:8,y:a.get("frame").y,width:a.owner.get("frame").width}},hideInsertionPoint:function(){var a=this._insertionPointView;if(a){a.removeFromParent()}if(this._dropOnInsertionPoint){this._dropOnInsertionPoint.removeClassName("drop-target");this._dropOnInsertionPoint=null}},insertionIndexForLocation:function(d,k){var e=this.get("innerFrame");var g=this.get("scrollFrame");var a=this.get("rowHeight")||0;var c=(this.get("groupBy"))?1:0;var b=d.y-e.y-g.y;var j=-1;var h=SC.DROP_BEFORE;var m=0;var o=0;while((j<0)&&(range=this.groupRangeForContentIndex(o)).length>0){var l=m+((range.length+c)*a);if(l>=b){b-=m;j=Math.floor(b/a);var p=(b/a)-j;if(k===SC.DROP_ON){if(p>0.8){j++}if((p>=0.2)&&(p<=0.8)){h=SC.DROP_ON}}else{if(p>0.45){j++}}if(j<c){return[-1,SC.DROP_BEFORE]}j=(j-c)+o}else{o+=range.length;m=l}}return[j,h]}});require("drag/drag");SC.DragSource={dragDidBegin:function(b,a){},dragDidEnd:function(c,b,a){},dragDidMove:function(b,a){},dragSourceOperationMaskFor:function(b,a){return SC.DRAG_NONE},ignoreModifierKeysWhileDragging:NO};require("views/field/field");SC.RadioFieldView=SC.FieldView.extend({emptyElement:"<div></div>",values:function(){if(!this._fields){return[]}return Object.keys(this._fields)}.property(),objects:null,setFieldValue:function(c){if(!this._fields){return}var b=this.get("objects");if(b){for(var a in b){if(!b.hasOwnProperty(a)){continue}if(b[a]==c){c=a;break}}}var d=this._fields[c];if(d){d.checked=true}else{for(var a in this._fields){if(!this._fields.hasOwnProperty(a)){continue}this._fields[a].checked=false}}},getFieldValue:function(){if(!this._fields){return null}var a=null;for(var b in this._fields){if(!this._fields.hasOwnProperty(b)){continue}if(this._fields[b].checked==true){a=b;break}}var c=this.get("objects");if(c&&a){a=c[a]}return a},enableField:function(){if(!this._fields){return}for(var a in this._fields){if(!this._fields.hasOwnProperty(a)){continue}Form.Element.enable(this._fields[a])}},disableField:function(){if(!this._fields){return}for(var a in this._fields){if(!this._fields.hasOwnProperty(a)){continue}Form.Element.disable(this._fields[a])}},init:function(){arguments.callee.base.apply(this,arguments);this._fields={};var a=this.$$tag("input");var b=this.fieldValueDidChange.bind(this,false);var d=a.length;this._fields={};while(--d>=0){var c=a[d];this._fields[c.value]=c;Event.observe(c,"change",b)}}});require("validators/validator");SC.Validator.CreditCard=SC.Validator.extend({fieldValueForObject:function(a,b,c){if(typeof(a)=="string"&&a.length==16){a=[a.slice(0,4),a.slice(4,8),a.slice(8,12),a.slice(12,16)].join(" ")}return a},objectForFieldValue:function(b,a,c){return b.replace(/[\s-\.\:]/g,"")},validate:function(a,b){return this.checkNumber(b.get("fieldValue"))},validateError:function(b,c){var a=c.get("errorLabel")||"Field";return $error("Invalid.CreditCard(%@)".loc(a),a)},checkNumber:function(k){var a="0123456789";var h=k.length;var g=parseInt(k,0);var m=k.toString();m=m.replace(/^\s+|\s+$/g,"");var l=0;var p=true;var b=false;var o;var d;for(var c=0;c<h;c++){o=""+m.substring(c,c+1);if(a.indexOf(o)=="-1"){p=false}}if(!p){b=false}if((h==0)&&(b)){b=false}else{if(h>=15){for(var e=h;e>0;e--){d=parseInt(g,0)%10;d=parseInt(d,0);l+=d;e--;g=g/10;d=parseInt(g,0)%10;d=d*2;switch(d){case 10:d=1;break;case 12:d=3;break;case 14:d=5;break;case 16:d=7;break;case 18:d=9;break;default:d=d}g=g/10;l+=d}if((l%10)==0){b=true}else{b=false}}}return b}});require("views/label");SC.ErrorExplanationView=SC.View.extend(SC.Control,{emptyElement:'<ul class="errors"></ul>',explanationTemplate:"<li>%@</li>",_errorsFor:function(a){if(!a||a.length==0){return[]}return a.map(function(b){return($type(b)==T_ERROR)?b:null}).compact()},valueBindingDefault:SC.Binding.Multiple,formatter:function(b,a){b=a._errorsFor(b);if(!b||b.length==0){return""}return b.map(function(c){c=c.get("description");if(c.escapeHTML){c=c.escapeHTML()}return a.explanationTemplate.fmt(c)}).join("")},escapeHTML:false,_valueObserver:function(){var b=this._errorsFor(this.get("value"));var a=b&&b.length>0;if(this.get("isVisible")!=a){this.set("isVisible",a)}this.set("innerHTML",this.formatter(b,this))}.observes("value"),init:function(){arguments.callee.base.apply(this,arguments);this._valueObserver()}});if(!Object.toJSONString){Array.prototype.toJSONString=function(){var e=["["],c,h,d=this.length,g;function j(a){if(c){e.push(",")}e.push(a);c=true}for(h=0;h<d;h+=1){g=this[h];switch(typeof g){case"object":if(g){if(typeof g.toJSONString==="function"){j(g.toJSONString())}else{j(Object.toJSONString(g))}}else{j("null")}break;case"string":case"number":case"boolean":j(g.toJSONString())}}e.push("]");return e.join("")};Boolean.prototype.toJSONString=function(){return String(this)};Date.prototype.toJSONString=function(){function a(b){return b<10?"0"+b:b}return'"'+this.getFullYear()+"-"+a(this.getMonth()+1)+"-"+a(this.getDate())+"T"+a(this.getHours())+":"+a(this.getMinutes())+":"+a(this.getSeconds())+'"'};Number.prototype.toJSONString=function(){return isFinite(this)?String(this):"null"};Object.toJSONString=function(h){var d=["{"],c,g,e;function j(a){if(c){d.push(",")}d.push(g.toJSONString(),":",a);c=true}for(g in h){if(h.hasOwnProperty(g)){e=h[g];switch(typeof e){case"object":if(e){if(typeof e.toJSONString==="function"){j(e.toJSONString())}else{j(Object.toJSONString(e))}}else{j("null")}break;case"string":case"number":case"boolean":j(e.toJSONString())}}}d.push("}");return d.join("")};(function(s){var m={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};s.parseJSON=function(filter){try{if(/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(this)){var j=eval("("+this+")");if(typeof filter==="function"){function walk(k,v){if(v&&typeof v==="object"){for(var i in v){if(v.hasOwnProperty(i)){v[i]=walk(i,v[i])}}}return filter(k,v)}j=walk("",j)}return j}}catch(e){}throw new SyntaxError("parseJSON")};s.toJSONString=function(){if(/["\\\x00-\x1f]/.test(this)){return'"'+this.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];if(c){return c}c=b.charCodeAt();return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16)})+'"'}return'"'+this+'"'}})(String.prototype)}require("views/view");require("views/container");SC.TAB_VIEW_TAB_REGEXP=/Tab$/;SC.TabView=SC.ContainerView.extend({nowShowing:"",lazyTabs:false,init:function(){arguments.callee.base.call(this);var g={};var e={};var h=this;var d=(this.outlets)?this.outlets.length:0;while(--d>=0){var k=this.outlets[d];if(k.match(SC.TAB_VIEW_TAB_REGEXP)){var j=k.slice(0,-3);var b=h.get(k);var c=h.get(j+"Button");if(b){var a=b.get("tabId")||j;g[a]=b;if(c){e[a]=c}if(b.removeFromParent){b.removeFromParent()}}}}this._tabs=g;this._buttons=e;this.nowShowingObserver()},nowShowingObserver:function(){var d=this.get("nowShowing");if(d==this._oldNowShowing){return}this._oldNowShowing=d;for(var a in this._tabs){var c=this._tabs[a];var b=this._buttons[a];if(a==d){if(b){b.set("isSelected",true)}}else{if(c){c.set("isVisible",false)}if(b){b.set("isSelected",false)}}}var e=this._tabs[d];if(!e&&this.get("lazyTabs")){this._tabs[d]=e=SC.page.get("%@Tab".fmt(d))}this.set("content",e);if(e){e.set("isVisible",true)}}.observes("nowShowing"),childNodesForFormField:function(){return Object.values(this._tabs||{})}});require("views/view");SC.RadioGroupView=SC.View.extend({value:null,isEnabled:true,init:function(){arguments.callee.base.apply(this,arguments);var e=this.outlets.length;var a=[];var d=[this,"value"];while(--e>=0){var c=this.outlets[e];var b=this[c];if(b&&(b.toggleOnValue!==undefined)){b.bind("value",d);a.push(b)}}this._radioButtons=a},_isEnabledObserver:function(){var a=this.get("isEnabled");if(!this.didChangeFor("_isEnabled","isEnabled")){return}if(this._radioButtons){this._radioButtons.invoke("set","isEnabled",a)}}.observes("isEnabled")});require("foundation/path_module");SC.Page=SC.Object.extend({get:function(b){var c=this[b];if(c&&(c instanceof Function)&&(c.isOutlet)){var a=this.outlet(b);if(SC.window&&!a.parentNode){SC.window._insertBefore(a,null,false);SC.window._rebuildChildNodes()}a.awake();return a}else{return arguments.callee.base.apply(this,arguments)}},awake:function(){arguments.callee.base.call(this);for(var a in this){if(this.hasOwnProperty(a)&&this[a]&&this[a].isOutlet){this.get(a)}}},init:function(){arguments.callee.base.apply(this,arguments);var a=this.rootElement=$("resources");SC.callOnLoad(function(){if(a&&a.parentNode){a.parentNode.removeChild(a)}a=null})},getIfConfigured:function(a){var b=this[a];if(b&&(b instanceof Function)&&(b.isOutlet)){return null}else{return b}},_insertBefore:function(){},_rebuildChildNodes:function(){}});Object.extend(SC.Page.prototype,SC.PathModule);require("views/view");require("mixins/control");SC.SliderView=SC.View.extend(SC.Control,{emptyElement:'<span class="sc-slider-view"><span class="inner"><img src="%@" class="sc-handle" /></span></span>'.fmt("/beta/sproutcore/en/702d7e042eec94e801ded1c7a09dabe677868b3e/blank.gif"),outlets:["handleElement"],handleElement:".sc-handle?",minimum:0,maximum:1,step:0.1,value:0.5,valueBindingDefault:SC.Binding.SingleNotEmpty,_valueDidChangeObserver:function(){if(!this.didChangeFor("value","value","minimum","maximum")){return}var b=this.get("minimum");var a=this.get("maximum");var g=this.get("value");var d=Math.min(Math.max(g,b),a);var c=this.get("step");if(c&&c!==0){d=Math.round(d/c)*c}if(Math.abs(g-d)>0.01){this.set("value",d)}g=d;g=(g-b)/(a-b);var e=this.get("innerFrame");g=Math.round((e.width-18)*g);g-=(39);Element.setStyle(this.handleElement,{left:"%@px".fmt(g)})}.observes("value","minimum","maximum"),mouseDown:function(b){this.recacheFrames();if(!this.get("isEnabled")){return true}this.addClassName("active");var g=this.convertFrameFromView(Event.pointerLocation(b),null).x;var e=this.get("innerFrame");g-=(e.x+9);var d=g/(e.width-18);var c=this.get("minimum");var a=this.get("maximum");d=(d*(a-c))+c;d=Math.min(Math.max(d,c),a);this.setIfChanged("value",d);return true},mouseDragged:function(a){return this.mouseDown(a)},mouseUp:function(a){this.removeClassName("active")}});require("panes/overlay");SC.PICKER_PANE="picker";SC.PickerPaneView=SC.OverlayPaneView.extend({emptyElement:'<div class="pane picker-pane"><div class="shadow pane-wrapper picker-pane-wrapper"><div class="pane-root"></div><div class="top-left-edge"></div><div class="top-edge"></div><div class="top-right-edge"></div><div class="right-edge"></div><div class="bottom-right-edge"></div><div class="bottom-edge"></div><div class="bottom-left-edge"></div><div class="left-edge"></div></div></div>',layer:300,isModal:false,positionPane:function(){var d=this.anchorView;var c=this.containerView;var a;if(d){a=c.convertFrameFromView(d.get("frame"),d);a.y+=a.height;a=this.fitPositionToScreen(a,c,d)}else{var b=SC.window.get("size");var e=c.get("size");a={};a.x=(b.width-e.width)/2;a.y=(b.height-e.height)/2}c.set("origin",a)}});require("views/button/button");SC.PopupButtonView=SC.ButtonView.extend({performKeyEquivalent:function(b,a){if(!this.get("isEnabled")){return false}if(arguments.callee.base.apply(this,arguments)){return true}var c=this.get("menu");return(!!c&&c.performKeyEquivalent(b,a))},menuName:null,menu:function(a,b){if(b!==undefined){b.set("isVisible",false);this.set("_menu",b)}if(!this._menu){var c=SC.page.get(this.get("menuName"));if(c){c.set("isVisible",false)}this.set("_menu",c)}return this._menu}.property(),isSelectedBinding:"*_menu.isVisible",action:function(a){var b=this.get("menu");if(!b){return false}if(!this._didFirstRun){b.popup(this,a);this._didFirstRun=true}else{this.get("isSelected")?b.set("isVisible",false):b.popup(this,a)}return true}});require("validators/validator");SC.Validator.Password=SC.Validator.extend({attachTo:function(a,b){argments.callee.base.call(this,a,b);if(!this.fields){this.fields=[]}this.fields.push(b)},validate:function(e){if(!this.fields||this.fields.length==0){return true}var d=false;var b=false;var a=true;var c=this.fields[0].get("fieldValue");this.fields.each(function(h){var g=h.get("fieldValue");if(g!=c){a=false}if(!g||g.length==0){d=true}if(g&&g.length>0){b=true}});if(e){return(b==false)?false:a}else{return(d==true)?true:a}},updateFields:function(c,b){if(!this.fields||this.fields.length==0){return true}var a="Invalid.Password".loc();var d=this._field;this.fields.each(function(e){var g=(b)?null:((e==d)?a:"");c.setErrorFor(e,g)});return(b)?SC.Validator.OK:a},validateChange:function(b,c,a){return this.updateFields(b,this.validate(false))},validateSubmit:function(a,b){return this.updateFields(a,this.validate(true))},validatePartial:function(b,c){var a=!this._field.get("isValid");if(a){return this.updateFields(b,this.validate(false))}else{return SC.Validator.NO_CHANGE}}});require("core");require("foundation/object");SC.Mock={};SC.Mock.DOMEvent=SC.Object.extend({type:null,target:null,stopped:false,preventDefault:function(){},stopPropagation:function(){}});SC.Mock.KeyEvent=SC.Mock.DOMEvent.extend({keyCode:0,altKey:false,ctrlKey:false,shiftKey:false,metaKey:false});require("views/view");SC.SpinnerView=SC.View.extend({isVisibleBindingDefault:SC.Binding.Not});require("views/field/field");SC.SelectFieldView=SC.FieldView.extend({emptyElement:"<select></select>",objects:null,nameKey:null,sortKey:null,valueKey:null,emptyName:null,localize:false,validateMenuItem:function(b,a){return true},sortObjects:function(b){var a=this.get("sortKey")||this.get("nameKey");b=b.sort(function(d,c){if(a){d=(d.get)?d.get(a):d[a];c=(c.get)?c.get(a):c[a]}return(d<c)?-1:((d>c)?1:0)});return b},rebuildMenu:function(){this._rebuildMenu()},mouseDown:function(a){a._stopWhenHandled=false;return false},getFieldValue:function(){var e=this.rootElement.value;var b=this.get("valueKey");var d=this.get("objects");if(e=="***"){e=null}else{if(e&&d){d=Array.from(d);var g=d.length;var c=null;while(!c&&(--g>=0)){var a=d[g];if(b){a=(a.get)?a.get(b):a[b]}ov=(a)?((a._guid)?a._guid:a.toString()):null;if(e==ov){c=a}}}}return b?e:c},setFieldValue:function(a){if(a){a=(a._guid)?a._guid:a.toString()}else{a="***"}if(this.rootElement.value!=a){this.rootElement.value=a}},_rebuildMenu:function(){var c=this.get("nameKey");var d=this.get("valueKey");var g=this.get("objects");var e=this.get("value");var h=this.get("localize");if(!d&&e){e=e._guid}if((e==null)||(e=="")){e="***"}if(g){g=Array.from(g);g=this.sortObjects(g);var a=[];var b=this.get("emptyName");if(b){if(h){b=b.loc()}a.push('<option value="***">%@</option>'.fmt(b));a.push('<option disabled="disabled"></option>')}g.each(function(l){if(l){var k=(c)?((l.get)?l.get(c):l[c]):l.toString();if(h){k=k.loc()}var m=(d)?((l.get)?l.get(d):l[d]):l;if(m){m=(m._guid)?m._guid:m.toString()}var j=(this.validateMenuItem&&this.validateMenuItem(m,k))?"":'disabled="disabled" ';a.push('<option %@value="%@">%@</option>'.fmt(j,m,k))}else{a.push('<option disabled="disabled"></option>')}}.bind(this));this.update(a.join(""));this.rootElement.value=e}else{this.set("value",null)}},_objectsObserver:function(){if(!this._boundObserver){this._boundObserver=this._objectsItemObserver.bind(this)}if(this.didChangeFor("_objO","objects","nameKey","valueKey")){var d;var c=Array.from(this.get("objects"));var b=this._boundObserver;if(this._objects){d=this._objects.length;while(--d>=0){var a=this._objects[d];if(a&&a.removeObserver){if(this._nameKey&&this._valueKey){a.removeObserver(this._nameKey,b);a.removeObserver(this._valueKey,b)}else{a.removeObserver("*",b)}}}}this._objects=c;this._nameKey=this.get("nameKey");this._valueKey=this.get("valueKey");if(this._objects){d=this._objects.length;while(--d>=0){var a=this._objects[d];if(a&&a.addObserver){if(this._nameKey&&this._valueKey){a.addObserver(this._nameKey,b);a.addObserver(this._valueKey,b)}else{a.addObserver("*",b)}}}}this._rebuildMenu()}}.observes("objects","nameKey","valueKey"),_objectsItemObserver:function(b,a,c){if(b.didChangeFor(this._guid,a)){this._rebuildMenu()}},_fieldDidFocus:function(){var a=this.get("isFocused");if(!a){this.set("isFocused",true)}},_fieldDidBlur:function(){var a=this.get("isFocused");if(a){this.set("isFocused",false)}},_isFocusedObserver:function(){var a=this.get("isFocused");this.setClassName("focus",a)}.observes("isFocused"),init:function(){arguments.callee.base.call(this);this._rebuildMenu();var a=this.fieldValueDidChange.bind(this,false);Element.observe(this.rootElement,"change",a);var b=this._fieldDidFocus.bindAsEventListener(this);Element.observe(this.rootElement,"focus",b);var c=this._fieldDidBlur.bindAsEventListener(this);Element.observe(this.rootElement,"blur",c)}});require("views/view");require("views/container");SC.PanelView=SC.View.extend({emptyElement:'<div id="panels" class="panels"><div class="overlay"></div></div>',wrapperView:SC.ContainerView.extend({emptyElement:'<div class="panel"><div class="root"></div><div class="top-left-edge"></div><div class="top-edge"></div><div class="top-right-edge"></div><div class="right-edge"></div><div class="bottom-right-edge"></div><div class="bottom-edge"></div><div class="bottom-left-edge"></div><div class="left-edge"></div></div>',outlets:["rootView"],rootView:SC.View.outletFor(".root?")}),_wrapperPool:null,_getWrapperView:function(){var a=this._wrapperPool.pop();if(a){return a}a=this.wrapperView.viewFor();if(a.visibleAnimation){var b=Object.clone(a.visibleAnimation);b.onComplete=this.hidePanelDidComplete.bind(this);a.visibleAnimation=b}return a},locationFor:function(b,a){return{top:"50px",left:"auto"}},showPanel:function(b,a){var c=this._getWrapperView();c.set("animateVisible",false);c.set("isVisible",false);c.set("content",b);c.setClassName("standard-panel",!(b.get("hasCustomPanelWrapper")||false));b._wrapperView=c;this.nowShowing.push(b);this.appendChild(c);this.set("isVisible",true);c.setStyle({visibility:"hidden"});c.set("isVisible",true);var d=Element.getDimensions(b.rootElement);c.setStyle(this.locationFor(b,a));c.set("isVisible",false);c.setStyle({width:d.width+"px",visibility:"visible"});c.set("animateVisible",true);c.set("isVisible",true)},hidePanel:function(a){var b=null;if(a._wrapperView){if(a._wrapperView.visibleAnimation){}else{b=a._wrapperView}a._wrapperView.set("isVisible",false);a._wrapperView=null}this.nowShowing=this.nowShowing.without(a);if(b){this.hidePanelDidComplete(b)}},hidePanelDidComplete:function(a){if(a.get("isVisible")!=false){return}if(a){a.set("content",null);this._wrapperPool.push(a)}if(this.nowShowing.length<=0){this.set("isVisible",false)}},init:function(){arguments.callee.base.call(this);this.nowShowing=[];this._wrapperPool=[]},panelStyle:{zIndex:"10000",visibility:"visible",position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"},showView:function(){var a=$tag("body");if(this.rootElement.parentNode!=a){a.appendChild(this.rootElement)}this.setStyle(this.panelStyle);if(!SC.isIE7()&&a){Element.addClassName(a,"under-panel")}},hideView:function(){var a=$tag("body");this.setStyle({zIndex:"-10000",visibility:"hidden"});if(!SC.isIE7()&&a){Element.removeClassName(a,"under-panel")}},didClick:function(c){if(this.nowShowing.length==0){return}var b=this.nowShowing[this.nowShowing.length-1];var e=Event.element(c);var d=$view(e);var a=b._wrapperView;while(e&&(e!=this.rootElement)&&(d!=a)){e=e.parentNode;d=(e)?$view(e):null}if((d!=a)&&(!b.get("isModal"))){b.set("isVisible",false)}}});SC.callOnLoad(function(){if(!SC.page){SC.page=SC.Page.create()}SC.page.panels=SC.PanelView.outletFor(null)});require("views/view");require("views/container");require("globals/panels");SC.PopupView=SC.PanelView.extend({emptyElement:'<div id="popups" class="popups"></div>',wrapperView:SC.ContainerView.extend({emptyElement:'<div class="popup"></div>',visibleAnimation:{visible:"opacity: 1.0",hidden:"opacity: 0.0",duration:200,onComplete:function(a){if(!a.get("isVisible")){SC.popups.hidePanelDidComplete(a)}}}}),locationFor:function(c,e){var h=Event.pointerLocation(e);var a=(e)?(h.x-20):100;var j=(e)?lox.y:100;var g=c.get("size");var d=Element.getDimensions(this);var b=(a+g.width+50)-d.width;if(b>0){a-=b}var b=(j+g.height+20)-d.height;if(b>0){j-=b}return{left:a+"px",top:j+"px"}},viewHide:function(){SC.page.get("popups").hidePanel(this)}});SC.callOnLoad(function(){if(!SC.page){SC.page=SC.Page.create()}SC.page.popups=SC.PopupView.outletFor(null)});require("mixins/enumerable");require("mixins/observable");SC.Set=function(b){if(b&&b.length>0){var a=(b.get)?b.get("length"):b.length;if(b.objectAt){while(--a>=0){this.add(b.objectAt(a))}}else{while(--a>=0){this.add(b[a])}}}return this};SC.Set.prototype={length:0,clear:function(){this.length=0},contains:function(b){if(b===null){return NO}var a=this[SC.hashFor(b)];return((a!=null)&&(a<this.length))},add:function(d){if(d==null){return this}var c=SC.hashFor(d);var b=this[c];var a=this.length;if((b==null)||(b>=a)){this[a]=d;this[c]=a;this.length=a+1}return this},addEach:function(b){var a=b.length;while(--a>=0){this.add(b[a])}},remove:function(d){if(d==null){return this}var c=SC.hashFor(d);var b=this[c];var a=this.length;if((b==null)||(b>=a)){return this}delete this[c];if(b<(a-1)){var d=this[b]=this[a-1];this[SC.hashFor(d)]=b}this.length=a-1;return this},pop:function(){var a=(this.length>0)?this[this.length-1]:null;if(a){this.remove(a)}return a},removeEach:function(b){var a=b.length;while(--a>=0){this.remove(b[a])}},_each:function(c){var b=this.length;for(var a=0;a<b;a++){c(this[a])}},toString:function(){return"SC.Set<%@>".fmt(SC.SC.$A(this))}};SC.mixin(SC.Set.prototype,SC.Enumerable,SC.Observable);SC.Set.prototype.push=SC.Set.prototype.unshift=SC.Set.prototype.add;SC.Set.prototype.shift=SC.Set.prototype.pop;SC.Set.create=function(a){return new SC.Set(a)};require("views/button/button");SC.FilterButtonView=SC.ButtonView.extend({filterValue:null,filterOn:null,filterOff:null,action:function(){var a=this.get("filterValue");a=(a==this.get("filterOn"))?this.get("filterOff"):this.get("filterOn");this.set("filterValue",a)},filterValueObserver:function(){var a=this.get("filterValue")==this.get("filterOn");if(a!=this.get("isSelected")){this.set("isSelected",a)}}.observes("filterValue")});require("drag/drag");SC.DropTarget={isDropTarget:true,dragEntered:function(b,a){return SC.DRAG_NONE},dragUpdated:function(b,a){},dragExited:function(b,a){},dragEnded:function(b,a){},prepareForDragOperation:function(a,b){return true},performDragOperation:function(a,b){return SC.DRAG_NONE},concludeDragOperation:function(a,b){}};