var IEPNGFix=window.IEPNGFix||{};IEPNGFix.tileBG=function(g,r,o){var H=this.data[g.uniqueID],b=Math.max(g.clientWidth,g.scrollWidth),h=Math.max(g.clientHeight,g.scrollHeight),k=g.currentStyle.backgroundPositionX,j=g.currentStyle.backgroundPositionY,p=g.currentStyle.backgroundRepeat;if(!H.tiles){H.tiles={elm:g,src:"",cache:[],img:new Image(),old:{}}}var D=H.tiles,v=D.img.width,c=D.img.height;if(r){if(!o&&r!=D.src){D.img.onload=function(){this.onload=null;IEPNGFix.tileBG(g,r,1)};return D.img.src=r}}else{if(D.src){o=1}v=c=0}D.src=r;if(!o&&b==D.old.w&&h==D.old.h&&k==D.old.x&&j==D.old.y&&p==D.old.r){return}var e={top:"0%",left:"0%",center:"50%",bottom:"100%",right:"100%"},m,l,a;m=e[k]||k;l=e[j]||j;if(a=m.match(/(\d+)%/)){m=Math.round((b-v)*(parseInt(a[1])/100))}if(a=l.match(/(\d+)%/)){l=Math.round((h-c)*(parseInt(a[1])/100))}m=parseInt(m);l=parseInt(l);var F={repeat:1,"repeat-x":1}[p],C={repeat:1,"repeat-y":1}[p];if(F){m%=v;if(m>0){m-=v}}if(C){l%=c;if(l>0){l-=c}}this.hook.enabled=0;if(!({relative:1,absolute:1}[g.currentStyle.position])){g.style.position="relative"}var f=0,n,B=F?b:m+0.1,t,z=C?h:l+0.1,A,q,E;if(v&&c){for(n=m;n<B;n+=v){for(t=l;t<z;t+=c){E=0;if(!D.cache[f]){D.cache[f]=document.createElement("div");E=1}var u=Math.max(0,n+v>b?b-n:v),G=Math.max(0,t+c>h?h-t:c);A=D.cache[f];q=A.style;q.behavior="none";q.left=(n-parseInt(g.currentStyle.paddingLeft))+"px";q.top=t+"px";q.width=u+"px";q.height=G+"px";q.clip="rect("+(t<0?0-t:0)+"px,"+u+"px,"+G+"px,"+(n<0?0-n:0)+"px)";q.display="block";if(E){q.position="absolute";q.zIndex=-999;if(g.firstChild){g.insertBefore(A,g.firstChild)}else{g.appendChild(A)}}this.fix(A,r,0);f++}}}while(f<D.cache.length){this.fix(D.cache[f],"",0);D.cache[f++].style.display="none"}this.hook.enabled=1;D.old={w:b,h:h,x:k,y:j,r:p}};IEPNGFix.update=function(){for(var b in IEPNGFix.data){var a=IEPNGFix.data[b].tiles;if(a&&a.elm&&a.src){IEPNGFix.tileBG(a.elm,a.src)}}};IEPNGFix.update.timer=0;if(window.attachEvent&&!window.opera){window.attachEvent("onresize",function(){clearTimeout(IEPNGFix.update.timer);IEPNGFix.update.timer=setTimeout(IEPNGFix.update,100)})}var Prototype={Version:"1.7",Browser:(function(){var b=navigator.userAgent;var a=Object.prototype.toString.call(window.opera)=="[object Opera]";return{IE:!!window.attachEvent&&!a,Opera:a,WebKit:b.indexOf("AppleWebKit/")>-1,Gecko:b.indexOf("Gecko")>-1&&b.indexOf("KHTML")===-1,MobileSafari:/Apple.*Mobile/.test(b)}})(),BrowserFeatures:{XPath:!!document.evaluate,SelectorsAPI:!!document.querySelector,ElementExtensions:(function(){var a=window.Element||window.HTMLElement;return !!(a&&a.prototype)})(),SpecificElementExtensions:(function(){if(typeof window.HTMLDivElement!=="undefined"){return true}var c=document.createElement("div"),b=document.createElement("form"),a=false;if(c.__proto__&&(c.__proto__!==b.__proto__)){a=true}c=b=null;return a})()},ScriptFragment:"<script[^>]*>([\\S\\s]*?)<\/script>",JSONFilter:/^\/\*-secure-([\s\S]*)\*\/\s*$/,emptyFunction:function(){},K:function(a){return a}};if(Prototype.Browser.MobileSafari){Prototype.BrowserFeatures.SpecificElementExtensions=false}var Abstract={};var Try={these:function(){var c;for(var b=0,f=arguments.length;b<f;b++){var a=arguments[b];try{c=a();break}catch(g){}}return c}};var Class=(function(){var e=(function(){for(var f in {toString:1}){if(f==="toString"){return false}}return true})();function a(){}function b(){var j=null,h=$A(arguments);if(Object.isFunction(h[0])){j=h.shift()}function f(){this.initialize.apply(this,arguments)}Object.extend(f,Class.Methods);f.superclass=j;f.subclasses=[];if(j){a.prototype=j.prototype;f.prototype=new a;j.subclasses.push(f)}for(var g=0,k=h.length;g<k;g++){f.addMethods(h[g])}if(!f.prototype.initialize){f.prototype.initialize=Prototype.emptyFunction}f.prototype.constructor=f;return f}function c(m){var h=this.superclass&&this.superclass.prototype,g=Object.keys(m);if(e){if(m.toString!=Object.prototype.toString){g.push("toString")}if(m.valueOf!=Object.prototype.valueOf){g.push("valueOf")}}for(var f=0,j=g.length;f<j;f++){var l=g[f],k=m[l];if(h&&Object.isFunction(k)&&k.argumentNames()[0]=="$super"){var n=k;k=(function(o){return function(){return h[o].apply(this,arguments)}})(l).wrap(n);k.valueOf=n.valueOf.bind(n);k.toString=n.toString.bind(n)}this.prototype[l]=k}return this}return{create:b,Methods:{addMethods:c}}})();(function(){var F=Object.prototype.toString,E="Null",q="Undefined",y="Boolean",g="Number",u="String",K="Object",v="[object Function]",B="[object Boolean]",h="[object Number]",n="[object String]",j="[object Array]",A="[object Date]",k=window.JSON&&typeof JSON.stringify==="function"&&JSON.stringify(0)==="0"&&typeof JSON.stringify(Prototype.K)==="undefined";function m(M){switch(M){case null:return E;case (void 0):return q}var L=typeof M;switch(L){case"boolean":return y;case"number":return g;case"string":return u}return K}function C(L,N){for(var M in N){L[M]=N[M]}return L}function J(L){try{if(c(L)){return"undefined"}if(L===null){return"null"}return L.inspect?L.inspect():String(L)}catch(M){if(M instanceof RangeError){return"..."}throw M}}function G(L){return I("",{"":L},[])}function I(U,R,S){var T=R[U],Q=typeof T;if(m(T)===K&&typeof T.toJSON==="function"){T=T.toJSON(U)}var N=F.call(T);switch(N){case h:case B:case n:T=T.valueOf()}switch(T){case null:return"null";case true:return"true";case false:return"false"}Q=typeof T;switch(Q){case"string":return T.inspect(true);case"number":return isFinite(T)?String(T):"null";case"object":for(var M=0,L=S.length;M<L;M++){if(S[M]===T){throw new TypeError()}}S.push(T);var P=[];if(N===j){for(var M=0,L=T.length;M<L;M++){var O=I(M,T,S);P.push(typeof O==="undefined"?"null":O)}P="["+P.join(",")+"]"}else{var V=Object.keys(T);for(var M=0,L=V.length;M<L;M++){var U=V[M],O=I(U,T,S);if(typeof O!=="undefined"){P.push(U.inspect(true)+":"+O)}}P="{"+P.join(",")+"}"}S.pop();return P}}function z(L){return JSON.stringify(L)}function l(L){return $H(L).toQueryString()}function r(L){return L&&L.toHTML?L.toHTML():String.interpret(L)}function t(L){if(m(L)!==K){throw new TypeError()}var M=[];for(var N in L){if(L.hasOwnProperty(N)){M.push(N)}}return M}function e(L){var M=[];for(var N in L){M.push(L[N])}return M}function D(L){return C({},L)}function x(L){return !!(L&&L.nodeType==1)}function o(L){return F.call(L)===j}var b=(typeof Array.isArray=="function")&&Array.isArray([])&&!Array.isArray({});if(b){o=Array.isArray}function f(L){return L instanceof Hash}function a(L){return F.call(L)===v}function p(L){return F.call(L)===n}function s(L){return F.call(L)===h}function H(L){return F.call(L)===A}function c(L){return typeof L==="undefined"}C(Object,{extend:C,inspect:J,toJSON:k?z:G,toQueryString:l,toHTML:r,keys:Object.keys||t,values:e,clone:D,isElement:x,isArray:o,isHash:f,isFunction:a,isString:p,isNumber:s,isDate:H,isUndefined:c})})();Object.extend(Function.prototype,(function(){var m=Array.prototype.slice;function e(q,n){var p=q.length,o=n.length;while(o--){q[p+o]=n[o]}return q}function k(o,n){o=m.call(o,0);return e(o,n)}function h(){var n=this.toString().match(/^[\s\(]*function[^(]*\(([^)]*)\)/)[1].replace(/\/\/.*?[\r\n]|\/\*(?:.|[\r\n])*?\*\//g,"").replace(/\s+/g,"").split(",");return n.length==1&&!n[0]?[]:n}function j(p){if(arguments.length<2&&Object.isUndefined(arguments[0])){return this}var n=this,o=m.call(arguments,1);return function(){var q=k(o,arguments);return n.apply(p,q)}}function g(p){var n=this,o=m.call(arguments,1);return function(r){var q=e([r||window.event],o);return n.apply(p,q)}}function l(){if(!arguments.length){return this}var n=this,o=m.call(arguments,0);return function(){var p=k(o,arguments);return n.apply(this,p)}}function f(p){var n=this,o=m.call(arguments,1);p=p*1000;return window.setTimeout(function(){return n.apply(n,o)},p)}function a(){var n=e([0.01],arguments);return this.delay.apply(this,n)}function c(o){var n=this;return function(){var p=e([n.bind(this)],arguments);return o.apply(this,p)}}function b(){if(this._methodized){return this._methodized}var n=this;return this._methodized=function(){var o=e([this],arguments);return n.apply(null,o)}}return{argumentNames:h,bind:j,bindAsEventListener:g,curry:l,delay:f,defer:a,wrap:c,methodize:b}})());(function(c){function b(){return this.getUTCFullYear()+"-"+(this.getUTCMonth()+1).toPaddedString(2)+"-"+this.getUTCDate().toPaddedString(2)+"T"+this.getUTCHours().toPaddedString(2)+":"+this.getUTCMinutes().toPaddedString(2)+":"+this.getUTCSeconds().toPaddedString(2)+"Z"}function a(){return this.toISOString()}if(!c.toISOString){c.toISOString=b}if(!c.toJSON){c.toJSON=a}})(Date.prototype);RegExp.prototype.match=RegExp.prototype.test;RegExp.escape=function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")};var PeriodicalExecuter=Class.create({initialize:function(b,a){this.callback=b;this.frequency=a;this.currentlyExecuting=false;this.registerCallback()},registerCallback:function(){this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000)},execute:function(){this.callback(this)},stop:function(){if(!this.timer){return}clearInterval(this.timer);this.timer=null},onTimerEvent:function(){if(!this.currentlyExecuting){try{this.currentlyExecuting=true;this.execute();this.currentlyExecuting=false}catch(a){this.currentlyExecuting=false;throw a}}}});Object.extend(String,{interpret:function(a){return a==null?"":String(a)},specialChar:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r","\\":"\\\\"}});Object.extend(String.prototype,(function(){var NATIVE_JSON_PARSE_SUPPORT=window.JSON&&typeof JSON.parse==="function"&&JSON.parse('{"test": true}').test;function prepareReplacement(replacement){if(Object.isFunction(replacement)){return replacement}var template=new Template(replacement);return function(match){return template.evaluate(match)}}function gsub(pattern,replacement){var result="",source=this,match;replacement=prepareReplacement(replacement);if(Object.isString(pattern)){pattern=RegExp.escape(pattern)}if(!(pattern.length||pattern.source)){replacement=replacement("");return replacement+source.split("").join(replacement)+replacement}while(source.length>0){if(match=source.match(pattern)){result+=source.slice(0,match.index);result+=String.interpret(replacement(match));source=source.slice(match.index+match[0].length)}else{result+=source,source=""}}return result}function sub(pattern,replacement,count){replacement=prepareReplacement(replacement);count=Object.isUndefined(count)?1:count;return this.gsub(pattern,function(match){if(--count<0){return match[0]}return replacement(match)})}function scan(pattern,iterator){this.gsub(pattern,iterator);return String(this)}function truncate(length,truncation){length=length||30;truncation=Object.isUndefined(truncation)?"...":truncation;return this.length>length?this.slice(0,length-truncation.length)+truncation:String(this)}function strip(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}function stripTags(){return this.replace(/<\w+(\s+("[^"]*"|'[^']*'|[^>])+)?>|<\/\w+>/gi,"")}function stripScripts(){return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"")}function extractScripts(){var matchAll=new RegExp(Prototype.ScriptFragment,"img"),matchOne=new RegExp(Prototype.ScriptFragment,"im");return(this.match(matchAll)||[]).map(function(scriptTag){return(scriptTag.match(matchOne)||["",""])[1]})}function evalScripts(){return this.extractScripts().map(function(script){return eval(script)})}function escapeHTML(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function unescapeHTML(){return this.stripTags().replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&")}function toQueryParams(separator){var match=this.strip().match(/([^?#]*)(#.*)?$/);if(!match){return{}}return match[1].split(separator||"&").inject({},function(hash,pair){if((pair=pair.split("="))[0]){var key=decodeURIComponent(pair.shift()),value=pair.length>1?pair.join("="):pair[0];if(value!=undefined){value=decodeURIComponent(value)}if(key in hash){if(!Object.isArray(hash[key])){hash[key]=[hash[key]]}hash[key].push(value)}else{hash[key]=value}}return hash})}function toArray(){return this.split("")}function succ(){return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1)}function times(count){return count<1?"":new Array(count+1).join(this)}function camelize(){return this.replace(/-+(.)?/g,function(match,chr){return chr?chr.toUpperCase():""})}function capitalize(){return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase()}function underscore(){return this.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/-/g,"_").toLowerCase()}function dasherize(){return this.replace(/_/g,"-")}function inspect(useDoubleQuotes){var escapedString=this.replace(/[\x00-\x1f\\]/g,function(character){if(character in String.specialChar){return String.specialChar[character]}return"\\u00"+character.charCodeAt().toPaddedString(2,16)});if(useDoubleQuotes){return'"'+escapedString.replace(/"/g,'\\"')+'"'}return"'"+escapedString.replace(/'/g,"\\'")+"'"}function unfilterJSON(filter){return this.replace(filter||Prototype.JSONFilter,"$1")}function isJSON(){var str=this;if(str.blank()){return false}str=str.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@");str=str.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]");str=str.replace(/(?:^|:|,)(?:\s*\[)+/g,"");return(/^[\],:{}\s]*$/).test(str)}function evalJSON(sanitize){var json=this.unfilterJSON(),cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;if(cx.test(json)){json=json.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}try{if(!sanitize||json.isJSON()){return eval("("+json+")")}}catch(e){}throw new SyntaxError("Badly formed JSON string: "+this.inspect())}function parseJSON(){var json=this.unfilterJSON();return JSON.parse(json)}function include(pattern){return this.indexOf(pattern)>-1}function startsWith(pattern){return this.lastIndexOf(pattern,0)===0}function endsWith(pattern){var d=this.length-pattern.length;return d>=0&&this.indexOf(pattern,d)===d}function empty(){return this==""}function blank(){return/^\s*$/.test(this)}function interpolate(object,pattern){return new Template(this,pattern).evaluate(object)}return{gsub:gsub,sub:sub,scan:scan,truncate:truncate,strip:String.prototype.trim||strip,stripTags:stripTags,stripScripts:stripScripts,extractScripts:extractScripts,evalScripts:evalScripts,escapeHTML:escapeHTML,unescapeHTML:unescapeHTML,toQueryParams:toQueryParams,parseQuery:toQueryParams,toArray:toArray,succ:succ,times:times,camelize:camelize,capitalize:capitalize,underscore:underscore,dasherize:dasherize,inspect:inspect,unfilterJSON:unfilterJSON,isJSON:isJSON,evalJSON:NATIVE_JSON_PARSE_SUPPORT?parseJSON:evalJSON,include:include,startsWith:startsWith,endsWith:endsWith,empty:empty,blank:blank,interpolate:interpolate}})());var Template=Class.create({initialize:function(a,b){this.template=a.toString();this.pattern=b||Template.Pattern},evaluate:function(a){if(a&&Object.isFunction(a.toTemplateReplacements)){a=a.toTemplateReplacements()}return this.template.gsub(this.pattern,function(e){if(a==null){return(e[1]+"")}var g=e[1]||"";if(g=="\\"){return e[2]}var b=a,h=e[3],f=/^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;e=f.exec(h);if(e==null){return g}while(e!=null){var c=e[1].startsWith("[")?e[2].replace(/\\\\]/g,"]"):e[1];b=b[c];if(null==b||""==e[3]){break}h=h.substring("["==e[3]?e[1].length:e[0].length);e=f.exec(h)}return g+String.interpret(b)})}});Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;var $break={};var Enumerable=(function(){function c(B,A){var z=0;try{this._each(function(D){B.call(A,D,z++)})}catch(C){if(C!=$break){throw C}}return this}function t(C,B,A){var z=-C,D=[],E=this.toArray();if(C<1){return E}while((z+=C)<E.length){D.push(E.slice(z,z+C))}return D.collect(B,A)}function b(B,A){B=B||Prototype.K;var z=true;this.each(function(D,C){z=z&&!!B.call(A,D,C);if(!z){throw $break}});return z}function k(B,A){B=B||Prototype.K;var z=false;this.each(function(D,C){if(z=!!B.call(A,D,C)){throw $break}});return z}function l(B,A){B=B||Prototype.K;var z=[];this.each(function(D,C){z.push(B.call(A,D,C))});return z}function v(B,A){var z;this.each(function(D,C){if(B.call(A,D,C)){z=D;throw $break}});return z}function j(B,A){var z=[];this.each(function(D,C){if(B.call(A,D,C)){z.push(D)}});return z}function h(C,B,A){B=B||Prototype.K;var z=[];if(Object.isString(C)){C=new RegExp(RegExp.escape(C))}this.each(function(E,D){if(C.match(E)){z.push(B.call(A,E,D))}});return z}function a(z){if(Object.isFunction(this.indexOf)){if(this.indexOf(z)!=-1){return true}}var A=false;this.each(function(B){if(B==z){A=true;throw $break}});return A}function s(A,z){z=Object.isUndefined(z)?null:z;return this.eachSlice(A,function(B){while(B.length<A){B.push(z)}return B})}function n(z,B,A){this.each(function(D,C){z=B.call(A,z,D,C)});return z}function y(A){var z=$A(arguments).slice(1);return this.map(function(B){return B[A].apply(B,z)})}function r(B,A){B=B||Prototype.K;var z;this.each(function(D,C){D=B.call(A,D,C);if(z==null||D>=z){z=D}});return z}function p(B,A){B=B||Prototype.K;var z;this.each(function(D,C){D=B.call(A,D,C);if(z==null||D<z){z=D}});return z}function f(C,A){C=C||Prototype.K;var B=[],z=[];this.each(function(E,D){(C.call(A,E,D)?B:z).push(E)});return[B,z]}function g(A){var z=[];this.each(function(B){z.push(B[A])});return z}function e(B,A){var z=[];this.each(function(D,C){if(!B.call(A,D,C)){z.push(D)}});return z}function o(A,z){return this.map(function(C,B){return{value:C,criteria:A.call(z,C,B)}}).sort(function(E,D){var C=E.criteria,B=D.criteria;return C<B?-1:C>B?1:0}).pluck("value")}function q(){return this.map()}function u(){var A=Prototype.K,z=$A(arguments);if(Object.isFunction(z.last())){A=z.pop()}var B=[this].concat(z).map($A);return this.map(function(D,C){return A(B.pluck(C))})}function m(){return this.toArray().length}function x(){return"#<Enumerable:"+this.toArray().inspect()+">"}return{each:c,eachSlice:t,all:b,every:b,any:k,some:k,collect:l,map:l,detect:v,findAll:j,select:j,filter:j,grep:h,include:a,member:a,inGroupsOf:s,inject:n,invoke:y,max:r,min:p,partition:f,pluck:g,reject:e,sortBy:o,toArray:q,entries:q,zip:u,size:m,inspect:x,find:v}})();function $A(c){if(!c){return[]}if("toArray" in Object(c)){return c.toArray()}var b=c.length||0,a=new Array(b);while(b--){a[b]=c[b]}return a}function $w(a){if(!Object.isString(a)){return[]}a=a.strip();return a?a.split(/\s+/):[]}Array.from=$A;(function(){var t=Array.prototype,o=t.slice,q=t.forEach;function b(z,y){for(var x=0,A=this.length>>>0;x<A;x++){if(x in this){z.call(y,this[x],x,this)}}}if(!q){q=b}function n(){this.length=0;return this}function e(){return this[0]}function h(){return this[this.length-1]}function k(){return this.select(function(x){return x!=null})}function v(){return this.inject([],function(y,x){if(Object.isArray(x)){return y.concat(x.flatten())}y.push(x);return y})}function j(){var x=o.call(arguments,0);return this.select(function(y){return !x.include(y)})}function g(x){return(x===false?this.toArray():this)._reverse()}function m(x){return this.inject([],function(A,z,y){if(0==y||(x?A.last()!=z:!A.include(z))){A.push(z)}return A})}function r(x){return this.uniq().findAll(function(y){return x.detect(function(z){return y===z})})}function s(){return o.call(this,0)}function l(){return this.length}function u(){return"["+this.map(Object.inspect).join(", ")+"]"}function a(z,x){x||(x=0);var y=this.length;if(x<0){x=y+x}for(;x<y;x++){if(this[x]===z){return x}}return -1}function p(y,x){x=isNaN(x)?this.length:(x<0?this.length+x:x)+1;var z=this.slice(0,x).reverse().indexOf(y);return(z<0)?z:x-z-1}function c(){var C=o.call(this,0),A;for(var y=0,z=arguments.length;y<z;y++){A=arguments[y];if(Object.isArray(A)&&!("callee" in A)){for(var x=0,B=A.length;x<B;x++){C.push(A[x])}}else{C.push(A)}}return C}Object.extend(t,Enumerable);if(!t._reverse){t._reverse=t.reverse}Object.extend(t,{_each:q,clear:n,first:e,last:h,compact:k,flatten:v,without:j,reverse:g,uniq:m,intersect:r,clone:s,toArray:s,size:l,inspect:u});var f=(function(){return[].concat(arguments)[0][0]!==1})(1,2);if(f){t.concat=c}if(!t.indexOf){t.indexOf=a}if(!t.lastIndexOf){t.lastIndexOf=p}})();function $H(a){return new Hash(a)}var Hash=Class.create(Enumerable,(function(){function f(r){this._object=Object.isHash(r)?r.toObject():Object.clone(r)}function g(s){for(var r in this._object){var t=this._object[r],u=[r,t];u.key=r;u.value=t;s(u)}}function l(r,s){return this._object[r]=s}function c(r){if(this._object[r]!==Object.prototype[r]){return this._object[r]}}function o(r){var s=this._object[r];delete this._object[r];return s}function q(){return Object.clone(this._object)}function p(){return this.pluck("key")}function n(){return this.pluck("value")}function h(s){var r=this.detect(function(t){return t.value===s});return r&&r.key}function k(r){return this.clone().update(r)}function e(r){return new Hash(r).inject(this,function(s,t){s.set(t.key,t.value);return s})}function b(r,s){if(Object.isUndefined(s)){return r}return r+"="+encodeURIComponent(String.interpret(s))}function a(){return this.inject([],function(v,z){var u=encodeURIComponent(z.key),s=z.value;if(s&&typeof s=="object"){if(Object.isArray(s)){var y=[];for(var t=0,r=s.length,x;t<r;t++){x=s[t];y.push(b(u,x))}return v.concat(y)}}else{v.push(b(u,s))}return v}).join("&")}function m(){return"#<Hash:{"+this.map(function(r){return r.map(Object.inspect).join(": ")}).join(", ")+"}>"}function j(){return new Hash(this)}return{initialize:f,_each:g,set:l,get:c,unset:o,toObject:q,toTemplateReplacements:q,keys:p,values:n,index:h,merge:k,update:e,toQueryString:a,inspect:m,toJSON:q,clone:j}})());Hash.from=$H;Object.extend(Number.prototype,(function(){function e(){return this.toPaddedString(2,16)}function b(){return this+1}function j(l,k){$R(0,this,true).each(l,k);return this}function h(m,l){var k=this.toString(l||10);return"0".times(m-k.length)+k}function a(){return Math.abs(this)}function c(){return Math.round(this)}function f(){return Math.ceil(this)}function g(){return Math.floor(this)}return{toColorPart:e,succ:b,times:j,toPaddedString:h,abs:a,round:c,ceil:f,floor:g}})());function $R(c,a,b){return new ObjectRange(c,a,b)}var ObjectRange=Class.create(Enumerable,(function(){function b(g,e,f){this.start=g;this.end=e;this.exclusive=f}function c(e){var f=this.start;while(this.include(f)){e(f);f=f.succ()}}function a(e){if(e<this.start){return false}if(this.exclusive){return e<this.end}return e<=this.end}return{initialize:b,_each:c,include:a}})());var Ajax={getTransport:function(){return Try.these(function(){return new XMLHttpRequest()},function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")})||false},activeRequestCount:0};Ajax.Responders={responders:[],_each:function(a){this.responders._each(a)},register:function(a){if(!this.include(a)){this.responders.push(a)}},unregister:function(a){this.responders=this.responders.without(a)},dispatch:function(e,b,c,a){this.each(function(f){if(Object.isFunction(f[e])){try{f[e].apply(f,[b,c,a])}catch(g){}}})}};Object.extend(Ajax.Responders,Enumerable);Ajax.Responders.register({onCreate:function(){Ajax.activeRequestCount++},onComplete:function(){Ajax.activeRequestCount--}});Ajax.Base=Class.create({initialize:function(a){this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:"",evalJSON:true,evalJS:true};Object.extend(this.options,a||{});this.options.method=this.options.method.toLowerCase();if(Object.isHash(this.options.parameters)){this.options.parameters=this.options.parameters.toObject()}}});Ajax.Request=Class.create(Ajax.Base,{_complete:false,initialize:function($super,b,a){$super(a);this.transport=Ajax.getTransport();this.request(b)},request:function(b){this.url=b;this.method=this.options.method;var f=Object.isString(this.options.parameters)?this.options.parameters:Object.toQueryString(this.options.parameters);if(!["get","post"].include(this.method)){f+=(f?"&":"")+"_method="+this.method;this.method="post"}if(f&&this.method==="get"){this.url+=(this.url.include("?")?"&":"?")+f}this.parameters=f.toQueryParams();try{var a=new Ajax.Response(this);if(this.options.onCreate){this.options.onCreate(a)}Ajax.Responders.dispatch("onCreate",this,a);this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);if(this.options.asynchronous){this.respondToReadyState.bind(this).defer(1)}this.transport.onreadystatechange=this.onStateChange.bind(this);this.setRequestHeaders();this.body=this.method=="post"?(this.options.postBody||f):null;this.transport.send(this.body);if(!this.options.asynchronous&&this.transport.overrideMimeType){this.onStateChange()}}catch(c){this.dispatchException(c)}},onStateChange:function(){var a=this.transport.readyState;if(a>1&&!((a==4)&&this._complete)){this.respondToReadyState(this.transport.readyState)}},setRequestHeaders:function(){var f={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,Accept:"text/javascript, text/html, application/xml, text/xml, */*"};if(this.method=="post"){f["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){f.Connection="close"}}if(typeof this.options.requestHeaders=="object"){var c=this.options.requestHeaders;if(Object.isFunction(c.push)){for(var b=0,e=c.length;b<e;b+=2){f[c[b]]=c[b+1]}}else{$H(c).each(function(g){f[g.key]=g.value})}}for(var a in f){this.transport.setRequestHeader(a,f[a])}},success:function(){var a=this.getStatus();return !a||(a>=200&&a<300)||a==304},getStatus:function(){try{if(this.transport.status===1223){return 204}return this.transport.status||0}catch(a){return 0}},respondToReadyState:function(a){var c=Ajax.Request.Events[a],b=new Ajax.Response(this);if(c=="Complete"){try{this._complete=true;(this.options["on"+b.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(b,b.headerJSON)}catch(f){this.dispatchException(f)}var g=b.getHeader("Content-type");if(this.options.evalJS=="force"||(this.options.evalJS&&this.isSameOrigin()&&g&&g.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))){this.evalResponse()}}try{(this.options["on"+c]||Prototype.emptyFunction)(b,b.headerJSON);Ajax.Responders.dispatch("on"+c,this,b,b.headerJSON)}catch(f){this.dispatchException(f)}if(c=="Complete"){this.transport.onreadystatechange=Prototype.emptyFunction}},isSameOrigin:function(){var a=this.url.match(/^\s*https?:\/\/[^\/]*/);return !a||(a[0]=="#{protocol}//#{domain}#{port}".interpolate({protocol:location.protocol,domain:document.domain,port:location.port?":"+location.port:""}))},getHeader:function(a){try{return this.transport.getResponseHeader(a)||null}catch(b){return null}},evalResponse:function(){try{return eval((this.transport.responseText||"").unfilterJSON())}catch(e){this.dispatchException(e)}},dispatchException:function(a){(this.options.onException||Prototype.emptyFunction)(this,a);Ajax.Responders.dispatch("onException",this,a)}});Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];Ajax.Response=Class.create({initialize:function(c){this.request=c;var e=this.transport=c.transport,a=this.readyState=e.readyState;if((a>2&&!Prototype.Browser.IE)||a==4){this.status=this.getStatus();this.statusText=this.getStatusText();this.responseText=String.interpret(e.responseText);this.headerJSON=this._getHeaderJSON()}if(a==4){var b=e.responseXML;this.responseXML=Object.isUndefined(b)?null:b;this.responseJSON=this._getResponseJSON()}},status:0,statusText:"",getStatus:Ajax.Request.prototype.getStatus,getStatusText:function(){try{return this.transport.statusText||""}catch(a){return""}},getHeader:Ajax.Request.prototype.getHeader,getAllHeaders:function(){try{return this.getAllResponseHeaders()}catch(a){return null}},getResponseHeader:function(a){return this.transport.getResponseHeader(a)},getAllResponseHeaders:function(){return this.transport.getAllResponseHeaders()},_getHeaderJSON:function(){var a=this.getHeader("X-JSON");if(!a){return null}a=decodeURIComponent(escape(a));try{return a.evalJSON(this.request.options.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}},_getResponseJSON:function(){var a=this.request.options;if(!a.evalJSON||(a.evalJSON!="force"&&!(this.getHeader("Content-type")||"").include("application/json"))||this.responseText.blank()){return null}try{return this.responseText.evalJSON(a.sanitizeJSON||!this.request.isSameOrigin())}catch(b){this.request.dispatchException(b)}}});Ajax.Updater=Class.create(Ajax.Request,{initialize:function($super,a,c,b){this.container={success:(a.success||a),failure:(a.failure||(a.success?null:a))};b=Object.clone(b);var e=b.onComplete;b.onComplete=(function(f,g){this.updateContent(f.responseText);if(Object.isFunction(e)){e(f,g)}}).bind(this);$super(c,b)},updateContent:function(e){var c=this.container[this.success()?"success":"failure"],a=this.options;if(!a.evalScripts){e=e.stripScripts()}if(c=$(c)){if(a.insertion){if(Object.isString(a.insertion)){var b={};b[a.insertion]=e;c.insert(b)}else{a.insertion(c,e)}}else{c.update(e)}}}});Ajax.PeriodicalUpdater=Class.create(Ajax.Base,{initialize:function($super,a,c,b){$super(b);this.onComplete=this.options.onComplete;this.frequency=(this.options.frequency||2);this.decay=(this.options.decay||1);this.updater={};this.container=a;this.url=c;this.start()},start:function(){this.options.onComplete=this.updateComplete.bind(this);this.onTimerEvent()},stop:function(){this.updater.options.onComplete=undefined;clearTimeout(this.timer);(this.onComplete||Prototype.emptyFunction).apply(this,arguments)},updateComplete:function(a){if(this.options.decay){this.decay=(a.responseText==this.lastText?this.decay*this.options.decay:1);this.lastText=a.responseText}this.timer=this.onTimerEvent.bind(this).delay(this.decay*this.frequency)},onTimerEvent:function(){this.updater=new Ajax.Updater(this.container,this.url,this.options)}});function $(b){if(arguments.length>1){for(var a=0,e=[],c=arguments.length;a<c;a++){e.push($(arguments[a]))}return e}if(Object.isString(b)){b=document.getElementById(b)}return Element.extend(b)}if(Prototype.BrowserFeatures.XPath){document._getElementsByXPath=function(g,a){var c=[];var f=document.evaluate(g,$(a)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);for(var b=0,e=f.snapshotLength;b<e;b++){c.push(Element.extend(f.snapshotItem(b)))}return c}}if(!Node){var Node={}}if(!Node.ELEMENT_NODE){Object.extend(Node,{ELEMENT_NODE:1,ATTRIBUTE_NODE:2,TEXT_NODE:3,CDATA_SECTION_NODE:4,ENTITY_REFERENCE_NODE:5,ENTITY_NODE:6,PROCESSING_INSTRUCTION_NODE:7,COMMENT_NODE:8,DOCUMENT_NODE:9,DOCUMENT_TYPE_NODE:10,DOCUMENT_FRAGMENT_NODE:11,NOTATION_NODE:12})}(function(c){function e(g,f){if(g==="select"){return false}if("type" in f){return false}return true}var b=(function(){try{var f=document.createElement('<input name="x">');return f.tagName.toLowerCase()==="input"&&f.name==="x"}catch(g){return false}})();var a=c.Element;c.Element=function(h,g){g=g||{};h=h.toLowerCase();var f=Element.cache;if(b&&g.name){h="<"+h+' name="'+g.name+'">';delete g.name;return Element.writeAttribute(document.createElement(h),g)}if(!f[h]){f[h]=Element.extend(document.createElement(h))}var j=e(h,g)?f[h].cloneNode(false):document.createElement(h);return Element.writeAttribute(j,g)};Object.extend(c.Element,a||{});if(a){c.Element.prototype=a.prototype}})(this);Element.idCounter=1;Element.cache={};Element._purgeElement=function(b){var a=b._prototypeUID;if(a){Element.stopObserving(b);b._prototypeUID=void 0;delete Element.Storage[a]}};Element.Methods={visible:function(a){return $(a).style.display!="none"},toggle:function(a){a=$(a);Element[Element.visible(a)?"hide":"show"](a);return a},hide:function(a){a=$(a);a.style.display="none";return a},show:function(a){a=$(a);a.style.display="";return a},remove:function(a){a=$(a);a.parentNode.removeChild(a);return a},update:(function(){var e=(function(){var h=document.createElement("select"),j=true;h.innerHTML='<option value="test">test</option>';if(h.options&&h.options[0]){j=h.options[0].nodeName.toUpperCase()!=="OPTION"}h=null;return j})();var b=(function(){try{var h=document.createElement("table");if(h&&h.tBodies){h.innerHTML="<tbody><tr><td>test</td></tr></tbody>";var k=typeof h.tBodies[0]=="undefined";h=null;return k}}catch(j){return true}})();var a=(function(){try{var h=document.createElement("div");h.innerHTML="<link>";var k=(h.childNodes.length===0);h=null;return k}catch(j){return true}})();var c=e||b||a;var g=(function(){var h=document.createElement("script"),k=false;try{h.appendChild(document.createTextNode(""));k=!h.firstChild||h.firstChild&&h.firstChild.nodeType!==3}catch(j){k=true}h=null;return k})();function f(m,n){m=$(m);var h=Element._purgeElement;var o=m.getElementsByTagName("*"),l=o.length;while(l--){h(o[l])}if(n&&n.toElement){n=n.toElement()}if(Object.isElement(n)){return m.update().insert(n)}n=Object.toHTML(n);var k=m.tagName.toUpperCase();if(k==="SCRIPT"&&g){m.text=n;return m}if(c){if(k in Element._insertionTranslations.tags){while(m.firstChild){m.removeChild(m.firstChild)}Element._getContentFromAnonymousElement(k,n.stripScripts()).each(function(p){m.appendChild(p)})}else{if(a&&Object.isString(n)&&n.indexOf("<link")>-1){while(m.firstChild){m.removeChild(m.firstChild)}var j=Element._getContentFromAnonymousElement(k,n.stripScripts(),true);j.each(function(p){m.appendChild(p)})}else{m.innerHTML=n.stripScripts()}}}else{m.innerHTML=n.stripScripts()}n.evalScripts.bind(n).defer();return m}return f})(),replace:function(b,c){b=$(b);if(c&&c.toElement){c=c.toElement()}else{if(!Object.isElement(c)){c=Object.toHTML(c);var a=b.ownerDocument.createRange();a.selectNode(b);c.evalScripts.bind(c).defer();c=a.createContextualFragment(c.stripScripts())}}b.parentNode.replaceChild(c,b);return b},insert:function(c,f){c=$(c);if(Object.isString(f)||Object.isNumber(f)||Object.isElement(f)||(f&&(f.toElement||f.toHTML))){f={bottom:f}}var e,g,b,h;for(var a in f){e=f[a];a=a.toLowerCase();g=Element._insertionTranslations[a];if(e&&e.toElement){e=e.toElement()}if(Object.isElement(e)){g(c,e);continue}e=Object.toHTML(e);b=((a=="before"||a=="after")?c.parentNode:c).tagName.toUpperCase();h=Element._getContentFromAnonymousElement(b,e.stripScripts());if(a=="top"||a=="after"){h.reverse()}h.each(g.curry(c));e.evalScripts.bind(e).defer()}return c},wrap:function(b,c,a){b=$(b);if(Object.isElement(c)){$(c).writeAttribute(a||{})}else{if(Object.isString(c)){c=new Element(c,a)}else{c=new Element("div",c)}}if(b.parentNode){b.parentNode.replaceChild(c,b)}c.appendChild(b);return c},inspect:function(b){b=$(b);var a="<"+b.tagName.toLowerCase();$H({id:"id",className:"class"}).each(function(g){var f=g.first(),c=g.last(),e=(b[f]||"").toString();if(e){a+=" "+c+"="+e.inspect(true)}});return a+">"},recursivelyCollect:function(a,c,e){a=$(a);e=e||-1;var b=[];while(a=a[c]){if(a.nodeType==1){b.push(Element.extend(a))}if(b.length==e){break}}return b},ancestors:function(a){return Element.recursivelyCollect(a,"parentNode")},descendants:function(a){return Element.select(a,"*")},firstDescendant:function(a){a=$(a).firstChild;while(a&&a.nodeType!=1){a=a.nextSibling}return $(a)},immediateDescendants:function(b){var a=[],c=$(b).firstChild;while(c){if(c.nodeType===1){a.push(Element.extend(c))}c=c.nextSibling}return a},previousSiblings:function(a,b){return Element.recursivelyCollect(a,"previousSibling")},nextSiblings:function(a){return Element.recursivelyCollect(a,"nextSibling")},siblings:function(a){a=$(a);return Element.previousSiblings(a).reverse().concat(Element.nextSiblings(a))},match:function(b,a){b=$(b);if(Object.isString(a)){return Prototype.Selector.match(b,a)}return a.match(b)},up:function(b,e,a){b=$(b);if(arguments.length==1){return $(b.parentNode)}var c=Element.ancestors(b);return Object.isNumber(e)?c[e]:Prototype.Selector.find(c,e,a)},down:function(b,c,a){b=$(b);if(arguments.length==1){return Element.firstDescendant(b)}return Object.isNumber(c)?Element.descendants(b)[c]:Element.select(b,c)[a||0]},previous:function(b,c,a){b=$(b);if(Object.isNumber(c)){a=c,c=false}if(!Object.isNumber(a)){a=0}if(c){return Prototype.Selector.find(b.previousSiblings(),c,a)}else{return b.recursivelyCollect("previousSibling",a+1)[a]}},next:function(b,e,a){b=$(b);if(Object.isNumber(e)){a=e,e=false}if(!Object.isNumber(a)){a=0}if(e){return Prototype.Selector.find(b.nextSiblings(),e,a)}else{var c=Object.isNumber(a)?a+1:1;return b.recursivelyCollect("nextSibling",a+1)[a]}},select:function(a){a=$(a);var b=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(b,a)},adjacent:function(a){a=$(a);var b=Array.prototype.slice.call(arguments,1).join(", ");return Prototype.Selector.select(b,a.parentNode).without(a)},identify:function(a){a=$(a);var b=Element.readAttribute(a,"id");if(b){return b}do{b="anonymous_element_"+Element.idCounter++}while($(b));Element.writeAttribute(a,"id",b);return b},readAttribute:function(c,a){c=$(c);if(Prototype.Browser.IE){var b=Element._attributeTranslations.read;if(b.values[a]){return b.values[a](c,a)}if(b.names[a]){a=b.names[a]}if(a.include(":")){return(!c.attributes||!c.attributes[a])?null:c.attributes[a].value}}return c.getAttribute(a)},writeAttribute:function(f,c,g){f=$(f);var b={},e=Element._attributeTranslations.write;if(typeof c=="object"){b=c}else{b[c]=Object.isUndefined(g)?true:g}for(var a in b){c=e.names[a]||a;g=b[a];if(e.values[a]){c=e.values[a](f,g)}if(g===false||g===null){f.removeAttribute(c)}else{if(g===true){f.setAttribute(c,c)}else{f.setAttribute(c,g)}}}return f},getHeight:function(a){return Element.getDimensions(a).height},getWidth:function(a){return Element.getDimensions(a).width},classNames:function(a){return new Element.ClassNames(a)},hasClassName:function(a,b){if(!(a=$(a))){return}var c=a.className;return(c.length>0&&(c==b||new RegExp("(^|\\s)"+b+"(\\s|$)").test(c)))},addClassName:function(a,b){if(!(a=$(a))){return}if(!Element.hasClassName(a,b)){a.className+=(a.className?" ":"")+b}return a},removeClassName:function(a,b){if(!(a=$(a))){return}a.className=a.className.replace(new RegExp("(^|\\s+)"+b+"(\\s+|$)")," ").strip();return a},toggleClassName:function(a,b){if(!(a=$(a))){return}return Element[Element.hasClassName(a,b)?"removeClassName":"addClassName"](a,b)},cleanWhitespace:function(b){b=$(b);var c=b.firstChild;while(c){var a=c.nextSibling;if(c.nodeType==3&&!/\S/.test(c.nodeValue)){b.removeChild(c)}c=a}return b},empty:function(a){return $(a).innerHTML.blank()},descendantOf:function(b,a){b=$(b),a=$(a);if(b.compareDocumentPosition){return(b.compareDocumentPosition(a)&8)===8}if(a.contains){return a.contains(b)&&a!==b}while(b=b.parentNode){if(b==a){return true}}return false},scrollTo:function(a){a=$(a);var b=Element.cumulativeOffset(a);window.scrollTo(b[0],b[1]);return a},getStyle:function(b,c){b=$(b);c=c=="float"?"cssFloat":c.camelize();var e=b.style[c];if(!e||e=="auto"){var a=document.defaultView.getComputedStyle(b,null);e=a?a[c]:null}if(c=="opacity"){return e?parseFloat(e):1}return e=="auto"?null:e},getOpacity:function(a){return $(a).getStyle("opacity")},setStyle:function(b,c){b=$(b);var f=b.style,a;if(Object.isString(c)){b.style.cssText+=";"+c;return c.include("opacity")?b.setOpacity(c.match(/opacity:\s*(\d?\.?\d*)/)[1]):b}for(var e in c){if(e=="opacity"){b.setOpacity(c[e])}else{f[(e=="float"||e=="cssFloat")?(Object.isUndefined(f.styleFloat)?"cssFloat":"styleFloat"):e]=c[e]}}return b},setOpacity:function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;return a},makePositioned:function(a){a=$(a);var b=Element.getStyle(a,"position");if(b=="static"||!b){a._madePositioned=true;a.style.position="relative";if(Prototype.Browser.Opera){a.style.top=0;a.style.left=0}}return a},undoPositioned:function(a){a=$(a);if(a._madePositioned){a._madePositioned=undefined;a.style.position=a.style.top=a.style.left=a.style.bottom=a.style.right=""}return a},makeClipping:function(a){a=$(a);if(a._overflow){return a}a._overflow=Element.getStyle(a,"overflow")||"auto";if(a._overflow!=="hidden"){a.style.overflow="hidden"}return a},undoClipping:function(a){a=$(a);if(!a._overflow){return a}a.style.overflow=a._overflow=="auto"?"":a._overflow;a._overflow=null;return a},clonePosition:function(b,e){var a=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});e=$(e);var f=Element.viewportOffset(e),g=[0,0],c=null;b=$(b);if(Element.getStyle(b,"position")=="absolute"){c=Element.getOffsetParent(b);g=Element.viewportOffset(c)}if(c==document.body){g[0]-=document.body.offsetLeft;g[1]-=document.body.offsetTop}if(a.setLeft){b.style.left=(f[0]-g[0]+a.offsetLeft)+"px"}if(a.setTop){b.style.top=(f[1]-g[1]+a.offsetTop)+"px"}if(a.setWidth){b.style.width=e.offsetWidth+"px"}if(a.setHeight){b.style.height=e.offsetHeight+"px"}return b}};Object.extend(Element.Methods,{getElementsBySelector:Element.Methods.select,childElements:Element.Methods.immediateDescendants});Element._attributeTranslations={write:{names:{className:"class",htmlFor:"for"},values:{}}};if(Prototype.Browser.Opera){Element.Methods.getStyle=Element.Methods.getStyle.wrap(function(e,b,c){switch(c){case"height":case"width":if(!Element.visible(b)){return null}var f=parseInt(e(b,c),10);if(f!==b["offset"+c.capitalize()]){return f+"px"}var a;if(c==="height"){a=["border-top-width","padding-top","padding-bottom","border-bottom-width"]}else{a=["border-left-width","padding-left","padding-right","border-right-width"]}return a.inject(f,function(g,h){var j=e(b,h);return j===null?g:g-parseInt(j,10)})+"px";default:return e(b,c)}});Element.Methods.readAttribute=Element.Methods.readAttribute.wrap(function(c,a,b){if(b==="title"){return a.title}return c(a,b)})}else{if(Prototype.Browser.IE){Element.Methods.getStyle=function(a,b){a=$(a);b=(b=="float"||b=="cssFloat")?"styleFloat":b.camelize();var c=a.style[b];if(!c&&a.currentStyle){c=a.currentStyle[b]}if(b=="opacity"){if(c=(a.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){if(c[1]){return parseFloat(c[1])/100}}return 1}if(c=="auto"){if((b=="width"||b=="height")&&(a.getStyle("display")!="none")){return a["offset"+b.capitalize()]+"px"}return null}return c};Element.Methods.setOpacity=function(b,f){function g(h){return h.replace(/alpha\([^\)]*\)/gi,"")}b=$(b);var a=b.currentStyle;if((a&&!a.hasLayout)||(!a&&b.style.zoom=="normal")){b.style.zoom=1}var e=b.getStyle("filter"),c=b.style;if(f==1||f===""){(e=g(e))?c.filter=e:c.removeAttribute("filter");return b}else{if(f<0.00001){f=0}}c.filter=g(e)+"alpha(opacity="+(f*100)+")";return b};Element._attributeTranslations=(function(){var b="className",a="for",c=document.createElement("div");c.setAttribute(b,"x");if(c.className!=="x"){c.setAttribute("class","x");if(c.className==="x"){b="class"}}c=null;c=document.createElement("label");c.setAttribute(a,"x");if(c.htmlFor!=="x"){c.setAttribute("htmlFor","x");if(c.htmlFor==="x"){a="htmlFor"}}c=null;return{read:{names:{"class":b,className:b,"for":a,htmlFor:a},values:{_getAttr:function(e,f){return e.getAttribute(f)},_getAttr2:function(e,f){return e.getAttribute(f,2)},_getAttrNode:function(e,g){var f=e.getAttributeNode(g);return f?f.value:""},_getEv:(function(){var e=document.createElement("div"),h;e.onclick=Prototype.emptyFunction;var g=e.getAttribute("onclick");if(String(g).indexOf("{")>-1){h=function(f,j){j=f.getAttribute(j);if(!j){return null}j=j.toString();j=j.split("{")[1];j=j.split("}")[0];return j.strip()}}else{if(g===""){h=function(f,j){j=f.getAttribute(j);if(!j){return null}return j.strip()}}}e=null;return h})(),_flag:function(e,f){return $(e).hasAttribute(f)?f:null},style:function(e){return e.style.cssText.toLowerCase()},title:function(e){return e.title}}}}})();Element._attributeTranslations.write={names:Object.extend({cellpadding:"cellPadding",cellspacing:"cellSpacing"},Element._attributeTranslations.read.names),values:{checked:function(a,b){a.checked=!!b},style:function(a,b){a.style.cssText=b?b:""}}};Element._attributeTranslations.has={};$w("colSpan rowSpan vAlign dateTime accessKey tabIndex encType maxLength readOnly longDesc frameBorder").each(function(a){Element._attributeTranslations.write.names[a.toLowerCase()]=a;Element._attributeTranslations.has[a.toLowerCase()]=a});(function(a){Object.extend(a,{href:a._getAttr2,src:a._getAttr2,type:a._getAttr,action:a._getAttrNode,disabled:a._flag,checked:a._flag,readonly:a._flag,multiple:a._flag,onload:a._getEv,onunload:a._getEv,onclick:a._getEv,ondblclick:a._getEv,onmousedown:a._getEv,onmouseup:a._getEv,onmouseover:a._getEv,onmousemove:a._getEv,onmouseout:a._getEv,onfocus:a._getEv,onblur:a._getEv,onkeypress:a._getEv,onkeydown:a._getEv,onkeyup:a._getEv,onsubmit:a._getEv,onreset:a._getEv,onselect:a._getEv,onchange:a._getEv})})(Element._attributeTranslations.read.values);if(Prototype.BrowserFeatures.ElementExtensions){(function(){function a(f){var b=f.getElementsByTagName("*"),e=[];for(var c=0,g;g=b[c];c++){if(g.tagName!=="!"){e.push(g)}}return e}Element.Methods.down=function(c,e,b){c=$(c);if(arguments.length==1){return c.firstDescendant()}return Object.isNumber(e)?a(c)[e]:Element.select(c,e)[b||0]}})()}}else{if(Prototype.Browser.Gecko&&/rv:1\.8\.0/.test(navigator.userAgent)){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1)?0.999999:(b==="")?"":(b<0.00001)?0:b;return a}}else{if(Prototype.Browser.WebKit){Element.Methods.setOpacity=function(a,b){a=$(a);a.style.opacity=(b==1||b==="")?"":(b<0.00001)?0:b;if(b==1){if(a.tagName.toUpperCase()=="IMG"&&a.width){a.width++;a.width--}else{try{var f=document.createTextNode(" ");a.appendChild(f);a.removeChild(f)}catch(c){}}}return a}}}}}if("outerHTML" in document.documentElement){Element.Methods.replace=function(c,f){c=$(c);if(f&&f.toElement){f=f.toElement()}if(Object.isElement(f)){c.parentNode.replaceChild(f,c);return c}f=Object.toHTML(f);var e=c.parentNode,b=e.tagName.toUpperCase();if(Element._insertionTranslations.tags[b]){var g=c.next(),a=Element._getContentFromAnonymousElement(b,f.stripScripts());e.removeChild(c);if(g){a.each(function(h){e.insertBefore(h,g)})}else{a.each(function(h){e.appendChild(h)})}}else{c.outerHTML=f.stripScripts()}f.evalScripts.bind(f).defer();return c}}Element._returnOffset=function(b,c){var a=[b,c];a.left=b;a.top=c;return a};Element._getContentFromAnonymousElement=function(f,e,g){var h=new Element("div"),c=Element._insertionTranslations.tags[f];var a=false;if(c){a=true}else{if(g){a=true;c=["","",0]}}if(a){h.innerHTML="&nbsp;"+c[0]+e+c[1];h.removeChild(h.firstChild);for(var b=c[2];b--;){h=h.firstChild}}else{h.innerHTML=e}return $A(h.childNodes)};Element._insertionTranslations={before:function(a,b){a.parentNode.insertBefore(b,a)},top:function(a,b){a.insertBefore(b,a.firstChild)},bottom:function(a,b){a.appendChild(b)},after:function(a,b){a.parentNode.insertBefore(b,a.nextSibling)},tags:{TABLE:["<table>","</table>",1],TBODY:["<table><tbody>","</tbody></table>",2],TR:["<table><tbody><tr>","</tr></tbody></table>",3],TD:["<table><tbody><tr><td>","</td></tr></tbody></table>",4],SELECT:["<select>","</select>",1]}};(function(){var a=Element._insertionTranslations.tags;Object.extend(a,{THEAD:a.TBODY,TFOOT:a.TBODY,TH:a.TD})})();Element.Methods.Simulated={hasAttribute:function(a,c){c=Element._attributeTranslations.has[c]||c;var b=$(a).getAttributeNode(c);return !!(b&&b.specified)}};Element.Methods.ByTag={};Object.extend(Element,Element.Methods);(function(a){if(!Prototype.BrowserFeatures.ElementExtensions&&a.__proto__){window.HTMLElement={};window.HTMLElement.prototype=a.__proto__;Prototype.BrowserFeatures.ElementExtensions=true}a=null})(document.createElement("div"));Element.extend=(function(){function c(h){if(typeof window.Element!="undefined"){var k=window.Element.prototype;if(k){var m="_"+(Math.random()+"").slice(2),j=document.createElement(h);k[m]="x";var l=(j[m]!=="x");delete k[m];j=null;return l}}return false}function b(j,h){for(var l in h){var k=h[l];if(Object.isFunction(k)&&!(l in j)){j[l]=k.methodize()}}}var e=c("object");if(Prototype.BrowserFeatures.SpecificElementExtensions){if(e){return function(j){if(j&&typeof j._extendedByPrototype=="undefined"){var h=j.tagName;if(h&&(/^(?:object|applet|embed)$/i.test(h))){b(j,Element.Methods);b(j,Element.Methods.Simulated);b(j,Element.Methods.ByTag[h.toUpperCase()])}}return j}}return Prototype.K}var a={},f=Element.Methods.ByTag;var g=Object.extend(function(k){if(!k||typeof k._extendedByPrototype!="undefined"||k.nodeType!=1||k==window){return k}var h=Object.clone(a),j=k.tagName.toUpperCase();if(f[j]){Object.extend(h,f[j])}b(k,h);k._extendedByPrototype=Prototype.emptyFunction;return k},{refresh:function(){if(!Prototype.BrowserFeatures.ElementExtensions){Object.extend(a,Element.Methods);Object.extend(a,Element.Methods.Simulated)}}});g.refresh();return g})();if(document.documentElement.hasAttribute){Element.hasAttribute=function(a,b){return a.hasAttribute(b)}}else{Element.hasAttribute=Element.Methods.Simulated.hasAttribute}Element.addMethods=function(c){var k=Prototype.BrowserFeatures,e=Element.Methods.ByTag;if(!c){Object.extend(Form,Form.Methods);Object.extend(Form.Element,Form.Element.Methods);Object.extend(Element.Methods.ByTag,{FORM:Object.clone(Form.Methods),INPUT:Object.clone(Form.Element.Methods),SELECT:Object.clone(Form.Element.Methods),TEXTAREA:Object.clone(Form.Element.Methods),BUTTON:Object.clone(Form.Element.Methods)})}if(arguments.length==2){var b=c;c=arguments[1]}if(!b){Object.extend(Element.Methods,c||{})}else{if(Object.isArray(b)){b.each(h)}else{h(b)}}function h(m){m=m.toUpperCase();if(!Element.Methods.ByTag[m]){Element.Methods.ByTag[m]={}}Object.extend(Element.Methods.ByTag[m],c)}function a(o,n,m){m=m||false;for(var q in o){var p=o[q];if(!Object.isFunction(p)){continue}if(!m||!(q in n)){n[q]=p.methodize()}}}function f(p){var m;var o={OPTGROUP:"OptGroup",TEXTAREA:"TextArea",P:"Paragraph",FIELDSET:"FieldSet",UL:"UList",OL:"OList",DL:"DList",DIR:"Directory",H1:"Heading",H2:"Heading",H3:"Heading",H4:"Heading",H5:"Heading",H6:"Heading",Q:"Quote",INS:"Mod",DEL:"Mod",A:"Anchor",IMG:"Image",CAPTION:"TableCaption",COL:"TableCol",COLGROUP:"TableCol",THEAD:"TableSection",TFOOT:"TableSection",TBODY:"TableSection",TR:"TableRow",TH:"TableCell",TD:"TableCell",FRAMESET:"FrameSet",IFRAME:"IFrame"};if(o[p]){m="HTML"+o[p]+"Element"}if(window[m]){return window[m]}m="HTML"+p+"Element";if(window[m]){return window[m]}m="HTML"+p.capitalize()+"Element";if(window[m]){return window[m]}var n=document.createElement(p),q=n.__proto__||n.constructor.prototype;n=null;return q}var j=window.HTMLElement?HTMLElement.prototype:Element.prototype;if(k.ElementExtensions){a(Element.Methods,j);a(Element.Methods.Simulated,j,true)}if(k.SpecificElementExtensions){for(var l in Element.Methods.ByTag){var g=f(l);if(Object.isUndefined(g)){continue}a(e[l],g.prototype)}}Object.extend(Element,Element.Methods);delete Element.ByTag;if(Element.extend.refresh){Element.extend.refresh()}Element.cache={}};document.viewport={getDimensions:function(){return{width:this.getWidth(),height:this.getHeight()}},getScrollOffsets:function(){return Element._returnOffset(window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft,window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop)}};(function(b){var h=Prototype.Browser,f=document,c,e={};function a(){if(h.WebKit&&!f.evaluate){return document}if(h.Opera&&window.parseFloat(window.opera.version())<9.5){return document.body}return document.documentElement}function g(j){if(!c){c=a()}e[j]="client"+j;b["get"+j]=function(){return c[e[j]]};return b["get"+j]()}b.getWidth=g.curry("Width");b.getHeight=g.curry("Height")})(document.viewport);Element.Storage={UID:1};Element.addMethods({getStorage:function(b){if(!(b=$(b))){return}var a;if(b===window){a=0}else{if(typeof b._prototypeUID==="undefined"){b._prototypeUID=Element.Storage.UID++}a=b._prototypeUID}if(!Element.Storage[a]){Element.Storage[a]=$H()}return Element.Storage[a]},store:function(b,a,c){if(!(b=$(b))){return}if(arguments.length===2){Element.getStorage(b).update(a)}else{Element.getStorage(b).set(a,c)}return b},retrieve:function(c,b,a){if(!(c=$(c))){return}var f=Element.getStorage(c),e=f.get(b);if(Object.isUndefined(e)){f.set(b,a);e=a}return e},clone:function(c,a){if(!(c=$(c))){return}var f=c.cloneNode(a);f._prototypeUID=void 0;if(a){var e=Element.select(f,"*"),b=e.length;while(b--){e[b]._prototypeUID=void 0}}return Element.extend(f)},purge:function(c){if(!(c=$(c))){return}var a=Element._purgeElement;a(c);var e=c.getElementsByTagName("*"),b=e.length;while(b--){a(e[b])}return null}});(function(){function j(y){var x=y.match(/^(\d+)%?$/i);if(!x){return null}return(Number(x[1])/100)}function q(I,J,y){var B=null;if(Object.isElement(I)){B=I;I=B.getStyle(J)}if(I===null){return null}if((/^(?:-)?\d+(\.\d+)?(px)?$/i).test(I)){return window.parseFloat(I)}var D=I.include("%"),z=(y===document.viewport);if(/\d/.test(I)&&B&&B.runtimeStyle&&!(D&&z)){var x=B.style.left,H=B.runtimeStyle.left;B.runtimeStyle.left=B.currentStyle.left;B.style.left=I||0;I=B.style.pixelLeft;B.style.left=x;B.runtimeStyle.left=H;return I}if(B&&D){y=y||B.parentNode;var A=j(I);var E=null;var C=B.getStyle("position");var G=J.include("left")||J.include("right")||J.include("width");var F=J.include("top")||J.include("bottom")||J.include("height");if(y===document.viewport){if(G){E=document.viewport.getWidth()}else{if(F){E=document.viewport.getHeight()}}}else{if(G){E=$(y).measure("width")}else{if(F){E=$(y).measure("height")}}}return(E===null)?0:E*A}return 0}function h(x){if(Object.isString(x)&&x.endsWith("px")){return x}return x+"px"}function l(y){var x=y;while(y&&y.parentNode){var z=y.getStyle("display");if(z==="none"){return false}y=$(y.parentNode)}return true}var e=Prototype.K;if("currentStyle" in document.documentElement){e=function(x){if(!x.currentStyle.hasLayout){x.style.zoom=1}return x}}function g(x){if(x.include("border")){x=x+"-width"}return x.camelize()}Element.Layout=Class.create(Hash,{initialize:function($super,y,x){$super();this.element=$(y);Element.Layout.PROPERTIES.each(function(z){this._set(z,null)},this);if(x){this._preComputing=true;this._begin();Element.Layout.PROPERTIES.each(this._compute,this);this._end();this._preComputing=false}},_set:function(y,x){return Hash.prototype.set.call(this,y,x)},set:function(y,x){throw"Properties of Element.Layout are read-only."},get:function($super,y){var x=$super(y);return x===null?this._compute(y):x},_begin:function(){if(this._prepared){return}var B=this.element;if(l(B)){this._prepared=true;return}var D={position:B.style.position||"",width:B.style.width||"",visibility:B.style.visibility||"",display:B.style.display||""};B.store("prototype_original_styles",D);var E=B.getStyle("position"),x=B.getStyle("width");if(x==="0px"||x===null){B.style.display="block";x=B.getStyle("width")}var y=(E==="fixed")?document.viewport:B.parentNode;B.setStyle({position:"absolute",visibility:"hidden",display:"block"});var z=B.getStyle("width");var A;if(x&&(z===x)){A=q(B,"width",y)}else{if(E==="absolute"||E==="fixed"){A=q(B,"width",y)}else{var F=B.parentNode,C=$(F).getLayout();A=C.get("width")-this.get("margin-left")-this.get("border-left")-this.get("padding-left")-this.get("padding-right")-this.get("border-right")-this.get("margin-right")}}B.setStyle({width:A+"px"});this._prepared=true},_end:function(){var y=this.element;var x=y.retrieve("prototype_original_styles");y.store("prototype_original_styles",null);y.setStyle(x);this._prepared=false},_compute:function(y){var x=Element.Layout.COMPUTATIONS;if(!(y in x)){throw"Property not found."}return this._set(y,x[y].call(this,this.element))},toObject:function(){var x=$A(arguments);var y=(x.length===0)?Element.Layout.PROPERTIES:x.join(" ").split(" ");var z={};y.each(function(A){if(!Element.Layout.PROPERTIES.include(A)){return}var B=this.get(A);if(B!=null){z[A]=B}},this);return z},toHash:function(){var x=this.toObject.apply(this,arguments);return new Hash(x)},toCSS:function(){var x=$A(arguments);var z=(x.length===0)?Element.Layout.PROPERTIES:x.join(" ").split(" ");var y={};z.each(function(A){if(!Element.Layout.PROPERTIES.include(A)){return}if(Element.Layout.COMPOSITE_PROPERTIES.include(A)){return}var B=this.get(A);if(B!=null){y[g(A)]=B+"px"}},this);return y},inspect:function(){return"#<Element.Layout>"}});Object.extend(Element.Layout,{PROPERTIES:$w("height width top left right bottom border-left border-right border-top border-bottom padding-left padding-right padding-top padding-bottom margin-top margin-bottom margin-left margin-right padding-box-width padding-box-height border-box-width border-box-height margin-box-width margin-box-height"),COMPOSITE_PROPERTIES:$w("padding-box-width padding-box-height margin-box-width margin-box-height border-box-width border-box-height"),COMPUTATIONS:{height:function(z){if(!this._preComputing){this._begin()}var x=this.get("border-box-height");if(x<=0){if(!this._preComputing){this._end()}return 0}var A=this.get("border-top"),y=this.get("border-bottom");var C=this.get("padding-top"),B=this.get("padding-bottom");if(!this._preComputing){this._end()}return x-A-y-C-B},width:function(z){if(!this._preComputing){this._begin()}var y=this.get("border-box-width");if(y<=0){if(!this._preComputing){this._end()}return 0}var C=this.get("border-left"),x=this.get("border-right");var A=this.get("padding-left"),B=this.get("padding-right");if(!this._preComputing){this._end()}return y-C-x-A-B},"padding-box-height":function(y){var x=this.get("height"),A=this.get("padding-top"),z=this.get("padding-bottom");return x+A+z},"padding-box-width":function(x){var y=this.get("width"),z=this.get("padding-left"),A=this.get("padding-right");return y+z+A},"border-box-height":function(y){if(!this._preComputing){this._begin()}var x=y.offsetHeight;if(!this._preComputing){this._end()}return x},"border-box-width":function(x){if(!this._preComputing){this._begin()}var y=x.offsetWidth;if(!this._preComputing){this._end()}return y},"margin-box-height":function(y){var x=this.get("border-box-height"),z=this.get("margin-top"),A=this.get("margin-bottom");if(x<=0){return 0}return x+z+A},"margin-box-width":function(z){var y=this.get("border-box-width"),A=this.get("margin-left"),x=this.get("margin-right");if(y<=0){return 0}return y+A+x},top:function(x){var y=x.positionedOffset();return y.top},bottom:function(x){var A=x.positionedOffset(),y=x.getOffsetParent(),z=y.measure("height");var B=this.get("border-box-height");return z-B-A.top},left:function(x){var y=x.positionedOffset();return y.left},right:function(z){var B=z.positionedOffset(),A=z.getOffsetParent(),x=A.measure("width");var y=this.get("border-box-width");return x-y-B.left},"padding-top":function(x){return q(x,"paddingTop")},"padding-bottom":function(x){return q(x,"paddingBottom")},"padding-left":function(x){return q(x,"paddingLeft")},"padding-right":function(x){return q(x,"paddingRight")},"border-top":function(x){return q(x,"borderTopWidth")},"border-bottom":function(x){return q(x,"borderBottomWidth")},"border-left":function(x){return q(x,"borderLeftWidth")},"border-right":function(x){return q(x,"borderRightWidth")},"margin-top":function(x){return q(x,"marginTop")},"margin-bottom":function(x){return q(x,"marginBottom")},"margin-left":function(x){return q(x,"marginLeft")},"margin-right":function(x){return q(x,"marginRight")}}});if("getBoundingClientRect" in document.documentElement){Object.extend(Element.Layout.COMPUTATIONS,{right:function(y){var z=e(y.getOffsetParent());var A=y.getBoundingClientRect(),x=z.getBoundingClientRect();return(x.right-A.right).round()},bottom:function(y){var z=e(y.getOffsetParent());var A=y.getBoundingClientRect(),x=z.getBoundingClientRect();return(x.bottom-A.bottom).round()}})}Element.Offset=Class.create({initialize:function(y,x){this.left=y.round();this.top=x.round();this[0]=this.left;this[1]=this.top},relativeTo:function(x){return new Element.Offset(this.left-x.left,this.top-x.top)},inspect:function(){return"#<Element.Offset left: #{left} top: #{top}>".interpolate(this)},toString:function(){return"[#{left}, #{top}]".interpolate(this)},toArray:function(){return[this.left,this.top]}});function t(y,x){return new Element.Layout(y,x)}function b(x,y){return $(x).getLayout().get(y)}function p(y){y=$(y);var C=Element.getStyle(y,"display");if(C&&C!=="none"){return{width:y.offsetWidth,height:y.offsetHeight}}var z=y.style;var x={visibility:z.visibility,position:z.position,display:z.display};var B={visibility:"hidden",display:"block"};if(x.position!=="fixed"){B.position="absolute"}Element.setStyle(y,B);var A={width:y.offsetWidth,height:y.offsetHeight};Element.setStyle(y,x);return A}function n(x){x=$(x);if(f(x)||c(x)||o(x)||m(x)){return $(document.body)}var y=(Element.getStyle(x,"display")==="inline");if(!y&&x.offsetParent){return $(x.offsetParent)}while((x=x.parentNode)&&x!==document.body){if(Element.getStyle(x,"position")!=="static"){return m(x)?$(document.body):$(x)}}return $(document.body)}function v(y){y=$(y);var x=0,z=0;if(y.parentNode){do{x+=y.offsetTop||0;z+=y.offsetLeft||0;y=y.offsetParent}while(y)}return new Element.Offset(z,x)}function r(y){y=$(y);var z=y.getLayout();var x=0,B=0;do{x+=y.offsetTop||0;B+=y.offsetLeft||0;y=y.offsetParent;if(y){if(o(y)){break}var A=Element.getStyle(y,"position");if(A!=="static"){break}}}while(y);B-=z.get("margin-top");x-=z.get("margin-left");return new Element.Offset(B,x)}function a(y){var x=0,z=0;do{x+=y.scrollTop||0;z+=y.scrollLeft||0;y=y.parentNode}while(y);return new Element.Offset(z,x)}function u(B){y=$(y);var x=0,A=0,z=document.body;var y=B;do{x+=y.offsetTop||0;A+=y.offsetLeft||0;if(y.offsetParent==z&&Element.getStyle(y,"position")=="absolute"){break}}while(y=y.offsetParent);y=B;do{if(y!=z){x-=y.scrollTop||0;A-=y.scrollLeft||0}}while(y=y.parentNode);return new Element.Offset(A,x)}function s(x){x=$(x);if(Element.getStyle(x,"position")==="absolute"){return x}var B=n(x);var A=x.viewportOffset(),y=B.viewportOffset();var C=A.relativeTo(y);var z=x.getLayout();x.store("prototype_absolutize_original_styles",{left:x.getStyle("left"),top:x.getStyle("top"),width:x.getStyle("width"),height:x.getStyle("height")});x.setStyle({position:"absolute",top:C.top+"px",left:C.left+"px",width:z.get("width")+"px",height:z.get("height")+"px"});return x}function k(y){y=$(y);if(Element.getStyle(y,"position")==="relative"){return y}var x=y.retrieve("prototype_absolutize_original_styles");if(x){y.setStyle(x)}return y}if(Prototype.Browser.IE){n=n.wrap(function(z,y){y=$(y);if(f(y)||c(y)||o(y)||m(y)){return $(document.body)}var x=y.getStyle("position");if(x!=="static"){return z(y)}y.setStyle({position:"relative"});var A=z(y);y.setStyle({position:x});return A});r=r.wrap(function(A,y){y=$(y);if(!y.parentNode){return new Element.Offset(0,0)}var x=y.getStyle("position");if(x!=="static"){return A(y)}var z=y.getOffsetParent();if(z&&z.getStyle("position")==="fixed"){e(z)}y.setStyle({position:"relative"});var B=A(y);y.setStyle({position:x});return B})}else{if(Prototype.Browser.Webkit){v=function(y){y=$(y);var x=0,z=0;do{x+=y.offsetTop||0;z+=y.offsetLeft||0;if(y.offsetParent==document.body){if(Element.getStyle(y,"position")=="absolute"){break}}y=y.offsetParent}while(y);return new Element.Offset(z,x)}}}Element.addMethods({getLayout:t,measure:b,getDimensions:p,getOffsetParent:n,cumulativeOffset:v,positionedOffset:r,cumulativeScrollOffset:a,viewportOffset:u,absolutize:s,relativize:k});function o(x){return x.nodeName.toUpperCase()==="BODY"}function m(x){return x.nodeName.toUpperCase()==="HTML"}function f(x){return x.nodeType===Node.DOCUMENT_NODE}function c(x){return x!==document.body&&!Element.descendantOf(x,document.body)}if("getBoundingClientRect" in document.documentElement){Element.addMethods({viewportOffset:function(x){x=$(x);if(c(x)){return new Element.Offset(0,0)}var y=x.getBoundingClientRect(),z=document.documentElement;return new Element.Offset(y.left-z.clientLeft,y.top-z.clientTop)}})}})();window.$$=function(){var a=$A(arguments).join(", ");return Prototype.Selector.select(a,document)};Prototype.Selector=(function(){function a(){throw new Error('Method "Prototype.Selector.select" must be defined.')}function c(){throw new Error('Method "Prototype.Selector.match" must be defined.')}function e(m,n,j){j=j||0;var h=Prototype.Selector.match,l=m.length,g=0,k;for(k=0;k<l;k++){if(h(m[k],n)&&j==g++){return Element.extend(m[k])}}}function f(j){for(var g=0,h=j.length;g<h;g++){Element.extend(j[g])}return j}var b=Prototype.K;return{select:a,match:c,find:e,extendElements:(Element.extend===b)?b:f,extendElement:Element.extend}})();Prototype._original_property=window.Sizzle;
/*!
 * Sizzle CSS Selector Engine - v1.0
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var s=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,l=0,f=Object.prototype.toString,q=false,k=true;[0,0].sort(function(){k=false;return 0});var b=function(H,x,E,z){E=E||[];var e=x=x||document;if(x.nodeType!==1&&x.nodeType!==9){return[]}if(!H||typeof H!=="string"){return E}var F=[],G,C,L,K,D,v,u=true,A=r(x),J=H;while((s.exec(""),G=s.exec(J))!==null){J=G[3];F.push(G[1]);if(G[2]){v=G[3];break}}if(F.length>1&&m.exec(H)){if(F.length===2&&g.relative[F[0]]){C=h(F[0]+F[1],x)}else{C=g.relative[F[0]]?[x]:b(F.shift(),x);while(F.length){H=F.shift();if(g.relative[H]){H+=F.shift()}C=h(H,C)}}}else{if(!z&&F.length>1&&x.nodeType===9&&!A&&g.match.ID.test(F[0])&&!g.match.ID.test(F[F.length-1])){var M=b.find(F.shift(),x,A);x=M.expr?b.filter(M.expr,M.set)[0]:M.set[0]}if(x){var M=z?{expr:F.pop(),set:a(z)}:b.find(F.pop(),F.length===1&&(F[0]==="~"||F[0]==="+")&&x.parentNode?x.parentNode:x,A);C=M.expr?b.filter(M.expr,M.set):M.set;if(F.length>0){L=a(C)}else{u=false}while(F.length){var y=F.pop(),B=y;if(!g.relative[y]){y=""}else{B=F.pop()}if(B==null){B=x}g.relative[y](L,B,A)}}else{L=F=[]}}if(!L){L=C}if(!L){throw"Syntax error, unrecognized expression: "+(y||H)}if(f.call(L)==="[object Array]"){if(!u){E.push.apply(E,L)}else{if(x&&x.nodeType===1){for(var I=0;L[I]!=null;I++){if(L[I]&&(L[I]===true||L[I].nodeType===1&&j(x,L[I]))){E.push(C[I])}}}else{for(var I=0;L[I]!=null;I++){if(L[I]&&L[I].nodeType===1){E.push(C[I])}}}}}else{a(L,E)}if(v){b(v,e,E,z);b.uniqueSort(E)}return E};b.uniqueSort=function(u){if(c){q=k;u.sort(c);if(q){for(var e=1;e<u.length;e++){if(u[e]===u[e-1]){u.splice(e--,1)}}}}return u};b.matches=function(e,u){return b(e,null,null,u)};b.find=function(B,e,C){var A,y;if(!B){return[]}for(var x=0,v=g.order.length;x<v;x++){var z=g.order[x],y;if((y=g.leftMatch[z].exec(B))){var u=y[1];y.splice(1,1);if(u.substr(u.length-1)!=="\\"){y[1]=(y[1]||"").replace(/\\/g,"");A=g.find[z](y,e,C);if(A!=null){B=B.replace(g.match[z],"");break}}}}if(!A){A=e.getElementsByTagName("*")}return{set:A,expr:B}};b.filter=function(E,D,H,x){var v=E,J=[],B=D,z,e,A=D&&D[0]&&r(D[0]);while(E&&D.length){for(var C in g.filter){if((z=g.match[C].exec(E))!=null){var u=g.filter[C],I,G;e=false;if(B==J){J=[]}if(g.preFilter[C]){z=g.preFilter[C](z,B,H,J,x,A);if(!z){e=I=true}else{if(z===true){continue}}}if(z){for(var y=0;(G=B[y])!=null;y++){if(G){I=u(G,z,y,B);var F=x^!!I;if(H&&I!=null){if(F){e=true}else{B[y]=false}}else{if(F){J.push(G);e=true}}}}}if(I!==undefined){if(!H){B=J}E=E.replace(g.match[C],"");if(!e){return[]}break}}}if(E==v){if(e==null){throw"Syntax error, unrecognized expression: "+E}else{break}}v=E}return B};var g=b.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")}},relative:{"+":function(B,e,A){var y=typeof e==="string",C=y&&!/\W/.test(e),z=y&&!C;if(C&&!A){e=e.toUpperCase()}for(var x=0,v=B.length,u;x<v;x++){if((u=B[x])){while((u=u.previousSibling)&&u.nodeType!==1){}B[x]=z||u&&u.nodeName===e?u||false:u===e}}if(z){b.filter(e,B,true)}},">":function(A,u,B){var y=typeof u==="string";if(y&&!/\W/.test(u)){u=B?u:u.toUpperCase();for(var v=0,e=A.length;v<e;v++){var z=A[v];if(z){var x=z.parentNode;A[v]=x.nodeName===u?x:false}}}else{for(var v=0,e=A.length;v<e;v++){var z=A[v];if(z){A[v]=y?z.parentNode:z.parentNode===u}}if(y){b.filter(u,A,true)}}},"":function(x,u,z){var v=l++,e=t;if(!/\W/.test(u)){var y=u=z?u:u.toUpperCase();e=p}e("parentNode",u,v,x,y,z)},"~":function(x,u,z){var v=l++,e=t;if(typeof u==="string"&&!/\W/.test(u)){var y=u=z?u:u.toUpperCase();e=p}e("previousSibling",u,v,x,y,z)}},find:{ID:function(u,v,x){if(typeof v.getElementById!=="undefined"&&!x){var e=v.getElementById(u[1]);return e?[e]:[]}},NAME:function(v,z,A){if(typeof z.getElementsByName!=="undefined"){var u=[],y=z.getElementsByName(v[1]);for(var x=0,e=y.length;x<e;x++){if(y[x].getAttribute("name")===v[1]){u.push(y[x])}}return u.length===0?null:u}},TAG:function(e,u){return u.getElementsByTagName(e[1])}},preFilter:{CLASS:function(x,u,v,e,A,B){x=" "+x[1].replace(/\\/g,"")+" ";if(B){return x}for(var y=0,z;(z=u[y])!=null;y++){if(z){if(A^(z.className&&(" "+z.className+" ").indexOf(x)>=0)){if(!v){e.push(z)}}else{if(v){u[y]=false}}}}return false},ID:function(e){return e[1].replace(/\\/g,"")},TAG:function(u,e){for(var v=0;e[v]===false;v++){}return e[v]&&r(e[v])?u[1]:u[1].toUpperCase()},CHILD:function(e){if(e[1]=="nth"){var u=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(e[2]=="even"&&"2n"||e[2]=="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(u[1]+(u[2]||1))-0;e[3]=u[3]-0}e[0]=l++;return e},ATTR:function(y,u,v,e,z,A){var x=y[1].replace(/\\/g,"");if(!A&&g.attrMap[x]){y[1]=g.attrMap[x]}if(y[2]==="~="){y[4]=" "+y[4]+" "}return y},PSEUDO:function(y,u,v,e,z){if(y[1]==="not"){if((s.exec(y[3])||"").length>1||/^\w/.test(y[3])){y[3]=b(y[3],null,null,u)}else{var x=b.filter(y[3],u,v,true^z);if(!v){e.push.apply(e,x)}return false}}else{if(g.match.POS.test(y[0])||g.match.CHILD.test(y[0])){return true}}return y},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){e.parentNode.selectedIndex;return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(v,u,e){return !!b(e[3],v).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){return"text"===e.type},radio:function(e){return"radio"===e.type},checkbox:function(e){return"checkbox"===e.type},file:function(e){return"file"===e.type},password:function(e){return"password"===e.type},submit:function(e){return"submit"===e.type},image:function(e){return"image"===e.type},reset:function(e){return"reset"===e.type},button:function(e){return"button"===e.type||e.nodeName.toUpperCase()==="BUTTON"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)}},setFilters:{first:function(u,e){return e===0},last:function(v,u,e,x){return u===x.length-1},even:function(u,e){return e%2===0},odd:function(u,e){return e%2===1},lt:function(v,u,e){return u<e[3]-0},gt:function(v,u,e){return u>e[3]-0},nth:function(v,u,e){return e[3]-0==u},eq:function(v,u,e){return e[3]-0==u}},filter:{PSEUDO:function(A,v,x,B){var u=v[1],y=g.filters[u];if(y){return y(A,x,v,B)}else{if(u==="contains"){return(A.textContent||A.innerText||"").indexOf(v[3])>=0}else{if(u==="not"){var z=v[3];for(var x=0,e=z.length;x<e;x++){if(z[x]===A){return false}}return true}}}},CHILD:function(e,x){var A=x[1],u=e;switch(A){case"only":case"first":while((u=u.previousSibling)){if(u.nodeType===1){return false}}if(A=="first"){return true}u=e;case"last":while((u=u.nextSibling)){if(u.nodeType===1){return false}}return true;case"nth":var v=x[2],D=x[3];if(v==1&&D==0){return true}var z=x[0],C=e.parentNode;if(C&&(C.sizcache!==z||!e.nodeIndex)){var y=0;for(u=C.firstChild;u;u=u.nextSibling){if(u.nodeType===1){u.nodeIndex=++y}}C.sizcache=z}var B=e.nodeIndex-D;if(v==0){return B==0}else{return(B%v==0&&B/v>=0)}}},ID:function(u,e){return u.nodeType===1&&u.getAttribute("id")===e},TAG:function(u,e){return(e==="*"&&u.nodeType===1)||u.nodeName===e},CLASS:function(u,e){return(" "+(u.className||u.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(z,x){var v=x[1],e=g.attrHandle[v]?g.attrHandle[v](z):z[v]!=null?z[v]:z.getAttribute(v),A=e+"",y=x[2],u=x[4];return e==null?y==="!=":y==="="?A===u:y==="*="?A.indexOf(u)>=0:y==="~="?(" "+A+" ").indexOf(u)>=0:!u?A&&e!==false:y==="!="?A!=u:y==="^="?A.indexOf(u)===0:y==="$="?A.substr(A.length-u.length)===u:y==="|="?A===u||A.substr(0,u.length+1)===u+"-":false},POS:function(y,u,v,z){var e=u[2],x=g.setFilters[e];if(x){return x(y,v,u,z)}}}};var m=g.match.POS;for(var o in g.match){g.match[o]=new RegExp(g.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source);g.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+g.match[o].source)}var a=function(u,e){u=Array.prototype.slice.call(u,0);if(e){e.push.apply(e,u);return e}return u};try{Array.prototype.slice.call(document.documentElement.childNodes,0)}catch(n){a=function(y,x){var u=x||[];if(f.call(y)==="[object Array]"){Array.prototype.push.apply(u,y)}else{if(typeof y.length==="number"){for(var v=0,e=y.length;v<e;v++){u.push(y[v])}}else{for(var v=0;y[v];v++){u.push(y[v])}}}return u}}var c;if(document.documentElement.compareDocumentPosition){c=function(u,e){if(!u.compareDocumentPosition||!e.compareDocumentPosition){if(u==e){q=true}return 0}var v=u.compareDocumentPosition(e)&4?-1:u===e?0:1;if(v===0){q=true}return v}}else{if("sourceIndex" in document.documentElement){c=function(u,e){if(!u.sourceIndex||!e.sourceIndex){if(u==e){q=true}return 0}var v=u.sourceIndex-e.sourceIndex;if(v===0){q=true}return v}}else{if(document.createRange){c=function(x,u){if(!x.ownerDocument||!u.ownerDocument){if(x==u){q=true}return 0}var v=x.ownerDocument.createRange(),e=u.ownerDocument.createRange();v.setStart(x,0);v.setEnd(x,0);e.setStart(u,0);e.setEnd(u,0);var y=v.compareBoundaryPoints(Range.START_TO_END,e);if(y===0){q=true}return y}}}}(function(){var u=document.createElement("div"),v="script"+(new Date).getTime();u.innerHTML="<a name='"+v+"'/>";var e=document.documentElement;e.insertBefore(u,e.firstChild);if(!!document.getElementById(v)){g.find.ID=function(y,z,A){if(typeof z.getElementById!=="undefined"&&!A){var x=z.getElementById(y[1]);return x?x.id===y[1]||typeof x.getAttributeNode!=="undefined"&&x.getAttributeNode("id").nodeValue===y[1]?[x]:undefined:[]}};g.filter.ID=function(z,x){var y=typeof z.getAttributeNode!=="undefined"&&z.getAttributeNode("id");return z.nodeType===1&&y&&y.nodeValue===x}}e.removeChild(u);e=u=null})();(function(){var e=document.createElement("div");e.appendChild(document.createComment(""));if(e.getElementsByTagName("*").length>0){g.find.TAG=function(u,z){var y=z.getElementsByTagName(u[1]);if(u[1]==="*"){var x=[];for(var v=0;y[v];v++){if(y[v].nodeType===1){x.push(y[v])}}y=x}return y}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){g.attrHandle.href=function(u){return u.getAttribute("href",2)}}e=null})();if(document.querySelectorAll){(function(){var e=b,v=document.createElement("div");v.innerHTML="<p class='TEST'></p>";if(v.querySelectorAll&&v.querySelectorAll(".TEST").length===0){return}b=function(A,z,x,y){z=z||document;if(!y&&z.nodeType===9&&!r(z)){try{return a(z.querySelectorAll(A),x)}catch(B){}}return e(A,z,x,y)};for(var u in e){b[u]=e[u]}v=null})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var e=document.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}g.order.splice(1,0,"CLASS");g.find.CLASS=function(u,v,x){if(typeof v.getElementsByClassName!=="undefined"&&!x){return v.getElementsByClassName(u[1])}};e=null})()}function p(u,A,z,E,B,D){var C=u=="previousSibling"&&!D;for(var x=0,v=E.length;x<v;x++){var e=E[x];if(e){if(C&&e.nodeType===1){e.sizcache=z;e.sizset=x}e=e[u];var y=false;while(e){if(e.sizcache===z){y=E[e.sizset];break}if(e.nodeType===1&&!D){e.sizcache=z;e.sizset=x}if(e.nodeName===A){y=e;break}e=e[u]}E[x]=y}}}function t(u,A,z,E,B,D){var C=u=="previousSibling"&&!D;for(var x=0,v=E.length;x<v;x++){var e=E[x];if(e){if(C&&e.nodeType===1){e.sizcache=z;e.sizset=x}e=e[u];var y=false;while(e){if(e.sizcache===z){y=E[e.sizset];break}if(e.nodeType===1){if(!D){e.sizcache=z;e.sizset=x}if(typeof A!=="string"){if(e===A){y=true;break}}else{if(b.filter(A,[e]).length>0){y=e;break}}}e=e[u]}E[x]=y}}}var j=document.compareDocumentPosition?function(u,e){return u.compareDocumentPosition(e)&16}:function(u,e){return u!==e&&(u.contains?u.contains(e):true)};var r=function(e){return e.nodeType===9&&e.documentElement.nodeName!=="HTML"||!!e.ownerDocument&&e.ownerDocument.documentElement.nodeName!=="HTML"};var h=function(e,B){var x=[],y="",z,v=B.nodeType?[B]:B;while((z=g.match.PSEUDO.exec(e))){y+=z[0];e=e.replace(g.match.PSEUDO,"")}e=g.relative[e]?e+"*":e;for(var A=0,u=v.length;A<u;A++){b(e,v[A],x)}return b.filter(y,x)};window.Sizzle=b})();(function(c){var e=Prototype.Selector.extendElements;function a(f,g){return e(c(f,g||document))}function b(g,f){return c.matches(f,[g]).length==1}Prototype.Selector.engine=c;Prototype.Selector.select=a;Prototype.Selector.match=b})(Sizzle);window.Sizzle=Prototype._original_property;delete Prototype._original_property;var Form={reset:function(a){a=$(a);a.reset();return a},serializeElements:function(j,e){if(typeof e!="object"){e={hash:!!e}}else{if(Object.isUndefined(e.hash)){e.hash=true}}var f,h,a=false,g=e.submit,b,c;if(e.hash){c={};b=function(k,l,m){if(l in k){if(!Object.isArray(k[l])){k[l]=[k[l]]}k[l].push(m)}else{k[l]=m}return k}}else{c="";b=function(k,l,m){return k+(k?"&":"")+encodeURIComponent(l)+"="+encodeURIComponent(m)}}return j.inject(c,function(k,l){if(!l.disabled&&l.name){f=l.name;h=$(l).getValue();if(h!=null&&l.type!="file"&&(l.type!="submit"||(!a&&g!==false&&(!g||f==g)&&(a=true)))){k=b(k,f,h)}}return k})}};Form.Methods={serialize:function(b,a){return Form.serializeElements(Form.getElements(b),a)},getElements:function(f){var g=$(f).getElementsByTagName("*"),e,a=[],c=Form.Element.Serializers;for(var b=0;e=g[b];b++){a.push(e)}return a.inject([],function(h,j){if(c[j.tagName.toLowerCase()]){h.push(Element.extend(j))}return h})},getInputs:function(h,c,e){h=$(h);var a=h.getElementsByTagName("input");if(!c&&!e){return $A(a).map(Element.extend)}for(var f=0,j=[],g=a.length;f<g;f++){var b=a[f];if((c&&b.type!=c)||(e&&b.name!=e)){continue}j.push(Element.extend(b))}return j},disable:function(a){a=$(a);Form.getElements(a).invoke("disable");return a},enable:function(a){a=$(a);Form.getElements(a).invoke("enable");return a},findFirstElement:function(b){var c=$(b).getElements().findAll(function(e){return"hidden"!=e.type&&!e.disabled});var a=c.findAll(function(e){return e.hasAttribute("tabIndex")&&e.tabIndex>=0}).sortBy(function(e){return e.tabIndex}).first();return a?a:c.find(function(e){return/^(?:input|select|textarea)$/i.test(e.tagName)})},focusFirstElement:function(b){b=$(b);var a=b.findFirstElement();if(a){a.activate()}return b},request:function(b,a){b=$(b),a=Object.clone(a||{});var e=a.parameters,c=b.readAttribute("action")||"";if(c.blank()){c=window.location.href}a.parameters=b.serialize(true);if(e){if(Object.isString(e)){e=e.toQueryParams()}Object.extend(a.parameters,e)}if(b.hasAttribute("method")&&!a.method){a.method=b.method}return new Ajax.Request(c,a)}};Form.Element={focus:function(a){$(a).focus();return a},select:function(a){$(a).select();return a}};Form.Element.Methods={serialize:function(a){a=$(a);if(!a.disabled&&a.name){var b=a.getValue();if(b!=undefined){var c={};c[a.name]=b;return Object.toQueryString(c)}}return""},getValue:function(a){a=$(a);var b=a.tagName.toLowerCase();return Form.Element.Serializers[b](a)},setValue:function(a,b){a=$(a);var c=a.tagName.toLowerCase();Form.Element.Serializers[c](a,b);return a},clear:function(a){$(a).value="";return a},present:function(a){return $(a).value!=""},activate:function(a){a=$(a);try{a.focus();if(a.select&&(a.tagName.toLowerCase()!="input"||!(/^(?:button|reset|submit)$/i.test(a.type)))){a.select()}}catch(b){}return a},disable:function(a){a=$(a);a.disabled=true;return a},enable:function(a){a=$(a);a.disabled=false;return a}};var Field=Form.Element;var $F=Form.Element.Methods.getValue;Form.Element.Serializers=(function(){function b(j,k){switch(j.type.toLowerCase()){case"checkbox":case"radio":return g(j,k);default:return f(j,k)}}function g(j,k){if(Object.isUndefined(k)){return j.checked?j.value:null}else{j.checked=!!k}}function f(j,k){if(Object.isUndefined(k)){return j.value}else{j.value=k}}function a(l,o){if(Object.isUndefined(o)){return(l.type==="select-one"?c:e)(l)}var k,m,p=!Object.isArray(o);for(var j=0,n=l.length;j<n;j++){k=l.options[j];m=this.optionValue(k);if(p){if(m==o){k.selected=true;return}}else{k.selected=o.include(m)}}}function c(k){var j=k.selectedIndex;return j>=0?h(k.options[j]):null}function e(m){var j,n=m.length;if(!n){return null}for(var l=0,j=[];l<n;l++){var k=m.options[l];if(k.selected){j.push(h(k))}}return j}function h(j){return Element.hasAttribute(j,"value")?j.value:j.text}return{input:b,inputSelector:g,textarea:f,select:a,selectOne:c,selectMany:e,optionValue:h,button:f}})();Abstract.TimedObserver=Class.create(PeriodicalExecuter,{initialize:function($super,a,b,c){$super(c,b);this.element=$(a);this.lastValue=this.getValue()},execute:function(){var a=this.getValue();if(Object.isString(this.lastValue)&&Object.isString(a)?this.lastValue!=a:String(this.lastValue)!=String(a)){this.callback(this.element,a);this.lastValue=a}}});Form.Element.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.Observer=Class.create(Abstract.TimedObserver,{getValue:function(){return Form.serialize(this.element)}});Abstract.EventObserver=Class.create({initialize:function(a,b){this.element=$(a);this.callback=b;this.lastValue=this.getValue();if(this.element.tagName.toLowerCase()=="form"){this.registerFormCallbacks()}else{this.registerCallback(this.element)}},onElementEvent:function(){var a=this.getValue();if(this.lastValue!=a){this.callback(this.element,a);this.lastValue=a}},registerFormCallbacks:function(){Form.getElements(this.element).each(this.registerCallback,this)},registerCallback:function(a){if(a.type){switch(a.type.toLowerCase()){case"checkbox":case"radio":Event.observe(a,"click",this.onElementEvent.bind(this));break;default:Event.observe(a,"change",this.onElementEvent.bind(this));break}}}});Form.Element.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.Element.getValue(this.element)}});Form.EventObserver=Class.create(Abstract.EventObserver,{getValue:function(){return Form.serialize(this.element)}});(function(){var F={KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,cache:{}};var g=document.documentElement;var G="onmouseenter" in g&&"onmouseleave" in g;var a=function(H){return false};if(window.attachEvent){if(window.addEventListener){a=function(H){return !(H instanceof window.Event)}}else{a=function(H){return true}}}var t;function D(I,H){return I.which?(I.which===H+1):(I.button===H)}var q={0:1,1:4,2:2};function B(I,H){return I.button===q[H]}function E(I,H){switch(H){case 0:return I.which==1&&!I.metaKey;case 1:return I.which==2||(I.which==1&&I.metaKey);case 2:return I.which==3;default:return false}}if(window.attachEvent){if(!window.addEventListener){t=B}else{t=function(I,H){return a(I)?B(I,H):D(I,H)}}}else{if(Prototype.Browser.WebKit){t=E}else{t=D}}function y(H){return t(H,0)}function v(H){return t(H,1)}function p(H){return t(H,2)}function e(J){J=F.extend(J);var I=J.target,H=J.type,K=J.currentTarget;if(K&&K.tagName){if(H==="load"||H==="error"||(H==="click"&&K.tagName.toLowerCase()==="input"&&K.type==="radio")){I=K}}if(I.nodeType==Node.TEXT_NODE){I=I.parentNode}return Element.extend(I)}function r(I,J){var H=F.element(I);if(!J){return H}while(H){if(Object.isElement(H)&&Prototype.Selector.match(H,J)){return Element.extend(H)}H=H.parentNode}}function u(H){return{x:c(H),y:b(H)}}function c(J){var I=document.documentElement,H=document.body||{scrollLeft:0};return J.pageX||(J.clientX+(I.scrollLeft||H.scrollLeft)-(I.clientLeft||0))}function b(J){var I=document.documentElement,H=document.body||{scrollTop:0};return J.pageY||(J.clientY+(I.scrollTop||H.scrollTop)-(I.clientTop||0))}function s(H){F.extend(H);H.preventDefault();H.stopPropagation();H.stopped=true}F.Methods={isLeftClick:y,isMiddleClick:v,isRightClick:p,element:e,findElement:r,pointer:u,pointerX:c,pointerY:b,stop:s};var A=Object.keys(F.Methods).inject({},function(H,I){H[I]=F.Methods[I].methodize();return H});if(window.attachEvent){function k(I){var H;switch(I.type){case"mouseover":case"mouseenter":H=I.fromElement;break;case"mouseout":case"mouseleave":H=I.toElement;break;default:return null}return Element.extend(H)}var x={stopPropagation:function(){this.cancelBubble=true},preventDefault:function(){this.returnValue=false},inspect:function(){return"[object Event]"}};F.extend=function(I,H){if(!I){return false}if(!a(I)){return I}if(I._extendedByPrototype){return I}I._extendedByPrototype=Prototype.emptyFunction;var J=F.pointer(I);Object.extend(I,{target:I.srcElement||H,relatedTarget:k(I),pageX:J.x,pageY:J.y});Object.extend(I,A);Object.extend(I,x);return I}}else{F.extend=Prototype.K}if(window.addEventListener){F.prototype=window.Event.prototype||document.createEvent("HTMLEvents").__proto__;Object.extend(F.prototype,A)}function o(L,K,M){var J=Element.retrieve(L,"prototype_event_registry");if(Object.isUndefined(J)){f.push(L);J=Element.retrieve(L,"prototype_event_registry",$H())}var H=J.get(K);if(Object.isUndefined(H)){H=[];J.set(K,H)}if(H.pluck("handler").include(M)){return false}var I;if(K.include(":")){I=function(N){if(Object.isUndefined(N.eventName)){return false}if(N.eventName!==K){return false}F.extend(N,L);M.call(L,N)}}else{if(!G&&(K==="mouseenter"||K==="mouseleave")){if(K==="mouseenter"||K==="mouseleave"){I=function(O){F.extend(O,L);var N=O.relatedTarget;while(N&&N!==L){try{N=N.parentNode}catch(P){N=L}}if(N===L){return}M.call(L,O)}}}else{I=function(N){F.extend(N,L);M.call(L,N)}}}I.handler=M;H.push(I);return I}function j(){for(var H=0,I=f.length;H<I;H++){F.stopObserving(f[H]);f[H]=null}}var f=[];if(Prototype.Browser.IE){window.attachEvent("onunload",j)}if(Prototype.Browser.WebKit){window.addEventListener("unload",Prototype.emptyFunction,false)}var n=Prototype.K,h={mouseenter:"mouseover",mouseleave:"mouseout"};if(!G){n=function(H){return(h[H]||H)}}function z(K,J,L){K=$(K);var I=o(K,J,L);if(!I){return K}if(J.include(":")){if(K.addEventListener){K.addEventListener("dataavailable",I,false)}else{K.attachEvent("ondataavailable",I);K.attachEvent("onlosecapture",I)}}else{var H=n(J);if(K.addEventListener){K.addEventListener(H,I,false)}else{K.attachEvent("on"+H,I)}}return K}function m(N,K,O){N=$(N);var J=Element.retrieve(N,"prototype_event_registry");if(!J){return N}if(!K){J.each(function(Q){var P=Q.key;m(N,P)});return N}var L=J.get(K);if(!L){return N}if(!O){L.each(function(P){m(N,K,P.handler)});return N}var M=L.length,I;while(M--){if(L[M].handler===O){I=L[M];break}}if(!I){return N}if(K.include(":")){if(N.removeEventListener){N.removeEventListener("dataavailable",I,false)}else{N.detachEvent("ondataavailable",I);N.detachEvent("onlosecapture",I)}}else{var H=n(K);if(N.removeEventListener){N.removeEventListener(H,I,false)}else{N.detachEvent("on"+H,I)}}J.set(K,L.without(I));return N}function C(K,J,I,H){K=$(K);if(Object.isUndefined(H)){H=true}if(K==document&&document.createEvent&&!K.dispatchEvent){K=document.documentElement}var L;if(document.createEvent){L=document.createEvent("HTMLEvents");L.initEvent("dataavailable",H,true)}else{L=document.createEventObject();L.eventType=H?"ondataavailable":"onlosecapture"}L.eventName=J;L.memo=I||{};if(document.createEvent){K.dispatchEvent(L)}else{K.fireEvent(L.eventType,L)}return F.extend(L)}F.Handler=Class.create({initialize:function(J,I,H,K){this.element=$(J);this.eventName=I;this.selector=H;this.callback=K;this.handler=this.handleEvent.bind(this)},start:function(){F.observe(this.element,this.eventName,this.handler);return this},stop:function(){F.stopObserving(this.element,this.eventName,this.handler);return this},handleEvent:function(I){var H=F.findElement(I,this.selector);if(H){this.callback.call(this.element,I,H)}}});function l(J,I,H,K){J=$(J);if(Object.isFunction(H)&&Object.isUndefined(K)){K=H,H=null}return new F.Handler(J,I,H,K).start()}Object.extend(F,F.Methods);Object.extend(F,{fire:C,observe:z,stopObserving:m,on:l});Element.addMethods({fire:C,observe:z,stopObserving:m,on:l});Object.extend(document,{fire:C.methodize(),observe:z.methodize(),stopObserving:m.methodize(),on:l.methodize(),loaded:false});if(window.Event){Object.extend(window.Event,F)}else{window.Event=F}})();(function(){var e;function a(){if(document.loaded){return}if(e){window.clearTimeout(e)}document.loaded=true;document.fire("dom:loaded")}function c(){if(document.readyState==="complete"){document.stopObserving("readystatechange",c);a()}}function b(){try{document.documentElement.doScroll("left")}catch(f){e=b.defer();return}a()}if(document.addEventListener){document.addEventListener("DOMContentLoaded",a,false)}else{document.observe("readystatechange",c);if(window==top){e=b.defer()}}Event.observe(window,"load",a)})();Element.addMethods();Hash.toQueryString=Object.toQueryString;var Toggle={display:Element.toggle};Element.Methods.childOf=Element.Methods.descendantOf;var Insertion={Before:function(a,b){return Element.insert(a,{before:b})},Top:function(a,b){return Element.insert(a,{top:b})},Bottom:function(a,b){return Element.insert(a,{bottom:b})},After:function(a,b){return Element.insert(a,{after:b})}};var $continue=new Error('"throw $continue" is deprecated, use "return" instead');var Position={includeScrollOffsets:false,prepare:function(){this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},within:function(b,a,c){if(this.includeScrollOffsets){return this.withinIncludingScrolloffsets(b,a,c)}this.xcomp=a;this.ycomp=c;this.offset=Element.cumulativeOffset(b);return(c>=this.offset[1]&&c<this.offset[1]+b.offsetHeight&&a>=this.offset[0]&&a<this.offset[0]+b.offsetWidth)},withinIncludingScrolloffsets:function(b,a,e){var c=Element.cumulativeScrollOffset(b);this.xcomp=a+c[0]-this.deltaX;this.ycomp=e+c[1]-this.deltaY;this.offset=Element.cumulativeOffset(b);return(this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+b.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+b.offsetWidth)},overlap:function(b,a){if(!b){return 0}if(b=="vertical"){return((this.offset[1]+a.offsetHeight)-this.ycomp)/a.offsetHeight}if(b=="horizontal"){return((this.offset[0]+a.offsetWidth)-this.xcomp)/a.offsetWidth}},cumulativeOffset:Element.Methods.cumulativeOffset,positionedOffset:Element.Methods.positionedOffset,absolutize:function(a){Position.prepare();return Element.absolutize(a)},relativize:function(a){Position.prepare();return Element.relativize(a)},realOffset:Element.Methods.cumulativeScrollOffset,offsetParent:Element.Methods.getOffsetParent,page:Element.Methods.viewportOffset,clone:function(b,c,a){a=a||{};return Element.clonePosition(c,b,a)}};if(!document.getElementsByClassName){document.getElementsByClassName=function(b){function a(c){return c.blank()?null:"[contains(concat(' ', @class, ' '), ' "+c+" ')]"}b.getElementsByClassName=Prototype.BrowserFeatures.XPath?function(c,f){f=f.toString().strip();var e=/\s/.test(f)?$w(f).map(a).join(""):a(f);return e?document._getElementsByXPath(".//*"+e,c):[]}:function(f,g){g=g.toString().strip();var h=[],j=(/\s/.test(g)?$w(g):null);if(!j&&!g){return h}var c=$(f).getElementsByTagName("*");g=" "+g+" ";for(var e=0,l,k;l=c[e];e++){if(l.className&&(k=" "+l.className+" ")&&(k.include(g)||(j&&j.all(function(m){return !m.toString().blank()&&k.include(" "+m+" ")})))){h.push(Element.extend(l))}}return h};return function(e,c){return $(c||document.body).getElementsByClassName(e)}}(Element.Methods)}Element.ClassNames=Class.create();Element.ClassNames.prototype={initialize:function(a){this.element=$(a)},_each:function(a){this.element.className.split(/\s+/).select(function(b){return b.length>0})._each(a)},set:function(a){this.element.className=a},add:function(a){if(this.include(a)){return}this.set($A(this).concat(a).join(" "))},remove:function(a){if(!this.include(a)){return}this.set($A(this).without(a).join(" "))},toString:function(){return $A(this).join(" ")}};Object.extend(Element.ClassNames.prototype,Enumerable);(function(){window.Selector=Class.create({initialize:function(a){this.expression=a.strip()},findElements:function(a){return Prototype.Selector.select(this.expression,a)},match:function(a){return Prototype.Selector.match(a,this.expression)},toString:function(){return this.expression},inspect:function(){return"#<Selector: "+this.expression+">"}});Object.extend(Selector,{matchElements:function(g,h){var a=Prototype.Selector.match,e=[];for(var c=0,f=g.length;c<f;c++){var b=g[c];if(a(b,h)){e.push(Element.extend(b))}}return e},findElement:function(g,h,b){b=b||0;var a=0,e;for(var c=0,f=g.length;c<f;c++){e=g[c];if(Prototype.Selector.match(e,h)&&b===a++){return Element.extend(e)}}},findChildElements:function(b,c){var a=c.toArray().join(", ");return Prototype.Selector.select(a,b||document)}})})();
/*!
 * jQuery JavaScript Library v1.6.4
 * http://jquery.com/
 *
 * Copyright 2011, John Resig
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Includes Sizzle.js
 * http://sizzlejs.com/
 * Copyright 2011, The Dojo Foundation
 * Released under the MIT, BSD, and GPL Licenses.
 *
 * Date: Mon Sep 12 18:54:48 2011 -0400
 */
(function(ba,N){var at=ba.document,bt=ba.navigator,bk=ba.location;var b=(function(){var bE=function(b0,b1){return new bE.fn.init(b0,b1,bC)},bU=ba.jQuery,bG=ba.$,bC,bY=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,bM=/\S/,bI=/^\s+/,bD=/\s+$/,bH=/\d/,bz=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,bN=/^[\],:{}\s]*$/,bW=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,bP=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,bJ=/(?:^|:|,)(?:\s*\[)+/g,bx=/(webkit)[ \/]([\w.]+)/,bR=/(opera)(?:.*version)?[ \/]([\w.]+)/,bQ=/(msie) ([\w.]+)/,bS=/(mozilla)(?:.*? rv:([\w.]+))?/,bA=/-([a-z]|[0-9])/ig,bZ=/^-ms-/,bT=function(b0,b1){return(b1+"").toUpperCase()},bX=bt.userAgent,bV,bB,e,bL=Object.prototype.toString,bF=Object.prototype.hasOwnProperty,by=Array.prototype.push,bK=Array.prototype.slice,bO=String.prototype.trim,bu=Array.prototype.indexOf,bw={};bE.fn=bE.prototype={constructor:bE,init:function(b0,b4,b3){var b2,b5,b1,b6;if(!b0){return this}if(b0.nodeType){this.context=this[0]=b0;this.length=1;return this}if(b0==="body"&&!b4&&at.body){this.context=at;this[0]=at.body;this.selector=b0;this.length=1;return this}if(typeof b0==="string"){if(b0.charAt(0)==="<"&&b0.charAt(b0.length-1)===">"&&b0.length>=3){b2=[null,b0,null]}else{b2=bY.exec(b0)}if(b2&&(b2[1]||!b4)){if(b2[1]){b4=b4 instanceof bE?b4[0]:b4;b6=(b4?b4.ownerDocument||b4:at);b1=bz.exec(b0);if(b1){if(bE.isPlainObject(b4)){b0=[at.createElement(b1[1])];bE.fn.attr.call(b0,b4,true)}else{b0=[b6.createElement(b1[1])]}}else{b1=bE.buildFragment([b2[1]],[b6]);b0=(b1.cacheable?bE.clone(b1.fragment):b1.fragment).childNodes}return bE.merge(this,b0)}else{b5=at.getElementById(b2[2]);if(b5&&b5.parentNode){if(b5.id!==b2[2]){return b3.find(b0)}this.length=1;this[0]=b5}this.context=at;this.selector=b0;return this}}else{if(!b4||b4.jquery){return(b4||b3).find(b0)}else{return this.constructor(b4).find(b0)}}}else{if(bE.isFunction(b0)){return b3.ready(b0)}}if(b0.selector!==N){this.selector=b0.selector;this.context=b0.context}return bE.makeArray(b0,this)},selector:"",jquery:"1.6.4",length:0,size:function(){return this.length},toArray:function(){return bK.call(this,0)},get:function(b0){return b0==null?this.toArray():(b0<0?this[this.length+b0]:this[b0])},pushStack:function(b1,b3,b0){var b2=this.constructor();if(bE.isArray(b1)){by.apply(b2,b1)}else{bE.merge(b2,b1)}b2.prevObject=this;b2.context=this.context;if(b3==="find"){b2.selector=this.selector+(this.selector?" ":"")+b0}else{if(b3){b2.selector=this.selector+"."+b3+"("+b0+")"}}return b2},each:function(b1,b0){return bE.each(this,b1,b0)},ready:function(b0){bE.bindReady();bB.done(b0);return this},eq:function(b0){return b0===-1?this.slice(b0):this.slice(b0,+b0+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(bK.apply(this,arguments),"slice",bK.call(arguments).join(","))},map:function(b0){return this.pushStack(bE.map(this,function(b2,b1){return b0.call(b2,b1,b2)}))},end:function(){return this.prevObject||this.constructor(null)},push:by,sort:[].sort,splice:[].splice};bE.fn.init.prototype=bE.fn;bE.extend=bE.fn.extend=function(){var b9,b2,b0,b1,b6,b7,b5=arguments[0]||{},b4=1,b3=arguments.length,b8=false;if(typeof b5==="boolean"){b8=b5;b5=arguments[1]||{};b4=2}if(typeof b5!=="object"&&!bE.isFunction(b5)){b5={}}if(b3===b4){b5=this;--b4}for(;b4<b3;b4++){if((b9=arguments[b4])!=null){for(b2 in b9){b0=b5[b2];b1=b9[b2];if(b5===b1){continue}if(b8&&b1&&(bE.isPlainObject(b1)||(b6=bE.isArray(b1)))){if(b6){b6=false;b7=b0&&bE.isArray(b0)?b0:[]}else{b7=b0&&bE.isPlainObject(b0)?b0:{}}b5[b2]=bE.extend(b8,b7,b1)}else{if(b1!==N){b5[b2]=b1}}}}}return b5};bE.extend({noConflict:function(b0){if(ba.$===bE){ba.$=bG}if(b0&&ba.jQuery===bE){ba.jQuery=bU}return bE},isReady:false,readyWait:1,holdReady:function(b0){if(b0){bE.readyWait++}else{bE.ready(true)}},ready:function(b0){if((b0===true&&!--bE.readyWait)||(b0!==true&&!bE.isReady)){if(!at.body){return setTimeout(bE.ready,1)}bE.isReady=true;if(b0!==true&&--bE.readyWait>0){return}bB.resolveWith(at,[bE]);if(bE.fn.trigger){bE(at).trigger("ready").unbind("ready")}}},bindReady:function(){if(bB){return}bB=bE._Deferred();if(at.readyState==="complete"){return setTimeout(bE.ready,1)}if(at.addEventListener){at.addEventListener("DOMContentLoaded",e,false);ba.addEventListener("load",bE.ready,false)}else{if(at.attachEvent){at.attachEvent("onreadystatechange",e);ba.attachEvent("onload",bE.ready);var b0=false;try{b0=ba.frameElement==null}catch(b1){}if(at.documentElement.doScroll&&b0){bv()}}}},isFunction:function(b0){return bE.type(b0)==="function"},isArray:Array.isArray||function(b0){return bE.type(b0)==="array"},isWindow:function(b0){return b0&&typeof b0==="object"&&"setInterval" in b0},isNaN:function(b0){return b0==null||!bH.test(b0)||isNaN(b0)},type:function(b0){return b0==null?String(b0):bw[bL.call(b0)]||"object"},isPlainObject:function(b2){if(!b2||bE.type(b2)!=="object"||b2.nodeType||bE.isWindow(b2)){return false}try{if(b2.constructor&&!bF.call(b2,"constructor")&&!bF.call(b2.constructor.prototype,"isPrototypeOf")){return false}}catch(b1){return false}var b0;for(b0 in b2){}return b0===N||bF.call(b2,b0)},isEmptyObject:function(b1){for(var b0 in b1){return false}return true},error:function(b0){throw b0},parseJSON:function(b0){if(typeof b0!=="string"||!b0){return null}b0=bE.trim(b0);if(ba.JSON&&ba.JSON.parse){return ba.JSON.parse(b0)}if(bN.test(b0.replace(bW,"@").replace(bP,"]").replace(bJ,""))){return(new Function("return "+b0))()}bE.error("Invalid JSON: "+b0)},parseXML:function(b2){var b0,b1;try{if(ba.DOMParser){b1=new DOMParser();b0=b1.parseFromString(b2,"text/xml")}else{b0=new ActiveXObject("Microsoft.XMLDOM");b0.async="false";b0.loadXML(b2)}}catch(b3){b0=N}if(!b0||!b0.documentElement||b0.getElementsByTagName("parsererror").length){bE.error("Invalid XML: "+b2)}return b0},noop:function(){},globalEval:function(b0){if(b0&&bM.test(b0)){(ba.execScript||function(b1){ba["eval"].call(ba,b1)})(b0)}},camelCase:function(b0){return b0.replace(bZ,"ms-").replace(bA,bT)},nodeName:function(b1,b0){return b1.nodeName&&b1.nodeName.toUpperCase()===b0.toUpperCase()},each:function(b3,b6,b2){var b1,b4=0,b5=b3.length,b0=b5===N||bE.isFunction(b3);if(b2){if(b0){for(b1 in b3){if(b6.apply(b3[b1],b2)===false){break}}}else{for(;b4<b5;){if(b6.apply(b3[b4++],b2)===false){break}}}}else{if(b0){for(b1 in b3){if(b6.call(b3[b1],b1,b3[b1])===false){break}}}else{for(;b4<b5;){if(b6.call(b3[b4],b4,b3[b4++])===false){break}}}}return b3},trim:bO?function(b0){return b0==null?"":bO.call(b0)}:function(b0){return b0==null?"":b0.toString().replace(bI,"").replace(bD,"")},makeArray:function(b3,b1){var b0=b1||[];if(b3!=null){var b2=bE.type(b3);if(b3.length==null||b2==="string"||b2==="function"||b2==="regexp"||bE.isWindow(b3)){by.call(b0,b3)}else{bE.merge(b0,b3)}}return b0},inArray:function(b2,b3){if(!b3){return -1}if(bu){return bu.call(b3,b2)}for(var b0=0,b1=b3.length;b0<b1;b0++){if(b3[b0]===b2){return b0}}return -1},merge:function(b4,b2){var b3=b4.length,b1=0;if(typeof b2.length==="number"){for(var b0=b2.length;b1<b0;b1++){b4[b3++]=b2[b1]}}else{while(b2[b1]!==N){b4[b3++]=b2[b1++]}}b4.length=b3;return b4},grep:function(b1,b6,b0){var b2=[],b5;b0=!!b0;for(var b3=0,b4=b1.length;b3<b4;b3++){b5=!!b6(b1[b3],b3);if(b0!==b5){b2.push(b1[b3])}}return b2},map:function(b0,b7,b8){var b5,b6,b4=[],b2=0,b1=b0.length,b3=b0 instanceof bE||b1!==N&&typeof b1==="number"&&((b1>0&&b0[0]&&b0[b1-1])||b1===0||bE.isArray(b0));if(b3){for(;b2<b1;b2++){b5=b7(b0[b2],b2,b8);if(b5!=null){b4[b4.length]=b5}}}else{for(b6 in b0){b5=b7(b0[b6],b6,b8);if(b5!=null){b4[b4.length]=b5}}}return b4.concat.apply([],b4)},guid:1,proxy:function(b4,b3){if(typeof b3==="string"){var b2=b4[b3];b3=b4;b4=b2}if(!bE.isFunction(b4)){return N}var b0=bK.call(arguments,2),b1=function(){return b4.apply(b3,b0.concat(bK.call(arguments)))};b1.guid=b4.guid=b4.guid||b1.guid||bE.guid++;return b1},access:function(b0,b8,b6,b2,b5,b7){var b1=b0.length;if(typeof b8==="object"){for(var b3 in b8){bE.access(b0,b3,b8[b3],b2,b5,b6)}return b0}if(b6!==N){b2=!b7&&b2&&bE.isFunction(b6);for(var b4=0;b4<b1;b4++){b5(b0[b4],b8,b2?b6.call(b0[b4],b4,b5(b0[b4],b8)):b6,b7)}return b0}return b1?b5(b0[0],b8):N},now:function(){return(new Date()).getTime()},uaMatch:function(b1){b1=b1.toLowerCase();var b0=bx.exec(b1)||bR.exec(b1)||bQ.exec(b1)||b1.indexOf("compatible")<0&&bS.exec(b1)||[];return{browser:b0[1]||"",version:b0[2]||"0"}},sub:function(){function b0(b3,b4){return new b0.fn.init(b3,b4)}bE.extend(true,b0,this);b0.superclass=this;b0.fn=b0.prototype=this();b0.fn.constructor=b0;b0.sub=this.sub;b0.fn.init=function b2(b3,b4){if(b4&&b4 instanceof bE&&!(b4 instanceof b0)){b4=b0(b4)}return bE.fn.init.call(this,b3,b4,b1)};b0.fn.init.prototype=b0.fn;var b1=b0(at);return b0},browser:{}});bE.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(b1,b0){bw["[object "+b0+"]"]=b0.toLowerCase()});bV=bE.uaMatch(bX);if(bV.browser){bE.browser[bV.browser]=true;bE.browser.version=bV.version}if(bE.browser.webkit){bE.browser.safari=true}if(bM.test("\xA0")){bI=/^[\s\xA0]+/;bD=/[\s\xA0]+$/}bC=bE(at);if(at.addEventListener){e=function(){at.removeEventListener("DOMContentLoaded",e,false);bE.ready()}}else{if(at.attachEvent){e=function(){if(at.readyState==="complete"){at.detachEvent("onreadystatechange",e);bE.ready()}}}}function bv(){if(bE.isReady){return}try{at.documentElement.doScroll("left")}catch(b0){setTimeout(bv,1);return}bE.ready()}return bE})();var a="done fail isResolved isRejected promise then always pipe".split(" "),aH=[].slice;b.extend({_Deferred:function(){var bw=[],bx,bu,bv,e={done:function(){if(!bv){var bz=arguments,bA,bD,bC,bB,by;if(bx){by=bx;bx=0}for(bA=0,bD=bz.length;bA<bD;bA++){bC=bz[bA];bB=b.type(bC);if(bB==="array"){e.done.apply(e,bC)}else{if(bB==="function"){bw.push(bC)}}}if(by){e.resolveWith(by[0],by[1])}}return this},resolveWith:function(bz,by){if(!bv&&!bx&&!bu){by=by||[];bu=1;try{while(bw[0]){bw.shift().apply(bz,by)}}finally{bx=[bz,by];bu=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return !!(bu||bx)},cancel:function(){bv=1;bw=[];return this}};return e},Deferred:function(bu){var e=b._Deferred(),bw=b._Deferred(),bv;b.extend(e,{then:function(by,bx){e.done(by).fail(bx);return this},always:function(){return e.done.apply(e,arguments).fail.apply(this,arguments)},fail:bw.done,rejectWith:bw.resolveWith,reject:bw.resolve,isRejected:bw.isResolved,pipe:function(by,bx){return b.Deferred(function(bz){b.each({done:[by,"resolve"],fail:[bx,"reject"]},function(bB,bE){var bA=bE[0],bD=bE[1],bC;if(b.isFunction(bA)){e[bB](function(){bC=bA.apply(this,arguments);if(bC&&b.isFunction(bC.promise)){bC.promise().then(bz.resolve,bz.reject)}else{bz[bD+"With"](this===e?bz:this,[bC])}})}else{e[bB](bz[bD])}})}).promise()},promise:function(by){if(by==null){if(bv){return bv}bv=by={}}var bx=a.length;while(bx--){by[a[bx]]=e[a[bx]]}return by}});e.done(bw.cancel).fail(e.cancel);delete e.cancel;if(bu){bu.call(e,e)}return e},when:function(bz){var bu=arguments,bv=0,by=bu.length,bx=by,e=by<=1&&bz&&b.isFunction(bz.promise)?bz:b.Deferred();function bw(bA){return function(bB){bu[bA]=arguments.length>1?aH.call(arguments,0):bB;if(!(--bx)){e.resolveWith(e,aH.call(bu,0))}}}if(by>1){for(;bv<by;bv++){if(bu[bv]&&b.isFunction(bu[bv].promise)){bu[bv].promise().then(bw(bv),e.reject)}else{--bx}}if(!bx){e.resolveWith(e,bu)}}else{if(e!==bz){e.resolveWith(e,by?[bz]:[])}}return e.promise()}});b.support=(function(){var bE=at.createElement("div"),bL=at.documentElement,bx,bM,bF,bv,bD,by,bB,bu,bC,bG,bA,bK,bI,bw,bz,bH,bN;bE.setAttribute("className","t");bE.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";bx=bE.getElementsByTagName("*");bM=bE.getElementsByTagName("a")[0];if(!bx||!bx.length||!bM){return{}}bF=at.createElement("select");bv=bF.appendChild(at.createElement("option"));bD=bE.getElementsByTagName("input")[0];bB={leadingWhitespace:(bE.firstChild.nodeType===3),tbody:!bE.getElementsByTagName("tbody").length,htmlSerialize:!!bE.getElementsByTagName("link").length,style:/top/.test(bM.getAttribute("style")),hrefNormalized:(bM.getAttribute("href")==="/a"),opacity:/^0.55$/.test(bM.style.opacity),cssFloat:!!bM.style.cssFloat,checkOn:(bD.value==="on"),optSelected:bv.selected,getSetAttribute:bE.className!=="t",submitBubbles:true,changeBubbles:true,focusinBubbles:false,deleteExpando:true,noCloneEvent:true,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableMarginRight:true};bD.checked=true;bB.noCloneChecked=bD.cloneNode(true).checked;bF.disabled=true;bB.optDisabled=!bv.disabled;try{delete bE.test}catch(bJ){bB.deleteExpando=false}if(!bE.addEventListener&&bE.attachEvent&&bE.fireEvent){bE.attachEvent("onclick",function(){bB.noCloneEvent=false});bE.cloneNode(true).fireEvent("onclick")}bD=at.createElement("input");bD.value="t";bD.setAttribute("type","radio");bB.radioValue=bD.value==="t";bD.setAttribute("checked","checked");bE.appendChild(bD);bu=at.createDocumentFragment();bu.appendChild(bE.firstChild);bB.checkClone=bu.cloneNode(true).cloneNode(true).lastChild.checked;bE.innerHTML="";bE.style.width=bE.style.paddingLeft="1px";bC=at.getElementsByTagName("body")[0];bA=at.createElement(bC?"div":"body");bK={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};if(bC){b.extend(bK,{position:"absolute",left:"-1000px",top:"-1000px"})}for(bH in bK){bA.style[bH]=bK[bH]}bA.appendChild(bE);bG=bC||bL;bG.insertBefore(bA,bG.firstChild);bB.appendChecked=bD.checked;bB.boxModel=bE.offsetWidth===2;if("zoom" in bE.style){bE.style.display="inline";bE.style.zoom=1;bB.inlineBlockNeedsLayout=(bE.offsetWidth===2);bE.style.display="";bE.innerHTML="<div style='width:4px;'></div>";bB.shrinkWrapBlocks=(bE.offsetWidth!==2)}bE.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";bI=bE.getElementsByTagName("td");bN=(bI[0].offsetHeight===0);bI[0].style.display="";bI[1].style.display="none";bB.reliableHiddenOffsets=bN&&(bI[0].offsetHeight===0);bE.innerHTML="";if(at.defaultView&&at.defaultView.getComputedStyle){by=at.createElement("div");by.style.width="0";by.style.marginRight="0";bE.appendChild(by);bB.reliableMarginRight=(parseInt((at.defaultView.getComputedStyle(by,null)||{marginRight:0}).marginRight,10)||0)===0}bA.innerHTML="";bG.removeChild(bA);if(bE.attachEvent){for(bH in {submit:1,change:1,focusin:1}){bz="on"+bH;bN=(bz in bE);if(!bN){bE.setAttribute(bz,"return;");bN=(typeof bE[bz]==="function")}bB[bH+"Bubbles"]=bN}}bA=bu=bF=bv=bC=by=bE=bD=null;return bB})();b.boxModel=b.support.boxModel;var aO=/^(?:\{.*\}|\[.*\])$/,ay=/([A-Z])/g;b.extend({cache:{},uuid:0,expando:"jQuery"+(b.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},hasData:function(e){e=e.nodeType?b.cache[e[b.expando]]:e[b.expando];return !!e&&!V(e)},data:function(bw,bu,by,bx){if(!b.acceptData(bw)){return}var bz,bB,bC=b.expando,bA=typeof bu==="string",bD=bw.nodeType,e=bD?b.cache:bw,bv=bD?bw[b.expando]:bw[b.expando]&&b.expando;if((!bv||(bx&&bv&&(e[bv]&&!e[bv][bC])))&&bA&&by===N){return}if(!bv){if(bD){bw[b.expando]=bv=++b.uuid}else{bv=b.expando}}if(!e[bv]){e[bv]={};if(!bD){e[bv].toJSON=b.noop}}if(typeof bu==="object"||typeof bu==="function"){if(bx){e[bv][bC]=b.extend(e[bv][bC],bu)}else{e[bv]=b.extend(e[bv],bu)}}bz=e[bv];if(bx){if(!bz[bC]){bz[bC]={}}bz=bz[bC]}if(by!==N){bz[b.camelCase(bu)]=by}if(bu==="events"&&!bz[bu]){return bz[bC]&&bz[bC].events}if(bA){bB=bz[bu];if(bB==null){bB=bz[b.camelCase(bu)]}}else{bB=bz}return bB},removeData:function(bx,bv,by){if(!b.acceptData(bx)){return}var bz,bA=b.expando,bB=bx.nodeType,bu=bB?b.cache:bx,bw=bB?bx[b.expando]:b.expando;if(!bu[bw]){return}if(bv){bz=by?bu[bw][bA]:bu[bw];if(bz){if(!bz[bv]){bv=b.camelCase(bv)}delete bz[bv];if(!V(bz)){return}}}if(by){delete bu[bw][bA];if(!V(bu[bw])){return}}var e=bu[bw][bA];if(b.support.deleteExpando||!bu.setInterval){delete bu[bw]}else{bu[bw]=null}if(e){bu[bw]={};if(!bB){bu[bw].toJSON=b.noop}bu[bw][bA]=e}else{if(bB){if(b.support.deleteExpando){delete bx[b.expando]}else{if(bx.removeAttribute){bx.removeAttribute(b.expando)}else{bx[b.expando]=null}}}}},_data:function(bu,e,bv){return b.data(bu,e,bv,true)},acceptData:function(bu){if(bu.nodeName){var e=b.noData[bu.nodeName.toLowerCase()];if(e){return !(e===true||bu.getAttribute("classid")!==e)}}return true}});b.fn.extend({data:function(bx,bz){var by=null;if(typeof bx==="undefined"){if(this.length){by=b.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,bv;for(var bw=0,bu=e.length;bw<bu;bw++){bv=e[bw].name;if(bv.indexOf("data-")===0){bv=b.camelCase(bv.substring(5));a4(this[0],bv,by[bv])}}}}return by}else{if(typeof bx==="object"){return this.each(function(){b.data(this,bx)})}}var bA=bx.split(".");bA[1]=bA[1]?"."+bA[1]:"";if(bz===N){by=this.triggerHandler("getData"+bA[1]+"!",[bA[0]]);if(by===N&&this.length){by=b.data(this[0],bx);by=a4(this[0],bx,by)}return by===N&&bA[1]?this.data(bA[0]):by}else{return this.each(function(){var bC=b(this),bB=[bA[0],bz];bC.triggerHandler("setData"+bA[1]+"!",bB);b.data(this,bx,bz);bC.triggerHandler("changeData"+bA[1]+"!",bB)})}},removeData:function(e){return this.each(function(){b.removeData(this,e)})}});function a4(bw,bv,bx){if(bx===N&&bw.nodeType===1){var bu="data-"+bv.replace(ay,"-$1").toLowerCase();bx=bw.getAttribute(bu);if(typeof bx==="string"){try{bx=bx==="true"?true:bx==="false"?false:bx==="null"?null:!b.isNaN(bx)?parseFloat(bx):aO.test(bx)?b.parseJSON(bx):bx}catch(by){}b.data(bw,bv,bx)}else{bx=N}}return bx}function V(bu){for(var e in bu){if(e!=="toJSON"){return false}}return true}function bg(bx,bw,bz){var bv=bw+"defer",bu=bw+"queue",e=bw+"mark",by=b.data(bx,bv,N,true);if(by&&(bz==="queue"||!b.data(bx,bu,N,true))&&(bz==="mark"||!b.data(bx,e,N,true))){setTimeout(function(){if(!b.data(bx,bu,N,true)&&!b.data(bx,e,N,true)){b.removeData(bx,bv,true);by.resolve()}},0)}}b.extend({_mark:function(bu,e){if(bu){e=(e||"fx")+"mark";b.data(bu,e,(b.data(bu,e,N,true)||0)+1,true)}},_unmark:function(bx,bw,bu){if(bx!==true){bu=bw;bw=bx;bx=false}if(bw){bu=bu||"fx";var e=bu+"mark",bv=bx?0:((b.data(bw,e,N,true)||1)-1);if(bv){b.data(bw,e,bv,true)}else{b.removeData(bw,e,true);bg(bw,bu,"mark")}}},queue:function(bu,e,bw){if(bu){e=(e||"fx")+"queue";var bv=b.data(bu,e,N,true);if(bw){if(!bv||b.isArray(bw)){bv=b.data(bu,e,b.makeArray(bw),true)}else{bv.push(bw)}}return bv||[]}},dequeue:function(bw,bv){bv=bv||"fx";var e=b.queue(bw,bv),bu=e.shift(),bx;if(bu==="inprogress"){bu=e.shift()}if(bu){if(bv==="fx"){e.unshift("inprogress")}bu.call(bw,function(){b.dequeue(bw,bv)})}if(!e.length){b.removeData(bw,bv+"queue",true);bg(bw,bv,"queue")}}});b.fn.extend({queue:function(e,bu){if(typeof e!=="string"){bu=e;e="fx"}if(bu===N){return b.queue(this[0],e)}return this.each(function(){var bv=b.queue(this,e,bu);if(e==="fx"&&bv[0]!=="inprogress"){b.dequeue(this,e)}})},dequeue:function(e){return this.each(function(){b.dequeue(this,e)})},delay:function(bu,e){bu=b.fx?b.fx.speeds[bu]||bu:bu;e=e||"fx";return this.queue(e,function(){var bv=this;setTimeout(function(){b.dequeue(bv,e)},bu)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(bC,bv){if(typeof bC!=="string"){bv=bC;bC=N}bC=bC||"fx";var e=b.Deferred(),bu=this,bx=bu.length,bA=1,by=bC+"defer",bz=bC+"queue",bB=bC+"mark",bw;function bD(){if(!(--bA)){e.resolveWith(bu,[bu])}}while(bx--){if((bw=b.data(bu[bx],by,N,true)||(b.data(bu[bx],bz,N,true)||b.data(bu[bx],bB,N,true))&&b.data(bu[bx],by,b._Deferred(),true))){bA++;bw.done(bD)}}bD();return e.promise()}});var aM=/[\n\t\r]/g,ae=/\s+/,aQ=/\r/g,h=/^(?:button|input)$/i,G=/^(?:button|input|object|select|textarea)$/i,n=/^a(?:rea)?$/i,am=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,bd,aX;b.fn.extend({attr:function(e,bu){return b.access(this,e,bu,true,b.attr)},removeAttr:function(e){return this.each(function(){b.removeAttr(this,e)})},prop:function(e,bu){return b.access(this,e,bu,true,b.prop)},removeProp:function(e){e=b.propFix[e]||e;return this.each(function(){try{this[e]=N;delete this[e]}catch(bu){}})},addClass:function(bx){var bz,bv,bu,bw,by,bA,e;if(b.isFunction(bx)){return this.each(function(bB){b(this).addClass(bx.call(this,bB,this.className))})}if(bx&&typeof bx==="string"){bz=bx.split(ae);for(bv=0,bu=this.length;bv<bu;bv++){bw=this[bv];if(bw.nodeType===1){if(!bw.className&&bz.length===1){bw.className=bx}else{by=" "+bw.className+" ";for(bA=0,e=bz.length;bA<e;bA++){if(!~by.indexOf(" "+bz[bA]+" ")){by+=bz[bA]+" "}}bw.className=b.trim(by)}}}}return this},removeClass:function(by){var bz,bv,bu,bx,bw,bA,e;if(b.isFunction(by)){return this.each(function(bB){b(this).removeClass(by.call(this,bB,this.className))})}if((by&&typeof by==="string")||by===N){bz=(by||"").split(ae);for(bv=0,bu=this.length;bv<bu;bv++){bx=this[bv];if(bx.nodeType===1&&bx.className){if(by){bw=(" "+bx.className+" ").replace(aM," ");for(bA=0,e=bz.length;bA<e;bA++){bw=bw.replace(" "+bz[bA]+" "," ")}bx.className=b.trim(bw)}else{bx.className=""}}}}return this},toggleClass:function(bw,bu){var bv=typeof bw,e=typeof bu==="boolean";if(b.isFunction(bw)){return this.each(function(bx){b(this).toggleClass(bw.call(this,bx,this.className,bu),bu)})}return this.each(function(){if(bv==="string"){var bz,by=0,bx=b(this),bA=bu,bB=bw.split(ae);while((bz=bB[by++])){bA=e?bA:!bx.hasClass(bz);bx[bA?"addClass":"removeClass"](bz)}}else{if(bv==="undefined"||bv==="boolean"){if(this.className){b._data(this,"__className__",this.className)}this.className=this.className||bw===false?"":b._data(this,"__className__")||""}}})},hasClass:function(e){var bw=" "+e+" ";for(var bv=0,bu=this.length;bv<bu;bv++){if(this[bv].nodeType===1&&(" "+this[bv].className+" ").replace(aM," ").indexOf(bw)>-1){return true}}return false},val:function(bw){var e,bu,bv=this[0];if(!arguments.length){if(bv){e=b.valHooks[bv.nodeName.toLowerCase()]||b.valHooks[bv.type];if(e&&"get" in e&&(bu=e.get(bv,"value"))!==N){return bu}bu=bv.value;return typeof bu==="string"?bu.replace(aQ,""):bu==null?"":bu}return N}var bx=b.isFunction(bw);return this.each(function(bz){var by=b(this),bA;if(this.nodeType!==1){return}if(bx){bA=bw.call(this,bz,by.val())}else{bA=bw}if(bA==null){bA=""}else{if(typeof bA==="number"){bA+=""}else{if(b.isArray(bA)){bA=b.map(bA,function(bB){return bB==null?"":bB+""})}}}e=b.valHooks[this.nodeName.toLowerCase()]||b.valHooks[this.type];if(!e||!("set" in e)||e.set(this,bA,"value")===N){this.value=bA}})}});b.extend({valHooks:{option:{get:function(e){var bu=e.attributes.value;return !bu||bu.specified?e.value:e.text}},select:{get:function(e){var bz,bx=e.selectedIndex,bA=[],bB=e.options,bw=e.type==="select-one";if(bx<0){return null}for(var bu=bw?bx:0,by=bw?bx+1:bB.length;bu<by;bu++){var bv=bB[bu];if(bv.selected&&(b.support.optDisabled?!bv.disabled:bv.getAttribute("disabled")===null)&&(!bv.parentNode.disabled||!b.nodeName(bv.parentNode,"optgroup"))){bz=b(bv).val();if(bw){return bz}bA.push(bz)}}if(bw&&!bA.length&&bB.length){return b(bB[bx]).val()}return bA},set:function(bu,bv){var e=b.makeArray(bv);b(bu).find("option").each(function(){this.selected=b.inArray(b(this).val(),e)>=0});if(!e.length){bu.selectedIndex=-1}return e}}},attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attrFix:{tabindex:"tabIndex"},attr:function(bz,bw,bA,by){var bu=bz.nodeType;if(!bz||bu===3||bu===8||bu===2){return N}if(by&&bw in b.attrFn){return b(bz)[bw](bA)}if(!("getAttribute" in bz)){return b.prop(bz,bw,bA)}var bv,e,bx=bu!==1||!b.isXMLDoc(bz);if(bx){bw=b.attrFix[bw]||bw;e=b.attrHooks[bw];if(!e){if(am.test(bw)){e=aX}else{if(bd){e=bd}}}}if(bA!==N){if(bA===null){b.removeAttr(bz,bw);return N}else{if(e&&"set" in e&&bx&&(bv=e.set(bz,bA,bw))!==N){return bv}else{bz.setAttribute(bw,""+bA);return bA}}}else{if(e&&"get" in e&&bx&&(bv=e.get(bz,bw))!==null){return bv}else{bv=bz.getAttribute(bw);return bv===null?N:bv}}},removeAttr:function(bu,e){var bv;if(bu.nodeType===1){e=b.attrFix[e]||e;b.attr(bu,e,"");bu.removeAttribute(e);if(am.test(e)&&(bv=b.propFix[e]||e) in bu){bu[bv]=false}}},attrHooks:{type:{set:function(e,bu){if(h.test(e.nodeName)&&e.parentNode){b.error("type property can't be changed")}else{if(!b.support.radioValue&&bu==="radio"&&b.nodeName(e,"input")){var bv=e.value;e.setAttribute("type",bu);if(bv){e.value=bv}return bu}}}},value:{get:function(bu,e){if(bd&&b.nodeName(bu,"button")){return bd.get(bu,e)}return e in bu?bu.value:null},set:function(bu,bv,e){if(bd&&b.nodeName(bu,"button")){return bd.set(bu,bv,e)}bu.value=bv}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(by,bw,bz){var bu=by.nodeType;if(!by||bu===3||bu===8||bu===2){return N}var bv,e,bx=bu!==1||!b.isXMLDoc(by);if(bx){bw=b.propFix[bw]||bw;e=b.propHooks[bw]}if(bz!==N){if(e&&"set" in e&&(bv=e.set(by,bz,bw))!==N){return bv}else{return(by[bw]=bz)}}else{if(e&&"get" in e&&(bv=e.get(by,bw))!==null){return bv}else{return by[bw]}}},propHooks:{tabIndex:{get:function(bu){var e=bu.getAttributeNode("tabindex");return e&&e.specified?parseInt(e.value,10):G.test(bu.nodeName)||n.test(bu.nodeName)&&bu.href?0:N}}}});b.attrHooks.tabIndex=b.propHooks.tabIndex;aX={get:function(bu,e){var bv;return b.prop(bu,e)===true||(bv=bu.getAttributeNode(e))&&bv.nodeValue!==false?e.toLowerCase():N},set:function(bu,bw,e){var bv;if(bw===false){b.removeAttr(bu,e)}else{bv=b.propFix[e]||e;if(bv in bu){bu[bv]=true}bu.setAttribute(e,e.toLowerCase())}return e}};if(!b.support.getSetAttribute){bd=b.valHooks.button={get:function(bv,bu){var e;e=bv.getAttributeNode(bu);return e&&e.nodeValue!==""?e.nodeValue:N},set:function(bv,bw,bu){var e=bv.getAttributeNode(bu);if(!e){e=at.createAttribute(bu);bv.setAttributeNode(e)}return(e.nodeValue=bw+"")}};b.each(["width","height"],function(bu,e){b.attrHooks[e]=b.extend(b.attrHooks[e],{set:function(bv,bw){if(bw===""){bv.setAttribute(e,"auto");return bw}}})})}if(!b.support.hrefNormalized){b.each(["href","src","width","height"],function(bu,e){b.attrHooks[e]=b.extend(b.attrHooks[e],{get:function(bw){var bv=bw.getAttribute(e,2);return bv===null?N:bv}})})}if(!b.support.style){b.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||N},set:function(e,bu){return(e.style.cssText=""+bu)}}}if(!b.support.optSelected){b.propHooks.selected=b.extend(b.propHooks.selected,{get:function(bu){var e=bu.parentNode;if(e){e.selectedIndex;if(e.parentNode){e.parentNode.selectedIndex}}return null}})}if(!b.support.checkOn){b.each(["radio","checkbox"],function(){b.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}})}b.each(["radio","checkbox"],function(){b.valHooks[this]=b.extend(b.valHooks[this],{set:function(e,bu){if(b.isArray(bu)){return(e.checked=b.inArray(b(e).val(),bu)>=0)}}})});var aZ=/\.(.*)$/,bc=/^(?:textarea|input|select)$/i,Q=/\./g,bh=/ /g,aE=/[^\w\s.|`]/g,J=function(e){return e.replace(aE,"\\$&")};b.event={add:function(bw,bA,bF,by){if(bw.nodeType===3||bw.nodeType===8){return}if(bF===false){bF=bj}else{if(!bF){return}}var bu,bE;if(bF.handler){bu=bF;bF=bu.handler}if(!bF.guid){bF.guid=b.guid++}var bB=b._data(bw);if(!bB){return}var bG=bB.events,bz=bB.handle;if(!bG){bB.events=bG={}}if(!bz){bB.handle=bz=function(bH){return typeof b!=="undefined"&&(!bH||b.event.triggered!==bH.type)?b.event.handle.apply(bz.elem,arguments):N}}bz.elem=bw;bA=bA.split(" ");var bD,bx=0,e;while((bD=bA[bx++])){bE=bu?b.extend({},bu):{handler:bF,data:by};if(bD.indexOf(".")>-1){e=bD.split(".");bD=e.shift();bE.namespace=e.slice(0).sort().join(".")}else{e=[];bE.namespace=""}bE.type=bD;if(!bE.guid){bE.guid=bF.guid}var bv=bG[bD],bC=b.event.special[bD]||{};if(!bv){bv=bG[bD]=[];if(!bC.setup||bC.setup.call(bw,by,e,bz)===false){if(bw.addEventListener){bw.addEventListener(bD,bz,false)}else{if(bw.attachEvent){bw.attachEvent("on"+bD,bz)}}}}if(bC.add){bC.add.call(bw,bE);if(!bE.handler.guid){bE.handler.guid=bF.guid}}bv.push(bE);b.event.global[bD]=true}bw=null},global:{},remove:function(bI,bD,bv,bz){if(bI.nodeType===3||bI.nodeType===8){return}if(bv===false){bv=bj}var bL,by,bA,bF,bG=0,bw,bB,bE,bx,bC,e,bK,bH=b.hasData(bI)&&b._data(bI),bu=bH&&bH.events;if(!bH||!bu){return}if(bD&&bD.type){bv=bD.handler;bD=bD.type}if(!bD||typeof bD==="string"&&bD.charAt(0)==="."){bD=bD||"";for(by in bu){b.event.remove(bI,by+bD)}return}bD=bD.split(" ");while((by=bD[bG++])){bK=by;e=null;bw=by.indexOf(".")<0;bB=[];if(!bw){bB=by.split(".");by=bB.shift();bE=new RegExp("(^|\\.)"+b.map(bB.slice(0).sort(),J).join("\\.(?:.*\\.)?")+"(\\.|$)")}bC=bu[by];if(!bC){continue}if(!bv){for(bF=0;bF<bC.length;bF++){e=bC[bF];if(bw||bE.test(e.namespace)){b.event.remove(bI,bK,e.handler,bF);bC.splice(bF--,1)}}continue}bx=b.event.special[by]||{};for(bF=bz||0;bF<bC.length;bF++){e=bC[bF];if(bv.guid===e.guid){if(bw||bE.test(e.namespace)){if(bz==null){bC.splice(bF--,1)}if(bx.remove){bx.remove.call(bI,e)}}if(bz!=null){break}}}if(bC.length===0||bz!=null&&bC.length===1){if(!bx.teardown||bx.teardown.call(bI,bB)===false){b.removeEvent(bI,by,bH.handle)}bL=null;delete bu[by]}}if(b.isEmptyObject(bu)){var bJ=bH.handle;if(bJ){bJ.elem=null}delete bH.events;delete bH.handle;if(b.isEmptyObject(bH)){b.removeData(bI,N,true)}}},customEvent:{getData:true,setData:true,changeData:true},trigger:function(e,bA,by,bF){var bD=e.type||e,bv=[],bu;if(bD.indexOf("!")>=0){bD=bD.slice(0,-1);bu=true}if(bD.indexOf(".")>=0){bv=bD.split(".");bD=bv.shift();bv.sort()}if((!by||b.event.customEvent[bD])&&!b.event.global[bD]){return}e=typeof e==="object"?e[b.expando]?e:new b.Event(bD,e):new b.Event(bD);e.type=bD;e.exclusive=bu;e.namespace=bv.join(".");e.namespace_re=new RegExp("(^|\\.)"+bv.join("\\.(?:.*\\.)?")+"(\\.|$)");if(bF||!by){e.preventDefault();e.stopPropagation()}if(!by){b.each(b.cache,function(){var bH=b.expando,bG=this[bH];if(bG&&bG.events&&bG.events[bD]){b.event.trigger(e,bA,bG.handle.elem)}});return}if(by.nodeType===3||by.nodeType===8){return}e.result=N;e.target=by;bA=bA!=null?b.makeArray(bA):[];bA.unshift(e);var bE=by,bw=bD.indexOf(":")<0?"on"+bD:"";do{var bB=b._data(bE,"handle");e.currentTarget=bE;if(bB){bB.apply(bE,bA)}if(bw&&b.acceptData(bE)&&bE[bw]&&bE[bw].apply(bE,bA)===false){e.result=false;e.preventDefault()}bE=bE.parentNode||bE.ownerDocument||bE===e.target.ownerDocument&&ba}while(bE&&!e.isPropagationStopped());if(!e.isDefaultPrevented()){var bx,bC=b.event.special[bD]||{};if((!bC._default||bC._default.call(by.ownerDocument,e)===false)&&!(bD==="click"&&b.nodeName(by,"a"))&&b.acceptData(by)){try{if(bw&&by[bD]){bx=by[bw];if(bx){by[bw]=null}b.event.triggered=bD;by[bD]()}}catch(bz){}if(bx){by[bw]=bx}b.event.triggered=N}}return e.result},handle:function(bA){bA=b.event.fix(bA||ba.event);var bu=((b._data(this,"events")||{})[bA.type]||[]).slice(0),bz=!bA.exclusive&&!bA.namespace,bx=Array.prototype.slice.call(arguments,0);bx[0]=bA;bA.currentTarget=this;for(var bw=0,e=bu.length;bw<e;bw++){var by=bu[bw];if(bz||bA.namespace_re.test(by.namespace)){bA.handler=by.handler;bA.data=by.data;bA.handleObj=by;var bv=by.handler.apply(this,bx);if(bv!==N){bA.result=bv;if(bv===false){bA.preventDefault();bA.stopPropagation()}}if(bA.isImmediatePropagationStopped()){break}}}return bA.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(bx){if(bx[b.expando]){return bx}var bu=bx;bx=b.Event(bu);for(var bv=this.props.length,bz;bv;){bz=this.props[--bv];bx[bz]=bu[bz]}if(!bx.target){bx.target=bx.srcElement||at}if(bx.target.nodeType===3){bx.target=bx.target.parentNode}if(!bx.relatedTarget&&bx.fromElement){bx.relatedTarget=bx.fromElement===bx.target?bx.toElement:bx.fromElement}if(bx.pageX==null&&bx.clientX!=null){var bw=bx.target.ownerDocument||at,by=bw.documentElement,e=bw.body;bx.pageX=bx.clientX+(by&&by.scrollLeft||e&&e.scrollLeft||0)-(by&&by.clientLeft||e&&e.clientLeft||0);bx.pageY=bx.clientY+(by&&by.scrollTop||e&&e.scrollTop||0)-(by&&by.clientTop||e&&e.clientTop||0)}if(bx.which==null&&(bx.charCode!=null||bx.keyCode!=null)){bx.which=bx.charCode!=null?bx.charCode:bx.keyCode}if(!bx.metaKey&&bx.ctrlKey){bx.metaKey=bx.ctrlKey}if(!bx.which&&bx.button!==N){bx.which=(bx.button&1?1:(bx.button&2?3:(bx.button&4?2:0)))}return bx},guid:100000000,proxy:b.proxy,special:{ready:{setup:b.bindReady,teardown:b.noop},live:{add:function(e){b.event.add(this,r(e.origType,e.selector),b.extend({},e,{handler:aj,guid:e.handler.guid}))},remove:function(e){b.event.remove(this,r(e.origType,e.selector),e)}},beforeunload:{setup:function(bv,bu,e){if(b.isWindow(this)){this.onbeforeunload=e}},teardown:function(bu,e){if(this.onbeforeunload===e){this.onbeforeunload=null}}}}};b.removeEvent=at.removeEventListener?function(bu,e,bv){if(bu.removeEventListener){bu.removeEventListener(e,bv,false)}}:function(bu,e,bv){if(bu.detachEvent){bu.detachEvent("on"+e,bv)}};b.Event=function(bu,e){if(!this.preventDefault){return new b.Event(bu,e)}if(bu&&bu.type){this.originalEvent=bu;this.type=bu.type;this.isDefaultPrevented=(bu.defaultPrevented||bu.returnValue===false||bu.getPreventDefault&&bu.getPreventDefault())?k:bj}else{this.type=bu}if(e){b.extend(this,e)}this.timeStamp=b.now();this[b.expando]=true};function bj(){return false}function k(){return true}b.Event.prototype={preventDefault:function(){this.isDefaultPrevented=k;var bu=this.originalEvent;if(!bu){return}if(bu.preventDefault){bu.preventDefault()}else{bu.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=k;var bu=this.originalEvent;if(!bu){return}if(bu.stopPropagation){bu.stopPropagation()}bu.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=k;this.stopPropagation()},isDefaultPrevented:bj,isPropagationStopped:bj,isImmediatePropagationStopped:bj};var ad=function(bv){var bw=bv.relatedTarget,e=false,bu=bv.type;bv.type=bv.data;if(bw!==this){if(bw){e=b.contains(this,bw)}if(!e){b.event.handle.apply(this,arguments);bv.type=bu}}},aU=function(e){e.type=e.data;b.event.handle.apply(this,arguments)};b.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(bu,e){b.event.special[bu]={setup:function(bv){b.event.add(this,e,bv&&bv.selector?aU:ad,bu)},teardown:function(bv){b.event.remove(this,e,bv&&bv.selector?aU:ad)}}});if(!b.support.submitBubbles){b.event.special.submit={setup:function(bu,e){if(!b.nodeName(this,"form")){b.event.add(this,"click.specialSubmit",function(bx){var bw=bx.target,bv=b.nodeName(bw,"input")||b.nodeName(bw,"button")?bw.type:"";if((bv==="submit"||bv==="image")&&b(bw).closest("form").length){aW("submit",this,arguments)}});b.event.add(this,"keypress.specialSubmit",function(bx){var bw=bx.target,bv=b.nodeName(bw,"input")||b.nodeName(bw,"button")?bw.type:"";if((bv==="text"||bv==="password")&&b(bw).closest("form").length&&bx.keyCode===13){aW("submit",this,arguments)}})}else{return false}},teardown:function(e){b.event.remove(this,".specialSubmit")}}}if(!b.support.changeBubbles){var bm,m=function(bu){var e=b.nodeName(bu,"input")?bu.type:"",bv=bu.value;if(e==="radio"||e==="checkbox"){bv=bu.checked}else{if(e==="select-multiple"){bv=bu.selectedIndex>-1?b.map(bu.options,function(bw){return bw.selected}).join("-"):""}else{if(b.nodeName(bu,"select")){bv=bu.selectedIndex}}}return bv},ab=function ab(bw){var bu=bw.target,bv,bx;if(!bc.test(bu.nodeName)||bu.readOnly){return}bv=b._data(bu,"_change_data");bx=m(bu);if(bw.type!=="focusout"||bu.type!=="radio"){b._data(bu,"_change_data",bx)}if(bv===N||bx===bv){return}if(bv!=null||bx){bw.type="change";bw.liveFired=N;b.event.trigger(bw,arguments[1],bu)}};b.event.special.change={filters:{focusout:ab,beforedeactivate:ab,click:function(bw){var bv=bw.target,bu=b.nodeName(bv,"input")?bv.type:"";if(bu==="radio"||bu==="checkbox"||b.nodeName(bv,"select")){ab.call(this,bw)}},keydown:function(bw){var bv=bw.target,bu=b.nodeName(bv,"input")?bv.type:"";if((bw.keyCode===13&&!b.nodeName(bv,"textarea"))||(bw.keyCode===32&&(bu==="checkbox"||bu==="radio"))||bu==="select-multiple"){ab.call(this,bw)}},beforeactivate:function(bv){var bu=bv.target;b._data(bu,"_change_data",m(bu))}},setup:function(bv,bu){if(this.type==="file"){return false}for(var e in bm){b.event.add(this,e+".specialChange",bm[e])}return bc.test(this.nodeName)},teardown:function(e){b.event.remove(this,".specialChange");return bc.test(this.nodeName)}};bm=b.event.special.change.filters;bm.focus=bm.beforeactivate}function aW(bu,bw,e){var bv=b.extend({},e[0]);bv.type=bu;bv.originalEvent={};bv.liveFired=N;b.event.handle.call(bw,bv);if(bv.isDefaultPrevented()){e[0].preventDefault()}}if(!b.support.focusinBubbles){b.each({focus:"focusin",blur:"focusout"},function(bw,e){var bu=0;b.event.special[e]={setup:function(){if(bu++===0){at.addEventListener(bw,bv,true)}},teardown:function(){if(--bu===0){at.removeEventListener(bw,bv,true)}}};function bv(bx){var by=b.event.fix(bx);by.type=e;by.originalEvent={};b.event.trigger(by,null,by.target);if(by.isDefaultPrevented()){bx.preventDefault()}}})}b.each(["bind","one"],function(bu,e){b.fn[e]=function(bA,bB,bz){var by;if(typeof bA==="object"){for(var bx in bA){this[e](bx,bB,bA[bx],bz)}return this}if(arguments.length===2||bB===false){bz=bB;bB=N}if(e==="one"){by=function(bC){b(this).unbind(bC,by);return bz.apply(this,arguments)};by.guid=bz.guid||b.guid++}else{by=bz}if(bA==="unload"&&e!=="one"){this.one(bA,bB,bz)}else{for(var bw=0,bv=this.length;bw<bv;bw++){b.event.add(this[bw],bA,by,bB)}}return this}});b.fn.extend({unbind:function(bx,bw){if(typeof bx==="object"&&!bx.preventDefault){for(var bv in bx){this.unbind(bv,bx[bv])}}else{for(var bu=0,e=this.length;bu<e;bu++){b.event.remove(this[bu],bx,bw)}}return this},delegate:function(e,bu,bw,bv){return this.live(bu,bw,bv,e)},undelegate:function(e,bu,bv){if(arguments.length===0){return this.unbind("live")}else{return this.die(bu,null,bv,e)}},trigger:function(e,bu){return this.each(function(){b.event.trigger(e,bu,this)})},triggerHandler:function(e,bu){if(this[0]){return b.event.trigger(e,bu,this[0],true)}},toggle:function(bw){var bu=arguments,e=bw.guid||b.guid++,bv=0,bx=function(by){var bz=(b.data(this,"lastToggle"+bw.guid)||0)%bv;b.data(this,"lastToggle"+bw.guid,bz+1);by.preventDefault();return bu[bz].apply(this,arguments)||false};bx.guid=e;while(bv<bu.length){bu[bv++].guid=e}return this.click(bx)},hover:function(e,bu){return this.mouseenter(e).mouseleave(bu||e)}});var aS={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};b.each(["live","die"],function(bu,e){b.fn[e]=function(bE,bB,bG,bx){var bF,bC=0,bD,bw,bI,bz=bx||this.selector,bv=bx?this:b(this.context);if(typeof bE==="object"&&!bE.preventDefault){for(var bH in bE){bv[e](bH,bB,bE[bH],bz)}return this}if(e==="die"&&!bE&&bx&&bx.charAt(0)==="."){bv.unbind(bx);return this}if(bB===false||b.isFunction(bB)){bG=bB||bj;bB=N}bE=(bE||"").split(" ");while((bF=bE[bC++])!=null){bD=aZ.exec(bF);bw="";if(bD){bw=bD[0];bF=bF.replace(aZ,"")}if(bF==="hover"){bE.push("mouseenter"+bw,"mouseleave"+bw);continue}bI=bF;if(aS[bF]){bE.push(aS[bF]+bw);bF=bF+bw}else{bF=(aS[bF]||bF)+bw}if(e==="live"){for(var bA=0,by=bv.length;bA<by;bA++){b.event.add(bv[bA],"live."+r(bF,bz),{data:bB,selector:bz,handler:bG,origType:bF,origHandler:bG,preType:bI})}}else{bv.unbind("live."+r(bF,bz),bG)}}return this}});function aj(bE){var bB,bw,bK,by,e,bG,bD,bF,bC,bJ,bA,bz,bI,bH=[],bx=[],bu=b._data(this,"events");if(bE.liveFired===this||!bu||!bu.live||bE.target.disabled||bE.button&&bE.type==="click"){return}if(bE.namespace){bz=new RegExp("(^|\\.)"+bE.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")}bE.liveFired=this;var bv=bu.live.slice(0);for(bD=0;bD<bv.length;bD++){e=bv[bD];if(e.origType.replace(aZ,"")===bE.type){bx.push(e.selector)}else{bv.splice(bD--,1)}}by=b(bE.target).closest(bx,bE.currentTarget);for(bF=0,bC=by.length;bF<bC;bF++){bA=by[bF];for(bD=0;bD<bv.length;bD++){e=bv[bD];if(bA.selector===e.selector&&(!bz||bz.test(e.namespace))&&!bA.elem.disabled){bG=bA.elem;bK=null;if(e.preType==="mouseenter"||e.preType==="mouseleave"){bE.type=e.preType;bK=b(bE.relatedTarget).closest(e.selector)[0];if(bK&&b.contains(bG,bK)){bK=bG}}if(!bK||bK!==bG){bH.push({elem:bG,handleObj:e,level:bA.level})}}}}for(bF=0,bC=bH.length;bF<bC;bF++){by=bH[bF];if(bw&&by.level>bw){break}bE.currentTarget=by.elem;bE.data=by.handleObj.data;bE.handleObj=by.handleObj;bI=by.handleObj.origHandler.apply(by.elem,arguments);if(bI===false||bE.isPropagationStopped()){bw=by.level;if(bI===false){bB=false}if(bE.isImmediatePropagationStopped()){break}}}return bB}function r(bu,e){return(bu&&bu!=="*"?bu+".":"")+e.replace(Q,"`").replace(bh,"&")}b.each(("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error").split(" "),function(bu,e){b.fn[e]=function(bw,bv){if(bv==null){bv=bw;bw=null}return arguments.length>0?this.bind(e,bw,bv):this.trigger(e)};if(b.attrFn){b.attrFn[e]=true}});
/*!
 * Sizzle CSS Selector Engine
 *  Copyright 2011, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var bE=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,bF=0,bI=Object.prototype.toString,bz=false,by=true,bG=/\\/g,bM=/\W/;[0,0].sort(function(){by=false;return 0});var bw=function(bR,e,bU,bV){bU=bU||[];e=e||at;var bX=e;if(e.nodeType!==1&&e.nodeType!==9){return[]}if(!bR||typeof bR!=="string"){return bU}var bO,bZ,b2,bN,bY,b1,b0,bT,bQ=true,bP=bw.isXML(e),bS=[],bW=bR;do{bE.exec("");bO=bE.exec(bW);if(bO){bW=bO[3];bS.push(bO[1]);if(bO[2]){bN=bO[3];break}}}while(bO);if(bS.length>1&&bA.exec(bR)){if(bS.length===2&&bB.relative[bS[0]]){bZ=bJ(bS[0]+bS[1],e)}else{bZ=bB.relative[bS[0]]?[e]:bw(bS.shift(),e);while(bS.length){bR=bS.shift();if(bB.relative[bR]){bR+=bS.shift()}bZ=bJ(bR,bZ)}}}else{if(!bV&&bS.length>1&&e.nodeType===9&&!bP&&bB.match.ID.test(bS[0])&&!bB.match.ID.test(bS[bS.length-1])){bY=bw.find(bS.shift(),e,bP);e=bY.expr?bw.filter(bY.expr,bY.set)[0]:bY.set[0]}if(e){bY=bV?{expr:bS.pop(),set:bC(bV)}:bw.find(bS.pop(),bS.length===1&&(bS[0]==="~"||bS[0]==="+")&&e.parentNode?e.parentNode:e,bP);bZ=bY.expr?bw.filter(bY.expr,bY.set):bY.set;if(bS.length>0){b2=bC(bZ)}else{bQ=false}while(bS.length){b1=bS.pop();b0=b1;if(!bB.relative[b1]){b1=""}else{b0=bS.pop()}if(b0==null){b0=e}bB.relative[b1](b2,b0,bP)}}else{b2=bS=[]}}if(!b2){b2=bZ}if(!b2){bw.error(b1||bR)}if(bI.call(b2)==="[object Array]"){if(!bQ){bU.push.apply(bU,b2)}else{if(e&&e.nodeType===1){for(bT=0;b2[bT]!=null;bT++){if(b2[bT]&&(b2[bT]===true||b2[bT].nodeType===1&&bw.contains(e,b2[bT]))){bU.push(bZ[bT])}}}else{for(bT=0;b2[bT]!=null;bT++){if(b2[bT]&&b2[bT].nodeType===1){bU.push(bZ[bT])}}}}}else{bC(b2,bU)}if(bN){bw(bN,bX,bU,bV);bw.uniqueSort(bU)}return bU};bw.uniqueSort=function(bN){if(bH){bz=by;bN.sort(bH);if(bz){for(var e=1;e<bN.length;e++){if(bN[e]===bN[e-1]){bN.splice(e--,1)}}}}return bN};bw.matches=function(e,bN){return bw(e,null,null,bN)};bw.matchesSelector=function(e,bN){return bw(bN,null,null,[e]).length>0};bw.find=function(bT,e,bU){var bS;if(!bT){return[]}for(var bP=0,bO=bB.order.length;bP<bO;bP++){var bQ,bR=bB.order[bP];if((bQ=bB.leftMatch[bR].exec(bT))){var bN=bQ[1];bQ.splice(1,1);if(bN.substr(bN.length-1)!=="\\"){bQ[1]=(bQ[1]||"").replace(bG,"");bS=bB.find[bR](bQ,e,bU);if(bS!=null){bT=bT.replace(bB.match[bR],"");break}}}}if(!bS){bS=typeof e.getElementsByTagName!=="undefined"?e.getElementsByTagName("*"):[]}return{set:bS,expr:bT}};bw.filter=function(bX,bW,b0,bQ){var bS,e,bO=bX,b2=[],bU=bW,bT=bW&&bW[0]&&bw.isXML(bW[0]);while(bX&&bW.length){for(var bV in bB.filter){if((bS=bB.leftMatch[bV].exec(bX))!=null&&bS[2]){var b1,bZ,bN=bB.filter[bV],bP=bS[1];e=false;bS.splice(1,1);if(bP.substr(bP.length-1)==="\\"){continue}if(bU===b2){b2=[]}if(bB.preFilter[bV]){bS=bB.preFilter[bV](bS,bU,b0,b2,bQ,bT);if(!bS){e=b1=true}else{if(bS===true){continue}}}if(bS){for(var bR=0;(bZ=bU[bR])!=null;bR++){if(bZ){b1=bN(bZ,bS,bR,bU);var bY=bQ^!!b1;if(b0&&b1!=null){if(bY){e=true}else{bU[bR]=false}}else{if(bY){b2.push(bZ);e=true}}}}}if(b1!==N){if(!b0){bU=b2}bX=bX.replace(bB.match[bV],"");if(!e){return[]}break}}}if(bX===bO){if(e==null){bw.error(bX)}else{break}}bO=bX}return bU};bw.error=function(e){throw"Syntax error, unrecognized expression: "+e};var bB=bw.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(e){return e.getAttribute("href")},type:function(e){return e.getAttribute("type")}},relative:{"+":function(bS,bN){var bP=typeof bN==="string",bR=bP&&!bM.test(bN),bT=bP&&!bR;if(bR){bN=bN.toLowerCase()}for(var bO=0,e=bS.length,bQ;bO<e;bO++){if((bQ=bS[bO])){while((bQ=bQ.previousSibling)&&bQ.nodeType!==1){}bS[bO]=bT||bQ&&bQ.nodeName.toLowerCase()===bN?bQ||false:bQ===bN}}if(bT){bw.filter(bN,bS,true)}},">":function(bS,bN){var bR,bQ=typeof bN==="string",bO=0,e=bS.length;if(bQ&&!bM.test(bN)){bN=bN.toLowerCase();for(;bO<e;bO++){bR=bS[bO];if(bR){var bP=bR.parentNode;bS[bO]=bP.nodeName.toLowerCase()===bN?bP:false}}}else{for(;bO<e;bO++){bR=bS[bO];if(bR){bS[bO]=bQ?bR.parentNode:bR.parentNode===bN}}if(bQ){bw.filter(bN,bS,true)}}},"":function(bP,bN,bR){var bQ,bO=bF++,e=bK;if(typeof bN==="string"&&!bM.test(bN)){bN=bN.toLowerCase();bQ=bN;e=bu}e("parentNode",bN,bO,bP,bQ,bR)},"~":function(bP,bN,bR){var bQ,bO=bF++,e=bK;if(typeof bN==="string"&&!bM.test(bN)){bN=bN.toLowerCase();bQ=bN;e=bu}e("previousSibling",bN,bO,bP,bQ,bR)}},find:{ID:function(bN,bO,bP){if(typeof bO.getElementById!=="undefined"&&!bP){var e=bO.getElementById(bN[1]);return e&&e.parentNode?[e]:[]}},NAME:function(bO,bR){if(typeof bR.getElementsByName!=="undefined"){var bN=[],bQ=bR.getElementsByName(bO[1]);for(var bP=0,e=bQ.length;bP<e;bP++){if(bQ[bP].getAttribute("name")===bO[1]){bN.push(bQ[bP])}}return bN.length===0?null:bN}},TAG:function(e,bN){if(typeof bN.getElementsByTagName!=="undefined"){return bN.getElementsByTagName(e[1])}}},preFilter:{CLASS:function(bP,bN,bO,e,bS,bT){bP=" "+bP[1].replace(bG,"")+" ";if(bT){return bP}for(var bQ=0,bR;(bR=bN[bQ])!=null;bQ++){if(bR){if(bS^(bR.className&&(" "+bR.className+" ").replace(/[\t\n\r]/g," ").indexOf(bP)>=0)){if(!bO){e.push(bR)}}else{if(bO){bN[bQ]=false}}}}return false},ID:function(e){return e[1].replace(bG,"")},TAG:function(bN,e){return bN[1].replace(bG,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){if(!e[2]){bw.error(e[0])}e[2]=e[2].replace(/^\+|\s*/g,"");var bN=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=(bN[1]+(bN[2]||1))-0;e[3]=bN[3]-0}else{if(e[2]){bw.error(e[0])}}e[0]=bF++;return e},ATTR:function(bQ,bN,bO,e,bR,bS){var bP=bQ[1]=bQ[1].replace(bG,"");if(!bS&&bB.attrMap[bP]){bQ[1]=bB.attrMap[bP]}bQ[4]=(bQ[4]||bQ[5]||"").replace(bG,"");if(bQ[2]==="~="){bQ[4]=" "+bQ[4]+" "}return bQ},PSEUDO:function(bQ,bN,bO,e,bR){if(bQ[1]==="not"){if((bE.exec(bQ[3])||"").length>1||/^\w/.test(bQ[3])){bQ[3]=bw(bQ[3],null,null,bN)}else{var bP=bw.filter(bQ[3],bN,bO,true^bR);if(!bO){e.push.apply(e,bP)}return false}}else{if(bB.match.POS.test(bQ[0])||bB.match.CHILD.test(bQ[0])){return true}}return bQ},POS:function(e){e.unshift(true);return e}},filters:{enabled:function(e){return e.disabled===false&&e.type!=="hidden"},disabled:function(e){return e.disabled===true},checked:function(e){return e.checked===true},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},parent:function(e){return !!e.firstChild},empty:function(e){return !e.firstChild},has:function(bO,bN,e){return !!bw(e[3],bO).length},header:function(e){return(/h\d/i).test(e.nodeName)},text:function(bO){var e=bO.getAttribute("type"),bN=bO.type;return bO.nodeName.toLowerCase()==="input"&&"text"===bN&&(e===bN||e===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(bN){var e=bN.nodeName.toLowerCase();return(e==="input"||e==="button")&&"submit"===bN.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(bN){var e=bN.nodeName.toLowerCase();return(e==="input"||e==="button")&&"reset"===bN.type},button:function(bN){var e=bN.nodeName.toLowerCase();return e==="input"&&"button"===bN.type||e==="button"},input:function(e){return(/input|select|textarea|button/i).test(e.nodeName)},focus:function(e){return e===e.ownerDocument.activeElement}},setFilters:{first:function(bN,e){return e===0},last:function(bO,bN,e,bP){return bN===bP.length-1},even:function(bN,e){return e%2===0},odd:function(bN,e){return e%2===1},lt:function(bO,bN,e){return bN<e[3]-0},gt:function(bO,bN,e){return bN>e[3]-0},nth:function(bO,bN,e){return e[3]-0===bN},eq:function(bO,bN,e){return e[3]-0===bN}},filter:{PSEUDO:function(bO,bT,bS,bU){var e=bT[1],bN=bB.filters[e];if(bN){return bN(bO,bS,bT,bU)}else{if(e==="contains"){return(bO.textContent||bO.innerText||bw.getText([bO])||"").indexOf(bT[3])>=0}else{if(e==="not"){var bP=bT[3];for(var bR=0,bQ=bP.length;bR<bQ;bR++){if(bP[bR]===bO){return false}}return true}else{bw.error(e)}}}},CHILD:function(e,bP){var bS=bP[1],bN=e;switch(bS){case"only":case"first":while((bN=bN.previousSibling)){if(bN.nodeType===1){return false}}if(bS==="first"){return true}bN=e;case"last":while((bN=bN.nextSibling)){if(bN.nodeType===1){return false}}return true;case"nth":var bO=bP[2],bV=bP[3];if(bO===1&&bV===0){return true}var bR=bP[0],bU=e.parentNode;if(bU&&(bU.sizcache!==bR||!e.nodeIndex)){var bQ=0;for(bN=bU.firstChild;bN;bN=bN.nextSibling){if(bN.nodeType===1){bN.nodeIndex=++bQ}}bU.sizcache=bR}var bT=e.nodeIndex-bV;if(bO===0){return bT===0}else{return(bT%bO===0&&bT/bO>=0)}}},ID:function(bN,e){return bN.nodeType===1&&bN.getAttribute("id")===e},TAG:function(bN,e){return(e==="*"&&bN.nodeType===1)||bN.nodeName.toLowerCase()===e},CLASS:function(bN,e){return(" "+(bN.className||bN.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(bR,bP){var bO=bP[1],e=bB.attrHandle[bO]?bB.attrHandle[bO](bR):bR[bO]!=null?bR[bO]:bR.getAttribute(bO),bS=e+"",bQ=bP[2],bN=bP[4];return e==null?bQ==="!=":bQ==="="?bS===bN:bQ==="*="?bS.indexOf(bN)>=0:bQ==="~="?(" "+bS+" ").indexOf(bN)>=0:!bN?bS&&e!==false:bQ==="!="?bS!==bN:bQ==="^="?bS.indexOf(bN)===0:bQ==="$="?bS.substr(bS.length-bN.length)===bN:bQ==="|="?bS===bN||bS.substr(0,bN.length+1)===bN+"-":false},POS:function(bQ,bN,bO,bR){var e=bN[2],bP=bB.setFilters[e];if(bP){return bP(bQ,bO,bN,bR)}}}};var bA=bB.match.POS,bv=function(bN,e){return"\\"+(e-0+1)};for(var bx in bB.match){bB.match[bx]=new RegExp(bB.match[bx].source+(/(?![^\[]*\])(?![^\(]*\))/.source));bB.leftMatch[bx]=new RegExp(/(^(?:.|\r|\n)*?)/.source+bB.match[bx].source.replace(/\\(\d+)/g,bv))}var bC=function(bN,e){bN=Array.prototype.slice.call(bN,0);if(e){e.push.apply(e,bN);return e}return bN};try{Array.prototype.slice.call(at.documentElement.childNodes,0)[0].nodeType}catch(bL){bC=function(bQ,bP){var bO=0,bN=bP||[];if(bI.call(bQ)==="[object Array]"){Array.prototype.push.apply(bN,bQ)}else{if(typeof bQ.length==="number"){for(var e=bQ.length;bO<e;bO++){bN.push(bQ[bO])}}else{for(;bQ[bO];bO++){bN.push(bQ[bO])}}}return bN}}var bH,bD;if(at.documentElement.compareDocumentPosition){bH=function(bN,e){if(bN===e){bz=true;return 0}if(!bN.compareDocumentPosition||!e.compareDocumentPosition){return bN.compareDocumentPosition?-1:1}return bN.compareDocumentPosition(e)&4?-1:1}}else{bH=function(bU,bT){if(bU===bT){bz=true;return 0}else{if(bU.sourceIndex&&bT.sourceIndex){return bU.sourceIndex-bT.sourceIndex}}var bR,bN,bO=[],e=[],bQ=bU.parentNode,bS=bT.parentNode,bV=bQ;if(bQ===bS){return bD(bU,bT)}else{if(!bQ){return -1}else{if(!bS){return 1}}}while(bV){bO.unshift(bV);bV=bV.parentNode}bV=bS;while(bV){e.unshift(bV);bV=bV.parentNode}bR=bO.length;bN=e.length;for(var bP=0;bP<bR&&bP<bN;bP++){if(bO[bP]!==e[bP]){return bD(bO[bP],e[bP])}}return bP===bR?bD(bU,e[bP],-1):bD(bO[bP],bT,1)};bD=function(bN,e,bO){if(bN===e){return bO}var bP=bN.nextSibling;while(bP){if(bP===e){return -1}bP=bP.nextSibling}return 1}}bw.getText=function(e){var bN="",bP;for(var bO=0;e[bO];bO++){bP=e[bO];if(bP.nodeType===3||bP.nodeType===4){bN+=bP.nodeValue}else{if(bP.nodeType!==8){bN+=bw.getText(bP.childNodes)}}}return bN};(function(){var bN=at.createElement("div"),bO="script"+(new Date()).getTime(),e=at.documentElement;bN.innerHTML="<a name='"+bO+"'/>";e.insertBefore(bN,e.firstChild);if(at.getElementById(bO)){bB.find.ID=function(bQ,bR,bS){if(typeof bR.getElementById!=="undefined"&&!bS){var bP=bR.getElementById(bQ[1]);return bP?bP.id===bQ[1]||typeof bP.getAttributeNode!=="undefined"&&bP.getAttributeNode("id").nodeValue===bQ[1]?[bP]:N:[]}};bB.filter.ID=function(bR,bP){var bQ=typeof bR.getAttributeNode!=="undefined"&&bR.getAttributeNode("id");return bR.nodeType===1&&bQ&&bQ.nodeValue===bP}}e.removeChild(bN);e=bN=null})();(function(){var e=at.createElement("div");e.appendChild(at.createComment(""));if(e.getElementsByTagName("*").length>0){bB.find.TAG=function(bN,bR){var bQ=bR.getElementsByTagName(bN[1]);if(bN[1]==="*"){var bP=[];for(var bO=0;bQ[bO];bO++){if(bQ[bO].nodeType===1){bP.push(bQ[bO])}}bQ=bP}return bQ}}e.innerHTML="<a href='#'></a>";if(e.firstChild&&typeof e.firstChild.getAttribute!=="undefined"&&e.firstChild.getAttribute("href")!=="#"){bB.attrHandle.href=function(bN){return bN.getAttribute("href",2)}}e=null})();if(at.querySelectorAll){(function(){var e=bw,bP=at.createElement("div"),bO="__sizzle__";bP.innerHTML="<p class='TEST'></p>";if(bP.querySelectorAll&&bP.querySelectorAll(".TEST").length===0){return}bw=function(b0,bR,bV,bZ){bR=bR||at;if(!bZ&&!bw.isXML(bR)){var bY=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b0);if(bY&&(bR.nodeType===1||bR.nodeType===9)){if(bY[1]){return bC(bR.getElementsByTagName(b0),bV)}else{if(bY[2]&&bB.find.CLASS&&bR.getElementsByClassName){return bC(bR.getElementsByClassName(bY[2]),bV)}}}if(bR.nodeType===9){if(b0==="body"&&bR.body){return bC([bR.body],bV)}else{if(bY&&bY[3]){var bU=bR.getElementById(bY[3]);if(bU&&bU.parentNode){if(bU.id===bY[3]){return bC([bU],bV)}}else{return bC([],bV)}}}try{return bC(bR.querySelectorAll(b0),bV)}catch(bW){}}else{if(bR.nodeType===1&&bR.nodeName.toLowerCase()!=="object"){var bS=bR,bT=bR.getAttribute("id"),bQ=bT||bO,b2=bR.parentNode,b1=/^\s*[+~]/.test(b0);if(!bT){bR.setAttribute("id",bQ)}else{bQ=bQ.replace(/'/g,"\\$&")}if(b1&&b2){bR=bR.parentNode}try{if(!b1||b2){return bC(bR.querySelectorAll("[id='"+bQ+"'] "+b0),bV)}}catch(bX){}finally{if(!bT){bS.removeAttribute("id")}}}}}return e(b0,bR,bV,bZ)};for(var bN in e){bw[bN]=e[bN]}bP=null})()}(function(){var e=at.documentElement,bO=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(bO){var bQ=!bO.call(at.createElement("div"),"div"),bN=false;try{bO.call(at.documentElement,"[test!='']:sizzle")}catch(bP){bN=true}bw.matchesSelector=function(bS,bU){bU=bU.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!bw.isXML(bS)){try{if(bN||!bB.match.PSEUDO.test(bU)&&!/!=/.test(bU)){var bR=bO.call(bS,bU);if(bR||!bQ||bS.document&&bS.document.nodeType!==11){return bR}}}catch(bT){}}return bw(bU,null,null,[bS]).length>0}}})();(function(){var e=at.createElement("div");e.innerHTML="<div class='test e'></div><div class='test'></div>";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0){return}e.lastChild.className="e";if(e.getElementsByClassName("e").length===1){return}bB.order.splice(1,0,"CLASS");bB.find.CLASS=function(bN,bO,bP){if(typeof bO.getElementsByClassName!=="undefined"&&!bP){return bO.getElementsByClassName(bN[1])}};e=null})();function bu(bN,bS,bR,bV,bT,bU){for(var bP=0,bO=bV.length;bP<bO;bP++){var e=bV[bP];if(e){var bQ=false;e=e[bN];while(e){if(e.sizcache===bR){bQ=bV[e.sizset];break}if(e.nodeType===1&&!bU){e.sizcache=bR;e.sizset=bP}if(e.nodeName.toLowerCase()===bS){bQ=e;break}e=e[bN]}bV[bP]=bQ}}}function bK(bN,bS,bR,bV,bT,bU){for(var bP=0,bO=bV.length;bP<bO;bP++){var e=bV[bP];if(e){var bQ=false;e=e[bN];while(e){if(e.sizcache===bR){bQ=bV[e.sizset];break}if(e.nodeType===1){if(!bU){e.sizcache=bR;e.sizset=bP}if(typeof bS!=="string"){if(e===bS){bQ=true;break}}else{if(bw.filter(bS,[e]).length>0){bQ=e;break}}}e=e[bN]}bV[bP]=bQ}}}if(at.documentElement.contains){bw.contains=function(bN,e){return bN!==e&&(bN.contains?bN.contains(e):true)}}else{if(at.documentElement.compareDocumentPosition){bw.contains=function(bN,e){return !!(bN.compareDocumentPosition(e)&16)}}else{bw.contains=function(){return false}}}bw.isXML=function(e){var bN=(e?e.ownerDocument||e:0).documentElement;return bN?bN.nodeName!=="HTML":false};var bJ=function(e,bT){var bR,bP=[],bQ="",bO=bT.nodeType?[bT]:bT;while((bR=bB.match.PSEUDO.exec(e))){bQ+=bR[0];e=e.replace(bB.match.PSEUDO,"")}e=bB.relative[e]?e+"*":e;for(var bS=0,bN=bO.length;bS<bN;bS++){bw(e,bO[bS],bP)}return bw.filter(bQ,bP)};b.find=bw;b.expr=bw.selectors;b.expr[":"]=b.expr.filters;b.unique=bw.uniqueSort;b.text=bw.getText;b.isXMLDoc=bw.isXML;b.contains=bw.contains})();var aa=/Until$/,ao=/^(?:parents|prevUntil|prevAll)/,a8=/,/,bp=/^.[^:#\[\.,]*$/,S=Array.prototype.slice,K=b.expr.match.POS,aw={children:true,contents:true,next:true,prev:true};b.fn.extend({find:function(e){var bv=this,bx,bu;if(typeof e!=="string"){return b(e).filter(function(){for(bx=0,bu=bv.length;bx<bu;bx++){if(b.contains(bv[bx],this)){return true}}})}var bw=this.pushStack("","find",e),bz,bA,by;for(bx=0,bu=this.length;bx<bu;bx++){bz=bw.length;b.find(e,this[bx],bw);if(bx>0){for(bA=bz;bA<bw.length;bA++){for(by=0;by<bz;by++){if(bw[by]===bw[bA]){bw.splice(bA--,1);break}}}}}return bw},has:function(bu){var e=b(bu);return this.filter(function(){for(var bw=0,bv=e.length;bw<bv;bw++){if(b.contains(this,e[bw])){return true}}})},not:function(e){return this.pushStack(aD(this,e,false),"not",e)},filter:function(e){return this.pushStack(aD(this,e,true),"filter",e)},is:function(e){return !!e&&(typeof e==="string"?b.filter(e,this).length>0:this.filter(e).length>0)},closest:function(bD,bu){var bA=[],bx,bv,bC=this[0];if(b.isArray(bD)){var bz,bw,by={},e=1;if(bC&&bD.length){for(bx=0,bv=bD.length;bx<bv;bx++){bw=bD[bx];if(!by[bw]){by[bw]=K.test(bw)?b(bw,bu||this.context):bw}}while(bC&&bC.ownerDocument&&bC!==bu){for(bw in by){bz=by[bw];if(bz.jquery?bz.index(bC)>-1:b(bC).is(bz)){bA.push({selector:bw,elem:bC,level:e})}}bC=bC.parentNode;e++}}return bA}var bB=K.test(bD)||typeof bD!=="string"?b(bD,bu||this.context):0;for(bx=0,bv=this.length;bx<bv;bx++){bC=this[bx];while(bC){if(bB?bB.index(bC)>-1:b.find.matchesSelector(bC,bD)){bA.push(bC);break}else{bC=bC.parentNode;if(!bC||!bC.ownerDocument||bC===bu||bC.nodeType===11){break}}}}bA=bA.length>1?b.unique(bA):bA;return this.pushStack(bA,"closest",bD)},index:function(e){if(!e){return(this[0]&&this[0].parentNode)?this.prevAll().length:-1}if(typeof e==="string"){return b.inArray(this[0],b(e))}return b.inArray(e.jquery?e[0]:e,this)},add:function(e,bu){var bw=typeof e==="string"?b(e,bu):b.makeArray(e&&e.nodeType?[e]:e),bv=b.merge(this.get(),bw);return this.pushStack(F(bw[0])||F(bv[0])?bv:b.unique(bv))},andSelf:function(){return this.add(this.prevObject)}});function F(e){return !e||!e.parentNode||e.parentNode.nodeType===11}b.each({parent:function(bu){var e=bu.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return b.dir(e,"parentNode")},parentsUntil:function(bu,e,bv){return b.dir(bu,"parentNode",bv)},next:function(e){return b.nth(e,2,"nextSibling")},prev:function(e){return b.nth(e,2,"previousSibling")},nextAll:function(e){return b.dir(e,"nextSibling")},prevAll:function(e){return b.dir(e,"previousSibling")},nextUntil:function(bu,e,bv){return b.dir(bu,"nextSibling",bv)},prevUntil:function(bu,e,bv){return b.dir(bu,"previousSibling",bv)},siblings:function(e){return b.sibling(e.parentNode.firstChild,e)},children:function(e){return b.sibling(e.firstChild)},contents:function(e){return b.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:b.makeArray(e.childNodes)}},function(e,bu){b.fn[e]=function(by,bv){var bx=b.map(this,bu,by),bw=S.call(arguments);if(!aa.test(e)){bv=by}if(bv&&typeof bv==="string"){bx=b.filter(bv,bx)}bx=this.length>1&&!aw[e]?b.unique(bx):bx;if((this.length>1||a8.test(bv))&&ao.test(e)){bx=bx.reverse()}return this.pushStack(bx,e,bw.join(","))}});b.extend({filter:function(bv,e,bu){if(bu){bv=":not("+bv+")"}return e.length===1?b.find.matchesSelector(e[0],bv)?[e[0]]:[]:b.find.matches(bv,e)},dir:function(bv,bu,bx){var e=[],bw=bv[bu];while(bw&&bw.nodeType!==9&&(bx===N||bw.nodeType!==1||!b(bw).is(bx))){if(bw.nodeType===1){e.push(bw)}bw=bw[bu]}return e},nth:function(bx,e,bv,bw){e=e||1;var bu=0;for(;bx;bx=bx[bv]){if(bx.nodeType===1&&++bu===e){break}}return bx},sibling:function(bv,bu){var e=[];for(;bv;bv=bv.nextSibling){if(bv.nodeType===1&&bv!==bu){e.push(bv)}}return e}});function aD(bw,bv,e){bv=bv||0;if(b.isFunction(bv)){return b.grep(bw,function(by,bx){var bz=!!bv.call(by,bx,by);return bz===e})}else{if(bv.nodeType){return b.grep(bw,function(by,bx){return(by===bv)===e})}else{if(typeof bv==="string"){var bu=b.grep(bw,function(bx){return bx.nodeType===1});if(bp.test(bv)){return b.filter(bv,bu,!e)}else{bv=b.filter(bv,bu)}}}}return b.grep(bw,function(by,bx){return(b.inArray(by,bv)>=0)===e})}var af=/ jQuery\d+="(?:\d+|null)"/g,ap=/^\s+/,U=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,f=/<([\w:]+)/,z=/<tbody/i,X=/<|&#?\w+;/,R=/<(?:script|object|embed|option|style)/i,p=/checked\s*(?:[^=]|=\s*.checked.)/i,bl=/\/(java|ecma)script/i,aL=/^\s*<!(?:\[CDATA\[|\-\-)/,av={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};av.optgroup=av.option;av.tbody=av.tfoot=av.colgroup=av.caption=av.thead;av.th=av.td;if(!b.support.htmlSerialize){av._default=[1,"div<div>","</div>"]}b.fn.extend({text:function(e){if(b.isFunction(e)){return this.each(function(bv){var bu=b(this);bu.text(e.call(this,bv,bu.text()))})}if(typeof e!=="object"&&e!==N){return this.empty().append((this[0]&&this[0].ownerDocument||at).createTextNode(e))}return b.text(this)},wrapAll:function(e){if(b.isFunction(e)){return this.each(function(bv){b(this).wrapAll(e.call(this,bv))})}if(this[0]){var bu=b(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){bu.insertBefore(this[0])}bu.map(function(){var bv=this;while(bv.firstChild&&bv.firstChild.nodeType===1){bv=bv.firstChild}return bv}).append(this)}return this},wrapInner:function(e){if(b.isFunction(e)){return this.each(function(bu){b(this).wrapInner(e.call(this,bu))})}return this.each(function(){var bu=b(this),bv=bu.contents();if(bv.length){bv.wrapAll(e)}else{bu.append(e)}})},wrap:function(e){return this.each(function(){b(this).wrapAll(e)})},unwrap:function(){return this.parent().each(function(){if(!b.nodeName(this,"body")){b(this).replaceWith(this.childNodes)}}).end()},append:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.appendChild(e)}})},prepend:function(){return this.domManip(arguments,true,function(e){if(this.nodeType===1){this.insertBefore(e,this.firstChild)}})},before:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bu){this.parentNode.insertBefore(bu,this)})}else{if(arguments.length){var e=b(arguments[0]);e.push.apply(e,this.toArray());return this.pushStack(e,"before",arguments)}}},after:function(){if(this[0]&&this[0].parentNode){return this.domManip(arguments,false,function(bu){this.parentNode.insertBefore(bu,this.nextSibling)})}else{if(arguments.length){var e=this.pushStack(this,"after",arguments);e.push.apply(e,b(arguments[0]).toArray());return e}}},remove:function(e,bw){for(var bu=0,bv;(bv=this[bu])!=null;bu++){if(!e||b.filter(e,[bv]).length){if(!bw&&bv.nodeType===1){b.cleanData(bv.getElementsByTagName("*"));b.cleanData([bv])}if(bv.parentNode){bv.parentNode.removeChild(bv)}}}return this},empty:function(){for(var e=0,bu;(bu=this[e])!=null;e++){if(bu.nodeType===1){b.cleanData(bu.getElementsByTagName("*"))}while(bu.firstChild){bu.removeChild(bu.firstChild)}}return this},clone:function(bu,e){bu=bu==null?false:bu;e=e==null?bu:e;return this.map(function(){return b.clone(this,bu,e)})},html:function(bw){if(bw===N){return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(af,""):null}else{if(typeof bw==="string"&&!R.test(bw)&&(b.support.leadingWhitespace||!ap.test(bw))&&!av[(f.exec(bw)||["",""])[1].toLowerCase()]){bw=bw.replace(U,"<$1></$2>");try{for(var bv=0,bu=this.length;bv<bu;bv++){if(this[bv].nodeType===1){b.cleanData(this[bv].getElementsByTagName("*"));this[bv].innerHTML=bw}}}catch(bx){this.empty().append(bw)}}else{if(b.isFunction(bw)){this.each(function(by){var e=b(this);e.html(bw.call(this,by,e.html()))})}else{this.empty().append(bw)}}}return this},replaceWith:function(e){if(this[0]&&this[0].parentNode){if(b.isFunction(e)){return this.each(function(bw){var bv=b(this),bu=bv.html();bv.replaceWith(e.call(this,bw,bu))})}if(typeof e!=="string"){e=b(e).detach()}return this.each(function(){var bv=this.nextSibling,bu=this.parentNode;b(this).remove();if(bv){b(bv).before(e)}else{b(bu).append(e)}})}else{return this.length?this.pushStack(b(b.isFunction(e)?e():e),"replaceWith",e):this}},detach:function(e){return this.remove(e,true)},domManip:function(bA,bE,bD){var bw,bx,bz,bC,bB=bA[0],bu=[];if(!b.support.checkClone&&arguments.length===3&&typeof bB==="string"&&p.test(bB)){return this.each(function(){b(this).domManip(bA,bE,bD,true)})}if(b.isFunction(bB)){return this.each(function(bG){var bF=b(this);bA[0]=bB.call(this,bG,bE?bF.html():N);bF.domManip(bA,bE,bD)})}if(this[0]){bC=bB&&bB.parentNode;if(b.support.parentNode&&bC&&bC.nodeType===11&&bC.childNodes.length===this.length){bw={fragment:bC}}else{bw=b.buildFragment(bA,this,bu)}bz=bw.fragment;if(bz.childNodes.length===1){bx=bz=bz.firstChild}else{bx=bz.firstChild}if(bx){bE=bE&&b.nodeName(bx,"tr");for(var bv=0,e=this.length,by=e-1;bv<e;bv++){bD.call(bE?a9(this[bv],bx):this[bv],bw.cacheable||(e>1&&bv<by)?b.clone(bz,true,true):bz)}}if(bu.length){b.each(bu,bo)}}return this}});function a9(e,bu){return b.nodeName(e,"table")?(e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody"))):e}function v(e,bA){if(bA.nodeType!==1||!b.hasData(e)){return}var bz=b.expando,bw=b.data(e),bx=b.data(bA,bw);if((bw=bw[bz])){var bB=bw.events;bx=bx[bz]=b.extend({},bw);if(bB){delete bx.handle;bx.events={};for(var by in bB){for(var bv=0,bu=bB[by].length;bv<bu;bv++){b.event.add(bA,by+(bB[by][bv].namespace?".":"")+bB[by][bv].namespace,bB[by][bv],bB[by][bv].data)}}}}}function ag(bu,e){var bv;if(e.nodeType!==1){return}if(e.clearAttributes){e.clearAttributes()}if(e.mergeAttributes){e.mergeAttributes(bu)}bv=e.nodeName.toLowerCase();if(bv==="object"){e.outerHTML=bu.outerHTML}else{if(bv==="input"&&(bu.type==="checkbox"||bu.type==="radio")){if(bu.checked){e.defaultChecked=e.checked=bu.checked}if(e.value!==bu.value){e.value=bu.value}}else{if(bv==="option"){e.selected=bu.defaultSelected}else{if(bv==="input"||bv==="textarea"){e.defaultValue=bu.defaultValue}}}}e.removeAttribute(b.expando)}b.buildFragment=function(by,bw,bu){var bx,e,bv,bz;if(bw&&bw[0]){bz=bw[0].ownerDocument||bw[0]}if(!bz.createDocumentFragment){bz=at}if(by.length===1&&typeof by[0]==="string"&&by[0].length<512&&bz===at&&by[0].charAt(0)==="<"&&!R.test(by[0])&&(b.support.checkClone||!p.test(by[0]))){e=true;bv=b.fragments[by[0]];if(bv&&bv!==1){bx=bv}}if(!bx){bx=bz.createDocumentFragment();b.clean(by,bz,bx,bu)}if(e){b.fragments[by[0]]=bv?bx:1}return{fragment:bx,cacheable:e}};b.fragments={};b.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,bu){b.fn[e]=function(bv){var by=[],bB=b(bv),bA=this.length===1&&this[0].parentNode;if(bA&&bA.nodeType===11&&bA.childNodes.length===1&&bB.length===1){bB[bu](this[0]);return this}else{for(var bz=0,bw=bB.length;bz<bw;bz++){var bx=(bz>0?this.clone(true):this).get();b(bB[bz])[bu](bx);by=by.concat(bx)}return this.pushStack(by,e,bB.selector)}}});function be(e){if("getElementsByTagName" in e){return e.getElementsByTagName("*")}else{if("querySelectorAll" in e){return e.querySelectorAll("*")}else{return[]}}}function ax(e){if(e.type==="checkbox"||e.type==="radio"){e.defaultChecked=e.checked}}function H(e){if(b.nodeName(e,"input")){ax(e)}else{if("getElementsByTagName" in e){b.grep(e.getElementsByTagName("input"),ax)}}}b.extend({clone:function(bx,bz,bv){var by=bx.cloneNode(true),e,bu,bw;if((!b.support.noCloneEvent||!b.support.noCloneChecked)&&(bx.nodeType===1||bx.nodeType===11)&&!b.isXMLDoc(bx)){ag(bx,by);e=be(bx);bu=be(by);for(bw=0;e[bw];++bw){if(bu[bw]){ag(e[bw],bu[bw])}}}if(bz){v(bx,by);if(bv){e=be(bx);bu=be(by);for(bw=0;e[bw];++bw){v(e[bw],bu[bw])}}}e=bu=null;return by},clean:function(bv,bx,bG,bz){var bE;bx=bx||at;if(typeof bx.createElement==="undefined"){bx=bx.ownerDocument||bx[0]&&bx[0].ownerDocument||at}var bH=[],bA;for(var bD=0,by;(by=bv[bD])!=null;bD++){if(typeof by==="number"){by+=""}if(!by){continue}if(typeof by==="string"){if(!X.test(by)){by=bx.createTextNode(by)}else{by=by.replace(U,"<$1></$2>");var bJ=(f.exec(by)||["",""])[1].toLowerCase(),bw=av[bJ]||av._default,bC=bw[0],bu=bx.createElement("div");bu.innerHTML=bw[1]+by+bw[2];while(bC--){bu=bu.lastChild}if(!b.support.tbody){var e=z.test(by),bB=bJ==="table"&&!e?bu.firstChild&&bu.firstChild.childNodes:bw[1]==="<table>"&&!e?bu.childNodes:[];for(bA=bB.length-1;bA>=0;--bA){if(b.nodeName(bB[bA],"tbody")&&!bB[bA].childNodes.length){bB[bA].parentNode.removeChild(bB[bA])}}}if(!b.support.leadingWhitespace&&ap.test(by)){bu.insertBefore(bx.createTextNode(ap.exec(by)[0]),bu.firstChild)}by=bu.childNodes}}var bF;if(!b.support.appendChecked){if(by[0]&&typeof(bF=by.length)==="number"){for(bA=0;bA<bF;bA++){H(by[bA])}}else{H(by)}}if(by.nodeType){bH.push(by)}else{bH=b.merge(bH,by)}}if(bG){bE=function(bK){return !bK.type||bl.test(bK.type)};for(bD=0;bH[bD];bD++){if(bz&&b.nodeName(bH[bD],"script")&&(!bH[bD].type||bH[bD].type.toLowerCase()==="text/javascript")){bz.push(bH[bD].parentNode?bH[bD].parentNode.removeChild(bH[bD]):bH[bD])}else{if(bH[bD].nodeType===1){var bI=b.grep(bH[bD].getElementsByTagName("script"),bE);bH.splice.apply(bH,[bD+1,0].concat(bI))}bG.appendChild(bH[bD])}}}return bH},cleanData:function(bu){var bx,bv,e=b.cache,bC=b.expando,bA=b.event.special,bz=b.support.deleteExpando;for(var by=0,bw;(bw=bu[by])!=null;by++){if(bw.nodeName&&b.noData[bw.nodeName.toLowerCase()]){continue}bv=bw[b.expando];if(bv){bx=e[bv]&&e[bv][bC];if(bx&&bx.events){for(var bB in bx.events){if(bA[bB]){b.event.remove(bw,bB)}else{b.removeEvent(bw,bB,bx.handle)}}if(bx.handle){bx.handle.elem=null}}if(bz){delete bw[b.expando]}else{if(bw.removeAttribute){bw.removeAttribute(b.expando)}}delete e[bv]}}}});function bo(e,bu){if(bu.src){b.ajax({url:bu.src,async:false,dataType:"script"})}else{b.globalEval((bu.text||bu.textContent||bu.innerHTML||"").replace(aL,"/*$0*/"))}if(bu.parentNode){bu.parentNode.removeChild(bu)}}var ai=/alpha\([^)]*\)/i,ar=/opacity=([^)]*)/,C=/([A-Z]|^ms)/g,bb=/^-?\d+(?:px)?$/i,bn=/^-?\d/,L=/^([\-+])=([\-+.\de]+)/,a6={position:"absolute",visibility:"hidden",display:"block"},al=["Left","Right"],a1=["Top","Bottom"],Y,aG,aV;b.fn.css=function(e,bu){if(arguments.length===2&&bu===N){return this}return b.access(this,e,bu,true,function(bw,bv,bx){return bx!==N?b.style(bw,bv,bx):b.css(bw,bv)})};b.extend({cssHooks:{opacity:{get:function(bv,bu){if(bu){var e=Y(bv,"opacity","opacity");return e===""?"1":e}else{return bv.style.opacity}}}},cssNumber:{fillOpacity:true,fontWeight:true,lineHeight:true,opacity:true,orphans:true,widows:true,zIndex:true,zoom:true},cssProps:{"float":b.support.cssFloat?"cssFloat":"styleFloat"},style:function(bw,bv,bC,bx){if(!bw||bw.nodeType===3||bw.nodeType===8||!bw.style){return}var bA,bB,by=b.camelCase(bv),bu=bw.style,bD=b.cssHooks[by];bv=b.cssProps[by]||by;if(bC!==N){bB=typeof bC;if(bB==="string"&&(bA=L.exec(bC))){bC=(+(bA[1]+1)*+bA[2])+parseFloat(b.css(bw,bv));bB="number"}if(bC==null||bB==="number"&&isNaN(bC)){return}if(bB==="number"&&!b.cssNumber[by]){bC+="px"}if(!bD||!("set" in bD)||(bC=bD.set(bw,bC))!==N){try{bu[bv]=bC}catch(bz){}}}else{if(bD&&"get" in bD&&(bA=bD.get(bw,false,bx))!==N){return bA}return bu[bv]}},css:function(bx,bw,bu){var bv,e;bw=b.camelCase(bw);e=b.cssHooks[bw];bw=b.cssProps[bw]||bw;if(bw==="cssFloat"){bw="float"}if(e&&"get" in e&&(bv=e.get(bx,true,bu))!==N){return bv}else{if(Y){return Y(bx,bw)}}},swap:function(bw,bv,bx){var e={};for(var bu in bv){e[bu]=bw.style[bu];bw.style[bu]=bv[bu]}bx.call(bw);for(bu in bv){bw.style[bu]=e[bu]}}});b.curCSS=b.css;b.each(["height","width"],function(bu,e){b.cssHooks[e]={get:function(bx,bw,bv){var by;if(bw){if(bx.offsetWidth!==0){return q(bx,e,bv)}else{b.swap(bx,a6,function(){by=q(bx,e,bv)})}return by}},set:function(bv,bw){if(bb.test(bw)){bw=parseFloat(bw);if(bw>=0){return bw+"px"}}else{return bw}}}});if(!b.support.opacity){b.cssHooks.opacity={get:function(bu,e){return ar.test((e&&bu.currentStyle?bu.currentStyle.filter:bu.style.filter)||"")?(parseFloat(RegExp.$1)/100)+"":e?"1":""},set:function(bx,by){var bw=bx.style,bu=bx.currentStyle,e=b.isNaN(by)?"":"alpha(opacity="+by*100+")",bv=bu&&bu.filter||bw.filter||"";bw.zoom=1;if(by>=1&&b.trim(bv.replace(ai,""))===""){bw.removeAttribute("filter");if(bu&&!bu.filter){return}}bw.filter=ai.test(bv)?bv.replace(ai,e):bv+" "+e}}}b(function(){if(!b.support.reliableMarginRight){b.cssHooks.marginRight={get:function(bv,bu){var e;b.swap(bv,{display:"inline-block"},function(){if(bu){e=Y(bv,"margin-right","marginRight")}else{e=bv.style.marginRight}});return e}}}});if(at.defaultView&&at.defaultView.getComputedStyle){aG=function(bx,bv){var bu,bw,e;bv=bv.replace(C,"-$1").toLowerCase();if(!(bw=bx.ownerDocument.defaultView)){return N}if((e=bw.getComputedStyle(bx,null))){bu=e.getPropertyValue(bv);if(bu===""&&!b.contains(bx.ownerDocument.documentElement,bx)){bu=b.style(bx,bv)}}return bu}}if(at.documentElement.currentStyle){aV=function(bx,bv){var by,bu=bx.currentStyle&&bx.currentStyle[bv],e=bx.runtimeStyle&&bx.runtimeStyle[bv],bw=bx.style;if(!bb.test(bu)&&bn.test(bu)){by=bw.left;if(e){bx.runtimeStyle.left=bx.currentStyle.left}bw.left=bv==="fontSize"?"1em":(bu||0);bu=bw.pixelLeft+"px";bw.left=by;if(e){bx.runtimeStyle.left=e}}return bu===""?"auto":bu}}Y=aG||aV;function q(bv,bu,e){var bx=bu==="width"?bv.offsetWidth:bv.offsetHeight,bw=bu==="width"?al:a1;if(bx>0){if(e!=="border"){b.each(bw,function(){if(!e){bx-=parseFloat(b.css(bv,"padding"+this))||0}if(e==="margin"){bx+=parseFloat(b.css(bv,e+this))||0}else{bx-=parseFloat(b.css(bv,"border"+this+"Width"))||0}})}return bx+"px"}bx=Y(bv,bu,bu);if(bx<0||bx==null){bx=bv.style[bu]||0}bx=parseFloat(bx)||0;if(e){b.each(bw,function(){bx+=parseFloat(b.css(bv,"padding"+this))||0;if(e!=="padding"){bx+=parseFloat(b.css(bv,"border"+this+"Width"))||0}if(e==="margin"){bx+=parseFloat(b.css(bv,e+this))||0}})}return bx+"px"}if(b.expr&&b.expr.filters){b.expr.filters.hidden=function(bv){var bu=bv.offsetWidth,e=bv.offsetHeight;return(bu===0&&e===0)||(!b.support.reliableHiddenOffsets&&(bv.style.display||b.css(bv,"display"))==="none")};b.expr.filters.visible=function(e){return !b.expr.filters.hidden(e)}}var l=/%20/g,an=/\[\]$/,bs=/\r?\n/g,bq=/#.*$/,aB=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,aY=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,aK=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,aN=/^(?:GET|HEAD)$/,c=/^\/\//,O=/\?/,a5=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,s=/^(?:select|textarea)/i,j=/\s+/,br=/([?&])_=[^&]*/,M=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,D=b.fn.load,Z={},t={},aC,u,aR=["*/"]+["*"];try{aC=bk.href}catch(au){aC=at.createElement("a");aC.href="";aC=aC.href}u=M.exec(aC.toLowerCase())||[];function g(e){return function(bx,bz){if(typeof bx!=="string"){bz=bx;bx="*"}if(b.isFunction(bz)){var bw=bx.toLowerCase().split(j),bv=0,by=bw.length,bu,bA,bB;for(;bv<by;bv++){bu=bw[bv];bB=/^\+/.test(bu);if(bB){bu=bu.substr(1)||"*"}bA=e[bu]=e[bu]||[];bA[bB?"unshift":"push"](bz)}}}}function aT(bu,bD,by,bC,bA,bw){bA=bA||bD.dataTypes[0];bw=bw||{};bw[bA]=true;var bz=bu[bA],bv=0,e=bz?bz.length:0,bx=(bu===Z),bB;for(;bv<e&&(bx||!bB);bv++){bB=bz[bv](bD,by,bC);if(typeof bB==="string"){if(!bx||bw[bB]){bB=N}else{bD.dataTypes.unshift(bB);bB=aT(bu,bD,by,bC,bB,bw)}}}if((bx||!bB)&&!bw["*"]){bB=aT(bu,bD,by,bC,"*",bw)}return bB}function ak(bv,bw){var bu,e,bx=b.ajaxSettings.flatOptions||{};for(bu in bw){if(bw[bu]!==N){(bx[bu]?bv:(e||(e={})))[bu]=bw[bu]}}if(e){b.extend(true,bv,e)}}b.fn.extend({load:function(bv,by,bz){if(typeof bv!=="string"&&D){return D.apply(this,arguments)}else{if(!this.length){return this}}var bx=bv.indexOf(" ");if(bx>=0){var e=bv.slice(bx,bv.length);bv=bv.slice(0,bx)}var bw="GET";if(by){if(b.isFunction(by)){bz=by;by=N}else{if(typeof by==="object"){by=b.param(by,b.ajaxSettings.traditional);bw="POST"}}}var bu=this;b.ajax({url:bv,type:bw,dataType:"html",data:by,complete:function(bB,bA,bC){bC=bB.responseText;if(bB.isResolved()){bB.done(function(bD){bC=bD});bu.html(e?b("<div>").append(bC.replace(a5,"")).find(e):bC)}if(bz){bu.each(bz,[bC,bA,bB])}}});return this},serialize:function(){return b.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?b.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||s.test(this.nodeName)||aY.test(this.type))}).map(function(e,bu){var bv=b(this).val();return bv==null?null:b.isArray(bv)?b.map(bv,function(bx,bw){return{name:bu.name,value:bx.replace(bs,"\r\n")}}):{name:bu.name,value:bv.replace(bs,"\r\n")}}).get()}});b.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,bu){b.fn[bu]=function(bv){return this.bind(bu,bv)}});b.each(["get","post"],function(e,bu){b[bu]=function(bv,bx,by,bw){if(b.isFunction(bx)){bw=bw||by;by=bx;bx=N}return b.ajax({type:bu,url:bv,data:bx,success:by,dataType:bw})}});b.extend({getScript:function(e,bu){return b.get(e,N,bu,"script")},getJSON:function(e,bu,bv){return b.get(e,bu,bv,"json")},ajaxSetup:function(bu,e){if(e){ak(bu,b.ajaxSettings)}else{e=bu;bu=b.ajaxSettings}ak(bu,e);return bu},ajaxSettings:{url:aC,isLocal:aK.test(u[1]),global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":aR},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":ba.String,"text html":true,"text json":b.parseJSON,"text xml":b.parseXML},flatOptions:{context:true,url:true}},ajaxPrefilter:g(Z),ajaxTransport:g(t),ajax:function(by,bw){if(typeof by==="object"){bw=by;by=N}bw=bw||{};var bC=b.ajaxSetup({},bw),bR=bC.context||bC,bF=bR!==bC&&(bR.nodeType||bR instanceof b)?b(bR):b.event,bQ=b.Deferred(),bM=b._Deferred(),bA=bC.statusCode||{},bB,bG={},bN={},bP,bx,bK,bD,bH,bz=0,bv,bJ,bI={readyState:0,setRequestHeader:function(bS,bT){if(!bz){var e=bS.toLowerCase();bS=bN[e]=bN[e]||bS;bG[bS]=bT}return this},getAllResponseHeaders:function(){return bz===2?bP:null},getResponseHeader:function(bS){var e;if(bz===2){if(!bx){bx={};while((e=aB.exec(bP))){bx[e[1].toLowerCase()]=e[2]}}e=bx[bS.toLowerCase()]}return e===N?null:e},overrideMimeType:function(e){if(!bz){bC.mimeType=e}return this},abort:function(e){e=e||"abort";if(bK){bK.abort(e)}bE(0,e);return this}};function bE(bY,bT,bZ,bV){if(bz===2){return}bz=2;if(bD){clearTimeout(bD)}bK=N;bP=bV||"";bI.readyState=bY>0?4:0;var bS,b3,b2,bW=bT,bX=bZ?bi(bC,bI,bZ):N,bU,b1;if(bY>=200&&bY<300||bY===304){if(bC.ifModified){if((bU=bI.getResponseHeader("Last-Modified"))){b.lastModified[bB]=bU}if((b1=bI.getResponseHeader("Etag"))){b.etag[bB]=b1}}if(bY===304){bW="notmodified";bS=true}else{try{b3=I(bC,bX);bW="success";bS=true}catch(b0){bW="parsererror";b2=b0}}}else{b2=bW;if(!bW||bY){bW="error";if(bY<0){bY=0}}}bI.status=bY;bI.statusText=""+(bT||bW);if(bS){bQ.resolveWith(bR,[b3,bW,bI])}else{bQ.rejectWith(bR,[bI,bW,b2])}bI.statusCode(bA);bA=N;if(bv){bF.trigger("ajax"+(bS?"Success":"Error"),[bI,bC,bS?b3:b2])}bM.resolveWith(bR,[bI,bW]);if(bv){bF.trigger("ajaxComplete",[bI,bC]);if(!(--b.active)){b.event.trigger("ajaxStop")}}}bQ.promise(bI);bI.success=bI.done;bI.error=bI.fail;bI.complete=bM.done;bI.statusCode=function(bS){if(bS){var e;if(bz<2){for(e in bS){bA[e]=[bA[e],bS[e]]}}else{e=bS[bI.status];bI.then(e,e)}}return this};bC.url=((by||bC.url)+"").replace(bq,"").replace(c,u[1]+"//");bC.dataTypes=b.trim(bC.dataType||"*").toLowerCase().split(j);if(bC.crossDomain==null){bH=M.exec(bC.url.toLowerCase());bC.crossDomain=!!(bH&&(bH[1]!=u[1]||bH[2]!=u[2]||(bH[3]||(bH[1]==="http:"?80:443))!=(u[3]||(u[1]==="http:"?80:443))))}if(bC.data&&bC.processData&&typeof bC.data!=="string"){bC.data=b.param(bC.data,bC.traditional)}aT(Z,bC,bw,bI);if(bz===2){return false}bv=bC.global;bC.type=bC.type.toUpperCase();bC.hasContent=!aN.test(bC.type);if(bv&&b.active++===0){b.event.trigger("ajaxStart")}if(!bC.hasContent){if(bC.data){bC.url+=(O.test(bC.url)?"&":"?")+bC.data;delete bC.data}bB=bC.url;if(bC.cache===false){var bu=b.now(),bO=bC.url.replace(br,"$1_="+bu);bC.url=bO+((bO===bC.url)?(O.test(bC.url)?"&":"?")+"_="+bu:"")}}if(bC.data&&bC.hasContent&&bC.contentType!==false||bw.contentType){bI.setRequestHeader("Content-Type",bC.contentType)}if(bC.ifModified){bB=bB||bC.url;if(b.lastModified[bB]){bI.setRequestHeader("If-Modified-Since",b.lastModified[bB])}if(b.etag[bB]){bI.setRequestHeader("If-None-Match",b.etag[bB])}}bI.setRequestHeader("Accept",bC.dataTypes[0]&&bC.accepts[bC.dataTypes[0]]?bC.accepts[bC.dataTypes[0]]+(bC.dataTypes[0]!=="*"?", "+aR+"; q=0.01":""):bC.accepts["*"]);for(bJ in bC.headers){bI.setRequestHeader(bJ,bC.headers[bJ])}if(bC.beforeSend&&(bC.beforeSend.call(bR,bI,bC)===false||bz===2)){bI.abort();return false}for(bJ in {success:1,error:1,complete:1}){bI[bJ](bC[bJ])}bK=aT(t,bC,bw,bI);if(!bK){bE(-1,"No Transport")}else{bI.readyState=1;if(bv){bF.trigger("ajaxSend",[bI,bC])}if(bC.async&&bC.timeout>0){bD=setTimeout(function(){bI.abort("timeout")},bC.timeout)}try{bz=1;bK.send(bG,bE)}catch(bL){if(bz<2){bE(-1,bL)}else{b.error(bL)}}}return bI},param:function(e,bv){var bu=[],bx=function(by,bz){bz=b.isFunction(bz)?bz():bz;bu[bu.length]=encodeURIComponent(by)+"="+encodeURIComponent(bz)};if(bv===N){bv=b.ajaxSettings.traditional}if(b.isArray(e)||(e.jquery&&!b.isPlainObject(e))){b.each(e,function(){bx(this.name,this.value)})}else{for(var bw in e){y(bw,e[bw],bv,bx)}}return bu.join("&").replace(l,"+")}});function y(bv,bx,bu,bw){if(b.isArray(bx)){b.each(bx,function(bz,by){if(bu||an.test(bv)){bw(bv,by)}else{y(bv+"["+(typeof by==="object"||b.isArray(by)?bz:"")+"]",by,bu,bw)}})}else{if(!bu&&bx!=null&&typeof bx==="object"){for(var e in bx){y(bv+"["+e+"]",bx[e],bu,bw)}}else{bw(bv,bx)}}}b.extend({active:0,lastModified:{},etag:{}});function bi(bC,bB,by){var bu=bC.contents,bA=bC.dataTypes,bv=bC.responseFields,bx,bz,bw,e;for(bz in bv){if(bz in by){bB[bv[bz]]=by[bz]}}while(bA[0]==="*"){bA.shift();if(bx===N){bx=bC.mimeType||bB.getResponseHeader("content-type")}}if(bx){for(bz in bu){if(bu[bz]&&bu[bz].test(bx)){bA.unshift(bz);break}}}if(bA[0] in by){bw=bA[0]}else{for(bz in by){if(!bA[0]||bC.converters[bz+" "+bA[0]]){bw=bz;break}if(!e){e=bz}}bw=bw||e}if(bw){if(bw!==bA[0]){bA.unshift(bw)}return by[bw]}}function I(bG,by){if(bG.dataFilter){by=bG.dataFilter(by,bG.dataType)}var bC=bG.dataTypes,bF={},bz,bD,bv=bC.length,bA,bB=bC[0],bw,bx,bE,bu,e;for(bz=1;bz<bv;bz++){if(bz===1){for(bD in bG.converters){if(typeof bD==="string"){bF[bD.toLowerCase()]=bG.converters[bD]}}}bw=bB;bB=bC[bz];if(bB==="*"){bB=bw}else{if(bw!=="*"&&bw!==bB){bx=bw+" "+bB;bE=bF[bx]||bF["* "+bB];if(!bE){e=N;for(bu in bF){bA=bu.split(" ");if(bA[0]===bw||bA[0]==="*"){e=bF[bA[1]+" "+bB];if(e){bu=bF[bu];if(bu===true){bE=e}else{if(e===true){bE=bu}}break}}}}if(!(bE||e)){b.error("No conversion from "+bx.replace(" "," to "))}if(bE!==true){by=bE?bE(by):e(bu(by))}}}}return by}var aA=b.now(),x=/(\=)\?(&|$)|\?\?/i;b.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return b.expando+"_"+(aA++)}});b.ajaxPrefilter("json jsonp",function(bC,bz,bB){var bw=bC.contentType==="application/x-www-form-urlencoded"&&(typeof bC.data==="string");if(bC.dataTypes[0]==="jsonp"||bC.jsonp!==false&&(x.test(bC.url)||bw&&x.test(bC.data))){var bA,bv=bC.jsonpCallback=b.isFunction(bC.jsonpCallback)?bC.jsonpCallback():bC.jsonpCallback,by=ba[bv],e=bC.url,bx=bC.data,bu="$1"+bv+"$2";if(bC.jsonp!==false){e=e.replace(x,bu);if(bC.url===e){if(bw){bx=bx.replace(x,bu)}if(bC.data===bx){e+=(/\?/.test(e)?"&":"?")+bC.jsonp+"="+bv}}}bC.url=e;bC.data=bx;ba[bv]=function(bD){bA=[bD]};bB.always(function(){ba[bv]=by;if(bA&&b.isFunction(by)){ba[bv](bA[0])}});bC.converters["script json"]=function(){if(!bA){b.error(bv+" was not called")}return bA[0]};bC.dataTypes[0]="json";return"script"}});b.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){b.globalEval(e);return e}}});b.ajaxPrefilter("script",function(e){if(e.cache===N){e.cache=false}if(e.crossDomain){e.type="GET";e.global=false}});b.ajaxTransport("script",function(bv){if(bv.crossDomain){var e,bu=at.head||at.getElementsByTagName("head")[0]||at.documentElement;return{send:function(bw,bx){e=at.createElement("script");e.async="async";if(bv.scriptCharset){e.charset=bv.scriptCharset}e.src=bv.url;e.onload=e.onreadystatechange=function(bz,by){if(by||!e.readyState||/loaded|complete/.test(e.readyState)){e.onload=e.onreadystatechange=null;if(bu&&e.parentNode){bu.removeChild(e)}e=N;if(!by){bx(200,"success")}}};bu.insertBefore(e,bu.firstChild)},abort:function(){if(e){e.onload(0,1)}}}}});var E=ba.ActiveXObject?function(){for(var e in P){P[e](0,1)}}:false,B=0,P;function aJ(){try{return new ba.XMLHttpRequest()}catch(bu){}}function ah(){try{return new ba.ActiveXObject("Microsoft.XMLHTTP")}catch(bu){}}b.ajaxSettings.xhr=ba.ActiveXObject?function(){return !this.isLocal&&aJ()||ah()}:aJ;(function(e){b.extend(b.support,{ajax:!!e,cors:!!e&&("withCredentials" in e)})})(b.ajaxSettings.xhr());if(b.support.ajax){b.ajaxTransport(function(e){if(!e.crossDomain||b.support.cors){var bu;return{send:function(bA,bv){var bz=e.xhr(),by,bx;if(e.username){bz.open(e.type,e.url,e.async,e.username,e.password)}else{bz.open(e.type,e.url,e.async)}if(e.xhrFields){for(bx in e.xhrFields){bz[bx]=e.xhrFields[bx]}}if(e.mimeType&&bz.overrideMimeType){bz.overrideMimeType(e.mimeType)}if(!e.crossDomain&&!bA["X-Requested-With"]){bA["X-Requested-With"]="XMLHttpRequest"}try{for(bx in bA){bz.setRequestHeader(bx,bA[bx])}}catch(bw){}bz.send((e.hasContent&&e.data)||null);bu=function(bJ,bD){var bE,bC,bB,bH,bG;try{if(bu&&(bD||bz.readyState===4)){bu=N;if(by){bz.onreadystatechange=b.noop;if(E){delete P[by]}}if(bD){if(bz.readyState!==4){bz.abort()}}else{bE=bz.status;bB=bz.getAllResponseHeaders();bH={};bG=bz.responseXML;if(bG&&bG.documentElement){bH.xml=bG}bH.text=bz.responseText;try{bC=bz.statusText}catch(bI){bC=""}if(!bE&&e.isLocal&&!e.crossDomain){bE=bH.text?200:404}else{if(bE===1223){bE=204}}}}}catch(bF){if(!bD){bv(-1,bF)}}if(bH){bv(bE,bC,bH,bB)}};if(!e.async||bz.readyState===4){bu()}else{by=++B;if(E){if(!P){P={};b(ba).unload(E)}P[by]=bu}bz.onreadystatechange=bu}},abort:function(){if(bu){bu(0,1)}}}}})}var T={},a7,o,az=/^(?:toggle|show|hide)$/,aP=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,a2,aF=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],a3;b.fn.extend({show:function(bw,bz,by){var bv,bx;if(bw||bw===0){return this.animate(a0("show",3),bw,bz,by)}else{for(var bu=0,e=this.length;bu<e;bu++){bv=this[bu];if(bv.style){bx=bv.style.display;if(!b._data(bv,"olddisplay")&&bx==="none"){bx=bv.style.display=""}if(bx===""&&b.css(bv,"display")==="none"){b._data(bv,"olddisplay",A(bv.nodeName))}}}for(bu=0;bu<e;bu++){bv=this[bu];if(bv.style){bx=bv.style.display;if(bx===""||bx==="none"){bv.style.display=b._data(bv,"olddisplay")||""}}}return this}},hide:function(bv,by,bx){if(bv||bv===0){return this.animate(a0("hide",3),bv,by,bx)}else{for(var bu=0,e=this.length;bu<e;bu++){if(this[bu].style){var bw=b.css(this[bu],"display");if(bw!=="none"&&!b._data(this[bu],"olddisplay")){b._data(this[bu],"olddisplay",bw)}}}for(bu=0;bu<e;bu++){if(this[bu].style){this[bu].style.display="none"}}return this}},_toggle:b.fn.toggle,toggle:function(bv,bu,bw){var e=typeof bv==="boolean";if(b.isFunction(bv)&&b.isFunction(bu)){this._toggle.apply(this,arguments)}else{if(bv==null||e){this.each(function(){var bx=e?bv:b(this).is(":hidden");b(this)[bx?"show":"hide"]()})}else{this.animate(a0("toggle",3),bv,bu,bw)}}return this},fadeTo:function(e,bw,bv,bu){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:bw},e,bv,bu)},animate:function(bx,bu,bw,bv){var e=b.speed(bu,bw,bv);if(b.isEmptyObject(bx)){return this.each(e.complete,[false])}bx=b.extend({},bx);return this[e.queue===false?"each":"queue"](function(){if(e.queue===false){b._mark(this)}var bB=b.extend({},e),bI=this.nodeType===1,bF=bI&&b(this).is(":hidden"),by,bC,bA,bH,bG,bE,bz,bD,bJ;bB.animatedProperties={};for(bA in bx){by=b.camelCase(bA);if(bA!==by){bx[by]=bx[bA];delete bx[bA]}bC=bx[by];if(b.isArray(bC)){bB.animatedProperties[by]=bC[1];bC=bx[by]=bC[0]}else{bB.animatedProperties[by]=bB.specialEasing&&bB.specialEasing[by]||bB.easing||"swing"}if(bC==="hide"&&bF||bC==="show"&&!bF){return bB.complete.call(this)}if(bI&&(by==="height"||by==="width")){bB.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(b.css(this,"display")==="inline"&&b.css(this,"float")==="none"){if(!b.support.inlineBlockNeedsLayout){this.style.display="inline-block"}else{bH=A(this.nodeName);if(bH==="inline"){this.style.display="inline-block"}else{this.style.display="inline";this.style.zoom=1}}}}}if(bB.overflow!=null){this.style.overflow="hidden"}for(bA in bx){bG=new b.fx(this,bB,bA);bC=bx[bA];if(az.test(bC)){bG[bC==="toggle"?bF?"show":"hide":bC]()}else{bE=aP.exec(bC);bz=bG.cur();if(bE){bD=parseFloat(bE[2]);bJ=bE[3]||(b.cssNumber[bA]?"":"px");if(bJ!=="px"){b.style(this,bA,(bD||1)+bJ);bz=((bD||1)/bG.cur())*bz;b.style(this,bA,bz+bJ)}if(bE[1]){bD=((bE[1]==="-="?-1:1)*bD)+bz}bG.custom(bz,bD,bJ)}else{bG.custom(bz,bC,"")}}}return true})},stop:function(bu,e){if(bu){this.queue([])}this.each(function(){var bw=b.timers,bv=bw.length;if(!e){b._unmark(true,this)}while(bv--){if(bw[bv].elem===this){if(e){bw[bv](true)}bw.splice(bv,1)}}});if(!e){this.dequeue()}return this}});function bf(){setTimeout(aq,0);return(a3=b.now())}function aq(){a3=N}function a0(bu,e){var bv={};b.each(aF.concat.apply([],aF.slice(0,e)),function(){bv[this]=bu});return bv}b.each({slideDown:a0("show",1),slideUp:a0("hide",1),slideToggle:a0("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,bu){b.fn[e]=function(bv,bx,bw){return this.animate(bu,bv,bx,bw)}});b.extend({speed:function(bv,bw,bu){var e=bv&&typeof bv==="object"?b.extend({},bv):{complete:bu||!bu&&bw||b.isFunction(bv)&&bv,duration:bv,easing:bu&&bw||bw&&!b.isFunction(bw)&&bw};e.duration=b.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in b.fx.speeds?b.fx.speeds[e.duration]:b.fx.speeds._default;e.old=e.complete;e.complete=function(bx){if(b.isFunction(e.old)){e.old.call(this)}if(e.queue!==false){b.dequeue(this)}else{if(bx!==false){b._unmark(this)}}};return e},easing:{linear:function(bv,bw,e,bu){return e+bu*bv},swing:function(bv,bw,e,bu){return((-Math.cos(bv*Math.PI)/2)+0.5)*bu+e}},timers:[],fx:function(bu,e,bv){this.options=e;this.elem=bu;this.prop=bv;e.orig=e.orig||{}}});b.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(b.fx.step[this.prop]||b.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var e,bu=b.css(this.elem,this.prop);return isNaN(e=parseFloat(bu))?!bu||bu==="auto"?0:bu:e},custom:function(by,bx,bw){var e=this,bv=b.fx;this.startTime=a3||bf();this.start=by;this.end=bx;this.unit=bw||this.unit||(b.cssNumber[this.prop]?"":"px");this.now=this.start;this.pos=this.state=0;function bu(bz){return e.step(bz)}bu.elem=this.elem;if(bu()&&b.timers.push(bu)&&!a2){a2=setInterval(bv.tick,bv.interval)}},show:function(){this.options.orig[this.prop]=b.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());b(this.elem).show()},hide:function(){this.options.orig[this.prop]=b.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(bx){var bw=a3||bf(),e=true,by=this.elem,bu=this.options,bv,bA;if(bx||bw>=bu.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();bu.animatedProperties[this.prop]=true;for(bv in bu.animatedProperties){if(bu.animatedProperties[bv]!==true){e=false}}if(e){if(bu.overflow!=null&&!b.support.shrinkWrapBlocks){b.each(["","X","Y"],function(bB,bC){by.style["overflow"+bC]=bu.overflow[bB]})}if(bu.hide){b(by).hide()}if(bu.hide||bu.show){for(var bz in bu.animatedProperties){b.style(by,bz,bu.orig[bz])}}bu.complete.call(by)}return false}else{if(bu.duration==Infinity){this.now=bw}else{bA=bw-this.startTime;this.state=bA/bu.duration;this.pos=b.easing[bu.animatedProperties[this.prop]](this.state,bA,0,1,bu.duration);this.now=this.start+((this.end-this.start)*this.pos)}this.update()}return true}};b.extend(b.fx,{tick:function(){for(var bu=b.timers,e=0;e<bu.length;++e){if(!bu[e]()){bu.splice(e--,1)}}if(!bu.length){b.fx.stop()}},interval:13,stop:function(){clearInterval(a2);a2=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(e){b.style(e.elem,"opacity",e.now)},_default:function(e){if(e.elem.style&&e.elem.style[e.prop]!=null){e.elem.style[e.prop]=(e.prop==="width"||e.prop==="height"?Math.max(0,e.now):e.now)+e.unit}else{e.elem[e.prop]=e.now}}}});if(b.expr&&b.expr.filters){b.expr.filters.animated=function(e){return b.grep(b.timers,function(bu){return e===bu.elem}).length}}function A(bw){if(!T[bw]){var e=at.body,bu=b("<"+bw+">").appendTo(e),bv=bu.css("display");bu.remove();if(bv==="none"||bv===""){if(!a7){a7=at.createElement("iframe");a7.frameBorder=a7.width=a7.height=0}e.appendChild(a7);if(!o||!a7.createElement){o=(a7.contentWindow||a7.contentDocument).document;o.write((at.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>");o.close()}bu=o.createElement(bw);o.body.appendChild(bu);bv=b.css(bu,"display");e.removeChild(a7)}T[bw]=bv}return T[bw]}var W=/^t(?:able|d|h)$/i,ac=/^(?:body|html)$/i;if("getBoundingClientRect" in at.documentElement){b.fn.offset=function(bH){var bx=this[0],bA;if(bH){return this.each(function(e){b.offset.setOffset(this,bH,e)})}if(!bx||!bx.ownerDocument){return null}if(bx===bx.ownerDocument.body){return b.offset.bodyOffset(bx)}try{bA=bx.getBoundingClientRect()}catch(bE){}var bG=bx.ownerDocument,bv=bG.documentElement;if(!bA||!b.contains(bv,bx)){return bA?{top:bA.top,left:bA.left}:{top:0,left:0}}var bB=bG.body,bC=aI(bG),bz=bv.clientTop||bB.clientTop||0,bD=bv.clientLeft||bB.clientLeft||0,bu=bC.pageYOffset||b.support.boxModel&&bv.scrollTop||bB.scrollTop,by=bC.pageXOffset||b.support.boxModel&&bv.scrollLeft||bB.scrollLeft,bF=bA.top+bu-bz,bw=bA.left+by-bD;return{top:bF,left:bw}}}else{b.fn.offset=function(bE){var by=this[0];if(bE){return this.each(function(bF){b.offset.setOffset(this,bE,bF)})}if(!by||!by.ownerDocument){return null}if(by===by.ownerDocument.body){return b.offset.bodyOffset(by)}b.offset.initialize();var bB,bv=by.offsetParent,bu=by,bD=by.ownerDocument,bw=bD.documentElement,bz=bD.body,bA=bD.defaultView,e=bA?bA.getComputedStyle(by,null):by.currentStyle,bC=by.offsetTop,bx=by.offsetLeft;while((by=by.parentNode)&&by!==bz&&by!==bw){if(b.offset.supportsFixedPosition&&e.position==="fixed"){break}bB=bA?bA.getComputedStyle(by,null):by.currentStyle;bC-=by.scrollTop;bx-=by.scrollLeft;if(by===bv){bC+=by.offsetTop;bx+=by.offsetLeft;if(b.offset.doesNotAddBorder&&!(b.offset.doesAddBorderForTableAndCells&&W.test(by.nodeName))){bC+=parseFloat(bB.borderTopWidth)||0;bx+=parseFloat(bB.borderLeftWidth)||0}bu=bv;bv=by.offsetParent}if(b.offset.subtractsBorderForOverflowNotVisible&&bB.overflow!=="visible"){bC+=parseFloat(bB.borderTopWidth)||0;bx+=parseFloat(bB.borderLeftWidth)||0}e=bB}if(e.position==="relative"||e.position==="static"){bC+=bz.offsetTop;bx+=bz.offsetLeft}if(b.offset.supportsFixedPosition&&e.position==="fixed"){bC+=Math.max(bw.scrollTop,bz.scrollTop);bx+=Math.max(bw.scrollLeft,bz.scrollLeft)}return{top:bC,left:bx}}}b.offset={initialize:function(){var e=at.body,bu=at.createElement("div"),bx,bz,by,bA,bv=parseFloat(b.css(e,"marginTop"))||0,bw="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";b.extend(bu.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});bu.innerHTML=bw;e.insertBefore(bu,e.firstChild);bx=bu.firstChild;bz=bx.firstChild;bA=bx.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(bz.offsetTop!==5);this.doesAddBorderForTableAndCells=(bA.offsetTop===5);bz.style.position="fixed";bz.style.top="20px";this.supportsFixedPosition=(bz.offsetTop===20||bz.offsetTop===15);bz.style.position=bz.style.top="";bx.style.overflow="hidden";bx.style.position="relative";this.subtractsBorderForOverflowNotVisible=(bz.offsetTop===-5);this.doesNotIncludeMarginInBodyOffset=(e.offsetTop!==bv);e.removeChild(bu);b.offset.initialize=b.noop},bodyOffset:function(e){var bv=e.offsetTop,bu=e.offsetLeft;b.offset.initialize();if(b.offset.doesNotIncludeMarginInBodyOffset){bv+=parseFloat(b.css(e,"marginTop"))||0;bu+=parseFloat(b.css(e,"marginLeft"))||0}return{top:bv,left:bu}},setOffset:function(bw,bF,bz){var bA=b.css(bw,"position");if(bA==="static"){bw.style.position="relative"}var by=b(bw),bu=by.offset(),e=b.css(bw,"top"),bD=b.css(bw,"left"),bE=(bA==="absolute"||bA==="fixed")&&b.inArray("auto",[e,bD])>-1,bC={},bB={},bv,bx;if(bE){bB=by.position();bv=bB.top;bx=bB.left}else{bv=parseFloat(e)||0;bx=parseFloat(bD)||0}if(b.isFunction(bF)){bF=bF.call(bw,bz,bu)}if(bF.top!=null){bC.top=(bF.top-bu.top)+bv}if(bF.left!=null){bC.left=(bF.left-bu.left)+bx}if("using" in bF){bF.using.call(bw,bC)}else{by.css(bC)}}};b.fn.extend({position:function(){if(!this[0]){return null}var bv=this[0],bu=this.offsetParent(),bw=this.offset(),e=ac.test(bu[0].nodeName)?{top:0,left:0}:bu.offset();bw.top-=parseFloat(b.css(bv,"marginTop"))||0;bw.left-=parseFloat(b.css(bv,"marginLeft"))||0;e.top+=parseFloat(b.css(bu[0],"borderTopWidth"))||0;e.left+=parseFloat(b.css(bu[0],"borderLeftWidth"))||0;return{top:bw.top-e.top,left:bw.left-e.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||at.body;while(e&&(!ac.test(e.nodeName)&&b.css(e,"position")==="static")){e=e.offsetParent}return e})}});b.each(["Left","Top"],function(bu,e){var bv="scroll"+e;b.fn[bv]=function(by){var bw,bx;if(by===N){bw=this[0];if(!bw){return null}bx=aI(bw);return bx?("pageXOffset" in bx)?bx[bu?"pageYOffset":"pageXOffset"]:b.support.boxModel&&bx.document.documentElement[bv]||bx.document.body[bv]:bw[bv]}return this.each(function(){bx=aI(this);if(bx){bx.scrollTo(!bu?by:b(bx).scrollLeft(),bu?by:b(bx).scrollTop())}else{this[bv]=by}})}});function aI(e){return b.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}b.each(["Height","Width"],function(bu,e){var bv=e.toLowerCase();b.fn["inner"+e]=function(){var bw=this[0];return bw&&bw.style?parseFloat(b.css(bw,bv,"padding")):null};b.fn["outer"+e]=function(bx){var bw=this[0];return bw&&bw.style?parseFloat(b.css(bw,bv,bx?"margin":"border")):null};b.fn[bv]=function(by){var bz=this[0];if(!bz){return by==null?null:this}if(b.isFunction(by)){return this.each(function(bD){var bC=b(this);bC[bv](by.call(this,bD,bC[bv]()))})}if(b.isWindow(bz)){var bA=bz.document.documentElement["client"+e],bw=bz.document.body;return bz.document.compatMode==="CSS1Compat"&&bA||bw&&bw["client"+e]||bA}else{if(bz.nodeType===9){return Math.max(bz.documentElement["client"+e],bz.body["scroll"+e],bz.documentElement["scroll"+e],bz.body["offset"+e],bz.documentElement["offset"+e])}else{if(by===N){var bB=b.css(bz,bv),bx=parseFloat(bB);return b.isNaN(bx)?bB:bx}else{return this.css(bv,typeof by==="string"?by:by+"px")}}}}});ba.jQuery=ba.$=b})(window);(function(a){a.address=(function(){var e=function(ao){a(a.address).trigger(a.extend(a.Event(ao),(function(){var at={},ar=a.address.parameterNames();for(var aq=0,ap=ar.length;aq<ap;aq++){at[ar[aq]]=a.address.parameter(ar[aq])}return{value:a.address.value(),path:a.address.path(),pathNames:a.address.pathNames(),parameterNames:ar,parameters:at,queryString:a.address.queryString()}}).call(a.address)))},l=function(aq,ap,ao){a().bind.apply(a(a.address),Array.prototype.slice.call(arguments));return a.address},R=function(){return(af.pushState&&I.state!==M)},L=function(){return("/"+ab.pathname.replace(new RegExp(I.state),"")+ab.search+(X()?"#"+X():"")).replace(T,"/")},X=function(){var ao=ab.href.indexOf("#");return ao!=-1?H(ab.href.substr(ao+1),ag):""},D=function(){return R()?L():X()},b=function(){try{return top.document!==M?top:window}catch(ao){return window}},n=function(){return"javascript"},am=function(ao){ao=ao.toString();return(I.strict&&ao.substr(0,1)!="/"?"/":"")+ao},H=function(ao,ap){if(I.crawlable&&ap){return(ao!==""?"!":"")+ao}return ao.replace(/^\!/,"")},W=function(ao,ap){return parseInt(ao.css(ap),10)},m=function(at){var ap,ar;for(var aq=0,ao=at.childNodes.length;aq<ao;aq++){try{if("src" in at.childNodes[aq]&&at.childNodes[aq].src){ap=String(at.childNodes[aq].src)}}catch(au){}ar=m(at.childNodes[aq]);if(ar){ap=ar}}return ap},ae=function(){if(!v){var ap=D(),ao=Z!=ap;if(ao){if(j&&s<7){ab.reload()}else{if(j&&s<8&&I.history){p(J,50)}Z=ap;ac(ag)}}}},ac=function(ao){e(K);e(ao?h:al);p(A,10)},A=function(){if(I.tracker!=="null"&&I.tracker!==null){var ao=a.isFunction(I.tracker)?I.tracker:U[I.tracker],ap=(ab.pathname+ab.search+(a.address&&!R()?a.address.value():"")).replace(/\/\//,"/").replace(/^\/$/,"");if(a.isFunction(ao)){ao(ap)}else{if(a.isFunction(U.urchinTracker)){U.urchinTracker(ap)}else{if(U.pageTracker!==M&&a.isFunction(U.pageTracker._trackPageview)){U.pageTracker._trackPageview(ap)}else{if(U._gaq!==M&&a.isFunction(U._gaq.push)){U._gaq.push(["_trackPageview",decodeURI(ap)])}}}}}},J=function(){var ao=n()+":"+ag+";document.open();document.writeln('<html><head><title>"+aj.title.replace("'","\\'")+"</title><script>var "+C+' = "'+encodeURIComponent(D())+(aj.domain!=ab.hostname?'";document.domain="'+aj.domain:"")+"\";<\/script></head></html>');document.close();";if(s<7){f.src=ao}else{f.contentWindow.location.replace(ao)}},ah=function(){if(k&&c!=-1){var ap,ao=k.substr(c+1).split("&");for(i=0;i<ao.length;i++){ap=ao[i].split("=");if(/^(autoUpdate|crawlable|history|strict|wrap)$/.test(ap[0])){I[ap[0]]=(isNaN(ap[1])?/^(true|yes)$/i.test(ap[1]):(parseInt(ap[1],10)!==0))}if(/^(state|tracker)$/.test(ap[0])){I[ap[0]]=ap[1]}}k=null}Z=D()},V=function(){if(!aa){aa=G;ah();var aq=function(){z.call(this);t.call(this)},ap=a("body").ajaxComplete(aq);aq();if(I.wrap){var ar=a("body > *").wrapAll('<div style="padding:'+(W(ap,"marginTop")+W(ap,"paddingTop"))+"px "+(W(ap,"marginRight")+W(ap,"paddingRight"))+"px "+(W(ap,"marginBottom")+W(ap,"paddingBottom"))+"px "+(W(ap,"marginLeft")+W(ap,"paddingLeft"))+'px;" />').parent().wrap('<div id="'+C+'" style="height:100%;overflow:auto;position:relative;'+(u&&!window.statusbar.visible?"resize:both;":"")+'" />');a("html, body").css({height:"100%",margin:0,padding:0,overflow:"hidden"});if(u){a('<style type="text/css" />').appendTo("head").text("#"+C+"::-webkit-resizer { background-color: #fff; }")}}if(j&&s<8){var ao=aj.getElementsByTagName("frameset")[0];f=aj.createElement((ao?"":"i")+"frame");if(ao){ao.insertAdjacentElement("beforeEnd",f);ao[ao.cols?"cols":"rows"]+=",0";f.noResize=G;f.frameBorder=f.frameSpacing=0}else{f.style.display="none";f.style.width=f.style.height=0;f.tabIndex=-1;aj.body.insertAdjacentElement("afterBegin",f)}p(function(){a(f).bind("load",function(){var at=f.contentWindow;Z=at[C]!==M?at[C]:"";if(Z!=D()){ac(ag);ab.hash=H(Z,G)}});if(f.contentWindow[C]===M){J()}},50)}p(function(){e("init");ac(ag)},1);if(!R()){if((j&&s>7)||(!j&&("on"+Y) in U)){if(U.addEventListener){U.addEventListener(Y,ae,ag)}else{if(U.attachEvent){U.attachEvent("on"+Y,ae)}}}else{x(ae,50)}}}},z=function(){var ar,au=a("a"),at=au.size(),ap=1,ao=-1,aq=function(){if(++ao!=at){ar=a(au.get(ao));if(ar.is('[rel*="address:"]')){ar.address()}p(aq,ap)}};p(aq,ap)},r=function(){if(Z!=D()){Z=D();ac(ag)}},q=function(){if(U.removeEventListener){U.removeEventListener(Y,ae,ag)}else{if(U.detachEvent){U.detachEvent("on"+Y,ae)}}},t=function(){if(I.crawlable){var ap=ab.pathname.replace(/\/$/,""),ao="_escaped_fragment_";if(a("body").html().indexOf(ao)!=-1){a('a[href]:not([href^=http]), a[href*="'+document.domain+'"]').each(function(){var aq=a(this).attr("href").replace(/^http:/,"").replace(new RegExp(ap+"/?$"),"");if(aq===""||aq.indexOf(ao)!=-1){a(this).attr("href","#"+aq.replace(new RegExp("/(.*)\\?"+ao+"=(.*)$"),"!$2"))}})}}},M,C="jQueryAddress",ad="string",Y="hashchange",o="init",K="change",h="internalChange",al="externalChange",G=true,ag=false,I={autoUpdate:G,crawlable:ag,history:G,strict:G,wrap:ag},F=a.browser,s=parseFloat(a.browser.version),ai=F.mozilla,j=F.msie,Q=F.opera,u=F.webkit||F.safari,ak=ag,U=b(),aj=U.document,af=U.history,ab=U.location,x=setInterval,p=setTimeout,T=/\/{2,9}/g,an=navigator.userAgent,f,O,k=m(document),c=k?k.indexOf("?"):-1,N=aj.title,v=ag,aa=ag,S=G,P=G,B=ag,E={},Z=D();if(j){s=parseFloat(an.substr(an.indexOf("MSIE")+4));if(aj.documentMode&&aj.documentMode!=s){s=aj.documentMode!=8?7:8}var y=aj.onpropertychange;aj.onpropertychange=function(){if(y){y.call(aj)}if(aj.title!=N&&aj.title.indexOf("#"+D())!=-1){aj.title=N}}}ak=(ai&&s>=1)||(j&&s>=6)||(Q&&s>=9.5)||(u&&s>=523);if(ak){if(Q){history.navigationMode="compatible"}if(document.readyState=="complete"){var g=setInterval(function(){if(a.address){V();clearInterval(g)}},50)}else{ah();a(V)}a(window).bind("popstate",r).bind("unload",q)}else{if(!ak&&X()!==""){ab.replace(ab.href.substr(0,ab.href.indexOf("#")))}else{A()}}return{bind:function(ap,aq,ao){return l(ap,aq,ao)},init:function(ao){return l(o,ao)},change:function(ao){return l(K,ao)},internalChange:function(ao){return l(h,ao)},externalChange:function(ao){return l(al,ao)},baseURL:function(){var ao=ab.href;if(ao.indexOf("#")!=-1){ao=ao.substr(0,ao.indexOf("#"))}if(/\/$/.test(ao)){ao=ao.substr(0,ao.length-1)}return ao},autoUpdate:function(ao){if(ao!==M){I.autoUpdate=ao;return this}return I.autoUpdate},crawlable:function(ao){if(ao!==M){I.crawlable=ao;return this}return I.crawlable},history:function(ao){if(ao!==M){I.history=ao;return this}return I.history},state:function(ao){if(ao!==M){I.state=ao;var ap=L();if(I.state!==M){if(af.pushState){if(ap.substr(0,3)=="/#/"){ab.replace(I.state.replace(/^\/$/,"")+ap.substr(2))}}else{if(ap!="/"&&ap.replace(/^\/#/,"")!=X()){p(function(){ab.replace(I.state.replace(/^\/$/,"")+"/#"+ap)},1)}}}return this}return I.state},strict:function(ao){if(ao!==M){I.strict=ao;return this}return I.strict},tracker:function(ao){if(ao!==M){I.tracker=ao;return this}return I.tracker},wrap:function(ao){if(ao!==M){I.wrap=ao;return this}return I.wrap},update:function(){B=G;this.value(Z);B=ag;return this},title:function(ao){if(ao!==M){p(function(){N=aj.title=ao;if(P&&f&&f.contentWindow&&f.contentWindow.document){f.contentWindow.document.title=ao;P=ag}if(!S&&ai){ab.replace(ab.href.indexOf("#")!=-1?ab.href:ab.href+"#")}S=ag},50);return this}return aj.title},value:function(ao){if(ao!==M){ao=am(ao);if(ao=="/"){ao=""}if(Z==ao&&!B){return}S=G;Z=ao;if(I.autoUpdate||B){ac(G);if(R()){af[I.history?"pushState":"replaceState"]({},"",I.state.replace(/\/$/,"")+(Z===""?"/":Z))}else{v=G;if(u){if(I.history){ab.hash="#"+H(Z,G)}else{ab.replace("#"+H(Z,G))}}else{if(Z!=D()){if(I.history){ab.hash="#"+H(Z,G)}else{ab.replace("#"+H(Z,G))}}}if((j&&s<8)&&I.history){p(J,50)}if(u){p(function(){v=ag},1)}else{v=ag}}}return this}if(!ak){return null}return am(Z)},path:function(ap){if(ap!==M){var ao=this.queryString(),aq=this.hash();this.value(ap+(ao?"?"+ao:"")+(aq?"#"+aq:""));return this}return am(Z).split("#")[0].split("?")[0]},pathNames:function(){var ap=this.path(),ao=ap.replace(T,"/").split("/");if(ap.substr(0,1)=="/"||ap.length===0){ao.splice(0,1)}if(ap.substr(ap.length-1,1)=="/"){ao.splice(ao.length-1,1)}return ao},queryString:function(ap){if(ap!==M){var aq=this.hash();this.value(this.path()+(ap?"?"+ap:"")+(aq?"#"+aq:""));return this}var ao=Z.split("?");return ao.slice(1,ao.length).join("?").split("#")[0]},parameter:function(ap,ay,ar){var aw,au;if(ay!==M){var ax=this.parameterNames();au=[];ay=ay?ay.toString():"";for(aw=0;aw<ax.length;aw++){var at=ax[aw],az=this.parameter(at);if(typeof az==ad){az=[az]}if(at==ap){az=(ay===null||ay==="")?[]:(ar?az.concat([ay]):[ay])}for(var av=0;av<az.length;av++){au.push(at+"="+az[av])}}if(a.inArray(ap,ax)==-1&&ay!==null&&ay!==""){au.push(ap+"="+ay)}this.queryString(au.join("&"));return this}ay=this.queryString();if(ay){var ao=[];au=ay.split("&");for(aw=0;aw<au.length;aw++){var aq=au[aw].split("=");if(aq[0]==ap){ao.push(aq.slice(1).join("="))}}if(ao.length!==0){return ao.length!=1?ao:ao[0]}}},parameterNames:function(){var ao=this.queryString(),ar=[];if(ao&&ao.indexOf("=")!=-1){var at=ao.split("&");for(var aq=0;aq<at.length;aq++){var ap=at[aq].split("=")[0];if(a.inArray(ap,ar)==-1){ar.push(ap)}}}return ar},hash:function(ap){if(ap!==M){this.value(Z.split("#")[0]+(ap?"#"+ap:""));return this}var ao=Z.split("#");return ao.slice(1,ao.length).join("#")}}})();a.fn.address=function(b){if(!a(this).attr("address")){var c=function(g){if(g.shiftKey||g.ctrlKey||g.metaKey){return true}if(a(this).is("a")){var f=b?b.call(this):/address:/.test(a(this).attr("rel"))?a(this).attr("rel").split("address:")[1].split(" ")[0]:a.address.state()!==undefined&&a.address.state()!="/"?a(this).attr("href").replace(new RegExp("^(.*"+a.address.state()+"|\\.)"),""):a(this).attr("href").replace(/^(#\!?|\.)/,"");a.address.value(f);g.preventDefault()}};a(this).click(c).live("click",c).live("submit",function(h){if(a(this).is("form")){var g=a(this).attr("action"),f=b?b.call(this):(g.indexOf("?")!=-1?g.replace(/&$/,""):g+"?")+a(this).serialize();a.address.value(f);h.preventDefault()}}).attr("address",true)}return this}})(jQuery);jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,m,l){var j=1.70158;var k=0;var g=m;if(h==0){return e}if((h/=l)==1){return e+m}if(!k){k=l*0.3}if(g<Math.abs(m)){g=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/g)}return -(g*Math.pow(2,10*(h-=1))*Math.sin((h*l-j)*(2*Math.PI)/k))+e},easeOutElastic:function(f,h,e,m,l){var j=1.70158;var k=0;var g=m;if(h==0){return e}if((h/=l)==1){return e+m}if(!k){k=l*0.3}if(g<Math.abs(m)){g=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/g)}return g*Math.pow(2,-10*h)*Math.sin((h*l-j)*(2*Math.PI)/k)+m+e},easeInOutElastic:function(f,h,e,m,l){var j=1.70158;var k=0;var g=m;if(h==0){return e}if((h/=l/2)==2){return e+m}if(!k){k=l*(0.3*1.5)}if(g<Math.abs(m)){g=m;var j=k/4}else{var j=k/(2*Math.PI)*Math.asin(m/g)}if(h<1){return -0.5*(g*Math.pow(2,10*(h-=1))*Math.sin((h*l-j)*(2*Math.PI)/k))+e}return g*Math.pow(2,-10*(h-=1))*Math.sin((h*l-j)*(2*Math.PI)/k)*0.5+m+e},easeInBack:function(e,f,a,j,h,g){if(g==undefined){g=1.70158}return j*(f/=h)*f*((g+1)*f-g)+a},easeOutBack:function(e,f,a,j,h,g){if(g==undefined){g=1.70158}return j*((f=f/h-1)*f*((g+1)*f+g)+1)+a},easeInOutBack:function(e,f,a,j,h,g){if(g==undefined){g=1.70158}if((f/=h/2)<1){return j/2*(f*f*(((g*=(1.525))+1)*f-g))+a}return j/2*((f-=2)*f*(((g*=(1.525))+1)*f+g)+2)+a},easeInBounce:function(e,f,a,h,g){return h-jQuery.easing.easeOutBounce(e,g-f,0,h,g)+a},easeOutBounce:function(e,f,a,h,g){if((f/=g)<(1/2.75)){return h*(7.5625*f*f)+a}else{if(f<(2/2.75)){return h*(7.5625*(f-=(1.5/2.75))*f+0.75)+a}else{if(f<(2.5/2.75)){return h*(7.5625*(f-=(2.25/2.75))*f+0.9375)+a}else{return h*(7.5625*(f-=(2.625/2.75))*f+0.984375)+a}}}},easeInOutBounce:function(e,f,a,h,g){if(f<g/2){return jQuery.easing.easeInBounce(e,f*2,0,h,g)*0.5+a}return jQuery.easing.easeOutBounce(e,f*2-g,0,h,g)*0.5+h*0.5+a}});jQuery.noConflict();var SCALE=100;if(!("console" in window)){window.console={};window.console.log=function(a){return a}}function supports_canvas(){return !!document.createElement("canvas").getContext}if(supports_canvas()){var src='<script type="text/javascript" src="js/libs/easel.js"><\/script>';document.write(src)}var trace=function(){};var b2Settings=Class.create();b2Settings.prototype={initialize:function(){}};b2Settings.USHRT_MAX=65535;b2Settings.b2_pi=Math.PI;b2Settings.b2_massUnitsPerKilogram=1;b2Settings.b2_timeUnitsPerSecond=1;b2Settings.b2_lengthUnitsPerMeter=30;b2Settings.b2_maxManifoldPoints=2;b2Settings.b2_maxShapesPerBody=64;b2Settings.b2_maxPolyVertices=8;b2Settings.b2_maxProxies=1024;b2Settings.b2_maxPairs=8*b2Settings.b2_maxProxies;b2Settings.b2_linearSlop=0.005*b2Settings.b2_lengthUnitsPerMeter;b2Settings.b2_angularSlop=2/180*b2Settings.b2_pi;b2Settings.b2_velocityThreshold=1*b2Settings.b2_lengthUnitsPerMeter/b2Settings.b2_timeUnitsPerSecond;b2Settings.b2_maxLinearCorrection=0.2*b2Settings.b2_lengthUnitsPerMeter;b2Settings.b2_maxAngularCorrection=8/180*b2Settings.b2_pi;b2Settings.b2_contactBaumgarte=0.2;b2Settings.b2_timeToSleep=0.5*b2Settings.b2_timeUnitsPerSecond;b2Settings.b2_linearSleepTolerance=0.01*b2Settings.b2_lengthUnitsPerMeter/b2Settings.b2_timeUnitsPerSecond;b2Settings.b2_angularSleepTolerance=2/180/b2Settings.b2_timeUnitsPerSecond;b2Settings.b2Assert=function(b){if(!b){var c;c.x++}};var b2Vec2=Class.create();b2Vec2.prototype={initialize:function(a,b){this.x=a;this.y=b},SetZero:function(){this.x=0;this.y=0},Set:function(a,b){this.x=a;this.y=b},SetV:function(a){this.x=a.x;this.y=a.y},Negative:function(){return new b2Vec2(-this.x,-this.y)},Copy:function(){return new b2Vec2(this.x,this.y)},Add:function(a){this.x+=a.x;this.y+=a.y},Subtract:function(a){this.x-=a.x;this.y-=a.y},Multiply:function(b){this.x*=b;this.y*=b},MulM:function(b){var a=this.x;this.x=b.col1.x*a+b.col2.x*this.y;this.y=b.col1.y*a+b.col2.y*this.y},MulTM:function(b){var a=b2Math.b2Dot(this,b.col1);this.y=b2Math.b2Dot(this,b.col2);this.x=a},CrossVF:function(b){var a=this.x;this.x=b*this.y;this.y=-b*a},CrossFV:function(b){var a=this.x;this.x=-b*this.y;this.y=b*a},MinV:function(a){this.x=this.x<a.x?this.x:a.x;this.y=this.y<a.y?this.y:a.y},MaxV:function(a){this.x=this.x>a.x?this.x:a.x;this.y=this.y>a.y?this.y:a.y},Abs:function(){this.x=Math.abs(this.x);this.y=Math.abs(this.y)},Length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},Normalize:function(){var b=this.Length();if(b<Number.MIN_VALUE){return 0}var a=1/b;this.x*=a;this.y*=a;return b},IsValid:function(){return b2Math.b2IsValid(this.x)&&b2Math.b2IsValid(this.y)},x:null,y:null};b2Vec2.Make=function(a,b){return new b2Vec2(a,b)};var b2Mat22=Class.create();b2Mat22.prototype={initialize:function(f,e,a){if(f==null){f=0}this.col1=new b2Vec2();this.col2=new b2Vec2();if(e!=null&&a!=null){this.col1.SetV(e);this.col2.SetV(a)}else{var g=Math.cos(f);var b=Math.sin(f);this.col1.x=g;this.col2.x=-b;this.col1.y=b;this.col2.y=g}},Set:function(b){var e=Math.cos(b);var a=Math.sin(b);this.col1.x=e;this.col2.x=-a;this.col1.y=a;this.col2.y=e},SetVV:function(b,a){this.col1.SetV(b);this.col2.SetV(a)},Copy:function(){return new b2Mat22(0,this.col1,this.col2)},SetM:function(a){this.col1.SetV(a.col1);this.col2.SetV(a.col2)},AddM:function(a){this.col1.x+=a.col1.x;this.col1.y+=a.col1.y;this.col2.x+=a.col2.x;this.col2.y+=a.col2.y},SetIdentity:function(){this.col1.x=1;this.col2.x=0;this.col1.y=0;this.col2.y=1},SetZero:function(){this.col1.x=0;this.col2.x=0;this.col1.y=0;this.col2.y=0},Invert:function(g){var f=this.col1.x;var e=this.col2.x;var k=this.col1.y;var j=this.col2.y;var h=f*j-e*k;h=1/h;g.col1.x=h*j;g.col2.x=-h*e;g.col1.y=-h*k;g.col2.y=h*f;return g},Solve:function(f,j,h){var b=this.col1.x;var a=this.col2.x;var e=this.col1.y;var c=this.col2.y;var g=b*c-a*e;g=1/g;f.x=g*(c*j-a*h);f.y=g*(b*h-e*j);return f},Abs:function(){this.col1.Abs();this.col2.Abs()},col1:new b2Vec2(),col2:new b2Vec2()};var b2Math=Class.create();b2Math.prototype={initialize:function(){}};b2Math.b2IsValid=function(a){return isFinite(a)};b2Math.b2Dot=function(e,c){return e.x*c.x+e.y*c.y};b2Math.b2CrossVV=function(e,c){return e.x*c.y-e.y*c.x};b2Math.b2CrossVF=function(b,e){var c=new b2Vec2(e*b.y,-e*b.x);return c};b2Math.b2CrossFV=function(e,b){var c=new b2Vec2(-e*b.y,e*b.x);return c};b2Math.b2MulMV=function(a,b){var c=new b2Vec2(a.col1.x*b.x+a.col2.x*b.y,a.col1.y*b.x+a.col2.y*b.y);return c};b2Math.b2MulTMV=function(a,b){var c=new b2Vec2(b2Math.b2Dot(b,a.col1),b2Math.b2Dot(b,a.col2));return c};b2Math.AddVV=function(e,c){var f=new b2Vec2(e.x+c.x,e.y+c.y);return f};b2Math.SubtractVV=function(e,c){var f=new b2Vec2(e.x-c.x,e.y-c.y);return f};b2Math.MulFV=function(e,b){var c=new b2Vec2(e*b.x,e*b.y);return c};b2Math.AddMM=function(a,c){var b=new b2Mat22(0,b2Math.AddVV(a.col1,c.col1),b2Math.AddVV(a.col2,c.col2));return b};b2Math.b2MulMM=function(a,c){var b=new b2Mat22(0,b2Math.b2MulMV(a,c.col1),b2Math.b2MulMV(a,c.col2));return b};b2Math.b2MulTMM=function(a,f){var c=new b2Vec2(b2Math.b2Dot(a.col1,f.col1),b2Math.b2Dot(a.col2,f.col1));var b=new b2Vec2(b2Math.b2Dot(a.col1,f.col2),b2Math.b2Dot(a.col2,f.col2));var e=new b2Mat22(0,c,b);return e};b2Math.b2Abs=function(b){return b>0?b:-b};b2Math.b2AbsV=function(e){var c=new b2Vec2(b2Math.b2Abs(e.x),b2Math.b2Abs(e.y));return c};b2Math.b2AbsM=function(a){var b=new b2Mat22(0,b2Math.b2AbsV(a.col1),b2Math.b2AbsV(a.col2));return b};b2Math.b2Min=function(e,c){return e<c?e:c};b2Math.b2MinV=function(f,e){var g=new b2Vec2(b2Math.b2Min(f.x,e.x),b2Math.b2Min(f.y,e.y));return g};b2Math.b2Max=function(e,c){return e>c?e:c};b2Math.b2MaxV=function(f,e){var g=new b2Vec2(b2Math.b2Max(f.x,e.x),b2Math.b2Max(f.y,e.y));return g};b2Math.b2Clamp=function(c,b,e){return b2Math.b2Max(b,b2Math.b2Min(c,e))};b2Math.b2ClampV=function(c,b,e){return b2Math.b2MaxV(b,b2Math.b2MinV(c,e))};b2Math.b2Swap=function(e,c){var f=e[0];e[0]=c[0];c[0]=f};b2Math.b2Random=function(){return Math.random()*2-1};b2Math.b2NextPowerOfTwo=function(a){a|=(a>>1)&2147483647;a|=(a>>2)&1073741823;a|=(a>>4)&268435455;a|=(a>>8)&16777215;a|=(a>>16)&65535;return a+1};b2Math.b2IsPowerOfTwo=function(b){var a=b>0&&(b&(b-1))==0;return a};b2Math.tempVec2=new b2Vec2();b2Math.tempVec3=new b2Vec2();b2Math.tempVec4=new b2Vec2();b2Math.tempVec5=new b2Vec2();b2Math.tempMat=new b2Mat22();var b2AABB=Class.create();b2AABB.prototype={IsValid:function(){var b=this.maxVertex.x;var a=this.maxVertex.y;b=this.maxVertex.x;a=this.maxVertex.y;b-=this.minVertex.x;a-=this.minVertex.y;var c=b>=0&&a>=0;c=c&&this.minVertex.IsValid()&&this.maxVertex.IsValid();return c},minVertex:new b2Vec2(),maxVertex:new b2Vec2(),initialize:function(){this.minVertex=new b2Vec2();this.maxVertex=new b2Vec2()}};var b2Bound=Class.create();b2Bound.prototype={IsLower:function(){return(this.value&1)==0},IsUpper:function(){return(this.value&1)==1},Swap:function(c){var f=this.value;var e=this.proxyId;var a=this.stabbingCount;this.value=c.value;this.proxyId=c.proxyId;this.stabbingCount=c.stabbingCount;c.value=f;c.proxyId=e;c.stabbingCount=a},value:0,proxyId:0,stabbingCount:0,initialize:function(){}};var b2BoundValues=Class.create();b2BoundValues.prototype={lowerValues:[0,0],upperValues:[0,0],initialize:function(){this.lowerValues=[0,0];this.upperValues=[0,0]}};var b2Pair=Class.create();b2Pair.prototype={SetBuffered:function(){this.status|=b2Pair.e_pairBuffered},ClearBuffered:function(){this.status&=~b2Pair.e_pairBuffered},IsBuffered:function(){return(this.status&b2Pair.e_pairBuffered)==b2Pair.e_pairBuffered},SetRemoved:function(){this.status|=b2Pair.e_pairRemoved},ClearRemoved:function(){this.status&=~b2Pair.e_pairRemoved},IsRemoved:function(){return(this.status&b2Pair.e_pairRemoved)==b2Pair.e_pairRemoved},SetFinal:function(){this.status|=b2Pair.e_pairFinal},IsFinal:function(){return(this.status&b2Pair.e_pairFinal)==b2Pair.e_pairFinal},userData:null,proxyId1:0,proxyId2:0,next:0,status:0,initialize:function(){}};b2Pair.b2_nullPair=b2Settings.USHRT_MAX;b2Pair.b2_nullProxy=b2Settings.USHRT_MAX;b2Pair.b2_tableCapacity=b2Settings.b2_maxPairs;b2Pair.b2_tableMask=b2Pair.b2_tableCapacity-1;b2Pair.e_pairBuffered=1;b2Pair.e_pairRemoved=2;b2Pair.e_pairFinal=4;var b2PairCallback=Class.create();b2PairCallback.prototype={PairAdded:function(b,a){return null},PairRemoved:function(c,b,a){},initialize:function(){}};var b2BufferedPair=Class.create();b2BufferedPair.prototype={proxyId1:0,proxyId2:0,initialize:function(){}};var b2PairManager=Class.create();b2PairManager.prototype={initialize:function(){var a=0;this.m_hashTable=new Array(b2Pair.b2_tableCapacity);for(a=0;a<b2Pair.b2_tableCapacity;++a){this.m_hashTable[a]=b2Pair.b2_nullPair}this.m_pairs=new Array(b2Settings.b2_maxPairs);for(a=0;a<b2Settings.b2_maxPairs;++a){this.m_pairs[a]=new b2Pair()}this.m_pairBuffer=new Array(b2Settings.b2_maxPairs);for(a=0;a<b2Settings.b2_maxPairs;++a){this.m_pairBuffer[a]=new b2BufferedPair()}for(a=0;a<b2Settings.b2_maxPairs;++a){this.m_pairs[a].proxyId1=b2Pair.b2_nullProxy;this.m_pairs[a].proxyId2=b2Pair.b2_nullProxy;this.m_pairs[a].userData=null;this.m_pairs[a].status=0;this.m_pairs[a].next=(a+1)}this.m_pairs[b2Settings.b2_maxPairs-1].next=b2Pair.b2_nullPair;this.m_pairCount=0},Initialize:function(a,b){this.m_broadPhase=a;this.m_callback=b},AddBufferedPair:function(b,a){var c=this.AddPair(b,a);if(c.IsBuffered()==false){c.SetBuffered();this.m_pairBuffer[this.m_pairBufferCount].proxyId1=c.proxyId1;this.m_pairBuffer[this.m_pairBufferCount].proxyId2=c.proxyId2;++this.m_pairBufferCount}c.ClearRemoved();if(b2BroadPhase.s_validate){this.ValidateBuffer()}},RemoveBufferedPair:function(b,a){var c=this.Find(b,a);if(c==null){return}if(c.IsBuffered()==false){c.SetBuffered();this.m_pairBuffer[this.m_pairBufferCount].proxyId1=c.proxyId1;this.m_pairBuffer[this.m_pairBufferCount].proxyId2=c.proxyId2;++this.m_pairBufferCount}c.SetRemoved();if(b2BroadPhase.s_validate){this.ValidateBuffer()}},Commit:function(){var b=0;var f=0;var a=this.m_broadPhase.m_proxyPool;for(b=0;b<this.m_pairBufferCount;++b){var g=this.Find(this.m_pairBuffer[b].proxyId1,this.m_pairBuffer[b].proxyId2);g.ClearBuffered();var e=a[g.proxyId1];var c=a[g.proxyId2];if(g.IsRemoved()){if(g.IsFinal()==true){this.m_callback.PairRemoved(e.userData,c.userData,g.userData)}this.m_pairBuffer[f].proxyId1=g.proxyId1;this.m_pairBuffer[f].proxyId2=g.proxyId2;++f}else{if(g.IsFinal()==false){g.userData=this.m_callback.PairAdded(e.userData,c.userData);g.SetFinal()}}}for(b=0;b<f;++b){this.RemovePair(this.m_pairBuffer[b].proxyId1,this.m_pairBuffer[b].proxyId2)}this.m_pairBufferCount=0;if(b2BroadPhase.s_validate){this.ValidateTable()}},AddPair:function(b,a){if(b>a){var c=b;b=a;a=c}var e=b2PairManager.Hash(b,a)&b2Pair.b2_tableMask;var g=g=this.FindHash(b,a,e);if(g!=null){return g}var f=this.m_freePair;g=this.m_pairs[f];this.m_freePair=g.next;g.proxyId1=b;g.proxyId2=a;g.status=0;g.userData=null;g.next=this.m_hashTable[e];this.m_hashTable[e]=f;++this.m_pairCount;return g},RemovePair:function(h,g){if(h>g){var k=h;h=g;g=k}var e=b2PairManager.Hash(h,g)&b2Pair.b2_tableMask;var b=this.m_hashTable[e];var j=null;while(b!=b2Pair.b2_nullPair){if(b2PairManager.Equals(this.m_pairs[b],h,g)){var f=b;if(j){j.next=this.m_pairs[b].next}else{this.m_hashTable[e]=this.m_pairs[b].next}var c=this.m_pairs[f];var a=c.userData;c.next=this.m_freePair;c.proxyId1=b2Pair.b2_nullProxy;c.proxyId2=b2Pair.b2_nullProxy;c.userData=null;c.status=0;this.m_freePair=f;--this.m_pairCount;return a}else{j=this.m_pairs[b];b=j.next}}return null},Find:function(b,a){if(b>a){var c=b;b=a;a=c}var e=b2PairManager.Hash(b,a)&b2Pair.b2_tableMask;return this.FindHash(b,a,e)},FindHash:function(b,a,e){var c=this.m_hashTable[e];while(c!=b2Pair.b2_nullPair&&b2PairManager.Equals(this.m_pairs[c],b,a)==false){c=this.m_pairs[c].next}if(c==b2Pair.b2_nullPair){return null}return this.m_pairs[c]},ValidateBuffer:function(){},ValidateTable:function(){},m_broadPhase:null,m_callback:null,m_pairs:null,m_freePair:0,m_pairCount:0,m_pairBuffer:null,m_pairBufferCount:0,m_hashTable:null};b2PairManager.Hash=function(b,a){var c=((a<<16)&4294901760)|b;c=~c+((c<<15)&4294934528);c=c^((c>>12)&1048575);c=c+((c<<2)&4294967292);c=c^((c>>4)&268435455);c=c*2057;c=c^((c>>16)&65535);return c};b2PairManager.Equals=function(c,b,a){return(c.proxyId1==b&&c.proxyId2==a)};b2PairManager.EqualsPair=function(b,a){return b.proxyId1==a.proxyId1&&b.proxyId2==a.proxyId2};var b2BroadPhase=Class.create();b2BroadPhase.prototype={initialize:function(g,h){this.m_pairManager=new b2PairManager();this.m_proxyPool=new Array(b2Settings.b2_maxPairs);this.m_bounds=new Array(2*b2Settings.b2_maxProxies);this.m_queryResults=new Array(b2Settings.b2_maxProxies);this.m_quantizationFactor=new b2Vec2();var e=0;this.m_pairManager.Initialize(this,h);this.m_worldAABB=g;this.m_proxyCount=0;for(e=0;e<b2Settings.b2_maxProxies;e++){this.m_queryResults[e]=0}this.m_bounds=new Array(2);for(e=0;e<2;e++){this.m_bounds[e]=new Array(2*b2Settings.b2_maxProxies);for(var c=0;c<2*b2Settings.b2_maxProxies;c++){this.m_bounds[e][c]=new b2Bound()}}var b=g.maxVertex.x;var a=g.maxVertex.y;b-=g.minVertex.x;a-=g.minVertex.y;this.m_quantizationFactor.x=b2Settings.USHRT_MAX/b;this.m_quantizationFactor.y=b2Settings.USHRT_MAX/a;var f;for(e=0;e<b2Settings.b2_maxProxies-1;++e){f=new b2Proxy();this.m_proxyPool[e]=f;f.SetNext(e+1);f.timeStamp=0;f.overlapCount=b2BroadPhase.b2_invalid;f.userData=null}f=new b2Proxy();this.m_proxyPool[b2Settings.b2_maxProxies-1]=f;f.SetNext(b2Pair.b2_nullProxy);f.timeStamp=0;f.overlapCount=b2BroadPhase.b2_invalid;f.userData=null;this.m_freeProxy=0;this.m_timeStamp=1;this.m_queryResultCount=0},InRange:function(c){var b;var a;var f;var e;b=c.minVertex.x;a=c.minVertex.y;b-=this.m_worldAABB.maxVertex.x;a-=this.m_worldAABB.maxVertex.y;f=this.m_worldAABB.minVertex.x;e=this.m_worldAABB.minVertex.y;f-=c.maxVertex.x;e-=c.maxVertex.y;b=b2Math.b2Max(b,f);a=b2Math.b2Max(a,e);return b2Math.b2Max(b,a)<0},GetProxy:function(a){if(a==b2Pair.b2_nullProxy||this.m_proxyPool[a].IsValid()==false){return null}return this.m_proxyPool[a]},CreateProxy:function(g,k){var e=0;var v;var y=this.m_freeProxy;v=this.m_proxyPool[y];this.m_freeProxy=v.GetNext();v.overlapCount=0;v.userData=k;var o=2*this.m_proxyCount;var m=new Array();var c=new Array();this.ComputeBounds(m,c,g);for(var b=0;b<2;++b){var f=this.m_bounds[b];var n=0;var s=0;var h=[n];var l=[s];this.Query(h,l,m[b],c[b],f,o,b);n=h[0];s=l[0];var p=new Array();var t=0;var x=o-s;var r;var q;for(t=0;t<x;t++){p[t]=new b2Bound();r=p[t];q=f[s+t];r.value=q.value;r.proxyId=q.proxyId;r.stabbingCount=q.stabbingCount}x=p.length;var z=s+2;for(t=0;t<x;t++){q=p[t];r=f[z+t];r.value=q.value;r.proxyId=q.proxyId;r.stabbingCount=q.stabbingCount}p=new Array();x=s-n;for(t=0;t<x;t++){p[t]=new b2Bound();r=p[t];q=f[n+t];r.value=q.value;r.proxyId=q.proxyId;r.stabbingCount=q.stabbingCount}x=p.length;z=n+1;for(t=0;t<x;t++){q=p[t];r=f[z+t];r.value=q.value;r.proxyId=q.proxyId;r.stabbingCount=q.stabbingCount}++s;f[n].value=m[b];f[n].proxyId=y;f[s].value=c[b];f[s].proxyId=y;f[n].stabbingCount=n==0?0:f[n-1].stabbingCount;f[s].stabbingCount=f[s-1].stabbingCount;for(e=n;e<s;++e){f[e].stabbingCount++}for(e=n;e<o+2;++e){var a=this.m_proxyPool[f[e].proxyId];if(f[e].IsLower()){a.lowerBounds[b]=e}else{a.upperBounds[b]=e}}}++this.m_proxyCount;for(var u=0;u<this.m_queryResultCount;++u){this.m_pairManager.AddBufferedPair(y,this.m_queryResults[u])}this.m_pairManager.Commit();this.m_queryResultCount=0;this.IncrementTimeStamp();return y},DestroyProxy:function(t){var r=this.m_proxyPool[t];var k=2*this.m_proxyCount;for(var c=0;c<2;++c){var g=this.m_bounds[c];var h=r.lowerBounds[c];var o=r.upperBounds[c];var v=g[h].value;var a=g[o].value;var l=new Array();var p=0;var s=o-h-1;var n;var m;for(p=0;p<s;p++){l[p]=new b2Bound();n=l[p];m=g[h+1+p];n.value=m.value;n.proxyId=m.proxyId;n.stabbingCount=m.stabbingCount}s=l.length;var u=h;for(p=0;p<s;p++){m=l[p];n=g[u+p];n.value=m.value;n.proxyId=m.proxyId;n.stabbingCount=m.stabbingCount}l=new Array();s=k-o-1;for(p=0;p<s;p++){l[p]=new b2Bound();n=l[p];m=g[o+1+p];n.value=m.value;n.proxyId=m.proxyId;n.stabbingCount=m.stabbingCount}s=l.length;u=o-1;for(p=0;p<s;p++){m=l[p];n=g[u+p];n.value=m.value;n.proxyId=m.proxyId;n.stabbingCount=m.stabbingCount}s=k-2;for(var f=h;f<s;++f){var b=this.m_proxyPool[g[f].proxyId];if(g[f].IsLower()){b.lowerBounds[c]=f}else{b.upperBounds[c]=f}}s=o-1;for(var e=h;e<s;++e){g[e].stabbingCount--}this.Query([0],[0],v,a,g,k-2,c)}for(var q=0;q<this.m_queryResultCount;++q){this.m_pairManager.RemoveBufferedPair(t,this.m_queryResults[q])}this.m_pairManager.Commit();this.m_queryResultCount=0;this.IncrementTimeStamp();r.userData=null;r.overlapCount=b2BroadPhase.b2_invalid;r.lowerBounds[0]=b2BroadPhase.b2_invalid;r.lowerBounds[1]=b2BroadPhase.b2_invalid;r.upperBounds[0]=b2BroadPhase.b2_invalid;r.upperBounds[1]=b2BroadPhase.b2_invalid;r.SetNext(this.m_freeProxy);this.m_freeProxy=t;--this.m_proxyCount},MoveProxy:function(r,k){var e=0;var h=0;var a;var c;var f;var l=0;var t;if(r==b2Pair.b2_nullProxy||b2Settings.b2_maxProxies<=r){return}if(k.IsValid()==false){return}var n=2*this.m_proxyCount;var p=this.m_proxyPool[r];var g=new b2BoundValues();this.ComputeBounds(g.lowerValues,g.upperValues,k);var u=new b2BoundValues();for(e=0;e<2;++e){u.lowerValues[e]=this.m_bounds[e][p.lowerBounds[e]].value;u.upperValues[e]=this.m_bounds[e][p.upperBounds[e]].value}for(e=0;e<2;++e){var j=this.m_bounds[e];var m=p.lowerBounds[e];var o=p.upperBounds[e];var v=g.lowerValues[e];var b=g.upperValues[e];var y=v-j[m].value;var s=b-j[o].value;j[m].value=v;j[o].value=b;if(y<0){h=m;while(h>0&&v<j[h-1].value){a=j[h];c=j[h-1];var x=c.proxyId;var q=this.m_proxyPool[c.proxyId];c.stabbingCount++;if(c.IsUpper()==true){if(this.TestOverlap(g,q)){this.m_pairManager.AddBufferedPair(r,x)}q.upperBounds[e]++;a.stabbingCount++}else{q.lowerBounds[e]++;a.stabbingCount--}p.lowerBounds[e]--;a.Swap(c);--h}}if(s>0){h=o;while(h<n-1&&j[h+1].value<=b){a=j[h];f=j[h+1];l=f.proxyId;t=this.m_proxyPool[l];f.stabbingCount++;if(f.IsLower()==true){if(this.TestOverlap(g,t)){this.m_pairManager.AddBufferedPair(r,l)}t.lowerBounds[e]--;a.stabbingCount++}else{t.upperBounds[e]--;a.stabbingCount--}p.upperBounds[e]++;a.Swap(f);h++}}if(y>0){h=m;while(h<n-1&&j[h+1].value<=v){a=j[h];f=j[h+1];l=f.proxyId;t=this.m_proxyPool[l];f.stabbingCount--;if(f.IsUpper()){if(this.TestOverlap(u,t)){this.m_pairManager.RemoveBufferedPair(r,l)}t.upperBounds[e]--;a.stabbingCount--}else{t.lowerBounds[e]--;a.stabbingCount++}p.lowerBounds[e]++;a.Swap(f);h++}}if(s<0){h=o;while(h>0&&b<j[h-1].value){a=j[h];c=j[h-1];x=c.proxyId;q=this.m_proxyPool[x];c.stabbingCount--;if(c.IsLower()==true){if(this.TestOverlap(u,q)){this.m_pairManager.RemoveBufferedPair(r,x)}q.lowerBounds[e]++;a.stabbingCount--}else{q.upperBounds[e]++;a.stabbingCount++}p.upperBounds[e]--;a.Swap(c);h--}}}},Commit:function(){this.m_pairManager.Commit()},QueryAABB:function(g,b,c){var k=new Array();var h=new Array();this.ComputeBounds(k,h,g);var a=0;var l=0;var e=[a];var n=[l];this.Query(e,n,k[0],h[0],this.m_bounds[0],2*this.m_proxyCount,0);this.Query(e,n,k[1],h[1],this.m_bounds[1],2*this.m_proxyCount,1);var j=0;for(var f=0;f<this.m_queryResultCount&&j<c;++f,++j){var m=this.m_proxyPool[this.m_queryResults[f]];b[f]=m.userData}this.m_queryResultCount=0;this.IncrementTimeStamp();return j},Validate:function(){var g;var f;var c;var k;for(var b=0;b<2;++b){var a=this.m_bounds[b];var l=2*this.m_proxyCount;var j=0;for(var h=0;h<l;++h){var e=a[h];if(e.IsLower()==true){j++}else{j--}}}},ComputeBounds:function(e,h,a){var c=a.minVertex.x;var b=a.minVertex.y;c=b2Math.b2Min(c,this.m_worldAABB.maxVertex.x);b=b2Math.b2Min(b,this.m_worldAABB.maxVertex.y);c=b2Math.b2Max(c,this.m_worldAABB.minVertex.x);b=b2Math.b2Max(b,this.m_worldAABB.minVertex.y);var g=a.maxVertex.x;var f=a.maxVertex.y;g=b2Math.b2Min(g,this.m_worldAABB.maxVertex.x);f=b2Math.b2Min(f,this.m_worldAABB.maxVertex.y);g=b2Math.b2Max(g,this.m_worldAABB.minVertex.x);f=b2Math.b2Max(f,this.m_worldAABB.minVertex.y);e[0]=(this.m_quantizationFactor.x*(c-this.m_worldAABB.minVertex.x))&(b2Settings.USHRT_MAX-1);h[0]=((this.m_quantizationFactor.x*(g-this.m_worldAABB.minVertex.x))&65535)|1;e[1]=(this.m_quantizationFactor.y*(b-this.m_worldAABB.minVertex.y))&(b2Settings.USHRT_MAX-1);h[1]=((this.m_quantizationFactor.y*(f-this.m_worldAABB.minVertex.y))&65535)|1},TestOverlapValidate:function(e,c){for(var a=0;a<2;++a){var b=this.m_bounds[a];if(b[e.lowerBounds[a]].value>b[c.upperBounds[a]].value){return false}if(b[e.upperBounds[a]].value<b[c.lowerBounds[a]].value){return false}}return true},TestOverlap:function(a,f){for(var c=0;c<2;++c){var e=this.m_bounds[c];if(a.lowerValues[c]>e[f.upperBounds[c]].value){return false}if(a.upperValues[c]<e[f.lowerBounds[c]].value){return false}}return true},Query:function(k,e,g,n,a,p,b){var c=b2BroadPhase.BinarySearch(a,p,g);var m=b2BroadPhase.BinarySearch(a,p,n);for(var f=c;f<m;++f){if(a[f].IsLower()){this.IncrementOverlapCount(a[f].proxyId)}}if(c>0){var h=c-1;var o=a[h].stabbingCount;while(o){if(a[h].IsLower()){var l=this.m_proxyPool[a[h].proxyId];if(c<=l.upperBounds[b]){this.IncrementOverlapCount(a[h].proxyId);--o}}--h}}k[0]=c;e[0]=m},IncrementOverlapCount:function(b){var a=this.m_proxyPool[b];if(a.timeStamp<this.m_timeStamp){a.timeStamp=this.m_timeStamp;a.overlapCount=1}else{a.overlapCount=2;this.m_queryResults[this.m_queryResultCount]=b;++this.m_queryResultCount}},IncrementTimeStamp:function(){if(this.m_timeStamp==b2Settings.USHRT_MAX){for(var a=0;a<b2Settings.b2_maxProxies;++a){this.m_proxyPool[a].timeStamp=0}this.m_timeStamp=1}else{++this.m_timeStamp}},m_pairManager:new b2PairManager(),m_proxyPool:new Array(b2Settings.b2_maxPairs),m_freeProxy:0,m_bounds:new Array(2*b2Settings.b2_maxProxies),m_queryResults:new Array(b2Settings.b2_maxProxies),m_queryResultCount:0,m_worldAABB:null,m_quantizationFactor:new b2Vec2(),m_proxyCount:0,m_timeStamp:0};b2BroadPhase.s_validate=false;b2BroadPhase.b2_invalid=b2Settings.USHRT_MAX;b2BroadPhase.b2_nullEdge=b2Settings.USHRT_MAX;b2BroadPhase.BinarySearch=function(e,c,g){var a=0;var f=c-1;while(a<=f){var b=Math.floor((a+f)/2);if(e[b].value>g){f=b-1}else{if(e[b].value<g){a=b+1}else{return(b)}}}return(a)};var b2Collision=Class.create();b2Collision.prototype={initialize:function(){}};b2Collision.b2_nullFeature=255;b2Collision.ClipSegmentToLine=function(g,b,f,a){var c=0;var k=b[0].v;var j=b[1].v;var h=b2Math.b2Dot(f,b[0].v)-a;var e=b2Math.b2Dot(f,b[1].v)-a;if(h<=0){g[c++]=b[0]}if(e<=0){g[c++]=b[1]}if(h*e<0){var l=h/(h-e);var m=g[c].v;m.x=k.x+l*(j.x-k.x);m.y=k.y+l*(j.y-k.y);if(h>0){g[c].id=b[0].id}else{g[c].id=b[1].id}++c}return c};b2Collision.EdgeSeparation=function(q,r,p){var g=q.m_vertices;var h=p.m_vertexCount;var s=p.m_vertices;var f=q.m_normals[r].x;var e=q.m_normals[r].y;var t=f;var m=q.m_R;f=m.col1.x*t+m.col2.x*e;e=m.col1.y*t+m.col2.y*e;var x=f;var v=e;m=p.m_R;t=x*m.col1.x+v*m.col1.y;v=x*m.col2.x+v*m.col2.y;x=t;var o=0;var n=Number.MAX_VALUE;for(var y=0;y<h;++y){var c=s[y];var u=c.x*x+c.y*v;if(u<n){n=u;o=y}}m=q.m_R;var b=q.m_position.x+(m.col1.x*g[r].x+m.col2.x*g[r].y);var a=q.m_position.y+(m.col1.y*g[r].x+m.col2.y*g[r].y);m=p.m_R;var l=p.m_position.x+(m.col1.x*s[o].x+m.col2.x*s[o].y);var j=p.m_position.y+(m.col1.y*s[o].x+m.col2.y*s[o].y);l-=b;j-=a;var k=l*f+j*e;return k};b2Collision.FindMaxSeparation=function(t,n,m,y){var k=n.m_vertexCount;var e=m.m_position.x-n.m_position.x;var c=m.m_position.y-n.m_position.y;var g=(e*n.m_R.col1.x+c*n.m_R.col1.y);var f=(e*n.m_R.col2.x+c*n.m_R.col2.y);var j=0;var a=-Number.MAX_VALUE;for(var q=0;q<k;++q){var p=(n.m_normals[q].x*g+n.m_normals[q].y*f);if(p>a){a=p;j=q}}var o=b2Collision.EdgeSeparation(n,j,m);if(o>0&&y==false){return o}var h=j-1>=0?j-1:k-1;var u=b2Collision.EdgeSeparation(n,h,m);if(u>0&&y==false){return u}var r=j+1<k?j+1:0;var v=b2Collision.EdgeSeparation(n,r,m);if(v>0&&y==false){return v}var b=0;var l;var x=0;if(u>o&&u>v){x=-1;b=h;l=u}else{if(v>o){x=1;b=r;l=v}else{t[0]=j;return o}}while(true){if(x==-1){j=b-1>=0?b-1:k-1}else{j=b+1<k?b+1:0}o=b2Collision.EdgeSeparation(n,j,m);if(o>0&&y==false){return o}if(o>l){b=j;l=o}else{break}}t[0]=b;return l};b2Collision.FindIncidentEdge=function(F,q,r,o){var j=q.m_vertexCount;var g=q.m_vertices;var h=o.m_vertexCount;var t=o.m_vertices;var a=r;var H=r+1==j?0:r+1;var f=g[H];var E=f.x;var C=f.y;f=g[a];E-=f.x;C-=f.y;var x=E;E=C;C=-x;var G=1/Math.sqrt(E*E+C*C);E*=G;C*=G;var s=E;var p=C;x=s;var m=q.m_R;s=m.col1.x*x+m.col2.x*p;p=m.col1.y*x+m.col2.y*p;var e=s;var b=p;m=o.m_R;x=e*m.col1.x+b*m.col1.y;b=e*m.col2.x+b*m.col2.y;e=x;var l=0;var k=0;var n=Number.MAX_VALUE;for(var D=0;D<h;++D){var B=D;var A=D+1<h?D+1:0;f=t[A];var v=f.x;var u=f.y;f=t[B];v-=f.x;u-=f.y;x=v;v=u;u=-x;G=1/Math.sqrt(v*v+u*u);v*=G;u*=G;var y=v*e+u*b;if(y<n){n=y;l=B;k=A}}var z;z=F[0];f=z.v;f.SetV(t[l]);f.MulM(o.m_R);f.Add(o.m_position);z.id.features.referenceFace=r;z.id.features.incidentEdge=l;z.id.features.incidentVertex=l;z=F[1];f=z.v;f.SetV(t[k]);f.MulM(o.m_R);f.Add(o.m_position);z.id.features.referenceFace=r;z.id.features.incidentEdge=l;z.id.features.incidentVertex=k};b2Collision.b2CollidePolyTempVec=new b2Vec2();b2Collision.b2CollidePoly=function(y,l,k,b){y.pointCount=0;var O=0;var I=[O];var H=b2Collision.FindMaxSeparation(I,l,k,b);O=I[0];if(H>0&&b==false){return}var M=0;var h=[M];var G=b2Collision.FindMaxSeparation(h,k,l,b);M=h[0];if(G>0&&b==false){return}var q;var p;var a=0;var T=0;var e=0.98;var Q=0.001;if(G>e*H+Q){q=k;p=l;a=M;T=1}else{q=l;p=k;a=O;T=0}var c=[new ClipVertex(),new ClipVertex()];b2Collision.FindIncidentEdge(c,q,a,p);var D=q.m_vertexCount;var r=q.m_vertices;var K=r[a];var J=a+1<D?r[a+1]:r[0];var V=J.x-K.x;var U=J.y-K.y;var g=J.x-K.x;var f=J.y-K.y;var j=g;var L=q.m_R;g=L.col1.x*j+L.col2.x*f;f=L.col1.y*j+L.col2.y*f;var t=1/Math.sqrt(g*g+f*f);g*=t;f*=t;var o=g;var n=f;j=o;o=n;n=-j;var P=K.x;var N=K.y;j=P;L=q.m_R;P=L.col1.x*j+L.col2.x*N;N=L.col1.y*j+L.col2.y*N;P+=q.m_position.x;N+=q.m_position.y;var x=J.x;var v=J.y;j=x;L=q.m_R;x=L.col1.x*j+L.col2.x*v;v=L.col1.y*j+L.col2.y*v;x+=q.m_position.x;v+=q.m_position.y;var E=o*P+n*N;var C=-(g*P+f*N);var B=g*x+f*v;var A=[new ClipVertex(),new ClipVertex()];var z=[new ClipVertex(),new ClipVertex()];var S=0;b2Collision.b2CollidePolyTempVec.Set(-g,-f);S=b2Collision.ClipSegmentToLine(A,c,b2Collision.b2CollidePolyTempVec,C);if(S<2){return}b2Collision.b2CollidePolyTempVec.Set(g,f);S=b2Collision.ClipSegmentToLine(z,A,b2Collision.b2CollidePolyTempVec,B);if(S<2){return}if(T){y.normal.Set(-o,-n)}else{y.normal.Set(o,n)}var s=0;for(var R=0;R<b2Settings.b2_maxManifoldPoints;++R){var F=z[R].v;var m=(o*F.x+n*F.y)-E;if(m<=0||b==true){var u=y.points[s];u.separation=m;u.position.SetV(z[R].v);u.id.Set(z[R].id);u.id.features.flip=T;++s}}y.pointCount=s};b2Collision.b2CollideCircle=function(j,k,g,b){j.pointCount=0;var h=g.m_position.x-k.m_position.x;var f=g.m_position.y-k.m_position.y;var o=h*h+f*f;var n=k.m_radius+g.m_radius;if(o>n*n&&b==false){return}var e;if(o<Number.MIN_VALUE){e=-n;j.normal.Set(0,1)}else{var l=Math.sqrt(o);e=l-n;var m=1/l;j.normal.x=m*h;j.normal.y=m*f}j.pointCount=1;var c=j.points[0];c.id.set_key(0);c.separation=e;c.position.x=g.m_position.x-(g.m_radius*j.normal.x);c.position.y=g.m_position.y-(g.m_radius*j.normal.y)};b2Collision.b2CollidePolyAndCircle=function(z,n,l,E){z.pointCount=0;var j;var f;var e;var B=l.m_position.x-n.m_position.x;var A=l.m_position.y-n.m_position.y;var o=n.m_R;var x=B*o.col1.x+A*o.col1.y;A=B*o.col2.x+A*o.col2.y;B=x;var y;var D=0;var p=-Number.MAX_VALUE;var h=l.m_radius;for(var C=0;C<n.m_vertexCount;++C){var v=n.m_normals[C].x*(B-n.m_vertices[C].x)+n.m_normals[C].y*(A-n.m_vertices[C].y);if(v>h){return}if(v>p){p=v;D=C}}if(p<Number.MIN_VALUE){z.pointCount=1;var c=n.m_normals[D];z.normal.x=o.col1.x*c.x+o.col2.x*c.y;z.normal.y=o.col1.y*c.x+o.col2.y*c.y;j=z.points[0];j.id.features.incidentEdge=D;j.id.features.incidentVertex=b2Collision.b2_nullFeature;j.id.features.referenceFace=b2Collision.b2_nullFeature;j.id.features.flip=0;j.position.x=l.m_position.x-h*z.normal.x;j.position.y=l.m_position.y-h*z.normal.y;j.separation=p-h;return}var b=D;var a=b+1<n.m_vertexCount?b+1:0;var t=n.m_vertices[a].x-n.m_vertices[b].x;var q=n.m_vertices[a].y-n.m_vertices[b].y;var g=Math.sqrt(t*t+q*q);t/=g;q/=g;if(g<Number.MIN_VALUE){f=B-n.m_vertices[b].x;e=A-n.m_vertices[b].y;y=Math.sqrt(f*f+e*e);f/=y;e/=y;if(y>h){return}z.pointCount=1;z.normal.Set(o.col1.x*f+o.col2.x*e,o.col1.y*f+o.col2.y*e);j=z.points[0];j.id.features.incidentEdge=b2Collision.b2_nullFeature;j.id.features.incidentVertex=b;j.id.features.referenceFace=b2Collision.b2_nullFeature;j.id.features.flip=0;j.position.x=l.m_position.x-h*z.normal.x;j.position.y=l.m_position.y-h*z.normal.y;j.separation=y-h;return}var r=(B-n.m_vertices[b].x)*t+(A-n.m_vertices[b].y)*q;j=z.points[0];j.id.features.incidentEdge=b2Collision.b2_nullFeature;j.id.features.incidentVertex=b2Collision.b2_nullFeature;j.id.features.referenceFace=b2Collision.b2_nullFeature;j.id.features.flip=0;var m,k;if(r<=0){m=n.m_vertices[b].x;k=n.m_vertices[b].y;j.id.features.incidentVertex=b}else{if(r>=g){m=n.m_vertices[a].x;k=n.m_vertices[a].y;j.id.features.incidentVertex=a}else{m=t*r+n.m_vertices[b].x;k=q*r+n.m_vertices[b].y;j.id.features.incidentEdge=b}}f=B-m;e=A-k;y=Math.sqrt(f*f+e*e);f/=y;e/=y;if(y>h){return}z.pointCount=1;z.normal.Set(o.col1.x*f+o.col2.x*e,o.col1.y*f+o.col2.y*e);j.position.x=l.m_position.x-h*z.normal.x;j.position.y=l.m_position.y-h*z.normal.y;j.separation=y-h};b2Collision.b2TestOverlap=function(e,c){var k=c.minVertex;var h=e.maxVertex;var g=k.x-h.x;var f=k.y-h.y;k=e.minVertex;h=c.maxVertex;var l=k.x-h.x;var j=k.y-h.y;if(g>0||f>0){return false}if(l>0||j>0){return false}return true};var Features=Class.create();Features.prototype={set_referenceFace:function(a){this._referenceFace=a;this._m_id._key=(this._m_id._key&4294967040)|(this._referenceFace&255)},get_referenceFace:function(){return this._referenceFace},_referenceFace:0,set_incidentEdge:function(a){this._incidentEdge=a;this._m_id._key=(this._m_id._key&4294902015)|((this._incidentEdge<<8)&65280)},get_incidentEdge:function(){return this._incidentEdge},_incidentEdge:0,set_incidentVertex:function(a){this._incidentVertex=a;this._m_id._key=(this._m_id._key&4278255615)|((this._incidentVertex<<16)&16711680)},get_incidentVertex:function(){return this._incidentVertex},_incidentVertex:0,set_flip:function(a){this._flip=a;this._m_id._key=(this._m_id._key&16777215)|((this._flip<<24)&4278190080)},get_flip:function(){return this._flip},_flip:0,_m_id:null,initialize:function(){}};var b2ContactID=Class.create();b2ContactID.prototype={initialize:function(){this.features=new Features();this.features._m_id=this},Set:function(a){this.set_key(a._key)},Copy:function(){var a=new b2ContactID();a.set_key(this._key);return a},get_key:function(){return this._key},set_key:function(a){this._key=a;this.features._referenceFace=this._key&255;this.features._incidentEdge=((this._key&65280)>>8)&255;this.features._incidentVertex=((this._key&16711680)>>16)&255;this.features._flip=((this._key&4278190080)>>24)&255},features:new Features(),_key:0};var b2ContactPoint=Class.create();b2ContactPoint.prototype={position:new b2Vec2(),separation:null,normalImpulse:null,tangentImpulse:null,id:new b2ContactID(),initialize:function(){this.position=new b2Vec2();this.id=new b2ContactID()}};var b2Distance=Class.create();b2Distance.prototype={initialize:function(){}};b2Distance.ProcessTwo=function(l,j,b,m,k){var g=-k[1].x;var f=-k[1].y;var e=k[0].x-k[1].x;var c=k[0].y-k[1].y;var a=Math.sqrt(e*e+c*c);e/=a;c/=a;var h=g*e+f*c;if(h<=0||a<Number.MIN_VALUE){l.SetV(b[1]);j.SetV(m[1]);b[0].SetV(b[1]);m[0].SetV(m[1]);k[0].SetV(k[1]);return 1}h/=a;l.x=b[1].x+h*(b[0].x-b[1].x);l.y=b[1].y+h*(b[0].y-b[1].y);j.x=m[1].x+h*(m[0].x-m[1].x);j.y=m[1].y+h*(m[0].y-m[1].y);return 2};b2Distance.ProcessThree=function(s,F,p,E,I){var m=I[0].x;var j=I[0].y;var B=I[1].x;var x=I[1].y;var L=I[2].x;var K=I[2].y;var o=B-m;var k=x-j;var A=L-m;var t=K-j;var c=L-B;var b=K-x;var J=-(m*o+j*k);var a=(B*o+x*k);var l=-(m*A+j*t);var q=(L*A+K*t);var z=-(B*c+x*b);var H=(L*c+K*b);if(q<=0&&H<=0){s.SetV(p[2]);F.SetV(E[2]);p[0].SetV(p[2]);E[0].SetV(E[2]);I[0].SetV(I[2]);return 1}var G=o*t-k*A;var f=G*(m*x-j*B);var h=G*(B*K-x*L);if(h<=0&&z>=0&&H>=0){var D=z/(z+H);s.x=p[1].x+D*(p[2].x-p[1].x);s.y=p[1].y+D*(p[2].y-p[1].y);F.x=E[1].x+D*(E[2].x-E[1].x);F.y=E[1].y+D*(E[2].y-E[1].y);p[0].SetV(p[2]);E[0].SetV(E[2]);I[0].SetV(I[2]);return 2}var g=G*(L*j-K*m);if(g<=0&&l>=0&&q>=0){var D=l/(l+q);s.x=p[0].x+D*(p[2].x-p[0].x);s.y=p[0].y+D*(p[2].y-p[0].y);F.x=E[0].x+D*(E[2].x-E[0].x);F.y=E[0].y+D*(E[2].y-E[0].y);p[1].SetV(p[2]);E[1].SetV(E[2]);I[1].SetV(I[2]);return 2}var e=h+g+f;e=1/e;var C=h*e;var y=g*e;var r=1-C-y;s.x=C*p[0].x+y*p[1].x+r*p[2].x;s.y=C*p[0].y+y*p[1].y+r*p[2].y;F.x=C*E[0].x+y*E[1].x+r*E[2].x;F.y=C*E[0].y+y*E[1].y+r*E[2].y;return 3};b2Distance.InPoinsts=function(a,c,e){for(var b=0;b<e;++b){if(a.x==c[b].x&&a.y==c[b].y){return true}}return false};b2Distance.Distance=function(j,o,c,a){var e=new Array(3);var m=new Array(3);var t=new Array(3);var v=0;j.SetV(c.m_position);o.SetV(a.m_position);var l=0;var r=20;for(var u=0;u<r;++u){var g=o.x-j.x;var f=o.y-j.y;var k=c.Support(g,f);var h=a.Support(-g,-f);l=(g*g+f*f);var q=h.x-k.x;var n=h.y-k.y;var p=(g*q+f*n);if(l-b2Dot(g*q+f*n)<=0.01*l){if(v==0){j.SetV(k);o.SetV(h)}b2Distance.g_GJK_Iterations=u;return Math.sqrt(l)}switch(v){case 0:e[0].SetV(k);m[0].SetV(h);t[0]=w;j.SetV(e[0]);o.SetV(m[0]);++v;break;case 1:e[1].SetV(k);m[1].SetV(h);t[1].x=q;t[1].y=n;v=b2Distance.ProcessTwo(j,o,e,m,t);break;case 2:e[2].SetV(k);m[2].SetV(h);t[2].x=q;t[2].y=n;v=b2Distance.ProcessThree(j,o,e,m,t);break}if(v==3){b2Distance.g_GJK_Iterations=u;return 0}var b=-Number.MAX_VALUE;for(var s=0;s<v;++s){b=b2Math.b2Max(b,(t[s].x*t[s].x+t[s].y*t[s].y))}if(v==3||l<=100*Number.MIN_VALUE*b){b2Distance.g_GJK_Iterations=u;return Math.sqrt(l)}}b2Distance.g_GJK_Iterations=r;return Math.sqrt(l)};b2Distance.g_GJK_Iterations=0;var b2Manifold=Class.create();b2Manifold.prototype={initialize:function(){this.points=new Array(b2Settings.b2_maxManifoldPoints);for(var a=0;a<b2Settings.b2_maxManifoldPoints;a++){this.points[a]=new b2ContactPoint()}this.normal=new b2Vec2()},points:null,normal:null,pointCount:0};var b2OBB=Class.create();b2OBB.prototype={R:new b2Mat22(),center:new b2Vec2(),extents:new b2Vec2(),initialize:function(){this.R=new b2Mat22();this.center=new b2Vec2();this.extents=new b2Vec2()}};var b2Proxy=Class.create();b2Proxy.prototype={GetNext:function(){return this.lowerBounds[0]},SetNext:function(a){this.lowerBounds[0]=a},IsValid:function(){return this.overlapCount!=b2BroadPhase.b2_invalid},lowerBounds:[(0),(0)],upperBounds:[(0),(0)],overlapCount:0,timeStamp:0,userData:null,initialize:function(){this.lowerBounds=[(0),(0)];this.upperBounds=[(0),(0)]}};var ClipVertex=Class.create();ClipVertex.prototype={v:new b2Vec2(),id:new b2ContactID(),initialize:function(){this.v=new b2Vec2();this.id=new b2ContactID()}};var b2Shape=Class.create();b2Shape.prototype={TestPoint:function(a){return false},GetUserData:function(){return this.m_userData},GetType:function(){return this.m_type},GetBody:function(){return this.m_body},GetPosition:function(){return this.m_position},GetRotationMatrix:function(){return this.m_R},ResetProxy:function(a){},GetNext:function(){return this.m_next},initialize:function(b,a){this.m_R=new b2Mat22();this.m_position=new b2Vec2();this.m_userData=b.userData;this.m_friction=b.friction;this.m_restitution=b.restitution;this.m_body=a;this.m_proxyId=b2Pair.b2_nullProxy;this.m_maxRadius=0;this.m_categoryBits=b.categoryBits;this.m_maskBits=b.maskBits;this.m_groupIndex=b.groupIndex},DestroyProxy:function(){if(this.m_proxyId!=b2Pair.b2_nullProxy){this.m_body.m_world.m_broadPhase.DestroyProxy(this.m_proxyId);this.m_proxyId=b2Pair.b2_nullProxy}},Synchronize:function(b,e,a,c){},QuickSync:function(a,b){},Support:function(b,a,c){},GetMaxRadius:function(){return this.m_maxRadius},m_next:null,m_R:new b2Mat22(),m_position:new b2Vec2(),m_type:0,m_userData:null,m_body:null,m_friction:null,m_restitution:null,m_maxRadius:null,m_proxyId:0,m_categoryBits:0,m_maskBits:0,m_groupIndex:0};b2Shape.Create=function(c,b,a){switch(c.type){case b2Shape.e_circleShape:return new b2CircleShape(c,b,a);case b2Shape.e_boxShape:case b2Shape.e_polyShape:return new b2PolyShape(c,b,a)}return null};b2Shape.Destroy=function(a){if(a.m_proxyId!=b2Pair.b2_nullProxy){a.m_body.m_world.m_broadPhase.DestroyProxy(a.m_proxyId)}};b2Shape.e_unknownShape=-1;b2Shape.e_circleShape=0;b2Shape.e_boxShape=1;b2Shape.e_polyShape=2;b2Shape.e_meshShape=3;b2Shape.e_shapeTypeCount=4;b2Shape.PolyMass=function(p,y,m,f){var B=new b2Vec2();B.SetZero();var A=0;var o=0;var k=new b2Vec2(0,0);var u=1/3;for(var z=0;z<m;++z){var e=k;var c=y[z];var b=z+1<m?y[z+1]:y[0];var n=b2Math.SubtractVV(c,e);var l=b2Math.SubtractVV(b,e);var s=b2Math.b2CrossVV(n,l);var j=0.5*s;A+=j;var h=new b2Vec2();h.SetV(e);h.Add(c);h.Add(b);h.Multiply(u*j);B.Add(h);var t=e.x;var r=e.y;var x=n.x;var a=n.y;var v=l.x;var C=l.y;var g=u*(0.25*(x*x+v*x+v*v)+(t*x+t*v))+0.5*t*t;var q=u*(0.25*(a*a+C*a+C*C)+(r*a+r*C))+0.5*r*r;o+=s*(g+q)}p.mass=f*A;B.Multiply(1/A);p.center=B;o=f*(o-A*b2Math.b2Dot(B,B));p.I=o};b2Shape.PolyCentroid=function(p,h,t){var v=0;var u=0;var x=0;var c=0;var b=0;var m=1/3;for(var s=0;s<h;++s){var r=c;var q=b;var f=p[s].x;var e=p[s].y;var k=s+1<h?p[s+1].x:p[0].x;var j=s+1<h?p[s+1].y:p[0].y;var o=f-r;var n=e-q;var a=k-r;var y=j-q;var l=(o*y-n*a);var g=0.5*l;x+=g;v+=g*m*(r+f+k);u+=g*m*(q+e+j)}v*=1/x;u*=1/x;t.Set(v,u)};var b2ShapeDef=Class.create();b2ShapeDef.prototype={initialize:function(){this.type=b2Shape.e_unknownShape;this.userData=null;this.localPosition=new b2Vec2(0,0);this.localRotation=0;this.friction=0.2;this.restitution=0;this.density=0;this.categoryBits=1;this.maskBits=65535;this.groupIndex=0},ComputeMass:function(a){a.center=new b2Vec2(0,0);if(this.density==0){a.mass=0;a.center.Set(0,0);a.I=0}switch(this.type){case b2Shape.e_circleShape:var e=this;a.mass=this.density*b2Settings.b2_pi*e.radius*e.radius;a.center.Set(0,0);a.I=0.5*(a.mass)*e.radius*e.radius;break;case b2Shape.e_boxShape:var b=this;a.mass=4*this.density*b.extents.x*b.extents.y;a.center.Set(0,0);a.I=a.mass/3*b2Math.b2Dot(b.extents,b.extents);break;case b2Shape.e_polyShape:var c=this;b2Shape.PolyMass(a,c.vertices,c.vertexCount,this.density);break;default:a.mass=0;a.center.Set(0,0);a.I=0;break}},type:0,userData:null,localPosition:null,localRotation:null,friction:null,restitution:null,density:null,categoryBits:0,maskBits:0,groupIndex:0};var b2BoxDef=Class.create();Object.extend(b2BoxDef.prototype,b2ShapeDef.prototype);Object.extend(b2BoxDef.prototype,{initialize:function(){this.type=b2Shape.e_unknownShape;this.userData=null;this.localPosition=new b2Vec2(0,0);this.localRotation=0;this.friction=0.2;this.restitution=0;this.density=0;this.categoryBits=1;this.maskBits=65535;this.groupIndex=0;this.type=b2Shape.e_boxShape;this.extents=new b2Vec2(1,1)},extents:null});var b2CircleDef=Class.create();Object.extend(b2CircleDef.prototype,b2ShapeDef.prototype);Object.extend(b2CircleDef.prototype,{initialize:function(){this.type=b2Shape.e_unknownShape;this.userData=null;this.localPosition=new b2Vec2(0,0);this.localRotation=0;this.friction=0.2;this.restitution=0;this.density=0;this.categoryBits=1;this.maskBits=65535;this.groupIndex=0;this.type=b2Shape.e_circleShape;this.radius=1},radius:null});var b2CircleShape=Class.create();Object.extend(b2CircleShape.prototype,b2Shape.prototype);Object.extend(b2CircleShape.prototype,{TestPoint:function(a){var b=new b2Vec2();b.SetV(a);b.Subtract(this.m_position);return b2Math.b2Dot(b,b)<=this.m_radius*this.m_radius},initialize:function(h,c,b){this.m_R=new b2Mat22();this.m_position=new b2Vec2();this.m_userData=h.userData;this.m_friction=h.friction;this.m_restitution=h.restitution;this.m_body=c;this.m_proxyId=b2Pair.b2_nullProxy;this.m_maxRadius=0;this.m_categoryBits=h.categoryBits;this.m_maskBits=h.maskBits;this.m_groupIndex=h.groupIndex;this.m_localPosition=new b2Vec2();var j=h;this.m_localPosition.Set(h.localPosition.x-b.x,h.localPosition.y-b.y);this.m_type=b2Shape.e_circleShape;this.m_radius=j.radius;this.m_R.SetM(this.m_body.m_R);var g=this.m_R.col1.x*this.m_localPosition.x+this.m_R.col2.x*this.m_localPosition.y;var f=this.m_R.col1.y*this.m_localPosition.x+this.m_R.col2.y*this.m_localPosition.y;this.m_position.x=this.m_body.m_position.x+g;this.m_position.y=this.m_body.m_position.y+f;this.m_maxRadius=Math.sqrt(g*g+f*f)+this.m_radius;var e=new b2AABB();e.minVertex.Set(this.m_position.x-this.m_radius,this.m_position.y-this.m_radius);e.maxVertex.Set(this.m_position.x+this.m_radius,this.m_position.y+this.m_radius);var a=this.m_body.m_world.m_broadPhase;if(a.InRange(e)){this.m_proxyId=a.CreateProxy(e,this)}else{this.m_proxyId=b2Pair.b2_nullProxy}if(this.m_proxyId==b2Pair.b2_nullProxy){this.m_body.Freeze()}},Synchronize:function(c,f,a,b){this.m_R.SetM(b);this.m_position.x=(b.col1.x*this.m_localPosition.x+b.col2.x*this.m_localPosition.y)+a.x;this.m_position.y=(b.col1.y*this.m_localPosition.x+b.col2.y*this.m_localPosition.y)+a.y;if(this.m_proxyId==b2Pair.b2_nullProxy){return}var k=c.x+(f.col1.x*this.m_localPosition.x+f.col2.x*this.m_localPosition.y);var j=c.y+(f.col1.y*this.m_localPosition.x+f.col2.y*this.m_localPosition.y);var n=Math.min(k,this.m_position.x);var m=Math.min(j,this.m_position.y);var g=Math.max(k,this.m_position.x);var e=Math.max(j,this.m_position.y);var h=new b2AABB();h.minVertex.Set(n-this.m_radius,m-this.m_radius);h.maxVertex.Set(g+this.m_radius,e+this.m_radius);var l=this.m_body.m_world.m_broadPhase;if(l.InRange(h)){l.MoveProxy(this.m_proxyId,h)}else{this.m_body.Freeze()}},QuickSync:function(a,b){this.m_R.SetM(b);this.m_position.x=(b.col1.x*this.m_localPosition.x+b.col2.x*this.m_localPosition.y)+a.x;this.m_position.y=(b.col1.y*this.m_localPosition.x+b.col2.y*this.m_localPosition.y)+a.y},ResetProxy:function(a){if(this.m_proxyId==b2Pair.b2_nullProxy){return}var c=a.GetProxy(this.m_proxyId);a.DestroyProxy(this.m_proxyId);c=null;var b=new b2AABB();b.minVertex.Set(this.m_position.x-this.m_radius,this.m_position.y-this.m_radius);b.maxVertex.Set(this.m_position.x+this.m_radius,this.m_position.y+this.m_radius);if(a.InRange(b)){this.m_proxyId=a.CreateProxy(b,this)}else{this.m_proxyId=b2Pair.b2_nullProxy}if(this.m_proxyId==b2Pair.b2_nullProxy){this.m_body.Freeze()}},Support:function(c,b,e){var a=Math.sqrt(c*c+b*b);c/=a;b/=a;e.Set(this.m_position.x+this.m_radius*c,this.m_position.y+this.m_radius*b)},m_localPosition:new b2Vec2(),m_radius:null});var b2MassData=Class.create();b2MassData.prototype={mass:0,center:new b2Vec2(0,0),I:0,initialize:function(){this.center=new b2Vec2(0,0)}};var b2PolyDef=Class.create();Object.extend(b2PolyDef.prototype,b2ShapeDef.prototype);Object.extend(b2PolyDef.prototype,{initialize:function(){this.type=b2Shape.e_unknownShape;this.userData=null;this.localPosition=new b2Vec2(0,0);this.localRotation=0;this.friction=0.2;this.restitution=0;this.density=0;this.categoryBits=1;this.maskBits=65535;this.groupIndex=0;this.vertices=new Array(b2Settings.b2_maxPolyVertices);this.type=b2Shape.e_polyShape;this.vertexCount=0;for(var a=0;a<b2Settings.b2_maxPolyVertices;a++){this.vertices[a]=new b2Vec2()}},vertices:new Array(b2Settings.b2_maxPolyVertices),vertexCount:0});var b2PolyShape=Class.create();Object.extend(b2PolyShape.prototype,b2Shape.prototype);Object.extend(b2PolyShape.prototype,{TestPoint:function(e){var f=new b2Vec2();f.SetV(e);f.Subtract(this.m_position);f.MulTM(this.m_R);for(var c=0;c<this.m_vertexCount;++c){var b=new b2Vec2();b.SetV(f);b.Subtract(this.m_vertices[c]);var a=b2Math.b2Dot(this.m_normals[c],b);if(a>0){return false}}return true},initialize:function(t,p,a){this.m_R=new b2Mat22();this.m_position=new b2Vec2();this.m_userData=t.userData;this.m_friction=t.friction;this.m_restitution=t.restitution;this.m_body=p;this.m_proxyId=b2Pair.b2_nullProxy;this.m_maxRadius=0;this.m_categoryBits=t.categoryBits;this.m_maskBits=t.maskBits;this.m_groupIndex=t.groupIndex;this.syncAABB=new b2AABB();this.syncMat=new b2Mat22();this.m_localCentroid=new b2Vec2();this.m_localOBB=new b2OBB();var y=0;var s;var r;var b;var l=new b2AABB();this.m_vertices=new Array(b2Settings.b2_maxPolyVertices);this.m_coreVertices=new Array(b2Settings.b2_maxPolyVertices);this.m_normals=new Array(b2Settings.b2_maxPolyVertices);this.m_type=b2Shape.e_polyShape;var c=new b2Mat22(t.localRotation);if(t.type==b2Shape.e_boxShape){this.m_localCentroid.x=t.localPosition.x-a.x;this.m_localCentroid.y=t.localPosition.y-a.y;var o=t;this.m_vertexCount=4;s=o.extents.x;r=o.extents.y;var k=Math.max(0,s-2*b2Settings.b2_linearSlop);var h=Math.max(0,r-2*b2Settings.b2_linearSlop);b=this.m_vertices[0]=new b2Vec2();b.x=c.col1.x*s+c.col2.x*r;b.y=c.col1.y*s+c.col2.y*r;b=this.m_vertices[1]=new b2Vec2();b.x=c.col1.x*-s+c.col2.x*r;b.y=c.col1.y*-s+c.col2.y*r;b=this.m_vertices[2]=new b2Vec2();b.x=c.col1.x*-s+c.col2.x*-r;b.y=c.col1.y*-s+c.col2.y*-r;b=this.m_vertices[3]=new b2Vec2();b.x=c.col1.x*s+c.col2.x*-r;b.y=c.col1.y*s+c.col2.y*-r;b=this.m_coreVertices[0]=new b2Vec2();b.x=c.col1.x*k+c.col2.x*h;b.y=c.col1.y*k+c.col2.y*h;b=this.m_coreVertices[1]=new b2Vec2();b.x=c.col1.x*-k+c.col2.x*h;b.y=c.col1.y*-k+c.col2.y*h;b=this.m_coreVertices[2]=new b2Vec2();b.x=c.col1.x*-k+c.col2.x*-h;b.y=c.col1.y*-k+c.col2.y*-h;b=this.m_coreVertices[3]=new b2Vec2();b.x=c.col1.x*k+c.col2.x*-h;b.y=c.col1.y*k+c.col2.y*-h}else{var f=t;this.m_vertexCount=f.vertexCount;b2Shape.PolyCentroid(f.vertices,f.vertexCount,b2PolyShape.tempVec);var j=b2PolyShape.tempVec.x;var g=b2PolyShape.tempVec.y;this.m_localCentroid.x=t.localPosition.x+(c.col1.x*j+c.col2.x*g)-a.x;this.m_localCentroid.y=t.localPosition.y+(c.col1.y*j+c.col2.y*g)-a.y;for(y=0;y<this.m_vertexCount;++y){this.m_vertices[y]=new b2Vec2();this.m_coreVertices[y]=new b2Vec2();s=f.vertices[y].x-j;r=f.vertices[y].y-g;this.m_vertices[y].x=c.col1.x*s+c.col2.x*r;this.m_vertices[y].y=c.col1.y*s+c.col2.y*r;var F=this.m_vertices[y].x;var E=this.m_vertices[y].y;var e=Math.sqrt(F*F+E*E);if(e>Number.MIN_VALUE){F*=1/e;E*=1/e}this.m_coreVertices[y].x=this.m_vertices[y].x-2*b2Settings.b2_linearSlop*F;this.m_coreVertices[y].y=this.m_vertices[y].y-2*b2Settings.b2_linearSlop*E}}var A=Number.MAX_VALUE;var z=Number.MAX_VALUE;var n=-Number.MAX_VALUE;var m=-Number.MAX_VALUE;this.m_maxRadius=0;for(y=0;y<this.m_vertexCount;++y){var q=this.m_vertices[y];A=Math.min(A,q.x);z=Math.min(z,q.y);n=Math.max(n,q.x);m=Math.max(m,q.y);this.m_maxRadius=Math.max(this.m_maxRadius,q.Length())}this.m_localOBB.R.SetIdentity();this.m_localOBB.center.Set((A+n)*0.5,(z+m)*0.5);this.m_localOBB.extents.Set((n-A)*0.5,(m-z)*0.5);var x=0;var u=0;for(y=0;y<this.m_vertexCount;++y){this.m_normals[y]=new b2Vec2();x=y;u=y+1<this.m_vertexCount?y+1:0;this.m_normals[y].x=this.m_vertices[u].y-this.m_vertices[x].y;this.m_normals[y].y=-(this.m_vertices[u].x-this.m_vertices[x].x);this.m_normals[y].Normalize()}for(y=0;y<this.m_vertexCount;++y){x=y;u=y+1<this.m_vertexCount?y+1:0}this.m_R.SetM(this.m_body.m_R);this.m_position.x=this.m_body.m_position.x+(this.m_R.col1.x*this.m_localCentroid.x+this.m_R.col2.x*this.m_localCentroid.y);this.m_position.y=this.m_body.m_position.y+(this.m_R.col1.y*this.m_localCentroid.x+this.m_R.col2.y*this.m_localCentroid.y);b2PolyShape.tAbsR.col1.x=this.m_R.col1.x*this.m_localOBB.R.col1.x+this.m_R.col2.x*this.m_localOBB.R.col1.y;b2PolyShape.tAbsR.col1.y=this.m_R.col1.y*this.m_localOBB.R.col1.x+this.m_R.col2.y*this.m_localOBB.R.col1.y;b2PolyShape.tAbsR.col2.x=this.m_R.col1.x*this.m_localOBB.R.col2.x+this.m_R.col2.x*this.m_localOBB.R.col2.y;b2PolyShape.tAbsR.col2.y=this.m_R.col1.y*this.m_localOBB.R.col2.x+this.m_R.col2.y*this.m_localOBB.R.col2.y;b2PolyShape.tAbsR.Abs();s=b2PolyShape.tAbsR.col1.x*this.m_localOBB.extents.x+b2PolyShape.tAbsR.col2.x*this.m_localOBB.extents.y;r=b2PolyShape.tAbsR.col1.y*this.m_localOBB.extents.x+b2PolyShape.tAbsR.col2.y*this.m_localOBB.extents.y;var D=this.m_position.x+(this.m_R.col1.x*this.m_localOBB.center.x+this.m_R.col2.x*this.m_localOBB.center.y);var C=this.m_position.y+(this.m_R.col1.y*this.m_localOBB.center.x+this.m_R.col2.y*this.m_localOBB.center.y);l.minVertex.x=D-s;l.minVertex.y=C-r;l.maxVertex.x=D+s;l.maxVertex.y=C+r;var B=this.m_body.m_world.m_broadPhase;if(B.InRange(l)){this.m_proxyId=B.CreateProxy(l,this)}else{this.m_proxyId=b2Pair.b2_nullProxy}if(this.m_proxyId==b2Pair.b2_nullProxy){this.m_body.Freeze()}},syncAABB:new b2AABB(),syncMat:new b2Mat22(),Synchronize:function(c,f,a,b){this.m_R.SetM(b);this.m_position.x=this.m_body.m_position.x+(b.col1.x*this.m_localCentroid.x+b.col2.x*this.m_localCentroid.y);this.m_position.y=this.m_body.m_position.y+(b.col1.y*this.m_localCentroid.x+b.col2.y*this.m_localCentroid.y);if(this.m_proxyId==b2Pair.b2_nullProxy){return}var o;var n;var m=f.col1;var l=f.col2;var k=this.m_localOBB.R.col1;var j=this.m_localOBB.R.col2;this.syncMat.col1.x=m.x*k.x+l.x*k.y;this.syncMat.col1.y=m.y*k.x+l.y*k.y;this.syncMat.col2.x=m.x*j.x+l.x*j.y;this.syncMat.col2.y=m.y*j.x+l.y*j.y;this.syncMat.Abs();o=this.m_localCentroid.x+this.m_localOBB.center.x;n=this.m_localCentroid.y+this.m_localOBB.center.y;var g=c.x+(f.col1.x*o+f.col2.x*n);var e=c.y+(f.col1.y*o+f.col2.y*n);o=this.syncMat.col1.x*this.m_localOBB.extents.x+this.syncMat.col2.x*this.m_localOBB.extents.y;n=this.syncMat.col1.y*this.m_localOBB.extents.x+this.syncMat.col2.y*this.m_localOBB.extents.y;this.syncAABB.minVertex.x=g-o;this.syncAABB.minVertex.y=e-n;this.syncAABB.maxVertex.x=g+o;this.syncAABB.maxVertex.y=e+n;m=b.col1;l=b.col2;k=this.m_localOBB.R.col1;j=this.m_localOBB.R.col2;this.syncMat.col1.x=m.x*k.x+l.x*k.y;this.syncMat.col1.y=m.y*k.x+l.y*k.y;this.syncMat.col2.x=m.x*j.x+l.x*j.y;this.syncMat.col2.y=m.y*j.x+l.y*j.y;this.syncMat.Abs();o=this.m_localCentroid.x+this.m_localOBB.center.x;n=this.m_localCentroid.y+this.m_localOBB.center.y;g=a.x+(b.col1.x*o+b.col2.x*n);e=a.y+(b.col1.y*o+b.col2.y*n);o=this.syncMat.col1.x*this.m_localOBB.extents.x+this.syncMat.col2.x*this.m_localOBB.extents.y;n=this.syncMat.col1.y*this.m_localOBB.extents.x+this.syncMat.col2.y*this.m_localOBB.extents.y;this.syncAABB.minVertex.x=Math.min(this.syncAABB.minVertex.x,g-o);this.syncAABB.minVertex.y=Math.min(this.syncAABB.minVertex.y,e-n);this.syncAABB.maxVertex.x=Math.max(this.syncAABB.maxVertex.x,g+o);this.syncAABB.maxVertex.y=Math.max(this.syncAABB.maxVertex.y,e+n);var h=this.m_body.m_world.m_broadPhase;if(h.InRange(this.syncAABB)){h.MoveProxy(this.m_proxyId,this.syncAABB)}else{this.m_body.Freeze()}},QuickSync:function(a,b){this.m_R.SetM(b);this.m_position.x=a.x+(b.col1.x*this.m_localCentroid.x+b.col2.x*this.m_localCentroid.y);this.m_position.y=a.y+(b.col1.y*this.m_localCentroid.x+b.col2.y*this.m_localCentroid.y)},ResetProxy:function(b){if(this.m_proxyId==b2Pair.b2_nullProxy){return}var f=b.GetProxy(this.m_proxyId);b.DestroyProxy(this.m_proxyId);f=null;var j=b2Math.b2MulMM(this.m_R,this.m_localOBB.R);var e=b2Math.b2AbsM(j);var g=b2Math.b2MulMV(e,this.m_localOBB.extents);var a=b2Math.b2MulMV(this.m_R,this.m_localOBB.center);a.Add(this.m_position);var c=new b2AABB();c.minVertex.SetV(a);c.minVertex.Subtract(g);c.maxVertex.SetV(a);c.maxVertex.Add(g);if(b.InRange(c)){this.m_proxyId=b.CreateProxy(c,this)}else{this.m_proxyId=b2Pair.b2_nullProxy}if(this.m_proxyId==b2Pair.b2_nullProxy){this.m_body.Freeze()}},Support:function(c,a,b){var h=(c*this.m_R.col1.x+a*this.m_R.col1.y);var g=(c*this.m_R.col2.x+a*this.m_R.col2.y);var f=0;var k=(this.m_coreVertices[0].x*h+this.m_coreVertices[0].y*g);for(var e=1;e<this.m_vertexCount;++e){var j=(this.m_coreVertices[e].x*h+this.m_coreVertices[e].y*g);if(j>k){f=e;k=j}}b.Set(this.m_position.x+(this.m_R.col1.x*this.m_coreVertices[f].x+this.m_R.col2.x*this.m_coreVertices[f].y),this.m_position.y+(this.m_R.col1.y*this.m_coreVertices[f].x+this.m_R.col2.y*this.m_coreVertices[f].y))},m_localCentroid:new b2Vec2(),m_localOBB:new b2OBB(),m_vertices:null,m_coreVertices:null,m_vertexCount:0,m_normals:null});b2PolyShape.tempVec=new b2Vec2();b2PolyShape.tAbsR=new b2Mat22();var b2Body=Class.create();b2Body.prototype={SetOriginPosition:function(a,b){if(this.IsFrozen()){return}this.m_rotation=b;this.m_R.Set(this.m_rotation);this.m_position=b2Math.AddVV(a,b2Math.b2MulMV(this.m_R,this.m_center));this.m_position0.SetV(this.m_position);this.m_rotation0=this.m_rotation;for(var c=this.m_shapeList;c!=null;c=c.m_next){c.Synchronize(this.m_position,this.m_R,this.m_position,this.m_R)}this.m_world.m_broadPhase.Commit()},GetOriginPosition:function(){return b2Math.SubtractVV(this.m_position,b2Math.b2MulMV(this.m_R,this.m_center))},SetCenterPosition:function(a,b){if(this.IsFrozen()){return}this.m_rotation=b;this.m_R.Set(this.m_rotation);this.m_position.SetV(a);this.m_position0.SetV(this.m_position);this.m_rotation0=this.m_rotation;for(var c=this.m_shapeList;c!=null;c=c.m_next){c.Synchronize(this.m_position,this.m_R,this.m_position,this.m_R)}this.m_world.m_broadPhase.Commit()},GetCenterPosition:function(){return this.m_position},GetRotation:function(){return this.m_rotation},GetRotationMatrix:function(){return this.m_R},SetLinearVelocity:function(a){this.m_linearVelocity.SetV(a)},GetLinearVelocity:function(){return this.m_linearVelocity},SetAngularVelocity:function(a){this.m_angularVelocity=a},GetAngularVelocity:function(){return this.m_angularVelocity},ApplyForce:function(b,a){if(this.IsSleeping()==false){this.m_force.Add(b);this.m_torque+=b2Math.b2CrossVV(b2Math.SubtractVV(a,this.m_position),b)}},ApplyTorque:function(a){if(this.IsSleeping()==false){this.m_torque+=a}},ApplyImpulse:function(b,a){if(this.IsSleeping()==false){this.m_linearVelocity.Add(b2Math.MulFV(this.m_invMass,b));this.m_angularVelocity+=(this.m_invI*b2Math.b2CrossVV(b2Math.SubtractVV(a,this.m_position),b))}},GetMass:function(){return this.m_mass},GetInertia:function(){return this.m_I},GetWorldPoint:function(a){return b2Math.AddVV(this.m_position,b2Math.b2MulMV(this.m_R,a))},GetWorldVector:function(a){return b2Math.b2MulMV(this.m_R,a)},GetLocalPoint:function(a){return b2Math.b2MulTMV(this.m_R,b2Math.SubtractVV(a,this.m_position))},GetLocalVector:function(a){return b2Math.b2MulTMV(this.m_R,a)},IsStatic:function(){return(this.m_flags&b2Body.e_staticFlag)==b2Body.e_staticFlag},IsFrozen:function(){return(this.m_flags&b2Body.e_frozenFlag)==b2Body.e_frozenFlag},IsSleeping:function(){return(this.m_flags&b2Body.e_sleepFlag)==b2Body.e_sleepFlag},AllowSleeping:function(a){if(a){this.m_flags|=b2Body.e_allowSleepFlag}else{this.m_flags&=~b2Body.e_allowSleepFlag;this.WakeUp()}},WakeUp:function(){this.m_flags&=~b2Body.e_sleepFlag;this.m_sleepTime=0},GetShapeList:function(){return this.m_shapeList},GetContactList:function(){return this.m_contactList},GetJointList:function(){return this.m_jointList},GetNext:function(){return this.m_next},GetUserData:function(){return this.m_userData},initialize:function(g,f){this.sMat0=new b2Mat22();this.m_position=new b2Vec2();this.m_R=new b2Mat22(0);this.m_position0=new b2Vec2();var c=0;var h;var a;this.m_flags=0;this.m_position.SetV(g.position);this.m_rotation=g.rotation;this.m_R.Set(this.m_rotation);this.m_position0.SetV(this.m_position);this.m_rotation0=this.m_rotation;this.m_world=f;this.m_linearDamping=b2Math.b2Clamp(1-g.linearDamping,0,1);this.m_angularDamping=b2Math.b2Clamp(1-g.angularDamping,0,1);this.m_force=new b2Vec2(0,0);this.m_torque=0;this.m_mass=0;var j=new Array(b2Settings.b2_maxShapesPerBody);for(c=0;c<b2Settings.b2_maxShapesPerBody;c++){j[c]=new b2MassData()}this.m_shapeCount=0;this.m_center=new b2Vec2(0,0);for(c=0;c<b2Settings.b2_maxShapesPerBody;++c){h=g.shapes[c];if(h==null){break}a=j[c];h.ComputeMass(a);this.m_mass+=a.mass;this.m_center.x+=a.mass*(h.localPosition.x+a.center.x);this.m_center.y+=a.mass*(h.localPosition.y+a.center.y);++this.m_shapeCount}if(this.m_mass>0){this.m_center.Multiply(1/this.m_mass);this.m_position.Add(b2Math.b2MulMV(this.m_R,this.m_center))}else{this.m_flags|=b2Body.e_staticFlag}this.m_I=0;for(c=0;c<this.m_shapeCount;++c){h=g.shapes[c];a=j[c];this.m_I+=a.I;var e=b2Math.SubtractVV(b2Math.AddVV(h.localPosition,a.center),this.m_center);this.m_I+=a.mass*b2Math.b2Dot(e,e)}if(this.m_mass>0){this.m_invMass=1/this.m_mass}else{this.m_invMass=0}if(this.m_I>0&&g.preventRotation==false){this.m_invI=1/this.m_I}else{this.m_I=0;this.m_invI=0}this.m_linearVelocity=b2Math.AddVV(g.linearVelocity,b2Math.b2CrossFV(g.angularVelocity,this.m_center));this.m_angularVelocity=g.angularVelocity;this.m_jointList=null;this.m_contactList=null;this.m_prev=null;this.m_next=null;this.m_shapeList=null;for(c=0;c<this.m_shapeCount;++c){h=g.shapes[c];var b=b2Shape.Create(h,this,this.m_center);b.m_next=this.m_shapeList;this.m_shapeList=b}this.m_sleepTime=0;if(g.allowSleep){this.m_flags|=b2Body.e_allowSleepFlag}if(g.isSleeping){this.m_flags|=b2Body.e_sleepFlag}if((this.m_flags&b2Body.e_sleepFlag)||this.m_invMass==0){this.m_linearVelocity.Set(0,0);this.m_angularVelocity=0}this.m_userData=g.userData},Destroy:function(){var b=this.m_shapeList;while(b){var a=b;b=b.m_next;b2Shape.Destroy(a)}},sMat0:new b2Mat22(),SynchronizeShapes:function(){this.sMat0.Set(this.m_rotation0);for(var a=this.m_shapeList;a!=null;a=a.m_next){a.Synchronize(this.m_position0,this.sMat0,this.m_position,this.m_R)}},QuickSyncShapes:function(){for(var a=this.m_shapeList;a!=null;a=a.m_next){a.QuickSync(this.m_position,this.m_R)}},IsConnected:function(a){for(var b=this.m_jointList;b!=null;b=b.next){if(b.other==a){return b.joint.m_collideConnected==false}}return false},Freeze:function(){this.m_flags|=b2Body.e_frozenFlag;this.m_linearVelocity.SetZero();this.m_angularVelocity=0;for(var a=this.m_shapeList;a!=null;a=a.m_next){a.DestroyProxy()}},m_flags:0,m_position:new b2Vec2(),m_rotation:null,m_R:new b2Mat22(0),m_position0:new b2Vec2(),m_rotation0:null,m_linearVelocity:null,m_angularVelocity:null,m_force:null,m_torque:null,m_center:null,m_world:null,m_prev:null,m_next:null,m_shapeList:null,m_shapeCount:0,m_jointList:null,m_contactList:null,m_mass:null,m_invMass:null,m_I:null,m_invI:null,m_linearDamping:null,m_angularDamping:null,m_sleepTime:null,m_userData:null};b2Body.e_staticFlag=1;b2Body.e_frozenFlag=2;b2Body.e_islandFlag=4;b2Body.e_sleepFlag=8;b2Body.e_allowSleepFlag=16;b2Body.e_destroyFlag=32;var b2BodyDef=Class.create();b2BodyDef.prototype={initialize:function(){this.shapes=new Array();this.userData=null;for(var a=0;a<b2Settings.b2_maxShapesPerBody;a++){this.shapes[a]=null}this.position=new b2Vec2(0,0);this.rotation=0;this.linearVelocity=new b2Vec2(0,0);this.angularVelocity=0;this.linearDamping=0;this.angularDamping=0;this.allowSleep=true;this.isSleeping=false;this.preventRotation=false},userData:null,shapes:new Array(),position:null,rotation:null,linearVelocity:null,angularVelocity:null,linearDamping:null,angularDamping:null,allowSleep:null,isSleeping:null,preventRotation:null,AddShape:function(a){for(var b=0;b<b2Settings.b2_maxShapesPerBody;++b){if(this.shapes[b]==null){this.shapes[b]=a;break}}}};var b2CollisionFilter=Class.create();b2CollisionFilter.prototype={ShouldCollide:function(b,a){if(b.m_groupIndex==a.m_groupIndex&&b.m_groupIndex!=0){return b.m_groupIndex>0}var c=(b.m_maskBits&a.m_categoryBits)!=0&&(b.m_categoryBits&a.m_maskBits)!=0;return c},initialize:function(){}};b2CollisionFilter.b2_defaultFilter=new b2CollisionFilter;var b2Island=Class.create();b2Island.prototype={initialize:function(f,e,c,a){var b=0;this.m_bodyCapacity=f;this.m_contactCapacity=e;this.m_jointCapacity=c;this.m_bodyCount=0;this.m_contactCount=0;this.m_jointCount=0;this.m_bodies=new Array(f);for(b=0;b<f;b++){this.m_bodies[b]=null}this.m_contacts=new Array(e);for(b=0;b<e;b++){this.m_contacts[b]=null}this.m_joints=new Array(c);for(b=0;b<c;b++){this.m_joints[b]=null}this.m_allocator=a},Clear:function(){this.m_bodyCount=0;this.m_contactCount=0;this.m_jointCount=0},Solve:function(c,m){var g=0;var l;for(g=0;g<this.m_bodyCount;++g){l=this.m_bodies[g];if(l.m_invMass==0){continue}l.m_linearVelocity.Add(b2Math.MulFV(c.dt,b2Math.AddVV(m,b2Math.MulFV(l.m_invMass,l.m_force))));l.m_angularVelocity+=c.dt*l.m_invI*l.m_torque;l.m_linearVelocity.Multiply(l.m_linearDamping);l.m_angularVelocity*=l.m_angularDamping;l.m_position0.SetV(l.m_position);l.m_rotation0=l.m_rotation}var e=new b2ContactSolver(this.m_contacts,this.m_contactCount,this.m_allocator);e.PreSolve();for(g=0;g<this.m_jointCount;++g){this.m_joints[g].PrepareVelocitySolver()}for(g=0;g<c.iterations;++g){e.SolveVelocityConstraints();for(var f=0;f<this.m_jointCount;++f){this.m_joints[f].SolveVelocityConstraints(c)}}for(g=0;g<this.m_bodyCount;++g){l=this.m_bodies[g];if(l.m_invMass==0){continue}l.m_position.x+=c.dt*l.m_linearVelocity.x;l.m_position.y+=c.dt*l.m_linearVelocity.y;l.m_rotation+=c.dt*l.m_angularVelocity;l.m_R.Set(l.m_rotation)}for(g=0;g<this.m_jointCount;++g){this.m_joints[g].PreparePositionSolver()}if(b2World.s_enablePositionCorrection){for(b2Island.m_positionIterationCount=0;b2Island.m_positionIterationCount<c.iterations;++b2Island.m_positionIterationCount){var h=e.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);var k=true;for(g=0;g<this.m_jointCount;++g){var a=this.m_joints[g].SolvePositionConstraints();k=k&&a}if(h&&k){break}}}e.PostSolve();for(g=0;g<this.m_bodyCount;++g){l=this.m_bodies[g];if(l.m_invMass==0){continue}l.m_R.Set(l.m_rotation);l.SynchronizeShapes();l.m_force.Set(0,0);l.m_torque=0}},UpdateSleep:function(h){var g=0;var a;var f=Number.MAX_VALUE;var e=b2Settings.b2_linearSleepTolerance*b2Settings.b2_linearSleepTolerance;var c=b2Settings.b2_angularSleepTolerance*b2Settings.b2_angularSleepTolerance;for(g=0;g<this.m_bodyCount;++g){a=this.m_bodies[g];if(a.m_invMass==0){continue}if((a.m_flags&b2Body.e_allowSleepFlag)==0){a.m_sleepTime=0;f=0}if((a.m_flags&b2Body.e_allowSleepFlag)==0||a.m_angularVelocity*a.m_angularVelocity>c||b2Math.b2Dot(a.m_linearVelocity,a.m_linearVelocity)>e){a.m_sleepTime=0;f=0}else{a.m_sleepTime+=h;f=b2Math.b2Min(f,a.m_sleepTime)}}if(f>=b2Settings.b2_timeToSleep){for(g=0;g<this.m_bodyCount;++g){a=this.m_bodies[g];a.m_flags|=b2Body.e_sleepFlag}}},AddBody:function(a){this.m_bodies[this.m_bodyCount++]=a},AddContact:function(a){this.m_contacts[this.m_contactCount++]=a},AddJoint:function(a){this.m_joints[this.m_jointCount++]=a},m_allocator:null,m_bodies:null,m_contacts:null,m_joints:null,m_bodyCount:0,m_jointCount:0,m_contactCount:0,m_bodyCapacity:0,m_contactCapacity:0,m_jointCapacity:0,m_positionError:null};b2Island.m_positionIterationCount=0;var b2TimeStep=Class.create();b2TimeStep.prototype={dt:null,inv_dt:null,iterations:0,initialize:function(){}};var b2ContactNode=Class.create();b2ContactNode.prototype={other:null,contact:null,prev:null,next:null,initialize:function(){}};var b2Contact=Class.create();b2Contact.prototype={GetManifolds:function(){return null},GetManifoldCount:function(){return this.m_manifoldCount},GetNext:function(){return this.m_next},GetShape1:function(){return this.m_shape1},GetShape2:function(){return this.m_shape2},initialize:function(b,a){this.m_node1=new b2ContactNode();this.m_node2=new b2ContactNode();this.m_flags=0;if(!b||!a){this.m_shape1=null;this.m_shape2=null;return}this.m_shape1=b;this.m_shape2=a;this.m_manifoldCount=0;this.m_friction=Math.sqrt(this.m_shape1.m_friction*this.m_shape2.m_friction);this.m_restitution=b2Math.b2Max(this.m_shape1.m_restitution,this.m_shape2.m_restitution);this.m_prev=null;this.m_next=null;this.m_node1.contact=null;this.m_node1.prev=null;this.m_node1.next=null;this.m_node1.other=null;this.m_node2.contact=null;this.m_node2.prev=null;this.m_node2.next=null;this.m_node2.other=null},Evaluate:function(){},m_flags:0,m_prev:null,m_next:null,m_node1:new b2ContactNode(),m_node2:new b2ContactNode(),m_shape1:null,m_shape2:null,m_manifoldCount:0,m_friction:null,m_restitution:null};b2Contact.e_islandFlag=1;b2Contact.e_destroyFlag=2;b2Contact.AddType=function(c,e,b,a){b2Contact.s_registers[b][a].createFcn=c;b2Contact.s_registers[b][a].destroyFcn=e;b2Contact.s_registers[b][a].primary=true;if(b!=a){b2Contact.s_registers[a][b].createFcn=c;b2Contact.s_registers[a][b].destroyFcn=e;b2Contact.s_registers[a][b].primary=false}};b2Contact.InitializeRegisters=function(){b2Contact.s_registers=new Array(b2Shape.e_shapeTypeCount);for(var b=0;b<b2Shape.e_shapeTypeCount;b++){b2Contact.s_registers[b]=new Array(b2Shape.e_shapeTypeCount);for(var a=0;a<b2Shape.e_shapeTypeCount;a++){b2Contact.s_registers[b][a]=new b2ContactRegister()}}b2Contact.AddType(b2CircleContact.Create,b2CircleContact.Destroy,b2Shape.e_circleShape,b2Shape.e_circleShape);b2Contact.AddType(b2PolyAndCircleContact.Create,b2PolyAndCircleContact.Destroy,b2Shape.e_polyShape,b2Shape.e_circleShape);b2Contact.AddType(b2PolyContact.Create,b2PolyContact.Destroy,b2Shape.e_polyShape,b2Shape.e_polyShape)};b2Contact.Create=function(l,k,a){if(b2Contact.s_initialized==false){b2Contact.InitializeRegisters();b2Contact.s_initialized=true}var f=l.m_type;var e=k.m_type;var h=b2Contact.s_registers[f][e].createFcn;if(h){if(b2Contact.s_registers[f][e].primary){return h(l,k,a)}else{var j=h(k,l,a);for(var g=0;g<j.GetManifoldCount();++g){var b=j.GetManifolds()[g];b.normal=b.normal.Negative()}return j}}else{return null}};b2Contact.Destroy=function(a,c){if(a.GetManifoldCount()>0){a.m_shape1.m_body.WakeUp();a.m_shape2.m_body.WakeUp()}var e=a.m_shape1.m_type;var b=a.m_shape2.m_type;var f=b2Contact.s_registers[e][b].destroyFcn;f(a,c)};b2Contact.s_registers=null;b2Contact.s_initialized=false;var b2ContactConstraint=Class.create();b2ContactConstraint.prototype={initialize:function(){this.normal=new b2Vec2();this.points=new Array(b2Settings.b2_maxManifoldPoints);for(var a=0;a<b2Settings.b2_maxManifoldPoints;a++){this.points[a]=new b2ContactConstraintPoint()}},points:null,normal:new b2Vec2(),manifold:null,body1:null,body2:null,friction:null,restitution:null,pointCount:0};var b2ContactConstraintPoint=Class.create();b2ContactConstraintPoint.prototype={localAnchor1:new b2Vec2(),localAnchor2:new b2Vec2(),normalImpulse:null,tangentImpulse:null,positionImpulse:null,normalMass:null,tangentMass:null,separation:null,velocityBias:null,initialize:function(){this.localAnchor1=new b2Vec2();this.localAnchor2=new b2Vec2()}};var b2ContactRegister=Class.create();b2ContactRegister.prototype={createFcn:null,destroyFcn:null,primary:null,initialize:function(){}};var b2ContactSolver=Class.create();b2ContactSolver.prototype={initialize:function(p,q,m){this.m_constraints=new Array();this.m_allocator=m;var W=0;var J;var P;this.m_constraintCount=0;for(W=0;W<q;++W){this.m_constraintCount+=p[W].GetManifoldCount()}for(W=0;W<this.m_constraintCount;W++){this.m_constraints[W]=new b2ContactConstraint()}var N=0;for(W=0;W<q;++W){var o=p[W];var A=o.m_shape1.m_body;var z=o.m_shape2.m_body;var f=o.GetManifoldCount();var M=o.GetManifolds();var y=o.m_friction;var a=o.m_restitution;var v=A.m_linearVelocity.x;var t=A.m_linearVelocity.y;var g=z.m_linearVelocity.x;var e=z.m_linearVelocity.y;var I=A.m_angularVelocity;var H=z.m_angularVelocity;for(var V=0;V<f;++V){var D=M[V];var L=D.normal.x;var K=D.normal.y;var X=this.m_constraints[N];X.body1=A;X.body2=z;X.manifold=D;X.normal.x=L;X.normal.y=K;X.pointCount=D.pointCount;X.friction=y;X.restitution=a;for(var T=0;T<X.pointCount;++T){var B=D.points[T];var b=X.points[T];b.normalImpulse=B.normalImpulse;b.tangentImpulse=B.tangentImpulse;b.separation=B.separation;var U=B.position.x-A.m_position.x;var S=B.position.y-A.m_position.y;var F=B.position.x-z.m_position.x;var E=B.position.y-z.m_position.y;J=b.localAnchor1;P=A.m_R;J.x=U*P.col1.x+S*P.col1.y;J.y=U*P.col2.x+S*P.col2.y;J=b.localAnchor2;P=z.m_R;J.x=F*P.col1.x+E*P.col1.y;J.y=F*P.col2.x+E*P.col2.y;var n=U*U+S*S;var G=F*F+E*E;var s=U*L+S*K;var r=F*L+E*K;var C=A.m_invMass+z.m_invMass;C+=A.m_invI*(n-s*s)+z.m_invI*(G-r*r);b.normalMass=1/C;var Q=K;var O=-L;var x=U*Q+S*O;var u=F*Q+E*O;var Y=A.m_invMass+z.m_invMass;Y+=A.m_invI*(n-x*x)+z.m_invI*(G-u*u);b.tangentMass=1/Y;b.velocityBias=0;if(b.separation>0){b.velocityBias=-60*b.separation}var l=g+(-H*E)-v-(-I*S);var h=e+(H*F)-t-(I*U);var R=X.normal.x*l+X.normal.y*h;if(R<-b2Settings.b2_velocityThreshold){b.velocityBias+=-X.restitution*R}}++N}}},PreSolve:function(){var b;var C;var s;for(var y=0;y<this.m_constraintCount;++y){var D=this.m_constraints[y];var p=D.body1;var o=D.body2;var u=p.m_invMass;var n=p.m_invI;var t=o.m_invMass;var m=o.m_invI;var f=D.normal.x;var e=D.normal.y;var l=e;var k=-f;var x=0;var z=0;if(b2World.s_enableWarmStarting){z=D.pointCount;for(x=0;x<z;++x){var a=D.points[x];var r=a.normalImpulse*f+a.tangentImpulse*l;var q=a.normalImpulse*e+a.tangentImpulse*k;s=p.m_R;b=a.localAnchor1;var B=s.col1.x*b.x+s.col2.x*b.y;var A=s.col1.y*b.x+s.col2.y*b.y;s=o.m_R;b=a.localAnchor2;var h=s.col1.x*b.x+s.col2.x*b.y;var g=s.col1.y*b.x+s.col2.y*b.y;p.m_angularVelocity-=n*(B*q-A*r);p.m_linearVelocity.x-=u*r;p.m_linearVelocity.y-=u*q;o.m_angularVelocity+=m*(h*q-g*r);o.m_linearVelocity.x+=t*r;o.m_linearVelocity.y+=t*q;a.positionImpulse=0}}else{z=D.pointCount;for(x=0;x<z;++x){var v=D.points[x];v.normalImpulse=0;v.tangentImpulse=0;v.positionImpulse=0}}}},SolveVelocityConstraints:function(){var F=0;var a;var K;var J;var l;var h;var C;var B;var z;var M;var s;var r;var t;var b;for(var G=0;G<this.m_constraintCount;++G){var L=this.m_constraints[G];var q=L.body1;var p=L.body2;var x=q.m_angularVelocity;var g=q.m_linearVelocity;var A=p.m_angularVelocity;var v=p.m_linearVelocity;var y=q.m_invMass;var o=q.m_invI;var u=p.m_invMass;var n=p.m_invI;var f=L.normal.x;var e=L.normal.y;var m=e;var k=-f;var I=L.pointCount;for(F=0;F<I;++F){a=L.points[F];t=q.m_R;b=a.localAnchor1;K=t.col1.x*b.x+t.col2.x*b.y;J=t.col1.y*b.x+t.col2.y*b.y;t=p.m_R;b=a.localAnchor2;l=t.col1.x*b.x+t.col2.x*b.y;h=t.col1.y*b.x+t.col2.y*b.y;C=v.x+(-A*h)-g.x-(-x*J);B=v.y+(A*l)-g.y-(x*K);var H=C*f+B*e;z=-a.normalMass*(H-a.velocityBias);M=b2Math.b2Max(a.normalImpulse+z,0);z=M-a.normalImpulse;s=z*f;r=z*e;g.x-=y*s;g.y-=y*r;x-=o*(K*r-J*s);v.x+=u*s;v.y+=u*r;A+=n*(l*r-h*s);a.normalImpulse=M;C=v.x+(-A*h)-g.x-(-x*J);B=v.y+(A*l)-g.y-(x*K);var E=C*m+B*k;z=a.tangentMass*(-E);var D=L.friction*a.normalImpulse;M=b2Math.b2Clamp(a.tangentImpulse+z,-D,D);z=M-a.tangentImpulse;s=z*m;r=z*k;g.x-=y*s;g.y-=y*r;x-=o*(K*r-J*s);v.x+=u*s;v.y+=u*r;A+=n*(l*r-h*s);a.tangentImpulse=M}q.m_angularVelocity=x;p.m_angularVelocity=A}},SolvePositionConstraints:function(y){var z=0;var J;var A;for(var P=0;P<this.m_constraintCount;++P){var S=this.m_constraints[P];var t=S.body1;var s=S.body2;var g=t.m_position;var a=t.m_rotation;var n=s.m_position;var h=s.m_rotation;var G=t.m_invMass;var q=t.m_invI;var E=s.m_invMass;var p=s.m_invI;var D=S.normal.x;var B=S.normal.y;var L=B;var K=-D;var r=S.pointCount;for(var O=0;O<r;++O){var b=S.points[O];J=t.m_R;A=b.localAnchor1;var N=J.col1.x*A.x+J.col2.x*A.y;var M=J.col1.y*A.x+J.col2.y*A.y;J=s.m_R;A=b.localAnchor2;var x=J.col1.x*A.x+J.col2.x*A.y;var v=J.col1.y*A.x+J.col2.y*A.y;var f=g.x+N;var e=g.y+M;var H=n.x+x;var F=n.y+v;var R=H-f;var Q=F-e;var l=(R*D+Q*B)+b.separation;z=b2Math.b2Min(z,l);var k=y*b2Math.b2Clamp(l+b2Settings.b2_linearSlop,-b2Settings.b2_maxLinearCorrection,0);var u=-b.normalMass*k;var I=b.positionImpulse;b.positionImpulse=b2Math.b2Max(I+u,0);u=b.positionImpulse-I;var o=u*D;var m=u*B;g.x-=G*o;g.y-=G*m;a-=q*(N*m-M*o);t.m_R.Set(a);n.x+=E*o;n.y+=E*m;h+=p*(x*m-v*o);s.m_R.Set(h)}t.m_rotation=a;s.m_rotation=h}return z>=-b2Settings.b2_linearSlop},PostSolve:function(){for(var e=0;e<this.m_constraintCount;++e){var h=this.m_constraints[e];var a=h.manifold;for(var b=0;b<h.pointCount;++b){var g=a.points[b];var f=h.points[b];g.normalImpulse=f.normalImpulse;g.tangentImpulse=f.tangentImpulse}}},m_allocator:null,m_constraints:new Array(),m_constraintCount:0};var b2CircleContact=Class.create();Object.extend(b2CircleContact.prototype,b2Contact.prototype);Object.extend(b2CircleContact.prototype,{initialize:function(b,a){this.m_node1=new b2ContactNode();this.m_node2=new b2ContactNode();this.m_flags=0;if(!b||!a){this.m_shape1=null;this.m_shape2=null;return}this.m_shape1=b;this.m_shape2=a;this.m_manifoldCount=0;this.m_friction=Math.sqrt(this.m_shape1.m_friction*this.m_shape2.m_friction);this.m_restitution=b2Math.b2Max(this.m_shape1.m_restitution,this.m_shape2.m_restitution);this.m_prev=null;this.m_next=null;this.m_node1.contact=null;this.m_node1.prev=null;this.m_node1.next=null;this.m_node1.other=null;this.m_node2.contact=null;this.m_node2.prev=null;this.m_node2.next=null;this.m_node2.other=null;this.m_manifold=[new b2Manifold()];this.m_manifold[0].pointCount=0;this.m_manifold[0].points[0].normalImpulse=0;this.m_manifold[0].points[0].tangentImpulse=0},Evaluate:function(){b2Collision.b2CollideCircle(this.m_manifold[0],this.m_shape1,this.m_shape2,false);if(this.m_manifold[0].pointCount>0){this.m_manifoldCount=1}else{this.m_manifoldCount=0}},GetManifolds:function(){return this.m_manifold},m_manifold:[new b2Manifold()]});b2CircleContact.Create=function(b,a,c){return new b2CircleContact(b,a)};b2CircleContact.Destroy=function(a,b){};var b2Conservative=Class.create();b2Conservative.prototype={initialize:function(){}};b2Conservative.R1=new b2Mat22();b2Conservative.R2=new b2Mat22();b2Conservative.x1=new b2Vec2();b2Conservative.x2=new b2Vec2();b2Conservative.Conservative=function(l,k){var j=l.GetBody();var h=k.GetBody();var t=j.m_position.x-j.m_position0.x;var r=j.m_position.y-j.m_position0.y;var J=j.m_rotation-j.m_rotation0;var b=h.m_position.x-h.m_position0.x;var a=h.m_position.y-h.m_position0.y;var H=h.m_rotation-h.m_rotation0;var n=l.GetMaxRadius();var m=k.GetMaxRadius();var K=j.m_position0.x;var F=j.m_position0.y;var B=j.m_rotation0;var G=h.m_position0.x;var E=h.m_position0.y;var o=h.m_rotation0;var e=K;var c=F;var L=B;var D=G;var C=E;var I=o;b2Conservative.R1.Set(L);b2Conservative.R2.Set(I);l.QuickSync(p1,b2Conservative.R1);k.QuickSync(p2,b2Conservative.R2);var N=0;var p=10;var v;var u;var A=0;var x=true;for(var y=0;y<p;++y){var s=b2Distance.Distance(b2Conservative.x1,b2Conservative.x2,l,k);if(s<b2Settings.b2_linearSlop){if(y==0){x=false}else{x=true}break}if(y==0){v=b2Conservative.x2.x-b2Conservative.x1.x;u=b2Conservative.x2.y-b2Conservative.x1.y;var f=Math.sqrt(v*v+u*u);var z=(v*(t-b)+u*(r-a))+Math.abs(J)*n+Math.abs(H)*m;if(Math.abs(z)<Number.MIN_VALUE){x=false;break}A=1/z}var g=s*A;var M=N+g;if(M<0||1<M){x=false;break}if(M<(1+100*Number.MIN_VALUE)*N){x=true;break}N=M;e=K+N*v1.x;c=F+N*v1.y;L=B+N*J;D=G+N*v2.x;C=E+N*v2.y;I=o+N*H;b2Conservative.R1.Set(L);b2Conservative.R2.Set(I);l.QuickSync(p1,b2Conservative.R1);k.QuickSync(p2,b2Conservative.R2)}if(x){v=b2Conservative.x2.x-b2Conservative.x1.x;u=b2Conservative.x2.y-b2Conservative.x1.y;var q=Math.sqrt(v*v+u*u);if(q>FLT_EPSILON){d*=b2_linearSlop/q}if(j.IsStatic()){j.m_position.x=e;j.m_position.y=c}else{j.m_position.x=e-v;j.m_position.y=c-u}j.m_rotation=L;j.m_R.Set(L);j.QuickSyncShapes();if(h.IsStatic()){h.m_position.x=D;h.m_position.y=C}else{h.m_position.x=D+v;h.m_position.y=C+u}h.m_position.x=D+v;h.m_position.y=C+u;h.m_rotation=I;h.m_R.Set(I);h.QuickSyncShapes();return true}l.QuickSync(j.m_position,j.m_R);k.QuickSync(h.m_position,h.m_R);return false};var b2NullContact=Class.create();Object.extend(b2NullContact.prototype,b2Contact.prototype);Object.extend(b2NullContact.prototype,{initialize:function(b,a){this.m_node1=new b2ContactNode();this.m_node2=new b2ContactNode();this.m_flags=0;if(!b||!a){this.m_shape1=null;this.m_shape2=null;return}this.m_shape1=b;this.m_shape2=a;this.m_manifoldCount=0;this.m_friction=Math.sqrt(this.m_shape1.m_friction*this.m_shape2.m_friction);this.m_restitution=b2Math.b2Max(this.m_shape1.m_restitution,this.m_shape2.m_restitution);this.m_prev=null;this.m_next=null;this.m_node1.contact=null;this.m_node1.prev=null;this.m_node1.next=null;this.m_node1.other=null;this.m_node2.contact=null;this.m_node2.prev=null;this.m_node2.next=null;this.m_node2.other=null},Evaluate:function(){},GetManifolds:function(){return null}});var b2PolyAndCircleContact=Class.create();Object.extend(b2PolyAndCircleContact.prototype,b2Contact.prototype);Object.extend(b2PolyAndCircleContact.prototype,{initialize:function(b,a){this.m_node1=new b2ContactNode();this.m_node2=new b2ContactNode();this.m_flags=0;if(!b||!a){this.m_shape1=null;this.m_shape2=null;return}this.m_shape1=b;this.m_shape2=a;this.m_manifoldCount=0;this.m_friction=Math.sqrt(this.m_shape1.m_friction*this.m_shape2.m_friction);this.m_restitution=b2Math.b2Max(this.m_shape1.m_restitution,this.m_shape2.m_restitution);this.m_prev=null;this.m_next=null;this.m_node1.contact=null;this.m_node1.prev=null;this.m_node1.next=null;this.m_node1.other=null;this.m_node2.contact=null;this.m_node2.prev=null;this.m_node2.next=null;this.m_node2.other=null;this.m_manifold=[new b2Manifold()];b2Settings.b2Assert(this.m_shape1.m_type==b2Shape.e_polyShape);b2Settings.b2Assert(this.m_shape2.m_type==b2Shape.e_circleShape);this.m_manifold[0].pointCount=0;this.m_manifold[0].points[0].normalImpulse=0;this.m_manifold[0].points[0].tangentImpulse=0},Evaluate:function(){b2Collision.b2CollidePolyAndCircle(this.m_manifold[0],this.m_shape1,this.m_shape2,false);if(this.m_manifold[0].pointCount>0){this.m_manifoldCount=1}else{this.m_manifoldCount=0}},GetManifolds:function(){return this.m_manifold},m_manifold:[new b2Manifold()]});b2PolyAndCircleContact.Create=function(b,a,c){return new b2PolyAndCircleContact(b,a)};b2PolyAndCircleContact.Destroy=function(a,b){};var b2PolyContact=Class.create();Object.extend(b2PolyContact.prototype,b2Contact.prototype);Object.extend(b2PolyContact.prototype,{initialize:function(b,a){this.m_node1=new b2ContactNode();this.m_node2=new b2ContactNode();this.m_flags=0;if(!b||!a){this.m_shape1=null;this.m_shape2=null;return}this.m_shape1=b;this.m_shape2=a;this.m_manifoldCount=0;this.m_friction=Math.sqrt(this.m_shape1.m_friction*this.m_shape2.m_friction);this.m_restitution=b2Math.b2Max(this.m_shape1.m_restitution,this.m_shape2.m_restitution);this.m_prev=null;this.m_next=null;this.m_node1.contact=null;this.m_node1.prev=null;this.m_node1.next=null;this.m_node1.other=null;this.m_node2.contact=null;this.m_node2.prev=null;this.m_node2.next=null;this.m_node2.other=null;this.m0=new b2Manifold();this.m_manifold=[new b2Manifold()];this.m_manifold[0].pointCount=0},m0:new b2Manifold(),Evaluate:function(){var a=this.m_manifold[0];var b=this.m0.points;for(var e=0;e<a.pointCount;e++){var c=b[e];var p=a.points[e];c.normalImpulse=p.normalImpulse;c.tangentImpulse=p.tangentImpulse;c.id=p.id.Copy()}this.m0.pointCount=a.pointCount;b2Collision.b2CollidePoly(a,this.m_shape1,this.m_shape2,false);if(a.pointCount>0){var l=[false,false];for(var g=0;g<a.pointCount;++g){var n=a.points[g];n.normalImpulse=0;n.tangentImpulse=0;var m=n.id.key;for(var f=0;f<this.m0.pointCount;++f){if(l[f]==true){continue}var h=this.m0.points[f];var o=h.id;if(o.key==m){l[f]=true;n.normalImpulse=h.normalImpulse;n.tangentImpulse=h.tangentImpulse;break}}}this.m_manifoldCount=1}else{this.m_manifoldCount=0}},GetManifolds:function(){return this.m_manifold},m_manifold:[new b2Manifold()]});b2PolyContact.Create=function(b,a,c){return new b2PolyContact(b,a)};b2PolyContact.Destroy=function(a,b){};var b2ContactManager=Class.create();Object.extend(b2ContactManager.prototype,b2PairCallback.prototype);Object.extend(b2ContactManager.prototype,{initialize:function(){this.m_nullContact=new b2NullContact();this.m_world=null;this.m_destroyImmediate=false},PairAdded:function(g,e){var k=g;var h=e;var a=k.m_body;var j=h.m_body;if(a.IsStatic()&&j.IsStatic()){return this.m_nullContact}if(k.m_body==h.m_body){return this.m_nullContact}if(j.IsConnected(a)){return this.m_nullContact}if(this.m_world.m_filter!=null&&this.m_world.m_filter.ShouldCollide(k,h)==false){return this.m_nullContact}if(j.m_invMass==0){var f=k;k=h;h=f;var c=a;a=j;j=c}var b=b2Contact.Create(k,h,this.m_world.m_blockAllocator);if(b==null){return this.m_nullContact}else{b.m_prev=null;b.m_next=this.m_world.m_contactList;if(this.m_world.m_contactList!=null){this.m_world.m_contactList.m_prev=b}this.m_world.m_contactList=b;this.m_world.m_contactCount++}return b},PairRemoved:function(f,b,a){if(a==null){return}var e=a;if(e!=this.m_nullContact){if(this.m_destroyImmediate==true){this.DestroyContact(e);e=null}else{e.m_flags|=b2Contact.e_destroyFlag}}},DestroyContact:function(g){if(g.m_prev){g.m_prev.m_next=g.m_next}if(g.m_next){g.m_next.m_prev=g.m_prev}if(g==this.m_world.m_contactList){this.m_world.m_contactList=g.m_next}if(g.GetManifoldCount()>0){var f=g.m_shape1.m_body;var e=g.m_shape2.m_body;var b=g.m_node1;var a=g.m_node2;f.WakeUp();e.WakeUp();if(b.prev){b.prev.next=b.next}if(b.next){b.next.prev=b.prev}if(b==f.m_contactList){f.m_contactList=b.next}b.prev=null;b.next=null;if(a.prev){a.prev.next=a.next}if(a.next){a.next.prev=a.prev}if(a==e.m_contactList){e.m_contactList=a.next}a.prev=null;a.next=null}b2Contact.Destroy(g,this.m_world.m_blockAllocator);--this.m_world.m_contactCount},CleanContactList:function(){var b=this.m_world.m_contactList;while(b!=null){var a=b;b=b.m_next;if(a.m_flags&b2Contact.e_destroyFlag){this.DestroyContact(a);a=null}}},Collide:function(){var g;var f;var e;var a;for(var j=this.m_world.m_contactList;j!=null;j=j.m_next){if(j.m_shape1.m_body.IsSleeping()&&j.m_shape2.m_body.IsSleeping()){continue}var b=j.GetManifoldCount();j.Evaluate();var h=j.GetManifoldCount();if(b==0&&h>0){g=j.m_shape1.m_body;f=j.m_shape2.m_body;e=j.m_node1;a=j.m_node2;e.contact=j;e.other=f;e.prev=null;e.next=g.m_contactList;if(e.next!=null){e.next.prev=j.m_node1}g.m_contactList=j.m_node1;a.contact=j;a.other=g;a.prev=null;a.next=f.m_contactList;if(a.next!=null){a.next.prev=a}f.m_contactList=a}else{if(b>0&&h==0){g=j.m_shape1.m_body;f=j.m_shape2.m_body;e=j.m_node1;a=j.m_node2;if(e.prev){e.prev.next=e.next}if(e.next){e.next.prev=e.prev}if(e==g.m_contactList){g.m_contactList=e.next}e.prev=null;e.next=null;if(a.prev){a.prev.next=a.next}if(a.next){a.next.prev=a.prev}if(a==f.m_contactList){f.m_contactList=a.next}a.prev=null;a.next=null}}}},m_world:null,m_nullContact:new b2NullContact(),m_destroyImmediate:null});var b2World=Class.create();b2World.prototype={initialize:function(a,e,c){this.step=new b2TimeStep();this.m_contactManager=new b2ContactManager();this.m_listener=null;this.m_filter=b2CollisionFilter.b2_defaultFilter;this.m_bodyList=null;this.m_contactList=null;this.m_jointList=null;this.m_bodyCount=0;this.m_contactCount=0;this.m_jointCount=0;this.m_bodyDestroyList=null;this.m_allowSleep=c;this.m_gravity=e;this.m_contactManager.m_world=this;this.m_broadPhase=new b2BroadPhase(a,this.m_contactManager);var b=new b2BodyDef();this.m_groundBody=this.CreateBody(b)},SetListener:function(a){this.m_listener=a},SetFilter:function(a){this.m_filter=a},CreateBody:function(c){var a=new b2Body(c,this);a.m_prev=null;a.m_next=this.m_bodyList;if(this.m_bodyList){this.m_bodyList.m_prev=a}this.m_bodyList=a;++this.m_bodyCount;return a},DestroyBody:function(a){if(a.m_flags&b2Body.e_destroyFlag){return}if(a.m_prev){a.m_prev.m_next=a.m_next}if(a.m_next){a.m_next.m_prev=a.m_prev}if(a==this.m_bodyList){this.m_bodyList=a.m_next}a.m_flags|=b2Body.e_destroyFlag;--this.m_bodyCount;a.m_prev=null;a.m_next=this.m_bodyDestroyList;this.m_bodyDestroyList=a},CleanBodyList:function(){this.m_contactManager.m_destroyImmediate=true;var c=this.m_bodyDestroyList;while(c){var f=c;c=c.m_next;var e=f.m_jointList;while(e){var a=e;e=e.next;if(this.m_listener){this.m_listener.NotifyJointDestroyed(a.joint)}this.DestroyJoint(a.joint)}f.Destroy()}this.m_bodyDestroyList=null;this.m_contactManager.m_destroyImmediate=false},CreateJoint:function(f){var c=b2Joint.Create(f,this.m_blockAllocator);c.m_prev=null;c.m_next=this.m_jointList;if(this.m_jointList){this.m_jointList.m_prev=c}this.m_jointList=c;++this.m_jointCount;c.m_node1.joint=c;c.m_node1.other=c.m_body2;c.m_node1.prev=null;c.m_node1.next=c.m_body1.m_jointList;if(c.m_body1.m_jointList){c.m_body1.m_jointList.prev=c.m_node1}c.m_body1.m_jointList=c.m_node1;c.m_node2.joint=c;c.m_node2.other=c.m_body1;c.m_node2.prev=null;c.m_node2.next=c.m_body2.m_jointList;if(c.m_body2.m_jointList){c.m_body2.m_jointList.prev=c.m_node2}c.m_body2.m_jointList=c.m_node2;if(f.collideConnected==false){var a=f.body1.m_shapeCount<f.body2.m_shapeCount?f.body1:f.body2;for(var e=a.m_shapeList;e;e=e.m_next){e.ResetProxy(this.m_broadPhase)}}return c},DestroyJoint:function(f){var h=f.m_collideConnected;if(f.m_prev){f.m_prev.m_next=f.m_next}if(f.m_next){f.m_next.m_prev=f.m_prev}if(f==this.m_jointList){this.m_jointList=f.m_next}var e=f.m_body1;var c=f.m_body2;e.WakeUp();c.WakeUp();if(f.m_node1.prev){f.m_node1.prev.next=f.m_node1.next}if(f.m_node1.next){f.m_node1.next.prev=f.m_node1.prev}if(f.m_node1==e.m_jointList){e.m_jointList=f.m_node1.next}f.m_node1.prev=null;f.m_node1.next=null;if(f.m_node2.prev){f.m_node2.prev.next=f.m_node2.next}if(f.m_node2.next){f.m_node2.next.prev=f.m_node2.prev}if(f.m_node2==c.m_jointList){c.m_jointList=f.m_node2.next}f.m_node2.prev=null;f.m_node2.next=null;b2Joint.Destroy(f,this.m_blockAllocator);--this.m_jointCount;if(h==false){var a=e.m_shapeCount<c.m_shapeCount?e:c;for(var g=a.m_shapeList;g;g=g.m_next){g.ResetProxy(this.m_broadPhase)}}},GetGroundBody:function(){return this.m_groundBody},step:new b2TimeStep(),Step:function(a,e){var s;var p;this.step.dt=a;this.step.iterations=e;if(a>0){this.step.inv_dt=1/a}else{this.step.inv_dt=0}this.m_positionIterationCount=0;this.m_contactManager.CleanContactList();this.CleanBodyList();this.m_contactManager.Collide();var o=new b2Island(this.m_bodyCount,this.m_contactCount,this.m_jointCount,this.m_stackAllocator);for(s=this.m_bodyList;s!=null;s=s.m_next){s.m_flags&=~b2Body.e_islandFlag}for(var q=this.m_contactList;q!=null;q=q.m_next){q.m_flags&=~b2Contact.e_islandFlag}for(var l=this.m_jointList;l!=null;l=l.m_next){l.m_islandFlag=false}var v=this.m_bodyCount;var r=new Array(this.m_bodyCount);for(var h=0;h<this.m_bodyCount;h++){r[h]=null}for(var n=this.m_bodyList;n!=null;n=n.m_next){if(n.m_flags&(b2Body.e_staticFlag|b2Body.e_islandFlag|b2Body.e_sleepFlag|b2Body.e_frozenFlag)){continue}o.Clear();var u=0;r[u++]=n;n.m_flags|=b2Body.e_islandFlag;while(u>0){s=r[--u];o.AddBody(s);s.m_flags&=~b2Body.e_sleepFlag;if(s.m_flags&b2Body.e_staticFlag){continue}for(var t=s.m_contactList;t!=null;t=t.next){if(t.contact.m_flags&b2Contact.e_islandFlag){continue}o.AddContact(t.contact);t.contact.m_flags|=b2Contact.e_islandFlag;p=t.other;if(p.m_flags&b2Body.e_islandFlag){continue}r[u++]=p;p.m_flags|=b2Body.e_islandFlag}for(var g=s.m_jointList;g!=null;g=g.next){if(g.joint.m_islandFlag==true){continue}o.AddJoint(g.joint);g.joint.m_islandFlag=true;p=g.other;if(p.m_flags&b2Body.e_islandFlag){continue}r[u++]=p;p.m_flags|=b2Body.e_islandFlag}}o.Solve(this.step,this.m_gravity);this.m_positionIterationCount=b2Math.b2Max(this.m_positionIterationCount,b2Island.m_positionIterationCount);if(this.m_allowSleep){o.UpdateSleep(a)}for(var m=0;m<o.m_bodyCount;++m){s=o.m_bodies[m];if(s.m_flags&b2Body.e_staticFlag){s.m_flags&=~b2Body.e_islandFlag}if(s.IsFrozen()&&this.m_listener){var f=this.m_listener.NotifyBoundaryViolated(s);if(f==b2WorldListener.b2_destroyBody){this.DestroyBody(s);s=null;o.m_bodies[m]=null}}}}this.m_broadPhase.Commit()},Query:function(b,a,g){var e=new Array();var f=this.m_broadPhase.QueryAABB(b,e,g);for(var c=0;c<f;++c){a[c]=e[c]}return f},GetBodyList:function(){return this.m_bodyList},GetJointList:function(){return this.m_jointList},GetContactList:function(){return this.m_contactList},m_blockAllocator:null,m_stackAllocator:null,m_broadPhase:null,m_contactManager:new b2ContactManager(),m_bodyList:null,m_contactList:null,m_jointList:null,m_bodyCount:0,m_contactCount:0,m_jointCount:0,m_bodyDestroyList:null,m_gravity:null,m_allowSleep:null,m_groundBody:null,m_listener:null,m_filter:null,m_positionIterationCount:0};b2World.s_enablePositionCorrection=1;b2World.s_enableWarmStarting=1;var b2WorldListener=Class.create();b2WorldListener.prototype={NotifyJointDestroyed:function(a){},NotifyBoundaryViolated:function(a){return b2WorldListener.b2_freezeBody},initialize:function(){}};b2WorldListener.b2_freezeBody=0;b2WorldListener.b2_destroyBody=1;var b2JointNode=Class.create();b2JointNode.prototype={other:null,joint:null,prev:null,next:null,initialize:function(){}};var b2Joint=Class.create();b2Joint.prototype={GetType:function(){return this.m_type},GetAnchor1:function(){return null},GetAnchor2:function(){return null},GetReactionForce:function(a){return null},GetReactionTorque:function(a){return 0},GetBody1:function(){return this.m_body1},GetBody2:function(){return this.m_body2},GetNext:function(){return this.m_next},GetUserData:function(){return this.m_userData},initialize:function(a){this.m_node1=new b2JointNode();this.m_node2=new b2JointNode();this.m_type=a.type;this.m_prev=null;this.m_next=null;this.m_body1=a.body1;this.m_body2=a.body2;this.m_collideConnected=a.collideConnected;this.m_islandFlag=false;this.m_userData=a.userData},PrepareVelocitySolver:function(){},SolveVelocityConstraints:function(a){},PreparePositionSolver:function(){},SolvePositionConstraints:function(){return false},m_type:0,m_prev:null,m_next:null,m_node1:new b2JointNode(),m_node2:new b2JointNode(),m_body1:null,m_body2:null,m_islandFlag:null,m_collideConnected:null,m_userData:null};b2Joint.Create=function(b,a){var c=null;switch(b.type){case b2Joint.e_distanceJoint:c=new b2DistanceJoint(b);break;case b2Joint.e_mouseJoint:c=new b2MouseJoint(b);break;case b2Joint.e_prismaticJoint:c=new b2PrismaticJoint(b);break;case b2Joint.e_revoluteJoint:c=new b2RevoluteJoint(b);break;case b2Joint.e_pulleyJoint:c=new b2PulleyJoint(b);break;case b2Joint.e_gearJoint:c=new b2GearJoint(b);break;default:break}return c};b2Joint.Destroy=function(b,a){};b2Joint.e_unknownJoint=0;b2Joint.e_revoluteJoint=1;b2Joint.e_prismaticJoint=2;b2Joint.e_distanceJoint=3;b2Joint.e_pulleyJoint=4;b2Joint.e_mouseJoint=5;b2Joint.e_gearJoint=6;b2Joint.e_inactiveLimit=0;b2Joint.e_atLowerLimit=1;b2Joint.e_atUpperLimit=2;b2Joint.e_equalLimits=3;var b2JointDef=Class.create();b2JointDef.prototype={initialize:function(){this.type=b2Joint.e_unknownJoint;this.userData=null;this.body1=null;this.body2=null;this.collideConnected=false},type:0,userData:null,body1:null,body2:null,collideConnected:null};var b2DistanceJoint=Class.create();Object.extend(b2DistanceJoint.prototype,b2Joint.prototype);Object.extend(b2DistanceJoint.prototype,{initialize:function(c){this.m_node1=new b2JointNode();this.m_node2=new b2JointNode();this.m_type=c.type;this.m_prev=null;this.m_next=null;this.m_body1=c.body1;this.m_body2=c.body2;this.m_collideConnected=c.collideConnected;this.m_islandFlag=false;this.m_userData=c.userData;this.m_localAnchor1=new b2Vec2();this.m_localAnchor2=new b2Vec2();this.m_u=new b2Vec2();var b;var a;var e;b=this.m_body1.m_R;a=c.anchorPoint1.x-this.m_body1.m_position.x;e=c.anchorPoint1.y-this.m_body1.m_position.y;this.m_localAnchor1.x=a*b.col1.x+e*b.col1.y;this.m_localAnchor1.y=a*b.col2.x+e*b.col2.y;b=this.m_body2.m_R;a=c.anchorPoint2.x-this.m_body2.m_position.x;e=c.anchorPoint2.y-this.m_body2.m_position.y;this.m_localAnchor2.x=a*b.col1.x+e*b.col1.y;this.m_localAnchor2.y=a*b.col2.x+e*b.col2.y;a=c.anchorPoint2.x-c.anchorPoint1.x;e=c.anchorPoint2.y-c.anchorPoint1.y;this.m_length=Math.sqrt(a*a+e*e);this.m_impulse=0},PrepareVelocitySolver:function(){var h;h=this.m_body1.m_R;var l=h.col1.x*this.m_localAnchor1.x+h.col2.x*this.m_localAnchor1.y;var k=h.col1.y*this.m_localAnchor1.x+h.col2.y*this.m_localAnchor1.y;h=this.m_body2.m_R;var g=h.col1.x*this.m_localAnchor2.x+h.col2.x*this.m_localAnchor2.y;var f=h.col1.y*this.m_localAnchor2.x+h.col2.y*this.m_localAnchor2.y;this.m_u.x=this.m_body2.m_position.x+g-this.m_body1.m_position.x-l;this.m_u.y=this.m_body2.m_position.y+f-this.m_body1.m_position.y-k;var a=Math.sqrt(this.m_u.x*this.m_u.x+this.m_u.y*this.m_u.y);if(a>b2Settings.b2_linearSlop){this.m_u.Multiply(1/a)}else{this.m_u.SetZero()}var j=(l*this.m_u.y-k*this.m_u.x);var e=(g*this.m_u.y-f*this.m_u.x);this.m_mass=this.m_body1.m_invMass+this.m_body1.m_invI*j*j+this.m_body2.m_invMass+this.m_body2.m_invI*e*e;this.m_mass=1/this.m_mass;if(b2World.s_enableWarmStarting){var c=this.m_impulse*this.m_u.x;var b=this.m_impulse*this.m_u.y;this.m_body1.m_linearVelocity.x-=this.m_body1.m_invMass*c;this.m_body1.m_linearVelocity.y-=this.m_body1.m_invMass*b;this.m_body1.m_angularVelocity-=this.m_body1.m_invI*(l*b-k*c);this.m_body2.m_linearVelocity.x+=this.m_body2.m_invMass*c;this.m_body2.m_linearVelocity.y+=this.m_body2.m_invMass*b;this.m_body2.m_angularVelocity+=this.m_body2.m_invI*(g*b-f*c)}else{this.m_impulse=0}},SolveVelocityConstraints:function(b){var l;l=this.m_body1.m_R;var p=l.col1.x*this.m_localAnchor1.x+l.col2.x*this.m_localAnchor1.y;var o=l.col1.y*this.m_localAnchor1.x+l.col2.y*this.m_localAnchor1.y;l=this.m_body2.m_R;var j=l.col1.x*this.m_localAnchor2.x+l.col2.x*this.m_localAnchor2.y;var h=l.col1.y*this.m_localAnchor2.x+l.col2.y*this.m_localAnchor2.y;var n=this.m_body1.m_linearVelocity.x+(-this.m_body1.m_angularVelocity*o);var m=this.m_body1.m_linearVelocity.y+(this.m_body1.m_angularVelocity*p);var g=this.m_body2.m_linearVelocity.x+(-this.m_body2.m_angularVelocity*h);var f=this.m_body2.m_linearVelocity.y+(this.m_body2.m_angularVelocity*j);var k=(this.m_u.x*(g-n)+this.m_u.y*(f-m));var a=-this.m_mass*k;this.m_impulse+=a;var e=a*this.m_u.x;var c=a*this.m_u.y;this.m_body1.m_linearVelocity.x-=this.m_body1.m_invMass*e;this.m_body1.m_linearVelocity.y-=this.m_body1.m_invMass*c;this.m_body1.m_angularVelocity-=this.m_body1.m_invI*(p*c-o*e);this.m_body2.m_linearVelocity.x+=this.m_body2.m_invMass*e;this.m_body2.m_linearVelocity.y+=this.m_body2.m_invMass*c;this.m_body2.m_angularVelocity+=this.m_body2.m_invI*(j*c-h*e)},SolvePositionConstraints:function(){var l;l=this.m_body1.m_R;var n=l.col1.x*this.m_localAnchor1.x+l.col2.x*this.m_localAnchor1.y;var m=l.col1.y*this.m_localAnchor1.x+l.col2.y*this.m_localAnchor1.y;l=this.m_body2.m_R;var k=l.col1.x*this.m_localAnchor2.x+l.col2.x*this.m_localAnchor2.y;var j=l.col1.y*this.m_localAnchor2.x+l.col2.y*this.m_localAnchor2.y;var h=this.m_body2.m_position.x+k-this.m_body1.m_position.x-n;var g=this.m_body2.m_position.y+j-this.m_body1.m_position.y-m;var c=Math.sqrt(h*h+g*g);h/=c;g/=c;var a=c-this.m_length;a=b2Math.b2Clamp(a,-b2Settings.b2_maxLinearCorrection,b2Settings.b2_maxLinearCorrection);var b=-this.m_mass*a;this.m_u.Set(h,g);var f=b*this.m_u.x;var e=b*this.m_u.y;this.m_body1.m_position.x-=this.m_body1.m_invMass*f;this.m_body1.m_position.y-=this.m_body1.m_invMass*e;this.m_body1.m_rotation-=this.m_body1.m_invI*(n*e-m*f);this.m_body2.m_position.x+=this.m_body2.m_invMass*f;this.m_body2.m_position.y+=this.m_body2.m_invMass*e;this.m_body2.m_rotation+=this.m_body2.m_invI*(k*e-j*f);this.m_body1.m_R.Set(this.m_body1.m_rotation);this.m_body2.m_R.Set(this.m_body2.m_rotation);return b2Math.b2Abs(a)<b2Settings.b2_linearSlop},GetAnchor1:function(){return b2Math.AddVV(this.m_body1.m_position,b2Math.b2MulMV(this.m_body1.m_R,this.m_localAnchor1))},GetAnchor2:function(){return b2Math.AddVV(this.m_body2.m_position,b2Math.b2MulMV(this.m_body2.m_R,this.m_localAnchor2))},GetReactionForce:function(a){var b=new b2Vec2();b.SetV(this.m_u);b.Multiply(this.m_impulse*a);return b},GetReactionTorque:function(a){return 0},m_localAnchor1:new b2Vec2(),m_localAnchor2:new b2Vec2(),m_u:new b2Vec2(),m_impulse:null,m_mass:null,m_length:null});var b2DistanceJointDef=Class.create();Object.extend(b2DistanceJointDef.prototype,b2JointDef.prototype);Object.extend(b2DistanceJointDef.prototype,{initialize:function(){this.type=b2Joint.e_unknownJoint;this.userData=null;this.body1=null;this.body2=null;this.collideConnected=false;this.anchorPoint1=new b2Vec2();this.anchorPoint2=new b2Vec2();this.type=b2Joint.e_distanceJoint},anchorPoint1:new b2Vec2(),anchorPoint2:new b2Vec2()});var b2Jacobian=Class.create();b2Jacobian.prototype={linear1:new b2Vec2(),angular1:null,linear2:new b2Vec2(),angular2:null,SetZero:function(){this.linear1.SetZero();this.angular1=0;this.linear2.SetZero();this.angular2=0},Set:function(e,b,c,a){this.linear1.SetV(e);this.angular1=b;this.linear2.SetV(c);this.angular2=a},Compute:function(e,b,c,a){return(this.linear1.x*e.x+this.linear1.y*e.y)+this.angular1*b+(this.linear2.x*c.x+this.linear2.y*c.y)+this.angular2*a},initialize:function(){this.linear1=new b2Vec2();this.linear2=new b2Vec2()}};var b2GearJoint=Class.create();Object.extend(b2GearJoint.prototype,b2Joint.prototype);Object.extend(b2GearJoint.prototype,{GetAnchor1:function(){var a=this.m_body1.m_R;return new b2Vec2(this.m_body1.m_position.x+(a.col1.x*this.m_localAnchor1.x+a.col2.x*this.m_localAnchor1.y),this.m_body1.m_position.y+(a.col1.y*this.m_localAnchor1.x+a.col2.y*this.m_localAnchor1.y))},GetAnchor2:function(){var a=this.m_body2.m_R;return new b2Vec2(this.m_body2.m_position.x+(a.col1.x*this.m_localAnchor2.x+a.col2.x*this.m_localAnchor2.y),this.m_body2.m_position.y+(a.col1.y*this.m_localAnchor2.x+a.col2.y*this.m_localAnchor2.y))},GetReactionForce:function(a){return new b2Vec2()},GetReactionTorque:function(a){return 0},GetRatio:function(){return this.m_ratio},initialize:function(a){this.m_node1=new b2JointNode();this.m_node2=new b2JointNode();this.m_type=a.type;this.m_prev=null;this.m_next=null;this.m_body1=a.body1;this.m_body2=a.body2;this.m_collideConnected=a.collideConnected;this.m_islandFlag=false;this.m_userData=a.userData;this.m_groundAnchor1=new b2Vec2();this.m_groundAnchor2=new b2Vec2();this.m_localAnchor1=new b2Vec2();this.m_localAnchor2=new b2Vec2();this.m_J=new b2Jacobian();this.m_revolute1=null;this.m_prismatic1=null;this.m_revolute2=null;this.m_prismatic2=null;var c;var b;this.m_ground1=a.joint1.m_body1;this.m_body1=a.joint1.m_body2;if(a.joint1.m_type==b2Joint.e_revoluteJoint){this.m_revolute1=a.joint1;this.m_groundAnchor1.SetV(this.m_revolute1.m_localAnchor1);this.m_localAnchor1.SetV(this.m_revolute1.m_localAnchor2);c=this.m_revolute1.GetJointAngle()}else{this.m_prismatic1=a.joint1;this.m_groundAnchor1.SetV(this.m_prismatic1.m_localAnchor1);this.m_localAnchor1.SetV(this.m_prismatic1.m_localAnchor2);c=this.m_prismatic1.GetJointTranslation()}this.m_ground2=a.joint2.m_body1;this.m_body2=a.joint2.m_body2;if(a.joint2.m_type==b2Joint.e_revoluteJoint){this.m_revolute2=a.joint2;this.m_groundAnchor2.SetV(this.m_revolute2.m_localAnchor1);this.m_localAnchor2.SetV(this.m_revolute2.m_localAnchor2);b=this.m_revolute2.GetJointAngle()}else{this.m_prismatic2=a.joint2;this.m_groundAnchor2.SetV(this.m_prismatic2.m_localAnchor1);this.m_localAnchor2.SetV(this.m_prismatic2.m_localAnchor2);b=this.m_prismatic2.GetJointTranslation()}this.m_ratio=a.ratio;this.m_constant=c+this.m_ratio*b;this.m_impulse=0},PrepareVelocitySolver:function(){var a=this.m_ground1;var n=this.m_ground2;var k=this.m_body1;var g=this.m_body2;var l;var h;var c;var b;var e;var m;var j;var f=0;this.m_J.SetZero();if(this.m_revolute1){this.m_J.angular1=-1;f+=k.m_invI}else{e=a.m_R;m=this.m_prismatic1.m_localXAxis1;l=e.col1.x*m.x+e.col2.x*m.y;h=e.col1.y*m.x+e.col2.y*m.y;e=k.m_R;c=e.col1.x*this.m_localAnchor1.x+e.col2.x*this.m_localAnchor1.y;b=e.col1.y*this.m_localAnchor1.x+e.col2.y*this.m_localAnchor1.y;j=c*h-b*l;this.m_J.linear1.Set(-l,-h);this.m_J.angular1=-j;f+=k.m_invMass+k.m_invI*j*j}if(this.m_revolute2){this.m_J.angular2=-this.m_ratio;f+=this.m_ratio*this.m_ratio*g.m_invI}else{e=n.m_R;m=this.m_prismatic2.m_localXAxis1;l=e.col1.x*m.x+e.col2.x*m.y;h=e.col1.y*m.x+e.col2.y*m.y;e=g.m_R;c=e.col1.x*this.m_localAnchor2.x+e.col2.x*this.m_localAnchor2.y;b=e.col1.y*this.m_localAnchor2.x+e.col2.y*this.m_localAnchor2.y;j=c*h-b*l;this.m_J.linear2.Set(-this.m_ratio*l,-this.m_ratio*h);this.m_J.angular2=-this.m_ratio*j;f+=this.m_ratio*this.m_ratio*(g.m_invMass+g.m_invI*j*j)}this.m_mass=1/f;k.m_linearVelocity.x+=k.m_invMass*this.m_impulse*this.m_J.linear1.x;k.m_linearVelocity.y+=k.m_invMass*this.m_impulse*this.m_J.linear1.y;k.m_angularVelocity+=k.m_invI*this.m_impulse*this.m_J.angular1;g.m_linearVelocity.x+=g.m_invMass*this.m_impulse*this.m_J.linear2.x;g.m_linearVelocity.y+=g.m_invMass*this.m_impulse*this.m_J.linear2.y;g.m_angularVelocity+=g.m_invI*this.m_impulse*this.m_J.angular2},SolveVelocityConstraints:function(c){var b=this.m_body1;var a=this.m_body2;var f=this.m_J.Compute(b.m_linearVelocity,b.m_angularVelocity,a.m_linearVelocity,a.m_angularVelocity);var e=-this.m_mass*f;this.m_impulse+=e;b.m_linearVelocity.x+=b.m_invMass*e*this.m_J.linear1.x;b.m_linearVelocity.y+=b.m_invMass*e*this.m_J.linear1.y;b.m_angularVelocity+=b.m_invI*e*this.m_J.angular1;a.m_linearVelocity.x+=a.m_invMass*e*this.m_J.linear2.x;a.m_linearVelocity.y+=a.m_invMass*e*this.m_J.linear2.y;a.m_angularVelocity+=a.m_invI*e*this.m_J.angular2},SolvePositionConstraints:function(){var h=0;var b=this.m_body1;var a=this.m_body2;var g;var e;if(this.m_revolute1){g=this.m_revolute1.GetJointAngle()}else{g=this.m_prismatic1.GetJointTranslation()}if(this.m_revolute2){e=this.m_revolute2.GetJointAngle()}else{e=this.m_prismatic2.GetJointTranslation()}var f=this.m_constant-(g+this.m_ratio*e);var c=-this.m_mass*f;b.m_position.x+=b.m_invMass*c*this.m_J.linear1.x;b.m_position.y+=b.m_invMass*c*this.m_J.linear1.y;b.m_rotation+=b.m_invI*c*this.m_J.angular1;a.m_position.x+=a.m_invMass*c*this.m_J.linear2.x;a.m_position.y+=a.m_invMass*c*this.m_J.linear2.y;a.m_rotation+=a.m_invI*c*this.m_J.angular2;b.m_R.Set(b.m_rotation);a.m_R.Set(a.m_rotation);return h<b2Settings.b2_linearSlop},m_ground1:null,m_ground2:null,m_revolute1:null,m_prismatic1:null,m_revolute2:null,m_prismatic2:null,m_groundAnchor1:new b2Vec2(),m_groundAnchor2:new b2Vec2(),m_localAnchor1:new b2Vec2(),m_localAnchor2:new b2Vec2(),m_J:new b2Jacobian(),m_constant:null,m_ratio:null,m_mass:null,m_impulse:null});var b2GearJointDef=Class.create();Object.extend(b2GearJointDef.prototype,b2JointDef.prototype);Object.extend(b2GearJointDef.prototype,{initialize:function(){this.type=b2Joint.e_gearJoint;this.joint1=null;this.joint2=null;this.ratio=1},joint1:null,joint2:null,ratio:null});var b2MouseJoint=Class.create();Object.extend(b2MouseJoint.prototype,b2Joint.prototype);Object.extend(b2MouseJoint.prototype,{GetAnchor1:function(){return this.m_target},GetAnchor2:function(){var a=b2Math.b2MulMV(this.m_body2.m_R,this.m_localAnchor);a.Add(this.m_body2.m_position);return a},GetReactionForce:function(a){var b=new b2Vec2();b.SetV(this.m_impulse);b.Multiply(a);return b},GetReactionTorque:function(a){return 0},SetTarget:function(a){this.m_body2.WakeUp();this.m_target=a},initialize:function(e){this.m_node1=new b2JointNode();this.m_node2=new b2JointNode();this.m_type=e.type;this.m_prev=null;this.m_next=null;this.m_body1=e.body1;this.m_body2=e.body2;this.m_collideConnected=e.collideConnected;this.m_islandFlag=false;this.m_userData=e.userData;this.K=new b2Mat22();this.K1=new b2Mat22();this.K2=new b2Mat22();this.m_localAnchor=new b2Vec2();this.m_target=new b2Vec2();this.m_impulse=new b2Vec2();this.m_ptpMass=new b2Mat22();this.m_C=new b2Vec2();this.m_target.SetV(e.target);var a=this.m_target.x-this.m_body2.m_position.x;var h=this.m_target.y-this.m_body2.m_position.y;this.m_localAnchor.x=(a*this.m_body2.m_R.col1.x+h*this.m_body2.m_R.col1.y);this.m_localAnchor.y=(a*this.m_body2.m_R.col2.x+h*this.m_body2.m_R.col2.y);this.m_maxForce=e.maxForce;this.m_impulse.SetZero();var c=this.m_body2.m_mass;var g=2*b2Settings.b2_pi*e.frequencyHz;var f=2*c*e.dampingRatio*g;var b=c*g*g;this.m_gamma=1/(f+e.timeStep*b);this.m_beta=e.timeStep*b/(f+e.timeStep*b)},K:new b2Mat22(),K1:new b2Mat22(),K2:new b2Mat22(),PrepareVelocitySolver:function(){var a=this.m_body2;var f;f=a.m_R;var k=f.col1.x*this.m_localAnchor.x+f.col2.x*this.m_localAnchor.y;var j=f.col1.y*this.m_localAnchor.x+f.col2.y*this.m_localAnchor.y;var h=a.m_invMass;var c=a.m_invI;this.K1.col1.x=h;this.K1.col2.x=0;this.K1.col1.y=0;this.K1.col2.y=h;this.K2.col1.x=c*j*j;this.K2.col2.x=-c*k*j;this.K2.col1.y=-c*k*j;this.K2.col2.y=c*k*k;this.K.SetM(this.K1);this.K.AddM(this.K2);this.K.col1.x+=this.m_gamma;this.K.col2.y+=this.m_gamma;this.K.Invert(this.m_ptpMass);this.m_C.x=a.m_position.x+k-this.m_target.x;this.m_C.y=a.m_position.y+j-this.m_target.y;a.m_angularVelocity*=0.98;var g=this.m_impulse.x;var e=this.m_impulse.y;a.m_linearVelocity.x+=h*g;a.m_linearVelocity.y+=h*e;a.m_angularVelocity+=c*(k*e-j*g)},SolveVelocityConstraints:function(e){var k=this.m_body2;var m;m=k.m_R;var j=m.col1.x*this.m_localAnchor.x+m.col2.x*this.m_localAnchor.y;var g=m.col1.y*this.m_localAnchor.x+m.col2.y*this.m_localAnchor.y;var a=k.m_linearVelocity.x+(-k.m_angularVelocity*g);var p=k.m_linearVelocity.y+(k.m_angularVelocity*j);m=this.m_ptpMass;var o=a+(this.m_beta*e.inv_dt)*this.m_C.x+this.m_gamma*this.m_impulse.x;var n=p+(this.m_beta*e.inv_dt)*this.m_C.y+this.m_gamma*this.m_impulse.y;var f=-(m.col1.x*o+m.col2.x*n);var c=-(m.col1.y*o+m.col2.y*n);var l=this.m_impulse.x;var h=this.m_impulse.y;this.m_impulse.x+=f;this.m_impulse.y+=c;var b=this.m_impulse.Length();if(b>e.dt*this.m_maxForce){this.m_impulse.Multiply(e.dt*this.m_maxForce/b)}f=this.m_impulse.x-l;c=this.m_impulse.y-h;k.m_linearVelocity.x+=k.m_invMass*f;k.m_linearVelocity.y+=k.m_invMass*c;k.m_angularVelocity+=k.m_invI*(j*c-g*f)},SolvePositionConstraints:function(){return true},m_localAnchor:new b2Vec2(),m_target:new b2Vec2(),m_impulse:new b2Vec2(),m_ptpMass:new b2Mat22(),m_C:new b2Vec2(),m_maxForce:null,m_beta:null,m_gamma:null});var b2MouseJointDef=Class.create();Object.extend(b2MouseJointDef.prototype,b2JointDef.prototype);Object.extend(b2MouseJointDef.prototype,{initialize:function(){this.type=b2Joint.e_unknownJoint;this.userData=null;this.body1=null;this.body2=null;this.collideConnected=false;this.target=new b2Vec2();this.type=b2Joint.e_mouseJoint;this.maxForce=0;this.frequencyHz=5;this.dampingRatio=0.7;this.timeStep=1/60},target:new b2Vec2(),maxForce:null,frequencyHz:null,dampingRatio:null,timeStep:null});var b2PrismaticJoint=Class.create();Object.extend(b2PrismaticJoint.prototype,b2Joint.prototype);Object.extend(b2PrismaticJoint.prototype,{GetAnchor1:function(){var a=this.m_body1;var b=new b2Vec2();b.SetV(this.m_localAnchor1);b.MulM(a.m_R);b.Add(a.m_position);return b},GetAnchor2:function(){var a=this.m_body2;var b=new b2Vec2();b.SetV(this.m_localAnchor2);b.MulM(a.m_R);b.Add(a.m_position);return b},GetJointTranslation:function(){var n=this.m_body1;var m=this.m_body2;var l;l=n.m_R;var r=l.col1.x*this.m_localAnchor1.x+l.col2.x*this.m_localAnchor1.y;var p=l.col1.y*this.m_localAnchor1.x+l.col2.y*this.m_localAnchor1.y;l=m.m_R;var k=l.col1.x*this.m_localAnchor2.x+l.col2.x*this.m_localAnchor2.y;var j=l.col1.y*this.m_localAnchor2.x+l.col2.y*this.m_localAnchor2.y;var h=n.m_position.x+r;var g=n.m_position.y+p;var c=m.m_position.x+k;var b=m.m_position.y+j;var f=c-h;var e=b-g;l=n.m_R;var q=l.col1.x*this.m_localXAxis1.x+l.col2.x*this.m_localXAxis1.y;var o=l.col1.y*this.m_localXAxis1.x+l.col2.y*this.m_localXAxis1.y;var a=q*f+o*e;return a},GetJointSpeed:function(){var l=this.m_body1;var k=this.m_body2;var m;m=l.m_R;var v=m.col1.x*this.m_localAnchor1.x+m.col2.x*this.m_localAnchor1.y;var u=m.col1.y*this.m_localAnchor1.x+m.col2.y*this.m_localAnchor1.y;m=k.m_R;var j=m.col1.x*this.m_localAnchor2.x+m.col2.x*this.m_localAnchor2.y;var h=m.col1.y*this.m_localAnchor2.x+m.col2.y*this.m_localAnchor2.y;var t=l.m_position.x+v;var r=l.m_position.y+u;var c=k.m_position.x+j;var a=k.m_position.y+h;var g=c-t;var f=a-r;m=l.m_R;var q=m.col1.x*this.m_localXAxis1.x+m.col2.x*this.m_localXAxis1.y;var p=m.col1.y*this.m_localXAxis1.x+m.col2.y*this.m_localXAxis1.y;var e=l.m_linearVelocity;var b=k.m_linearVelocity;var o=l.m_angularVelocity;var n=k.m_angularVelocity;var s=(g*(-o*p)+f*(o*q))+(q*(((b.x+(-n*h))-e.x)-(-o*u))+p*(((b.y+(n*j))-e.y)-(o*v)));return s},GetMotorForce:function(a){return a*this.m_motorImpulse},SetMotorSpeed:function(a){this.m_motorSpeed=a},SetMotorForce:function(a){this.m_maxMotorForce=a},GetReactionForce:function(b){var f=b*this.m_limitImpulse;var e;e=this.m_body1.m_R;var h=f*(e.col1.x*this.m_localXAxis1.x+e.col2.x*this.m_localXAxis1.y);var g=f*(e.col1.y*this.m_localXAxis1.x+e.col2.y*this.m_localXAxis1.y);var c=f*(e.col1.x*this.m_localYAxis1.x+e.col2.x*this.m_localYAxis1.y);var a=f*(e.col1.y*this.m_localYAxis1.x+e.col2.y*this.m_localYAxis1.y);return new b2Vec2(h+c,g+a)},GetReactionTorque:function(a){return a*this.m_angularImpulse},initialize:function(c){this.m_node1=new b2JointNode();this.m_node2=new b2JointNode();this.m_type=c.type;this.m_prev=null;this.m_next=null;this.m_body1=c.body1;this.m_body2=c.body2;this.m_collideConnected=c.collideConnected;this.m_islandFlag=false;this.m_userData=c.userData;this.m_localAnchor1=new b2Vec2();this.m_localAnchor2=new b2Vec2();this.m_localXAxis1=new b2Vec2();this.m_localYAxis1=new b2Vec2();this.m_linearJacobian=new b2Jacobian();this.m_motorJacobian=new b2Jacobian();var b;var a;var e;b=this.m_body1.m_R;a=(c.anchorPoint.x-this.m_body1.m_position.x);e=(c.anchorPoint.y-this.m_body1.m_position.y);this.m_localAnchor1.Set((a*b.col1.x+e*b.col1.y),(a*b.col2.x+e*b.col2.y));b=this.m_body2.m_R;a=(c.anchorPoint.x-this.m_body2.m_position.x);e=(c.anchorPoint.y-this.m_body2.m_position.y);this.m_localAnchor2.Set((a*b.col1.x+e*b.col1.y),(a*b.col2.x+e*b.col2.y));b=this.m_body1.m_R;a=c.axis.x;e=c.axis.y;this.m_localXAxis1.Set((a*b.col1.x+e*b.col1.y),(a*b.col2.x+e*b.col2.y));this.m_localYAxis1.x=-this.m_localXAxis1.y;this.m_localYAxis1.y=this.m_localXAxis1.x;this.m_initialAngle=this.m_body2.m_rotation-this.m_body1.m_rotation;this.m_linearJacobian.SetZero();this.m_linearMass=0;this.m_linearImpulse=0;this.m_angularMass=0;this.m_angularImpulse=0;this.m_motorJacobian.SetZero();this.m_motorMass=0;this.m_motorImpulse=0;this.m_limitImpulse=0;this.m_limitPositionImpulse=0;this.m_lowerTranslation=c.lowerTranslation;this.m_upperTranslation=c.upperTranslation;this.m_maxMotorForce=c.motorForce;this.m_motorSpeed=c.motorSpeed;this.m_enableLimit=c.enableLimit;this.m_enableMotor=c.enableMotor},PrepareVelocitySolver:function(){var o=this.m_body1;var n=this.m_body2;var r;r=o.m_R;var C=r.col1.x*this.m_localAnchor1.x+r.col2.x*this.m_localAnchor1.y;var B=r.col1.y*this.m_localAnchor1.x+r.col2.y*this.m_localAnchor1.y;r=n.m_R;var k=r.col1.x*this.m_localAnchor2.x+r.col2.x*this.m_localAnchor2.y;var h=r.col1.y*this.m_localAnchor2.x+r.col2.y*this.m_localAnchor2.y;var u=o.m_invMass;var t=n.m_invMass;var m=o.m_invI;var l=n.m_invI;r=o.m_R;var j=r.col1.x*this.m_localYAxis1.x+r.col2.x*this.m_localYAxis1.y;var g=r.col1.y*this.m_localYAxis1.x+r.col2.y*this.m_localYAxis1.y;var v=n.m_position.x+k-o.m_position.x;var s=n.m_position.y+h-o.m_position.y;this.m_linearJacobian.linear1.x=-j;this.m_linearJacobian.linear1.y=-g;this.m_linearJacobian.linear2.x=j;this.m_linearJacobian.linear2.y=g;this.m_linearJacobian.angular1=-(v*g-s*j);this.m_linearJacobian.angular2=k*g-h*j;this.m_linearMass=u+m*this.m_linearJacobian.angular1*this.m_linearJacobian.angular1+t+l*this.m_linearJacobian.angular2*this.m_linearJacobian.angular2;this.m_linearMass=1/this.m_linearMass;this.m_angularMass=1/(m+l);if(this.m_enableLimit||this.m_enableMotor){r=o.m_R;var y=r.col1.x*this.m_localXAxis1.x+r.col2.x*this.m_localXAxis1.y;var x=r.col1.y*this.m_localXAxis1.x+r.col2.y*this.m_localXAxis1.y;this.m_motorJacobian.linear1.x=-y;this.m_motorJacobian.linear1.y=-x;this.m_motorJacobian.linear2.x=y;this.m_motorJacobian.linear2.y=x;this.m_motorJacobian.angular1=-(v*x-s*y);this.m_motorJacobian.angular2=k*x-h*y;this.m_motorMass=u+m*this.m_motorJacobian.angular1*this.m_motorJacobian.angular1+t+l*this.m_motorJacobian.angular2*this.m_motorJacobian.angular2;this.m_motorMass=1/this.m_motorMass;if(this.m_enableLimit){var f=v-C;var e=s-B;var c=y*f+x*e;if(b2Math.b2Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*b2Settings.b2_linearSlop){this.m_limitState=b2Joint.e_equalLimits}else{if(c<=this.m_lowerTranslation){if(this.m_limitState!=b2Joint.e_atLowerLimit){this.m_limitImpulse=0}this.m_limitState=b2Joint.e_atLowerLimit}else{if(c>=this.m_upperTranslation){if(this.m_limitState!=b2Joint.e_atUpperLimit){this.m_limitImpulse=0}this.m_limitState=b2Joint.e_atUpperLimit}else{this.m_limitState=b2Joint.e_inactiveLimit;this.m_limitImpulse=0}}}}}if(this.m_enableMotor==false){this.m_motorImpulse=0}if(this.m_enableLimit==false){this.m_limitImpulse=0}if(b2World.s_enableWarmStarting){var b=this.m_linearImpulse*this.m_linearJacobian.linear1.x+(this.m_motorImpulse+this.m_limitImpulse)*this.m_motorJacobian.linear1.x;var a=this.m_linearImpulse*this.m_linearJacobian.linear1.y+(this.m_motorImpulse+this.m_limitImpulse)*this.m_motorJacobian.linear1.y;var q=this.m_linearImpulse*this.m_linearJacobian.linear2.x+(this.m_motorImpulse+this.m_limitImpulse)*this.m_motorJacobian.linear2.x;var p=this.m_linearImpulse*this.m_linearJacobian.linear2.y+(this.m_motorImpulse+this.m_limitImpulse)*this.m_motorJacobian.linear2.y;var A=this.m_linearImpulse*this.m_linearJacobian.angular1-this.m_angularImpulse+(this.m_motorImpulse+this.m_limitImpulse)*this.m_motorJacobian.angular1;var z=this.m_linearImpulse*this.m_linearJacobian.angular2+this.m_angularImpulse+(this.m_motorImpulse+this.m_limitImpulse)*this.m_motorJacobian.angular2;o.m_linearVelocity.x+=u*b;o.m_linearVelocity.y+=u*a;o.m_angularVelocity+=m*A;n.m_linearVelocity.x+=t*q;n.m_linearVelocity.y+=t*p;n.m_angularVelocity+=l*z}else{this.m_linearImpulse=0;this.m_angularImpulse=0;this.m_limitImpulse=0;this.m_motorImpulse=0}this.m_limitPositionImpulse=0},SolveVelocityConstraints:function(b){var n=this.m_body1;var m=this.m_body2;var s=n.m_invMass;var q=m.m_invMass;var e=n.m_invI;var c=m.m_invI;var r;var f=this.m_linearJacobian.Compute(n.m_linearVelocity,n.m_angularVelocity,m.m_linearVelocity,m.m_angularVelocity);var l=-this.m_linearMass*f;this.m_linearImpulse+=l;n.m_linearVelocity.x+=(s*l)*this.m_linearJacobian.linear1.x;n.m_linearVelocity.y+=(s*l)*this.m_linearJacobian.linear1.y;n.m_angularVelocity+=e*l*this.m_linearJacobian.angular1;m.m_linearVelocity.x+=(q*l)*this.m_linearJacobian.linear2.x;m.m_linearVelocity.y+=(q*l)*this.m_linearJacobian.linear2.y;m.m_angularVelocity+=c*l*this.m_linearJacobian.angular2;var j=m.m_angularVelocity-n.m_angularVelocity;var a=-this.m_angularMass*j;this.m_angularImpulse+=a;n.m_angularVelocity-=e*a;m.m_angularVelocity+=c*a;if(this.m_enableMotor&&this.m_limitState!=b2Joint.e_equalLimits){var o=this.m_motorJacobian.Compute(n.m_linearVelocity,n.m_angularVelocity,m.m_linearVelocity,m.m_angularVelocity)-this.m_motorSpeed;var g=-this.m_motorMass*o;var p=this.m_motorImpulse;this.m_motorImpulse=b2Math.b2Clamp(this.m_motorImpulse+g,-b.dt*this.m_maxMotorForce,b.dt*this.m_maxMotorForce);g=this.m_motorImpulse-p;n.m_linearVelocity.x+=(s*g)*this.m_motorJacobian.linear1.x;n.m_linearVelocity.y+=(s*g)*this.m_motorJacobian.linear1.y;n.m_angularVelocity+=e*g*this.m_motorJacobian.angular1;m.m_linearVelocity.x+=(q*g)*this.m_motorJacobian.linear2.x;m.m_linearVelocity.y+=(q*g)*this.m_motorJacobian.linear2.y;m.m_angularVelocity+=c*g*this.m_motorJacobian.angular2}if(this.m_enableLimit&&this.m_limitState!=b2Joint.e_inactiveLimit){var k=this.m_motorJacobian.Compute(n.m_linearVelocity,n.m_angularVelocity,m.m_linearVelocity,m.m_angularVelocity);var h=-this.m_motorMass*k;if(this.m_limitState==b2Joint.e_equalLimits){this.m_limitImpulse+=h}else{if(this.m_limitState==b2Joint.e_atLowerLimit){r=this.m_limitImpulse;this.m_limitImpulse=b2Math.b2Max(this.m_limitImpulse+h,0);h=this.m_limitImpulse-r}else{if(this.m_limitState==b2Joint.e_atUpperLimit){r=this.m_limitImpulse;this.m_limitImpulse=b2Math.b2Min(this.m_limitImpulse+h,0);h=this.m_limitImpulse-r}}}n.m_linearVelocity.x+=(s*h)*this.m_motorJacobian.linear1.x;n.m_linearVelocity.y+=(s*h)*this.m_motorJacobian.linear1.y;n.m_angularVelocity+=e*h*this.m_motorJacobian.angular1;m.m_linearVelocity.x+=(q*h)*this.m_motorJacobian.linear2.x;m.m_linearVelocity.y+=(q*h)*this.m_motorJacobian.linear2.y;m.m_angularVelocity+=c*h*this.m_motorJacobian.angular2}},SolvePositionConstraints:function(){var q;var B;var o=this.m_body1;var m=this.m_body2;var v=o.m_invMass;var u=m.m_invMass;var l=o.m_invI;var k=m.m_invI;var s;s=o.m_R;var H=s.col1.x*this.m_localAnchor1.x+s.col2.x*this.m_localAnchor1.y;var G=s.col1.y*this.m_localAnchor1.x+s.col2.y*this.m_localAnchor1.y;s=m.m_R;var j=s.col1.x*this.m_localAnchor2.x+s.col2.x*this.m_localAnchor2.y;var h=s.col1.y*this.m_localAnchor2.x+s.col2.y*this.m_localAnchor2.y;var E=o.m_position.x+H;var C=o.m_position.y+G;var b=m.m_position.x+j;var a=m.m_position.y+h;var f=b-E;var c=a-C;s=o.m_R;var g=s.col1.x*this.m_localYAxis1.x+s.col2.x*this.m_localYAxis1.y;var e=s.col1.y*this.m_localYAxis1.x+s.col2.y*this.m_localYAxis1.y;var n=g*f+e*c;n=b2Math.b2Clamp(n,-b2Settings.b2_maxLinearCorrection,b2Settings.b2_maxLinearCorrection);var A=-this.m_linearMass*n;o.m_position.x+=(v*A)*this.m_linearJacobian.linear1.x;o.m_position.y+=(v*A)*this.m_linearJacobian.linear1.y;o.m_rotation+=l*A*this.m_linearJacobian.angular1;m.m_position.x+=(u*A)*this.m_linearJacobian.linear2.x;m.m_position.y+=(u*A)*this.m_linearJacobian.linear2.y;m.m_rotation+=k*A*this.m_linearJacobian.angular2;var r=b2Math.b2Abs(n);var D=m.m_rotation-o.m_rotation-this.m_initialAngle;D=b2Math.b2Clamp(D,-b2Settings.b2_maxAngularCorrection,b2Settings.b2_maxAngularCorrection);var t=-this.m_angularMass*D;o.m_rotation-=o.m_invI*t;o.m_R.Set(o.m_rotation);m.m_rotation+=m.m_invI*t;m.m_R.Set(m.m_rotation);var F=b2Math.b2Abs(D);if(this.m_enableLimit&&this.m_limitState!=b2Joint.e_inactiveLimit){s=o.m_R;H=s.col1.x*this.m_localAnchor1.x+s.col2.x*this.m_localAnchor1.y;G=s.col1.y*this.m_localAnchor1.x+s.col2.y*this.m_localAnchor1.y;s=m.m_R;j=s.col1.x*this.m_localAnchor2.x+s.col2.x*this.m_localAnchor2.y;h=s.col1.y*this.m_localAnchor2.x+s.col2.y*this.m_localAnchor2.y;E=o.m_position.x+H;C=o.m_position.y+G;b=m.m_position.x+j;a=m.m_position.y+h;f=b-E;c=a-C;s=o.m_R;var y=s.col1.x*this.m_localXAxis1.x+s.col2.x*this.m_localXAxis1.y;var x=s.col1.y*this.m_localXAxis1.x+s.col2.y*this.m_localXAxis1.y;var p=(y*f+x*c);var z=0;if(this.m_limitState==b2Joint.e_equalLimits){q=b2Math.b2Clamp(p,-b2Settings.b2_maxLinearCorrection,b2Settings.b2_maxLinearCorrection);z=-this.m_motorMass*q;r=b2Math.b2Max(r,b2Math.b2Abs(D))}else{if(this.m_limitState==b2Joint.e_atLowerLimit){q=p-this.m_lowerTranslation;r=b2Math.b2Max(r,-q);q=b2Math.b2Clamp(q+b2Settings.b2_linearSlop,-b2Settings.b2_maxLinearCorrection,0);z=-this.m_motorMass*q;B=this.m_limitPositionImpulse;this.m_limitPositionImpulse=b2Math.b2Max(this.m_limitPositionImpulse+z,0);z=this.m_limitPositionImpulse-B}else{if(this.m_limitState==b2Joint.e_atUpperLimit){q=p-this.m_upperTranslation;r=b2Math.b2Max(r,q);q=b2Math.b2Clamp(q-b2Settings.b2_linearSlop,0,b2Settings.b2_maxLinearCorrection);z=-this.m_motorMass*q;B=this.m_limitPositionImpulse;this.m_limitPositionImpulse=b2Math.b2Min(this.m_limitPositionImpulse+z,0);z=this.m_limitPositionImpulse-B}}}o.m_position.x+=(v*z)*this.m_motorJacobian.linear1.x;o.m_position.y+=(v*z)*this.m_motorJacobian.linear1.y;o.m_rotation+=l*z*this.m_motorJacobian.angular1;o.m_R.Set(o.m_rotation);m.m_position.x+=(u*z)*this.m_motorJacobian.linear2.x;m.m_position.y+=(u*z)*this.m_motorJacobian.linear2.y;m.m_rotation+=k*z*this.m_motorJacobian.angular2;m.m_R.Set(m.m_rotation)}return r<=b2Settings.b2_linearSlop&&F<=b2Settings.b2_angularSlop},m_localAnchor1:new b2Vec2(),m_localAnchor2:new b2Vec2(),m_localXAxis1:new b2Vec2(),m_localYAxis1:new b2Vec2(),m_initialAngle:null,m_linearJacobian:new b2Jacobian(),m_linearMass:null,m_linearImpulse:null,m_angularMass:null,m_angularImpulse:null,m_motorJacobian:new b2Jacobian(),m_motorMass:null,m_motorImpulse:null,m_limitImpulse:null,m_limitPositionImpulse:null,m_lowerTranslation:null,m_upperTranslation:null,m_maxMotorForce:null,m_motorSpeed:null,m_enableLimit:null,m_enableMotor:null,m_limitState:0});var b2PrismaticJointDef=Class.create();Object.extend(b2PrismaticJointDef.prototype,b2JointDef.prototype);Object.extend(b2PrismaticJointDef.prototype,{initialize:function(){this.type=b2Joint.e_unknownJoint;this.userData=null;this.body1=null;this.body2=null;this.collideConnected=false;this.type=b2Joint.e_prismaticJoint;this.anchorPoint=new b2Vec2(0,0);this.axis=new b2Vec2(0,0);this.lowerTranslation=0;this.upperTranslation=0;this.motorForce=0;this.motorSpeed=0;this.enableLimit=false;this.enableMotor=false},anchorPoint:null,axis:null,lowerTranslation:null,upperTranslation:null,motorForce:null,motorSpeed:null,enableLimit:null,enableMotor:null});var b2PulleyJoint=Class.create();Object.extend(b2PulleyJoint.prototype,b2Joint.prototype);Object.extend(b2PulleyJoint.prototype,{GetAnchor1:function(){var a=this.m_body1.m_R;return new b2Vec2(this.m_body1.m_position.x+(a.col1.x*this.m_localAnchor1.x+a.col2.x*this.m_localAnchor1.y),this.m_body1.m_position.y+(a.col1.y*this.m_localAnchor1.x+a.col2.y*this.m_localAnchor1.y))},GetAnchor2:function(){var a=this.m_body2.m_R;return new b2Vec2(this.m_body2.m_position.x+(a.col1.x*this.m_localAnchor2.x+a.col2.x*this.m_localAnchor2.y),this.m_body2.m_position.y+(a.col1.y*this.m_localAnchor2.x+a.col2.y*this.m_localAnchor2.y))},GetGroundPoint1:function(){return new b2Vec2(this.m_ground.m_position.x+this.m_groundAnchor1.x,this.m_ground.m_position.y+this.m_groundAnchor1.y)},GetGroundPoint2:function(){return new b2Vec2(this.m_ground.m_position.x+this.m_groundAnchor2.x,this.m_ground.m_position.y+this.m_groundAnchor2.y)},GetReactionForce:function(a){return new b2Vec2()},GetReactionTorque:function(a){return 0},GetLength1:function(){var f;f=this.m_body1.m_R;var e=this.m_body1.m_position.x+(f.col1.x*this.m_localAnchor1.x+f.col2.x*this.m_localAnchor1.y);var c=this.m_body1.m_position.y+(f.col1.y*this.m_localAnchor1.x+f.col2.y*this.m_localAnchor1.y);var b=e-(this.m_ground.m_position.x+this.m_groundAnchor1.x);var a=c-(this.m_ground.m_position.y+this.m_groundAnchor1.y);return Math.sqrt(b*b+a*a)},GetLength2:function(){var f;f=this.m_body2.m_R;var e=this.m_body2.m_position.x+(f.col1.x*this.m_localAnchor2.x+f.col2.x*this.m_localAnchor2.y);var c=this.m_body2.m_position.y+(f.col1.y*this.m_localAnchor2.x+f.col2.y*this.m_localAnchor2.y);var b=e-(this.m_ground.m_position.x+this.m_groundAnchor2.x);var a=c-(this.m_ground.m_position.y+this.m_groundAnchor2.y);return Math.sqrt(b*b+a*a)},GetRatio:function(){return this.m_ratio},initialize:function(e){this.m_node1=new b2JointNode();this.m_node2=new b2JointNode();this.m_type=e.type;this.m_prev=null;this.m_next=null;this.m_body1=e.body1;this.m_body2=e.body2;this.m_collideConnected=e.collideConnected;this.m_islandFlag=false;this.m_userData=e.userData;this.m_groundAnchor1=new b2Vec2();this.m_groundAnchor2=new b2Vec2();this.m_localAnchor1=new b2Vec2();this.m_localAnchor2=new b2Vec2();this.m_u1=new b2Vec2();this.m_u2=new b2Vec2();var b;var a;var j;this.m_ground=this.m_body1.m_world.m_groundBody;this.m_groundAnchor1.x=e.groundPoint1.x-this.m_ground.m_position.x;this.m_groundAnchor1.y=e.groundPoint1.y-this.m_ground.m_position.y;this.m_groundAnchor2.x=e.groundPoint2.x-this.m_ground.m_position.x;this.m_groundAnchor2.y=e.groundPoint2.y-this.m_ground.m_position.y;b=this.m_body1.m_R;a=e.anchorPoint1.x-this.m_body1.m_position.x;j=e.anchorPoint1.y-this.m_body1.m_position.y;this.m_localAnchor1.x=a*b.col1.x+j*b.col1.y;this.m_localAnchor1.y=a*b.col2.x+j*b.col2.y;b=this.m_body2.m_R;a=e.anchorPoint2.x-this.m_body2.m_position.x;j=e.anchorPoint2.y-this.m_body2.m_position.y;this.m_localAnchor2.x=a*b.col1.x+j*b.col1.y;this.m_localAnchor2.y=a*b.col2.x+j*b.col2.y;this.m_ratio=e.ratio;a=e.groundPoint1.x-e.anchorPoint1.x;j=e.groundPoint1.y-e.anchorPoint1.y;var g=Math.sqrt(a*a+j*j);a=e.groundPoint2.x-e.anchorPoint2.x;j=e.groundPoint2.y-e.anchorPoint2.y;var c=Math.sqrt(a*a+j*j);var h=b2Math.b2Max(0.5*b2PulleyJoint.b2_minPulleyLength,g);var f=b2Math.b2Max(0.5*b2PulleyJoint.b2_minPulleyLength,c);this.m_constant=h+this.m_ratio*f;this.m_maxLength1=b2Math.b2Clamp(e.maxLength1,h,this.m_constant-this.m_ratio*b2PulleyJoint.b2_minPulleyLength);this.m_maxLength2=b2Math.b2Clamp(e.maxLength2,f,(this.m_constant-b2PulleyJoint.b2_minPulleyLength)/this.m_ratio);this.m_pulleyImpulse=0;this.m_limitImpulse1=0;this.m_limitImpulse2=0},PrepareVelocitySolver:function(){var j=this.m_body1;var h=this.m_body2;var n;n=j.m_R;var y=n.col1.x*this.m_localAnchor1.x+n.col2.x*this.m_localAnchor1.y;var x=n.col1.y*this.m_localAnchor1.x+n.col2.y*this.m_localAnchor1.y;n=h.m_R;var g=n.col1.x*this.m_localAnchor2.x+n.col2.x*this.m_localAnchor2.y;var f=n.col1.y*this.m_localAnchor2.x+n.col2.y*this.m_localAnchor2.y;var v=j.m_position.x+y;var t=j.m_position.y+x;var e=h.m_position.x+g;var c=h.m_position.y+f;var o=this.m_ground.m_position.x+this.m_groundAnchor1.x;var m=this.m_ground.m_position.y+this.m_groundAnchor1.y;var u=this.m_ground.m_position.x+this.m_groundAnchor2.x;var s=this.m_ground.m_position.y+this.m_groundAnchor2.y;this.m_u1.Set(v-o,t-m);this.m_u2.Set(e-u,c-s);var r=this.m_u1.Length();var q=this.m_u2.Length();if(r>b2Settings.b2_linearSlop){this.m_u1.Multiply(1/r)}else{this.m_u1.SetZero()}if(q>b2Settings.b2_linearSlop){this.m_u2.Multiply(1/q)}else{this.m_u2.SetZero()}if(r<this.m_maxLength1){this.m_limitState1=b2Joint.e_inactiveLimit;this.m_limitImpulse1=0}else{this.m_limitState1=b2Joint.e_atUpperLimit;this.m_limitPositionImpulse1=0}if(q<this.m_maxLength2){this.m_limitState2=b2Joint.e_inactiveLimit;this.m_limitImpulse2=0}else{this.m_limitState2=b2Joint.e_atUpperLimit;this.m_limitPositionImpulse2=0}var z=y*this.m_u1.y-x*this.m_u1.x;var p=g*this.m_u2.y-f*this.m_u2.x;this.m_limitMass1=j.m_invMass+j.m_invI*z*z;this.m_limitMass2=h.m_invMass+h.m_invI*p*p;this.m_pulleyMass=this.m_limitMass1+this.m_ratio*this.m_ratio*this.m_limitMass2;this.m_limitMass1=1/this.m_limitMass1;this.m_limitMass2=1/this.m_limitMass2;this.m_pulleyMass=1/this.m_pulleyMass;var b=(-this.m_pulleyImpulse-this.m_limitImpulse1)*this.m_u1.x;var a=(-this.m_pulleyImpulse-this.m_limitImpulse1)*this.m_u1.y;var l=(-this.m_ratio*this.m_pulleyImpulse-this.m_limitImpulse2)*this.m_u2.x;var k=(-this.m_ratio*this.m_pulleyImpulse-this.m_limitImpulse2)*this.m_u2.y;j.m_linearVelocity.x+=j.m_invMass*b;j.m_linearVelocity.y+=j.m_invMass*a;j.m_angularVelocity+=j.m_invI*(y*a-x*b);h.m_linearVelocity.x+=h.m_invMass*l;h.m_linearVelocity.y+=h.m_invMass*k;h.m_angularVelocity+=h.m_invI*(g*k-f*l)},SolveVelocityConstraints:function(j){var k=this.m_body1;var h=this.m_body2;var p;p=k.m_R;var u=p.col1.x*this.m_localAnchor1.x+p.col2.x*this.m_localAnchor1.y;var t=p.col1.y*this.m_localAnchor1.x+p.col2.y*this.m_localAnchor1.y;p=h.m_R;var g=p.col1.x*this.m_localAnchor2.x+p.col2.x*this.m_localAnchor2.y;var f=p.col1.y*this.m_localAnchor2.x+p.col2.y*this.m_localAnchor2.y;var e;var b;var q;var n;var c;var a;var o;var m;var r;var l;var s;e=k.m_linearVelocity.x+(-k.m_angularVelocity*t);b=k.m_linearVelocity.y+(k.m_angularVelocity*u);q=h.m_linearVelocity.x+(-h.m_angularVelocity*f);n=h.m_linearVelocity.y+(h.m_angularVelocity*g);r=-(this.m_u1.x*e+this.m_u1.y*b)-this.m_ratio*(this.m_u2.x*q+this.m_u2.y*n);l=-this.m_pulleyMass*r;this.m_pulleyImpulse+=l;c=-l*this.m_u1.x;a=-l*this.m_u1.y;o=-this.m_ratio*l*this.m_u2.x;m=-this.m_ratio*l*this.m_u2.y;k.m_linearVelocity.x+=k.m_invMass*c;k.m_linearVelocity.y+=k.m_invMass*a;k.m_angularVelocity+=k.m_invI*(u*a-t*c);h.m_linearVelocity.x+=h.m_invMass*o;h.m_linearVelocity.y+=h.m_invMass*m;h.m_angularVelocity+=h.m_invI*(g*m-f*o);if(this.m_limitState1==b2Joint.e_atUpperLimit){e=k.m_linearVelocity.x+(-k.m_angularVelocity*t);b=k.m_linearVelocity.y+(k.m_angularVelocity*u);r=-(this.m_u1.x*e+this.m_u1.y*b);l=-this.m_limitMass1*r;s=this.m_limitImpulse1;this.m_limitImpulse1=b2Math.b2Max(0,this.m_limitImpulse1+l);l=this.m_limitImpulse1-s;c=-l*this.m_u1.x;a=-l*this.m_u1.y;k.m_linearVelocity.x+=k.m_invMass*c;k.m_linearVelocity.y+=k.m_invMass*a;k.m_angularVelocity+=k.m_invI*(u*a-t*c)}if(this.m_limitState2==b2Joint.e_atUpperLimit){q=h.m_linearVelocity.x+(-h.m_angularVelocity*f);n=h.m_linearVelocity.y+(h.m_angularVelocity*g);r=-(this.m_u2.x*q+this.m_u2.y*n);l=-this.m_limitMass2*r;s=this.m_limitImpulse2;this.m_limitImpulse2=b2Math.b2Max(0,this.m_limitImpulse2+l);l=this.m_limitImpulse2-s;o=-l*this.m_u2.x;m=-l*this.m_u2.y;h.m_linearVelocity.x+=h.m_invMass*o;h.m_linearVelocity.y+=h.m_invMass*m;h.m_angularVelocity+=h.m_invI*(g*m-f*o)}},SolvePositionConstraints:function(){var h=this.m_body1;var g=this.m_body2;var l;var m=this.m_ground.m_position.x+this.m_groundAnchor1.x;var k=this.m_ground.m_position.y+this.m_groundAnchor1.y;var s=this.m_ground.m_position.x+this.m_groundAnchor2.x;var q=this.m_ground.m_position.y+this.m_groundAnchor2.y;var x;var v;var e;var c;var t;var r;var b;var a;var p;var o;var n;var j;var u;var f=0;l=h.m_R;x=l.col1.x*this.m_localAnchor1.x+l.col2.x*this.m_localAnchor1.y;v=l.col1.y*this.m_localAnchor1.x+l.col2.y*this.m_localAnchor1.y;l=g.m_R;e=l.col1.x*this.m_localAnchor2.x+l.col2.x*this.m_localAnchor2.y;c=l.col1.y*this.m_localAnchor2.x+l.col2.y*this.m_localAnchor2.y;t=h.m_position.x+x;r=h.m_position.y+v;b=g.m_position.x+e;a=g.m_position.y+c;this.m_u1.Set(t-m,r-k);this.m_u2.Set(b-s,a-q);p=this.m_u1.Length();o=this.m_u2.Length();if(p>b2Settings.b2_linearSlop){this.m_u1.Multiply(1/p)}else{this.m_u1.SetZero()}if(o>b2Settings.b2_linearSlop){this.m_u2.Multiply(1/o)}else{this.m_u2.SetZero()}n=this.m_constant-p-this.m_ratio*o;f=b2Math.b2Max(f,Math.abs(n));n=b2Math.b2Clamp(n,-b2Settings.b2_maxLinearCorrection,b2Settings.b2_maxLinearCorrection);j=-this.m_pulleyMass*n;t=-j*this.m_u1.x;r=-j*this.m_u1.y;b=-this.m_ratio*j*this.m_u2.x;a=-this.m_ratio*j*this.m_u2.y;h.m_position.x+=h.m_invMass*t;h.m_position.y+=h.m_invMass*r;h.m_rotation+=h.m_invI*(x*r-v*t);g.m_position.x+=g.m_invMass*b;g.m_position.y+=g.m_invMass*a;g.m_rotation+=g.m_invI*(e*a-c*b);h.m_R.Set(h.m_rotation);g.m_R.Set(g.m_rotation);if(this.m_limitState1==b2Joint.e_atUpperLimit){l=h.m_R;x=l.col1.x*this.m_localAnchor1.x+l.col2.x*this.m_localAnchor1.y;v=l.col1.y*this.m_localAnchor1.x+l.col2.y*this.m_localAnchor1.y;t=h.m_position.x+x;r=h.m_position.y+v;this.m_u1.Set(t-m,r-k);p=this.m_u1.Length();if(p>b2Settings.b2_linearSlop){this.m_u1.x*=1/p;this.m_u1.y*=1/p}else{this.m_u1.SetZero()}n=this.m_maxLength1-p;f=b2Math.b2Max(f,-n);n=b2Math.b2Clamp(n+b2Settings.b2_linearSlop,-b2Settings.b2_maxLinearCorrection,0);j=-this.m_limitMass1*n;u=this.m_limitPositionImpulse1;this.m_limitPositionImpulse1=b2Math.b2Max(0,this.m_limitPositionImpulse1+j);j=this.m_limitPositionImpulse1-u;t=-j*this.m_u1.x;r=-j*this.m_u1.y;h.m_position.x+=h.m_invMass*t;h.m_position.y+=h.m_invMass*r;h.m_rotation+=h.m_invI*(x*r-v*t);h.m_R.Set(h.m_rotation)}if(this.m_limitState2==b2Joint.e_atUpperLimit){l=g.m_R;e=l.col1.x*this.m_localAnchor2.x+l.col2.x*this.m_localAnchor2.y;c=l.col1.y*this.m_localAnchor2.x+l.col2.y*this.m_localAnchor2.y;b=g.m_position.x+e;a=g.m_position.y+c;this.m_u2.Set(b-s,a-q);o=this.m_u2.Length();if(o>b2Settings.b2_linearSlop){this.m_u2.x*=1/o;this.m_u2.y*=1/o}else{this.m_u2.SetZero()}n=this.m_maxLength2-o;f=b2Math.b2Max(f,-n);n=b2Math.b2Clamp(n+b2Settings.b2_linearSlop,-b2Settings.b2_maxLinearCorrection,0);j=-this.m_limitMass2*n;u=this.m_limitPositionImpulse2;this.m_limitPositionImpulse2=b2Math.b2Max(0,this.m_limitPositionImpulse2+j);j=this.m_limitPositionImpulse2-u;b=-j*this.m_u2.x;a=-j*this.m_u2.y;g.m_position.x+=g.m_invMass*b;g.m_position.y+=g.m_invMass*a;g.m_rotation+=g.m_invI*(e*a-c*b);g.m_R.Set(g.m_rotation)}return f<b2Settings.b2_linearSlop},m_ground:null,m_groundAnchor1:new b2Vec2(),m_groundAnchor2:new b2Vec2(),m_localAnchor1:new b2Vec2(),m_localAnchor2:new b2Vec2(),m_u1:new b2Vec2(),m_u2:new b2Vec2(),m_constant:null,m_ratio:null,m_maxLength1:null,m_maxLength2:null,m_pulleyMass:null,m_limitMass1:null,m_limitMass2:null,m_pulleyImpulse:null,m_limitImpulse1:null,m_limitImpulse2:null,m_limitPositionImpulse1:null,m_limitPositionImpulse2:null,m_limitState1:0,m_limitState2:0});b2PulleyJoint.b2_minPulleyLength=b2Settings.b2_lengthUnitsPerMeter;var b2PulleyJointDef=Class.create();Object.extend(b2PulleyJointDef.prototype,b2JointDef.prototype);Object.extend(b2PulleyJointDef.prototype,{initialize:function(){this.type=b2Joint.e_unknownJoint;this.userData=null;this.body1=null;this.body2=null;this.collideConnected=false;this.groundPoint1=new b2Vec2();this.groundPoint2=new b2Vec2();this.anchorPoint1=new b2Vec2();this.anchorPoint2=new b2Vec2();this.type=b2Joint.e_pulleyJoint;this.groundPoint1.Set(-1,1);this.groundPoint2.Set(1,1);this.anchorPoint1.Set(-1,0);this.anchorPoint2.Set(1,0);this.maxLength1=0.5*b2PulleyJoint.b2_minPulleyLength;this.maxLength2=0.5*b2PulleyJoint.b2_minPulleyLength;this.ratio=1;this.collideConnected=true},groundPoint1:new b2Vec2(),groundPoint2:new b2Vec2(),anchorPoint1:new b2Vec2(),anchorPoint2:new b2Vec2(),maxLength1:null,maxLength2:null,ratio:null});var b2RevoluteJoint=Class.create();Object.extend(b2RevoluteJoint.prototype,b2Joint.prototype);Object.extend(b2RevoluteJoint.prototype,{GetAnchor1:function(){var a=this.m_body1.m_R;return new b2Vec2(this.m_body1.m_position.x+(a.col1.x*this.m_localAnchor1.x+a.col2.x*this.m_localAnchor1.y),this.m_body1.m_position.y+(a.col1.y*this.m_localAnchor1.x+a.col2.y*this.m_localAnchor1.y))},GetAnchor2:function(){var a=this.m_body2.m_R;return new b2Vec2(this.m_body2.m_position.x+(a.col1.x*this.m_localAnchor2.x+a.col2.x*this.m_localAnchor2.y),this.m_body2.m_position.y+(a.col1.y*this.m_localAnchor2.x+a.col2.y*this.m_localAnchor2.y))},GetJointAngle:function(){return this.m_body2.m_rotation-this.m_body1.m_rotation},GetJointSpeed:function(){return this.m_body2.m_angularVelocity-this.m_body1.m_angularVelocity},GetMotorTorque:function(a){return a*this.m_motorImpulse},SetMotorSpeed:function(a){this.m_motorSpeed=a},SetMotorTorque:function(a){this.m_maxMotorTorque=a},GetReactionForce:function(a){var b=this.m_ptpImpulse.Copy();b.Multiply(a);return b},GetReactionTorque:function(a){return a*this.m_limitImpulse},initialize:function(c){this.m_node1=new b2JointNode();this.m_node2=new b2JointNode();this.m_type=c.type;this.m_prev=null;this.m_next=null;this.m_body1=c.body1;this.m_body2=c.body2;this.m_collideConnected=c.collideConnected;this.m_islandFlag=false;this.m_userData=c.userData;this.K=new b2Mat22();this.K1=new b2Mat22();this.K2=new b2Mat22();this.K3=new b2Mat22();this.m_localAnchor1=new b2Vec2();this.m_localAnchor2=new b2Vec2();this.m_ptpImpulse=new b2Vec2();this.m_ptpMass=new b2Mat22();var b;var a;var e;b=this.m_body1.m_R;a=c.anchorPoint.x-this.m_body1.m_position.x;e=c.anchorPoint.y-this.m_body1.m_position.y;this.m_localAnchor1.x=a*b.col1.x+e*b.col1.y;this.m_localAnchor1.y=a*b.col2.x+e*b.col2.y;b=this.m_body2.m_R;a=c.anchorPoint.x-this.m_body2.m_position.x;e=c.anchorPoint.y-this.m_body2.m_position.y;this.m_localAnchor2.x=a*b.col1.x+e*b.col1.y;this.m_localAnchor2.y=a*b.col2.x+e*b.col2.y;this.m_intialAngle=this.m_body2.m_rotation-this.m_body1.m_rotation;this.m_ptpImpulse.Set(0,0);this.m_motorImpulse=0;this.m_limitImpulse=0;this.m_limitPositionImpulse=0;this.m_lowerAngle=c.lowerAngle;this.m_upperAngle=c.upperAngle;this.m_maxMotorTorque=c.motorTorque;this.m_motorSpeed=c.motorSpeed;this.m_enableLimit=c.enableLimit;this.m_enableMotor=c.enableMotor},K:new b2Mat22(),K1:new b2Mat22(),K2:new b2Mat22(),K3:new b2Mat22(),PrepareVelocitySolver:function(){var j=this.m_body1;var h=this.m_body2;var g;g=j.m_R;var m=g.col1.x*this.m_localAnchor1.x+g.col2.x*this.m_localAnchor1.y;var k=g.col1.y*this.m_localAnchor1.x+g.col2.y*this.m_localAnchor1.y;g=h.m_R;var f=g.col1.x*this.m_localAnchor2.x+g.col2.x*this.m_localAnchor2.y;var e=g.col1.y*this.m_localAnchor2.x+g.col2.y*this.m_localAnchor2.y;var n=j.m_invMass;var l=h.m_invMass;var c=j.m_invI;var b=h.m_invI;this.K1.col1.x=n+l;this.K1.col2.x=0;this.K1.col1.y=0;this.K1.col2.y=n+l;this.K2.col1.x=c*k*k;this.K2.col2.x=-c*m*k;this.K2.col1.y=-c*m*k;this.K2.col2.y=c*m*m;this.K3.col1.x=b*e*e;this.K3.col2.x=-b*f*e;this.K3.col1.y=-b*f*e;this.K3.col2.y=b*f*f;this.K.SetM(this.K1);this.K.AddM(this.K2);this.K.AddM(this.K3);this.K.Invert(this.m_ptpMass);this.m_motorMass=1/(c+b);if(this.m_enableMotor==false){this.m_motorImpulse=0}if(this.m_enableLimit){var a=h.m_rotation-j.m_rotation-this.m_intialAngle;if(b2Math.b2Abs(this.m_upperAngle-this.m_lowerAngle)<2*b2Settings.b2_angularSlop){this.m_limitState=b2Joint.e_equalLimits}else{if(a<=this.m_lowerAngle){if(this.m_limitState!=b2Joint.e_atLowerLimit){this.m_limitImpulse=0}this.m_limitState=b2Joint.e_atLowerLimit}else{if(a>=this.m_upperAngle){if(this.m_limitState!=b2Joint.e_atUpperLimit){this.m_limitImpulse=0}this.m_limitState=b2Joint.e_atUpperLimit}else{this.m_limitState=b2Joint.e_inactiveLimit;this.m_limitImpulse=0}}}}else{this.m_limitImpulse=0}if(b2World.s_enableWarmStarting){j.m_linearVelocity.x-=n*this.m_ptpImpulse.x;j.m_linearVelocity.y-=n*this.m_ptpImpulse.y;j.m_angularVelocity-=c*((m*this.m_ptpImpulse.y-k*this.m_ptpImpulse.x)+this.m_motorImpulse+this.m_limitImpulse);h.m_linearVelocity.x+=l*this.m_ptpImpulse.x;h.m_linearVelocity.y+=l*this.m_ptpImpulse.y;h.m_angularVelocity+=b*((f*this.m_ptpImpulse.y-e*this.m_ptpImpulse.x)+this.m_motorImpulse+this.m_limitImpulse)}else{this.m_ptpImpulse.SetZero();this.m_motorImpulse=0;this.m_limitImpulse=0}this.m_limitPositionImpulse=0},SolveVelocityConstraints:function(g){var h=this.m_body1;var f=this.m_body2;var k;k=h.m_R;var q=k.col1.x*this.m_localAnchor1.x+k.col2.x*this.m_localAnchor1.y;var p=k.col1.y*this.m_localAnchor1.x+k.col2.y*this.m_localAnchor1.y;k=f.m_R;var b=k.col1.x*this.m_localAnchor2.x+k.col2.x*this.m_localAnchor2.y;var a=k.col1.y*this.m_localAnchor2.x+k.col2.y*this.m_localAnchor2.y;var m;var s=f.m_linearVelocity.x+(-f.m_angularVelocity*a)-h.m_linearVelocity.x-(-h.m_angularVelocity*p);var r=f.m_linearVelocity.y+(f.m_angularVelocity*b)-h.m_linearVelocity.y-(h.m_angularVelocity*q);var o=-(this.m_ptpMass.col1.x*s+this.m_ptpMass.col2.x*r);var n=-(this.m_ptpMass.col1.y*s+this.m_ptpMass.col2.y*r);this.m_ptpImpulse.x+=o;this.m_ptpImpulse.y+=n;h.m_linearVelocity.x-=h.m_invMass*o;h.m_linearVelocity.y-=h.m_invMass*n;h.m_angularVelocity-=h.m_invI*(q*n-p*o);f.m_linearVelocity.x+=f.m_invMass*o;f.m_linearVelocity.y+=f.m_invMass*n;f.m_angularVelocity+=f.m_invI*(b*n-a*o);if(this.m_enableMotor&&this.m_limitState!=b2Joint.e_equalLimits){var t=f.m_angularVelocity-h.m_angularVelocity-this.m_motorSpeed;var c=-this.m_motorMass*t;var e=this.m_motorImpulse;this.m_motorImpulse=b2Math.b2Clamp(this.m_motorImpulse+c,-g.dt*this.m_maxMotorTorque,g.dt*this.m_maxMotorTorque);c=this.m_motorImpulse-e;h.m_angularVelocity-=h.m_invI*c;f.m_angularVelocity+=f.m_invI*c}if(this.m_enableLimit&&this.m_limitState!=b2Joint.e_inactiveLimit){var j=f.m_angularVelocity-h.m_angularVelocity;var l=-this.m_motorMass*j;if(this.m_limitState==b2Joint.e_equalLimits){this.m_limitImpulse+=l}else{if(this.m_limitState==b2Joint.e_atLowerLimit){m=this.m_limitImpulse;this.m_limitImpulse=b2Math.b2Max(this.m_limitImpulse+l,0);l=this.m_limitImpulse-m}else{if(this.m_limitState==b2Joint.e_atUpperLimit){m=this.m_limitImpulse;this.m_limitImpulse=b2Math.b2Min(this.m_limitImpulse+l,0);l=this.m_limitImpulse-m}}}h.m_angularVelocity-=h.m_invI*l;f.m_angularVelocity+=f.m_invI*l}},SolvePositionConstraints:function(){var u;var o;var n=this.m_body1;var m=this.m_body2;var q=0;var p;p=n.m_R;var B=p.col1.x*this.m_localAnchor1.x+p.col2.x*this.m_localAnchor1.y;var A=p.col1.y*this.m_localAnchor1.x+p.col2.y*this.m_localAnchor1.y;p=m.m_R;var g=p.col1.x*this.m_localAnchor2.x+p.col2.x*this.m_localAnchor2.y;var f=p.col1.y*this.m_localAnchor2.x+p.col2.y*this.m_localAnchor2.y;var x=n.m_position.x+B;var v=n.m_position.y+A;var e=m.m_position.x+g;var c=m.m_position.y+f;var l=e-x;var k=c-v;q=Math.sqrt(l*l+k*k);var s=n.m_invMass;var r=m.m_invMass;var j=n.m_invI;var h=m.m_invI;this.K1.col1.x=s+r;this.K1.col2.x=0;this.K1.col1.y=0;this.K1.col2.y=s+r;this.K2.col1.x=j*A*A;this.K2.col2.x=-j*B*A;this.K2.col1.y=-j*B*A;this.K2.col2.y=j*B*B;this.K3.col1.x=h*f*f;this.K3.col2.x=-h*g*f;this.K3.col1.y=-h*g*f;this.K3.col2.y=h*g*g;this.K.SetM(this.K1);this.K.AddM(this.K2);this.K.AddM(this.K3);this.K.Solve(b2RevoluteJoint.tImpulse,-l,-k);var b=b2RevoluteJoint.tImpulse.x;var a=b2RevoluteJoint.tImpulse.y;n.m_position.x-=n.m_invMass*b;n.m_position.y-=n.m_invMass*a;n.m_rotation-=n.m_invI*(B*a-A*b);n.m_R.Set(n.m_rotation);m.m_position.x+=m.m_invMass*b;m.m_position.y+=m.m_invMass*a;m.m_rotation+=m.m_invI*(g*a-f*b);m.m_R.Set(m.m_rotation);var z=0;if(this.m_enableLimit&&this.m_limitState!=b2Joint.e_inactiveLimit){var y=m.m_rotation-n.m_rotation-this.m_intialAngle;var t=0;if(this.m_limitState==b2Joint.e_equalLimits){o=b2Math.b2Clamp(y,-b2Settings.b2_maxAngularCorrection,b2Settings.b2_maxAngularCorrection);t=-this.m_motorMass*o;z=b2Math.b2Abs(o)}else{if(this.m_limitState==b2Joint.e_atLowerLimit){o=y-this.m_lowerAngle;z=b2Math.b2Max(0,-o);o=b2Math.b2Clamp(o+b2Settings.b2_angularSlop,-b2Settings.b2_maxAngularCorrection,0);t=-this.m_motorMass*o;u=this.m_limitPositionImpulse;this.m_limitPositionImpulse=b2Math.b2Max(this.m_limitPositionImpulse+t,0);t=this.m_limitPositionImpulse-u}else{if(this.m_limitState==b2Joint.e_atUpperLimit){o=y-this.m_upperAngle;z=b2Math.b2Max(0,o);o=b2Math.b2Clamp(o-b2Settings.b2_angularSlop,0,b2Settings.b2_maxAngularCorrection);t=-this.m_motorMass*o;u=this.m_limitPositionImpulse;this.m_limitPositionImpulse=b2Math.b2Min(this.m_limitPositionImpulse+t,0);t=this.m_limitPositionImpulse-u}}}n.m_rotation-=n.m_invI*t;n.m_R.Set(n.m_rotation);m.m_rotation+=m.m_invI*t;m.m_R.Set(m.m_rotation)}return q<=b2Settings.b2_linearSlop&&z<=b2Settings.b2_angularSlop},m_localAnchor1:new b2Vec2(),m_localAnchor2:new b2Vec2(),m_ptpImpulse:new b2Vec2(),m_motorImpulse:null,m_limitImpulse:null,m_limitPositionImpulse:null,m_ptpMass:new b2Mat22(),m_motorMass:null,m_intialAngle:null,m_lowerAngle:null,m_upperAngle:null,m_maxMotorTorque:null,m_motorSpeed:null,m_enableLimit:null,m_enableMotor:null,m_limitState:0});b2RevoluteJoint.tImpulse=new b2Vec2();var b2RevoluteJointDef=Class.create();Object.extend(b2RevoluteJointDef.prototype,b2JointDef.prototype);Object.extend(b2RevoluteJointDef.prototype,{initialize:function(){this.type=b2Joint.e_unknownJoint;this.userData=null;this.body1=null;this.body2=null;this.collideConnected=false;this.type=b2Joint.e_revoluteJoint;this.anchorPoint=new b2Vec2(0,0);this.lowerAngle=0;this.upperAngle=0;this.motorTorque=0;this.motorSpeed=0;this.enableLimit=false;this.enableMotor=false},anchorPoint:null,lowerAngle:null,upperAngle:null,motorTorque:null,motorSpeed:null,enableLimit:null,enableMotor:null});var RoundIsland=Class.create();RoundIsland.prototype={initialize:function(f,e,c,a){var b=0;this.m_bodyCapacity=f;this.m_contactCapacity=e;this.m_jointCapacity=c;this.m_bodyCount=0;this.m_contactCount=0;this.m_jointCount=0;this.m_bodies=new Array(f);for(b=0;b<f;b++){this.m_bodies[b]=null}this.m_contacts=new Array(e);for(b=0;b<e;b++){this.m_contacts[b]=null}this.m_joints=new Array(c);for(b=0;b<c;b++){this.m_joints[b]=null}this.m_allocator=a},Clear:function(){this.m_bodyCount=0;this.m_contactCount=0;this.m_jointCount=0},Solve:function(e,o,c){var k=0;var n;for(k=0;k<this.m_bodyCount;++k){n=this.m_bodies[k];if(n.m_invMass==0){continue}if(c==null){n.m_linearVelocity.Add(b2Math.MulFV(e.dt,b2Math.AddVV(o,b2Math.MulFV(n.m_invMass,n.m_force))))}else{var f=new b2Vec2(c.x,c.y);f.Subtract(n.m_position);if(f.Normalize()>0){n.m_linearVelocity.x+=e.dt*((o.y*f.x)+n.m_invMass*n.m_force.x);n.m_linearVelocity.y+=e.dt*((o.y*f.y)+n.m_invMass*n.m_force.y)}}n.m_angularVelocity+=e.dt*n.m_invI*n.m_torque;n.m_linearVelocity.Multiply(n.m_linearDamping);n.m_angularVelocity*=n.m_angularDamping;n.m_position0.SetV(n.m_position);n.m_rotation0=n.m_rotation}var g=new b2ContactSolver(this.m_contacts,this.m_contactCount,this.m_allocator);g.PreSolve();for(k=0;k<this.m_jointCount;++k){this.m_joints[k].PrepareVelocitySolver()}for(k=0;k<e.iterations;++k){g.SolveVelocityConstraints();for(var h=0;h<this.m_jointCount;++h){this.m_joints[h].SolveVelocityConstraints(e)}}for(k=0;k<this.m_bodyCount;++k){n=this.m_bodies[k];if(n.m_invMass==0){continue}n.m_position.x+=e.dt*n.m_linearVelocity.x;n.m_position.y+=e.dt*n.m_linearVelocity.y;n.m_rotation+=e.dt*n.m_angularVelocity;n.m_R.Set(n.m_rotation)}for(k=0;k<this.m_jointCount;++k){this.m_joints[k].PreparePositionSolver()}if(b2World.s_enablePositionCorrection){for(RoundIsland.m_positionIterationCount=0;RoundIsland.m_positionIterationCount<e.iterations;++RoundIsland.m_positionIterationCount){var l=g.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);var m=true;for(k=0;k<this.m_jointCount;++k){var a=this.m_joints[k].SolvePositionConstraints();m=m&&a}if(l&&m){break}}}g.PostSolve();for(k=0;k<this.m_bodyCount;++k){n=this.m_bodies[k];if(n.m_invMass==0){continue}n.m_R.Set(n.m_rotation);n.SynchronizeShapes();n.m_force.Set(0,0);n.m_torque=0}},UpdateSleep:function(h){var g=0;var a;var f=Number.MAX_VALUE;var e=b2Settings.b2_linearSleepTolerance*b2Settings.b2_linearSleepTolerance;var c=b2Settings.b2_angularSleepTolerance*b2Settings.b2_angularSleepTolerance;for(g=0;g<this.m_bodyCount;++g){a=this.m_bodies[g];if(a.m_invMass==0){continue}if((a.m_flags&b2Body.e_allowSleepFlag)==0){a.m_sleepTime=0;f=0}if((a.m_flags&b2Body.e_allowSleepFlag)==0||a.m_angularVelocity*a.m_angularVelocity>c||b2Math.b2Dot(a.m_linearVelocity,a.m_linearVelocity)>e){a.m_sleepTime=0;f=0}else{a.m_sleepTime+=h;f=b2Math.b2Min(f,a.m_sleepTime)}}if(f>=b2Settings.b2_timeToSleep){for(g=0;g<this.m_bodyCount;++g){a=this.m_bodies[g];a.m_flags|=b2Body.e_sleepFlag}}},AddBody:function(a){this.m_bodies[this.m_bodyCount++]=a},AddContact:function(a){this.m_contacts[this.m_contactCount++]=a},AddJoint:function(a){this.m_joints[this.m_jointCount++]=a},m_allocator:null,m_bodies:null,m_contacts:null,m_joints:null,m_bodyCount:0,m_jointCount:0,m_contactCount:0,m_bodyCapacity:0,m_contactCapacity:0,m_jointCapacity:0,m_positionError:null};RoundIsland.m_positionIterationCount=0;var RoundWorld=Class.create();RoundWorld.prototype={initialize:function(a,f,e,c){this.step=new b2TimeStep();this.m_contactManager=new b2ContactManager();this.m_listener=null;this.m_filter=b2CollisionFilter.b2_defaultFilter;this.m_bodyList=null;this.m_contactList=null;this.m_jointList=null;this.m_bodyCount=0;this.m_contactCount=0;this.m_jointCount=0;this.m_bodyDestroyList=null;this.m_allowSleep=e;this.m_gravity=f;this.m_contactManager.m_world=this;this.m_broadPhase=new b2BroadPhase(a,this.m_contactManager);var b=new b2BodyDef();this.m_groundBody=this.CreateBody(b);this.m_gravityPosition=c},SetListener:function(a){this.m_listener=a},SetFilter:function(a){this.m_filter=a},CreateBody:function(c){var a=new b2Body(c,this);a.m_prev=null;a.m_next=this.m_bodyList;if(this.m_bodyList){this.m_bodyList.m_prev=a}this.m_bodyList=a;++this.m_bodyCount;return a},DestroyBody:function(a){if(a.m_flags&b2Body.e_destroyFlag){return}if(a.m_prev){a.m_prev.m_next=a.m_next}if(a.m_next){a.m_next.m_prev=a.m_prev}if(a==this.m_bodyList){this.m_bodyList=a.m_next}a.m_flags|=b2Body.e_destroyFlag;--this.m_bodyCount;a.m_prev=null;a.m_next=this.m_bodyDestroyList;this.m_bodyDestroyList=a},CleanBodyList:function(){this.m_contactManager.m_destroyImmediate=true;var c=this.m_bodyDestroyList;while(c){var f=c;c=c.m_next;var e=f.m_jointList;while(e){var a=e;e=e.next;if(this.m_listener){this.m_listener.NotifyJointDestroyed(a.joint)}this.DestroyJoint(a.joint)}f.Destroy()}this.m_bodyDestroyList=null;this.m_contactManager.m_destroyImmediate=false},CreateJoint:function(f){var c=b2Joint.Create(f,this.m_blockAllocator);c.m_prev=null;c.m_next=this.m_jointList;if(this.m_jointList){this.m_jointList.m_prev=c}this.m_jointList=c;++this.m_jointCount;c.m_node1.joint=c;c.m_node1.other=c.m_body2;c.m_node1.prev=null;c.m_node1.next=c.m_body1.m_jointList;if(c.m_body1.m_jointList){c.m_body1.m_jointList.prev=c.m_node1}c.m_body1.m_jointList=c.m_node1;c.m_node2.joint=c;c.m_node2.other=c.m_body1;c.m_node2.prev=null;c.m_node2.next=c.m_body2.m_jointList;if(c.m_body2.m_jointList){c.m_body2.m_jointList.prev=c.m_node2}c.m_body2.m_jointList=c.m_node2;if(f.collideConnected==false){var a=f.body1.m_shapeCount<f.body2.m_shapeCount?f.body1:f.body2;for(var e=a.m_shapeList;e;e=e.m_next){e.ResetProxy(this.m_broadPhase)}}return c},DestroyJoint:function(f){var h=f.m_collideConnected;if(f.m_prev){f.m_prev.m_next=f.m_next}if(f.m_next){f.m_next.m_prev=f.m_prev}if(f==this.m_jointList){this.m_jointList=f.m_next}var e=f.m_body1;var c=f.m_body2;e.WakeUp();c.WakeUp();if(f.m_node1.prev){f.m_node1.prev.next=f.m_node1.next}if(f.m_node1.next){f.m_node1.next.prev=f.m_node1.prev}if(f.m_node1==e.m_jointList){e.m_jointList=f.m_node1.next}f.m_node1.prev=null;f.m_node1.next=null;if(f.m_node2.prev){f.m_node2.prev.next=f.m_node2.next}if(f.m_node2.next){f.m_node2.next.prev=f.m_node2.prev}if(f.m_node2==c.m_jointList){c.m_jointList=f.m_node2.next}f.m_node2.prev=null;f.m_node2.next=null;b2Joint.Destroy(f,this.m_blockAllocator);--this.m_jointCount;if(h==false){var a=e.m_shapeCount<c.m_shapeCount?e:c;for(var g=a.m_shapeList;g;g=g.m_next){g.ResetProxy(this.m_broadPhase)}}},GetGroundBody:function(){return this.m_groundBody},step:new b2TimeStep(),Step:function(a,e){var s;var p;this.step.dt=a;this.step.iterations=e;if(a>0){this.step.inv_dt=1/a}else{this.step.inv_dt=0}this.m_positionIterationCount=0;this.m_contactManager.CleanContactList();this.CleanBodyList();this.m_contactManager.Collide();var o=new RoundIsland(this.m_bodyCount,this.m_contactCount,this.m_jointCount,this.m_stackAllocator);for(s=this.m_bodyList;s!=null;s=s.m_next){s.m_flags&=~b2Body.e_islandFlag}for(var q=this.m_contactList;q!=null;q=q.m_next){q.m_flags&=~b2Contact.e_islandFlag}for(var l=this.m_jointList;l!=null;l=l.m_next){l.m_islandFlag=false}var v=this.m_bodyCount;var r=new Array(this.m_bodyCount);for(var h=0;h<this.m_bodyCount;h++){r[h]=null}for(var n=this.m_bodyList;n!=null;n=n.m_next){if(n.m_flags&(b2Body.e_staticFlag|b2Body.e_islandFlag|b2Body.e_sleepFlag|b2Body.e_frozenFlag)){continue}o.Clear();var u=0;r[u++]=n;n.m_flags|=b2Body.e_islandFlag;while(u>0){s=r[--u];o.AddBody(s);s.m_flags&=~b2Body.e_sleepFlag;if(s.m_flags&b2Body.e_staticFlag){continue}for(var t=s.m_contactList;t!=null;t=t.next){if(t.contact.m_flags&b2Contact.e_islandFlag){continue}o.AddContact(t.contact);t.contact.m_flags|=b2Contact.e_islandFlag;p=t.other;if(p.m_flags&b2Body.e_islandFlag){continue}r[u++]=p;p.m_flags|=b2Body.e_islandFlag}for(var g=s.m_jointList;g!=null;g=g.next){if(g.joint.m_islandFlag==true){continue}o.AddJoint(g.joint);g.joint.m_islandFlag=true;p=g.other;if(p.m_flags&b2Body.e_islandFlag){continue}r[u++]=p;p.m_flags|=b2Body.e_islandFlag}}o.Solve(this.step,this.m_gravity,this.m_gravityPosition);this.m_positionIterationCount=b2Math.b2Max(this.m_positionIterationCount,b2Island.m_positionIterationCount);if(this.m_allowSleep){o.UpdateSleep(a)}for(var m=0;m<o.m_bodyCount;++m){s=o.m_bodies[m];if(s.m_flags&b2Body.e_staticFlag){s.m_flags&=~b2Body.e_islandFlag}if(s.IsFrozen()&&this.m_listener){var f=this.m_listener.NotifyBoundaryViolated(s);if(f==b2WorldListener.b2_destroyBody){this.DestroyBody(s);s=null;o.m_bodies[m]=null}}}}this.m_broadPhase.Commit()},Query:function(b,a,g){var e=new Array();var f=this.m_broadPhase.QueryAABB(b,e,g);for(var c=0;c<f;++c){a[c]=e[c]}return f},GetBodyList:function(){return this.m_bodyList},GetJointList:function(){return this.m_jointList},GetContactList:function(){return this.m_contactList},m_blockAllocator:null,m_stackAllocator:null,m_broadPhase:null,m_contactManager:new b2ContactManager(),m_bodyList:null,m_contactList:null,m_jointList:null,m_bodyCount:0,m_contactCount:0,m_jointCount:0,m_bodyDestroyList:null,m_gravity:null,m_allowSleep:null,m_groundBody:null,m_listener:null,m_filter:null,m_gravityPosition:null,m_positionIterationCount:0};RoundWorld.s_enablePositionCorrection=1;RoundWorld.s_enableWarmStarting=1;function drawWorld(g,e){for(var c=g.m_jointList;c;c=c.m_next){drawJoint(c,e,g)}for(var a=g.m_bodyList;a;a=a.m_next){for(var f=a.GetShapeList();f!=null;f=f.GetNext()){drawShape(f,e)}}}function drawJoint(e,b,f){var h=e.m_body1;var g=e.m_body2;var c=h.m_position;var a=g.m_position;var k=e.GetAnchor1();var j=e.GetAnchor2();b.strokeStyle="#00eeee";b.beginPath();switch(e.m_type){case b2Joint.e_distanceJoint:b.moveTo(k.x*SCALE,k.y*SCALE);b.lineTo(j.x*SCALE,j.y*SCALE);break;case b2Joint.e_pulleyJoint:break;default:if(h==f.m_groundBody){b.moveTo(k.x*SCALE,k.y*SCALE);b.lineTo(a.x*SCALE,a.y*SCALE)}else{if(g==f.m_groundBody){b.moveTo(k.x*SCALE,k.y*SCALE);b.lineTo(c.x*SCALE,c.y*SCALE)}else{b.moveTo(c.x*SCALE,c.y*SCALE);b.lineTo(k.x*SCALE,k.y*SCALE);b.lineTo(a.x*SCALE,a.y*SCALE);b.lineTo(j.x*SCALE,j.y*SCALE)}}break}b.stroke()}function drawShape(k,f){f.strokeStyle="#0000FF";f.beginPath();switch(k.m_type){case b2Shape.e_circleShape:var e=k;var n=e.m_position;var b=e.m_radius;var j=16;var g=0;var p=2*Math.PI/j;f.moveTo((n.x+b)*SCALE,n.y*SCALE);for(var h=0;h<j;h++){var l=new b2Vec2(b*Math.cos(g),b*Math.sin(g));var o=b2Math.AddVV(n,l);f.lineTo(o.x*SCALE,o.y*SCALE);g+=p}f.lineTo((n.x+b)*SCALE,n.y*SCALE);f.moveTo(n.x*SCALE,n.y*SCALE);var a=e.m_R.col1;var m=new b2Vec2(n.x+b*a.x,n.y+b*a.y);f.lineTo(m.x*SCALE,m.y*SCALE);break;case b2Shape.e_polyShape:var c=k;var q=b2Math.AddVV(c.m_position,b2Math.b2MulMV(c.m_R,c.m_vertices[0]));f.moveTo(q.x*SCALE,q.y*SCALE);for(var h=0;h<c.m_vertexCount;h++){var o=b2Math.AddVV(c.m_position,b2Math.b2MulMV(c.m_R,c.m_vertices[h]));f.lineTo(o.x*SCALE,o.y*SCALE)}f.lineTo(q.x*SCALE,q.y*SCALE);break}f.stroke()}var MathUtil={};MathUtil.toRadian=function(a){return a*Math.PI/180};MathUtil.toDegree=function(a){return a*180/Math.PI};var Indicator=function(){if(Indicator.instance){return}var a=jQuery(new Image());a.prototype=jQuery.extend(a,Indicator.prototype);a.initialize();return a};Indicator.instance=null;(function(b,a){this.initialize=function(){a=this;var c={position:"absolute",margin:"-8px 0 0 -8px",zIndex:9999};this.css(c)};this.onLoad=function(c){var e=a[0];if(e.width==0){var f=b.Deferred();e.onload=f.resolve;e.onerror=f.reject;e.src="images/indicator.gif";return f.promise()}};this.onAdded=function(c){b(window).bind("resize",this,this.onResize);this.onResize({data:this})};this.onRemoved=function(c){b(window).unbind("resize",this.onResize)};this.onResize=function(j){var g=j.data;var h=b(window).width();var f=b(window).height();var c=Math.floor(h/2);var k=Math.floor(f/2);k=(k<150+8)?150+8:(100+450+8<k)?100+450+8:k;g.css({top:k+"px",left:c+"px"})}}).call(Indicator.prototype,jQuery);Indicator.getInstance=function(){if(!Indicator.instance){Indicator.instance=new Indicator()}return Indicator.instance};var Planet=function(){if(!supports_canvas()){return}this.initialize()};Planet.Center=function(){return new b2Vec2(760/2,400)};Planet.WorldCenter=function(){return new b2Vec2(760/2/SCALE,400/SCALE)};(function(a){this.canvas;this.debug;this.world;this.stage;this.maru;this.ground;this.wall;this.initialize=function(){var c={position:"absolute",width:"760px",height:"400px"};this.canvas=a('<canvas width="760px" height="400" onSelectStart = "return false;" onMouseDown = "return false;" style = "-moz-user-select: none; -khtml-user-select: none; user-select: none;">');this.canvas.css(c);this.debug=a('<canvas width="760px" height="400">');this.debug.css(c);this.world=new PlanetWorld(this.debug);this.stage=new Stage(this.canvas[0]);this.ground=new Ground(this.world);this.maru=new Maru(this.world);this.wall=new Wall(this.world);this.stage.addChild(this.ground);this.stage.addChild(this.maru);this.tick();var b=this;this.ground.onPress=function(f){b.onPress.call(b,f)};this.stage.onMouseMove=function(f){b.onMouseMove.call(b,f)}};this.jumpCount=0;this.onPress=function(g){var c=this.ground.getBody().GetContactList();if(c){this.jumpCount=0}else{if(1<this.jumpCount){return}}var b=this.maru.getBody();var f=b.GetCenterPosition().Copy();f.Subtract(Planet.WorldCenter());f.Normalize();b.ApplyImpulse(f,b.GetCenterPosition());this.jumpCount++};this.onMouseMove=function(h){var f=new b2Vec2(h.stageX,h.stageY);f.Subtract(Planet.Center());var c=f.Length();if(c<=175){var b=Math.atan2(f.y,f.x);var g=MathUtil.toDegree(b)+90;this.maru.power=(g/90)*(c/175)}else{this.maru.power=0}};this.tick=function(f){this.world.Step(1/24,10);this.world.drawDebug();this.stage.update();this.maru.update();var g=this.wall.GetContactList();if(g){var b=this.maru.getBody().GetAngularVelocity();this.ground.rotation+=-b*0.3}};this.onAdded=function(b){var c=this;var e=a.Deferred();a.when(this.ground.onLoad(),this.maru.onLoad()).always(function(){a("#footer").append(c.canvas);Ticker.setFPS(24);Ticker.addListener(c);e.resolve()});return e.promise()}}).call(Planet.prototype,jQuery);var PlanetWorld=function(a){return this.initialize(a)};(function(a){this.debug;this.initialize=function(e){this.debug=e;var c=new b2AABB();c.minVertex.Set(-1000,-1000);c.maxVertex.Set(1000,1000);var g=new b2Vec2(0,10);var b=new b2Vec2(760/2/SCALE,400/SCALE);var f=jQuery.extend(this,RoundWorld.prototype);RoundWorld.call(f,c,g,true,b);return f};this.drawDebug=function(){var b=this.debug[0].getContext("2d");b.clearRect(0,0,this.debug[0].width,this.debug[0].height);drawWorld(this,b)}}).call(PlanetWorld.prototype,jQuery);var Wall=function(a){return this.initialize(a)};(function(a){this.initialize=function(c){var e=new b2BoxDef();e.extents.Set(360/SCALE,30/SCALE);e.friction=0;e.restitution=0;var b=new b2BodyDef();b.AddShape(e);b.position.Set(360/SCALE,(400+30)/SCALE);return c.CreateBody(b)}}).call(Wall.prototype,jQuery);var Ground=function(b){if(Ground.instance){return}var a=new Container();a.prototype=jQuery.extend(a,Ground.prototype);a.initialize(b);Ground.instance=a;return a};Ground.instance=null;(function(a){this.body;this.bmp;this.initialize=function(c){var e=new b2CircleDef();e.radius=(350-20)/2/SCALE;e.friction=0.2;e.restitution=0.5;var b=new b2BodyDef();b.AddShape(e);b.position.SetV(Planet.WorldCenter());b.userData=this;this.body=c.CreateBody(b);this.x=Planet.Center().x;this.y=Planet.Center().y};this.getBody=function(){return this.body};this.onLoad=function(b){var c=this;if(!this.bmp){var f=a.Deferred();var e=new Image();e.src="images/ground.png";e.onload=function(){c.bmp=new Bitmap(this);c.bmp.x=-255;c.bmp.y=-236;c.addChild(c.bmp);f.resolve()};e.onerror=f.reject;return f.promise()}}}).call(Ground.prototype,jQuery);var Maru=function(b){if(Maru.instance){return}var a=new Container();a.prototype=jQuery.extend(a,Maru.prototype);a.initialize(b);Maru.instance=a;return a};Maru.instance=null;(function(a){this.body;this.bmp;this.power=0;this.initialize=function(c){var e=new b2CircleDef();e.density=1;e.radius=72/2/SCALE;e.friction=0.2;e.restitution=0.1;var b=new b2BodyDef();b.angularDamping=0.2;b.position.Set(760/2/SCALE,100/SCALE);b.AddShape(e);b.userData=this;b.allowSleep=false;this.body=c.CreateBody(b)};this.onLoad=function(b){var c=this;if(!this.bmp){var f=a.Deferred();var e=new Image();e.src="images/animation20111027144212.png";e.onload=function(){var g=new SpriteSheet(this,100,100);c.bmp=new BitmapSequence(g);c.bmp.x=-50;c.bmp.y=-50;c.addChild(c.bmp);c.setFootRotate(0);f.resolve()};e.onerror=f.reject;return f.promise()}};this.getBody=function(){return this.body};this.getFootRotate=function(){return this._footRotate};this.setFootRotate=function(b){this._footRotate=b%1;if(!this.bmp){return}var c=Math.floor(Math.abs(this._footRotate*60));this.bmp.gotoAndStop(c)};this._footRotate=0;this.isAnimate=false;this.update=function(){if(!this.body){return}this.body.ApplyTorque(this.power);var c=this.body.GetCenterPosition().Copy();this.x=c.x*SCALE;this.y=c.y*SCALE;c.Subtract(Planet.WorldCenter());var b=Math.atan2(c.y,c.x);var e=MathUtil.toDegree(b);this.rotation=e+90;var g=this.body.GetAngularVelocity();if(Math.abs(g)<=0.01){if(!this.isAnimate){this.isAnimate=true;var f=this._footRotate;f=(f<-0.75)?-1:(f<-0.25)?-0.5:(f<0.25)?0:(f<0.75)?0.5:1;a(this).animate({_footRotate:f},500,null,function(){self.isAnimate=false})}this.setFootRotate(this._footRotate);return}a(this).stop();this.isAnimate=false;this.setFootRotate(this.getFootRotate()+g/15);if(g){this.scaleX=(g<0)?-1:(g>0)?1:this.scaleX}}}).call(Maru.prototype,jQuery);var IndexScene=function(b){var a={};a.prototype=jQuery.extend(a,SceneObject.prototype,IndexScene.prototype);a.initialize(b);return a};(function(a){this.planet;this.aboutScene;this.clientScene;this.privateScene;this.contactScene;this.initialize=function(b){SceneObject.prototype.initialize.call(this,b);this.planet=(supports_canvas())?new Planet():null;this.aboutScene=this.addScene(new AboutScene("about"));this.clientScene=this.addScene(new ClientScene("client"));this.privateScene=this.addScene(new PrivateScene("private"));this.contactScene=this.addScene(new ContactScene("contact"))};this.onLoadScene=function(b){var e=this;var f=SceneManager.getInstance();if(f.departedSceneId){SceneObject.prototype.onLoadScene.call(e);return}var c=Indicator.getInstance();var g=a.Deferred();g.pipe(function(){return c.onLoad()}).pipe(function(){a("body").append(c);return c.onAdded()}).pipe(function(){if(e.planet){a("#footer").find("img").remove();return e.planet.onAdded()}}).always(function(){a(window).bind("resize",e.onResize);e.onResize()}).pipe(function(){a("#container").css("visibility","visible");c.remove();return c.onRemoved()}).always(function(){SceneObject.prototype.onLoadScene.call(e)});g.resolve()};this.onInitScene=function(b){var e=this;var c=Indicator.getInstance();var f=a.Deferred();f.pipe(function(){a("body").append(c);return c.onAdded()}).pipe(function(){var g=a.Deferred();a.ajax({type:"GET",dataType:"html",url:"index.html",success:function(k,j){a("#content").append(a(k).find("#index"));e.onResize();var h=a(k).filter("title").text();if(h){a("title").text(h)}a("#index").hide();a("#index").fadeTo(500,1,function(){g.resolve()});c.remove();c.onRemoved()},error:function(h,k,j){g.reject();c.remove();c.onRemoved()}});return g.promise()}).always(function(){SceneObject.prototype.onInitScene.call(e)});f.resolve()};this.onGotoScene=function(b){var e=this;var c=Indicator.getInstance();var f=a.Deferred();f.pipe(function(){a("#index").remove();c.remove();return c.onRemoved()}).always(function(){SceneObject.prototype.onGotoScene.call(e)});f.resolve()};this.onResize=function(j){var f=768;var b=900;var o=400;var n=a(window).height();var k=(n<f)?f-o:(n-o);a("#footer").css("top",k+"px");var g=n-f;var c=b-f;var l=(n<b)?(g/c):1;l=0.5+0.5*Math.max(l,0);a(".mb30").css("margin-bottom",Math.floor(30*l)+"px");a(".mb50").css("margin-bottom",Math.floor(50*l)+"px");a(".mb70").css("margin-bottom",Math.floor(70*l)+"px");a(".mt70").css("margin-top",Math.floor(70*l)+"px")}}).call(IndexScene.prototype,jQuery);var AboutScene=function(b){var a={};a.prototype=jQuery.extend(a,SceneObject.prototype,AboutScene.prototype);a.initialize(b);return a};(function(a){this.initialize=function(b){SceneObject.prototype.initialize.call(this,b)};this.onInitScene=function(b){var e=this;var c=Indicator.getInstance();var f=a.Deferred();f.pipe(function(){a("body").append(c);return c.onAdded()}).pipe(function(){var g=a.Deferred();a.ajax({type:"GET",dataType:"html",url:"about.html",success:function(k,j){a("#content").append(a(k).find("#about"));e.parent.onResize();var h=a(k).filter("title").text();if(h){a("title").text(h)}a("#about").hide();a("#about").fadeTo(500,1,function(){g.resolve()});c.remove();c.onRemoved()},error:function(h,k,j){g.reject();c.remove();c.onRemoved()}});return g.promise()}).always(function(){SceneObject.prototype.onInitScene.call(e)});f.resolve()};this.onGotoScene=function(b){var e=this;var c=Indicator.getInstance();var f=a.Deferred();f.pipe(function(){a("#about").remove();c.remove();return c.onRemoved()}).always(function(){SceneObject.prototype.onGotoScene.call(e)});f.resolve()}}).call(AboutScene.prototype,jQuery);var ClientScene=function(b){var a={};a.prototype=jQuery.extend(a,SceneObject.prototype,ClientScene.prototype);a.initialize(b);return a};(function(a){this.initialize=function(b){SceneObject.prototype.initialize.call(this,b)};this.onInitScene=function(b){var e=this;var c=Indicator.getInstance();var f=a.Deferred();f.pipe(function(){a("body").append(c);return c.onAdded()}).pipe(function(){var g=a.Deferred();a.ajax({type:"GET",dataType:"html",url:"client.html",success:function(k,j){a("#content").append(a(k).find("#client"));e.parent.onResize();var h=a(k).filter("title").text();if(h){a("title").text(h)}a("#showcase li").empty();a("#client").hide();a("#client").fadeTo(500,1,function(){g.resolve()});c.remove();c.onRemoved()},error:function(h,k,j){g.reject();c.remove();c.onRemoved()}});return g.promise()}).pipe(function(){var g=a.Deferred();a.ajax({type:"GET",dataType:"html",url:"showcase.html",success:function(k,h){var j=a(k).find("dl");new ClientShowCase(j);g.resolve()},error:function(h,k,j){trace("",h,k,j);g.reject()}});return g.promise()}).always(function(){SceneObject.prototype.onInitScene.call(e)});f.resolve()};this.onGotoScene=function(b){var e=this;var c=Indicator.getInstance();var f=a.Deferred();f.pipe(function(){a("#client").remove();c.remove();return c.onRemoved()}).always(function(){SceneObject.prototype.onGotoScene.call(e)});f.resolve()}}).call(ClientScene.prototype,jQuery);var PrivateScene=function(b){var a={};a.prototype=jQuery.extend(a,SceneObject.prototype,PrivateScene.prototype);a.initialize(b);return a};(function(a){this.initialize=function(b){SceneObject.prototype.initialize.call(this,b)};this.onInitScene=function(b){var e=this;var c=Indicator.getInstance();var f=a.Deferred();f.pipe(function(){a("body").append(c);return c.onAdded()}).pipe(function(){var g=a.Deferred();a.ajax({type:"GET",dataType:"html",url:"private.html",success:function(k,j){a("#content").append(a(k).find("#private"));e.parent.onResize();var h=a(k).filter("title").text();if(h){a("title").text(h)}a("#private").hide();a("#private").fadeTo(500,1,function(){g.resolve()});c.remove();c.onRemoved()},error:function(h,k,j){g.reject();c.remove();c.onRemoved()}});return g.promise()}).always(function(){SceneObject.prototype.onInitScene.call(e)});f.resolve()};this.onGotoScene=function(b){var e=this;var c=Indicator.getInstance();var f=a.Deferred();f.pipe(function(){a("#private").remove();c.remove();return c.onRemoved()}).always(function(){SceneObject.prototype.onGotoScene.call(e)});f.resolve()}}).call(PrivateScene.prototype,jQuery);var ContactScene=function(b){var a={};a.prototype=jQuery.extend(a,SceneObject.prototype,ContactScene.prototype);a.initialize(b);return a};(function(a){this.initialize=function(b){SceneObject.prototype.initialize.call(this,b)};this.onInitScene=function(b){var e=this;var c=Indicator.getInstance();var f=a.Deferred();f.pipe(function(){a("body").append(c);return c.onAdded()}).pipe(function(){var g=a.Deferred();a.ajax({type:"GET",dataType:"html",url:"contact.html",success:function(k,j){a("#content").append(a(k).find("#contact"));e.parent.onResize();var h=a(k).filter("title").text();if(h){a("title").text(h)}a("#content").hide();a("#content").fadeTo(500,1,function(){g.resolve()});c.remove();c.onRemoved()},error:function(h,k,j){g.reject();c.remove();c.onRemoved()}});return g.promise()}).always(function(){SceneObject.prototype.onInitScene.call(e)});f.resolve()};this.onGotoScene=function(b){var e=this;var c=Indicator.getInstance();var f=a.Deferred();f.pipe(function(){a("#contact").remove();c.remove();return c.onRemoved()}).always(function(){SceneObject.prototype.onGotoScene.call(e)});f.resolve()}}).call(ContactScene.prototype,jQuery);var ClientShowCase=function(a){this.initialize(a)};(function(a){this.list;this.initialize=function(b){this.list=b;this.max=Math.ceil(this.list.length/4);a("#prev").bind("click",this,this.onPrev);a("#next").bind("click",this,this.onNext);a.address.bind("change",this,this.onChange);this.setPage(this.check(a.address.parameter("page")))};this.max;this.getPage=function(){return this.page};this.setPage=function(b){b=this.check(b);if(this.page==b){return}this.page=b;a("#paging dt").text((this.page)+"/"+this.max);this.change()};this.page;this.onChange=function(c){var b=c.data;b.setPage(a.address.parameter("page"))};this.change=function(){var e=(this.check(this.page)-1)*4;var g=Math.min(e+4,this.list.length);var o=a("#showcase li");o.empty();var m=0;var k=[];for(var j=e;j<g;j++){var n=o.eq(m);var f=this.list.eq(j).clone();var c=f.find(".thumb");var l=f.find(".body");c.addClass("preloader");var h=f.find("img");h.hide();l.hide();h.thumb=c;h.body=l;h.bind("load",h,function(p){p.data.body.fadeTo(500,1);p.data.fadeTo(500,1,function(){p.data.thumb.removeClass("preloader")})});h.bind("error",h,function(p){p.data.thumb.removeClass("preloader")});n.append(f);var b=h.attr("src");h.src=b;k.push(h);m++}setTimeout(function(){for(var q=0;q<k.length;q++){var p=k[q];p.attr("src",p.src)}},1)};this.check=function(b){b=isNaN(b)?0:b;b=Math.floor(b);b=(b<1)?1:(b<this.max)?b:this.max;return b};this.onNext=function(f){var b=f.data;var c=b.check(b.page+1);a.address.parameter("page",c);return false};this.onPrev=function(f){var b=f.data;var c=b.check(b.page-1);a.address.parameter("page",c);return false}}).call(ClientShowCase.prototype,jQuery);jQuery(document).ready(function(a){a("#container").css("visibility","hidden");a("#content").empty();new TimeShift();new Index()});var Index=function(){this.initialize()};(function(a){this.sceneManager;this.initialize=function(){this.sceneManager=new SceneManager(new IndexScene("index"))}}).call(Index.prototype,jQuery);var TimeShift=function(){this.initialize()};(function(a){this.initialize=function(){var c=new Date();var b=c.getHours();var e=(b<6)?false:(b<18)?true:false;if(e){a("body").css("background-color","#FFFFFF");a("body").css("background-image","url(/images/day/bg.png)");a("#logo").attr("src","/images/day/logo.png");a("#navi1").attr("src","/images/day/navi1.png");a("#navi2").attr("src","/images/day/navi2.png");a("#navi3").attr("src","/images/day/navi3.png");a("#navi4").attr("src","/images/day/navi4.png");a("#navi5").attr("src","/images/day/navi5.png")}else{if(!a("#logo").attr("src").match("night")){a("body").css("background-color","#000000");a("body").css("background-image","url(/images/night/bg.png)");a("#logo").attr("src","/images/night/logo.png");a("#navi1").attr("src","/images/night/navi1.png");a("#navi2").attr("src","/images/night/navi2.png");a("#navi3").attr("src","/images/night/navi3.png");a("#navi4").attr("src","/images/night/navi4.png");a("#navi5").attr("src","/images/night/navi5.png")}}}}).call(TimeShift.prototype,jQuery);var SceneManager=function(a){if(SceneManager.instance){return}SceneManager.instance=this;this.initialize(a)};SceneManager.instance=null;SceneManager.getInstance=function(){return SceneManager.instance};(function(a){this.lock=false;this.currentScene=null;this.departedSceneId;this.destinedSceneId;this.rootScene;this.scenes;this.initialize=function(c){this.rootScene=c;this.scenes=[];this.scenes.push(this.rootScene);var b=this;a.address.init(function(f){b.onEventHandler.call(b,f)});a.address.change(function(f){b.onEventHandler.call(b,f)})};this.onEventHandler=function(g){trace(""+g.type+"",g);var f=g.path;var c=new RegExp("^/index");if(f.match(c)){trace("")}else{f=f.replace(/^/,this.rootScene.getSceneId().getPath())}f=f.replace(/\/$/,"");var b=new SceneId(f);this.gotoScene.call(this,b)};this.gotoScene=function(b){if(this.lock){trace("");return}if(!this.getSceneBySceneId(b)){trace("",b.getPath());if(!this.currentScene){trace("");this.gotoScene(this.rootScene.getSceneId())}trace("");this.gotoComplete();return}if(this.currentScene&&b.equals(this.currentScene.getSceneId())){trace("");this.gotoComplete();return}else{this.departedSceneId=(this.currentScene)?this.currentScene.getSceneId():null;this.destinedSceneId=b;this._gotoScene("goto",this.currentScene)}};this.gotoComplete=function(){this.lock=false;trace("",this.currentScene.getSceneId().getPath())};this._gotoScene=function(e,c){var b=this;this.lock=true;if(e=="load"){if(c){c.unbind();c.one("onLoadSceneComplete",{scene:c},function(f){b._gotoScene("loadComplete",f.data.scene)});c.onLoadScene();trace(c.getSceneId().getPath()+"でonLoadSceneを実行。")}}else{if(e=="loadComplete"){trace(c.getSceneId().getPath()+"でonLoadScene完了。");if(c.getSceneId().equals(this.destinedSceneId)){this._gotoScene("init",c)}else{if(c.getSceneId().contains(this.destinedSceneId)){this._gotoScene("load",this._getLoadScene(c))}}}else{if(e=="init"){trace("");if(c){c.unbind();c.one("onInitSceneComplete",{scene:c},function(f){b._gotoScene("initComplete",f.data.scene)});c.onInitScene()}else{this._gotoScene("initComplete",c)}}else{if(e=="initComplete"){trace(c.getSceneId().getPath()+"でonInitScene完了。");this.currentScene=c;this.gotoComplete();pageTracker._trackPageview(c.getSceneId().getPath());return}else{if(e=="goto"){trace("");if(c){c.unbind();c.one("onGotoSceneComplete",{scene:c},function(f){b._gotoScene("gotoComplete",f.data.scene)});c.onGotoScene()}else{this._gotoScene("gotoComplete",c)}}else{if(e=="gotoComplete"){trace("");if(c){if(c.getSceneId().contains(this.destinedSceneId)){this._gotoScene("load",this._getLoadScene(c))}else{this._gotoScene("unload",c)}}else{this._gotoScene("unload",c)}}else{if(e=="unload"){trace("");if(c){c.unbind();c.one("onUnLoadSceneComplete",{scene:c},function(f){b._gotoScene("unloadComplete",f.data.scene)});c.onUnLoadScene()}else{this._gotoScene("unloadComplete",c)}}else{if(e=="unloadComplete"){trace("");if(c){if(c.parent.getSceneId().equals(this.destinedSceneId)){this._gotoScene("init",c.parent)}else{if(c.parent.getSceneId().contains(this.destinedSceneId)){this._gotoScene("load",this._getLoadScene(c.parent))}}}else{this._gotoScene("load",this._getLoadScene(c))}}}}}}}}}};this._getLoadScene=function(g){var c;if(g){var f=g.getSceneId().getPath().split("/");var b=this.destinedSceneId.getPath().split("/");trace("",f,b,g.getSceneId().contains(this.destinedSceneId));if(g.getSceneId().contains(this.destinedSceneId)){var h="";for(var e=1;e<f.length+1;e++){h+="/"+b[e]}c=new SceneId(h);trace("",c.getPath())}else{if(g.parent){c=g.parent.getSceneId();trace("",c.getPath())}}}else{c=this.rootScene.getSceneId();trace("",this.rootScene.getSceneId().getPath())}return this.getSceneBySceneId(c)};this.getChildScenes=function(){return this.scenes.concat()};this.getSceneBySceneId=function(e){var c=e.getPath().split("/");trace("",c);if(c[0]!=""){trace("",c[0]);return}var j;for(var f=1;f<c.length;f++){var h=c[f];var b=(j)?j.getChildScenes():this.scenes.concat();var j=null;while(0<b.length){var g=b.shift();if(g.id==h){j=g;trace(f+"",h);break}}if(!j){trace(f+"",h);break}}return j}}).call(SceneManager.prototype,jQuery);var SceneId=function(a){this.initialize(a)};(function(a){this.path;this.initialize=function(b){this.path=b};this.contains=function(c){if(!c.getPath()||!this.path){return}var b=c.getPath().match(this.path);return b};this.equals=function(c){if(!c.getPath()||!this.path){return}var b=(this.path==c.getPath());return b};this.getPath=function(){return this.path}}).call(SceneId.prototype,jQuery);var SceneObject=function(a){this.initialize(a)};SceneObject.prototype=jQuery.extend({},jQuery({}));(function(a){this._scenes;this.id;this.parent=null;this.initialize=function(b){this.id=b;this._scenes=[]};this.onLoadScene=function(b){this.trigger("onLoadSceneComplete")};this.onInitScene=function(b){this.trigger("onInitSceneComplete")};this.onGotoScene=function(b){this.trigger("onGotoSceneComplete")};this.onUnLoadScene=function(b){this.trigger("onUnLoadSceneComplete")};this.addScene=function(b){this._scenes.push(b);b.parent=this;return b};this.getSceneId=function(){var c=this.id;var b=this;while(b.parent){var e=b.parent.id;c=e+"/"+c;b=b.parent}c="/"+c;return new SceneId(c)};this.getChildScenes=function(){return this._scenes.concat()}}).call(SceneObject.prototype,jQuery);
