function Vector(){}function Line(){}function Matrix(){}function checkTouch(){var a=document.createElement("div");return a.setAttribute("ontouchmove","return;"),typeof a.ontouchmove=="function"?!0:!1}function initControls(){for(var a=0;aelementRight&&(j=f-elementRight),ielementBottom&&(k=h-elementBottom);var l=0;j>k?l=j:l=k,smallestDistance===null?(smallestDistance=l,closestElement=b[e]):l").appendTo(b),d=c.css("display");c.remove();if(d==="none"||d===""){cp||(cp=G.createElement("iframe"),cp.frameBorder=cp.width=cp.height=0),b.appendChild(cp);if(!cq||!cp.createElement)cq=(cp.contentWindow||cp.contentDocument).document,cq.write((J.support.boxModel?"":"")+""),cq.close();c=cq.createElement(a),cq.body.appendChild(c),d=J.css(c,"display"),b.removeChild(cp)}co[a]=d}return co[a]}function e(a,b){var c={};return J.each(cu.concat.apply([],cu.slice(0,b)),function(){c[this]=a}),c}function f(){cv=b}function g(){return setTimeout(f,0),cv=J.now()}function h(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function i(){try{return new a.XMLHttpRequest}catch(b){}}function j(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},f,g,h=d.length,i,j=d[0],k,l,m,n,o;for(f=1;f0){if(c!=="border")for(;e=0===c})}function z(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function A(){return!0}function B(){return!1}function C(a,b,c){var d=b+"defer",e=b+"queue",f=b+"mark",g=J._data(a,d);g&&(c==="queue"||!J._data(a,e))&&(c==="mark"||!J._data(a,f))&&setTimeout(function(){!J._data(a,e)&&!J._data(a,f)&&(J.removeData(a,d,!0),g.fire())},0)}function D(a){for(var b in a){if(b==="data"&&J.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function E(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(N,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:J.isNumeric(d)?+d:M.test(d)?J.parseJSON(d):d}catch(f){}J.data(a,c,d)}else d=b}return d}function F(a){var b=K[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,i=/\S/,j=/^\s+/,k=/\s+$/,l=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,m=/^[\],:{}\s]*$/,n=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,o=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,p=/(?:^|:|,)(?:\s*\[)+/g,q=/(webkit)[ \/]([\w.]+)/,r=/(opera)(?:.*version)?[ \/]([\w.]+)/,s=/(msie) ([\w.]+)/,t=/(mozilla)(?:.*? rv:([\w.]+))?/,u=/-([a-z]|[0-9])/ig,v=/^-ms-/,w=function(a,b){return(b+"").toUpperCase()},x=H.userAgent,y,z,A,B=Object.prototype.toString,C=Object.prototype.hasOwnProperty,D=Array.prototype.push,E=Array.prototype.slice,F=String.prototype.trim,I=Array.prototype.indexOf,J={};return d.fn=d.prototype={constructor:d,init:function(a,c,e){var f,g,i,j;if(!a)return this;if(a.nodeType)return this.context=this[0]=a,this.length=1,this;if(a==="body"&&!c&&G.body)return this.context=G,this[0]=G.body,this.selector=a,this.length=1,this;if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?f=h.exec(a):f=[null,a,null];if(f&&(f[1]||!c)){if(f[1])return c=c instanceof d?c[0]:c,j=c?c.ownerDocument||c:G,i=l.exec(a),i?d.isPlainObject(c)?(a=[G.createElement(i[1])],d.fn.attr.call(a,c,!0)):a=[j.createElement(i[1])]:(i=d.buildFragment([f[1]],[j]),a=(i.cacheable?d.clone(i.fragment):i.fragment).childNodes),d.merge(this,a);g=G.getElementById(f[2]);if(g&&g.parentNode){if(g.id!==f[2])return e.find(a);this.length=1,this[0]=g}return this.context=G,this.selector=a,this}return!c||c.jquery?(c||e).find(a):this.constructor(c).find(a)}return d.isFunction(a)?e.ready(a):(a.selector!==b&&(this.selector=a.selector,this.context=a.context),d.makeArray(a,this))},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return E.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var e=this.constructor();return d.isArray(a)?D.apply(e,a):d.merge(e,a),e.prevObject=this,e.context=this.context,b==="find"?e.selector=this.selector+(this.selector?" ":"")+c:b&&(e.selector=this.selector+"."+b+"("+c+")"),e},each:function(a,b){return d.each(this,a,b)},ready:function(a){return d.bindReady(),z.add(a),this},eq:function(a){return a=+a,a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(E.apply(this,arguments),"slice",E.call(arguments).join(","))},map:function(a){return this.pushStack(d.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:D,sort:[].sort,splice:[].splice},d.fn.init.prototype=d.fn,d.extend=d.fn.extend=function(){var a,c,e,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!d.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;z.fireWith(G,[d]),d.fn.trigger&&d(G).trigger("ready").off("ready")}},bindReady:function(){if(!z){z=d.Callbacks("once memory");if(G.readyState==="complete")return setTimeout(d.ready,1);if(G.addEventListener)G.addEventListener("DOMContentLoaded",A,!1),a.addEventListener("load",d.ready,!1);else if(G.attachEvent){G.attachEvent("onreadystatechange",A),a.attachEvent("onload",d.ready);var b=!1;try{b=a.frameElement==null}catch(e){}G.documentElement.doScroll&&b&&c()}}},isFunction:function(a){return d.type(a)==="function"},isArray:Array.isArray||function(a){return d.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):J[B.call(a)]||"object"},isPlainObject:function(a){if(!a||d.type(a)!=="object"||a.nodeType||d.isWindow(a))return!1;try{if(a.constructor&&!C.call(a,"constructor")&&!C.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var e;for(e in a);return e===b||C.call(a,e)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=d.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(m.test(b.replace(n,"@").replace(o,"]").replace(p,"")))return(new Function("return "+b))();d.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var e,f;try{a.DOMParser?(f=new DOMParser,e=f.parseFromString(c,"text/xml")):(e=new ActiveXObject("Microsoft.XMLDOM"),e.async="false",e.loadXML(c))}catch(g){e=b}return(!e||!e.documentElement||e.getElementsByTagName("parsererror").length)&&d.error("Invalid XML: "+c),e},noop:function(){},globalEval:function(b){b&&i.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(v,"ms-").replace(u,w)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,e){var f,g=0,h=a.length,i=h===b||d.isFunction(a);if(e){if(i){for(f in a)if(c.apply(a[f],e)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||d.isArray(a));if(k)for(;i1?L.call(arguments,0):b,j.notifyWith(k,g)}}function c(a){return function(b){d[a]=arguments.length>1?L.call(arguments,0):b,--h||j.resolveWith(j,d)}}var d=L.call(arguments,0),e=0,f=d.length,g=Array(f),h=f,i=f,j=f<=1&&a&&J.isFunction(a.promise)?a:J.Deferred(),k=j.promise();if(f>1){for(;e
a",c=n.getElementsByTagName("*"),d=n.getElementsByTagName("a")[0];if(!c||!c.length||!d)return{};e=G.createElement("select"),f=e.appendChild(G.createElement("option")),g=n.getElementsByTagName("input")[0],b={leadingWhitespace:n.firstChild.nodeType===3,tbody:!n.getElementsByTagName("tbody").length,htmlSerialize:!!n.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.55/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:g.value==="on",optSelected:f.selected,getSetAttribute:n.className!=="t",enctype:!!G.createElement("form").enctype,html5Clone:G.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},J.boxModel=b.boxModel=G.compatMode==="CSS1Compat",g.checked=!0,b.noCloneChecked=g.cloneNode(!0).checked,e.disabled=!0,b.optDisabled=!f.disabled;try{delete n.test}catch(p){b.deleteExpando=!1}!n.addEventListener&&n.attachEvent&&n.fireEvent&&(n.attachEvent("onclick",function(){b.noCloneEvent=!1}),n.cloneNode(!0).fireEvent("onclick")),g=G.createElement("input"),g.value="t",g.setAttribute("type","radio"),b.radioValue=g.value==="t",g.setAttribute("checked","checked"),g.setAttribute("name","t"),n.appendChild(g),h=G.createDocumentFragment(),h.appendChild(n.lastChild),b.checkClone=h.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=g.checked,h.removeChild(g),h.appendChild(n);if(n.attachEvent)for(l in{submit:1,change:1,focusin:1})k="on"+l,m=k in n,m||(n.setAttribute(k,"return;"),m=typeof n[k]=="function"),b[l+"Bubbles"]=m;return h.removeChild(n),h=e=f=n=g=null,J(function(){var c,d,e,f,g,h,j,k,l,o,p,q,r,s=G.getElementsByTagName("body")[0];!s||(k=1,r="padding:0;margin:0;border:",p="position:absolute;top:0;left:0;width:1px;height:1px;",q=r+"0;visibility:hidden;",l="style='"+p+r+"5px solid #000;",o="
"+""+"
",c=G.createElement("div"),c.style.cssText=q+"width:0;height:0;position:static;top:0;margin-top:"+k+"px",s.insertBefore(c,s.firstChild),n=G.createElement("div"),c.appendChild(n),n.innerHTML="
t
",i=n.getElementsByTagName("td"),m=i[0].offsetHeight===0,i[0].style.display="",i[1].style.display="none",b.reliableHiddenOffsets=m&&i[0].offsetHeight===0,a.getComputedStyle&&(n.innerHTML="",j=G.createElement("div"),j.style.width="0",j.style.marginRight="0",n.style.width="2px",n.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),typeof n.style.zoom!="undefined"&&(n.innerHTML="",n.style.width=n.style.padding="1px",n.style.border=0,n.style.overflow="hidden",n.style.display="inline",n.style.zoom=1,b.inlineBlockNeedsLayout=n.offsetWidth===3,n.style.display="block",n.style.overflow="visible",n.innerHTML="
",b.shrinkWrapBlocks=n.offsetWidth!==3),n.style.cssText=p+q,n.innerHTML=o,d=n.firstChild,e=d.firstChild,g=d.nextSibling.firstChild.firstChild,h={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:g.offsetTop===5},e.style.position="fixed",e.style.top="20px",h.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",h.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,h.doesNotIncludeMarginInBodyOffset=s.offsetTop!==k,a.getComputedStyle&&(n.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(n,null)||{marginTop:0}).marginTop!=="1%"),typeof c.style.zoom!="undefined"&&(c.style.zoom=1),s.removeChild(c),j=n=c=null,J.extend(b,h))}),b}();var M=/^(?:\{.*\}|\[.*\])$/,N=/([A-Z])/g;J.extend({cache:{},uuid:0,expando:"jQuery"+(J.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){return a=a.nodeType?J.cache[a[J.expando]]:a[J.expando],!!a&&!D(a)},data:function(a,c,d,e){if(!!J.acceptData(a)){var f,g,h,i=J.expando,j=typeof c=="string",k=a.nodeType,l=k?J.cache:a,m=k?a[i]:a[i]&&i,n=c==="events";if((!m||!l[m]||!n&&!e&&!l[m].data)&&j&&d===b)return;m||(k?a[i]=m=++J.uuid:m=i),l[m]||(l[m]={},k||(l[m].toJSON=J.noop));if(typeof c=="object"||typeof c=="function")e?l[m]=J.extend(l[m],c):l[m].data=J.extend(l[m].data,c);return f=g=l[m],e||(g.data||(g.data={}),g=g.data),d!==b&&(g[J.camelCase(c)]=d),n&&!g[c]?f.events:(j?(h=g[c],h==null&&(h=g[J.camelCase(c)])):h=g,h)}},removeData:function(a,b,c){if(!!J.acceptData(a)){var d,e,f,g=J.expando,h=a.nodeType,i=h?J.cache:a,j=h?a[g]:g;if(!i[j])return;if(b){d=c?i[j]:i[j].data;if(d){J.isArray(b)||(b in d?b=[b]:(b=J.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,f=b.length;e1,null,!1))},removeData:function(a){return this.each(function(){J.removeData(this,a)})}}),J.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",J._data(a,b,(J._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(J._data(b,d)||1)-1;e?J._data(b,d,e):(J.removeData(b,d,!0),C(b,c,"mark"))}},queue:function(a,b,c){var d;if(a)return b=(b||"fx")+"queue",d=J._data(a,b),c&&(!d||J.isArray(c)?d=J._data(a,b,J.makeArray(c)):d.push(c)),d||[]},dequeue:function(a,b){b=b||"fx";var c=J.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),J._data(a,b+".run",e),d.call(a,function(){J.dequeue(a,b)},e)),c.length||(J.removeData(a,b+"queue "+b+".run",!0),C(a,b,"queue"))}}),J.fn.extend({queue:function(a,c){var d=2;return typeof a!="string"&&(c=a,a="fx",d--),arguments.length1)},removeAttr:function(a){return this.each(function(){J.removeAttr(this,a)})},prop:function(a,b){return J.access(this,J.prop,a,b,arguments.length>1)},removeProp:function(a){return a=J.propFix[a]||a,this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,f,g,h;if(J.isFunction(a))return this.each(function(b){J(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(P);for(c=0,d=this.length;c-1)return!0;return!1},val:function(a){var c,d,e,f=this[0];if(!!arguments.length)return e=J.isFunction(a),this.each(function(d){var f=J(this),g;if(this.nodeType===1){e?g=a.call(this,d,f.val()):g=a,g==null?g="":typeof g=="number"?g+="":J.isArray(g)&&(g=J.map(g,function(a){return a==null?"":a+""})),c=J.valHooks[this.type]||J.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,g,"value")===b)this.value=g}});if(f)return c=J.valHooks[f.type]||J.valHooks[f.nodeName.toLowerCase()],c&&"get"in c&&(d=c.get(f,"value"))!==b?d:(d=f.value,typeof d=="string"?d.replace(Q,""):d==null?"":d)}}),J.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,f=a.selectedIndex,g=[],h=a.options,i=a.type==="select-one";if(f<0)return null;c=i?f:0,d=i?f+1:h.length;for(;c=0}),c.length||(a.selectedIndex=-1),c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var f,g,h,i=a.nodeType;if(!!a&&i!==3&&i!==8&&i!==2){if(e&&c in J.attrFn)return J(a)[c](d);if(typeof a.getAttribute=="undefined")return J.prop(a,c,d);h=i!==1||!J.isXMLDoc(a),h&&(c=c.toLowerCase(),g=J.attrHooks[c]||(U.test(c)?X:W));if(d!==b){if(d===null){J.removeAttr(a,c);return}return g&&"set"in g&&h&&(f=g.set(a,d,c))!==b?f:(a.setAttribute(c,""+d),d)}return g&&"get"in g&&h&&(f=g.get(a,c))!==null?f:(f=a.getAttribute(c),f===null?b:f)}},removeAttr:function(a,b){var c,d,e,f,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(P),f=d.length;for(;h=0}})});var Z=/^(?:textarea|input|select)$/i,$=/^([^\.]*)?(?:\.(.+))?$/,_=/(?:^|\s)hover(\.\S+)?\b/,ba=/^key/,bb=/^(?:mouse|contextmenu)|click/,bc=/^(?:focusinfocus|focusoutblur)$/,bd=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,be=function(a){var b=bd.exec(a);return b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)")),b},bf=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},bg=function(a){return J.event.special.hover?a:a.replace(_,"mouseenter$1 mouseleave$1")};J.event={add:function(a,c,d,e,f){var g,h,i,j,k,l,m,n,o,p,q,r;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(g=J._data(a)))){d.handler&&(o=d,d=o.handler,f=o.selector),d.guid||(d.guid=J.guid++),i=g.events,i||(g.events=i={}),h=g.handle,h||(g.handle=h=function(a){return typeof J=="undefined"||!!a&&J.event.triggered===a.type?b:J.event.dispatch.apply(h.elem,arguments)},h.elem=a),c=J.trim(bg(c)).split(" ");for(j=0;j=0&&(g=g.slice(0,-1),j=!0),g.indexOf(".")>=0&&(h=g.split("."),g=h.shift(),h.sort());if((!e||J.event.customEvent[g])&&!J.event.global[g])return;c=typeof c=="object"?c[J.expando]?c:new J.Event(g,c):new J.Event(g),c.type=g,c.isTrigger=!0,c.exclusive=j,c.namespace=h.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,n=g.indexOf(":")<0?"on"+g:"";if(!e){i=J.cache;for(k in i)i[k].events&&i[k].events[g]&&J.event.trigger(c,d,i[k].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?J.makeArray(d):[],d.unshift(c),o=J.event.special[g]||{};if(o.trigger&&o.trigger.apply(e,d)===!1)return;q=[[e,o.bindType||g]];if(!f&&!o.noBubble&&!J.isWindow(e)){r=o.delegateType||g,l=bc.test(r+g)?e:e.parentNode,m=null;for(;l;l=l.parentNode)q.push([l,r]),m=l;m&&m===e.ownerDocument&&q.push([m.defaultView||m.parentWindow||a,r])}for(k=0;ke&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},J.attrFn&&(J.attrFn[b]=!0),ba.test(b)&&(J.event.fixHooks[b]=J.event.keyHooks),bb.test(b)&&(J.event.fixHooks[b]=J.event.mouseHooks)}),function(){function a(a,b,c,d,f,g){for(var h=0,i=d.length;h0){k=j;break}}j=j[a]}d[h]=k}}}function c(a,b,c,d,f,g){for(var h=0,i=d.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e="sizcache"+(Math.random()+"").replace(".",""),f=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){return i=!1,0});var m=function(a,b,c,e){c=c||[],b=b||G;var f=b;if(b.nodeType!==1&&b.nodeType!==9)return[];if(!a||typeof a!="string")return c;var h,i,j,k,l,n,q,r,t=!0,u=m.isXML(b),v=[],x=a;do{d.exec(""),h=d.exec(x);if(h){x=h[3],v.push(h[1]);if(h[2]){k=h[3];break}}}while(h);if(v.length>1&&p.exec(a))if(v.length===2&&o.relative[v[0]])i=w(v[0]+v[1],b,e);else{i=o.relative[v[0]]?[b]:m(v.shift(),b);while(v.length)a=v.shift(),o.relative[a]&&(a+=v.shift()),i=w(a,i,e)}else{!e&&v.length>1&&b.nodeType===9&&!u&&o.match.ID.test(v[0])&&!o.match.ID.test(v[v.length-1])&&(l=m.find(v.shift(),b,u),b=l.expr?m.filter(l.expr,l.set)[0]:l.set[0]);if(b){l=e?{expr:v.pop(),set:s(e)}:m.find(v.pop(),v.length!==1||v[0]!=="~"&&v[0]!=="+"||!b.parentNode?b:b.parentNode,u),i=l.expr?m.filter(l.expr,l.set):l.set,v.length>0?j=s(i):t=!1;while(v.length)n=v.pop(),q=n,o.relative[n]?q=v.pop():n="",q==null&&(q=b),o.relative[n](j,q,u)}else j=v=[]}j||(j=i),j||m.error(n||a);if(g.call(j)==="[object Array]")if(!t)c.push.apply(c,j);else if(b&&b.nodeType===1)for(r=0;j[r]!=null;r++)j[r]&&(j[r]===!0||j[r].nodeType===1&&m.contains(b,j[r]))&&c.push(i[r]);else for(r=0;j[r]!=null;r++)j[r]&&j[r].nodeType===1&&c.push(i[r]);else s(j,c);return k&&(m(k,f,c,e),m.uniqueSort(c)),c};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);return a[0]=f++,a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");return!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" "),a},PSEUDO:function(a,b,c,e,f){if(a[1]==="not")if((d.exec(a[3])||"").length>1||/^\w/.test(a[3]))a[3]=m(a[3],null,null,b);else{var g=m.filter(a[3],b,c,!0^f);return c||e.push.apply(e,g),!1}else if(o.match.POS.test(a[0])||o.match.CHILD.test(a[0]))return!0;return a},POS:function(a){return a.unshift(!0),a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){return a=Array.prototype.slice.call(a,0),b?(b.push.apply(b,a),b):a};try{Array.prototype.slice.call(G.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",d.insertBefore(a,d.firstChild),G.getElementById(c)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),d.removeChild(a),d=a=null}(),function(){var a=G.createElement("div");a.appendChild(G.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),G.querySelectorAll&&function(){var a=m,b=G.createElement("div"),c="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,d,e,f){d=d||G;if(!f&&!m.isXML(d)){var g=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(g&&(d.nodeType===1||d.nodeType===9)){if(g[1])return s(d.getElementsByTagName(b),e);if(g[2]&&o.find.CLASS&&d.getElementsByClassName)return s(d.getElementsByClassName(g[2]),e)}if(d.nodeType===9){if(b==="body"&&d.body)return s([d.body],e);if(g&&g[3]){var h=d.getElementById(g[3]);if(!h||!h.parentNode)return s([],e);if(h.id===g[3])return s([h],e)}try{return s(d.querySelectorAll(b),e)}catch(i){}}else if(d.nodeType===1&&d.nodeName.toLowerCase()!=="object"){var j=d,k=d.getAttribute("id"),l=k||c,n=d.parentNode,p=/^\s*[+~]/.test(b);k?l=l.replace(/'/g,"\\$&"):d.setAttribute("id",l),p&&n&&(d=d.parentNode);try{if(!p||n)return s(d.querySelectorAll("[id='"+l+"'] "+b),e)}catch(q){}finally{k||j.removeAttribute("id")}}}return a(b,d,e,f)};for(var d in a)m[d]=a[d];b=null}}(),function(){var a=G.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var c=!b.call(G.createElement("div"),"div"),d=!1;try{b.call(G.documentElement,"[test!='']:sizzle")}catch(e){d=!0}m.matchesSelector=function(a,e){e=e.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(d||!o.match.PSEUDO.test(e)&&!/!=/.test(e)){var f=b.call(a,e);if(f||!c||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(e,null,null,[a]).length>0}}}(),function(){var a=G.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),G.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:G.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var w=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(g=f;g=0:J.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,f=this[0];if(J.isArray(a)){var g=1;while(f&&f.ownerDocument&&f!==b){for(d=0;d-1:J.find.matchesSelector(f,a)){c.push(f);break}f=f.parentNode;if(!f||!f.ownerDocument||f===b||f.nodeType===11)break}}return c=c.length>1?J.unique(c):c,this.pushStack(c,"closest",a)},index:function(a){return a?typeof a=="string"?J.inArray(this[0],J(a)):J.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(a,b){var c=typeof a=="string"?J(a,b):J.makeArray(a&&a.nodeType?[a]:a),d=J.merge(this.get(),c);return this.pushStack(z(c[0])||z(d[0])?d:J.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),J.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return J.dir(a,"parentNode")},parentsUntil:function(a,b,c){return J.dir(a,"parentNode",c)},next:function(a){return J.nth(a,2,"nextSibling")},prev:function(a){return J.nth(a,2,"previousSibling")},nextAll:function(a){return J.dir(a,"nextSibling")},prevAll:function(a){return J.dir(a,"previousSibling")},nextUntil:function(a,b,c){return J.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return J.dir(a,"previousSibling",c)},siblings:function(a){return J.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return J.sibling(a.firstChild)},contents:function(a){return J.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:J.makeArray(a.childNodes)}},function(a,b){J.fn[a]=function(c,d){var e=J.map(this,b,c);return bh.test(a)||(d=c),d&&typeof d=="string"&&(e=J.filter(d,e)),e=this.length>1&&!bn[a]?J.unique(e):e,(this.length>1||bj.test(d))&&bi.test(a)&&(e=e.reverse()),this.pushStack(e,a,bl.call(arguments).join(","))}}),J.extend({filter:function(a,b,c){return c&&(a=":not("+a+")"),b.length===1?J.find.matchesSelector(b[0],a)?[b[0]]:[]:J.find.matches(a,b)},dir:function(a,c,d){var e=[],f=a[c];while(f&&f.nodeType!==9&&(d===b||f.nodeType!==1||!J(f).is(d)))f.nodeType===1&&e.push(f),f=f[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var bo="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",bp=/ jQuery\d+="(?:\d+|null)"/g,bq=/^\s+/,br=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,bs=/<([\w:]+)/,bt=/]","i"),by=/checked\s*(?:[^=]|=\s*.checked.)/i,bz=/\/(java|ecma)script/i,bA=/^\s*",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bC=x(G);bB.optgroup=bB.option,bB.tbody=bB.tfoot=bB.colgroup=bB.caption=bB.thead,bB.th=bB.td,J.support.htmlSerialize||(bB._default=[1,"div
","
"]),J.fn.extend({text:function(a){return J.access(this,function(a){return a===b?J.text(this):this.empty().append((this[0]&&this[0].ownerDocument||G).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(J.isFunction(a))return this.each(function(b){J(this).wrapAll(a.call(this,b))});if(this[0]){var b=J(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){return J.isFunction(a)?this.each(function(b){J(this).wrapInner(a.call(this,b))}):this.each(function(){var b=J(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=J.isFunction(a);return this.each(function(c){J(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){J.nodeName(this,"body")||J(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=J.clean(arguments);return a.push.apply(a,this.toArray()),this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);return a.push.apply(a,J.clean(arguments)),a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||J.filter(a,[d]).length)!b&&d.nodeType===1&&(J.cleanData(d.getElementsByTagName("*")),J.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&J.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){return a=a==null?!1:a,b=b==null?a:b,this.map(function(){return J.clone(this,a,b)})},html:function(a){return J.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(bp,""):null;if(typeof a=="string"&&!bv.test(a)&&(J.support.leadingWhitespace||!bq.test(a))&&!bB[(bs.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(br,"<$1>");try{for(;d1&&k0?this.clone(!0):this).get();J(e[g])[b](i),d=d.concat(i)}return this.pushStack(d,a,e.selector)}}),J.extend({clone:function(a,b,c){var d,e,f,g=J.support.html5Clone||J.isXMLDoc(a)||!bx.test("<"+a.nodeName+">")?a.cloneNode(!0):q(a);if((!J.support.noCloneEvent||!J.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!J.isXMLDoc(a)){u(a,g),d=t(a),e=t(g);for(f=0;d[f];++f)e[f]&&u(d[f],e[f])}if(b){v(a,g);if(c){d=t(a),e=t(g);for(f=0;d[f];++f)v(d[f],e[f])}}return d=e=null,g},clean:function(a,b,c,d){var e,f,g,h=[];b=b||G,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||G);for(var i=0,j;(j=a[i])!=null;i++){typeof j=="number"&&(j+="");if(!j)continue;if(typeof j=="string")if(!bu.test(j))j=b.createTextNode(j);else{j=j.replace(br,"<$1>");var k=(bs.exec(j)||["",""])[1].toLowerCase(),l=bB[k]||bB._default,m=l[0],n=b.createElement("div"),o=bC.childNodes,p;b===G?bC.appendChild(n):x(b).appendChild(n),n.innerHTML=l[1]+j+l[2];while(m--)n=n.lastChild;if(!J.support.tbody){var q=bt.test(j),s=k==="table"&&!q?n.firstChild&&n.firstChild.childNodes:l[1]===""&&!q?n.childNodes:[];for(g=s.length-1;g>=0;--g)J.nodeName(s[g],"tbody")&&!s[g].childNodes.length&&s[g].parentNode.removeChild(s[g])}!J.support.leadingWhitespace&&bq.test(j)&&n.insertBefore(b.createTextNode(bq.exec(j)[0]),n.firstChild),j=n.childNodes,n&&(n.parentNode.removeChild(n),o.length>0&&(p=o[o.length-1],p&&p.parentNode&&p.parentNode.removeChild(p)))}var t;if(!J.support.appendChecked)if(j[0]&&typeof (t=j.length)=="number")for(g=0;g1)},J.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bM(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":J.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var f,g,h=J.camelCase(c),i=a.style,j=J.cssHooks[h];c=J.cssProps[h]||h;if(d===b)return j&&"get"in j&&(f=j.get(a,!1,e))!==b?f:i[c];g=typeof d,g==="string"&&(f=bI.exec(d))&&(d=+(f[1]+1)*+f[2]+parseFloat(J.css(a,c)),g="number");if(d==null||g==="number"&&isNaN(d))return;g==="number"&&!J.cssNumber[h]&&(d+="px");if(!j||!("set"in j)||(d=j.set(a,d))!==b)try{i[c]=d}catch(k){}}},css:function(a,c,d){var e,f;c=J.camelCase(c),f=J.cssHooks[c],c=J.cssProps[c]||c,c==="cssFloat"&&(c="float");if(f&&"get"in f&&(e=f.get(a,!0,d))!==b)return e;if(bM)return bM(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),J.curCSS=J.css,G.defaultView&&G.defaultView.getComputedStyle&&(bN=function(a,b){var c,d,e,f,g=a.style;return b=b.replace(bF,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!J.contains(a.ownerDocument.documentElement,a)&&(c=J.style(a,b))),!J.support.pixelMargin&&e&&bJ.test(b)&&bH.test(c)&&(f=g.width,g.width=c,c=e.width,g.width=f),c}),G.documentElement.currentStyle&&(bO=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;return f==null&&g&&(e=g[b])&&(f=e),bH.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d)),f===""?"auto":f}),bM=bN||bO,J.each(["height","width"],function(a,b){J.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?p(a,b,d):J.swap(a,bK,function(){return p(a,b,d)})},set:function(a,b){return bG.test(b)?b+"px":b}}}),J.support.opacity||(J.cssHooks.opacity={get:function(a,b){return bE.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=J.isNumeric(b)?"alpha(opacity="+b*100+")":"",f=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&J.trim(f.replace(bD,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bD.test(f)?f.replace(bD,e):f+" "+e}}),J(function(){J.support.reliableMarginRight||(J.cssHooks.marginRight={get:function(a,b){return J.swap(a,{display:"inline-block"},function(){return b?bM(a,"margin-right"):a.style.marginRight})}})}),J.expr&&J.expr.filters&&(J.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!J.support.reliableHiddenOffsets&&(a.style&&a.style.display||J.css(a,"display"))==="none"},J.expr.filters.visible=function(a){return!J.expr.filters.hidden(a)}),J.each({margin:"",padding:"",border:"Width"},function(a,b){J.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bL[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bP=/%20/g,bQ=/\[\]$/,bR=/\r?\n/g,bS=/#.*$/,bT=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bU=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bV=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bW=/^(?:GET|HEAD)$/,bX=/^\/\//,bY=/\?/,bZ=/)<[^<]*)*<\/script>/gi,b$=/^(?:select|textarea)/i,b_=/\s+/,ca=/([?&])_=[^&]*/,cb=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,cc=J.fn.load,cd={},ce={},cf,cg,ch=["*/"]+["*"];try{cf=I.href}catch(ci){cf=G.createElement("a"),cf.href="",cf=cf.href}cg=cb.exec(cf.toLowerCase())||[],J.fn.extend({load:function(a,c,d){if(typeof a!="string"&&cc)return cc.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}var g="GET";c&&(J.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=J.param(c,J.ajaxSettings.traditional),g="POST"));var h=this;return J.ajax({url:a,type:g,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),h.html(f?J("
").append(c.replace(bZ,"")).find(f):c)),d&&h.each(d,[c,b,a])}}),this},serialize:function(){return J.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?J.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||b$.test(this.nodeName)||bU.test(this.type))}).map(function(a,b){var c=J(this).val();return c==null?null:J.isArray(c)?J.map(c,function(a,c){return{name:b.name,value:a.replace(bR,"\r\n")}}):{name:b.name,value:c.replace(bR,"\r\n")}}).get()}}),J.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){J.fn[b]=function(a){return this.on(b,a)}}),J.each(["get","post"],function(a,c){J[c]=function(a,d,e,f){return J.isFunction(d)&&(f=f||e,e=d,d=b),J.ajax({type:c,url:a,data:d,success:e,dataType:f})}}),J.extend({getScript:function(a,c){return J.get(a,b,c,"script")},getJSON:function(a,b,c){return J.get(a,b,c,"json")},ajaxSetup:function(a,b){return b?m(a,J.ajaxSettings):(b=a,a=J.ajaxSettings),m(a,b),a},ajaxSettings:{url:cf,isLocal:bV.test(cg[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":ch},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":J.parseJSON,"text xml":J.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:o(cd),ajaxTransport:o(ce),ajax:function(a,c){function d(a,c,d,n){if(v!==2){v=2,t&&clearTimeout(t),s=b,q=n||"",y.readyState=a>0?4:0;var o,p,r,u=c,x=d?k(e,y,d):b,z,A;if(a>=200&&a<300||a===304){if(e.ifModified){if(z=y.getResponseHeader("Last-Modified"))J.lastModified[m]=z;if(A=y.getResponseHeader("Etag"))J.etag[m]=A}if(a===304)u="notmodified",o=!0;else try{p=j(e,x),u="success",o=!0}catch(B){u="parsererror",r=B}}else{r=u;if(!u||a)u="error",a<0&&(a=0)}y.status=a,y.statusText=""+(c||u),o?h.resolveWith(f,[p,u,y]):h.rejectWith(f,[y,u,r]),y.statusCode(l),l=b,w&&g.trigger("ajax"+(o?"Success":"Error"),[y,e,o?p:r]),i.fireWith(f,[y,u]),w&&(g.trigger("ajaxComplete",[y,e]),--J.active||J.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var e=J.ajaxSetup({},c),f=e.context||e,g=f!==e&&(f.nodeType||f instanceof J)?J(f):J.event,h=J.Deferred(),i=J.Callbacks("once memory"),l=e.statusCode||{},m,o={},p={},q,r,s,t,u,v=0,w,x,y={readyState:0,setRequestHeader:function(a,b){if(!v){var c=a.toLowerCase();a=p[c]=p[c]||a,o[a]=b}return this},getAllResponseHeaders:function(){return v===2?q:null},getResponseHeader:function(a){var c;if(v===2){if(!r){r={};while(c=bT.exec(q))r[c[1].toLowerCase()]=c[2]}c=r[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){return v||(e.mimeType=a),this},abort:function(a){return a=a||"abort",s&&s.abort(a),d(0,a),this}};h.promise(y),y.success=y.done,y.error=y.fail,y.complete=i.add,y.statusCode=function(a){if(a){var b;if(v<2)for(b in a)l[b]=[l[b],a[b]];else b=a[y.status],y.then(b,b)}return this},e.url=((a||e.url)+"").replace(bS,"").replace(bX,cg[1]+"//"),e.dataTypes=J.trim(e.dataType||"*").toLowerCase().split(b_),e.crossDomain==null&&(u=cb.exec(e.url.toLowerCase()),e.crossDomain=!(!u||u[1]==cg[1]&&u[2]==cg[2]&&(u[3]||(u[1]==="http:"?80:443))==(cg[3]||(cg[1]==="http:"?80:443)))),e.data&&e.processData&&typeof e.data!="string"&&(e.data=J.param(e.data,e.traditional)),n(cd,e,c,y);if(v===2)return!1;w=e.global,e.type=e.type.toUpperCase(),e.hasContent=!bW.test(e.type),w&&J.active++===0&&J.event.trigger("ajaxStart");if(!e.hasContent){e.data&&(e.url+=(bY.test(e.url)?"&":"?")+e.data,delete e.data),m=e.url;if(e.cache===!1){var z=J.now(),A=e.url.replace(ca,"$1_="+z);e.url=A+(A===e.url?(bY.test(e.url)?"&":"?")+"_="+z:"")}}(e.data&&e.hasContent&&e.contentType!==!1||c.contentType)&&y.setRequestHeader("Content-Type",e.contentType),e.ifModified&&(m=m||e.url,J.lastModified[m]&&y.setRequestHeader("If-Modified-Since",J.lastModified[m]),J.etag[m]&&y.setRequestHeader("If-None-Match",J.etag[m])),y.setRequestHeader("Accept",e.dataTypes[0]&&e.accepts[e.dataTypes[0]]?e.accepts[e.dataTypes[0]]+(e.dataTypes[0]!=="*"?", "+ch+"; q=0.01":""):e.accepts["*"]);for(x in e.headers)y.setRequestHeader(x,e.headers[x]);if(!e.beforeSend||e.beforeSend.call(f,y,e)!==!1&&v!==2){for(x in{success:1,error:1,complete:1})y[x](e[x]);s=n(ce,e,c,y);if(!s)d(-1,"No Transport");else{y.readyState=1,w&&g.trigger("ajaxSend",[y,e]),e.async&&e.timeout>0&&(t=setTimeout(function(){y.abort("timeout")},e.timeout));try{v=1,s.send(o,d)}catch(B){if(v<2)d(-1,B);else throw B}}return y}return y.abort(),!1},param:function(a,c){var d=[],e=function(a,b){b=J.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=J.ajaxSettings.traditional);if(J.isArray(a)||a.jquery&&!J.isPlainObject(a))J.each(a,function(){e(this.name,this.value)});else for(var f in a)l(f,a[f],c,e);return d.join("&").replace(bP,"+")}}),J.extend({active:0,lastModified:{},etag:{}});var cj=J.now(),ck=/(\=)\?(&|$)|\?\?/i;J.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return J.expando+"_"+cj++}}),J.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ck.test(b.url)||e&&ck.test(b.data))){var f,g=b.jsonpCallback=J.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h=a[g],i=b.url,j=b.data,k="$1"+g+"$2";return b.jsonp!==!1&&(i=i.replace(ck,k),b.url===i&&(e&&(j=j.replace(ck,k)),b.data===j&&(i+=(/\?/.test(i)?"&":"?")+b.jsonp+"="+g))),b.url=i,b.data=j,a[g]=function(a){f=[a]},d.always(function(){a[g]=h,f&&J.isFunction(h)&&a[g](f[0])}),b.converters["script json"]=function(){return f||J.error(g+" was not called"),f[0]},b.dataTypes[0]="json","script"}}),J.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){return J.globalEval(a),a}}}),J.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),J.ajaxTransport("script",function(a){if(a.crossDomain){var c,d=G.head||G.getElementsByTagName("head")[0]||G.documentElement;return{send:function(e,f){c=G.createElement("script"),c.async="async",a.scriptCharset&&(c.charset=a.scriptCharset),c.src=a.url,c.onload=c.onreadystatechange=function(a,e){if(e||!c.readyState||/loaded|complete/.test(c.readyState))c.onload=c.onreadystatechange=null,d&&c.parentNode&&d.removeChild(c),c=b,e||f(200,"success")},d.insertBefore(c,d.firstChild)},abort:function(){c&&c.onload(0,1)}}}});var cl=a.ActiveXObject?function(){for(var a in cn)cn[a](0,1)}:!1,cm=0,cn;J.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&i()||h()}:i,function(a){J.extend(J.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(J.ajaxSettings.xhr()),J.support.ajax&&J.ajaxTransport(function(c){if(!c.crossDomain||J.support.cors){var d;return{send:function(e,f){var g=c.xhr(),h,i;c.username?g.open(c.type,c.url,c.async,c.username,c.password):g.open(c.type,c.url,c.async);if(c.xhrFields)for(i in c.xhrFields)g[i]=c.xhrFields[i];c.mimeType&&g.overrideMimeType&&g.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(i in e)g.setRequestHeader(i,e[i])}catch(j){}g.send(c.hasContent&&c.data||null),d=function(a,e){var i,j,k,l,m;try{if(d&&(e||g.readyState===4)){d=b,h&&(g.onreadystatechange=J.noop,cl&&delete cn[h]);if(e)g.readyState!==4&&g.abort();else{i=g.status,k=g.getAllResponseHeaders(),l={},m=g.responseXML,m&&m.documentElement&&(l.xml=m);try{l.text=g.responseText}catch(a){}try{j=g.statusText}catch(n){j=""}!i&&c.isLocal&&!c.crossDomain?i=l.text?200:404:i===1223&&(i=204)}}}catch(o){e||f(-1,o)}l&&f(i,j,l,k)},!c.async||g.readyState===4?d():(h=++cm,cl&&(cn||(cn={},J(a).unload(cl)),cn[h]=d),g.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var co={},cp,cq,cr=/^(?:toggle|show|hide)$/,cs=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,ct,cu=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cv;J.fn.extend({show:function(a,b,c){var f,g;if(a||a===0)return this.animate(e("show",3),a,b,c);for(var h=0,i=this.length;h=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(f=!1);if(f){i.overflow!=null&&!J.support.shrinkWrapBlocks&&J.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&J(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)J.style(h,b,i.orig[b]),J.removeData(h,"fxshow"+b,!0),J.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}return i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=J.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update(),!0}},J.extend(J.fx,{tick:function(){var a,b=J.timers,c=0;for(;c-1,j={},k={},l,m;i?(k=e.position(),l=k.top,m=k.left):(l=parseFloat(g)||0,m=parseFloat(h)||0),J.isFunction(b)&&(b=b.call(a,c,f)),b.top!=null&&(j.top=b.top-f.top+l),b.left!=null&&(j.left=b.left-f.left+m),"using"in b?b.using.call(a,j):e.css(j)}},J.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cy.test(b[0].nodeName)?{top:0,left:0}:b.offset();return c.top-=parseFloat(J.css(a,"marginTop"))||0,c.left-=parseFloat(J.css(a,"marginLeft"))||0,d.top+=parseFloat(J.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(J.css(b[0],"borderLeftWidth"))||0,{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||G.body;while(a&&!cy.test(a.nodeName)&&J.css(a,"position")==="static")a=a.offsetParent;return a})}}),J.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,d){var e=/Y/.test(d);J.fn[a]=function(f){return J.access(this,function(a,f,g){var h=c(a);if(g===b)return h?d in h?h[d]:J.support.boxModel&&h.document.documentElement[f]||h.document.body[f]:a[f];h?h.scrollTo(e?J(h).scrollLeft():g,e?g:J(h).scrollTop()):a[f]=g},a,f,arguments.length,null)}}),J.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,f="offset"+a;J.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(J.css(a,c,"padding")):this[c]():null},J.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(J.css(b,c,a?"margin":"border")):this[c]():null},J.fn[c]=function(a){return J.access(this,function(a,c,g){var h,i,j,k;if(J.isWindow(a))return h=a.document,i=h.documentElement[d],J.support.boxModel&&i||h.body&&h.body[d]||i;if(a.nodeType===9)return h=a.documentElement,h[d]>=h[e]?h[d]:Math.max(a.body[e],h[e],a.body[f],h[f]);if(g===b)return j=J.css(a,c),k=parseFloat(j),J.isNumeric(k)?k:j;J(a).css(c,g)},c,a,arguments.length,null)}}),a.jQuery=a.$=J,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return J})})(window);var Photon={version:"0.0.3",degToRad:function(a){return a*Math.PI/180},radToDeg:function(a){return a*180/Math.PI},getRotationVector:function(a,b){var c=a.rotate(b.x,Line.create([0,0,0],[1,0,0])),d=c.rotate(b.y,Line.create([0,0,0],[0,1,0])),e=d.rotate(b.z,Line.create([0,0,0],[0,0,1]));return e},getTransformString:function(){if(Photon.transformString)return Photon.transformString;var a,b=["transform","webkitTransform","MozTransform","msTransform","OTransform"],c=document.createElement("div");for(var d=0;d.5&&(f=1-f);var g=Math.abs(this.maxShade+this.maxTint),h=g*f;this.rangedPercentage=h,h<=this.maxTint?e="rgba(255, 255, 255, "+Math.abs(this.maxTint-h)+")":e="rgba(0, 0, 0, "+Math.abs(h-this.maxTint)+")",this.shaderElement.style.background=e},setMaxShade:function(a){this.maxShade=a},setMaxTint:function(a){this.maxTint=a}},Photon.ShaderElement=function(a){var b=document.createElement("div");return b.className="photon-shader",b.style.position="absolute",b.style.top="0",b.style.left="0",b.style.width=window.getComputedStyle(a).width,b.style.height=window.getComputedStyle(a).height,b},Photon.FaceGroup=function(a,b,c,d,e){this.element=a,this.faces=[],this.transformString=Photon.getTransformString();var f=b;for(var g=0;g1&&(i=1),Math.acos(i)},dot:function(a){var b=a.elements||a,c,d=0,e=this.elements.length;if(e!=b.length)return null;do d+=this.elements[e-1]*b[e-1];while(--e);return d},rotate:function(a,b){var c,d,e,f,g;switch(this.elements.length){case 2:c=b.elements||b;if(c.length!=2)return null;return d=Matrix.Rotation(a).elements,e=this.elements[0]-c[0],f=this.elements[1]-c[1],Vector.create([c[0]+d[0][0]*e+d[0][1]*f,c[1]+d[1][0]*e+d[1][1]*f]);case 3:if(!b.direction)return null;var h=b.pointClosestTo(this).elements;return d=Matrix.Rotation(a,b.direction).elements,e=this.elements[0]-h[0],f=this.elements[1]-h[1],g=this.elements[2]-h[2],Vector.create([h[0]+d[0][0]*e+d[0][1]*f+d[0][2]*g,h[1]+d[1][0]*e+d[1][1]*f+d[1][2]*g,h[2]+d[2][0]*e+d[2][1]*f+d[2][2]*g]);default:return null}},setElements:function(a){return this.elements=(a.elements||a).slice(),this}},Vector.create=function(a){var b=new Vector;return b.setElements(a)};var $V=Vector.create;Line.prototype={distanceFrom:function(a){if(a.normal)return a.distanceFrom(this);if(a.direction){if(this.isParallelTo(a))return this.distanceFrom(a.anchor);var b=this.direction.cross(a.direction).toUnitVector().elements,c=this.anchor.elements,d=a.anchor.elements;return Math.abs((c[0]-d[0])*b[0]+(c[1]-d[1])*b[1]+(c[2]-d[2])*b[2])}var e=a.elements||a,c=this.anchor.elements,f=this.direction.elements,g=e[0]-c[0],h=e[1]-c[1],i=(e[2]||0)-c[2],j=Math.sqrt(g*g+h*h+i*i);if(j===0)return 0;var k=(g*f[0]+h*f[1]+i*f[2])/j,l=1-k*k;return Math.abs(j*Math.sqrt(l<0?0:l))},contains:function(a){var b=this.distanceFrom(a);return b!==null&&b<=Sylvester.precision},pointClosestTo:function(a){if(a.direction){if(this.intersects(a))return this.intersectionWith(a);if(this.isParallelTo(a))return null;var b=this.direction.elements,c=a.direction.elements,d=b[0],e=b[1],f=b[2],g=c[0],h=c[1],i=c[2],j=f*g-d*i,k=d*h-e*g,l=e*i-f*h,m=Vector.create([j*i-k*h,k*g-l*i,l*h-j*g]),n=Plane.create(a.anchor,m);return n.intersectionWith(this)}var n=a.elements||a;if(this.contains(n))return Vector.create(n);var o=this.anchor.elements,b=this.direction.elements,d=b[0],e=b[1],f=b[2],p=o[0],q=o[1],r=o[2],j=d*(n[1]-q)-e*(n[0]-p),k=e*((n[2]||0)-r)-f*(n[1]-q),l=f*(n[0]-p)-d*((n[2]||0)-r),s=Vector.create([e*j-f*l,f*k-d*j,d*l-e*k]),t=this.distanceFrom(n)/s.modulus();return Vector.create([n[0]+s.elements[0]*t,n[1]+s.elements[1]*t,(n[2]||0)+s.elements[2]*t])},rotate:function(a,b){typeof b.direction=="undefined"&&(b=Line.create(b.to3D(),Vector.k));var c=Matrix.Rotation(a,b.direction).elements,d=b.pointClosestTo(this.anchor).elements,e=this.anchor.elements,f=this.direction.elements,g=d[0],h=d[1],i=d[2],j=e[0],k=e[1],l=e[2],m=j-g,n=k-h,o=l-i;return Line.create([g+c[0][0]*m+c[0][1]*n+c[0][2]*o,h+c[1][0]*m+c[1][1]*n+c[1][2]*o,i+c[2][0]*m+c[2][1]*n+c[2][2]*o],[c[0][0]*f[0]+c[0][1]*f[1]+c[0][2]*f[2],c[1][0]*f[0]+c[1][1]*f[1]+c[1][2]*f[2],c[2][0]*f[0]+c[2][1]*f[1]+c[2][2]*f[2]])},setVectors:function(a,b){a=Vector.create(a),b=Vector.create(b),a.elements.length==2&&a.elements.push(0),b.elements.length==2&&b.elements.push(0);if(a.elements.length>3||b.elements.length>3)return null;var c=b.modulus();return c===0?null:(this.anchor=a,this.direction=Vector.create([b.elements[0]/c,b.elements[1]/c,b.elements[2]/c]),this)}},Line.create=function(a,b){var c=new Line;return c.setVectors(a,b)},Matrix.prototype={setElements:function(a){var b,c=a.elements||a;if(typeof c[0][0]!="undefined"){var d=c.length,e=d,f,g,h;this.elements=[];do{b=e-d,f=c[b].length,g=f,this.elements[b]=[];do h=g-f,this.elements[b][h]=c[b][h];while(--f)}while(--d);return this}var i=c.length,j=i;this.elements=[];do b=j-i,this.elements.push([c[b]]);while(--i);return this}},Matrix.create=function(a){var b=new Matrix;return b.setElements(a)},Matrix.Rotation=function(a,b){if(!b)return Matrix.create([[Math.cos(a),-Math.sin(a)],[Math.sin(a),Math.cos(a)]]);var c=b.dup();if(c.elements.length!=3)return null;var d=c.modulus(),e=c.elements[0]/d,f=c.elements[1]/d,g=c.elements[2]/d,h=Math.sin(a),i=Math.cos(a),j=1-i;return Matrix.create([[j*e*e+i,j*e*f-h*g,j*e*g+h*f],[j*e*f+h*g,j*f*f+i,j*f*g-h*e],[j*e*g-h*f,j*f*g+h*e,j*g*g+i]])},FirminCSSMatrix=function(a){this.m11=this.m22=this.m33=this.m44=1,this.m12=this.m13=this.m14=this.m21=this.m23=this.m24=this.m31=this.m32=this.m34=this.m41=this.m42=this.m43=0,typeof a=="string"&&this.setMatrixValue(a)},FirminCSSMatrix.displayName="FirminCSSMatrix",FirminCSSMatrix.degreesToRadians=function(a){return a*Math.PI/180},FirminCSSMatrix.prototype.isAffine=function(){return this.m13===0&&this.m14===0&&this.m23===0&&this.m24===0&&this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m43===0&&this.m44===1},FirminCSSMatrix.prototype.setMatrixValue=function(a){a=a.trim();var b=a.match(/^matrix(3d)?\(\s*(.+)\s*\)$/),c,d,e,f,g,h;if(!b)return;c=!!b[1],d=b[2].split(/\s*,\s*/),e=d.length,f=new Array(e);if(c&&e!==16||!c&&e!==6)return;for(g=0;g-1&&(H.w|=t.KSIDE_CASTLE),e[2].indexOf("Q")>-1&&(H.w|=t.QSIDE_CASTLE),e[2].indexOf("k")>-1&&(H.b|=t.KSIDE_CASTLE),e[2].indexOf("q")>-1&&(H.b|=t.QSIDE_CASTLE),I=e[3]=="-"?d:C[e[3]],J=parseInt(e[4],10),K=parseInt(e[5],10),T(R()),!0}function Q(a){var b={0:"No errors.",1:"FEN string must contain six space-delimited fields.",2:"6th field (move number) must be a positive integer.",3:"5th field (half move counter) must be a non-negative integer.",4:"4th field (en-passant square) is invalid.",5:"3rd field (castling availability) is invalid.",6:"2nd field (side to move) is invalid.",7:"1st field (piece positions) does not contain 8 '/'-delimited rows.",8:"1st field (piece positions) is invalid [consecutive numbers].",9:"1st field (piece positions) is invalid [invalid piece].",10:"1st field (piece positions) is invalid [row too large]."},c=a.split(/\s+/);if(c.length!=6)return{valid:!1,error_number:1,error:b[1]};if(isNaN(c[5])||parseInt(c[5],10)<=0)return{valid:!1,error_number:2,error:b[2]};if(isNaN(c[4])||parseInt(c[4],10)<0)return{valid:!1,error_number:3,error:b[3]};if(!/^(-|[abcdefgh][36])$/.test(c[3]))return{valid:!1,error_number:4,error:b[4]};if(!/^(KQ?k?q?|Qk?q?|kq?|q|-)$/.test(c[2]))return{valid:!1,error_number:5,error:b[5]};if(!/^(w|b)$/.test(c[1]))return{valid:!1,error_number:6,error:b[6]};var d=c[0].split("/");if(d.length!=8)return{valid:!1,error_number:7,error:b[7]};for(var e=0;e0&&(e+=a,a=0);var g=E[f].color,h=E[f].type;e+=g==c?h.toUpperCase():h.toLowerCase()}f+1&136&&(a>0&&(e+=a),f!=C.h1&&(e+="/"),a=0,f+=8)}var i="";H[c]&t.KSIDE_CASTLE&&(i+="K"),H[c]&t.QSIDE_CASTLE&&(i+="Q"),H[b]&t.KSIDE_CASTLE&&(i+="k"),H[b]&t.QSIDE_CASTLE&&(i+="q"),i=i||"-";var j=I==d?"-":bl(I);return[e,G,i,j,J,K].join(" ")}function S(a){for(var b=0;b0)return;a!=l?(M.SetUp=a,M.FEN="1"):(delete M.SetUp,delete M.FEN)}function U(a){var b=E[C[a]];return b?{type:b.type,color:b.color}:null}function V(a,b){if("type"in a&&"color"in a){if(k.indexOf(a.type.toLowerCase())==-1)return!1;if(b in C){var c=C[b];return E[c]={type:a.type,color:a.color},a.type==j&&(F[a.color]=c),T(R()),!0}return!1}return!1}function W(a){var b=U(a);return E[C[a]]=null,b&&b.type==j&&(F[b.color]=d),T(R()),b}function X(a){function b(a,b,c,d,j){if(a[c].type!=e||bj(d)!=B&&bj(d)!=u){var o={color:G,from:c,to:d,flags:j,piece:a[c].type};a[d]&&(o.captured=a[d].type),b.push(o)}else{var k=[i,h,g,f];for(var l=0,m=k.length;l0){if(g.color==c)return!0}else if(g.color==b)return!0;continue}if(g.type=="n"||g.type=="k")return!0;var j=q[i],k=f+j,l=!1;while(k!=d){if(E[k]!=null){l=!0;break}k+=j}if(!l)return!0}}return!1}function $(a){return Z(bm(a),F[a])}function _(){return $(G)}function ba(){return _()&&X().length==0}function bb(){return!_()&&X().length==0}function bc(){var a={},b=0;for(var c=C.a8;c<=C.h1;c++){if(c&136){c+=7;continue}var d=E[c];d&&(a[d.type]=d.type in a?a[d.type]+1:1,b++)}return b==2?!0:b!=3||a[g]!=1&&a[f]!=1?!1:!0}function bd(){var a=[],b={},c=!1;for(;;){var d=bg();if(!d)break;a.push(d)}for(;;){var e=R().split(" ").slice(0,4).join(" ");b[e]=e in b?b[e]+1:1,b[e]>=3&&(c=!0);if(!a.length)break;bf(a.pop())}return c}function be(a){L.push({move:a,kings:{b:F.b,w:F.w},turn:G,castling:{b:H.b,w:H.w},ep_square:I,half_moves:J,move_number:K})}function bf(a){var c=G,f=bm(c);be(a),E[a.to]=E[a.from],E[a.from]=null,a.flags&t.EP_CAPTURE&&(G==b?E[a.to-16]=null:E[a.to+16]=null),a.flags&t.PROMOTION&&(E[a.to]={type:a.promotion,color:c});if(E[a.to].type==j){F[E[a.to].color]=a.to;if(a.flags&t.KSIDE_CASTLE){var g=a.to-1,h=a.to+1;E[g]=E[h],E[h]=null}else if(a.flags&t.QSIDE_CASTLE){var g=a.to+1,h=a.to-2;E[g]=E[h],E[h]=null}H[G]=""}if(H[G]!="")for(var i=0,k=D[G].length;i0?g>0&&h>0?bl(c):h>0?bl(c).charAt(1):bl(c).charAt(0):""}function bi(){var a=" +------------------------+\n";for(var b=C.a8;b<=C.h1;b++){bk(b)==0&&(a+=" "+"87654321"[bj(b)]+" |");if(E[b]==null)a+=" . ";else{var d=E[b].type,e=E[b].color,f=e==c?d.toUpperCase():d.toLowerCase();a+=" "+f+" "}b+1&136&&(a+="|\n",b+=8)}return a+=" +------------------------+\n",a+=" a b c d e f g h\n",a}function bj(a){return a>>4}function bk(a){return a&15}function bl(a){var b=bk(a),c=bj(a);return"abcdefgh".substring(b,b+1)+"87654321".substring(c,c+1)}function bm(a){return a==c?b:c}function bn(a){return"0123456789".indexOf(a)!=-1}function bo(a){var b=bp(a);b.san=Y(b),b.to=bl(b.to),b.from=bl(b.from);var c="";for(var d in t)t[d]&b.flags&&(c+=s[d]);return b.flags=c,b}function bp(a){var b=a instanceof Array?[]:{};for(var c in a)typeof c=="object"?b[c]=bp(a[c]):b[c]=a[c];return b}function bq(a){return a.replace(/^\s+|\s+$/g,"")}function br(a){var b=X({legal:!1}),c=0,d=G;for(var e=0,f=b.length;e0){var g=br(a-1);c+=g}else c++;bg()}return c}var b="b",c="w",d=-1,e="p",f="n",g="b",h="r",i="q",j="k",k="pnbrqkPNBRQK",l="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",m=["1-0","0-1","1/2-1/2","*"],n={b:[16,32,17,15],w:[-16,-32,-17,-15]},o={n:[-18,-33,-31,-14,18,33,31,14],b:[-17,-15,17,15],r:[-16,1,16,-1],q:[-17,-16,-15,1,17,16,15,-1],k:[-17,-16,-15,1,17,16,15,-1]},p=[20,0,0,0,0,0,0,24,0,0,0,0,0,0,20,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,24,24,24,24,24,24,56,0,56,24,24,24,24,24,24,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,20,0,0,0,0,0,0,24,0,0,0,0,0,0,20],q=[17,0,0,0,0,0,0,16,0,0,0,0,0,0,15,0,0,17,0,0,0,0,0,16,0,0,0,0,0,15,0,0,0,0,17,0,0,0,0,16,0,0,0,0,15,0,0,0,0,0,0,17,0,0,0,16,0,0,0,15,0,0,0,0,0,0,0,0,17,0,0,16,0,0,15,0,0,0,0,0,0,0,0,0,0,17,0,16,0,15,0,0,0,0,0,0,0,0,0,0,0,0,17,16,15,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,-15,-16,-17,0,0,0,0,0,0,0,0,0,0,0,0,-15,0,-16,0,-17,0,0,0,0,0,0,0,0,0,0,-15,0,0,-16,0,0,-17,0,0,0,0,0,0,0,0,-15,0,0,0,-16,0,0,0,-17,0,0,0,0,0,0,-15,0,0,0,0,-16,0,0,0,0,-17,0,0,0,0,-15,0,0,0,0,0,-16,0,0,0,0,0,-17,0,0,-15,0,0,0,0,0,0,-16,0,0,0,0,0,0,-17],r={p:0,n:1,b:2,r:3,q:4,k:5},s={NORMAL:"n",CAPTURE:"c",BIG_PAWN:"b",EP_CAPTURE:"e",PROMOTION:"p",KSIDE_CASTLE:"k",QSIDE_CASTLE:"q"},t={NORMAL:1,CAPTURE:2,BIG_PAWN:4,EP_CAPTURE:8,PROMOTION:16,KSIDE_CASTLE:32,QSIDE_CASTLE:64},u=7,v=6,w=5,x=4,y=3,z=2,A=1,B=0,C={a8:0,b8:1,c8:2,d8:3,e8:4,f8:5,g8:6,h8:7,a7:16,b7:17,c7:18,d7:19,e7:20,f7:21,g7:22,h7:23,a6:32,b6:33,c6:34,d6:35,e6:36,f6:37,g6:38,h6:39,a5:48,b5:49,c5:50,d5:51,e5:52,f5:53,g5:54,h5:55,a4:64,b4:65,c4:66,d4:67,e4:68,f4:69,g4:70,h4:71,a3:80,b3:81,c3:82,d3:83,e3:84,f3:85,g3:86,h3:87,a2:96,b2:97,c2:98,d2:99,e2:100,f2:101,g2:102,h2:103,a1:112,b1:113,c1:114,d1:115,e1:116,f1:117,g1:118,h1:119},D={w:[{square:C.a1,flag:t.QSIDE_CASTLE},{square:C.h1,flag:t.KSIDE_CASTLE}],b:[{square:C.a8,flag:t.QSIDE_CASTLE},{square:C.h8,flag:t.KSIDE_CASTLE}]},E=new Array(128),F={w:d,b:d},G=c,H={w:0,b:0},I=d,J=0,K=1,L=[],M={};return typeof a=="undefined"?P(l):P(a),{WHITE:c,BLACK:b,PAWN:e,KNIGHT:f,BISHOP:g,ROOK:h,QUEEN:i,KING:j,SQUARES:function(){var a=[];for(var b=C.a8;b<=C.h1;b++){if(b&136){b+=7;continue}a.push(bl(b))}return a}(),FLAGS:s,load:function(a){return P(a)},reset:function(){return O()},moves:function(a){var b;typeof a=="undefined"||typeof a.target=="undefined"?b=X():b=X({target:a.target});var c=[];for(var d=0,e=b.length;d=100||bb()||bc()||bd()},insufficient_material:function(){return bc()},in_threefold_repetition:function(){return bd()},game_over:function(){return J>=100||ba()||bb()||bc()||bd()},validate_fen:function(a){return Q(a)},fen:function(){return R()},pgn:function(a){var b=typeof a=="object"&&typeof a.newline_char=="string"?a.newline_char:"\n",c=typeof a=="object"&&typeof a.max_width=="number"?a.max_width:0,d=[],e=!1;for(var f in M)d.push("["+f+' "'+M[f]+'"]'+b),e=!0;e&&L.length&&d.push(b);var g=[];while(L.length>0)g.push(bg());var h=[],i="",j=1;while(g.length>0){var k=g.pop();j==1&&k.color=="b"?(i="1. ...",j++):k.color=="w"&&(i.length&&h.push(i),i=j+".",j++),i=i+" "+Y(k),bf(k)}i.length&&h.push(i),typeof M.Result!="undefined"&&h.push(M.Result);if(c==0)return d.join("")+h.join(" ");var l=0;for(var f=0;fc&&f!=0?(d[d.length-1]==" "&&d.pop(),d.push(b),l=0):f!=0&&(d.push(" "),l++),d.push(h[f]),l+=h[f].length;return d.join("")},load_pgn:function(a,b){function c(a){return a.replace(/\n/g,"\\n")}function d(a){var b=X();for(var c=0,d=b.length;c0&&(d[f]=g);return d}var h=typeof b=="object"&&typeof b.newline_char=="string"?b.newline_char:"\n",i=new RegExp("^(\\[(.|"+c(h)+")*\\])"+"("+c(h)+")*"+"1.("+c(h)+"|.)*$","g"),j=a.replace(i,"$1");j[0]!="["&&(j=""),O();var k=g(j,b);for(var l in k)S([l,k[l]]);var n=a.replace(j,"").replace(new RegExp(c(h),"g")," ");n=n.replace(/(\{[^}]+\})+?/g,""),n=n.replace(/\d+\./g,"");var o=bq(n).split(new RegExp(/\s+/));o=o.join(",").replace(/,,+/g,",").split(",");var p="";for(var q=0;q-1)f(M)&&typeof M.Result=="undefined"&&S(["Result",p]);else{p=e(p);if(p==null)return!1;bf(p)}return!0},header:function(){return S(arguments)},ascii:function(){return bi()},turn:function(){return G},move:function(a){var b=null,c=X();if(typeof a=="string"){for(var d=0,e=c.length;d0)b.push(bg());while(b.length>0){var e=b.pop();d?c.push(bo(e)):c.push(Y(e)),bf(e)}return c}}};typeof exports!="undefined"&&(exports.Chess=Chess);var chess=new Chess,currentColor=chess.turn(),turn=0,timeOut=null,photon=document.getElementsByClassName("photon-shader"),sphere=document.getElementsByClassName("sphere"),piece=document.getElementsByClassName("piece"),square=document.getElementsByClassName("square"),app=document.getElementById("app"),scene=document.getElementById("scene"),sceneX=70,sceneY=90,controls=!1,animated=!1,mouseDown=!1,closestElement=null,white="White",black="Black";if(checkTouch())var press="touchstart",drag="touchmove",drop="touchend";else var press="mousedown",drag="mousemove",drop="mouseup";window.addEventListener("resize",resetPoly,!1);var readyStateCheckInterval=setInterval(function(){document.readyState==="complete"&&(renderPoly(),init(),clearInterval(readyStateCheckInterval))},3250)