var JSON;if(!JSON){JSON={};}
(function(){'use strict';function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==='string'){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());;(function(){var root=this;var previousUnderscore=root._;var breaker={};var ArrayProto=Array.prototype,ObjProto=Object.prototype,FuncProto=Function.prototype;var slice=ArrayProto.slice,unshift=ArrayProto.unshift,toString=ObjProto.toString,hasOwnProperty=ObjProto.hasOwnProperty;var
nativeForEach=ArrayProto.forEach,nativeMap=ArrayProto.map,nativeReduce=ArrayProto.reduce,nativeReduceRight=ArrayProto.reduceRight,nativeFilter=ArrayProto.filter,nativeEvery=ArrayProto.every,nativeSome=ArrayProto.some,nativeIndexOf=ArrayProto.indexOf,nativeLastIndexOf=ArrayProto.lastIndexOf,nativeIsArray=Array.isArray,nativeKeys=Object.keys,nativeBind=FuncProto.bind;var _=function(obj){return new wrapper(obj);};if(typeof exports!=='undefined'){if(typeof module!=='undefined'&&module.exports){exports=module.exports=_;}
exports._=_;}else if(typeof define==='function'&&define.amd){define('underscore',function(){return _;});}else{root['_']=_;}
_.VERSION='1.2.2';var each=_.each=_.forEach=function(obj,iterator,context){if(obj==null)return;if(nativeForEach&&obj.forEach===nativeForEach){obj.forEach(iterator,context);}else if(obj.length===+obj.length){for(var i=0,l=obj.length;i<l;i++){if(i in obj&&iterator.call(context,obj[i],i,obj)===breaker)return;}}else{for(var key in obj){if(hasOwnProperty.call(obj,key)){if(iterator.call(context,obj[key],key,obj)===breaker)return;}}}};_.map=function(obj,iterator,context){var results=[];if(obj==null)return results;if(nativeMap&&obj.map===nativeMap)return obj.map(iterator,context);each(obj,function(value,index,list){results[results.length]=iterator.call(context,value,index,list);});return results;};_.reduce=_.foldl=_.inject=function(obj,iterator,memo,context){var initial=memo!==void 0;if(obj==null)obj=[];if(nativeReduce&&obj.reduce===nativeReduce){if(context)iterator=_.bind(iterator,context);return initial?obj.reduce(iterator,memo):obj.reduce(iterator);}
each(obj,function(value,index,list){if(!initial){memo=value;initial=true;}else{memo=iterator.call(context,memo,value,index,list);}});if(!initial)throw new TypeError("Reduce of empty array with no initial value");return memo;};_.reduceRight=_.foldr=function(obj,iterator,memo,context){if(obj==null)obj=[];if(nativeReduceRight&&obj.reduceRight===nativeReduceRight){if(context)iterator=_.bind(iterator,context);return memo!==void 0?obj.reduceRight(iterator,memo):obj.reduceRight(iterator);}
var reversed=(_.isArray(obj)?obj.slice():_.toArray(obj)).reverse();return _.reduce(reversed,iterator,memo,context);};_.find=_.detect=function(obj,iterator,context){var result;any(obj,function(value,index,list){if(iterator.call(context,value,index,list)){result=value;return true;}});return result;};_.filter=_.select=function(obj,iterator,context){var results=[];if(obj==null)return results;if(nativeFilter&&obj.filter===nativeFilter)return obj.filter(iterator,context);each(obj,function(value,index,list){if(iterator.call(context,value,index,list))results[results.length]=value;});return results;};_.reject=function(obj,iterator,context){var results=[];if(obj==null)return results;each(obj,function(value,index,list){if(!iterator.call(context,value,index,list))results[results.length]=value;});return results;};_.every=_.all=function(obj,iterator,context){var result=true;if(obj==null)return result;if(nativeEvery&&obj.every===nativeEvery)return obj.every(iterator,context);each(obj,function(value,index,list){if(!(result=result&&iterator.call(context,value,index,list)))return breaker;});return result;};var any=_.some=_.any=function(obj,iterator,context){iterator=iterator||_.identity;var result=false;if(obj==null)return result;if(nativeSome&&obj.some===nativeSome)return obj.some(iterator,context);each(obj,function(value,index,list){if(result||(result=iterator.call(context,value,index,list)))return breaker;});return!!result;};_.include=_.contains=function(obj,target){var found=false;if(obj==null)return found;if(nativeIndexOf&&obj.indexOf===nativeIndexOf)return obj.indexOf(target)!=-1;found=any(obj,function(value){return value===target;});return found;};_.invoke=function(obj,method){var args=slice.call(arguments,2);return _.map(obj,function(value){return(method.call?method||value:value[method]).apply(value,args);});};_.pluck=function(obj,key){return _.map(obj,function(value){return value[key];});};_.max=function(obj,iterator,context){if(!iterator&&_.isArray(obj))return Math.max.apply(Math,obj);if(!iterator&&_.isEmpty(obj))return-Infinity;var result={computed:-Infinity};each(obj,function(value,index,list){var computed=iterator?iterator.call(context,value,index,list):value;computed>=result.computed&&(result={value:value,computed:computed});});return result.value;};_.min=function(obj,iterator,context){if(!iterator&&_.isArray(obj))return Math.min.apply(Math,obj);if(!iterator&&_.isEmpty(obj))return Infinity;var result={computed:Infinity};each(obj,function(value,index,list){var computed=iterator?iterator.call(context,value,index,list):value;computed<result.computed&&(result={value:value,computed:computed});});return result.value;};_.shuffle=function(obj){var shuffled=[],rand;each(obj,function(value,index,list){if(index==0){shuffled[0]=value;}else{rand=Math.floor(Math.random()*(index+1));shuffled[index]=shuffled[rand];shuffled[rand]=value;}});return shuffled;};_.sortBy=function(obj,iterator,context){return _.pluck(_.map(obj,function(value,index,list){return{value:value,criteria:iterator.call(context,value,index,list)};}).sort(function(left,right){var a=left.criteria,b=right.criteria;return a<b?-1:a>b?1:0;}),'value');};_.groupBy=function(obj,val){var result={};var iterator=_.isFunction(val)?val:function(obj){return obj[val];};each(obj,function(value,index){var key=iterator(value,index);(result[key]||(result[key]=[])).push(value);});return result;};_.sortedIndex=function(array,obj,iterator){iterator||(iterator=_.identity);var low=0,high=array.length;while(low<high){var mid=(low+high)>>1;iterator(array[mid])<iterator(obj)?low=mid+1:high=mid;}
return low;};_.toArray=function(iterable){if(!iterable)return[];if(iterable.toArray)return iterable.toArray();if(_.isArray(iterable))return slice.call(iterable);if(_.isArguments(iterable))return slice.call(iterable);return _.values(iterable);};_.size=function(obj){return _.toArray(obj).length;};_.first=_.head=function(array,n,guard){return(n!=null)&&!guard?slice.call(array,0,n):array[0];};_.initial=function(array,n,guard){return slice.call(array,0,array.length-((n==null)||guard?1:n));};_.last=function(array,n,guard){if((n!=null)&&!guard){return slice.call(array,Math.max(array.length-n,0));}else{return array[array.length-1];}};_.rest=_.tail=function(array,index,guard){return slice.call(array,(index==null)||guard?1:index);};_.compact=function(array){return _.filter(array,function(value){return!!value;});};_.flatten=function(array,shallow){return _.reduce(array,function(memo,value){if(_.isArray(value))return memo.concat(shallow?value:_.flatten(value));memo[memo.length]=value;return memo;},[]);};_.without=function(array){return _.difference(array,slice.call(arguments,1));};_.uniq=_.unique=function(array,isSorted,iterator){var initial=iterator?_.map(array,iterator):array;var result=[];_.reduce(initial,function(memo,el,i){if(0==i||(isSorted===true?_.last(memo)!=el:!_.include(memo,el))){memo[memo.length]=el;result[result.length]=array[i];}
return memo;},[]);return result;};_.union=function(){return _.uniq(_.flatten(arguments,true));};_.intersection=_.intersect=function(array){var rest=slice.call(arguments,1);return _.filter(_.uniq(array),function(item){return _.every(rest,function(other){return _.indexOf(other,item)>=0;});});};_.difference=function(array){var rest=_.flatten(slice.call(arguments,1));return _.filter(array,function(value){return!_.include(rest,value);});};_.symDifference=function(){return _.reduce(arguments,function(memo,array){return _.union(_.difference(memo,array),_.difference(array,memo));});};_.zip=function(){var args=slice.call(arguments);var length=_.max(_.pluck(args,'length'));var results=new Array(length);for(var i=0;i<length;i++)results[i]=_.pluck(args,""+i);return results;};_.indexOf=function(array,item,isSorted){if(array==null)return-1;var i,l;if(isSorted){i=_.sortedIndex(array,item);return array[i]===item?i:-1;}
if(nativeIndexOf&&array.indexOf===nativeIndexOf)return array.indexOf(item);for(i=0,l=array.length;i<l;i++)if(i in array&&array[i]===item)return i;return-1;};_.lastIndexOf=function(array,item){if(array==null)return-1;if(nativeLastIndexOf&&array.lastIndexOf===nativeLastIndexOf)return array.lastIndexOf(item);var i=array.length;while(i--)if(i in array&&array[i]===item)return i;return-1;};_.range=function(start,stop,step){if(arguments.length<=1){stop=start||0;start=0;}
step=arguments[2]||1;var len=Math.max(Math.ceil((stop-start)/step),0);var idx=0;var range=new Array(len);while(idx<len){range[idx++]=start;start+=step;}
return range;};var ctor=function(){};_.bind=function bind(func,context){var bound,args;if(func.bind===nativeBind&&nativeBind)return nativeBind.apply(func,slice.call(arguments,1));if(!_.isFunction(func))throw new TypeError;args=slice.call(arguments,2);return bound=function(){if(!(this instanceof bound))return func.apply(context,args.concat(slice.call(arguments)));ctor.prototype=func.prototype;var self=new ctor;var result=func.apply(self,args.concat(slice.call(arguments)));if(Object(result)===result)return result;return self;};};_.bindAll=function(obj){var funcs=slice.call(arguments,1);if(funcs.length==0)funcs=_.functions(obj);each(funcs,function(f){obj[f]=_.bind(obj[f],obj);});return obj;};_.memoize=function(func,hasher){var memo={};hasher||(hasher=_.identity);return function(){var key=hasher.apply(this,arguments);return hasOwnProperty.call(memo,key)?memo[key]:(memo[key]=func.apply(this,arguments));};};_.delay=function(func,wait){var args=slice.call(arguments,2);return setTimeout(function(){return func.apply(func,args);},wait);};_.defer=function(func){return _.delay.apply(_,[func,1].concat(slice.call(arguments,1)));};_.throttle=function(func,wait){var context,args,timeout,throttling,more;var whenDone=_.debounce(function(){more=throttling=false;},wait);return function(){context=this;args=arguments;var later=function(){timeout=null;if(more)func.apply(context,args);whenDone();};if(!timeout)timeout=setTimeout(later,wait);if(throttling){more=true;}else{func.apply(context,args);}
whenDone();throttling=true;};};_.debounce=function(func,wait){var timeout;return function(){var context=this,args=arguments;var later=function(){timeout=null;func.apply(context,args);};clearTimeout(timeout);timeout=setTimeout(later,wait);};};_.once=function(func){var ran=false,memo;return function(){if(ran)return memo;ran=true;return memo=func.apply(this,arguments);};};_.wrap=function(func,wrapper){return function(){var args=[func].concat(slice.call(arguments));return wrapper.apply(this,args);};};_.compose=function(){var funcs=slice.call(arguments);return function(){var args=slice.call(arguments);for(var i=funcs.length-1;i>=0;i--){args=[funcs[i].apply(this,args)];}
return args[0];};};_.after=function(times,func){if(times<=0)return func();return function(){if(--times<1){return func.apply(this,arguments);}};};_.keys=nativeKeys||function(obj){if(obj!==Object(obj))throw new TypeError('Invalid object');var keys=[];for(var key in obj)if(hasOwnProperty.call(obj,key))keys[keys.length]=key;return keys;};_.values=function(obj){return _.map(obj,_.identity);};_.functions=_.methods=function(obj){var names=[];for(var key in obj){if(_.isFunction(obj[key]))names.push(key);}
return names.sort();};_.extend=function(obj){each(slice.call(arguments,1),function(source){for(var prop in source){if(source[prop]!==void 0)obj[prop]=source[prop];}});return obj;};_.defaults=function(obj){each(slice.call(arguments,1),function(source){for(var prop in source){if(obj[prop]==null)obj[prop]=source[prop];}});return obj;};_.clone=function(obj){if(!_.isObject(obj))return obj;return _.isArray(obj)?obj.slice():_.extend({},obj);};_.tap=function(obj,interceptor){interceptor(obj);return obj;};function eq(a,b,stack){if(a===b)return a!==0||1/a==1/b;if(a==null||b==null)return a===b;if(a._chain)a=a._wrapped;if(b._chain)b=b._wrapped;if(_.isFunction(a.isEqual))return a.isEqual(b);if(_.isFunction(b.isEqual))return b.isEqual(a);var className=toString.call(a);if(className!=toString.call(b))return false;switch(className){case'[object String]':return String(a)==String(b);case'[object Number]':a=+a;b=+b;return a!=a?b!=b:(a==0?1/a==1/b:a==b);case'[object Date]':case'[object Boolean]':return+a==+b;case'[object RegExp]':return a.source==b.source&&a.global==b.global&&a.multiline==b.multiline&&a.ignoreCase==b.ignoreCase;}
if(typeof a!='object'||typeof b!='object')return false;var length=stack.length;while(length--){if(stack[length]==a)return true;}
stack.push(a);var size=0,result=true;if(className=='[object Array]'){size=a.length;result=size==b.length;if(result){while(size--){if(!(result=size in a==size in b&&eq(a[size],b[size],stack)))break;}}}else{if("constructor"in a!="constructor"in b||a.constructor!=b.constructor)return false;for(var key in a){if(hasOwnProperty.call(a,key)){size++;if(!(result=hasOwnProperty.call(b,key)&&eq(a[key],b[key],stack)))break;}}
if(result){for(key in b){if(hasOwnProperty.call(b,key)&&!(size--))break;}
result=!size;}}
stack.pop();return result;}
_.isEqual=function(a,b){return eq(a,b,[]);};_.isEmpty=function(obj){if(_.isArray(obj)||_.isString(obj))return obj.length===0;for(var key in obj)if(hasOwnProperty.call(obj,key))return false;return true;};_.isElement=function(obj){return!!(obj&&obj.nodeType==1);};_.isArray=nativeIsArray||function(obj){return toString.call(obj)=='[object Array]';};_.isObject=function(obj){return obj===Object(obj);};if(toString.call(arguments)=='[object Arguments]'){_.isArguments=function(obj){return toString.call(obj)=='[object Arguments]';};}else{_.isArguments=function(obj){return!!(obj&&hasOwnProperty.call(obj,'callee'));};}
_.isFunction=function(obj){return toString.call(obj)=='[object Function]';};_.isString=function(obj){return toString.call(obj)=='[object String]';};_.isNumber=function(obj){return toString.call(obj)=='[object Number]';};_.isNaN=function(obj){return obj!==obj;};_.isBoolean=function(obj){return obj===true||obj===false||toString.call(obj)=='[object Boolean]';};_.isDate=function(obj){return toString.call(obj)=='[object Date]';};_.isRegExp=function(obj){return toString.call(obj)=='[object RegExp]';};_.isNull=function(obj){return obj===null;};_.isUndefined=function(obj){return obj===void 0;};_.noConflict=function(){root._=previousUnderscore;return this;};_.identity=function(value){return value;};_.times=function(n,iterator,context){for(var i=0;i<n;i++)iterator.call(context,i);};_.escape=function(string){return(''+string).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;').replace(/'/g,'&#x27;').replace(/\//g,'&#x2F;');};_.mixin=function(obj){each(_.functions(obj),function(name){addToWrapper(name,_[name]=obj[name]);});};var idCounter=0;_.uniqueId=function(prefix){var id=idCounter++;return prefix?prefix+id:id;};_.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};_.template=function(str,data){var c=_.templateSettings;var tmpl='var __p=[],print=function(){__p.push.apply(__p,arguments);};'+'with(obj||{}){__p.push(\''+
str.replace(/\\/g,'\\\\').replace(/'/g,"\\'").replace(c.escape,function(match,code){return"',_.escape("+code.replace(/\\'/g,"'")+"),'";}).replace(c.interpolate,function(match,code){return"',"+code.replace(/\\'/g,"'")+",'";}).replace(c.evaluate||null,function(match,code){return"');"+code.replace(/\\'/g,"'").replace(/[\r\n\t]/g,' ')+";__p.push('";}).replace(/\r/g,'\\r').replace(/\n/g,'\\n').replace(/\t/g,'\\t')
+"');}return __p.join('');";var func=new Function('obj','_',tmpl);if(data)return func(data,_);return function(data){return func.call(this,data,_);};};var wrapper=function(obj){this._wrapped=obj;};_.prototype=wrapper.prototype;var result=function(obj,chain){return chain?_(obj).chain():obj;};var addToWrapper=function(name,func){wrapper.prototype[name]=function(){var args=slice.call(arguments);unshift.call(args,this._wrapped);return result(func.apply(_,args),this._chain);};};_.mixin(_);each(['pop','push','reverse','shift','sort','splice','unshift'],function(name){var method=ArrayProto[name];wrapper.prototype[name]=function(){method.apply(this._wrapped,arguments);return result(this._wrapped,this._chain);};});each(['concat','join','slice'],function(name){var method=ArrayProto[name];wrapper.prototype[name]=function(){return result(method.apply(this._wrapped,arguments),this._chain);};});wrapper.prototype.chain=function(){this._chain=true;return this;};wrapper.prototype.value=function(){return this._wrapped;};}).call(this);;(function(){var root=this;var previousBackbone=root.Backbone;var slice=Array.prototype.slice;var Backbone;if(typeof exports!=='undefined'){Backbone=exports;}else{Backbone=root.Backbone={};}
Backbone.VERSION='0.5.3';var _=root._;if(!_&&(typeof require!=='undefined'))_=require('underscore')._;var $=root.jQuery||root.Zepto||root.ender;Backbone.noConflict=function(){root.Backbone=previousBackbone;return this;};Backbone.emulateHTTP=false;Backbone.emulateJSON=false;Backbone.Events={bind:function(ev,callback,context){var calls=this._callbacks||(this._callbacks={});var list=calls[ev]||(calls[ev]={});var tail=list.tail||(list.tail=list.next={});tail.callback=callback;tail.context=context;list.tail=tail.next={};return this;},unbind:function(ev,callback){var calls,node,prev;if(!ev){this._callbacks=null;}else if(calls=this._callbacks){if(!callback){calls[ev]={};}else if(node=calls[ev]){while((prev=node)&&(node=node.next)){if(node.callback!==callback)continue;prev.next=node.next;node.context=node.callback=null;break;}}}
return this;},trigger:function(eventName){var node,calls,callback,args,ev,events=['all',eventName];if(!(calls=this._callbacks))return this;while(ev=events.pop()){if(!(node=calls[ev]))continue;args=ev=='all'?arguments:slice.call(arguments,1);while(node=node.next)if(callback=node.callback)callback.apply(node.context||this,args);}
return this;}};Backbone.Model=function(attributes,options){var defaults;attributes||(attributes={});if(defaults=this.defaults){if(_.isFunction(defaults))defaults=defaults.call(this);attributes=_.extend({},defaults,attributes);}
this.attributes={};this._escapedAttributes={};this.cid=_.uniqueId('c');this.set(attributes,{silent:true});this._changed=false;this._previousAttributes=_.clone(this.attributes);if(options&&options.collection)this.collection=options.collection;this.initialize(attributes,options);};_.extend(Backbone.Model.prototype,Backbone.Events,{_changed:false,idAttribute:'id',initialize:function(){},toJSON:function(){return _.clone(this.attributes);},get:function(attr){return this.attributes[attr];},escape:function(attr){var html;if(html=this._escapedAttributes[attr])return html;var val=this.attributes[attr];return this._escapedAttributes[attr]=_.escape(val==null?'':''+val);},has:function(attr){return this.attributes[attr]!=null;},set:function(key,value,options){var attrs;if(_.isObject(key)){attrs=key;options=value;}else{attrs={};attrs[key]=value;}
options||(options={});if(!attrs)return this;if(attrs.attributes)attrs=attrs.attributes;if(options.unset)for(var attr in attrs)attrs[attr]=void 0;var now=this.attributes,escaped=this._escapedAttributes;if(!options.silent&&this.validate&&!this._performValidation(attrs,options))return false;if(this.idAttribute in attrs)this.id=attrs[this.idAttribute];var alreadyChanging=this._changing;this._changing=true;for(var attr in attrs){var val=attrs[attr];if(!_.isEqual(now[attr],val)||(options.unset&&(attr in now))){options.unset?delete now[attr]:now[attr]=val;delete escaped[attr];this._changed=true;if(!options.silent)this.trigger('change:'+attr,this,val,options);}}
if(!alreadyChanging){if(!options.silent&&this._changed)this.change(options);this._changing=false;}
return this;},unset:function(attr,options){(options||(options={})).unset=true;return this.set(attr,null,options);},clear:function(options){(options||(options={})).unset=true;return this.set(_.clone(this.attributes),options);},fetch:function(options){options||(options={});var model=this;var success=options.success;options.success=function(resp,status,xhr){if(!model.set(model.parse(resp,xhr),options))return false;if(success)success(model,resp);};options.error=wrapError(options.error,model,options);return(this.sync||Backbone.sync).call(this,'read',this,options);},save:function(attrs,options){options||(options={});if(attrs&&!this.set(attrs,options))return false;var model=this;var success=options.success;options.success=function(resp,status,xhr){if(!model.set(model.parse(resp,xhr),options))return false;if(success)success(model,resp,xhr);};options.error=wrapError(options.error,model,options);var method=this.isNew()?'create':'update';return(this.sync||Backbone.sync).call(this,method,this,options);},destroy:function(options){options||(options={});if(this.isNew())return this.trigger('destroy',this,this.collection,options);var model=this;var success=options.success;options.success=function(resp){model.trigger('destroy',model,model.collection,options);if(success)success(model,resp);};options.error=wrapError(options.error,model,options);return(this.sync||Backbone.sync).call(this,'delete',this,options);},url:function(){var base=getUrl(this.collection)||this.urlRoot||urlError();if(this.isNew())return base;return base+(base.charAt(base.length-1)=='/'?'':'/')+encodeURIComponent(this.id);},parse:function(resp,xhr){return resp;},clone:function(){return new this.constructor(this);},isNew:function(){return this.id==null;},change:function(options){this.trigger('change',this,options);this._previousAttributes=_.clone(this.attributes);this._changed=false;},hasChanged:function(attr){if(attr)return this._previousAttributes[attr]!=this.attributes[attr];return this._changed;},changedAttributes:function(now){if(!this._changed)return false;now||(now=this.attributes);var changed=false,old=this._previousAttributes;for(var attr in now){if(_.isEqual(old[attr],now[attr]))continue;(changed||(changed={}))[attr]=now[attr];}
for(var attr in old){if(!(attr in now))(changed||(changed={}))[attr]=void 0;}
return changed;},previous:function(attr){if(!attr||!this._previousAttributes)return null;return this._previousAttributes[attr];},previousAttributes:function(){return _.clone(this._previousAttributes);},_performValidation:function(attrs,options){var error=this.validate(attrs,options);if(error){if(options.error){options.error(this,error,options);}else{this.trigger('error',this,error,options);}
return false;}
return true;}});Backbone.Collection=function(models,options){options||(options={});if(options.comparator)this.comparator=options.comparator;_.bindAll(this,'_onModelEvent','_removeReference');this._reset();if(models)this.reset(models,{silent:true});this.initialize.apply(this,arguments);};_.extend(Backbone.Collection.prototype,Backbone.Events,{model:Backbone.Model,initialize:function(){},toJSON:function(){return this.map(function(model){return model.toJSON();});},add:function(models,options){if(_.isArray(models)){for(var i=0,l=models.length;i<l;i++){this._add(models[i],options);}}else{this._add(models,options);}
return this;},remove:function(models,options){if(_.isArray(models)){for(var i=0,l=models.length;i<l;i++){this._remove(models[i],options);}}else{this._remove(models,options);}
return this;},get:function(id){if(id==null)return null;return this._byId[id.id!=null?id.id:id];},getByCid:function(cid){return cid&&this._byCid[cid.cid||cid];},at:function(index){return this.models[index];},sort:function(options){options||(options={});if(!this.comparator)throw new Error('Cannot sort a set without a comparator');this.models=this.sortBy(this.comparator);if(!options.silent)this.trigger('reset',this,options);return this;},pluck:function(attr){return _.map(this.models,function(model){return model.get(attr);});},reset:function(models,options){models||(models=[]);options||(options={});this.each(this._removeReference);this._reset();this.add(models,{silent:true});if(!options.silent)this.trigger('reset',this,options);return this;},fetch:function(options){options||(options={});var collection=this;var success=options.success;options.success=function(resp,status,xhr){collection[options.add?'add':'reset'](collection.parse(resp,xhr),options);if(success)success(collection,resp);};options.error=wrapError(options.error,collection,options);return(this.sync||Backbone.sync).call(this,'read',this,options);},create:function(model,options){var coll=this;options||(options={});model=this._prepareModel(model,options);if(!model)return false;var success=options.success;options.success=function(nextModel,resp,xhr){coll.add(nextModel,options);if(success)success(nextModel,resp,xhr);};model.save(null,options);return model;},parse:function(resp,xhr){return resp;},chain:function(){return _(this.models).chain();},_reset:function(options){this.length=0;this.models=[];this._byId={};this._byCid={};},_prepareModel:function(model,options){if(!(model instanceof Backbone.Model)){var attrs=model;model=new this.model(attrs,{collection:this});if(model.validate&&!model._performValidation(model.attributes,options))model=false;}else if(!model.collection){model.collection=this;}
return model;},_add:function(model,options){options||(options={});model=this._prepareModel(model,options);if(!model)return false;var already=this.getByCid(model);if(already)throw new Error(["Can't add the same model to a set twice",already.id]);this._byId[model.id]=model;this._byCid[model.cid]=model;var index=options.at!=null?options.at:this.comparator?this.sortedIndex(model,this.comparator):this.length;this.models.splice(index,0,model);model.bind('all',this._onModelEvent);this.length++;options.index=index;if(!options.silent)model.trigger('add',model,this,options);return model;},_remove:function(model,options){options||(options={});model=this.getByCid(model)||this.get(model);if(!model)return null;delete this._byId[model.id];delete this._byCid[model.cid];var index=this.indexOf(model);this.models.splice(index,1);this.length--;options.index=index;if(!options.silent)model.trigger('remove',model,this,options);this._removeReference(model);return model;},_removeReference:function(model){if(this==model.collection){delete model.collection;}
model.unbind('all',this._onModelEvent);},_onModelEvent:function(ev,model,collection,options){if((ev=='add'||ev=='remove')&&collection!=this)return;if(ev=='destroy'){this._remove(model,options);}
if(model&&ev==='change:'+model.idAttribute){delete this._byId[model.previous(model.idAttribute)];this._byId[model.id]=model;}
this.trigger.apply(this,arguments);}});var methods=['forEach','each','map','reduce','reduceRight','find','detect','filter','select','reject','every','all','some','any','include','contains','invoke','max','min','sortBy','sortedIndex','toArray','size','first','rest','last','without','indexOf','lastIndexOf','isEmpty','groupBy'];_.each(methods,function(method){Backbone.Collection.prototype[method]=function(){return _[method].apply(_,[this.models].concat(_.toArray(arguments)));};});Backbone.Router=function(options){options||(options={});if(options.routes)this.routes=options.routes;this._bindRoutes();this.initialize.apply(this,arguments);};var namedParam=/:([\w\d]+)/g;var splatParam=/\*([\w\d]+)/g;var escapeRegExp=/[-[\]{}()+?.,\\^$|#\s]/g;_.extend(Backbone.Router.prototype,Backbone.Events,{initialize:function(){},route:function(route,name,callback){Backbone.history||(Backbone.history=new Backbone.History);if(!_.isRegExp(route))route=this._routeToRegExp(route);Backbone.history.route(route,_.bind(function(fragment){var args=this._extractParameters(route,fragment);callback&&callback.apply(this,args);this.trigger.apply(this,['route:'+name].concat(args));},this));},navigate:function(fragment,options){Backbone.history.navigate(fragment,options);},_bindRoutes:function(){if(!this.routes)return;var routes=[];for(var route in this.routes){routes.unshift([route,this.routes[route]]);}
for(var i=0,l=routes.length;i<l;i++){this.route(routes[i][0],routes[i][1],this[routes[i][1]]);}},_routeToRegExp:function(route){route=route.replace(escapeRegExp,"\\$&").replace(namedParam,"([^\/]*)").replace(splatParam,"(.*?)");return new RegExp('^'+route+'$');},_extractParameters:function(route,fragment){return route.exec(fragment).slice(1);}});Backbone.History=function(){this.handlers=[];_.bindAll(this,'checkUrl');};var hashStrip=/^#*/;var isExplorer=/msie [\w.]+/;var historyStarted=false;_.extend(Backbone.History.prototype,{interval:50,getFragment:function(fragment,forcePushState){if(fragment==null){if(this._hasPushState||forcePushState){fragment=window.location.pathname;var search=window.location.search;if(search)fragment+=search;}else{fragment=window.location.hash;}}
fragment=decodeURIComponent(fragment.replace(hashStrip,''));if(!fragment.indexOf(this.options.root))fragment=fragment.substr(this.options.root.length);return fragment;},start:function(options){if(historyStarted)throw new Error("Backbone.history has already been started");this.options=_.extend({},{root:'/'},this.options,options);this._wantsPushState=!!this.options.pushState;this._hasPushState=!!(this.options.pushState&&window.history&&window.history.pushState);var fragment=this.getFragment();var docMode=document.documentMode;var oldIE=(isExplorer.exec(navigator.userAgent.toLowerCase())&&(!docMode||docMode<=7));if(oldIE){this.iframe=$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo('body')[0].contentWindow;this.navigate(fragment);}
if(this._hasPushState){$(window).bind('popstate',this.checkUrl);}else if('onhashchange'in window&&!oldIE){$(window).bind('hashchange',this.checkUrl);}else{setInterval(this.checkUrl,this.interval);}
this.fragment=fragment;historyStarted=true;var loc=window.location;var atRoot=loc.pathname==this.options.root;if(this._wantsPushState&&!this._hasPushState&&!atRoot){this.fragment=this.getFragment(null,true);window.location.replace(this.options.root+'#'+this.fragment);return true;}else if(this._wantsPushState&&this._hasPushState&&atRoot&&loc.hash){this.fragment=loc.hash.replace(hashStrip,'');window.history.replaceState({},document.title,loc.protocol+'//'+loc.host+this.options.root+this.fragment);}
if(!this.options.silent){return this.loadUrl();}},route:function(route,callback){this.handlers.unshift({route:route,callback:callback});},checkUrl:function(e){var current=this.getFragment();if(current==this.fragment&&this.iframe)current=this.getFragment(this.iframe.location.hash);if(current==this.fragment||current==decodeURIComponent(this.fragment))return false;if(this.iframe)this.navigate(current);this.loadUrl()||this.loadUrl(window.location.hash);},loadUrl:function(fragmentOverride){var fragment=this.fragment=this.getFragment(fragmentOverride);var matched=_.any(this.handlers,function(handler){if(handler.route.test(fragment)){handler.callback(fragment);return true;}});return matched;},navigate:function(fragment,options){if(!options||options===true)options={trigger:options};var frag=(fragment||'').replace(hashStrip,'');if(this.fragment==frag||this.fragment==decodeURIComponent(frag))return;if(this._hasPushState){if(frag.indexOf(this.options.root)!=0)frag=this.options.root+frag;this.fragment=frag;window.history[options.replace?'replaceState':'pushState']({},document.title,frag);}else{this.fragment=frag;this._updateHash(window.location,frag,options.replace);if(this.iframe&&(frag!=this.getFragment(this.iframe.location.hash))){if(!options.replace)this.iframe.document.open().close();this._updateHash(this.iframe.location,frag,options.replace);}}
if(options.trigger)this.loadUrl(fragment);},_updateHash:function(location,fragment,replace){if(replace){location.replace(location.toString().replace(/#.*$/,'')+'#'+fragment);}else{location.hash=fragment;}}});Backbone.View=function(options){this.cid=_.uniqueId('view');this._configure(options||{});this._ensureElement();this.delegateEvents();this.initialize.apply(this,arguments);};var eventSplitter=/^(\S+)\s*(.*)$/;var viewOptions=['model','collection','el','id','attributes','className','tagName'];_.extend(Backbone.View.prototype,Backbone.Events,{tagName:'div',$:function(selector){return(selector==null)?$(this.el):$(selector,this.el);},initialize:function(){},render:function(){return this;},remove:function(){$(this.el).remove();return this;},make:function(tagName,attributes,content){var el=document.createElement(tagName);if(attributes)$(el).attr(attributes);if(content)$(el).html(content);return el;},delegateEvents:function(events){if(!(events||(events=this.events)))return;if(_.isFunction(events))events=events.call(this);this.undelegateEvents();for(var key in events){var method=this[events[key]];if(!method)throw new Error('Event "'+events[key]+'" does not exist');var match=key.match(eventSplitter);var eventName=match[1],selector=match[2];method=_.bind(method,this);eventName+='.delegateEvents'+this.cid;if(selector===''){$(this.el).bind(eventName,method);}else{$(this.el).delegate(selector,eventName,method);}}},undelegateEvents:function(){$(this.el).unbind('.delegateEvents'+this.cid);},_configure:function(options){if(this.options)options=_.extend({},this.options,options);for(var i=0,l=viewOptions.length;i<l;i++){var attr=viewOptions[i];if(options[attr])this[attr]=options[attr];}
this.options=options;},_ensureElement:function(){if(!this.el){var attrs=this.attributes||{};if(this.id)attrs.id=this.id;if(this.className)attrs['class']=this.className;this.el=this.make(this.tagName,attrs);}else if(_.isString(this.el)){this.el=$(this.el).get(0);}}});var extend=function(protoProps,classProps){var child=inherits(this,protoProps,classProps);child.extend=this.extend;return child;};Backbone.Model.extend=Backbone.Collection.extend=Backbone.Router.extend=Backbone.View.extend=extend;var methodMap={'create':'POST','update':'PUT','delete':'DELETE','read':'GET'};Backbone.sync=function(method,model,options){var type=methodMap[method];var params={type:type,dataType:'json'};if(!options.url){params.url=getUrl(model)||urlError();}
if(!options.data&&model&&(method=='create'||method=='update')){params.contentType='application/json';params.data=JSON.stringify(model.toJSON());}
if(Backbone.emulateJSON){params.contentType='application/x-www-form-urlencoded';params.data=params.data?{model:params.data}:{};}
if(Backbone.emulateHTTP){if(type==='PUT'||type==='DELETE'){if(Backbone.emulateJSON)params.data._method=type;params.type='POST';params.beforeSend=function(xhr){xhr.setRequestHeader('X-HTTP-Method-Override',type);};}}
if(params.type!=='GET'&&!Backbone.emulateJSON){params.processData=false;}
return $.ajax(_.extend(params,options));};var ctor=function(){};var inherits=function(parent,protoProps,staticProps){var child;if(protoProps&&protoProps.hasOwnProperty('constructor')){child=protoProps.constructor;}else{child=function(){return parent.apply(this,arguments);};}
_.extend(child,parent);ctor.prototype=parent.prototype;child.prototype=new ctor();if(protoProps)_.extend(child.prototype,protoProps);if(staticProps)_.extend(child,staticProps);child.prototype.constructor=child;child.__super__=parent.prototype;return child;};var getUrl=function(object){if(!(object&&object.url))return null;return _.isFunction(object.url)?object.url():object.url;};var urlError=function(){throw new Error('A "url" property or function must be specified');};var wrapError=function(onError,originalModel,options){return function(model,resp){var resp=model===originalModel?resp:model;if(onError){onError(model,resp,options);}else{originalModel.trigger('error',model,resp,options);}};};}).call(this);;(function(window,document,undefined){var prefixes=['webkit','Moz','ms','O'],animations={},useCssAnimations;function createEl(tag,prop){var el=document.createElement(tag||'div'),n;for(n in prop){el[n]=prop[n];}
return el;}
function ins(parent,child1,child2){if(child2&&!child2.parentNode)ins(parent,child2);parent.insertBefore(child1,child2||null);return parent;}
var sheet=(function(){var el=createEl('style');ins(document.getElementsByTagName('head')[0],el);return el.sheet||el.styleSheet;})();function addAnimation(alpha,trail,i,lines){var name=['opacity',trail,~~(alpha*100),i,lines].join('-'),start=0.01+i/lines*100,z=Math.max(1-(1-alpha)/trail*(100-start),alpha),prefix=useCssAnimations.substring(0,useCssAnimations.indexOf('Animation')).toLowerCase(),pre=prefix&&'-'+prefix+'-'||'';if(!animations[name]){sheet.insertRule('@'+pre+'keyframes '+name+'{'+'0%{opacity:'+z+'}'+
start+'%{opacity:'+alpha+'}'+
(start+0.01)+'%{opacity:1}'+
(start+trail)%100+'%{opacity:'+alpha+'}'+'100%{opacity:'+z+'}'+'}',0);animations[name]=1;}
return name;}
function vendor(el,prop){var s=el.style,pp,i;if(s[prop]!==undefined)return prop;prop=prop.charAt(0).toUpperCase()+prop.slice(1);for(i=0;i<prefixes.length;i++){pp=prefixes[i]+prop;if(s[pp]!==undefined)return pp;}}
function css(el,prop){for(var n in prop){el.style[vendor(el,n)||n]=prop[n];}
return el;}
function merge(obj){for(var i=1;i<arguments.length;i++){var def=arguments[i];for(var n in def){if(obj[n]===undefined)obj[n]=def[n];}}
return obj;}
function pos(el){var o={x:el.offsetLeft,y:el.offsetTop};while((el=el.offsetParent)){o.x+=el.offsetLeft;o.y+=el.offsetTop;}
return o;}
var Spinner=function Spinner(o){if(!this.spin)return new Spinner(o);this.opts=merge(o||{},Spinner.defaults,defaults);},defaults=Spinner.defaults={lines:12,length:7,width:5,radius:10,color:'#000',speed:1,trail:100,opacity:1/4,fps:20},proto=Spinner.prototype={spin:function(target){this.stop();var self=this,el=self.el=css(createEl(),{position:'relative'}),ep,tp;if(target){tp=pos(ins(target,el,target.firstChild));ep=pos(el);css(el,{left:(target.offsetWidth>>1)-ep.x+tp.x+'px',top:(target.offsetHeight>>1)-ep.y+tp.y+'px'});}
el.setAttribute('aria-role','progressbar');self.lines(el,self.opts);if(!useCssAnimations){var o=self.opts,i=0,fps=o.fps,f=fps/o.speed,ostep=(1-o.opacity)/(f*o.trail/100),astep=f/o.lines;(function anim(){i++;for(var s=o.lines;s;s--){var alpha=Math.max(1-(i+s*astep)%f*ostep,o.opacity);self.opacity(el,o.lines-s,alpha,o);}
self.timeout=self.el&&setTimeout(anim,~~(1000/fps));})();}
return self;},stop:function(){var el=this.el;if(el){clearTimeout(this.timeout);if(el.parentNode)el.parentNode.removeChild(el);this.el=undefined;}
return this;}};proto.lines=function(el,o){var i=0,seg;function fill(color,shadow){return css(createEl(),{position:'absolute',width:(o.length+o.width)+'px',height:o.width+'px',background:color,boxShadow:shadow,transformOrigin:'left',transform:'rotate('+~~(360/o.lines*i)+'deg) translate('+o.radius+'px'+',0)',borderRadius:(o.width>>1)+'px'});}
for(;i<o.lines;i++){seg=css(createEl(),{position:'absolute',top:1+~(o.width/2)+'px',transform:'translate3d(0,0,0)',opacity:o.opacity,animation:useCssAnimations&&addAnimation(o.opacity,o.trail,i,o.lines)+' '+1/o.speed+'s linear infinite'});if(o.shadow)ins(seg,css(fill('#000','0 0 4px '+'#000'),{top:2+'px'}));ins(el,ins(seg,fill(o.color,'0 0 1px rgba(0,0,0,.1)')));}
return el;};proto.opacity=function(el,i,val){if(i<el.childNodes.length)el.childNodes[i].style.opacity=val;};(function(){var s=css(createEl('group'),{behavior:'url(#default#VML)'}),i;if(!vendor(s,'transform')&&s.adj){for(i=4;i--;)sheet.addRule(['group','roundrect','fill','stroke'][i],'behavior:url(#default#VML)');proto.lines=function(el,o){var r=o.length+o.width,s=2*r;function grp(){return css(createEl('group',{coordsize:s+' '+s,coordorigin:-r+' '+-r}),{width:s,height:s});}
var g=grp(),margin=~(o.length+o.radius+o.width)+'px',i;function seg(i,dx,filter){ins(g,ins(css(grp(),{rotation:360/o.lines*i+'deg',left:~~dx}),ins(css(createEl('roundrect',{arcsize:1}),{width:r,height:o.width,left:o.radius,top:-o.width>>1,filter:filter}),createEl('fill',{color:o.color,opacity:o.opacity}),createEl('stroke',{opacity:0}))));}
if(o.shadow){for(i=1;i<=o.lines;i++){seg(i,-2,'progid:DXImageTransform.Microsoft.Blur(pixelradius=2,makeshadow=1,shadowopacity=.3)');}}
for(i=1;i<=o.lines;i++){seg(i);}
return ins(css(el,{margin:margin+' 0 0 '+margin,zoom:1}),g);};proto.opacity=function(el,i,val,o){var c=el.firstChild;o=o.shadow&&o.lines||0;if(c&&i+o<c.childNodes.length){c=c.childNodes[i+o];c=c&&c.firstChild;c=c&&c.firstChild;if(c)c.opacity=val;}};}
else{useCssAnimations=vendor(s,'animation');}})();window.Spinner=Spinner;})(window,document);;window.log=function(){log.history=log.history||[];log.history.push(arguments);if(this.console){arguments.callee=arguments.callee.caller;var newarr=[].slice.call(arguments);(typeof console.log==='object'?log.apply.call(console.log,console,newarr):console.log.apply(console,newarr));}};(function(b){function c(){}for(var d="assert,clear,count,debug,dir,dirxml,error,exception,firebug,group,groupCollapsed,groupEnd,info,log,memoryProfile,memoryProfileEnd,profile,profileEnd,table,time,timeEnd,timeStamp,trace,warn".split(","),a;a=d.pop();){b[a]=b[a]||c}})((function(){try
{console.log();return window.console;}catch(err){return window.console={};}})());;(function(jQuery,originalAnimateMethod,originalStopMethod){var cssTransitionProperties=["top","right","bottom","left","opacity","height","width"],directions=["top","right","bottom","left"],cssPrefixes=["","-webkit-","-moz-","-o-"],pluginOptions=["avoidTransforms","useTranslate3d","leaveTransforms"],rfxnum=/^([+-]=)?([\d+-.]+)(.*)$/,rupper=/([A-Z])/g,defaultEnhanceData={secondary:{},meta:{top:0,right:0,bottom:0,left:0}},DATA_KEY='jQe',CUBIC_BEZIER_OPEN='cubic-bezier(',CUBIC_BEZIER_CLOSE=')',use3DByDefault=false,originalAnimatedFilter=null;var thisBody=document.body||document.documentElement,thisStyle=thisBody.style,transitionEndEvent=(thisStyle.WebkitTransition!==undefined)?"webkitTransitionEnd":(thisStyle.OTransition!==undefined)?"oTransitionEnd":"transitionend",cssTransitionsSupported=thisStyle.WebkitTransition!==undefined||thisStyle.MozTransition!==undefined||thisStyle.OTransition!==undefined||thisStyle.transition!==undefined,has3D=use3DByDefault=('WebKitCSSMatrix'in window&&'m11'in new WebKitCSSMatrix());if(jQuery.expr&&jQuery.expr.filters){originalAnimatedFilter=jQuery.expr.filters.animated;jQuery.expr.filters.animated=function(elem){return jQuery(elem).data('events')&&jQuery(elem).data('events')[transitionEndEvent]?true:originalAnimatedFilter.call(this,elem);}}
function _interpretValue(e,val,prop,isTransform){var parts=rfxnum.exec(val),start=e.css(prop)==="auto"?0:e.css(prop),cleanCSSStart=typeof start=="string"?_cleanValue(start):start,cleanTarget=typeof val=="string"?_cleanValue(val):val,cleanStart=isTransform===true?0:cleanCSSStart,hidden=e.is(":hidden"),translation=e.translation();if(prop=="left")cleanStart=parseInt(cleanCSSStart,10)+translation.x;if(prop=="right")cleanStart=parseInt(cleanCSSStart,10)+translation.x;if(prop=="top")cleanStart=parseInt(cleanCSSStart,10)+translation.y;if(prop=="bottom")cleanStart=parseInt(cleanCSSStart,10)+translation.y;if(!parts&&val=="show"){cleanStart=1;if(hidden)e.css({'display':'block','opacity':0});}else if(!parts&&val=="hide"){cleanStart=0;}
if(parts){var end=parseFloat(parts[2]);if(parts[1])end=((parts[1]==="-="?-1:1)*end)+parseInt(cleanStart,10);return end;}else{return cleanStart;}};function _getTranslation(x,y,use3D){return((use3D===true||(use3DByDefault==true&&use3D!=false))&&has3D)?"translate3d("+x+"px,"+y+"px,0)":"translate("+x+"px,"+y+"px)";};function _applyCSSTransition(e,property,duration,easing,value,isTransform,isTranslatable,use3D){var enhanceData=e.data(DATA_KEY)?!_isEmptyObject(e.data(DATA_KEY))?e.data(DATA_KEY):jQuery.extend(true,{},defaultEnhanceData):jQuery.extend(true,{},defaultEnhanceData),offsetPosition=value,isDirection=jQuery.inArray(property,directions)>-1;if(isDirection){var meta=enhanceData.meta,cleanPropertyValue=_cleanValue(e.css(property))||0,stashedProperty=property+"_o";offsetPosition=value-cleanPropertyValue;meta[property]=offsetPosition;meta[stashedProperty]=e.css(property)=="auto"?0+offsetPosition:cleanPropertyValue+offsetPosition||0;enhanceData.meta=meta;if(isTranslatable&&offsetPosition===0){offsetPosition=0-meta[stashedProperty];meta[property]=offsetPosition;meta[stashedProperty]=0;}}
return e.data(DATA_KEY,_applyCSSWithPrefix(enhanceData,property,duration,easing,offsetPosition,isTransform,isTranslatable,use3D));};function _applyCSSWithPrefix(cssProperties,property,duration,easing,value,isTransform,isTranslatable,use3D){cssProperties=typeof cssProperties==='undefined'?{}:cssProperties;cssProperties.secondary=typeof cssProperties.secondary==='undefined'?{}:cssProperties.secondary;for(var i=cssPrefixes.length-1;i>=0;i--){if(typeof cssProperties[cssPrefixes[i]+'transition-property']==='undefined')cssProperties[cssPrefixes[i]+'transition-property']='';cssProperties[cssPrefixes[i]+'transition-property']+=', '+((isTransform===true&&isTranslatable===true)?cssPrefixes[i]+'transform':property);cssProperties[cssPrefixes[i]+'transition-duration']=duration+'ms';cssProperties[cssPrefixes[i]+'transition-timing-function']=easing;cssProperties.secondary[((isTransform===true&&isTranslatable===true)?cssPrefixes[i]+'transform':property)]=(isTransform===true&&isTranslatable===true)?_getTranslation(cssProperties.meta.left,cssProperties.meta.top,use3D):value;};return cssProperties;};function _isBoxShortcut(prop){for(var property in prop){if((property=="width"||property=="height")&&(prop[property]=="show"||prop[property]=="hide"||prop[property]=="toggle")){return true;}}
return false;};function _isEmptyObject(obj){for(var i in obj)return false;return true;};function _cleanValue(val){return parseFloat(val.replace(/px/i,''));};function _appropriateProperty(prop,value,element){var is=jQuery.inArray(prop,cssTransitionProperties)>-1;if((prop=='width'||prop=='height')&&(value===parseFloat(element.css(prop))))is=false;return is;};jQuery.extend({toggle3DByDefault:function(){use3DByDefault=!use3DByDefault;}});jQuery.fn.translation=function(){if(!this[0]){return null;}
var elem=this[0],cStyle=window.getComputedStyle(elem,null),translation={x:0,y:0};for(var i=cssPrefixes.length-1;i>=0;i--){var transform=cStyle.getPropertyValue(cssPrefixes[i]+"transform");if(transform&&(/matrix/i).test(transform)){var explodedMatrix=transform.replace(/^matrix\(/i,'').split(/, |\)$/g);translation={x:parseInt(explodedMatrix[4],10),y:parseInt(explodedMatrix[5],10)};break;}}
return translation;};jQuery.fn.animate=function(prop,speed,easing,callback){prop=prop||{};var isTranslatable=!(typeof prop["bottom"]!=="undefined"||typeof prop["right"]!=="undefined"),optall=jQuery.speed(speed,easing,callback),elements=this,callbackQueue=0,propertyCallback=function(){callbackQueue--;if(callbackQueue===0){if(typeof optall.complete==='function'){optall.complete.apply(elements[0],arguments);}}};if(!cssTransitionsSupported||_isEmptyObject(prop)||_isBoxShortcut(prop)||optall.duration<=0||(jQuery.fn.animate.defaults.avoidTransforms===true&&prop['avoidTransforms']!==false)){return originalAnimateMethod.apply(this,arguments);}
return this[optall.queue===true?"queue":"each"](function(){var self=jQuery(this),opt=jQuery.extend({},optall),cssCallback=function(){var reset={};for(var i=cssPrefixes.length-1;i>=0;i--){reset[cssPrefixes[i]+'transition-property']='none';reset[cssPrefixes[i]+'transition-duration']='';reset[cssPrefixes[i]+'transition-timing-function']='';};self.unbind(transitionEndEvent);if(!prop.leaveTransforms===true){var props=self.data(DATA_KEY)||{},restore={};for(i=cssPrefixes.length-1;i>=0;i--){restore[cssPrefixes[i]+'transform']='';}
if(isTranslatable&&typeof props.meta!=='undefined'){for(var j=0,dir;dir=directions[j];++j){restore[dir]=props.meta[dir+"_o"]+"px";}}
self.css(reset).css(restore);}
if(prop.opacity==='hide'){self.css('display','none');}
self.data(DATA_KEY,null);propertyCallback.call(self);},easings={bounce:CUBIC_BEZIER_OPEN+'0.0, 0.35, .5, 1.3'+CUBIC_BEZIER_CLOSE,linear:'linear',swing:'ease-in-out',easeInQuad:CUBIC_BEZIER_OPEN+'0.550, 0.085, 0.680, 0.530'+CUBIC_BEZIER_CLOSE,easeInCubic:CUBIC_BEZIER_OPEN+'0.550, 0.055, 0.675, 0.190'+CUBIC_BEZIER_CLOSE,easeInQuart:CUBIC_BEZIER_OPEN+'0.895, 0.030, 0.685, 0.220'+CUBIC_BEZIER_CLOSE,easeInQuint:CUBIC_BEZIER_OPEN+'0.755, 0.050, 0.855, 0.060'+CUBIC_BEZIER_CLOSE,easeInSine:CUBIC_BEZIER_OPEN+'0.470, 0.000, 0.745, 0.715'+CUBIC_BEZIER_CLOSE,easeInExpo:CUBIC_BEZIER_OPEN+'0.950, 0.050, 0.795, 0.035'+CUBIC_BEZIER_CLOSE,easeInCirc:CUBIC_BEZIER_OPEN+'0.600, 0.040, 0.980, 0.335'+CUBIC_BEZIER_CLOSE,easeOutQuad:CUBIC_BEZIER_OPEN+'0.250, 0.460, 0.450, 0.940'+CUBIC_BEZIER_CLOSE,easeOutCubic:CUBIC_BEZIER_OPEN+'0.215, 0.610, 0.355, 1.000'+CUBIC_BEZIER_CLOSE,easeOutQuart:CUBIC_BEZIER_OPEN+'0.165, 0.840, 0.440, 1.000'+CUBIC_BEZIER_CLOSE,easeOutQuint:CUBIC_BEZIER_OPEN+'0.230, 1.000, 0.320, 1.000'+CUBIC_BEZIER_CLOSE,easeOutSine:CUBIC_BEZIER_OPEN+'0.390, 0.575, 0.565, 1.000'+CUBIC_BEZIER_CLOSE,easeOutExpo:CUBIC_BEZIER_OPEN+'0.190, 1.000, 0.220, 1.000'+CUBIC_BEZIER_CLOSE,easeOutCirc:CUBIC_BEZIER_OPEN+'0.075, 0.820, 0.165, 1.000'+CUBIC_BEZIER_CLOSE,easeInOutQuad:CUBIC_BEZIER_OPEN+'0.455, 0.030, 0.515, 0.955'+CUBIC_BEZIER_CLOSE,easeInOutCubic:CUBIC_BEZIER_OPEN+'0.645, 0.045, 0.355, 1.000'+CUBIC_BEZIER_CLOSE,easeInOutQuart:CUBIC_BEZIER_OPEN+'0.770, 0.000, 0.175, 1.000'+CUBIC_BEZIER_CLOSE,easeInOutQuint:CUBIC_BEZIER_OPEN+'0.860, 0.000, 0.070, 1.000'+CUBIC_BEZIER_CLOSE,easeInOutSine:CUBIC_BEZIER_OPEN+'0.445, 0.050, 0.550, 0.950'+CUBIC_BEZIER_CLOSE,easeInOutExpo:CUBIC_BEZIER_OPEN+'1.000, 0.000, 0.000, 1.000'+CUBIC_BEZIER_CLOSE,easeInOutCirc:CUBIC_BEZIER_OPEN+'0.785, 0.135, 0.150, 0.860'+CUBIC_BEZIER_CLOSE},domProperties={},cssEasing=easings[opt.easing||"swing"]?easings[opt.easing||"swing"]:opt.easing||"swing";for(var p in prop){if(jQuery.inArray(p,pluginOptions)===-1){var isDirection=jQuery.inArray(p,directions)>-1,cleanVal=_interpretValue(self,prop[p],p,(isDirection&&prop.avoidTransforms!==true));if(prop.avoidTransforms!==true&&_appropriateProperty(p,cleanVal,self)){_applyCSSTransition(self,p,opt.duration,cssEasing,isDirection&&prop.avoidTransforms===true?cleanVal+"px":cleanVal,isDirection&&prop.avoidTransforms!==true,isTranslatable,prop.useTranslate3d===true);}
else{domProperties[p]=prop[p];}}}
var cssProperties=self.data(DATA_KEY)||{};for(var i=cssPrefixes.length-1;i>=0;i--){if(typeof cssProperties[cssPrefixes[i]+'transition-property']!=='undefined'){cssProperties[cssPrefixes[i]+'transition-property']=cssProperties[cssPrefixes[i]+'transition-property'].substr(2);}}
self.data(DATA_KEY,cssProperties).unbind(transitionEndEvent);if(!_isEmptyObject(self.data(DATA_KEY))&&!_isEmptyObject(self.data(DATA_KEY).secondary)){callbackQueue++;self.css(self.data(DATA_KEY));var secondary=self.data(DATA_KEY).secondary;setTimeout(function(){self.bind(transitionEndEvent,cssCallback).css(secondary);});}
else{opt.queue=false;}
if(!_isEmptyObject(domProperties)){callbackQueue++;originalAnimateMethod.apply(self,[domProperties,{duration:opt.duration,easing:jQuery.easing[opt.easing]?opt.easing:(jQuery.easing.swing?"swing":"linear"),complete:propertyCallback,queue:opt.queue}]);}
return true;});};jQuery.fn.animate.defaults={};jQuery.fn.stop=function(clearQueue,gotoEnd,leaveTransforms){if(!cssTransitionsSupported)return originalStopMethod.apply(this,[clearQueue,gotoEnd]);if(clearQueue)this.queue([]);var reset={};for(var i=cssPrefixes.length-1;i>=0;i--){reset[cssPrefixes[i]+'transition-property']='none';reset[cssPrefixes[i]+'transition-duration']='';reset[cssPrefixes[i]+'transition-timing-function']='';};this.each(function(){var self=jQuery(this),cStyle=window.getComputedStyle(this,null),restore={},i;if(!_isEmptyObject(self.data(DATA_KEY))&&!_isEmptyObject(self.data(DATA_KEY).secondary)){var selfCSSData=self.data(DATA_KEY);if(gotoEnd){restore=selfCSSData.secondary;if(!leaveTransforms&&typeof selfCSSData.meta['left_o']!==undefined||typeof selfCSSData.meta['top_o']!==undefined){restore['left']=typeof selfCSSData.meta['left_o']!==undefined?selfCSSData.meta['left_o']:'auto';restore['top']=typeof selfCSSData.meta['top_o']!==undefined?selfCSSData.meta['top_o']:'auto';for(i=cssPrefixes.length-1;i>=0;i--){restore[cssPrefixes[i]+'transform']='';}}}
else{for(var prop in self.data(DATA_KEY).secondary){prop=prop.replace(rupper,"-$1").toLowerCase();restore[prop]=cStyle.getPropertyValue(prop);if(!leaveTransforms&&(/matrix/i).test(restore[prop])){var explodedMatrix=restore[prop].replace(/^matrix\(/i,'').split(/, |\)$/g);restore['left']=(parseFloat(explodedMatrix[4])+parseFloat(self.css('left'))+'px')||'auto';restore['top']=(parseFloat(explodedMatrix[5])+parseFloat(self.css('top'))+'px')||'auto';for(i=cssPrefixes.length-1;i>=0;i--){restore[cssPrefixes[i]+'transform']='';}}}}
self.unbind(transitionEndEvent).css(reset).css(restore).data(DATA_KEY,null);}
else{originalStopMethod.apply(self,[clearQueue,gotoEnd]);}});return this;};})(jQuery,jQuery.fn.animate,jQuery.fn.stop);;(function($){var settings={animation:'fade',animationSpeed:1000,timer:false,clock:false,rate:4000,pauseOnHover:false,startTimerOnMouseOut:false,startTimerOnMouseOutAfter:1000,arrows:true,captions:false,captionAnimation:'fade',captionAnimationSpeed:500,bullets:true,bulletThumbs:false,bulletThumbLocation:'',cycleLimit:-1,activeID:0,afterSlideChange:function(){}},options,methods={initialise:function(opts){return this.each(function(){options=$.extend({},settings,opts);var self=this,$_this=$(this).addClass('orbit'),$_wrapper=$_this.wrap('<div class="orbit-wrapper"></div>').parent(),$_slides=$_this.children(),_slideNum=$_slides.length,_points=[],_data=$_this.data('orbit'),_xTracker=0,_xOffset=20,_init={getDimensions:function(){var $slide,slide_w,slide_h,orbit_w=1,orbit_h=1;$_slides.each(function(i){$slide=$(this);slide_w=$slide.outerWidth();slide_h=$slide.outerHeight();orbit_w=(slide_w>orbit_w)?slide_w:orbit_w;orbit_h=(slide_h>orbit_h)?slide_h:orbit_h;_points[i]=_xTracker;_xTracker+=(slide_w+_xOffset);});$_wrapper.width($_this.outerWidth()).height($_this.outerHeight());return{orbit_w:orbit_w,orbit_h:orbit_h};},createBullets:function(){var $clip,bullets='',i=0;for(;i<_slideNum;i++){bullets+='<li data-index="'+i+'">'+(i+1)+'</li>';}
$_wrapper.append('<ol class="orbit-bullets">'+bullets+'</ol>');$clip=$('.orbit-bullets',$_wrapper);$clip.css('margin-left',Math.round($clip.outerWidth()*-0.5));return $clip.children();},createThumbs:function(){var _thumbURL,$_bullet;for(var i=0;i<_slideNum;i++){$_bullet=$_slides.eq(i).data('thumb');if(_thumbURL){$_bullet=$('<li class="has-thumb">'+i+'</li>');$_bullet.css({"background":"url("+options.bulletThumbLocation+_thumbURL+") no-repeat"});}}},createClock:function(){var _html='<div class="clock">'+'<span class="mask"><span class="rotator"></span></span>'+'<span class="pause"></span>'+'</div>',_degrees=0,$_div=$_wrapper.append(_html).children().last(),$_pause=$('span.pause',$_div),$_rotator=$('span.rotator',$_div),$_mask=$('span.mask',$_div);$_div.click(function(){self.toggleTimer()});return{div:$_div,isVisible:function(){return $_div.is(':visible');},pause:function(remove){$_pause.addClass('active');},play:function(){$_pause.removeClass('active');},update:function(degrees){var degreeCSS="rotate("+degrees+"deg)";if(degrees==180){$_rotator.addClass('move');$_mask.addClass('move');}
if(degrees==360){$_rotator.removeClass('move');$_mask.removeClass('move');}
$_rotator.css({"-webkit-transform":degreeCSS,"-moz-transform":degreeCSS,"-o-transform":degreeCSS,"transform":degreeCSS});},remove:function(){$_div.fadeOut();}}},createTimerOnMouseOut:function(){var outTimer;$_wrapper.mouseleave(function(){outTimer=setTimeout(function(){if(!_data.timer.running){startTimer();}},options.startTimerOnMouseOutAfter)}).mouseenter(function(){clearTimeout(outTimer);});},createCaptionDiv:function(){var html='<div class="orbit-caption"></div>';return $_wrapper.append(html).children().last();},createDirectionNav:function(){var html='<div class="slider-nav">'+'<span class="right">Right</span>'+'<span class="left">Left</span>'+'</div>';$_wrapper.append(html);$('span.left',$_wrapper).click(function(){self.gotoAndStop("prev");});$('span.right',$_wrapper).click(function(){self.gotoAndStop("next");});}};if(!_data){_data={target:$_this,wrapper:$_wrapper,slides:$_slides,slideNum:_slideNum,locked:false,cycleID:0,activeID:options.activeID,dimensions:_init.getDimensions(),points:_points};if(options.captions){_data.captionDiv=_init.createCaptionDiv();}
if(options.bullets&&_slideNum>1){_data.bullets=_init.createBullets();_data.bullets.click(function(){self.gotoAndStop($(this).data('index'));});if(options.bulletThumbs){_init.createThumbs();}}
if(options.timer){_data.timer={running:false,interval:null,tick:0,tickRate:Math.floor(options.rate/360)}}
if(options.clock){_data.clock=_init.createClock();}
if(options.pauseOnHover){$_wrapper.mouseenter(function(){stopTimer();});}
if(options.startTimerOnMouseOut){_init.createTimerOnMouseOut();}
if(options.animation==="horizontal-stack"){$_slides.each(function(i){$(this).css({"left":_points[i]});});$_this.width(_xTracker-_xOffset);}
if(options.arrows){switch(options.animation){case"horizontal-stack":if($_this.width()>$_wrapper.width())_init.createDirectionNav();break;default:_init.createDirectionNav();}}
$_this.data('orbit',_data);}
function shift(direction){var _prevID=_data.activeID,_dirNext=(direction==="next"),_dimensions=_data.dimensions,$_activeSlide,$_prevSlide;if(!_data.locked){setActiveID();if(direction==_prevID)return;_data.locked=true;setActiveBullet();setCaption();setSlide();}
function resetAndUnlock(){_data.slides.eq(_prevID).css({"z-index":1});_data.locked=false;if(_data.timer&&_data.timer.running&&cycleMaxReached()){stopTimer(true);}
options.afterSlideChange.call(this);}
function setActiveID(){if(_dirNext){if(++_data.activeID==_data.slideNum){_data.activeID=0;_data.cycleID++;}}
else if(direction=="prev"){_data.activeID=(--_data.activeID<0)?_data.slideNum-1:_data.activeID;}
else{_data.activeID=direction;_dirNext=(_prevID<_data.activeID);}}
function setSlide(){$_activeSlide=_data.slides.eq(_data.activeID);$_prevSlide=_data.slides.eq(_prevID).css({"z-index":2});var x,y,prev_x,active_x;switch(options.animation){case"horizontal-stack":x=_data.points[_data.activeID]*-1;var dx=$_wrapper.outerWidth()-$_this.outerWidth(),cx=$_this.position().left;if(x<dx)x=dx;if(x!=cx){$_this.animate({"left":x},options.animationSpeed,resetAndUnlock);}
else{_data.locked=false;shift("next");}
break;case"horizontal-slide":x=_dirNext?_dimensions.orbit_w:-_dimensions.orbit_w;$_activeSlide.css({"left":x,"z-index":3}).animate({"left":0},options.animationSpeed,resetAndUnlock);break;case"vertical-slide":y=_dirNext?-_dimensions.orbit_h:_dimensions.orbit_h;$_activeSlide.css({"top":-y,"z-index":3}).animate({"top":-y},options.animationSpeed,resetAndUnlock);break;case"horizontal-push":active_x=_dirNext?_dimensions.orbit_w:-_dimensions.orbit_w;prev_x=_dirNext?-_dimensions.orbit_w:_dimensions.orbit_w;$_activeSlide.css({"left":active_x,"z-index":3}).animate({"left":0},options.animationSpeed,resetAndUnlock);$_prevSlide.animate({"left":prev_x},options.animationSpeed);break;case"fade":default:$_activeSlide.css({"opacity":0,"z-index":3}).animate({"opacity":1},options.animationSpeed,resetAndUnlock);break;}}}
function setActiveBullet(){if(!options.bullets)return;_data.bullets.removeClass('active').eq(_data.activeID).addClass('active');}
function setCaption(){if(!options.captions)return;var _captionEl=_data.slides.eq(_data.activeID).data('caption'),_captionHTML=$(_captionEl).html(),_display=(_captionHTML),_method;if(_display){_data.captionDiv.attr('id',_captionEl).html(_captionHTML);}
switch(options.captionAnimation){case"fade":_method=_display?"fadeIn":"fadeOut";break;case"slideOpen":_method=_display?"slideUp":"slideDown";break;case"none":default:_method=_display?"show":"hide";break;}
_data.captionDiv[_method]();}
function cycleMaxReached()
{return(options.cycleLimit>-1&&_data.cycleID>=options.cycleLimit);}
function startTimer(){if(!_data.timer||cycleMaxReached()){return;}
if(_data.clock){_data.clock.play();}
_data.timer.running=true;_data.timer.interval=setInterval(function(){if(_data.clock&&_data.clock.isVisible()){_data.clock.update(_data.timer.tick);}
if(_data.timer.tick==360){_data.timer.tick=0;shift("next");}
_data.timer.tick++;},_data.timer.tickRate);}
function stopTimer(killTimer){if(!_data.timer)return;_data.timer.running=false;clearInterval(_data.timer.interval);if(_data.clock){_data.clock.pause();if(killTimer)_data.clock.remove();}}
function display(){function _onDisplayed(){$_this.removeClass('loading');$_slides.css({"display":"block"});if(options.bullets)setActiveBullet();if(options.captions)setCaption();if(options.timer)startTimer();}
if(options.animation==="horizontal-stack"){$_slides.css({"display":"block"});$_this.fadeIn(_onDisplayed);}
else{$_slides.eq(_data.activeID).css({"z-index":3}).fadeIn(_onDisplayed);}}
this.gotoAndStop=function(index){stopTimer();shift(index);};this.toggleTimer=function(){if(!_data.timer)return;(_data.timer.running)?stopTimer():startTimer();};display();});},toggle:function(){return this.each(function(){if(options.timer){this.toggleTimer();}});},goto:function(index){return this.each(function(){this.gotoAndStop(index);});},destroy:function(){}};$.fn.orbit=function(method){if(methods[method]){return methods[method].apply(this,Array.prototype.slice.call(arguments,1));}
else if(typeof method==='object'||!method){return methods.initialise.apply(this,arguments);}
else{$.error('Method '+method+' does not exist on jQuery.orbit');}};})(jQuery);;var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';s.parentNode.insertBefore(g,s)}(document,'script'));$(function(){var slideshow=$('#recent_work .slideshow').orbit({timer:true,clock:true,rate:5000});var _contactClick=function(event){event.preventDefault();$(this).toggleClass('active');$('#contact').slideToggle('slow');slideshow.orbit('toggle');};$('a[href="#contact"]').on('click',_contactClick);});
