
(function(window,$,undefined){var can=window.can||{};if(typeof GLOBALCAN==='undefined'||GLOBALCAN!==false){window.can=can;}
can.isDeferred=function(obj){var isFunction=this.isFunction;return obj&&isFunction(obj.then)&&isFunction(obj.pipe);};can.each=function(elements,callback,context){var i=0,key;if(elements){if(typeof elements.length==='number'&&elements.pop){if(elements.attr){elements.attr('length');}
for(key=elements.length;i<key;i++){if(callback.call(context||elements[i],elements[i],i,elements)===false){break;}}}else if(elements.hasOwnProperty){for(key in elements){if(elements.hasOwnProperty(key)){if(callback.call(context||elements[key],elements[key],key,elements)===false){break;}}}}}
return elements;};$.extend(can,$,{trigger:function(obj,event,args){if(obj.trigger){obj.trigger(event,args);}else{$.event.trigger(event,args,obj,true);}},addEvent:function(ev,cb){$([this]).bind(ev,cb);return this;},removeEvent:function(ev,cb){$([this]).unbind(ev,cb);return this;},buildFragment:function(result,element){var ret=$.buildFragment([result],$(element));return ret.cacheable?$.clone(ret.fragment):ret.fragment;},$:$,each:can.each});$.each(['bind','unbind','undelegate','delegate'],function(i,func){can[func]=function(){var t=this[func]?this:$([this]);t[func].apply(t,arguments);return this;};});$.each(["append","filter","addClass","remove","data","get"],function(i,name){can[name]=function(wrapped){return wrapped[name].apply(wrapped,can.makeArray(arguments).slice(1));};});var oldClean=$.cleanData;$.cleanData=function(elems){$.each(elems,function(i,elem){if(elem){can.trigger(elem,"destroyed",[],false);}});oldClean(elems);};var undHash=/_|-/,colons=/\=\=/,words=/([A-Z]+)([A-Z][a-z])/g,lowUp=/([a-z\d])([A-Z])/g,dash=/([a-z\d])([A-Z])/g,replacer=/\{([^\}]+)\}/g,quote=/"/g,singleQuote=/'/g,getNext=function(obj,prop,add){return prop in obj?obj[prop]:(add&&(obj[prop]={}));},isContainer=function(current){return(/^f|^o/).test(typeof current);};can.extend(can,{esc:function(content){var isInvalid=content===null||content===undefined||(isNaN(content)&&(""+content==='NaN'));return(""+(isInvalid?'':content)).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(quote,'&#34;').replace(singleQuote,"&#39;");},getObject:function(name,roots,add){var parts=name?name.split('.'):[],length=parts.length,current,r=0,ret,i;roots=can.isArray(roots)?roots:[roots||window];if(!length){return roots[0];}
while(roots[r]){current=roots[r];for(i=0;i<length-1&&isContainer(current);i++){current=getNext(current,parts[i],add);}
if(isContainer(current)){ret=getNext(current,parts[i],add);if(ret!==undefined){if(add===false){delete current[parts[i]];}
return ret;}}
r++;}},capitalize:function(s,cache){return s.charAt(0).toUpperCase()+s.slice(1);},underscore:function(s){return s.replace(colons,'/').replace(words,'$1_$2').replace(lowUp,'$1_$2').replace(dash,'_').toLowerCase();},sub:function(str,data,remove){var obs=[];obs.push(str.replace(replacer,function(whole,inside){var ob=can.getObject(inside,data,remove===undefined?remove:!remove);if(ob===undefined){obs=null;return"";}
if(isContainer(ob)&&obs){obs.push(ob);return"";}
return""+ob;}));return obs===null?obs:(obs.length<=1?obs[0]:obs);},replacer:replacer,undHash:undHash});var initializing=0;can.Construct=function(){if(arguments.length){return can.Construct.extend.apply(can.Construct,arguments);}};can.extend(can.Construct,{newInstance:function(){var inst=this.instance(),arg=arguments,args;if(inst.setup){args=inst.setup.apply(inst,arguments);}
if(inst.init){inst.init.apply(inst,args||arguments);}
return inst;},_inherit:function(newProps,oldProps,addTo){can.extend(addTo||newProps,newProps||{})},_overwrite:function(what,oldProps,propName,val){what[propName]=val;},setup:function(base,fullName){this.defaults=can.extend(true,{},base.defaults,this.defaults);},instance:function(){initializing=1;var inst=new this();initializing=0;return inst;},extend:function(fullName,klass,proto){if(typeof fullName!='string'){proto=klass;klass=fullName;fullName=null;}
if(!proto){proto=klass;klass=null;}
proto=proto||{};var _super_class=this,_super=this.prototype,name,shortName,namespace,prototype;prototype=this.instance();can.Construct._inherit(proto,_super,prototype);function Constructor(){if(!initializing){return this.constructor!==Constructor&&arguments.length?arguments.callee.extend.apply(arguments.callee,arguments):this.constructor.newInstance.apply(this.constructor,arguments);}}
for(name in _super_class){if(_super_class.hasOwnProperty(name)){Constructor[name]=_super_class[name];}}
can.Construct._inherit(klass,_super_class,Constructor);if(fullName){var parts=fullName.split('.'),shortName=parts.pop(),current=can.getObject(parts.join('.'),window,true),namespace=current,_fullName=can.underscore(fullName.replace(/\./g,"_")),_shortName=can.underscore(shortName);current[shortName]=Constructor;}
can.extend(Constructor,{constructor:Constructor,prototype:prototype,namespace:namespace,shortName:shortName,_shortName:_shortName,fullName:fullName,_fullName:_fullName});Constructor.prototype.constructor=Constructor;var t=[_super_class].concat(can.makeArray(arguments)),args=Constructor.setup.apply(Constructor,t);if(Constructor.init){Constructor.init.apply(Constructor,args||t);}
return Constructor;}});var canMakeObserve=function(obj){return obj&&(can.isArray(obj)||can.isPlainObject(obj)||(obj instanceof can.Observe));},unhookup=function(items,namespace){return can.each(items,function(item){if(item&&item.unbind){item.unbind("change"+namespace);}});},hookupBubble=function(val,prop,parent,Ob,List){Ob=Ob||Observe;List=List||Observe.List;if(val instanceof Observe){unhookup([val],parent._cid);}else if(can.isArray(val)){val=new List(val);}else{val=new Ob(val);}
val.bind("change"+parent._cid,function(){var args=can.makeArray(arguments),ev=args.shift();args[0]=(prop==="*"?[parent.indexOf(val),args[0]]:[prop,args[0]]).join(".");ev.triggeredNS=ev.triggeredNS||{};if(ev.triggeredNS[parent._cid]){return;}
ev.triggeredNS[parent._cid]=true;can.trigger(parent,ev,args);});return val;},observeId=0,serialize=function(observe,how,where){observe.each(function(val,name){where[name]=canMakeObserve(val)&&can.isFunction(val[how])?val[how]():val;});return where;},$method=function(name){return function(){return can[name].apply(this,arguments);};},bind=$method('addEvent'),unbind=$method('removeEvent'),attrParts=function(attr){return can.isArray(attr)?attr:(""+attr).split(".");},batchNum=1,transactions=0,batchEvents=[],stopCallbacks=[];var cid=0;can.cid=function(object,name){if(object._cid){return object._cid}else{return object._cid=(name||"")+(++cid)}}
var Observe=can.Observe=can.Construct({bind:bind,unbind:unbind,id:"id",canMakeObserve:canMakeObserve,startBatch:function(batchStopHandler){transactions++;batchStopHandler&&stopCallbacks.push(batchStopHandler);},stopBatch:function(force,callStart){if(force){transactions=0;}else{transactions--;}
if(transactions==0){var items=batchEvents.slice(0),callbacks=stopCallbacks.slice(0);batchEvents=[];stopCallbacks=[];batchNum++;callStart&&this.startBatch();can.each(items,function(args){can.trigger.apply(can,args);});can.each(callbacks,function(cb){cb;});}},triggerBatch:function(item,event,args){if(!item._init){if(transactions==0){return can.trigger(item,event,args);}else{batchEvents.push([item,{type:event,batchNum:batchNum},args]);}}},keys:function(observe){var keys=[];Observe.__reading&&Observe.__reading(observe,'__keys');for(var keyName in observe._data){keys.push(keyName);}
return keys;}},{setup:function(obj){this._data={};can.cid(this,".observe");this._init=1;this.attr(obj);this.bind('change'+this._cid,can.proxy(this._changes,this));delete this._init;},_changes:function(ev,attr,how,newVal,oldVal){Observe.triggerBatch(this,{type:attr,batchNum:ev.batchNum},[newVal,oldVal]);},attr:function(attr,val){var type=typeof attr;if(type!=="string"&&type!=="number"){return this._attrs(attr,val)}else if(val===undefined){Observe.__reading&&Observe.__reading(this,attr)
return this._get(attr)}else{this._set(attr,val);return this;}},each:function(){Observe.__reading&&Observe.__reading(this,'__keys');return can.each.apply(undefined,[this.__get()].concat(can.makeArray(arguments)))},removeAttr:function(attr){var parts=attrParts(attr),prop=parts.shift(),current=this._data[prop];if(parts.length){return current.removeAttr(parts)}else{if(prop in this._data){delete this._data[prop];if(!(prop in this.constructor.prototype)){delete this[prop]}
Observe.triggerBatch(this,"__keys",undefined);Observe.triggerBatch(this,"change",[prop,"remove",undefined,current]);Observe.triggerBatch(this,prop,[undefined,current]);}
return current;}},_get:function(attr){var parts=attrParts(attr),current=this.__get(parts.shift());return parts.length?current?current._get(parts):undefined:current;},__get:function(attr){return attr?this._data[attr]:this._data;},_set:function(attr,value){var parts=attrParts(attr),prop=parts.shift(),current=this.__get(prop);if(canMakeObserve(current)&&parts.length){current._set(parts,value)}else if(!parts.length){if(this.__convert){value=this.__convert(prop,value)}
if(!current){Observe.triggerBatch(this,"__keys",undefined);}
this.__set(prop,value,current)}else{throw"can.Observe: Object does not exist"}},__set:function(prop,value,current){if(value!==current){var changeType=this.__get().hasOwnProperty(prop)?"set":"add";this.___set(prop,canMakeObserve(value)?hookupBubble(value,prop,this):value);Observe.triggerBatch(this,"change",[prop,changeType,value,current]);current&&unhookup([current],this._cid);}},___set:function(prop,val){this._data[prop]=val;if(!(prop in this.constructor.prototype)){this[prop]=val}},bind:bind,unbind:unbind,serialize:function(){return serialize(this,'serialize',{});},_attrs:function(props,remove){if(props===undefined){return serialize(this,'attr',{})}
props=can.extend(true,{},props);var prop,self=this,newVal;Observe.startBatch();this.each(function(curVal,prop,toRemove){newVal=props[prop];if(newVal===undefined){remove&&self.removeAttr(prop);return;}
if(self.__convert){newVal=self.__convert(prop,newVal);}
if(curVal!==newVal){if(curVal instanceof can.Observe&&newVal instanceof can.Observe){unhookup([curVal],self._cid);}
if(newVal instanceof can.Observe){self._set(prop,newVal)}
else if(canMakeObserve(curVal)&&canMakeObserve(newVal)){curVal.attr(newVal,toRemove)}else if(curVal!=newVal){self._set(prop,newVal)}}
delete props[prop];})
for(var prop in props){newVal=props[prop];this._set(prop,newVal)}
Observe.stopBatch()
return this;}});var splice=[].splice,list=Observe({setup:function(instances,options){this.length=0;can.cid(this,".observe")
this._init=1;this.push.apply(this,can.makeArray(instances||[]));this.bind('change'+this._cid,can.proxy(this._changes,this));can.extend(this,options);delete this._init;},_changes:function(ev,attr,how,newVal,oldVal){if(!~attr.indexOf('.')){if(how==='add'){Observe.triggerBatch(this,how,[newVal,+attr]);Observe.triggerBatch(this,'length',[this.length]);}else if(how==='remove'){Observe.triggerBatch(this,how,[oldVal,+attr]);Observe.triggerBatch(this,'length',[this.length]);}else{Observe.triggerBatch(this,how,[newVal,+attr])}}
Observe.prototype._changes.apply(this,arguments)},__get:function(attr){return attr?this[attr]:this;},___set:function(attr,val){this[attr]=val;if(+attr>=this.length){this.length=(+attr+1)}},serialize:function(){return serialize(this,'serialize',[]);},splice:function(index,howMany){var args=can.makeArray(arguments),i;for(i=2;i<args.length;i++){var val=args[i];if(canMakeObserve(val)){args[i]=hookupBubble(val,"*",this)}}
if(howMany===undefined){howMany=args[1]=this.length-index;}
var removed=splice.apply(this,args);if(howMany>0){Observe.triggerBatch(this,"change",[""+index,"remove",undefined,removed]);unhookup(removed,this._cid);}
if(args.length>2){Observe.triggerBatch(this,"change",[""+index,"add",args.slice(2),removed]);}
return removed;},_attrs:function(items,remove){if(items===undefined){return serialize(this,'attr',[]);}
items=can.makeArray(items);Observe.startBatch();this._updateAttrs(items,remove);Observe.stopBatch()},_updateAttrs:function(items,remove){var len=Math.min(items.length,this.length);for(var prop=0;prop<len;prop++){var curVal=this[prop],newVal=items[prop];if(canMakeObserve(curVal)&&canMakeObserve(newVal)){curVal.attr(newVal,remove)}else if(curVal!=newVal){this._set(prop,newVal)}else{}}
if(items.length>this.length){this.push.apply(this,items.slice(this.length));}else if(items.length<this.length&&remove){this.splice(items.length)}}}),getArgs=function(args){return args[0]&&can.isArray(args[0])?args[0]:can.makeArray(args);};can.each({push:"length",unshift:0},function(where,name){list.prototype[name]=function(){var args=can.makeArray(arguments),len=where?this.length:0;for(var i=0;i<args.length;i++){var val=args[i];if(canMakeObserve(val)){args[i]=hookupBubble(val,"*",this,this.constructor.Observe,this.constructor);}}
var res=[][name].apply(this,args);if(!this.comparator||!args.length){Observe.triggerBatch(this,"change",[""+len,"add",args,undefined])}
return res;}});can.each({pop:"length",shift:0},function(where,name){list.prototype[name]=function(){var args=getArgs(arguments),len=where&&this.length?this.length-1:0;var res=[][name].apply(this,args)
Observe.triggerBatch(this,"change",[""+len,"remove",undefined,[res]])
if(res&&res.unbind){res.unbind("change"+this._cid)}
return res;}});can.extend(list.prototype,{indexOf:function(item){this.attr('length')
return can.inArray(item,this)},join:[].join,slice:function(){var temp=Array.prototype.slice.apply(this,arguments);return new this.constructor(temp);},concat:function(){var args=[];can.each(can.makeArray(arguments),function(arg,i){args[i]=arg instanceof can.Observe.List?arg.serialize():arg;});return new this.constructor(Array.prototype.concat.apply(this.serialize(),args));},forEach:function(cb,thisarg){can.each(this,cb,thisarg||this);}});Observe.List=list;Observe.setup=function(){can.Construct.setup.apply(this,arguments);this.List=Observe.List({Observe:this},{});}
var pipe=function(def,model,func){var d=new can.Deferred();def.then(function(){var args=can.makeArray(arguments);args[0]=model[func](args[0]);d.resolveWith(d,args);},function(){d.rejectWith(this,arguments);});if(typeof def.abort==='function'){d.abort=function(){return def.abort();}}
return d;},modelNum=0,ignoreHookup=/change.observe\d+/,getId=function(inst){can.Observe.__reading&&can.Observe.__reading(inst,inst.constructor.id)
return inst.__get(inst.constructor.id);},ajax=function(ajaxOb,data,type,dataType,success,error){var params={};if(typeof ajaxOb=="string"){var parts=ajaxOb.split(/\s/);params.url=parts.pop();if(parts.length){params.type=parts.pop();}}else{can.extend(params,ajaxOb);}
params.data=typeof data=="object"&&!can.isArray(data)?can.extend(params.data||{},data):data;params.url=can.sub(params.url,params.data,true);return can.ajax(can.extend({type:type||"post",dataType:dataType||"json",success:success,error:error},params));},makeRequest=function(self,type,success,error,method){var deferred,args=[self.serialize()],model=self.constructor,jqXHR;if(type=='destroy'){args.shift();}
if(type!=='create'){args.unshift(getId(self));}
jqXHR=model[type].apply(model,args);deferred=jqXHR.pipe(function(data){self[method||type+"d"](data,jqXHR);return self;});if(jqXHR.abort){deferred.abort=function(){jqXHR.abort();};}
deferred.then(success,error);return deferred;},ajaxMethods={create:{url:"_shortName",type:"post"},update:{data:function(id,attrs){attrs=attrs||{};var identity=this.id;if(attrs[identity]&&attrs[identity]!==id){attrs["new"+can.capitalize(id)]=attrs[identity];delete attrs[identity];}
attrs[identity]=id;return attrs;},type:"put"},destroy:{type:"delete",data:function(id){var args={};args.id=args[this.id]=id;return args;}},findAll:{url:"_shortName"},findOne:{}},ajaxMaker=function(ajaxMethod,str){return function(data){data=ajaxMethod.data?ajaxMethod.data.apply(this,arguments):data;return ajax(str||this[ajaxMethod.url||"_url"],data,ajaxMethod.type||"get")}}
can.Model=can.Observe({fullName:"can.Model",setup:function(base){this.store={};can.Observe.setup.apply(this,arguments);if(!can.Model){return;}
this.List=ML({Observe:this},{});var self=this,clean=can.proxy(this._clean,self);can.each(ajaxMethods,function(method,name){if(!can.isFunction(self[name])){self[name]=ajaxMaker(method,self[name]);}
if(self["make"+can.capitalize(name)]){var newMethod=self["make"+can.capitalize(name)](self[name]);can.Construct._overwrite(self,base,name,function(){this._reqs++;var def=newMethod.apply(this,arguments);var then=def.then(clean,clean);then.abort=def.abort;return then;})}});if(self.fullName=="can.Model"||!self.fullName){self.fullName="Model"+(++modelNum);}
this._reqs=0;this._url=this._shortName+"/{"+this.id+"}"},_ajax:ajaxMaker,_clean:function(){this._reqs--;if(!this._reqs){for(var id in this.store){if(!this.store[id]._bindings){delete this.store[id];}}}
return arguments[0];},models:function(instancesRawData,oldList){if(!instancesRawData){return;}
if(instancesRawData instanceof this.List){return instancesRawData;}
var self=this,tmp=[],res=oldList instanceof can.Observe.List?oldList:new(self.List||ML),arr=can.isArray(instancesRawData),ml=(instancesRawData instanceof ML),raw=arr?instancesRawData:(ml?instancesRawData.serialize():instancesRawData.data),i=0;if(res.length>0){res.splice(0);}
can.each(raw,function(rawPart){tmp.push(self.model(rawPart));});res.push.apply(res,tmp);if(!arr){can.each(instancesRawData,function(val,prop){if(prop!=='data'){res.attr(prop,val);}})}
return res;},model:function(attributes){if(!attributes){return;}
if(attributes instanceof this){attributes=attributes.serialize();}
var id=attributes[this.id],model=id&&this.store[id]?this.store[id].attr(attributes):new this(attributes);if(this._reqs){this.store[attributes[this.id]]=model;}
return model;}},{isNew:function(){var id=getId(this);return!(id||id===0);},save:function(success,error){return makeRequest(this,this.isNew()?'create':'update',success,error);},destroy:function(success,error){return makeRequest(this,'destroy',success,error,'destroyed');},bind:function(eventName){if(!ignoreHookup.test(eventName)){if(!this._bindings){this.constructor.store[getId(this)]=this;this._bindings=0;}
this._bindings++;}
return can.Observe.prototype.bind.apply(this,arguments);},unbind:function(eventName){if(!ignoreHookup.test(eventName)){this._bindings--;if(!this._bindings){delete this.constructor.store[getId(this)];}}
return can.Observe.prototype.unbind.apply(this,arguments);},___set:function(prop,val){can.Observe.prototype.___set.call(this,prop,val)
if(prop===this.constructor.id&&this._bindings){this.constructor.store[getId(this)]=this;}}});can.each({makeFindAll:"models",makeFindOne:"model"},function(method,name){can.Model[name]=function(oldFind){return function(params,success,error){var def=pipe(oldFind.call(this,params),this,method);def.then(success,error);return def;};};});can.each(["created","updated","destroyed"],function(funcName){can.Model.prototype[funcName]=function(attrs){var stub,constructor=this.constructor;stub=attrs&&typeof attrs=='object'&&this.attr(attrs.attr?attrs.attr():attrs);can.trigger(this,funcName);can.trigger(this,"change",funcName)
can.trigger(constructor,funcName,this);};});var ML=can.Model.List=can.Observe.List({setup:function(){can.Observe.List.prototype.setup.apply(this,arguments);var self=this;this.bind('change',function(ev,how){if(/\w+\.destroyed/.test(how)){var index=self.indexOf(ev.target);if(index!=-1){self.splice(index,1);}}})}})
var digitTest=/^\d+$/,keyBreaker=/([^\[\]]+)|(\[\])/g,paramTest=/([^?#]*)(#.*)?$/,prep=function(str){return decodeURIComponent(str.replace(/\+/g," "));};can.extend(can,{deparam:function(params){var data={},pairs,lastPart;if(params&&paramTest.test(params)){pairs=params.split('&'),can.each(pairs,function(pair){var parts=pair.split('='),key=prep(parts.shift()),value=prep(parts.join("=")),current=data;parts=key.match(keyBreaker);for(var j=0,l=parts.length-1;j<l;j++){if(!current[parts[j]]){current[parts[j]]=digitTest.test(parts[j+1])||parts[j+1]=="[]"?[]:{};}
current=current[parts[j]];}
lastPart=parts.pop();if(lastPart=="[]"){current.push(value);}else{current[lastPart]=value;}});}
return data;}});var
matcher=/\:([\w\.]+)/g,paramsMatcher=/^(?:&[^=]+=[^&]*)+/,makeProps=function(props){var tags=[];can.each(props,function(val,name){tags.push((name==='className'?'class':name)+'="'+(name==="href"?val:can.esc(val))+'"');});return tags.join(" ");},matchesData=function(route,data){var count=0,i=0,defaults={};for(var name in route.defaults){if(route.defaults[name]===data[name]){defaults[name]=1;count++;}}
for(;i<route.names.length;i++){if(!data.hasOwnProperty(route.names[i])){return-1;}
if(!defaults[route.names[i]]){count++;}}
return count;},onready=!0,location=window.location,wrapQuote=function(str){return(str+'').replace(/([.?*+\^$\[\]\\(){}|\-])/g,"\\$1");},each=can.each,extend=can.extend;can.route=function(url,defaults){defaults=defaults||{};var names=[],test=url.replace(matcher,function(whole,name,i){names.push(name);var next="\\"+(url.substr(i+whole.length,1)||can.route._querySeparator);return"([^"+next+"]"+(defaults[name]?"*":"+")+")";});can.route.routes[url]={test:new RegExp("^"+test+"($|"+wrapQuote(can.route._querySeparator)+")"),route:url,names:names,defaults:defaults,length:url.split('/').length};return can.route;};extend(can.route,{_querySeparator:'&',_paramsMatcher:paramsMatcher,param:function(data,_setRoute){var route,matches=0,matchCount,routeName=data.route,propCount=0;delete data.route;each(data,function(){propCount++;});each(can.route.routes,function(temp,name){matchCount=matchesData(temp,data);if(matchCount>matches){route=temp;matches=matchCount;}
if(matchCount>=propCount){return false;}});if(can.route.routes[routeName]&&matchesData(can.route.routes[routeName],data)===matches){route=can.route.routes[routeName];}
if(route){var cpy=extend({},data),res=route.route.replace(matcher,function(whole,name){delete cpy[name];return data[name]===route.defaults[name]?"":encodeURIComponent(data[name]);}),after;each(route.defaults,function(val,name){if(cpy[name]===val){delete cpy[name];}});after=can.param(cpy);if(_setRoute){can.route.attr('route',route.route);}
return res+(after?can.route._querySeparator+after:"");}
return can.isEmptyObject(data)?"":can.route._querySeparator+can.param(data);},deparam:function(url){var route={length:-1};each(can.route.routes,function(temp,name){if(temp.test.test(url)&&temp.length>route.length){route=temp;}});if(route.length>-1){var
parts=url.match(route.test),start=parts.shift(),remainder=url.substr(start.length-(parts[parts.length-1]===can.route._querySeparator?1:0)),obj=(remainder&&can.route._paramsMatcher.test(remainder))?can.deparam(remainder.slice(1)):{};obj=extend(true,{},route.defaults,obj);each(parts,function(part,i){if(part&&part!==can.route._querySeparator){obj[route.names[i]]=decodeURIComponent(part);}});obj.route=route.route;return obj;}
if(url.charAt(0)!==can.route._querySeparator){url=can.route._querySeparator+url;}
return can.route._paramsMatcher.test(url)?can.deparam(url.slice(1)):{};},data:new can.Observe({}),routes:{},ready:function(val){if(val===false){onready=val;}
if(val===true||onready===true){can.route._setup();setState();}
return can.route;},url:function(options,merge){if(merge){options=extend({},curParams,options)}
return"#!"+can.route.param(options);},link:function(name,options,props,merge){return"<a "+makeProps(extend({href:can.route.url(options,merge)},props))+">"+name+"</a>";},current:function(options){return location.hash=="#!"+can.route.param(options)},_setup:function(){can.bind.call(window,'hashchange',setState);},_getHash:function(){return location.href.split(/#!?/)[1]||"";},_setHash:function(serialized){var path=(can.route.param(serialized,true));location.hash="#!"+path;return path;}});each(['bind','unbind','delegate','undelegate','attr','removeAttr'],function(name){can.route[name]=function(){return can.route.data[name].apply(can.route.data,arguments)}})
var
timer,curParams,setState=can.route.setState=function(){var hash=can.route._getHash();curParams=can.route.deparam(hash);if(!changingData||hash!==lastHash){can.route.attr(curParams,true);}},lastHash,changingData;can.route.bind("change",function(ev,attr){changingData=1;clearTimeout(timer);timer=setTimeout(function(){changingData=0;var serialized=can.route.data.serialize();lastHash=can.route._setHash(serialized);},1);});can.bind.call(document,"ready",can.route.ready);can.route.constructor.canMakeObserve=can.Observe.canMakeObserve;var bind=function(el,ev,callback){can.bind.call(el,ev,callback);return function(){can.unbind.call(el,ev,callback);};},isFunction=can.isFunction,extend=can.extend,each=can.each,slice=[].slice,paramReplacer=/\{([^\}]+)\}/g,special=can.getObject("$.event.special")||{},delegate=function(el,selector,ev,callback){can.delegate.call(el,selector,ev,callback);return function(){can.undelegate.call(el,selector,ev,callback);};},binder=function(el,ev,callback,selector){return selector?delegate(el,can.trim(selector),ev,callback):bind(el,ev,callback);},basicProcessor;var Control=can.Control=can.Construct({setup:function(){can.Construct.setup.apply(this,arguments);if(can.Control){var control=this,funcName;control.actions={};for(funcName in control.prototype){if(control._isAction(funcName)){control.actions[funcName]=control._action(funcName);}}}},_shifter:function(context,name){var method=typeof name=="string"?context[name]:name;if(!isFunction(method)){method=context[method];}
return function(){context.called=name;return method.apply(context,[this.nodeName?can.$(this):this].concat(slice.call(arguments,0)));};},_isAction:function(methodName){var val=this.prototype[methodName],type=typeof val;return(methodName!=='constructor')&&(type=="function"||(type=="string"&&isFunction(this.prototype[val])))&&!!(special[methodName]||processors[methodName]||/[^\w]/.test(methodName));},_action:function(methodName,options){paramReplacer.lastIndex=0;if(options||!paramReplacer.test(methodName)){var convertedName=options?can.sub(methodName,[options,window]):methodName;if(!convertedName){return null;}
var arr=can.isArray(convertedName),name=arr?convertedName[1]:convertedName,parts=name.split(/\s+/g),event=parts.pop();return{processor:processors[event]||basicProcessor,parts:[name,parts.join(" "),event],delegate:arr?convertedName[0]:undefined};}},processors:{},defaults:{}},{setup:function(element,options){var cls=this.constructor,pluginname=cls.pluginName||cls._fullName,arr;this.element=can.$(element)
if(pluginname&&pluginname!=='can_control'){this.element.addClass(pluginname);}
(arr=can.data(this.element,"controls"))||can.data(this.element,"controls",arr=[]);arr.push(this);this.options=extend({},cls.defaults,options);this.on();return[this.element,this.options];},on:function(el,selector,eventName,func){if(!el){this.off();var cls=this.constructor,bindings=this._bindings,actions=cls.actions,element=this.element,destroyCB=can.Control._shifter(this,"destroy"),funcName,ready;for(funcName in actions){if(actions.hasOwnProperty(funcName)&&(ready=actions[funcName]||cls._action(funcName,this.options))){bindings.push(ready.processor(ready.delegate||element,ready.parts[2],ready.parts[1],funcName,this));}}
can.bind.call(element,"destroyed",destroyCB);bindings.push(function(el){can.unbind.call(el,"destroyed",destroyCB);});return bindings.length;}
if(typeof el=='string'){func=eventName;eventName=selector;selector=el;el=this.element;}
if(func===undefined){func=eventName;eventName=selector;selector=null;}
if(typeof func=='string'){func=can.Control._shifter(this,func);}
this._bindings.push(binder(el,eventName,func,selector));return this._bindings.length;},off:function(){var el=this.element[0]
each(this._bindings||[],function(value){value(el);});this._bindings=[];},destroy:function(){var Class=this.constructor,pluginName=Class.pluginName||Class._fullName,controls;this.off();if(pluginName&&pluginName!=='can_control'){this.element.removeClass(pluginName);}
controls=can.data(this.element,"controls");controls.splice(can.inArray(this,controls),1);can.trigger(this,"destroyed");this.element=null;}});var processors=can.Control.processors,basicProcessor=function(el,event,selector,methodName,control){return binder(el,event,can.Control._shifter(control,methodName),selector);};each(["change","click","contextmenu","dblclick","keydown","keyup","keypress","mousedown","mousemove","mouseout","mouseover","mouseup","reset","resize","scroll","select","submit","focusin","focusout","mouseenter","mouseleave","touchstart","touchmove","touchcancel","touchend","touchleave"],function(v){processors[v]=basicProcessor;});can.Control.processors.route=function(el,event,selector,funcName,controller){selector=selector||"";can.route(selector);var batchNum,check=function(ev,attr,how){if(can.route.attr('route')===(selector)&&(ev.batchNum===undefined||ev.batchNum!==batchNum)){batchNum=ev.batchNum;var d=can.route.attr();delete d.route;if(can.isFunction(controller[funcName])){controller[funcName](d);}else{controller[controller[funcName]](d);}}};can.route.bind('change',check);return function(){can.route.unbind('change',check);};};var isFunction=can.isFunction,makeArray=can.makeArray,hookupId=1,$view=can.view=function(view,data,helpers,callback){var result=$view.render(view,data,helpers,callback);if(isFunction(result)){return result;}
if(can.isDeferred(result)){return result.pipe(function(result){return $view.frag(result);});}
return $view.frag(result);};can.extend($view,{frag:function(result,parentNode){return $view.hookup($view.fragment(result),parentNode);},fragment:function(result){var frag=can.buildFragment(result,document.body);if(!frag.childNodes.length){frag.appendChild(document.createTextNode(''));}
return frag;},toId:function(src){return can.map(src.toString().split(/\/|\./g),function(part){if(part){return part;}}).join("_");},hookup:function(fragment,parentNode){var hookupEls=[],id,func;can.each(fragment.childNodes?can.makeArray(fragment.childNodes):fragment,function(node){if(node.nodeType===1){hookupEls.push(node);hookupEls.push.apply(hookupEls,can.makeArray(node.getElementsByTagName('*')));}});can.each(hookupEls,function(el){if(el.getAttribute&&(id=el.getAttribute('data-view-id'))&&(func=$view.hookups[id])){func(el,parentNode,id);delete $view.hookups[id];el.removeAttribute('data-view-id');}});return fragment;},hookups:{},hook:function(cb){$view.hookups[++hookupId]=cb;return" data-view-id='"+hookupId+"'";},cached:{},cachedRenderers:{},cache:true,register:function(info){this.types["."+info.suffix]=info;},types:{},ext:".ejs",registerScript:function(){},preload:function(){},render:function(view,data,helpers,callback){if(isFunction(helpers)){callback=helpers;helpers=undefined;}
var deferreds=getDeferreds(data);if(deferreds.length){var deferred=new can.Deferred();deferreds.push(get(view,true))
can.when.apply(can,deferreds).then(function(resolved){var objs=makeArray(arguments),renderer=objs.pop(),result;if(can.isDeferred(data)){data=usefulPart(resolved);}
else{for(var prop in data){if(can.isDeferred(data[prop])){data[prop]=usefulPart(objs.shift());}}}
result=renderer(data,helpers);deferred.resolve(result);callback&&callback(result);});return deferred;}
else{var response,async=isFunction(callback),deferred=get(view,async);if(async){response=deferred;deferred.then(function(renderer){callback(data?renderer(data,helpers):renderer);})}else{if(deferred.state()==="resolved"&&deferred.__view_id){var currentRenderer=$view.cachedRenderers[deferred.__view_id];return data?currentRenderer(data,helpers):currentRenderer;}else{deferred.then(function(renderer){response=data?renderer(data,helpers):renderer;});}}
return response;}},registerView:function(id,text,type,def){var func=(type||$view.types[$view.ext]).renderer(id,text);def=def||new can.Deferred();if($view.cache){$view.cached[id]=def;def.__view_id=id;$view.cachedRenderers[id]=func;}
return def.resolve(func);}});var checkText=function(text,url){if(!text.length){throw"can.view: No template or empty template:"+url;}},get=function(url,async){var suffix=url.match(/\.[\w\d]+$/),type,el,id,jqXHR;if(url.match(/^#/)){url=url.substr(1);}
if(el=document.getElementById(url)){suffix="."+el.type.match(/\/(x\-)?(.+)/)[2];}
if(!suffix&&!$view.cached[url]){url+=(suffix=$view.ext);}
if(can.isArray(suffix)){suffix=suffix[0]}
id=$view.toId(url);if(url.match(/^\/\//)){var sub=url.substr(2);url=!window.steal?sub:steal.config().root.mapJoin(sub);}
type=$view.types[suffix];if($view.cached[id]){return $view.cached[id];}else if(el){return $view.registerView(id,el.innerHTML,type);}else{var d=new can.Deferred();can.ajax({async:async,url:url,dataType:"text",error:function(jqXHR){checkText("",url);d.reject(jqXHR);},success:function(text){checkText(text,url);$view.registerView(id,text,type,d)}});return d;}},getDeferreds=function(data){var deferreds=[];if(can.isDeferred(data)){return[data]}else{for(var prop in data){if(can.isDeferred(data[prop])){deferreds.push(data[prop]);}}}
return deferreds;},usefulPart=function(resolved){return can.isArray(resolved)&&resolved[1]==='success'?resolved[0]:resolved};if(window.steal){steal.type("view js",function(options,success,error){var type=$view.types["."+options.type],id=$view.toId(options.id);options.text="steal('"+(type.plugin||"can/view/"+options.type)+"',function(can){return "+"can.view.preload('"+id+"',"+options.text+");\n})";success();})}
can.extend($view,{register:function(info){this.types["."+info.suffix]=info;if(window.steal){steal.type(info.suffix+" view js",function(options,success,error){var type=$view.types["."+options.type],id=$view.toId(options.id+'');options.text=type.script(id,options.text)
success();})};$view[info.suffix]=function(id,text){if(!text){return info.renderer(null,id);}
$view.preload(id,info.renderer(id,text));return can.view(id);}},registerScript:function(type,id,src){return"can.view.preload('"+id+"',"+$view.types["."+type].script(id,src)+");";},preload:function(id,renderer){$view.cached[id]=new can.Deferred().resolve(function(data,helpers){return renderer.call(data,data,helpers);});return function(){return $view.frag(renderer.apply(this,arguments))};}});var getValueAndObserved=function(func,self){var oldReading;if(can.Observe){oldReading=can.Observe.__reading;can.Observe.__reading=function(obj,attr){observed.push({obj:obj,attr:attr});};}
var observed=[],value=func.call(self);if(can.Observe){can.Observe.__reading=oldReading;}
return{value:value,observed:observed};},computeBinder=function(getterSetter,context,callback){var observing={},matched=true,data={value:undefined,teardown:function(){for(var name in observing){var ob=observing[name];ob.observe.obj.unbind(ob.observe.attr,onchanged);delete observing[name];}}},batchNum;var onchanged=function(ev){if(ev.batchNum===undefined||ev.batchNum!==batchNum){var oldValue=data.value,newvalue=getValueAndBind();data.value=newvalue;if(newvalue!==oldValue){callback(newvalue,oldValue);}
batchNum=batchNum=ev.batchNum;}};var getValueAndBind=function(){var info=getValueAndObserved(getterSetter,context),newObserveSet=info.observed;var value=info.value;matched=!matched;can.each(newObserveSet,function(ob){if(observing[ob.obj._cid+"|"+ob.attr]){observing[ob.obj._cid+"|"+ob.attr].matched=matched;}else{observing[ob.obj._cid+"|"+ob.attr]={matched:matched,observe:ob};ob.obj.bind(ob.attr,onchanged);}});for(var name in observing){var ob=observing[name];if(ob.matched!==matched){ob.observe.obj.unbind(ob.observe.attr,onchanged);delete observing[name];}}
return value;};data.value=getValueAndBind();data.isListening=!can.isEmptyObject(observing);return data;}
can.compute=function(getterSetter,context){if(getterSetter&&getterSetter.isComputed){return getterSetter;}
var computedData,bindings=0,computed,canbind=true;if(typeof getterSetter==="function"){computed=function(value){if(value===undefined){if(computedData){if(bindings&&can.Observe.__reading){can.Observe.__reading(computed,'change');}
return computedData.value;}else{return getterSetter.call(context||this)}}else{return getterSetter.apply(context||this,arguments)}}}else{computed=function(val){if(val===undefined){if(can.Observe.__reading){can.Observe.__reading(computed,'change');}
return getterSetter;}else{var old=getterSetter;getterSetter=val;if(old!==val){can.Observe.triggerBatch(computed,"change",[val,old]);}
return val;}}
canbind=false;}
computed.isComputed=true;computed.bind=function(ev,handler){can.addEvent.apply(computed,arguments);if(bindings===0&&canbind){computedData=computeBinder(getterSetter,context||this,function(newValue,oldValue){can.Observe.triggerBatch(computed,"change",[newValue,oldValue])});}
bindings++;}
computed.unbind=function(ev,handler){can.removeEvent.apply(computed,arguments);bindings--;if(bindings===0&&canbind){computedData.teardown();}};return computed;};can.compute.binder=computeBinder;var newLine=/(\r|\n)+/g,tagToContentPropMap={option:"textContent",textarea:"value"},clean=function(content){return content.split('\\').join("\\\\").split("\n").join("\\n").split('"').join('\\"').split("\t").join("\\t");},reverseTagMap={tr:"tbody",option:"select",td:"tr",li:"ul"},getTag=function(tagName,tokens,i){if(tagName){return tagName;}else{while(i<tokens.length){if(tokens[i]=="<"&&reverseTagMap[tokens[i+1]]){return reverseTagMap[tokens[i+1]];}
i++;}}},bracketNum=function(content){return(--content.split("{").length)-(--content.split("}").length);},myEval=function(script){eval(script);},attrReg=/([^\s]+)[\s]*=[\s]*$/,startTxt='var ___v1ew = [];',finishTxt="return ___v1ew.join('')",put_cmd="___v1ew.push(",insert_cmd=put_cmd,htmlTag=null,quote=null,beforeQuote=null,rescan=null,status=function(){return quote?"'"+beforeQuote.match(attrReg)[1]+"'":(htmlTag?1:0);};can.view.Scanner=Scanner=function(options){can.extend(this,{text:{},tokens:[]},options);this.tokenReg=[];this.tokenSimple={"<":"<",">":">",'"':'"',"'":"'"};this.tokenComplex=[];this.tokenMap={};for(var i=0,token;token=this.tokens[i];i++){if(token[2]){this.tokenReg.push(token[2]);this.tokenComplex.push({abbr:token[1],re:new RegExp(token[2]),rescan:token[3]});}
else{this.tokenReg.push(token[1]);this.tokenSimple[token[1]]=token[0];}
this.tokenMap[token[0]]=token[1];}
this.tokenReg=new RegExp("("+this.tokenReg.slice(0).concat(["<",">",'"',"'"]).join("|")+")","g");};Scanner.prototype={helpers:[{name:/\s*\(([\$\w]+)\)\s*->([^\n]*)/,fn:function(content){var quickFunc=/\s*\(([\$\w]+)\)\s*->([^\n]*)/,parts=content.match(quickFunc);return"function(__){var "+parts[1]+"=can.$(__);"+parts[2]+"}";}}],scan:function(source,name){var tokens=[],last=0,simple=this.tokenSimple,complex=this.tokenComplex;source=source.replace(newLine,"\n");source.replace(this.tokenReg,function(whole,part){var offset=arguments[arguments.length-2];if(offset>last){tokens.push(source.substring(last,offset));}
if(simple[whole]){tokens.push(whole);}
else{for(var i=0,token;token=complex[i];i++){if(token.re.test(whole)){tokens.push(token.abbr);if(token.rescan){tokens.push(token.rescan(part));}
break;}}}
last=offset+part.length;});if(last<source.length){tokens.push(source.substr(last));}
var content='',buff=[startTxt+(this.text.start||'')],put=function(content,bonus){buff.push(put_cmd,'"',clean(content),'"'+(bonus||'')+');');},endStack=[],lastToken,startTag=null,magicInTag=false,tagName='',tagNames=[],bracketCount,i=0,token,tmap=this.tokenMap;htmlTag=quote=beforeQuote=null;for(;(token=tokens[i++])!==undefined;){if(startTag===null){switch(token){case tmap.left:case tmap.escapeLeft:case tmap.returnLeft:magicInTag=htmlTag&&1;case tmap.commentLeft:startTag=token;if(content.length){put(content);}
content='';break;case tmap.escapeFull:magicInTag=htmlTag&&1;rescan=1;startTag=tmap.escapeLeft;if(content.length){put(content);}
rescan=tokens[i++];content=rescan.content||rescan;if(rescan.before){put(rescan.before);}
tokens.splice(i,0,tmap.right);break;case tmap.commentFull:break;case tmap.templateLeft:content+=tmap.left;break;case'<':if(tokens[i].indexOf("!--")!==0){htmlTag=1;magicInTag=0;}
content+=token;break;case'>':htmlTag=0;var emptyElement=content.substr(content.length-1)=="/";if(magicInTag||tagToContentPropMap[tagNames[tagNames.length-1]]){if(emptyElement){put(content.substr(0,content.length-1),",can.view.pending(),\"/>\"");}else{put(content,",can.view.pending(),\">\"");}
content='';}else{content+=token;}
if(emptyElement){tagNames.pop();tagName=tagNames[tagNames.length-1];}
break;case"'":case'"':if(htmlTag){if(quote&&quote===token){quote=null;}else if(quote===null){quote=token;beforeQuote=lastToken;}}
default:if(lastToken==='<'){tagName=token.split(/\s/)[0];if(tagName.indexOf("/")===0&&tagNames.pop()===tagName.substr(1)){tagName=tagNames[tagNames.length-1];}else{tagNames.push(tagName);}}
content+=token;break;}}else{switch(token){case tmap.right:case tmap.returnRight:switch(startTag){case tmap.left:bracketCount=bracketNum(content);if(bracketCount==1){buff.push(insert_cmd,"can.view.txt(0,'"+getTag(tagName,tokens,i)+"',"+status()+",this,function(){",startTxt,content);endStack.push({before:"",after:finishTxt+"}));\n"});}
else{last=endStack.length&&bracketCount==-1?endStack.pop():{after:";"};if(last.before){buff.push(last.before);}
buff.push(content,";",last.after);}
break;case tmap.escapeLeft:case tmap.returnLeft:bracketCount=bracketNum(content);if(bracketCount){endStack.push({before:finishTxt,after:"}));"});}
var escaped=startTag===tmap.escapeLeft?1:0,commands={insert:insert_cmd,tagName:tagName,status:status()};for(var ii=0;ii<this.helpers.length;ii++){var helper=this.helpers[ii];if(helper.name.test(content)){content=helper.fn(content,commands);if(helper.name.source==/^>[\s|\w]\w*/.source){escaped=0;}
break;}}
if(typeof content=='object'){if(content.raw){buff.push(content.raw);}}else{buff.push(insert_cmd,"can.view.txt("+escaped+",'"+tagName+"',"+status()+",this,function(){ "+(this.text.escape||'')+"return ",content,bracketCount?startTxt:"}));");}
if(rescan&&rescan.after&&rescan.after.length){put(rescan.after.length);rescan=null;}
break;}
startTag=null;content='';break;case tmap.templateLeft:content+=tmap.left;break;default:content+=token;break;}}
lastToken=token;}
if(content.length){put(content);}
buff.push(";");var template=buff.join(''),out={out:'with(_VIEW) { with (_CONTEXT) {'+template+" "+finishTxt+"}}"};myEval.call(out,'this.fn = (function(_CONTEXT,_VIEW){'+out.out+'});\r\n//@ sourceURL='+name+".js");return out;}};var canExpando=true;try{document.createTextNode()._=0;}catch(ex){canExpando=false;}
var attrMap={"class":"className","value":"value","textContent":"textContent"},tagMap={"":"span",table:"tr",tr:"td",ol:"li",ul:"li",tbody:"tr",thead:"tr",tfoot:"tr",select:"option",optgroup:"option"},attributePlaceholder='__!!__',attributeReplace=/__!!__/g,tagToContentPropMap={option:"textContent",textarea:"value"},bool=can.each(["checked","disabled","readonly","required"],function(n){attrMap[n]=n;}),getParentNode=function(el,defaultParentNode){return defaultParentNode&&el.parentNode.nodeType===11?defaultParentNode:el.parentNode;},setAttr=function(el,attrName,val){var tagName=el.nodeName.toString().toLowerCase(),prop=attrMap[attrName];if(prop){el[prop]=can.inArray(attrName,bool)>-1?true:val;if(prop==="value"&&tagName==="input"){el.defaultValue=val;}}else{el.setAttribute(attrName,val);}},getAttr=function(el,attrName){return(attrMap[attrName]?el[attrMap[attrName]]:el.getAttribute(attrName))||'';},removeAttr=function(el,attrName){if(can.inArray(attrName,bool)>-1){el[attrName]=false;}else{el.removeAttribute(attrName);}},pendingHookups=[],contentText=function(input){if(typeof input=='string'){return input;}
if(!input&&input!==0){return'';}
var hook=(input.hookup&&function(el,id){input.hookup.call(input,el,id);})||(typeof input=='function'&&input);if(hook){pendingHookups.push(hook);return'';}
return""+input;},contentEscape=function(txt){return(typeof txt=='string'||typeof txt=='number')?can.esc(txt):contentText(txt);},nodeMap={},textNodeMap={},nodeListMap={},expando="ejs_"+Math.random(),_id=0,id=function(node){if(canExpando||node.nodeType!==3){if(node[expando]){return node[expando];}
else{return node[expando]=(node.nodeName?"element_":"obj_")+(++_id);}}
else{for(var textNodeID in textNodeMap){if(textNodeMap[textNodeID]===node){return textNodeID;}}
textNodeMap["text_"+(++_id)]=node;return"text_"+_id;}},removeNodeListId=function(node,nodeListId){var nodeListIds=nodeMap[id(node)];if(nodeListIds){var index=can.inArray(nodeListId,nodeListIds);if(index>=0){nodeListIds.splice(index,1);}
if(!nodeListIds.length){delete nodeMap[id(node)];}}},addNodeListId=function(node,nodeListId){var nodeListIds=nodeMap[id(node)];if(!nodeListIds){nodeListIds=nodeMap[id(node)]=[];}
nodeListIds.push(nodeListId);},tagChildren=function(tagName){var newTag=tagMap[tagName]||"span";if(newTag==="span"){return"@@!!@@";}
return"<"+newTag+">"+tagChildren(newTag)+"</"+newTag+">";};can.extend(can.view,{pending:function(){var hooks=pendingHookups.slice(0);lastHookups=hooks;pendingHookups=[];return can.view.hook(function(el){can.each(hooks,function(fn){fn(el);});});},registerNode:function(nodeList){var nLId=id(nodeList);nodeListMap[nLId]=nodeList;can.each(nodeList,function(node){addNodeListId(node,nLId);});},unregisterNode:function(nodeList){var nLId=id(nodeList);can.each(nodeList,function(node){removeNodeListId(node,nLId);});delete nodeListMap[nLId];},txt:function(escape,tagName,status,self,func){var binding=can.compute.binder(func,self,function(newVal,oldVal){update(newVal,oldVal);});if(!binding.isListening){return(escape||status!==0?contentEscape:contentText)(binding.value);}
var parentElement,nodeList,teardown=function(){binding.teardown();if(nodeList){can.view.unregisterNode(nodeList);}},setupTeardownOnDestroy=function(el){can.bind.call(el,'destroyed',teardown);parentElement=el;},teardownCheck=function(parent){if(!parent){teardown();can.unbind.call(parentElement,'destroyed',teardown);}},tag=(tagMap[tagName]||"span"),update,contentProp=tagToContentPropMap[tagName];if(status===0&&!contentProp){return"<"+tag+can.view.hook(escape?function(el,parentNode){update=function(newVal){node.nodeValue=""+newVal;teardownCheck(node.parentNode);};var parent=getParentNode(el,parentNode),node=document.createTextNode(binding.value);parent.insertBefore(node,el);parent.removeChild(el);setupTeardownOnDestroy(parent);}:function(span,parentNode){update=function(newVal){var attached=nodes[0].parentNode;if(attached){makeAndPut(newVal);}
teardownCheck(nodes[0].parentNode);};parentNode=getParentNode(span,parentNode);var nodes,makeAndPut=function(val){var frag=can.view.frag(val,parentNode),newNodes=can.makeArray(frag.childNodes),last=nodes?nodes[nodes.length-1]:span;if(last.nextSibling){last.parentNode.insertBefore(frag,last.nextSibling);}else{last.parentNode.appendChild(frag);}
if(!nodes){can.remove(can.$(span));nodes=newNodes;nodeList=nodes;can.view.registerNode(nodes);}else{can.remove(can.$(nodes));can.view.replace(nodes,newNodes);}};makeAndPut(binding.value,[span]);setupTeardownOnDestroy(parentNode);})+">"+tagChildren(tag)+"</"+tag+">";}else if(status===1){var attrName=binding.value.replace(/['"]/g,'').split('=')[0];pendingHookups.push(function(el){update=function(newVal){var parts=(newVal||"").replace(/['"]/g,'').split('='),newAttrName=parts[0];if((newAttrName!=attrName)&&attrName){removeAttr(el,attrName);}
if(newAttrName){setAttr(el,newAttrName,parts[1]);attrName=newAttrName;}};setupTeardownOnDestroy(el);});return binding.value;}else{var attributeName=status===0?contentProp:status;(status===0?lastHookups:pendingHookups).push(function(el){update=function(){setAttr(el,attributeName,hook.render(),contentProp);};var wrapped=can.$(el),hooks;hooks=can.data(wrapped,'hooks');if(!hooks){can.data(wrapped,'hooks',hooks={});}
var attr=getAttr(el,attributeName,contentProp),parts=attr.split(attributePlaceholder),goodParts=[],hook;goodParts.push(parts.shift(),parts.join(attributePlaceholder));if(hooks[attributeName]){hooks[attributeName].bindings.push(binding);}else{hooks[attributeName]={render:function(){var i=0,newAttr=attr.replace(attributeReplace,function(){return contentText(hook.bindings[i++].value);});return newAttr;},bindings:[binding],batchNum:undefined};}
hook=hooks[attributeName];goodParts.splice(1,0,binding.value);setAttr(el,attributeName,goodParts.join(""),contentProp);setupTeardownOnDestroy(el);});return attributePlaceholder;}},replace:function(oldNodeList,newNodes){oldNodeList=can.makeArray(oldNodeList);can.each(oldNodeList,function(node){can.each(can.makeArray(nodeMap[id(node)]),function(nodeListId){var nodeList=nodeListMap[nodeListId],startIndex=can.inArray(node,nodeList),endIndex=can.inArray(oldNodeList[oldNodeList.length-1],nodeList);if(startIndex>=0&&endIndex>=0){for(var i=startIndex;i<=endIndex;i++){var n=nodeList[i];removeNodeListId(n,nodeListId);}
nodeList.splice.apply(nodeList,[startIndex,endIndex-startIndex+1].concat(newNodes));can.each(newNodes,function(node){addNodeListId(node,nodeListId);});}else{can.view.unregisterNode(nodeList);}});});},canExpando:canExpando,textNodeMap:textNodeMap,nodeMap:nodeMap,nodeListMap:nodeListMap});var extend=can.extend,EJS=function(options){if(this.constructor!=EJS){var ejs=new EJS(options);return function(data,helpers){return ejs.render(data,helpers);};}
if(typeof options=="function"){this.template={fn:options};return;}
extend(this,options);this.template=this.scanner.scan(this.text,this.name);};can.EJS=EJS;EJS.prototype.render=function(object,extraHelpers){object=object||{};return this.template.fn.call(object,object,new EJS.Helpers(object,extraHelpers||{}));};extend(EJS.prototype,{scanner:new can.view.Scanner({tokens:[["templateLeft","<%%"],["templateRight","%>"],["returnLeft","<%=="],["escapeLeft","<%="],["commentLeft","<%#"],["left","<%"],["right","%>"],["returnRight","%>"]]})});EJS.Helpers=function(data,extras){this._data=data;this._extras=extras;extend(this,extras);};EJS.Helpers.prototype={list:function(list,cb){can.each(list,function(item,i){cb(item,i,list)})}};can.view.register({suffix:"ejs",script:function(id,src){return"can.EJS(function(_CONTEXT,_VIEW) { "+new EJS({text:src,name:id}).template.out+" })";},renderer:function(id,text){return EJS({text:text,name:id});}});})(this,jQuery);

/*
Date: 9/17/2015 8:17:19 PM
Non-published images:
/webdav/17%20Ireland-English%20web/Building%20Blocks/System/00%20Shared/Content/CSS/i/options,merge
*/