Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Berry <bryan@olenepal.org>2009-10-09 06:37:12 (GMT)
committer Bryan Berry <bryan@olenepal.org>2009-10-09 06:37:12 (GMT)
commitbc0bf3d8aee602bdf967531957b2b3412b1993f9 (patch)
tree507df5b4f15a6ec5c129ab6421c84addf0178745
initial commit
-rwxr-xr-xREADME66
-rw-r--r--index.html21
-rw-r--r--index.html.~1~0
-rwxr-xr-xjs/jquery-1.3.2.min.js19
-rwxr-xr-xjs/jquery.karma.js1161
-rwxr-xr-xjs/karma.Gettext.js1282
-rwxr-xr-xjs/raphael-min.js7
-rw-r--r--package.json9
-rw-r--r--package.json.~1~9
9 files changed, 2574 insertions, 0 deletions
diff --git a/README b/README
new file mode 100755
index 0000000..7eb9c6c
--- /dev/null
+++ b/README
@@ -0,0 +1,66 @@
+==============================================================
+
+= = = = = = = = = = Karma Read Me = = = = = = = = = = =
+
+==============================================================
+
+Karma is subject to the terms detailed in the license
+agreement accompanying it.
+
+This Read Me file contains information about system
+requirements and installation instructions
+
+For more info on karma, start at http://www.karmaeducation.org .
+Most of the documentation is at http://wiki.sugarlabs.org/go/Karma
+
+To submit bugs
+or other feedback, go to http://www.launchpad.net/karma
+
+Karma is a subproject of SugarLabs http://www.sugarlabs.org
+
+The API documentation is available at
+http://karma.sugarlabs.org/docs/jsdocs/
+
+==============================================================
+
+ Getting karma
+
+==============================================================
+
+git clone git://git.sugarlabs.org/karma/mainline.git
+
+
+==============================================================
+
+ System Requirements
+
+==============================================================
+
+Running karma lessons requires an html5-capable web browser.
+
+It has only been tested thus far with with firefox 3.5 and
+Google Chrome.
+
+Running the karma utility script requires java v1.5 or greater
+
+==============================================================
+
+ Installation Instructions
+
+==============================================================
+
+
+
+==============================================================
+
+ Miscellaneous
+
+==============================================================
+
+
+
+Creating The First Translation Template
+------------------------------------
+run the setup.sh script in the utils/ directory
+
+./karma --gettext html_file.html js_file.js your_lesson_name.pot \ No newline at end of file
diff --git a/index.html b/index.html
new file mode 100644
index 0000000..5939b0b
--- /dev/null
+++ b/index.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Karma - My First Lesson</title>
+ <meta name="keywords" content="karma,javascript,html5,sugar,sugarlabs" />
+ <script type="text/javascript" src="js/raphael-min.js"></script>
+ <script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
+ <script type="text/javascript" src="js/jquery.karma.js"></script>
+ <script type="text/javascript" src="js/karma.Gettext.js"></script>
+
+ <!-- Put the code specific to your lesson in lesson.js -->
+ <script type="text/javascript" src="js/lesson.js"></script>
+
+
+</head>
+<body>
+<div>Hello World! This is my first Karma Lesson!</div>
+<div>Use this file as a template to create your first Karma lesson</div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/index.html.~1~ b/index.html.~1~
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/index.html.~1~
diff --git a/js/jquery-1.3.2.min.js b/js/jquery-1.3.2.min.js
new file mode 100755
index 0000000..b1ae21d
--- /dev/null
+++ b/js/jquery-1.3.2.min.js
@@ -0,0 +1,19 @@
+/*
+ * jQuery JavaScript Library v1.3.2
+ * http://jquery.com/
+ *
+ * Copyright (c) 2009 John Resig
+ * Dual licensed under the MIT and GPL licenses.
+ * http://docs.jquery.com/License
+ *
+ * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
+ * Revision: 6246
+ */
+(function(){var l=this,g,y=l.jQuery,p=l.$,o=l.jQuery=l.$=function(E,F){return new o.fn.init(E,F)},D=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;o.fn=o.prototype={init:function(E,H){E=E||document;if(E.nodeType){this[0]=E;this.length=1;this.context=E;return this}if(typeof E==="string"){var G=D.exec(E);if(G&&(G[1]||!H)){if(G[1]){E=o.clean([G[1]],H)}else{var I=document.getElementById(G[3]);if(I&&I.id!=G[3]){return o().find(E)}var F=o(I||[]);F.context=document;F.selector=E;return F}}else{return o(H).find(E)}}else{if(o.isFunction(E)){return o(document).ready(E)}}if(E.selector&&E.context){this.selector=E.selector;this.context=E.context}return this.setArray(o.isArray(E)?E:o.makeArray(E))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(E){return E===g?Array.prototype.slice.call(this):this[E]},pushStack:function(F,H,E){var G=o(F);G.prevObject=this;G.context=this.context;if(H==="find"){G.selector=this.selector+(this.selector?" ":"")+E}else{if(H){G.selector=this.selector+"."+H+"("+E+")"}}return G},setArray:function(E){this.length=0;Array.prototype.push.apply(this,E);return this},each:function(F,E){return o.each(this,F,E)},index:function(E){return o.inArray(E&&E.jquery?E[0]:E,this)},attr:function(F,H,G){var E=F;if(typeof F==="string"){if(H===g){return this[0]&&o[G||"attr"](this[0],F)}else{E={};E[F]=H}}return this.each(function(I){for(F in E){o.attr(G?this.style:this,F,o.prop(this,E[F],G,I,F))}})},css:function(E,F){if((E=="width"||E=="height")&&parseFloat(F)<0){F=g}return this.attr(E,F,"curCSS")},text:function(F){if(typeof F!=="object"&&F!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(F))}var E="";o.each(F||this,function(){o.each(this.childNodes,function(){if(this.nodeType!=8){E+=this.nodeType!=1?this.nodeValue:o.fn.text([this])}})});return E},wrapAll:function(E){if(this[0]){var F=o(E,this[0].ownerDocument).clone();if(this[0].parentNode){F.insertBefore(this[0])}F.map(function(){var G=this;while(G.firstChild){G=G.firstChild}return G}).append(this)}return this},wrapInner:function(E){return this.each(function(){o(this).contents().wrapAll(E)})},wrap:function(E){return this.each(function(){o(this).wrapAll(E)})},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(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this)})},after:function(){return this.domManip(arguments,false,function(E){this.parentNode.insertBefore(E,this.nextSibling)})},end:function(){return this.prevObject||o([])},push:[].push,sort:[].sort,splice:[].splice,find:function(E){if(this.length===1){var F=this.pushStack([],"find",E);F.length=0;o.find(E,this[0],F);return F}else{return this.pushStack(o.unique(o.map(this,function(G){return o.find(E,G)})),"find",E)}},clone:function(G){var E=this.map(function(){if(!o.support.noCloneEvent&&!o.isXMLDoc(this)){var I=this.outerHTML;if(!I){var J=this.ownerDocument.createElement("div");J.appendChild(this.cloneNode(true));I=J.innerHTML}return o.clean([I.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(G===true){var H=this.find("*").andSelf(),F=0;E.find("*").andSelf().each(function(){if(this.nodeName!==H[F].nodeName){return}var I=o.data(H[F],"events");for(var K in I){for(var J in I[K]){o.event.add(this,K,I[K][J],I[K][J].data)}}F++})}return E},filter:function(E){return this.pushStack(o.isFunction(E)&&o.grep(this,function(G,F){return E.call(G,F)})||o.multiFilter(E,o.grep(this,function(F){return F.nodeType===1})),"filter",E)},closest:function(E){var G=o.expr.match.POS.test(E)?o(E):null,F=0;return this.map(function(){var H=this;while(H&&H.ownerDocument){if(G?G.index(H)>-1:o(H).is(E)){o.data(H,"closest",F);return H}H=H.parentNode;F++}})},not:function(E){if(typeof E==="string"){if(f.test(E)){return this.pushStack(o.multiFilter(E,this,true),"not",E)}else{E=o.multiFilter(E,this)}}var F=E.length&&E[E.length-1]!==g&&!E.nodeType;return this.filter(function(){return F?o.inArray(this,E)<0:this!=E})},add:function(E){return this.pushStack(o.unique(o.merge(this.get(),typeof E==="string"?o(E):o.makeArray(E))))},is:function(E){return !!E&&o.multiFilter(E,this).length>0},hasClass:function(E){return !!E&&this.is("."+E)},val:function(K){if(K===g){var E=this[0];if(E){if(o.nodeName(E,"option")){return(E.attributes.value||{}).specified?E.value:E.text}if(o.nodeName(E,"select")){var I=E.selectedIndex,L=[],M=E.options,H=E.type=="select-one";if(I<0){return null}for(var F=H?I:0,J=H?I+1:M.length;F<J;F++){var G=M[F];if(G.selected){K=o(G).val();if(H){return K}L.push(K)}}return L}return(E.value||"").replace(/\r/g,"")}return g}if(typeof K==="number"){K+=""}return this.each(function(){if(this.nodeType!=1){return}if(o.isArray(K)&&/radio|checkbox/.test(this.type)){this.checked=(o.inArray(this.value,K)>=0||o.inArray(this.name,K)>=0)}else{if(o.nodeName(this,"select")){var N=o.makeArray(K);o("option",this).each(function(){this.selected=(o.inArray(this.value,N)>=0||o.inArray(this.text,N)>=0)});if(!N.length){this.selectedIndex=-1}}else{this.value=K}}})},html:function(E){return E===g?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(E)},replaceWith:function(E){return this.after(E).remove()},eq:function(E){return this.slice(E,+E+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(E){return this.pushStack(o.map(this,function(G,F){return E.call(G,F,G)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=o.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),this.length>1||G>0?I.cloneNode(true):I)}}if(F){o.each(F,z)}}return this;function K(N,O){return M&&o.nodeName(N,"table")&&o.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};o.fn.init.prototype=o.fn;function z(E,F){if(F.src){o.ajax({url:F.src,async:false,dataType:"script"})}else{o.globalEval(F.text||F.textContent||F.innerHTML||"")}if(F.parentNode){F.parentNode.removeChild(F)}}function e(){return +new Date}o.extend=o.fn.extend=function(){var J=arguments[0]||{},H=1,I=arguments.length,E=false,G;if(typeof J==="boolean"){E=J;J=arguments[1]||{};H=2}if(typeof J!=="object"&&!o.isFunction(J)){J={}}if(I==H){J=this;--H}for(;H<I;H++){if((G=arguments[H])!=null){for(var F in G){var K=J[F],L=G[F];if(J===L){continue}if(E&&L&&typeof L==="object"&&!L.nodeType){J[F]=o.extend(E,K||(L.length!=null?[]:{}),L)}else{if(L!==g){J[F]=L}}}}}return J};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,q=document.defaultView||{},s=Object.prototype.toString;o.extend({noConflict:function(E){l.$=p;if(E){l.jQuery=y}return o},isFunction:function(E){return s.call(E)==="[object Function]"},isArray:function(E){return s.call(E)==="[object Array]"},isXMLDoc:function(E){return E.nodeType===9&&E.documentElement.nodeName!=="HTML"||!!E.ownerDocument&&o.isXMLDoc(E.ownerDocument)},globalEval:function(G){if(G&&/\S/.test(G)){var F=document.getElementsByTagName("head")[0]||document.documentElement,E=document.createElement("script");E.type="text/javascript";if(o.support.scriptEval){E.appendChild(document.createTextNode(G))}else{E.text=G}F.insertBefore(E,F.firstChild);F.removeChild(E)}},nodeName:function(F,E){return F.nodeName&&F.nodeName.toUpperCase()==E.toUpperCase()},each:function(G,K,F){var E,H=0,I=G.length;if(F){if(I===g){for(E in G){if(K.apply(G[E],F)===false){break}}}else{for(;H<I;){if(K.apply(G[H++],F)===false){break}}}}else{if(I===g){for(E in G){if(K.call(G[E],E,G[E])===false){break}}}else{for(var J=G[0];H<I&&K.call(J,H,J)!==false;J=G[++H]){}}}return G},prop:function(H,I,G,F,E){if(o.isFunction(I)){I=I.call(H,F)}return typeof I==="number"&&G=="curCSS"&&!b.test(E)?I+"px":I},className:{add:function(E,F){o.each((F||"").split(/\s+/),function(G,H){if(E.nodeType==1&&!o.className.has(E.className,H)){E.className+=(E.className?" ":"")+H}})},remove:function(E,F){if(E.nodeType==1){E.className=F!==g?o.grep(E.className.split(/\s+/),function(G){return !o.className.has(F,G)}).join(" "):""}},has:function(F,E){return F&&o.inArray(E,(F.className||F).toString().split(/\s+/))>-1}},swap:function(H,G,I){var E={};for(var F in G){E[F]=H.style[F];H.style[F]=G[F]}I.call(H);for(var F in G){H.style[F]=E[F]}},css:function(H,F,J,E){if(F=="width"||F=="height"){var L,G={position:"absolute",visibility:"hidden",display:"block"},K=F=="width"?["Left","Right"]:["Top","Bottom"];function I(){L=F=="width"?H.offsetWidth:H.offsetHeight;if(E==="border"){return}o.each(K,function(){if(!E){L-=parseFloat(o.curCSS(H,"padding"+this,true))||0}if(E==="margin"){L+=parseFloat(o.curCSS(H,"margin"+this,true))||0}else{L-=parseFloat(o.curCSS(H,"border"+this+"Width",true))||0}})}if(H.offsetWidth!==0){I()}else{o.swap(H,G,I)}return Math.max(0,Math.round(L))}return o.curCSS(H,F,J)},curCSS:function(I,F,G){var L,E=I.style;if(F=="opacity"&&!o.support.opacity){L=o.attr(E,"opacity");return L==""?"1":L}if(F.match(/float/i)){F=w}if(!G&&E&&E[F]){L=E[F]}else{if(q.getComputedStyle){if(F.match(/float/i)){F="float"}F=F.replace(/([A-Z])/g,"-$1").toLowerCase();var M=q.getComputedStyle(I,null);if(M){L=M.getPropertyValue(F)}if(F=="opacity"&&L==""){L="1"}}else{if(I.currentStyle){var J=F.replace(/\-(\w)/g,function(N,O){return O.toUpperCase()});L=I.currentStyle[F]||I.currentStyle[J];if(!/^\d+(px)?$/i.test(L)&&/^\d/.test(L)){var H=E.left,K=I.runtimeStyle.left;I.runtimeStyle.left=I.currentStyle.left;E.left=L||0;L=E.pixelLeft+"px";E.left=H;I.runtimeStyle.left=K}}}}return L},clean:function(F,K,I){K=K||document;if(typeof K.createElement==="undefined"){K=K.ownerDocument||K[0]&&K[0].ownerDocument||document}if(!I&&F.length===1&&typeof F[0]==="string"){var H=/^<(\w+)\s*\/?>$/.exec(F[0]);if(H){return[K.createElement(H[1])]}}var G=[],E=[],L=K.createElement("div");o.each(F,function(P,S){if(typeof S==="number"){S+=""}if(!S){return}if(typeof S==="string"){S=S.replace(/(<(\w+)[^>]*?)\/>/g,function(U,V,T){return T.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?U:V+"></"+T+">"});var O=S.replace(/^\s+/,"").substring(0,10).toLowerCase();var Q=!O.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!O.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||O.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!O.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!O.indexOf("<td")||!O.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!O.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!o.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];L.innerHTML=Q[1]+S+Q[2];while(Q[0]--){L=L.lastChild}if(!o.support.tbody){var R=/<tbody/i.test(S),N=!O.indexOf("<table")&&!R?L.firstChild&&L.firstChild.childNodes:Q[1]=="<table>"&&!R?L.childNodes:[];for(var M=N.length-1;M>=0;--M){if(o.nodeName(N[M],"tbody")&&!N[M].childNodes.length){N[M].parentNode.removeChild(N[M])}}}if(!o.support.leadingWhitespace&&/^\s/.test(S)){L.insertBefore(K.createTextNode(S.match(/^\s*/)[0]),L.firstChild)}S=o.makeArray(L.childNodes)}if(S.nodeType){G.push(S)}else{G=o.merge(G,S)}});if(I){for(var J=0;G[J];J++){if(o.nodeName(G[J],"script")&&(!G[J].type||G[J].type.toLowerCase()==="text/javascript")){E.push(G[J].parentNode?G[J].parentNode.removeChild(G[J]):G[J])}else{if(G[J].nodeType===1){G.splice.apply(G,[J+1,0].concat(o.makeArray(G[J].getElementsByTagName("script"))))}I.appendChild(G[J])}}return E}return G},attr:function(J,G,K){if(!J||J.nodeType==3||J.nodeType==8){return g}var H=!o.isXMLDoc(J),L=K!==g;G=H&&o.props[G]||G;if(J.tagName){var F=/href|src|style/.test(G);if(G=="selected"&&J.parentNode){J.parentNode.selectedIndex}if(G in J&&H&&!F){if(L){if(G=="type"&&o.nodeName(J,"input")&&J.parentNode){throw"type property can't be changed"}J[G]=K}if(o.nodeName(J,"form")&&J.getAttributeNode(G)){return J.getAttributeNode(G).nodeValue}if(G=="tabIndex"){var I=J.getAttributeNode("tabIndex");return I&&I.specified?I.value:J.nodeName.match(/(button|input|object|select|textarea)/i)?0:J.nodeName.match(/^(a|area)$/i)&&J.href?0:g}return J[G]}if(!o.support.style&&H&&G=="style"){return o.attr(J.style,"cssText",K)}if(L){J.setAttribute(G,""+K)}var E=!o.support.hrefNormalized&&H&&F?J.getAttribute(G,2):J.getAttribute(G);return E===null?g:E}if(!o.support.opacity&&G=="opacity"){if(L){J.zoom=1;J.filter=(J.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(K)+""=="NaN"?"":"alpha(opacity="+K*100+")")}return J.filter&&J.filter.indexOf("opacity=")>=0?(parseFloat(J.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}G=G.replace(/-([a-z])/ig,function(M,N){return N.toUpperCase()});if(L){J[G]=K}return J[G]},trim:function(E){return(E||"").replace(/^\s+|\s+$/g,"")},makeArray:function(G){var E=[];if(G!=null){var F=G.length;if(F==null||typeof G==="string"||o.isFunction(G)||G.setInterval){E[0]=G}else{while(F){E[--F]=G[F]}}}return E},inArray:function(G,H){for(var E=0,F=H.length;E<F;E++){if(H[E]===G){return E}}return -1},merge:function(H,E){var F=0,G,I=H.length;if(!o.support.getAll){while((G=E[F++])!=null){if(G.nodeType!=8){H[I++]=G}}}else{while((G=E[F++])!=null){H[I++]=G}}return H},unique:function(K){var F=[],E={};try{for(var G=0,H=K.length;G<H;G++){var J=o.data(K[G]);if(!E[J]){E[J]=true;F.push(K[G])}}}catch(I){F=K}return F},grep:function(F,J,E){var G=[];for(var H=0,I=F.length;H<I;H++){if(!E!=!J(F[H],H)){G.push(F[H])}}return G},map:function(E,J){var F=[];for(var G=0,H=E.length;G<H;G++){var I=J(E[G],G);if(I!=null){F[F.length]=I}}return F.concat.apply([],F)}});var C=navigator.userAgent.toLowerCase();o.browser={version:(C.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(C),opera:/opera/.test(C),msie:/msie/.test(C)&&!/opera/.test(C),mozilla:/mozilla/.test(C)&&!/(compatible|webkit)/.test(C)};o.each({parent:function(E){return E.parentNode},parents:function(E){return o.dir(E,"parentNode")},next:function(E){return o.nth(E,2,"nextSibling")},prev:function(E){return o.nth(E,2,"previousSibling")},nextAll:function(E){return o.dir(E,"nextSibling")},prevAll:function(E){return o.dir(E,"previousSibling")},siblings:function(E){return o.sibling(E.parentNode.firstChild,E)},children:function(E){return o.sibling(E.firstChild)},contents:function(E){return o.nodeName(E,"iframe")?E.contentDocument||E.contentWindow.document:o.makeArray(E.childNodes)}},function(E,F){o.fn[E]=function(G){var H=o.map(this,F);if(G&&typeof G=="string"){H=o.multiFilter(G,H)}return this.pushStack(o.unique(H),E,G)}});o.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(E,F){o.fn[E]=function(G){var J=[],L=o(G);for(var K=0,H=L.length;K<H;K++){var I=(K>0?this.clone(true):this).get();o.fn[F].apply(o(L[K]),I);J=J.concat(I)}return this.pushStack(J,E,G)}});o.each({removeAttr:function(E){o.attr(this,E,"");if(this.nodeType==1){this.removeAttribute(E)}},addClass:function(E){o.className.add(this,E)},removeClass:function(E){o.className.remove(this,E)},toggleClass:function(F,E){if(typeof E!=="boolean"){E=!o.className.has(this,F)}o.className[E?"add":"remove"](this,F)},remove:function(E){if(!E||o.filter(E,[this]).length){o("*",this).add([this]).each(function(){o.event.remove(this);o.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){o(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(E,F){o.fn[E]=function(){return this.each(F,arguments)}});function j(E,F){return E[0]&&parseInt(o.curCSS(E[0],F,true),10)||0}var h="jQuery"+e(),v=0,A={};o.extend({cache:{},data:function(F,E,G){F=F==l?A:F;var H=F[h];if(!H){H=F[h]=++v}if(E&&!o.cache[H]){o.cache[H]={}}if(G!==g){o.cache[H][E]=G}return E?o.cache[H][E]:H},removeData:function(F,E){F=F==l?A:F;var H=F[h];if(E){if(o.cache[H]){delete o.cache[H][E];E="";for(E in o.cache[H]){break}if(!E){o.removeData(F)}}}else{try{delete F[h]}catch(G){if(F.removeAttribute){F.removeAttribute(h)}}delete o.cache[H]}},queue:function(F,E,H){if(F){E=(E||"fx")+"queue";var G=o.data(F,E);if(!G||o.isArray(H)){G=o.data(F,E,o.makeArray(H))}else{if(H){G.push(H)}}}return G},dequeue:function(H,G){var E=o.queue(H,G),F=E.shift();if(!G||G==="fx"){F=E[0]}if(F!==g){F.call(H)}}});o.fn.extend({data:function(E,G){var H=E.split(".");H[1]=H[1]?"."+H[1]:"";if(G===g){var F=this.triggerHandler("getData"+H[1]+"!",[H[0]]);if(F===g&&this.length){F=o.data(this[0],E)}return F===g&&H[1]?this.data(H[0]):F}else{return this.trigger("setData"+H[1]+"!",[H[0],G]).each(function(){o.data(this,E,G)})}},removeData:function(E){return this.each(function(){o.removeData(this,E)})},queue:function(E,F){if(typeof E!=="string"){F=E;E="fx"}if(F===g){return o.queue(this[0],E)}return this.each(function(){var G=o.queue(this,E,F);if(E=="fx"&&G.length==1){G[0].call(this)}})},dequeue:function(E){return this.each(function(){o.dequeue(this,E)})}});
+/*
+ * Sizzle CSS Selector Engine - v0.9.3
+ * Copyright 2009, The Dojo Foundation
+ * Released under the MIT, BSD, and GPL Licenses.
+ * More information: http://sizzlejs.com/
+ */
+(function(){var R=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,L=0,H=Object.prototype.toString;var F=function(Y,U,ab,ac){ab=ab||[];U=U||document;if(U.nodeType!==1&&U.nodeType!==9){return[]}if(!Y||typeof Y!=="string"){return ab}var Z=[],W,af,ai,T,ad,V,X=true;R.lastIndex=0;while((W=R.exec(Y))!==null){Z.push(W[1]);if(W[2]){V=RegExp.rightContext;break}}if(Z.length>1&&M.exec(Y)){if(Z.length===2&&I.relative[Z[0]]){af=J(Z[0]+Z[1],U)}else{af=I.relative[Z[0]]?[U]:F(Z.shift(),U);while(Z.length){Y=Z.shift();if(I.relative[Y]){Y+=Z.shift()}af=J(Y,af)}}}else{var ae=ac?{expr:Z.pop(),set:E(ac)}:F.find(Z.pop(),Z.length===1&&U.parentNode?U.parentNode:U,Q(U));af=F.filter(ae.expr,ae.set);if(Z.length>0){ai=E(af)}else{X=false}while(Z.length){var ah=Z.pop(),ag=ah;if(!I.relative[ah]){ah=""}else{ag=Z.pop()}if(ag==null){ag=U}I.relative[ah](ai,ag,Q(U))}}if(!ai){ai=af}if(!ai){throw"Syntax error, unrecognized expression: "+(ah||Y)}if(H.call(ai)==="[object Array]"){if(!X){ab.push.apply(ab,ai)}else{if(U.nodeType===1){for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&(ai[aa]===true||ai[aa].nodeType===1&&K(U,ai[aa]))){ab.push(af[aa])}}}else{for(var aa=0;ai[aa]!=null;aa++){if(ai[aa]&&ai[aa].nodeType===1){ab.push(af[aa])}}}}}else{E(ai,ab)}if(V){F(V,U,ab,ac);if(G){hasDuplicate=false;ab.sort(G);if(hasDuplicate){for(var aa=1;aa<ab.length;aa++){if(ab[aa]===ab[aa-1]){ab.splice(aa--,1)}}}}}return ab};F.matches=function(T,U){return F(T,null,null,U)};F.find=function(aa,T,ab){var Z,X;if(!aa){return[]}for(var W=0,V=I.order.length;W<V;W++){var Y=I.order[W],X;if((X=I.match[Y].exec(aa))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){X[1]=(X[1]||"").replace(/\\/g,"");Z=I.find[Y](X,T,ab);if(Z!=null){aa=aa.replace(I.match[Y],"");break}}}}if(!Z){Z=T.getElementsByTagName("*")}return{set:Z,expr:aa}};F.filter=function(ad,ac,ag,W){var V=ad,ai=[],aa=ac,Y,T,Z=ac&&ac[0]&&Q(ac[0]);while(ad&&ac.length){for(var ab in I.filter){if((Y=I.match[ab].exec(ad))!=null){var U=I.filter[ab],ah,af;T=false;if(aa==ai){ai=[]}if(I.preFilter[ab]){Y=I.preFilter[ab](Y,aa,ag,ai,W,Z);if(!Y){T=ah=true}else{if(Y===true){continue}}}if(Y){for(var X=0;(af=aa[X])!=null;X++){if(af){ah=U(af,Y,X,aa);var ae=W^!!ah;if(ag&&ah!=null){if(ae){T=true}else{aa[X]=false}}else{if(ae){ai.push(af);T=true}}}}}if(ah!==g){if(!ag){aa=ai}ad=ad.replace(I.match[ab],"");if(!T){return[]}break}}}if(ad==V){if(T==null){throw"Syntax error, unrecognized expression: "+ad}else{break}}V=ad}return aa};var I=F.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\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(T){return T.getAttribute("href")}},relative:{"+":function(aa,T,Z){var X=typeof T==="string",ab=X&&!/\W/.test(T),Y=X&&!ab;if(ab&&!Z){T=T.toUpperCase()}for(var W=0,V=aa.length,U;W<V;W++){if((U=aa[W])){while((U=U.previousSibling)&&U.nodeType!==1){}aa[W]=Y||U&&U.nodeName===T?U||false:U===T}}if(Y){F.filter(T,aa,true)}},">":function(Z,U,aa){var X=typeof U==="string";if(X&&!/\W/.test(U)){U=aa?U:U.toUpperCase();for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){var W=Y.parentNode;Z[V]=W.nodeName===U?W:false}}}else{for(var V=0,T=Z.length;V<T;V++){var Y=Z[V];if(Y){Z[V]=X?Y.parentNode:Y.parentNode===U}}if(X){F.filter(U,Z,true)}}},"":function(W,U,Y){var V=L++,T=S;if(!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("parentNode",U,V,W,X,Y)},"~":function(W,U,Y){var V=L++,T=S;if(typeof U==="string"&&!U.match(/\W/)){var X=U=Y?U:U.toUpperCase();T=P}T("previousSibling",U,V,W,X,Y)}},find:{ID:function(U,V,W){if(typeof V.getElementById!=="undefined"&&!W){var T=V.getElementById(U[1]);return T?[T]:[]}},NAME:function(V,Y,Z){if(typeof Y.getElementsByName!=="undefined"){var U=[],X=Y.getElementsByName(V[1]);for(var W=0,T=X.length;W<T;W++){if(X[W].getAttribute("name")===V[1]){U.push(X[W])}}return U.length===0?null:U}},TAG:function(T,U){return U.getElementsByTagName(T[1])}},preFilter:{CLASS:function(W,U,V,T,Z,aa){W=" "+W[1].replace(/\\/g,"")+" ";if(aa){return W}for(var X=0,Y;(Y=U[X])!=null;X++){if(Y){if(Z^(Y.className&&(" "+Y.className+" ").indexOf(W)>=0)){if(!V){T.push(Y)}}else{if(V){U[X]=false}}}}return false},ID:function(T){return T[1].replace(/\\/g,"")},TAG:function(U,T){for(var V=0;T[V]===false;V++){}return T[V]&&Q(T[V])?U[1]:U[1].toUpperCase()},CHILD:function(T){if(T[1]=="nth"){var U=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(T[2]=="even"&&"2n"||T[2]=="odd"&&"2n+1"||!/\D/.test(T[2])&&"0n+"+T[2]||T[2]);T[2]=(U[1]+(U[2]||1))-0;T[3]=U[3]-0}T[0]=L++;return T},ATTR:function(X,U,V,T,Y,Z){var W=X[1].replace(/\\/g,"");if(!Z&&I.attrMap[W]){X[1]=I.attrMap[W]}if(X[2]==="~="){X[4]=" "+X[4]+" "}return X},PSEUDO:function(X,U,V,T,Y){if(X[1]==="not"){if(X[3].match(R).length>1||/^\w/.test(X[3])){X[3]=F(X[3],null,null,U)}else{var W=F.filter(X[3],U,V,true^Y);if(!V){T.push.apply(T,W)}return false}}else{if(I.match.POS.test(X[0])||I.match.CHILD.test(X[0])){return true}}return X},POS:function(T){T.unshift(true);return T}},filters:{enabled:function(T){return T.disabled===false&&T.type!=="hidden"},disabled:function(T){return T.disabled===true},checked:function(T){return T.checked===true},selected:function(T){T.parentNode.selectedIndex;return T.selected===true},parent:function(T){return !!T.firstChild},empty:function(T){return !T.firstChild},has:function(V,U,T){return !!F(T[3],V).length},header:function(T){return/h\d/i.test(T.nodeName)},text:function(T){return"text"===T.type},radio:function(T){return"radio"===T.type},checkbox:function(T){return"checkbox"===T.type},file:function(T){return"file"===T.type},password:function(T){return"password"===T.type},submit:function(T){return"submit"===T.type},image:function(T){return"image"===T.type},reset:function(T){return"reset"===T.type},button:function(T){return"button"===T.type||T.nodeName.toUpperCase()==="BUTTON"},input:function(T){return/input|select|textarea|button/i.test(T.nodeName)}},setFilters:{first:function(U,T){return T===0},last:function(V,U,T,W){return U===W.length-1},even:function(U,T){return T%2===0},odd:function(U,T){return T%2===1},lt:function(V,U,T){return U<T[3]-0},gt:function(V,U,T){return U>T[3]-0},nth:function(V,U,T){return T[3]-0==U},eq:function(V,U,T){return T[3]-0==U}},filter:{PSEUDO:function(Z,V,W,aa){var U=V[1],X=I.filters[U];if(X){return X(Z,W,V,aa)}else{if(U==="contains"){return(Z.textContent||Z.innerText||"").indexOf(V[3])>=0}else{if(U==="not"){var Y=V[3];for(var W=0,T=Y.length;W<T;W++){if(Y[W]===Z){return false}}return true}}}},CHILD:function(T,W){var Z=W[1],U=T;switch(Z){case"only":case"first":while(U=U.previousSibling){if(U.nodeType===1){return false}}if(Z=="first"){return true}U=T;case"last":while(U=U.nextSibling){if(U.nodeType===1){return false}}return true;case"nth":var V=W[2],ac=W[3];if(V==1&&ac==0){return true}var Y=W[0],ab=T.parentNode;if(ab&&(ab.sizcache!==Y||!T.nodeIndex)){var X=0;for(U=ab.firstChild;U;U=U.nextSibling){if(U.nodeType===1){U.nodeIndex=++X}}ab.sizcache=Y}var aa=T.nodeIndex-ac;if(V==0){return aa==0}else{return(aa%V==0&&aa/V>=0)}}},ID:function(U,T){return U.nodeType===1&&U.getAttribute("id")===T},TAG:function(U,T){return(T==="*"&&U.nodeType===1)||U.nodeName===T},CLASS:function(U,T){return(" "+(U.className||U.getAttribute("class"))+" ").indexOf(T)>-1},ATTR:function(Y,W){var V=W[1],T=I.attrHandle[V]?I.attrHandle[V](Y):Y[V]!=null?Y[V]:Y.getAttribute(V),Z=T+"",X=W[2],U=W[4];return T==null?X==="!=":X==="="?Z===U:X==="*="?Z.indexOf(U)>=0:X==="~="?(" "+Z+" ").indexOf(U)>=0:!U?Z&&T!==false:X==="!="?Z!=U:X==="^="?Z.indexOf(U)===0:X==="$="?Z.substr(Z.length-U.length)===U:X==="|="?Z===U||Z.substr(0,U.length+1)===U+"-":false},POS:function(X,U,V,Y){var T=U[2],W=I.setFilters[T];if(W){return W(X,V,U,Y)}}}};var M=I.match.POS;for(var O in I.match){I.match[O]=RegExp(I.match[O].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var E=function(U,T){U=Array.prototype.slice.call(U);if(T){T.push.apply(T,U);return T}return U};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(N){E=function(X,W){var U=W||[];if(H.call(X)==="[object Array]"){Array.prototype.push.apply(U,X)}else{if(typeof X.length==="number"){for(var V=0,T=X.length;V<T;V++){U.push(X[V])}}else{for(var V=0;X[V];V++){U.push(X[V])}}}return U}}var G;if(document.documentElement.compareDocumentPosition){G=function(U,T){var V=U.compareDocumentPosition(T)&4?-1:U===T?0:1;if(V===0){hasDuplicate=true}return V}}else{if("sourceIndex" in document.documentElement){G=function(U,T){var V=U.sourceIndex-T.sourceIndex;if(V===0){hasDuplicate=true}return V}}else{if(document.createRange){G=function(W,U){var V=W.ownerDocument.createRange(),T=U.ownerDocument.createRange();V.selectNode(W);V.collapse(true);T.selectNode(U);T.collapse(true);var X=V.compareBoundaryPoints(Range.START_TO_END,T);if(X===0){hasDuplicate=true}return X}}}}(function(){var U=document.createElement("form"),V="script"+(new Date).getTime();U.innerHTML="<input name='"+V+"'/>";var T=document.documentElement;T.insertBefore(U,T.firstChild);if(!!document.getElementById(V)){I.find.ID=function(X,Y,Z){if(typeof Y.getElementById!=="undefined"&&!Z){var W=Y.getElementById(X[1]);return W?W.id===X[1]||typeof W.getAttributeNode!=="undefined"&&W.getAttributeNode("id").nodeValue===X[1]?[W]:g:[]}};I.filter.ID=function(Y,W){var X=typeof Y.getAttributeNode!=="undefined"&&Y.getAttributeNode("id");return Y.nodeType===1&&X&&X.nodeValue===W}}T.removeChild(U)})();(function(){var T=document.createElement("div");T.appendChild(document.createComment(""));if(T.getElementsByTagName("*").length>0){I.find.TAG=function(U,Y){var X=Y.getElementsByTagName(U[1]);if(U[1]==="*"){var W=[];for(var V=0;X[V];V++){if(X[V].nodeType===1){W.push(X[V])}}X=W}return X}}T.innerHTML="<a href='#'></a>";if(T.firstChild&&typeof T.firstChild.getAttribute!=="undefined"&&T.firstChild.getAttribute("href")!=="#"){I.attrHandle.href=function(U){return U.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var T=F,U=document.createElement("div");U.innerHTML="<p class='TEST'></p>";if(U.querySelectorAll&&U.querySelectorAll(".TEST").length===0){return}F=function(Y,X,V,W){X=X||document;if(!W&&X.nodeType===9&&!Q(X)){try{return E(X.querySelectorAll(Y),V)}catch(Z){}}return T(Y,X,V,W)};F.find=T.find;F.filter=T.filter;F.selectors=T.selectors;F.matches=T.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var T=document.createElement("div");T.innerHTML="<div class='test e'></div><div class='test'></div>";if(T.getElementsByClassName("e").length===0){return}T.lastChild.className="e";if(T.getElementsByClassName("e").length===1){return}I.order.splice(1,0,"CLASS");I.find.CLASS=function(U,V,W){if(typeof V.getElementsByClassName!=="undefined"&&!W){return V.getElementsByClassName(U[1])}}})()}function P(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1&&!ac){T.sizcache=Y;T.sizset=W}if(T.nodeName===Z){X=T;break}T=T[U]}ad[W]=X}}}function S(U,Z,Y,ad,aa,ac){var ab=U=="previousSibling"&&!ac;for(var W=0,V=ad.length;W<V;W++){var T=ad[W];if(T){if(ab&&T.nodeType===1){T.sizcache=Y;T.sizset=W}T=T[U];var X=false;while(T){if(T.sizcache===Y){X=ad[T.sizset];break}if(T.nodeType===1){if(!ac){T.sizcache=Y;T.sizset=W}if(typeof Z!=="string"){if(T===Z){X=true;break}}else{if(F.filter(Z,[T]).length>0){X=T;break}}}T=T[U]}ad[W]=X}}}var K=document.compareDocumentPosition?function(U,T){return U.compareDocumentPosition(T)&16}:function(U,T){return U!==T&&(U.contains?U.contains(T):true)};var Q=function(T){return T.nodeType===9&&T.documentElement.nodeName!=="HTML"||!!T.ownerDocument&&Q(T.ownerDocument)};var J=function(T,aa){var W=[],X="",Y,V=aa.nodeType?[aa]:aa;while((Y=I.match.PSEUDO.exec(T))){X+=Y[0];T=T.replace(I.match.PSEUDO,"")}T=I.relative[T]?T+"*":T;for(var Z=0,U=V.length;Z<U;Z++){F(T,V[Z],W)}return F.filter(X,W)};o.find=F;o.filter=F.filter;o.expr=F.selectors;o.expr[":"]=o.expr.filters;F.selectors.filters.hidden=function(T){return T.offsetWidth===0||T.offsetHeight===0};F.selectors.filters.visible=function(T){return T.offsetWidth>0||T.offsetHeight>0};F.selectors.filters.animated=function(T){return o.grep(o.timers,function(U){return T===U.elem}).length};o.multiFilter=function(V,T,U){if(U){V=":not("+V+")"}return F.matches(V,T)};o.dir=function(V,U){var T=[],W=V[U];while(W&&W!=document){if(W.nodeType==1){T.push(W)}W=W[U]}return T};o.nth=function(X,T,V,W){T=T||1;var U=0;for(;X;X=X[V]){if(X.nodeType==1&&++U==T){break}}return X};o.sibling=function(V,U){var T=[];for(;V;V=V.nextSibling){if(V.nodeType==1&&V!=U){T.push(V)}}return T};return;l.Sizzle=F})();o.event={add:function(I,F,H,K){if(I.nodeType==3||I.nodeType==8){return}if(I.setInterval&&I!=l){I=l}if(!H.guid){H.guid=this.guid++}if(K!==g){var G=H;H=this.proxy(G);H.data=K}var E=o.data(I,"events")||o.data(I,"events",{}),J=o.data(I,"handle")||o.data(I,"handle",function(){return typeof o!=="undefined"&&!o.event.triggered?o.event.handle.apply(arguments.callee.elem,arguments):g});J.elem=I;o.each(F.split(/\s+/),function(M,N){var O=N.split(".");N=O.shift();H.type=O.slice().sort().join(".");var L=E[N];if(o.event.specialAll[N]){o.event.specialAll[N].setup.call(I,K,O)}if(!L){L=E[N]={};if(!o.event.special[N]||o.event.special[N].setup.call(I,K,O)===false){if(I.addEventListener){I.addEventListener(N,J,false)}else{if(I.attachEvent){I.attachEvent("on"+N,J)}}}}L[H.guid]=H;o.event.global[N]=true});I=null},guid:1,global:{},remove:function(K,H,J){if(K.nodeType==3||K.nodeType==8){return}var G=o.data(K,"events"),F,E;if(G){if(H===g||(typeof H==="string"&&H.charAt(0)==".")){for(var I in G){this.remove(K,I+(H||""))}}else{if(H.type){J=H.handler;H=H.type}o.each(H.split(/\s+/),function(M,O){var Q=O.split(".");O=Q.shift();var N=RegExp("(^|\\.)"+Q.slice().sort().join(".*\\.")+"(\\.|$)");if(G[O]){if(J){delete G[O][J.guid]}else{for(var P in G[O]){if(N.test(G[O][P].type)){delete G[O][P]}}}if(o.event.specialAll[O]){o.event.specialAll[O].teardown.call(K,Q)}for(F in G[O]){break}if(!F){if(!o.event.special[O]||o.event.special[O].teardown.call(K,Q)===false){if(K.removeEventListener){K.removeEventListener(O,o.data(K,"handle"),false)}else{if(K.detachEvent){K.detachEvent("on"+O,o.data(K,"handle"))}}}F=null;delete G[O]}}})}for(F in G){break}if(!F){var L=o.data(K,"handle");if(L){L.elem=null}o.removeData(K,"events");o.removeData(K,"handle")}}},trigger:function(I,K,H,E){var G=I.type||I;if(!E){I=typeof I==="object"?I[h]?I:o.extend(o.Event(G),I):o.Event(G);if(G.indexOf("!")>=0){I.type=G=G.slice(0,-1);I.exclusive=true}if(!H){I.stopPropagation();if(this.global[G]){o.each(o.cache,function(){if(this.events&&this.events[G]){o.event.trigger(I,K,this.handle.elem)}})}}if(!H||H.nodeType==3||H.nodeType==8){return g}I.result=g;I.target=H;K=o.makeArray(K);K.unshift(I)}I.currentTarget=H;var J=o.data(H,"handle");if(J){J.apply(H,K)}if((!H[G]||(o.nodeName(H,"a")&&G=="click"))&&H["on"+G]&&H["on"+G].apply(H,K)===false){I.result=false}if(!E&&H[G]&&!I.isDefaultPrevented()&&!(o.nodeName(H,"a")&&G=="click")){this.triggered=true;try{H[G]()}catch(L){}}this.triggered=false;if(!I.isPropagationStopped()){var F=H.parentNode||H.ownerDocument;if(F){o.event.trigger(I,K,F,true)}}},handle:function(K){var J,E;K=arguments[0]=o.event.fix(K||l.event);K.currentTarget=this;var L=K.type.split(".");K.type=L.shift();J=!L.length&&!K.exclusive;var I=RegExp("(^|\\.)"+L.slice().sort().join(".*\\.")+"(\\.|$)");E=(o.data(this,"events")||{})[K.type];for(var G in E){var H=E[G];if(J||I.test(H.type)){K.handler=H;K.data=H.data;var F=H.apply(this,arguments);if(F!==g){K.result=F;if(F===false){K.preventDefault();K.stopPropagation()}}if(K.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(H){if(H[h]){return H}var F=H;H=o.Event(F);for(var G=this.props.length,J;G;){J=this.props[--G];H[J]=F[J]}if(!H.target){H.target=H.srcElement||document}if(H.target.nodeType==3){H.target=H.target.parentNode}if(!H.relatedTarget&&H.fromElement){H.relatedTarget=H.fromElement==H.target?H.toElement:H.fromElement}if(H.pageX==null&&H.clientX!=null){var I=document.documentElement,E=document.body;H.pageX=H.clientX+(I&&I.scrollLeft||E&&E.scrollLeft||0)-(I.clientLeft||0);H.pageY=H.clientY+(I&&I.scrollTop||E&&E.scrollTop||0)-(I.clientTop||0)}if(!H.which&&((H.charCode||H.charCode===0)?H.charCode:H.keyCode)){H.which=H.charCode||H.keyCode}if(!H.metaKey&&H.ctrlKey){H.metaKey=H.ctrlKey}if(!H.which&&H.button){H.which=(H.button&1?1:(H.button&2?3:(H.button&4?2:0)))}return H},proxy:function(F,E){E=E||function(){return F.apply(this,arguments)};E.guid=F.guid=F.guid||E.guid||this.guid++;return E},special:{ready:{setup:B,teardown:function(){}}},specialAll:{live:{setup:function(E,F){o.event.add(this,F[0],c)},teardown:function(G){if(G.length){var E=0,F=RegExp("(^|\\.)"+G[0]+"(\\.|$)");o.each((o.data(this,"events").live||{}),function(){if(F.test(this.type)){E++}});if(E<1){o.event.remove(this,G[0],c)}}}}}};o.Event=function(E){if(!this.preventDefault){return new o.Event(E)}if(E&&E.type){this.originalEvent=E;this.type=E.type}else{this.type=E}this.timeStamp=e();this[h]=true};function k(){return false}function u(){return true}o.Event.prototype={preventDefault:function(){this.isDefaultPrevented=u;var E=this.originalEvent;if(!E){return}if(E.preventDefault){E.preventDefault()}E.returnValue=false},stopPropagation:function(){this.isPropagationStopped=u;var E=this.originalEvent;if(!E){return}if(E.stopPropagation){E.stopPropagation()}E.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=u;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(F){var E=F.relatedTarget;while(E&&E!=this){try{E=E.parentNode}catch(G){E=this}}if(E!=this){F.type=F.data;o.event.handle.apply(this,arguments)}};o.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(F,E){o.event.special[E]={setup:function(){o.event.add(this,F,a,E)},teardown:function(){o.event.remove(this,F,a)}}});o.fn.extend({bind:function(F,G,E){return F=="unload"?this.one(F,G,E):this.each(function(){o.event.add(this,F,E||G,E&&G)})},one:function(G,H,F){var E=o.event.proxy(F||H,function(I){o(this).unbind(I,E);return(F||H).apply(this,arguments)});return this.each(function(){o.event.add(this,G,E,F&&H)})},unbind:function(F,E){return this.each(function(){o.event.remove(this,F,E)})},trigger:function(E,F){return this.each(function(){o.event.trigger(E,F,this)})},triggerHandler:function(E,G){if(this[0]){var F=o.Event(E);F.preventDefault();F.stopPropagation();o.event.trigger(F,G,this[0]);return F.result}},toggle:function(G){var E=arguments,F=1;while(F<E.length){o.event.proxy(G,E[F++])}return this.click(o.event.proxy(G,function(H){this.lastToggle=(this.lastToggle||0)%F;H.preventDefault();return E[this.lastToggle++].apply(this,arguments)||false}))},hover:function(E,F){return this.mouseenter(E).mouseleave(F)},ready:function(E){B();if(o.isReady){E.call(document,o)}else{o.readyList.push(E)}return this},live:function(G,F){var E=o.event.proxy(F);E.guid+=this.selector+G;o(document).bind(i(G,this.selector),this.selector,E);return this},die:function(F,E){o(document).unbind(i(F,this.selector),E?{guid:E.guid+this.selector+F}:null);return this}});function c(H){var E=RegExp("(^|\\.)"+H.type+"(\\.|$)"),G=true,F=[];o.each(o.data(this,"events").live||[],function(I,J){if(E.test(J.type)){var K=o(H.target).closest(J.data)[0];if(K){F.push({elem:K,fn:J})}}});F.sort(function(J,I){return o.data(J.elem,"closest")-o.data(I.elem,"closest")});o.each(F,function(){if(this.fn.call(this.elem,H,this.fn.data)===false){return(G=false)}});return G}function i(F,E){return["live",F,E.replace(/\./g,"`").replace(/ /g,"|")].join(".")}o.extend({isReady:false,readyList:[],ready:function(){if(!o.isReady){o.isReady=true;if(o.readyList){o.each(o.readyList,function(){this.call(document,o)});o.readyList=null}o(document).triggerHandler("ready")}}});var x=false;function B(){if(x){return}x=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);o.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);o.ready()}});if(document.documentElement.doScroll&&l==l.top){(function(){if(o.isReady){return}try{document.documentElement.doScroll("left")}catch(E){setTimeout(arguments.callee,0);return}o.ready()})()}}}o.event.add(l,"load",o.ready)}o.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(F,E){o.fn[E]=function(G){return G?this.bind(E,G):this.trigger(E)}});o(l).bind("unload",function(){for(var E in o.cache){if(E!=1&&o.cache[E].handle){o.event.remove(o.cache[E].handle.elem)}}});(function(){o.support={};var F=document.documentElement,G=document.createElement("script"),K=document.createElement("div"),J="script"+(new Date).getTime();K.style.display="none";K.innerHTML=' <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var H=K.getElementsByTagName("*"),E=K.getElementsByTagName("a")[0];if(!H||!H.length||!E){return}o.support={leadingWhitespace:K.firstChild.nodeType==3,tbody:!K.getElementsByTagName("tbody").length,objectAll:!!K.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!K.getElementsByTagName("link").length,style:/red/.test(E.getAttribute("style")),hrefNormalized:E.getAttribute("href")==="/a",opacity:E.style.opacity==="0.5",cssFloat:!!E.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};G.type="text/javascript";try{G.appendChild(document.createTextNode("window."+J+"=1;"))}catch(I){}F.insertBefore(G,F.firstChild);if(l[J]){o.support.scriptEval=true;delete l[J]}F.removeChild(G);if(K.attachEvent&&K.fireEvent){K.attachEvent("onclick",function(){o.support.noCloneEvent=false;K.detachEvent("onclick",arguments.callee)});K.cloneNode(true).fireEvent("onclick")}o(function(){var L=document.createElement("div");L.style.width=L.style.paddingLeft="1px";document.body.appendChild(L);o.boxModel=o.support.boxModel=L.offsetWidth===2;document.body.removeChild(L).style.display="none"})})();var w=o.support.cssFloat?"cssFloat":"styleFloat";o.props={"for":"htmlFor","class":"className","float":w,cssFloat:w,styleFloat:w,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};o.fn.extend({_load:o.fn.load,load:function(G,J,K){if(typeof G!=="string"){return this._load(G)}var I=G.indexOf(" ");if(I>=0){var E=G.slice(I,G.length);G=G.slice(0,I)}var H="GET";if(J){if(o.isFunction(J)){K=J;J=null}else{if(typeof J==="object"){J=o.param(J);H="POST"}}}var F=this;o.ajax({url:G,type:H,dataType:"html",data:J,complete:function(M,L){if(L=="success"||L=="notmodified"){F.html(E?o("<div/>").append(M.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(E):M.responseText)}if(K){F.each(K,[M.responseText,L,M])}}});return this},serialize:function(){return o.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?o.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(E,F){var G=o(this).val();return G==null?null:o.isArray(G)?o.map(G,function(I,H){return{name:F.name,value:I}}):{name:F.name,value:G}}).get()}});o.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(E,F){o.fn[F]=function(G){return this.bind(F,G)}});var r=e();o.extend({get:function(E,G,H,F){if(o.isFunction(G)){H=G;G=null}return o.ajax({type:"GET",url:E,data:G,success:H,dataType:F})},getScript:function(E,F){return o.get(E,null,F,"script")},getJSON:function(E,F,G){return o.get(E,F,G,"json")},post:function(E,G,H,F){if(o.isFunction(G)){H=G;G={}}return o.ajax({type:"POST",url:E,data:G,success:H,dataType:F})},ajaxSetup:function(E){o.extend(o.ajaxSettings,E)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(M){M=o.extend(true,M,o.extend(true,{},o.ajaxSettings,M));var W,F=/=\?(&|$)/g,R,V,G=M.type.toUpperCase();if(M.data&&M.processData&&typeof M.data!=="string"){M.data=o.param(M.data)}if(M.dataType=="jsonp"){if(G=="GET"){if(!M.url.match(F)){M.url+=(M.url.match(/\?/)?"&":"?")+(M.jsonp||"callback")+"=?"}}else{if(!M.data||!M.data.match(F)){M.data=(M.data?M.data+"&":"")+(M.jsonp||"callback")+"=?"}}M.dataType="json"}if(M.dataType=="json"&&(M.data&&M.data.match(F)||M.url.match(F))){W="jsonp"+r++;if(M.data){M.data=(M.data+"").replace(F,"="+W+"$1")}M.url=M.url.replace(F,"="+W+"$1");M.dataType="script";l[W]=function(X){V=X;I();L();l[W]=g;try{delete l[W]}catch(Y){}if(H){H.removeChild(T)}}}if(M.dataType=="script"&&M.cache==null){M.cache=false}if(M.cache===false&&G=="GET"){var E=e();var U=M.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+E+"$2");M.url=U+((U==M.url)?(M.url.match(/\?/)?"&":"?")+"_="+E:"")}if(M.data&&G=="GET"){M.url+=(M.url.match(/\?/)?"&":"?")+M.data;M.data=null}if(M.global&&!o.active++){o.event.trigger("ajaxStart")}var Q=/^(\w+:)?\/\/([^\/?#]+)/.exec(M.url);if(M.dataType=="script"&&G=="GET"&&Q&&(Q[1]&&Q[1]!=location.protocol||Q[2]!=location.host)){var H=document.getElementsByTagName("head")[0];var T=document.createElement("script");T.src=M.url;if(M.scriptCharset){T.charset=M.scriptCharset}if(!W){var O=false;T.onload=T.onreadystatechange=function(){if(!O&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){O=true;I();L();T.onload=T.onreadystatechange=null;H.removeChild(T)}}}H.appendChild(T);return g}var K=false;var J=M.xhr();if(M.username){J.open(G,M.url,M.async,M.username,M.password)}else{J.open(G,M.url,M.async)}try{if(M.data){J.setRequestHeader("Content-Type",M.contentType)}if(M.ifModified){J.setRequestHeader("If-Modified-Since",o.lastModified[M.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}J.setRequestHeader("X-Requested-With","XMLHttpRequest");J.setRequestHeader("Accept",M.dataType&&M.accepts[M.dataType]?M.accepts[M.dataType]+", */*":M.accepts._default)}catch(S){}if(M.beforeSend&&M.beforeSend(J,M)===false){if(M.global&&!--o.active){o.event.trigger("ajaxStop")}J.abort();return false}if(M.global){o.event.trigger("ajaxSend",[J,M])}var N=function(X){if(J.readyState==0){if(P){clearInterval(P);P=null;if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}}else{if(!K&&J&&(J.readyState==4||X=="timeout")){K=true;if(P){clearInterval(P);P=null}R=X=="timeout"?"timeout":!o.httpSuccess(J)?"error":M.ifModified&&o.httpNotModified(J,M.url)?"notmodified":"success";if(R=="success"){try{V=o.httpData(J,M.dataType,M)}catch(Z){R="parsererror"}}if(R=="success"){var Y;try{Y=J.getResponseHeader("Last-Modified")}catch(Z){}if(M.ifModified&&Y){o.lastModified[M.url]=Y}if(!W){I()}}else{o.handleError(M,J,R)}L();if(X){J.abort()}if(M.async){J=null}}}};if(M.async){var P=setInterval(N,13);if(M.timeout>0){setTimeout(function(){if(J&&!K){N("timeout")}},M.timeout)}}try{J.send(M.data)}catch(S){o.handleError(M,J,null,S)}if(!M.async){N()}function I(){if(M.success){M.success(V,R)}if(M.global){o.event.trigger("ajaxSuccess",[J,M])}}function L(){if(M.complete){M.complete(J,R)}if(M.global){o.event.trigger("ajaxComplete",[J,M])}if(M.global&&!--o.active){o.event.trigger("ajaxStop")}}return J},handleError:function(F,H,E,G){if(F.error){F.error(H,E,G)}if(F.global){o.event.trigger("ajaxError",[H,F,G])}},active:0,httpSuccess:function(F){try{return !F.status&&location.protocol=="file:"||(F.status>=200&&F.status<300)||F.status==304||F.status==1223}catch(E){}return false},httpNotModified:function(G,E){try{var H=G.getResponseHeader("Last-Modified");return G.status==304||H==o.lastModified[E]}catch(F){}return false},httpData:function(J,H,G){var F=J.getResponseHeader("content-type"),E=H=="xml"||!H&&F&&F.indexOf("xml")>=0,I=E?J.responseXML:J.responseText;if(E&&I.documentElement.tagName=="parsererror"){throw"parsererror"}if(G&&G.dataFilter){I=G.dataFilter(I,H)}if(typeof I==="string"){if(H=="script"){o.globalEval(I)}if(H=="json"){I=l["eval"]("("+I+")")}}return I},param:function(E){var G=[];function H(I,J){G[G.length]=encodeURIComponent(I)+"="+encodeURIComponent(J)}if(o.isArray(E)||E.jquery){o.each(E,function(){H(this.name,this.value)})}else{for(var F in E){if(o.isArray(E[F])){o.each(E[F],function(){H(F,this)})}else{H(F,o.isFunction(E[F])?E[F]():E[F])}}}return G.join("&").replace(/%20/g,"+")}});var m={},n,d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function t(F,E){var G={};o.each(d.concat.apply([],d.slice(0,E)),function(){G[this]=F});return G}o.fn.extend({show:function(J,L){if(J){return this.animate(t("show",3),J,L)}else{for(var H=0,F=this.length;H<F;H++){var E=o.data(this[H],"olddisplay");this[H].style.display=E||"";if(o.css(this[H],"display")==="none"){var G=this[H].tagName,K;if(m[G]){K=m[G]}else{var I=o("<"+G+" />").appendTo("body");K=I.css("display");if(K==="none"){K="block"}I.remove();m[G]=K}o.data(this[H],"olddisplay",K)}}for(var H=0,F=this.length;H<F;H++){this[H].style.display=o.data(this[H],"olddisplay")||""}return this}},hide:function(H,I){if(H){return this.animate(t("hide",3),H,I)}else{for(var G=0,F=this.length;G<F;G++){var E=o.data(this[G],"olddisplay");if(!E&&E!=="none"){o.data(this[G],"olddisplay",o.css(this[G],"display"))}}for(var G=0,F=this.length;G<F;G++){this[G].style.display="none"}return this}},_toggle:o.fn.toggle,toggle:function(G,F){var E=typeof G==="boolean";return o.isFunction(G)&&o.isFunction(F)?this._toggle.apply(this,arguments):G==null||E?this.each(function(){var H=E?G:o(this).is(":hidden");o(this)[H?"show":"hide"]()}):this.animate(t("toggle",3),G,F)},fadeTo:function(E,G,F){return this.animate({opacity:G},E,F)},animate:function(I,F,H,G){var E=o.speed(F,H,G);return this[E.queue===false?"each":"queue"](function(){var K=o.extend({},E),M,L=this.nodeType==1&&o(this).is(":hidden"),J=this;for(M in I){if(I[M]=="hide"&&L||I[M]=="show"&&!L){return K.complete.call(this)}if((M=="height"||M=="width")&&this.style){K.display=o.css(this,"display");K.overflow=this.style.overflow}}if(K.overflow!=null){this.style.overflow="hidden"}K.curAnim=o.extend({},I);o.each(I,function(O,S){var R=new o.fx(J,K,O);if(/toggle|show|hide/.test(S)){R[S=="toggle"?L?"show":"hide":S](I)}else{var Q=S.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),T=R.cur(true)||0;if(Q){var N=parseFloat(Q[2]),P=Q[3]||"px";if(P!="px"){J.style[O]=(N||1)+P;T=((N||1)/R.cur(true))*T;J.style[O]=T+P}if(Q[1]){N=((Q[1]=="-="?-1:1)*N)+T}R.custom(T,N,P)}else{R.custom(T,S,"")}}});return true})},stop:function(F,E){var G=o.timers;if(F){this.queue([])}this.each(function(){for(var H=G.length-1;H>=0;H--){if(G[H].elem==this){if(E){G[H](true)}G.splice(H,1)}}});if(!E){this.dequeue()}return this}});o.each({slideDown:t("show",1),slideUp:t("hide",1),slideToggle:t("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(E,F){o.fn[E]=function(G,H){return this.animate(F,G,H)}});o.extend({speed:function(G,H,F){var E=typeof G==="object"?G:{complete:F||!F&&H||o.isFunction(G)&&G,duration:G,easing:F&&H||H&&!o.isFunction(H)&&H};E.duration=o.fx.off?0:typeof E.duration==="number"?E.duration:o.fx.speeds[E.duration]||o.fx.speeds._default;E.old=E.complete;E.complete=function(){if(E.queue!==false){o(this).dequeue()}if(o.isFunction(E.old)){E.old.call(this)}};return E},easing:{linear:function(G,H,E,F){return E+F*G},swing:function(G,H,E,F){return((-Math.cos(G*Math.PI)/2)+0.5)*F+E}},timers:[],fx:function(F,E,G){this.options=E;this.elem=F;this.prop=G;if(!E.orig){E.orig={}}}});o.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(o.fx.step[this.prop]||o.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(F){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var E=parseFloat(o.css(this.elem,this.prop,F));return E&&E>-10000?E:parseFloat(o.curCSS(this.elem,this.prop))||0},custom:function(I,H,G){this.startTime=e();this.start=I;this.end=H;this.unit=G||this.unit||"px";this.now=this.start;this.pos=this.state=0;var E=this;function F(J){return E.step(J)}F.elem=this.elem;if(F()&&o.timers.push(F)&&!n){n=setInterval(function(){var K=o.timers;for(var J=0;J<K.length;J++){if(!K[J]()){K.splice(J--,1)}}if(!K.length){clearInterval(n);n=g}},13)}},show:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());o(this.elem).show()},hide:function(){this.options.orig[this.prop]=o.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(H){var G=e();if(H||G>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var E=true;for(var F in this.options.curAnim){if(this.options.curAnim[F]!==true){E=false}}if(E){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(o.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){o(this.elem).hide()}if(this.options.hide||this.options.show){for(var I in this.options.curAnim){o.attr(this.elem.style,I,this.options.orig[I])}}this.options.complete.call(this.elem)}return false}else{var J=G-this.startTime;this.state=J/this.options.duration;this.pos=o.easing[this.options.easing||(o.easing.swing?"swing":"linear")](this.state,J,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};o.extend(o.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(E){o.attr(E.elem.style,"opacity",E.now)},_default:function(E){if(E.elem.style&&E.elem.style[E.prop]!=null){E.elem.style[E.prop]=E.now+E.unit}else{E.elem[E.prop]=E.now}}}});if(document.documentElement.getBoundingClientRect){o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}var G=this[0].getBoundingClientRect(),J=this[0].ownerDocument,F=J.body,E=J.documentElement,L=E.clientTop||F.clientTop||0,K=E.clientLeft||F.clientLeft||0,I=G.top+(self.pageYOffset||o.boxModel&&E.scrollTop||F.scrollTop)-L,H=G.left+(self.pageXOffset||o.boxModel&&E.scrollLeft||F.scrollLeft)-K;return{top:I,left:H}}}else{o.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return o.offset.bodyOffset(this[0])}o.offset.initialized||o.offset.initialize();var J=this[0],G=J.offsetParent,F=J,O=J.ownerDocument,M,H=O.documentElement,K=O.body,L=O.defaultView,E=L.getComputedStyle(J,null),N=J.offsetTop,I=J.offsetLeft;while((J=J.parentNode)&&J!==K&&J!==H){M=L.getComputedStyle(J,null);N-=J.scrollTop,I-=J.scrollLeft;if(J===G){N+=J.offsetTop,I+=J.offsetLeft;if(o.offset.doesNotAddBorder&&!(o.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(J.tagName))){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}F=G,G=J.offsetParent}if(o.offset.subtractsBorderForOverflowNotVisible&&M.overflow!=="visible"){N+=parseInt(M.borderTopWidth,10)||0,I+=parseInt(M.borderLeftWidth,10)||0}E=M}if(E.position==="relative"||E.position==="static"){N+=K.offsetTop,I+=K.offsetLeft}if(E.position==="fixed"){N+=Math.max(H.scrollTop,K.scrollTop),I+=Math.max(H.scrollLeft,K.scrollLeft)}return{top:N,left:I}}}o.offset={initialize:function(){if(this.initialized){return}var L=document.body,F=document.createElement("div"),H,G,N,I,M,E,J=L.style.marginTop,K='<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>';M={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(E in M){F.style[E]=M[E]}F.innerHTML=K;L.insertBefore(F,L.firstChild);H=F.firstChild,G=H.firstChild,I=H.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(G.offsetTop!==5);this.doesAddBorderForTableAndCells=(I.offsetTop===5);H.style.overflow="hidden",H.style.position="relative";this.subtractsBorderForOverflowNotVisible=(G.offsetTop===-5);L.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(L.offsetTop===0);L.style.marginTop=J;L.removeChild(F);this.initialized=true},bodyOffset:function(E){o.offset.initialized||o.offset.initialize();var G=E.offsetTop,F=E.offsetLeft;if(o.offset.doesNotIncludeMarginInBodyOffset){G+=parseInt(o.curCSS(E,"marginTop",true),10)||0,F+=parseInt(o.curCSS(E,"marginLeft",true),10)||0}return{top:G,left:F}}};o.fn.extend({position:function(){var I=0,H=0,F;if(this[0]){var G=this.offsetParent(),J=this.offset(),E=/^body|html$/i.test(G[0].tagName)?{top:0,left:0}:G.offset();J.top-=j(this,"marginTop");J.left-=j(this,"marginLeft");E.top+=j(G,"borderTopWidth");E.left+=j(G,"borderLeftWidth");F={top:J.top-E.top,left:J.left-E.left}}return F},offsetParent:function(){var E=this[0].offsetParent||document.body;while(E&&(!/^body|html$/i.test(E.tagName)&&o.css(E,"position")=="static")){E=E.offsetParent}return o(E)}});o.each(["Left","Top"],function(F,E){var G="scroll"+E;o.fn[G]=function(H){if(!this[0]){return null}return H!==g?this.each(function(){this==l||this==document?l.scrollTo(!F?H:o(l).scrollLeft(),F?H:o(l).scrollTop()):this[G]=H}):this[0]==l||this[0]==document?self[F?"pageYOffset":"pageXOffset"]||o.boxModel&&document.documentElement[G]||document.body[G]:this[0][G]}});o.each(["Height","Width"],function(I,G){var E=I?"Left":"Top",H=I?"Right":"Bottom",F=G.toLowerCase();o.fn["inner"+G]=function(){return this[0]?o.css(this[0],F,false,"padding"):null};o.fn["outer"+G]=function(K){return this[0]?o.css(this[0],F,false,K?"margin":"border"):null};var J=G.toLowerCase();o.fn[J]=function(K){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+G]||document.body["client"+G]:this[0]==document?Math.max(document.documentElement["client"+G],document.body["scroll"+G],document.documentElement["scroll"+G],document.body["offset"+G],document.documentElement["offset"+G]):K===g?(this.length?o.css(this[0],J):null):this.css(J,typeof K==="string"?K:K+"px")}})})(); \ No newline at end of file
diff --git a/js/jquery.karma.js b/js/jquery.karma.js
new file mode 100755
index 0000000..f4b99af
--- /dev/null
+++ b/js/jquery.karma.js
@@ -0,0 +1,1161 @@
+/*
+* Karma Framework
+* http://wiki.sugarlabs.org/go/Karma
+*
+* Copyright (c) 2009
+* Felipe López Toledo zer.subzero@gmail.com
+* Bryan W Berry bryan@olenepal.org
+*
+* Under MIT License:
+* Permission is hereby granted, free of charge, to any person
+* obtaining a copy of this software and associated documentation
+* files (the "Software"), to deal in the Software without
+* restriction, including without limitation the rights to use,
+* copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following
+* conditions:
+*
+* The above copyright notice and this permission notice shall be
+* included in all copies or substantial portions of the Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+* OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+/**
+* @fileOverview Contains karma library
+* @version 0.1
+* @author Felipe Lopez Toledo <zer.subzero@gmail.com>
+*/
+
+
+/**
+ * See <a href="http://jquery.com">jQuery</a>.
+ * @class
+ * @name jQuery
+ * @exports $ as jQuery
+*/
+
+(function ($) {
+//helpers
+/**
+Checks if the argument 'arg' is set and if its type is 'type'.<br>
+1. if arg is set: it returns 'toReturn' if specified, otherwise it returns
+ 'true'
+2. if arg is not set: it returns 'false'
+@param arg The param to check
+@param {Object} [type] The expeted type of 'arg'
+@param [toReturn] object or value to return in case 1
+@returns true | false | toReturn
+@example
+var msg = "hi";
+valid(msg); //returns true
+valid(msg, "String" ); //returns true
+valid(msg, "Number"); //returns false
+valid(msg, "String",false ); //returns false
+valid(msg, "String", "hello" ); //returns "hello"
+valid(msg123); //returns false
+**/
+var valid = function ( arg, type, toReturn ) {
+ if ( type ) {
+ if ( typeof arg === type ) {
+ if ( toReturn )
+ return toReturn;
+ return true;
+ }
+ return false
+ }
+ if ( typeof arg !== "undefined" && arg!== "null" ) return true;
+ return false;
+}
+/**
+Clones an object
+@param {object} obj The source object
+@returns {object} The cloned object
+**/
+var clone = function( obj ){
+ if(obj == null || typeof(obj) != 'object')
+ return obj;
+ var temp = new obj.constructor();
+ for(var key in obj)
+ temp[ key ] = clone( obj[ key ] );
+ return temp;
+}
+
+/**
+Karma
+@name Karma
+@class Represents a Karma (master) object.
+@param {String | Object } options Constructor arguments
+@param {String | Object } [options.container] Target DIV-class that will contain
+ any canvas element created using Karma functions
+@param {String} [options.language]
+*/
+var Karma = function( options ) {
+ var that = this;
+ this.version = "0.01";
+ //
+ //relative path to the po, images, sounds, etc. from the html
+ //defined here: http://wiki.sugarlabs.org/go/Karma/Bundle_layout
+ //localized is recalculated inside localizeContent ( $ = language.lang )
+ this.paths = {
+ po: "po/",
+ images: {
+ localized: "assets/$/images/",
+ generic: "assets/generic/images/"
+ },
+ sounds: {
+ localized: "assets/$/sounds/",
+ generic: "assets/generic/sounds/"
+ },
+ videos: {
+ localized: "assets/$/videos/",
+ generic: "assets/generic/videos/"
+ }
+ };
+ this.supportedLangFileTypes = [
+ { ext: "po", type: 'application/x-po' },
+ { ext: "json", type: 'application/json'}
+ ];
+ //
+ //PRIVATE STUFF start
+ /**
+ Gets the language acording to the browser language
+ @returns {Object} <br>
+ lang: countryCode and langCode (if specified)
+ langCode*: language code represented as xx, example: en.<br>
+ countryCode*: country code represented as YY, example: US.<br>
+ *optional
+ **/
+ var getLanguage = function () {
+ //console.log += navigator.language +"\n";
+ var lang = navigator.language || navigator.browserLanguage; //mozilla/ie
+ lang = lang.replace(/_/, '-').toLowerCase();
+ if (lang.length > 3 ) {
+ var country = lang.substring(3, 5);
+ lang = lang.substring(0, 2);
+ if ( country.match(/[^a-zA-Z]/) === null ) {
+ country = country.toUpperCase();
+ return {
+ "lang": lang + "-" + country,
+ "langCode": lang,
+ "countryCode": country
+ };
+ }
+ }
+ return { "lang": lang };
+ }
+ /**
+ Creates a new Gettext object and returns a shortcut function to localise
+ defined strings.<br>We use karma.Gettext.js it's a modification of
+ <a href=http://jsgettext.berlios.de/doc/html/Gettext.html>
+ Gettext.js</a> from beril OS.
+ @requires karma.Gettext.js
+ @param {Object} options The arguments of the Gettext constructor
+ @returns {Function} A generic function to call Gettext functions
+ **/
+ var i18nWrapper = function ( options ) {
+ var gt = new Gettext( options );
+ if ( typeof ( gt ) === 'undefined' )
+ throw new Error("Unable to initialize Gettext object");
+ return (function (str1, str2, str3, str4 ) {
+ var n, context, singular, plural;
+ if (typeof(str4) != 'undefined') {
+ // number, context, singular, plural
+ return gt.npgettext(str2, str3, str4, str1);
+ } else if (typeof(str3) != 'undefined') {
+ // number, singular, plural
+ return gt.ngettext(str2, str3, str1);
+ } else if (typeof(str2) != 'undefined') {
+ // context, msgid
+ return gt.pgettext(str1, str2);
+ } else if (typeof(str1) != 'undefined') {
+ // msgid
+ return gt.gettext(str1);
+ } else {
+ // nothing passed in; return blank string.
+ // XXX: we could error here, but that may cause more harm than good.
+ return '';
+ }
+ });
+ };
+ /**
+ Localises the inline html content and it creates the localised paths for
+ "images", "sounds" and "videos".
+ <b>Note:</b>Inline html localisation under development<br>
+ @param {String} lang The language that will be used to localise the content
+ @see <a href="http://wiki.sugarlabs.org/go/Karma/Bundle_layout">
+ Karma Bundle_layout</a>
+ **/
+ var localiseContent = function ( lang ) {
+
+ var toFix = ["images", "sounds", "videos"];
+ for (var i = 0; i < toFix.length; i++) {
+ that.paths[ toFix[ i ] ].localized = that.paths[
+ toFix[ i ] ].localized.replace('\$', lang );
+ }
+ //dirty hack to support {lang}_AudioFile
+ var prefix = lang+"_";
+ that.paths[ "sounds" ].localized+=prefix;
+ }
+ /**
+ It will attempt to load a language file, the posible languages are defined
+ on language.alternatives.
+ <p>The language file type could be: .po (Pootle) or .json (JSON). The
+ precedence between file types is defined according to which is defined first
+ in supportedLangFileTypes. By default Pootle files has precedence over JSON,
+ files.</p>
+ @see Karma
+ @returns {String} The name of the language file loaded. Example: en-US.po
+ **/
+ var loadAlternatives = function ( ) {
+ var loaded = undefined;
+ var tryNext = true;
+ //try to load the po or json language file if it exists.
+ //the lang order is acording to options.language.alternatives
+ //the type (po or json or ...) is defined in supportedLangFileTypes
+ $.each( that.language.alternatives, function ( c, lang ) {
+ for (var i=0; i < that.supportedLangFileTypes.length
+ && tryNext === true; i++) {
+ $.ajax({
+ url: that.paths.po + lang + "." +
+ that.supportedLangFileTypes[i].ext,
+ cache: true,
+ dataType: "text",
+ async: false, //important: touch it at your own risk
+ success: function( data, textStatus ){
+
+ loaded = lang + "." +
+ that.supportedLangFileTypes[i].ext;
+ //i18n
+ //we pass the data so we avoid re-loading the file
+ //creates the shorcout
+ that.i18n.root[ that.i18n.shortcut ] = i18nWrapper(
+ {
+ domain : lang,
+ file : {
+ type: that.supportedLangFileTypes[i].type,
+ uri: this.url, data: data
+ }
+ }
+ );
+ localiseContent( lang );
+ tryNext = false;
+ },
+ error: function ( XHR, textStatus, errorThrown ) {
+ //the file doesn't exist or it wasn't possible to load it
+ tryNext = true;
+ }
+ });
+ return tryNext;
+ }
+ });
+ return loaded;
+ }
+ //PRIVATE STUFF end
+ // default options
+ var defaultOptions ={
+ container: "#karma-main",
+ language: {
+ lang: undefined,
+ alternatives: ['en-US', 'en'],
+ countryCode: undefined,
+ langCode: undefined,
+ },
+ i18n: {
+ root: self, // self is global
+ shortcut: "_"
+ }
+ };
+ //
+ this.library = { "images": [], "sounds": [], "videos":[], "shapes":[] };
+
+ //initializes the defaultOptions argument
+ //1 argument: string. assume it's the container
+ if ( typeof options === "string" ) {
+ options = { container: options };
+ options.language = getLanguage() ;
+ } else if (typeof options === "object" ){
+ if ( typeof options.lang === "string" ) {
+ //if language is string, assume it's the language.lang
+ options.language = { lang: options.lang };
+ }
+ }
+ $.extend( true, defaultOptions, options );
+ //
+ //copy defaultOptions to this, we use this.xyz instead this.defaultOptions.xyz
+ for (var i in defaultOptions ) {
+ this[ i ] = defaultOptions[i];
+ }
+
+ //initializes i18n
+ //add the localized language to the language.alternatives
+ if ( typeof this.language.countryCode !== "undefined" ) {
+ this.language.alternatives.unshift(
+ this.language.langCode,
+ this.language.countryCode
+ );
+ }
+ if ( typeof this.language.lang !== "undefined" ) {
+ this.language.alternatives.unshift( this.language.lang );
+ }
+ //try to load the localized lang file (po or json or ...)
+ this.language.fileLoaded = loadAlternatives( );
+ //initializes the container
+ if ( typeof this.container === "string" ) {
+ this.container = $( this.container )[ 0 ];
+ if ( !valid(this.container) ) delete this.container;
+ }
+
+ gk = {
+ "paths": this.paths
+ }
+ this.surfaces = {};
+}
+
+/**
+@memberOf Karma
+@namespace Geometry functions.
+**/
+Karma.prototype.geometry = {
+ /**
+ Converts a value from degrees to radians.
+ @param {Number} angle The angle in degrees
+ @returns {Number} The The angle in radians
+ **/
+ radians : function( angle ){
+ return ( angle / 180 ) * Math.PI;
+ },
+ /**
+ Gets the square of the Euclidian (ordinary) distance between 2 points.
+ @param {Number} Point Point No. 0
+ @param {Number} Point Point No. 1
+ @returns {Number} The square of the Euclidian distance
+ **/
+ distance2 : function ( p0, p1 ) {
+ return (p1.x - p0.x) * (p1.x - p0.x) + (p1.y - p1.y) * (p1.y - p1.y);
+ },
+ /**
+ Gets the Euclidian (ordinary) distance between 2 points.<br>
+ <b>Warning:</b> It's slower than distance2 function
+ @param {Number} Point Point No. 0
+ @param {Number} Point Point No. 1
+ @returns {Number} The Euclidian distance
+ **/
+ distance : function ( p0, p1 ) {
+ return Math.sqrt( Karma.prototype.geometry.distance2( p0, p1 ) );
+ }
+}
+/**
+@memberOf Karma
+@namespace Graphics functions.
+**/
+Karma.prototype.graphics = {
+ /**
+ Creates a new rectangle. It's a shortcut for calling 'new KRectangle(..)'.
+ **/
+ rectangle: function ( args ) { return new KRectangle( args ); },
+ /**
+ Creates a new circle. It's a shortcut for calling 'new KCircle(..)'.
+ **/
+ circle: function ( args ) { return new KCircle( args ); }
+}
+/**
+@memberOf Karma
+@namespace Math functions.
+**/
+Karma.prototype.math = {
+ /**
+ Generates a random bumber between lower bound and upper bound inclusive.
+ @param {Number} lower The lower bound
+ @param {Number} upper The upper bound
+ @returns {Number} The generated number
+ **/
+ rand : function ( lower, upper ){
+ return Math.round ( Math.random() * (upper - lower) + lower );
+ }
+}
+//FIXME
+//everything inside karma.graphics is exported to karma.prototype
+$.extend( Karma.prototype, Karma.prototype.graphics);
+//
+/**
+@param {Object} [toLoad] The Object that has the arrays for preloading.
+@param {Array} [toLoad.images] The images
+@param {Array} [toLoad.sounds] The sounds
+@param {Array} [toLoad.videos] The videos
+@memberOf Karma
+@returns {Object} this
+**/
+Karma.prototype.init = function( toLoad ) {
+ this.pendingToLoad = toLoad;
+ return this; //chaining :)
+}
+
+/**
+Main function. Any Karma function call should be inside the callback function.
+The callback function will be executed when the preloading finishes.
+@param {Function} cb The callback funtion
+@memberOf Karma
+@see Karma#init
+**/
+Karma.prototype.main = function ( cb ) {
+ if ( valid( this.pendingToLoad ) ) {
+ //loader
+ var loaderDiv = $("body").append('<div id=\"karma-loader\">Karma is \
+ loading ...<div id=\"karma-loader\" class=\"status\"></div></div>');
+ var statusDiv = $("#karma-loader .status");
+
+ var statusUpdate = function ( current, error, total) {
+ statusDiv.html(current + "/" + total + (error > 0 ? " [ "+error+" ]":''));
+ }
+
+ var that = this;
+ var categories = ["images", "sounds", "videos" ];
+ var counters = { "loaded":0, "error": 0 };
+ var totalItems = 0;
+ //creates the surfaces
+ if ( valid( this.pendingToLoad[ "surfaces" ] ) ) {
+ $.each (this.pendingToLoad[ "surfaces" ], function( key, config ){
+ Karma.prototype.surface.call( that, config );
+ });
+ }
+ statusUpdate( 0, 0, totalItems);
+ //get the total items
+ for ( var i=0; i < categories.length; i++ ) {
+ if ( valid ( this.pendingToLoad[ categories[ i ] ] ) ) {
+ totalItems += this.pendingToLoad[ categories[ i ] ].length;
+ }
+ }
+
+ /**
+ callback to check if all the items were loaded or got an error when
+ loading
+ **/
+ var errors=[];
+ var checkAllLoaded = function ( ev ) {
+ if ( ev.type === "load") counters.loaded += 1;
+ else {
+ errors.push( ev.target.src );
+ counters.error += 1;
+ }
+ statusUpdate( counters.loaded, counters.error, totalItems);
+ if ( counters.loaded + counters.error === totalItems ) {
+ if ( counters.error > 0 ){
+ throw ( "Media files not found: " + errors );
+ }
+ $("#karma-loader:hiden:first").fadeOut("slow",function(){
+ $(this).remove();});
+ if ( cb ) cb();
+ }
+ }
+
+ for ( var i=0; i < categories.length; i++ ) {
+ var category = categories[ i ];
+ if ( valid ( this.pendingToLoad[ category ] ) ) {
+ //load all the category elements
+ var type = category.substr( 0, category.length-1 )
+ $.each (this.pendingToLoad[ category ], function( key, config ){
+ var name = config.name;
+ delete config.name;
+ //register the elements into the library
+ that.library[ category ][ name ] = Karma.prototype[ type ](
+ config
+ );
+ that.library[ category ][ name ].media.addEventListener(
+ "load",checkAllLoaded,false
+ );
+ that.library[ category ][ name ].media.addEventListener(
+ "error",checkAllLoaded,false
+ );
+ });
+ }
+ }
+ }else {
+ if ( cb ) cb();
+ }
+}
+/**
+A shortcut for calling 'KImage( )'
+@see KImage
+@memberOf Karma
+@returns {Object} new instance of KImage object
+**/
+Karma.prototype.image = function ( args ) { return new KImage( args ) };
+/**
+A shortcut for calling 'KSound( )'
+@see KSound
+@memberOf Karma
+@returns {Object} new instance of KSound object
+**/
+Karma.prototype.sound = function ( args ) { return new KSound( args ) };
+/**
+A shortcut for calling 'KVideo( )'
+@see KVideo
+@memberOf Karma
+@returns {Object} new instance of KVideo object
+**/
+Karma.prototype.video = function ( args ) { alert("Not implemented yet"); };
+/**
+A shortcut for calling 'KGroup( )'
+@see KGroup
+@memberOf Karma
+@returns {Object} new instance of KGroup object
+**/
+Karma.prototype.group = function ( args ) { return new KGroup( args ) };
+/**
+A shortcut for calling 'KButton( )'
+@see KButton
+@memberOf Karma
+@returns {Object} new instance of KButton object
+**/
+Karma.prototype.button = function ( args ) { return new KButton( args ) };
+/**
+A shortcut for calling 'KSurface(.. )'.
+@see KSurface
+@memberOf Karma
+@returns {Object} new instance of KSurface object
+**/
+Karma.prototype.surface = function ( options ) {
+ if ( !valid(options, "object") ){
+ var options = { name: "ksurface-"+ ( this.surfaces.length + 1 ) };
+ }
+ options.mainContainer = this.container;
+ options.paths = this.paths;
+ this.surfaces[ options.name ] = new KSurface( options );
+ return this.surface[ options.name ];
+}
+
+/**
+Mouse
+**/
+var mouse = {};
+/**
+Gets the 'x' and 'y' mouse coordinates relatives to the canvas
+@returns {Object} An Object with 'x' and 'y' attributes
+**/
+mouse.getRelativeCanvasPosition = function ( ev ) {
+ if ( !ev ) return;
+ var xy ={x:0, y:0};
+ xy.x = ev.layerX;
+ xy.y = ev.layerY;
+ return xy;
+}
+
+//Events stuff
+var master ={}
+master.buttons =[];
+var handleEvents = function( ev ) {
+ var xy = mouse.getRelativeCanvasPosition( ev );
+ for (var i in master.buttons) {
+ if (master.buttons[i].isPointInPath( xy.x, xy.y) ){
+ master.buttons[i].onClick( ev );
+ }
+ }
+ /*switch(ev.type){
+ case "click": break;
+ }*/
+ /*var s="";
+ for (var i in ev) {
+ s+=i+"="+ev[i]+"\n";
+ }
+ alert(s);*/
+};
+
+/**
+Master class creator. It will merge all the properties and methods of the
+recived arguments (objects) into one new class that wil be returned.
+@returns {Object} The new class
+**/
+var Class = function ( ) {
+ var log="";
+ var parents = [];
+ for ( var i = 0; i < arguments.length; i++ ) {
+ if ( arguments[i].prototype && arguments[i].init ) {
+ parents.push( arguments[i].init );
+ }
+ }
+ var o = function ( ) {
+ //we inject all the init functions
+ /*for ( var i = 0; i < this.__parents.length; i++ ) {
+ this.__parents[ i ].apply ( this, arguments );
+ }*/
+ //call the real class init
+ if ( this.init )
+ this.init.apply( this, arguments );
+ };
+
+ o.prototype ={};
+ var a;
+ for ( var i =0; i < arguments.length; i++) {
+ a = arguments[i];
+ log += "**" + typeof a+"\n";
+ //if ( a === "function") {
+ if (a.prototype) {
+ for ( var j in a.prototype ) {
+ //log += j+" = "+a.prototype[j]+"\n";
+ o[ j ] = o.prototype[ j ] = a.prototype [ j ];
+ }
+ }
+ else {
+ //if ( typeof a === "object") {
+ for (var j in a) {
+ //log += j+" = "+a[j]+"\n";
+ o[ j ] = o.prototype[ j ] = a [ j ];
+ }
+ }
+
+ }
+ o.prototype.__parents = parents;
+ //alert( log );
+ return o; //(function ( ) { return new o( arguments );});
+};
+
+/**
+Creates a new surface. A surface is a 'canvas' element with additional methods
+that makes easier its manipulation. <br>
+There are 2 ways to create a new KSurface:
+<ol>
+ <li><b>Using an existing canvas element:</b>You must provide at least
+ the 'canvas' parameter. The 'name' is optional (if it's not provided the
+ 'canvas' parameter will be used).
+ </li>
+ <li><b>Creating a new canvas element:</b> A new 'canvas' element will be
+ created and it will be appended to the specific 'container'.
+ You must provide at least the 'name' and 'container' parameters.
+ </li>
+</ol>
+@class KSurface class
+@param {object} options Constructor options.
+@param {string} [options.name] The desired name for the surface. The value must
+ be unique among others KSurfaces-name objects.
+@param {string} [options.canvas] The name of the element. Commonly the
+ canvas-id value.
+@param {string | object} [options.container] The the name of the container
+ element. Commonly a div-id value.
+@param {number} [width=100] The width of the canvas.
+@param {number} [height=100] The height of the canvas.
+@param {number} [fps=24] The frames per second for any refresh operation.
+@param {boolean} [visible=true] 'true' if the content is visible (will be drawn).
+@memberOf_ Karma
+**/
+var KSurface = Class(
+ {
+ init: function( options ){
+ //fix the container
+ if ( valid( options.container, "string" ) && !valid( options.canvas)
+ ) {
+ var name=options.container;
+ options.container = $( options.container )[ 0 ];
+ if ( !valid (options.container) ){
+ // the container must be created inside the mainContainer
+ if ( !valid( options.mainContainer ) ){
+ throw ("You need to create the Karma master container");
+ }
+ var div = document.createElement("div");
+ div.id = name;
+ options.container=options.mainContainer.appendChild( div );
+ }
+ }else {
+ if ( !valid( options.mainContainer ) ){
+ throw ("You need to create the Karma master container");
+ }
+ options.container = options.mainContainer;
+ }
+
+ var defaultOptions = {
+ //mainContainer: '',//must be overwritten by Karma.container
+ name: '',//must be overwritten by the Karma.surface OR user
+ container: '', //must be overwritten by Karma.container OR user
+
+ width: 100,
+ height: 100,
+ fps: 24,
+ visible: true
+ }
+ $.extend( this, defaultOptions, options);
+
+ if ( !this.canvas ) {
+ this.canvas = document.createElement("canvas");
+ this.canvas.width = this.width;
+ this.canvas.height = this.height;
+ this.canvas.id = this.name;
+ this.container.appendChild( this.canvas );
+ }else {
+ this.canvas = document.getElementById( options.canvas );
+ if ( !this.canvas ){
+ throw new Error ("The canvas id doesn't exist");
+ }
+ this.width = this.canvas.width;
+ this.height = this.canvas.height;
+ if (!this.name){
+ this.name = this.canvas.id;
+ }
+ }
+ if ( this.canvas.getContext ) {
+ this.ctx = this.canvas.getContext("2d");
+ }else {
+ throw new Error ("Your browser doesn't support canvas, \
+ try the newest Firefox, Safari or Google Chrome");
+ }
+ //ctx methods chaining stuff
+ var toChain = [
+ "globalAlpha", "globalCompositeOperation", "lineWidth", "lineCap",
+ "lineJoin", "miterLimit", "font", "textAlign", "textBaseline", "save",
+ "restore", "scale", "rotate", "translate", "transform", "setTransform",
+ "clearRect", "fillRect", "strokeRect", "beginPath", "closePath",
+ "moveTo", "lineTo", "quadraticCurveTo", "bezierCurveTo", "arcTo",
+ "arc", "rect", "fill", "stroke", "clip", "fillText", "strokeText",
+ "measureText", "isPointInPath", "strokeStyle", "fillStyle",
+ "createLinearGradient", "createRadialGradient", "createPattern",
+ "shadowOffsetX", "shadowOffsetY", "shadowBlur", "shadowColor",
+ //"mozTextStyle", "mozDrawText", "mozMeasureText", "mozPathText",
+ "mozTextAlongPath", "drawImage", "getImageData", "putImageData",
+ "createImageData", "drawWindow"
+ ];
+ var that=this;
+ var chainMaker = function ( name ){
+ that[ name ] = function ( ){
+ var type = typeof that.ctx[name];
+ if ( type === "function") {
+ that.ctx[ name ].apply( that.ctx, arguments );
+ }else if ( type === "string" ){
+ that.ctx[ name ] = arguments[0];
+ }else {
+ throw ("wtf?!: impossible to chain " + name + "!");
+ }
+ return that;
+ }
+ }
+ for (var i=0; i<toChain.length; i++){
+ chainMaker( toChain[ i ] );
+ }
+
+
+ //events
+ this.canvas.addEventListener("contextmenu", function(ev){
+ //
+ },false
+ );
+ this.canvas.addEventListener("click",
+ handleEvents,
+ false
+ );
+
+ },
+ /**
+ Adds an event listener to the surface
+ @param {string} type Event type
+ @param {function} cb Function call back
+ @param {boolean} [bubble=false] If the event must be captured on
+ bubbling phase
+ **/
+ addEventListener : function ( type, cb, bubble ) {
+ this.canvas.addEventListener( type, cb, bubble || false );
+ },
+ /**
+ Removes an event listener attached to the surface
+ @param {string} type Event type
+ @param {function} cb Function call back
+ @param {boolean} [bubble=false] If the event must be captured on
+ bubbling phase
+ **/
+ removeEventListener : function ( type, cb, bubble ) {
+ this.canvas.removeEventListener( type, cb, bubble || false );
+ },
+ /**
+ Clears a rectangular area within the canvas
+ @param {Number} [x=0] Start position of x
+ @param {Number} [y=0] Start position of y
+ @param {Number} [width=canvas width] Square width
+ @param {Number} [height=canvas height] Square height
+ **/
+ clear : function ( x, y, width, height ) {
+ this.ctx.clearRect(
+ x || 0,
+ y || 0,
+ width || this.width,
+ height || this.height
+ );
+ return this;
+ },
+ draw: function ( ) {
+
+ }
+ }
+);
+
+/**
+Karma basic Object
+@class The basic Karma object
+@param {Object} [options] Options
+@param {String} [options.localized = true] The object will be localized
+@memberOf_ Karma
+**/
+var KObject = Class(
+ {
+ init: function ( options ) {
+ if ( valid(options.localized, "boolean" ) ) {
+ this.localized = options.localized;
+ }else {
+ this.localized = true;
+ }
+ }
+ }
+);
+/**
+Graphics basic Object
+@class General methods for any Graphic object
+@param {object} [options] Options
+@param {number} [options.x = 0] The 'x' position of the object
+@param {number} [options.y = 0] The 'y' position of the object
+@param {number} [options.z = 0] The 'z' index of the object
+@param {number} [options.width = 0] The 'width' of the object
+@param {number} [options.height = 0] The 'height' of the object
+@param {boolean} [options.visible = true] Defines if the object will be visible
+ when drawing
+@augments KObject
+@memberOf_ Karma
+**/
+var KGraphic = Class(
+ KObject,
+ {
+ init: function ( options ) {
+ if ( valid( options.localized ) )
+ KObject.init.call(this, options.localized );
+ var defaultOptions = {
+ x : 0,
+ y : 0,
+ z : 0,
+ width: 0,
+ height: 0,
+ visible : true
+ }
+ $.extend( this, defaultOptions, options);
+ },
+ /**
+ @memberOf KGraphic
+ Determines if the 'x' and 'y' coodinates are inside the object.
+ @returns {boolean} 'true' if the coordinates are inside or on the border
+ of the object, otherwise 'false'
+ **/
+ isPointInPath : function( x, y ) {
+ return (this.x <= x && (this.x + this.width) >= x &&
+ this.y <= y && (this.y+this.width)>=y);
+ },
+ addEventListener : function (type, cb, bubble) {
+ //FIXME
+ }
+ }
+);
+/**
+An object that collects multiple KGraphic objects. Supports multiple objects.
+@class An object that collects multiple KGraphic objects
+@augments KGraphic
+@memberOf_ Karma
+**/
+var KGroup = Class(
+ KGraphic,
+ {
+ init: function ( options ) {
+ this.childNodes = [];
+ this.sorted = true;
+ },
+ /**
+ @memberOf KGroup
+ Adds each argument passed to the funtion to chilNodes.
+ @param {Array:KGraphic} arguments The elements to add to childNodes
+ @see KGroup#draw
+ **/
+ appendChild : function ( ) {
+ if ( arguments.length > 0 ) {
+ for ( var i = 0; i< arguments.length; i++) {
+ this.childNodes.push ( arguments[ i ] );
+ }
+ this.sorted = false;
+
+ }
+ },
+ removeChild: function () {
+ //FIXME
+ },
+ /**
+ @memberOf_ KGroup
+ Draws all the elements in childNodes. The elements are drawn according
+ to its 'z' (z-index) value.
+ @see KGroup#appendChild
+ **/
+ draw : function() {
+ if ( this.visible && this.childNodes.length > 0 ) {
+ if ( !this.sorted ) {
+ this.childNodes.sort ( function ( g1, g2 ) {
+ return g1.z - g2.z;
+ });
+ this.sorted = true;
+ }
+ for (var i in this.childNodes) {
+ this.childNodes[ i ].draw();
+ }
+ }
+ },
+ isPointInPath : function() {
+ //TODO
+ }
+
+ }
+);
+
+/**
+Graphics basic Media object.
+@class General methods for any Graphic object
+@param {String} file The name of the file that must be loaded
+@param {String} type 'image', 'sound' or 'video'
+@param {Object} [options] Options that will be passed to the media element
+ constructor
+@augments KObject
+@memberOf_ Karma
+**/
+var KMedia = Class(
+ KObject,
+ {
+ init: function (file, type, options ) {
+ if ( !file || !type ) {
+ throw new Error ("file and type needed");
+ }
+ if ( valid ( options ) )
+ KObject.init.call (this, options);
+
+ this.file = file;
+ this.type = type;
+
+ this.status = undefined;
+ this.path = undefined;
+ this.media = undefined;
+ switch ( this.type ) {
+ case "image": this.media = new Image(); break;
+ case "sound": this.media = new Audio(); break;
+ default: throw new Error ("Media type not supported");
+ }
+ this.path = gk.paths[ this.type + "s" ][
+ this.localized ? "localized": "generic"
+ ];
+ this.media.src = this.src = this.path + this.file;
+
+ var that = this;
+ this.media.addEventListener("load",
+ function (e) { that.status = "loaded";}, false);
+ this.media.addEventListener("error",
+ function (e) { that.status = "error";}, false);
+ this.media.addEventListener("abort",
+ function (e) { that.status = "aborted";}, false);
+ }
+ }
+);
+
+/**
+Image object
+@class General methods for any Image object
+@param {Object} options Constructor arguments.
+@param {Object} options.file The image file that will be loaded.
+@augments KGraphic
+@augments KMedia
+@memberOf_ Karma
+**/
+var KImage = Class(
+ KGraphic,
+ KMedia,
+ {
+ init: function ( options ) {
+ if ( valid ( options, "string" ) ) {
+ options = { file:options };
+ }
+ if ( valid( options ) ) {
+ KGraphic.init.call(this, options);
+ KMedia.init.call(this, options.file, "image", options );
+ }
+ var defaultOptions = {
+ //w : undefined,
+ //h : undefined,
+ };
+ $.extend( this, defaultOptions, options);
+ },
+ draw : function( ctx, x, y ) {
+ if ( this.visible && this.isReady() ) {
+ this.x = x || this.x;
+ this.y = y || this.y;
+ ctx.drawImage( this.media, this.x , this.y );
+ }
+ },
+ /**
+ Checks if the image has been loaded and fully decoded.
+ @returns {boolean} 'true' or 'false'
+ **/
+ isReady : function () {
+ if ( !this.media.complete ) return false;
+ if ( !this.media.naturalWidth || this.media.naturalWidth === 0)
+ return false;
+ return true;
+ }
+ }
+);
+
+/**
+Sound object
+@class General methods for any Sound object
+@param {Object} options Constructor arguments.
+@param {Object} options.file The image file that will be loaded.
+@augments KMedia
+@memberOf_ Karma
+**/
+var KSound = Class(
+ /**@lends_ KMedia*/
+ KMedia,
+ {
+ init: function( options ) {
+ if ( valid ( options, "string" ) ) {
+ options = { file: options };
+ }
+ if ( valid( options ) ) {
+ KMedia.init.call(this, options.file, "sound", options );
+ //next line is important!
+ this.media.load();
+ }
+ },
+ /**
+ Checks if the image has been loaded and fully decoded.
+ @returns {boolean} 'true' or 'false'
+ **/
+ isReady: function () {
+ return this.readyState === 4;
+ },
+ play: function (){
+ //hack to fix the audio "stuttering" problem
+ //more info: https://bugs.launchpad.net/karma/+bug/426108
+ this.media.currentTime = 0.1;
+ this.media.play();
+ }
+ }
+);
+
+/**
+Shape object
+@class General methods for any Shape object
+@param {object} options Constructor arguments.
+@param {boolean} [options.fill=true] 'true' if the Shape will be filled when
+ drawing.
+@param {boolean} [options.stroke=true] 'true' if the stroke will be drawn.
+@param {color|string} [options.fillStyle="#000"] The fill style of the shape.
+@param {color|string} [options.strokeStyle="#000"] The stroke style of the shape.
+@augments KMedia
+@memberOf_ Karma
+**/
+var KShape = Class(
+ /**@lends_ KGraphic*/
+ KGraphic,
+ {
+ init : function ( options ) {
+ if ( valid( options ) ) {
+ KGraphic.init.call(this, options );
+ }
+ var defaultOptions = {
+ fill: true,
+ stroke: true,
+ fillStyle: '#000',
+ strokeStyle: '#000',
+ openPath : false
+ }
+ $.extend( this, defaultOptions, options);
+ },
+ draw : function ( ctx ) {
+ if ( this.visible ) {
+ ctx.fillStyle = this.fillStyle
+ ctx.strokeStyle= this.strokeStyle
+ if ( this.fill )
+ ctx.fill();
+ if ( this.stroke )
+ ctx.stroke();
+ if ( !this.openPath )
+ ctx.closePath();
+ ctx.restore();
+ }
+ }
+ }
+);
+/**
+Rectangle object
+@class General methods for a rectangle object
+@param {object} options Constructor arguments.
+@param {number} options.x The 'x' position.
+@param {number} options.y The 'y' position.
+@param {number} options.w The width of the rectangle.
+@param {number} options.h The height of the rectangle.
+@augments KShape
+@memberOf_ Karma
+**/
+var KRectangle = Class(
+ KShape,
+ {
+ init : function ( options ) {
+ //ADD multiple constructors support
+ //x,y,w,h
+ //w,y,w,h,options
+ if ( valid( options ) ) {
+ KShape.init.call(this, options );
+ }
+ },
+ draw : function ( ctx ) {
+ if ( this.visible ) {
+ ctx.save();
+ ctx.beginPath();
+ ctx.rect( this.x, this.y, this.width, this.height);
+ KShape.draw.call( this, ctx );
+ }
+ },
+ clear : function ( ) {
+ if ( this.visible ) {
+
+ }
+ }
+ }
+
+);
+
+/**@class_ */
+var KButton = Class(
+ /**@lends_ KGraphic*/
+ KGraphic,
+ {
+
+ init : function ( options ) {
+ //ADD multiple constructors support
+ //x,y,w,h
+ //w,y,w,h,options
+ if ( valid( options ) ) {
+ KGraphic.init.call(this, options );
+ }
+ this.name = options.name;
+ master.buttons.push(this);
+ },
+ draw : function ( ) {},
+ onClick : function() { } //callback
+ }
+);
+//
+/**
+Karma function. It's a shotcut for calling 'new Karma(..)'
+@param [options] Options passed to the Karma constructor
+@returns {Object} a new Karma object
+@see Karma
+**/
+$.karma = function (options) {
+ var k =new Karma( options );
+ return k;
+}
+})(jQuery); \ No newline at end of file
diff --git a/js/karma.Gettext.js b/js/karma.Gettext.js
new file mode 100755
index 0000000..0e39a31
--- /dev/null
+++ b/js/karma.Gettext.js
@@ -0,0 +1,1282 @@
+/*
+Pure Javascript implementation of Uniforum message translation.
+Copyright (C) 2008 Joshua I. Miller <unrtst@cpan.org>, all rights reserved
+
+This program is free software; you can redistribute it and/or modify it
+under the terms of the GNU Library General Public License as published
+by the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+USA.
+
+=head1 NAME
+
+Javascript Gettext - Javascript implemenation of GNU Gettext API.
+
+=head1 SYNOPSIS
+
+ // //////////////////////////////////////////////////////////
+ // Optimum caching way
+ <script language="javascript" src="/path/LC_MESSAGES/myDomain.json"></script>
+ <script language="javascript" src="/path/Gettext.js'></script>
+
+ // assuming myDomain.json defines variable json_locale_data
+ var params = { "domain" : "myDomain",
+ "locale_data" : json_locale_data
+ };
+ var gt = new Gettext(params);
+ // create a shortcut if you'd like
+ function _ (msgid) { return gt.gettext(msgid); }
+ alert(_("some string"));
+ // or use fully named method
+ alert(gt.gettext("some string"));
+ // change to use a different "domain"
+ gt.textdomain("anotherDomain");
+ alert(gt.gettext("some string"));
+
+
+ // //////////////////////////////////////////////////////////
+ // The other way to load the language lookup is a "link" tag
+ // Downside is that not all browsers cache XMLHttpRequests the
+ // same way, so caching of the language data isn't guarenteed
+ // across page loads.
+ // Upside is that it's easy to specify multiple files
+ <link rel="gettext" href="/path/LC_MESSAGES/myDomain.json" />
+ <script language="javascript" src="/path/Gettext.js'></script>
+
+ var gt = new Gettext({ "domain" : "myDomain" });
+ // rest is the same
+
+
+ // //////////////////////////////////////////////////////////
+ // The reson the shortcuts aren't exported by default is because they'd be
+ // glued to the single domain you created. So, if you're adding i18n support
+ // to some js library, you should use it as so:
+
+ if (typeof(MyNamespace) == 'undefined') MyNamespace = {};
+ MyNamespace.MyClass = function () {
+ var gtParms = { "domain" : 'MyNamespace_MyClass' };
+ this.gt = new Gettext(gtParams);
+ return this;
+ };
+ MyNamespace.MyClass.prototype._ = function (msgid) {
+ return this.gt.gettext(msgid);
+ };
+ MyNamespace.MyClass.prototype.something = function () {
+ var myString = this._("this will get translated");
+ };
+
+ // //////////////////////////////////////////////////////////
+ // Adding the shortcuts to a global scope is easier. If that's
+ // ok in your app, this is certainly easier.
+ var myGettext = new Gettext({ 'domain' : 'myDomain' });
+ function _ (msgid) {
+ return myGettext.gettext(msgid);
+ }
+ alert( _("text") );
+
+ // //////////////////////////////////////////////////////////
+ // Data structure of the json data
+ // NOTE: if you're loading via the <script> tag, you can only
+ // load one file, but it can contain multiple domains.
+ var json_locale_data = {
+ "MyDomain" : {
+ "" : {
+ "header_key" : "header value",
+ "header_key" : "header value",
+ "msgid" : [ "msgid_plural", "msgstr", "msgstr_plural", "msgstr_pluralN" ],
+ "msgctxt\004msgid" : [ null, "msgstr" ],
+ },
+ "AnotherDomain" : {
+ },
+ }
+
+=head1 DESCRIPTION
+
+This is a javascript implementation of GNU Gettext, providing internationalization support for javascript. It differs from existing javascript implementations in that it will support all current Gettext features (ex. plural and context support), and will also support loading language catalogs from .mo, .po, or preprocessed json files (converter included).
+
+The locale initialization differs from that of GNU Gettext / POSIX. Rather than setting the category, domain, and paths, and letting the libs find the right file, you must explicitly load the file at some point. The "domain" will still be honored. Future versions may be expanded to include support for set_locale like features.
+
+
+=head1 INSTALL
+
+To install this module, simply copy the file lib/Gettext.js to a web accessable location, and reference it from your application.
+
+
+=head1 CONFIGURATION
+
+Configure in one of two ways:
+
+=over
+
+=item 1. Optimal. Load language definition from statically defined json data.
+
+ <script language="javascript" src="/path/locale/domain.json"></script>
+
+ // in domain.json
+ json_locale_data = {
+ "mydomain" : {
+ // po header fields
+ "" : {
+ "plural-forms" : "...",
+ "lang" : "en",
+ },
+ // all the msgid strings and translations
+ "msgid" : [ "msgid_plural", "translation", "plural_translation" ],
+ },
+ };
+ // please see the included bin/po2json script for the details on this format
+
+This method also allows you to use unsupported file formats, so long as you can parse them into the above format.
+
+=item 2. Use AJAX to load language file.
+
+Use XMLHttpRequest (actually, SJAX - syncronous) to load an external resource.
+
+Supported external formats are:
+
+=over
+
+=item * Javascript Object Notation (.json)
+
+(see bin/po2json)
+
+ type=application/json
+
+=item * Uniforum Portable Object (.po)
+
+(see GNU Gettext's xgettext)
+
+ type=application/x-po
+
+=item * Machine Object (compiled .po) (.mo)
+
+NOTE: .mo format isn't actually supported just yet, but support is planned.
+
+(see GNU Gettext's msgfmt)
+
+ type=application/x-mo
+
+=back
+
+=back
+
+=head1 METHODS
+
+The following methods are implemented:
+
+ new Gettext(args)
+ textdomain (domain)
+ gettext (msgid)
+ dgettext (domainname, msgid)
+ dcgettext (domainname, msgid, LC_MESSAGES)
+ ngettext (msgid, msgid_plural, count)
+ dngettext (domainname, msgid, msgid_plural, count)
+ dcngettext (domainname, msgid, msgid_plural, count, LC_MESSAGES)
+ pgettext (msgctxt, msgid)
+ dpgettext (domainname, msgctxt, msgid)
+ dcpgettext (domainname, msgctxt, msgid, LC_MESSAGES)
+ npgettext (msgctxt, msgid, msgid_plural, count)
+ dnpgettext (domainname, msgctxt, msgid, msgid_plural, count)
+ dcnpgettext (domainname, msgctxt, msgid, msgid_plural, count, LC_MESSAGES)
+ strargs (string, args_array)
+
+
+=head2 new Gettext (args)
+
+Several methods of loading locale data are included. You may specify a plugin or alternative method of loading data by passing the data in as the "locale_data" option. For example:
+
+ var get_locale_data = function () {
+ // plugin does whatever to populate locale_data
+ return locale_data;
+ };
+ var gt = new Gettext( 'domain' : 'messages',
+ 'locale_data' : get_locale_data() );
+
+The above can also be used if locale data is specified in a statically included <SCRIPT> tag. Just specify the variable name in the call to new. Ex:
+
+ var gt = new Gettext( 'domain' : 'messages',
+ 'locale_data' : json_locale_data_variable );
+
+Finally, you may load the locale data by referencing it in a <LINK> tag. Simply exclude the 'locale_data' option, and all <LINK rel="gettext" ...> items will be tried. The <LINK> should be specified as:
+
+ <link rel="gettext" type="application/json" href="/path/to/file.json">
+ <link rel="gettext" type="text/javascript" href="/path/to/file.json">
+ <link rel="gettext" type="application/x-po" href="/path/to/file.po">
+ <link rel="gettext" type="application/x-mo" href="/path/to/file.mo">
+
+args:
+
+=over
+
+=item domain
+
+The Gettext domain, not www.whatev.com. It's usually your applications basename. If the .po file was "myapp.po", this would be "myapp".
+
+=item locale_data
+
+Raw locale data (in json structure). If specified, from_link data will be ignored.
+
+=back
+
+=cut
+
+*/
+
+Gettext = function (args) {
+ this.domain = 'messages';
+ // locale_data will be populated from <link...> if not specified in args
+ this.locale_data = undefined;
+
+
+
+
+ // set options
+ var options = [ "domain", "locale_data", "file"];
+ if (this.isValidObject(args)) {
+ for (var i in args) {
+ for (var j=0; j<options.length; j++) {
+ if (i == options[j]) {
+ // don't set it if it's null or undefined
+ if (this.isValidObject(args[i]))
+ this[i] = args[i];
+ }
+ }
+ }
+ }
+
+ // try to load the lang file from somewhere
+ this.try_load_lang();
+ return this;
+}
+
+Gettext.context_glue = "\004";
+Gettext._locale_data = {};
+
+Gettext.prototype.try_load_lang = function() {
+ // check to see if language is statically included
+ if (typeof(this.locale_data) != 'undefined') {
+ // we're going to reformat it, and overwrite the variable
+ var locale_copy = this.locale_data;
+ this.locale_data = undefined;
+ this.parse_locale_data(locale_copy);
+
+ if (typeof(Gettext._locale_data[this.domain]) == 'undefined') {
+ throw new Error("Error: Gettext 'locale_data' does not contain the domain '"+this.domain+"'");
+ }
+ }
+
+ //Karma
+ //work with the specific data
+ if ( this.isValidObject( this.file ) ) {
+
+ if ( this.file.type==="application/x-po" ) {
+ //when sending the data it doesn't load the uri
+ this.try_load_lang_po( this.file.uri, this.file.data );
+ }else if ( this.file.type==="application/json" ) {
+ this.try_load_lang_json( this.file.uri, this.file.data );
+ }
+
+ } else {
+ // try loading from JSON
+ // get lang links
+ var lang_link = this.get_lang_refs();
+
+ if (typeof(lang_link) == 'object' && lang_link.length > 0) {
+ // NOTE: there will be a delay here, as this is async.
+ // So, any i18n calls made right after page load may not
+ // get translated.
+ // XXX: we may want to see if we can "fix" this behavior
+ for (var i=0; i<lang_link.length; i++) {
+ var link = lang_link[i];
+ if (link.type == 'application/json') {
+ if (! this.try_load_lang_json(link.href) ) {
+ throw new Error("Error: Gettext 'try_load_lang_json' failed. Unable to exec xmlhttprequest for link ["+link.href+"]");
+ }
+ } else if (link.type == 'application/x-po') {
+ if (! this.try_load_lang_po(link.href) ) {
+ throw new Error("Error: Gettext 'try_load_lang_po' failed. Unable to exec xmlhttprequest for link ["+link.href+"]");
+ }
+ } else {
+ // TODO: implement the other types (.mo)
+ throw new Error("TODO: link type ["+link.type+"] found, and support is planned, but not implemented at this time.");
+ }
+ }
+ }
+ }
+};
+
+// This takes the bin/po2json'd data, and moves it into an internal form
+// for use in our lib, and puts it in our object as:
+// Gettext._locale_data = {
+// domain : {
+// head : { headfield : headvalue },
+// msgs : {
+// msgid : [ msgid_plural, msgstr, msgstr_plural ],
+// },
+Gettext.prototype.parse_locale_data = function(locale_data) {
+ if (typeof(Gettext._locale_data) == 'undefined') {
+ Gettext._locale_data = { };
+ }
+
+ // suck in every domain defined in the supplied data
+ for (var domain in locale_data) {
+ // skip empty specs (flexibly)
+ if ((! locale_data.hasOwnProperty(domain)) || (! this.isValidObject(locale_data[domain])))
+ continue;
+ // skip if it has no msgid's
+ var has_msgids = false;
+ for (var msgid in locale_data[domain]) {
+ has_msgids = true;
+ break;
+ }
+ if (! has_msgids) continue;
+
+ // grab shortcut to data
+ var data = locale_data[domain];
+
+ // if they specifcy a blank domain, default to "messages"
+ if (domain == "") domain = "messages";
+ // init the data structure
+ if (! this.isValidObject(Gettext._locale_data[domain]) )
+ Gettext._locale_data[domain] = { };
+ if (! this.isValidObject(Gettext._locale_data[domain].head) )
+ Gettext._locale_data[domain].head = { };
+ if (! this.isValidObject(Gettext._locale_data[domain].msgs) )
+ Gettext._locale_data[domain].msgs = { };
+
+ for (var key in data) {
+ if (key == "") {
+ var header = data[key];
+ for (var head in header) {
+ var h = head.toLowerCase();
+ Gettext._locale_data[domain].head[h] = header[head];
+ }
+ } else {
+ Gettext._locale_data[domain].msgs[key] = data[key];
+ }
+ }
+ }
+
+ // build the plural forms function
+ for (var domain in Gettext._locale_data) {
+ if (this.isValidObject(Gettext._locale_data[domain].head['plural-forms']) &&
+ typeof(Gettext._locale_data[domain].head.plural_func) == 'undefined') {
+ // untaint data
+ var plural_forms = Gettext._locale_data[domain].head['plural-forms'];
+ var pf_re = new RegExp('^(\\s*nplurals\\s*=\\s*[0-9]+\\s*;\\s*plural\\s*=\\s*(?:\\s|[-\\?\\|&=!<>+*/%:;a-zA-Z0-9_\(\)])+)', 'm');
+ if (pf_re.test(plural_forms)) {
+ //ex english: "Plural-Forms: nplurals=2; plural=(n != 1);\n"
+ //pf = "nplurals=2; plural=(n != 1);";
+ //ex russian: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10< =4 && (n%100<10 or n%100>=20) ? 1 : 2)
+ //pf = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2)";
+
+ var pf = Gettext._locale_data[domain].head['plural-forms'];
+ if (! /;\s*$/.test(pf)) pf = pf.concat(';');
+ /* We used to use eval, but it seems IE has issues with it.
+ * We now use "new Function", though it carries a slightly
+ * bigger performance hit.
+ var code = 'function (n) { var plural; var nplurals; '+pf+' return { "nplural" : nplurals, "plural" : (plural === true ? 1 : plural ? plural : 0) }; };';
+ Gettext._locale_data[domain].head.plural_func = eval("("+code+")");
+ */
+ var code = 'var plural; var nplurals; '+pf+' return { "nplural" : nplurals, "plural" : (plural === true ? 1 : plural ? plural : 0) };';
+ Gettext._locale_data[domain].head.plural_func = new Function("n", code);
+ } else {
+ throw new Error("Syntax error in language file. Plural-Forms header is invalid ["+plural_forms+"]");
+ }
+
+ // default to english plural form
+ } else if (typeof(Gettext._locale_data[domain].head.plural_func) == 'undefined') {
+ Gettext._locale_data[domain].head.plural_func = function (n) {
+ var p = (n != 1) ? 1 : 0;
+ return { 'nplural' : 2, 'plural' : p };
+ };
+ } // else, plural_func already created
+ }
+
+ return;
+};
+
+
+// try_load_lang_po : do an ajaxy call to load in the .po lang defs
+Gettext.prototype.try_load_lang_po = function(uri, data ) {
+
+ if ( !this.isValidObject(data) ) {
+ var data = this.sjax(uri);
+ if (! data) return;
+ }
+ var domain = this.uri_basename(uri);
+ var parsed = this.parse_po(data);
+
+ var rv = {};
+ // munge domain into/outof header
+ if (parsed) {
+ if (! parsed[""]) parsed[""] = {};
+ if (! parsed[""]["domain"]) parsed[""]["domain"] = domain;
+ domain = parsed[""]["domain"];
+ rv[domain] = parsed;
+
+ this.parse_locale_data(rv);
+ }
+
+ return 1;
+};
+
+Gettext.prototype.uri_basename = function(uri) {
+ var rv;
+ if (rv = uri.match(/^(.*\/)?(.*)/)) {
+ var ext_strip;
+ if (ext_strip = rv[2].match(/^(.*)\..+$/))
+ return ext_strip[1];
+ else
+ return rv[2];
+ } else {
+ return "";
+ }
+};
+
+Gettext.prototype.parse_po = function(data) {
+ var rv = {};
+ var buffer = {};
+ var lastbuffer = "";
+ var errors = [];
+ var lines = data.split("\n");
+ for (var i=0; i<lines.length; i++) {
+ // chomp
+ lines[i] = lines[i].replace(/(\n|\r)+$/, '');
+
+ var match;
+
+ // Empty line / End of an entry.
+ if (/^$/.test(lines[i])) {
+ if (typeof(buffer['msgid']) != 'undefined') {
+ var msg_ctxt_id = (typeof(buffer['msgctxt']) != 'undefined' &&
+ buffer['msgctxt'].length) ?
+ buffer['msgctxt']+Gettext.context_glue+buffer['msgid'] :
+ buffer['msgid'];
+ var msgid_plural = (typeof(buffer['msgid_plural']) != 'undefined' &&
+ buffer['msgid_plural'].length) ?
+ buffer['msgid_plural'] :
+ null;
+
+ // find msgstr_* translations and push them on
+ var trans = [];
+ for (var str in buffer) {
+ var match;
+ if (match = str.match(/^msgstr_(\d+)/))
+ trans[parseInt(match[1])] = buffer[str];
+ }
+ trans.unshift(msgid_plural);
+
+ // only add it if we've got a translation
+ // NOTE: this doesn't conform to msgfmt specs
+ if (trans.length > 1) rv[msg_ctxt_id] = trans;
+
+ buffer = {};
+ lastbuffer = "";
+ }
+
+ // comments
+ } else if (/^#/.test(lines[i])) {
+ continue;
+
+ // msgctxt
+ } else if (match = lines[i].match(/^msgctxt\s+(.*)/)) {
+ lastbuffer = 'msgctxt';
+ buffer[lastbuffer] = this.parse_po_dequote(match[1]);
+
+ // msgid
+ } else if (match = lines[i].match(/^msgid\s+(.*)/)) {
+ lastbuffer = 'msgid';
+ buffer[lastbuffer] = this.parse_po_dequote(match[1]);
+
+ // msgid_plural
+ } else if (match = lines[i].match(/^msgid_plural\s+(.*)/)) {
+ lastbuffer = 'msgid_plural';
+ buffer[lastbuffer] = this.parse_po_dequote(match[1]);
+
+ // msgstr
+ } else if (match = lines[i].match(/^msgstr\s+(.*)/)) {
+ lastbuffer = 'msgstr_0';
+ buffer[lastbuffer] = this.parse_po_dequote(match[1]);
+
+ // msgstr[0] (treak like msgstr)
+ } else if (match = lines[i].match(/^msgstr\[0\]\s+(.*)/)) {
+ lastbuffer = 'msgstr_0';
+ buffer[lastbuffer] = this.parse_po_dequote(match[1]);
+
+ // msgstr[n]
+ } else if (match = lines[i].match(/^msgstr\[(\d+)\]\s+(.*)/)) {
+ lastbuffer = 'msgstr_'+match[1];
+ buffer[lastbuffer] = this.parse_po_dequote(match[2]);
+
+ // continued string
+ } else if (/^"/.test(lines[i])) {
+ buffer[lastbuffer] += this.parse_po_dequote(lines[i]);
+
+ // something strange
+ } else {
+ errors.push("Strange line ["+i+"] : "+lines[i]);
+ }
+ }
+
+
+ // handle the final entry
+ if (typeof(buffer['msgid']) != 'undefined') {
+ var msg_ctxt_id = (typeof(buffer['msgctxt']) != 'undefined' &&
+ buffer['msgctxt'].length) ?
+ buffer['msgctxt']+Gettext.context_glue+buffer['msgid'] :
+ buffer['msgid'];
+ var msgid_plural = (typeof(buffer['msgid_plural']) != 'undefined' &&
+ buffer['msgid_plural'].length) ?
+ buffer['msgid_plural'] :
+ null;
+
+ // find msgstr_* translations and push them on
+ var trans = [];
+ for (var str in buffer) {
+ var match;
+ if (match = str.match(/^msgstr_(\d+)/))
+ trans[parseInt(match[1])] = buffer[str];
+ }
+ trans.unshift(msgid_plural);
+
+ // only add it if we've got a translation
+ // NOTE: this doesn't conform to msgfmt specs
+ if (trans.length > 1) rv[msg_ctxt_id] = trans;
+
+ buffer = {};
+ lastbuffer = "";
+ }
+
+
+ // parse out the header
+ if (rv[""] && rv[""][1]) {
+ var cur = {};
+ var hlines = rv[""][1].split(/\\n/);
+ for (var i=0; i<hlines.length; i++) {
+ if (! hlines.length) continue;
+
+ var pos = hlines[i].indexOf(':', 0);
+ if (pos != -1) {
+ var key = hlines[i].substring(0, pos);
+ var val = hlines[i].substring(pos +1);
+ var keylow = key.toLowerCase();
+
+ if (cur[keylow] && cur[keylow].length) {
+ errors.push("SKIPPING DUPLICATE HEADER LINE: "+hlines[i]);
+ } else if (/#-#-#-#-#/.test(keylow)) {
+ errors.push("SKIPPING ERROR MARKER IN HEADER: "+hlines[i]);
+ } else {
+ // remove begining spaces if any
+ val = val.replace(/^\s+/, '');
+ cur[keylow] = val;
+ }
+
+ } else {
+ errors.push("PROBLEM LINE IN HEADER: "+hlines[i]);
+ cur[hlines[i]] = '';
+ }
+ }
+
+ // replace header string with assoc array
+ rv[""] = cur;
+ } else {
+ rv[""] = {};
+ }
+
+ // TODO: XXX: if there are errors parsing, what do we want to do?
+ // GNU Gettext silently ignores errors. So will we.
+ // alert( "Errors parsing po file:\n" + errors.join("\n") );
+
+ return rv;
+};
+
+
+Gettext.prototype.parse_po_dequote = function(str) {
+ var match;
+ if (match = str.match(/^"(.*)"/)) {
+ str = match[1];
+ }
+ str = str.replace(/\\"/, "");
+ return str;
+};
+
+
+// try_load_lang_json : do an ajaxy call to load in the lang defs
+Gettext.prototype.try_load_lang_json = function(uri, dta) {
+
+ if ( !this.isValidObject(data) ) {
+ var data = this.sjax(uri);
+ if (! data) return;
+ }
+
+ var rv = this.JSON(data);
+ this.parse_locale_data(rv);
+
+ return 1;
+};
+
+// this finds all <link> tags, filters out ones that match our
+// specs, and returns a list of hashes of those
+Gettext.prototype.get_lang_refs = function() {
+ var langs = new Array();
+ var links = document.getElementsByTagName("link");
+ // find all <link> tags in dom; filter ours
+ for (var i=0; i<links.length; i++) {
+ if (links[i].rel == 'gettext' && links[i].href) {
+ if (typeof(links[i].type) == 'undefined' ||
+ links[i].type == '') {
+ if (/\.json$/i.test(links[i].href)) {
+ links[i].type = 'application/json';
+ } else if (/\.js$/i.test(links[i].href)) {
+ links[i].type = 'application/json';
+ } else if (/\.po$/i.test(links[i].href)) {
+ links[i].type = 'application/x-po';
+ } else if (/\.mo$/i.test(links[i].href)) {
+ links[i].type = 'application/x-mo';
+ } else {
+ throw new Error("LINK tag with rel=gettext found, but the type and extension are unrecognized.");
+ }
+ }
+
+ links[i].type = links[i].type.toLowerCase();
+ if (links[i].type == 'application/json') {
+ links[i].type = 'application/json';
+ } else if (links[i].type == 'text/javascript') {
+ links[i].type = 'application/json';
+ } else if (links[i].type == 'application/x-po') {
+ links[i].type = 'application/x-po';
+ } else if (links[i].type == 'application/x-mo') {
+ links[i].type = 'application/x-mo';
+ } else {
+ throw new Error("LINK tag with rel=gettext found, but the type attribute ["+links[i].type+"] is unrecognized.");
+ }
+
+ langs.push(links[i]);
+ }
+ }
+ return langs;
+};
+
+
+/*
+
+=head2 textdomain( domain )
+
+Set domain for future gettext() calls
+
+A message domain is a set of translatable msgid messages. Usually,
+every software package has its own message domain. The domain name is
+used to determine the message catalog where a translation is looked up;
+it must be a non-empty string.
+
+The current message domain is used by the gettext, ngettext, pgettext,
+npgettext functions, and by the dgettext, dcgettext, dngettext, dcngettext,
+dpgettext, dcpgettext, dnpgettext and dcnpgettext functions when called
+with a NULL domainname argument.
+
+If domainname is not NULL, the current message domain is set to
+domainname.
+
+If domainname is undefined, null, or empty string, the function returns
+the current message domain.
+
+If successful, the textdomain function returns the current message
+domain, after possibly changing it. (ie. if you set a new domain, the
+value returned will NOT be the previous domain).
+
+=cut
+
+*/
+Gettext.prototype.textdomain = function (domain) {
+ if (domain && domain.length) this.domain = domain;
+ return this.domain;
+}
+
+/*
+
+=head2 gettext( MSGID )
+
+Returns the translation for B<MSGID>. Example:
+
+ alert( gt.gettext("Hello World!\n") );
+
+If no translation can be found, the unmodified B<MSGID> is returned,
+i. e. the function can I<never> fail, and will I<never> mess up your
+original message.
+
+One common mistake is to interpolate a variable into the string like this:
+
+ var translated = gt.gettext("Hello " + full_name);
+
+The interpolation will happen before it's passed to gettext, and it's
+unlikely you'll have a translation for every "Hello Tom" and "Hello Dick"
+and "Hellow Harry" that may arise.
+
+Use C<strargs()> (see below) to solve this problem:
+
+ var translated = Gettext.strargs( gt.gettext("Hello %1"), [full_name] );
+
+This is espeically useful when multiple replacements are needed, as they
+may not appear in the same order within the translation. As an English to
+French example:
+
+ Expected result: "This is the red ball"
+ English: "This is the %1 %2"
+ French: "C'est le %2 %1"
+ Code: Gettext.strargs( gt.gettext("This is the %1 %2"), ["red", "ball"] );
+
+(The example is stupid because neither color nor thing will get
+translated here ...).
+
+=head2 dgettext( TEXTDOMAIN, MSGID )
+
+Like gettext(), but retrieves the message for the specified
+B<TEXTDOMAIN> instead of the default domain. In case you wonder what
+a textdomain is, see above section on the textdomain() call.
+
+=head2 dcgettext( TEXTDOMAIN, MSGID, CATEGORY )
+
+Like dgettext() but retrieves the message from the specified B<CATEGORY>
+instead of the default category C<LC_MESSAGES>.
+
+NOTE: the categories are really useless in javascript context. This is
+here for GNU Gettext API compatability. In practice, you'll never need
+to use this. This applies to all the calls including the B<CATEGORY>.
+
+
+=head2 ngettext( MSGID, MSGID_PLURAL, COUNT )
+
+Retrieves the correct translation for B<COUNT> items. In legacy software
+you will often find something like:
+
+ alert( count + " file(s) deleted.\n" );
+
+or
+
+ printf(count + " file%s deleted.\n", $count == 1 ? '' : 's');
+
+I<NOTE: javascript lacks a builtin printf, so the above isn't a working example>
+
+The first example looks awkward, the second will only work in English
+and languages with similar plural rules. Before ngettext() was introduced,
+the best practice for internationalized programs was:
+
+ if (count == 1) {
+ alert( gettext("One file deleted.\n") );
+ } else {
+ printf( gettext("%d files deleted.\n"), count );
+ }
+
+This is a nuisance for the programmer and often still not sufficient
+for an adequate translation. Many languages have completely different
+ideas on numerals. Some (French, Italian, ...) treat 0 and 1 alike,
+others make no distinction at all (Japanese, Korean, Chinese, ...),
+others have two or more plural forms (Russian, Latvian, Czech,
+Polish, ...). The solution is:
+
+ printf( ngettext("One file deleted.\n",
+ "%d files deleted.\n",
+ count), // argument to ngettext!
+ count); // argument to printf!
+
+In English, or if no translation can be found, the first argument
+(B<MSGID>) is picked if C<count> is one, the second one otherwise.
+For other languages, the correct plural form (of 1, 2, 3, 4, ...)
+is automatically picked, too. You don't have to know anything about
+the plural rules in the target language, ngettext() will take care
+of that.
+
+This is most of the time sufficient but you will have to prove your
+creativity in cases like
+
+ "%d file(s) deleted, and %d file(s) created.\n"
+
+That said, javascript lacks C<printf()> support. Supplied with Gettext.js
+is the C<strargs()> method, which can be used for these cases:
+
+ Gettext.strargs( gt.ngettext( "One file deleted.\n",
+ "%d files deleted.\n",
+ count), // argument to ngettext!
+ count); // argument to strargs!
+
+NOTE: the variable replacement isn't done for you, so you must
+do it yourself as in the above.
+
+=head2 dngettext( TEXTDOMAIN, MSGID, MSGID_PLURAL, COUNT )
+
+Like ngettext() but retrieves the translation from the specified
+textdomain instead of the default domain.
+
+=head2 dcngettext( TEXTDOMAIN, MSGID, MSGID_PLURAL, COUNT, CATEGORY )
+
+Like dngettext() but retrieves the translation from the specified
+category, instead of the default category C<LC_MESSAGES>.
+
+
+=head2 pgettext( MSGCTXT, MSGID )
+
+Returns the translation of MSGID, given the context of MSGCTXT.
+
+Both items are used as a unique key into the message catalog.
+
+This allows the translator to have two entries for words that may
+translate to different foreign words based on their context. For
+example, the word "View" may be a noun or a verb, which may be
+used in a menu as File->View or View->Source.
+
+ alert( pgettext( "Verb: To View", "View" ) );
+ alert( pgettext( "Noun: A View", "View" ) );
+
+The above will both lookup different entries in the message catalog.
+
+In English, or if no translation can be found, the second argument
+(B<MSGID>) is returned.
+
+=head2 dpgettext( TEXTDOMAIN, MSGCTXT, MSGID )
+
+Like pgettext(), but retrieves the message for the specified
+B<TEXTDOMAIN> instead of the default domain.
+
+=head2 dcpgettext( TEXTDOMAIN, MSGCTXT, MSGID, CATEGORY )
+
+Like dpgettext() but retrieves the message from the specified B<CATEGORY>
+instead of the default category C<LC_MESSAGES>.
+
+
+=head2 npgettext( MSGCTXT, MSGID, MSGID_PLURAL, COUNT )
+
+Like ngettext() with the addition of context as in pgettext().
+
+In English, or if no translation can be found, the second argument
+(MSGID) is picked if B<COUNT> is one, the third one otherwise.
+
+=head2 dnpgettext( TEXTDOMAIN, MSGCTXT, MSGID, MSGID_PLURAL, COUNT )
+
+Like npgettext() but retrieves the translation from the specified
+textdomain instead of the default domain.
+
+=head2 dcnpgettext( TEXTDOMAIN, MSGCTXT, MSGID, MSGID_PLURAL, COUNT, CATEGORY )
+
+Like dnpgettext() but retrieves the translation from the specified
+category, instead of the default category C<LC_MESSAGES>.
+
+=cut
+
+*/
+
+// gettext
+Gettext.prototype.gettext = function (msgid) {
+ var msgctxt;
+ var msgid_plural;
+ var n;
+ var category;
+ return this.dcnpgettext(null, msgctxt, msgid, msgid_plural, n, category);
+};
+
+Gettext.prototype.dgettext = function (domain, msgid) {
+ var msgctxt;
+ var msgid_plural;
+ var n;
+ var category;
+ return this.dcnpgettext(domain, msgctxt, msgid, msgid_plural, n, category);
+};
+
+Gettext.prototype.dcgettext = function (domain, msgid, category) {
+ var msgctxt;
+ var msgid_plural;
+ var n;
+ return this.dcnpgettext(domain, msgctxt, msgid, msgid_plural, n, category);
+};
+
+// ngettext
+Gettext.prototype.ngettext = function (msgid, msgid_plural, n) {
+ var msgctxt;
+ var category;
+ return this.dcnpgettext(null, msgctxt, msgid, msgid_plural, n, category);
+};
+
+Gettext.prototype.dngettext = function (domain, msgid, msgid_plural, n) {
+ var msgctxt;
+ var category;
+ return this.dcnpgettext(domain, msgctxt, msgid, msgid_plural, n, category);
+};
+
+Gettext.prototype.dcngettext = function (domain, msgid, msgid_plural, n, category) {
+ var msgctxt;
+ return this.dcnpgettext(domain, msgctxt, msgid, msgid_plural, n, category, category);
+};
+
+// pgettext
+Gettext.prototype.pgettext = function (msgctxt, msgid) {
+ var msgid_plural;
+ var n;
+ var category;
+ return this.dcnpgettext(null, msgctxt, msgid, msgid_plural, n, category);
+};
+
+Gettext.prototype.dpgettext = function (domain, msgctxt, msgid) {
+ var msgid_plural;
+ var n;
+ var category;
+ return this.dcnpgettext(domain, msgctxt, msgid, msgid_plural, n, category);
+};
+
+Gettext.prototype.dcpgettext = function (domain, msgctxt, msgid, category) {
+ var msgid_plural;
+ var n;
+ return this.dcnpgettext(domain, msgctxt, msgid, msgid_plural, n, category);
+};
+
+// npgettext
+Gettext.prototype.npgettext = function (msgctxt, msgid, msgid_plural, n) {
+ var category;
+ return this.dcnpgettext(null, msgctxt, msgid, msgid_plural, n, category);
+};
+
+Gettext.prototype.dnpgettext = function (domain, msgctxt, msgid, msgid_plural, n) {
+ var category;
+ return this.dcnpgettext(domain, msgctxt, msgid, msgid_plural, n, category);
+};
+
+// this has all the options, so we use it for all of them.
+Gettext.prototype.dcnpgettext = function (domain, msgctxt, msgid, msgid_plural, n, category) {
+ if (! this.isValidObject(msgid)) return '';
+
+ var plural = this.isValidObject(msgid_plural);
+ var msg_ctxt_id = this.isValidObject(msgctxt) ? msgctxt+Gettext.context_glue+msgid : msgid;
+
+ var domainname = this.isValidObject(domain) ? domain :
+ this.isValidObject(this.domain) ? this.domain :
+ 'messages';
+
+ // category is always LC_MESSAGES. We ignore all else
+ var category_name = 'LC_MESSAGES';
+ var category = 5;
+
+ var locale_data = new Array();
+ if (typeof(Gettext._locale_data) != 'undefined' &&
+ this.isValidObject(Gettext._locale_data[domainname])) {
+ locale_data.push( Gettext._locale_data[domainname] );
+
+ } else if (typeof(Gettext._locale_data) != 'undefined') {
+ // didn't find domain we're looking for. Search all of them.
+ for (var dom in Gettext._locale_data) {
+ locale_data.push( Gettext._locale_data[dom] );
+ }
+ }
+
+ var trans = [];
+ var found = false;
+ var domain_used; // so we can find plural-forms if needed
+ if (locale_data.length) {
+ for (var i=0; i<locale_data.length; i++) {
+ var locale = locale_data[i];
+ if (this.isValidObject(locale.msgs[msg_ctxt_id])) {
+ // make copy of that array (cause we'll be destructive)
+ for (var j=0; j<locale.msgs[msg_ctxt_id].length; j++) {
+ trans[j] = locale.msgs[msg_ctxt_id][j];
+ }
+ trans.shift(); // throw away the msgid_plural
+ domain_used = locale;
+ found = true;
+ // only break if found translation actually has a translation.
+ if ( trans.length > 0 && trans[0].length != 0 )
+ break;
+ }
+ }
+ }
+
+ // default to english if we lack a match, or match has zero length
+ if ( trans.length == 0 || trans[0].length == 0 ) {
+ trans = [ msgid, msgid_plural ];
+ }
+
+ var translation = trans[0];
+ if (plural) {
+ var p;
+ if (found && this.isValidObject(domain_used.head.plural_func) ) {
+ var rv = domain_used.head.plural_func(n);
+ if (! rv.plural) rv.plural = 0;
+ if (! rv.nplural) rv.nplural = 0;
+ // if plurals returned is out of bound for total plural forms
+ if (rv.nplural <= rv.plural) rv.plural = 0;
+ p = rv.plural;
+ } else {
+ p = (n != 1) ? 1 : 0;
+ }
+ if (this.isValidObject(trans[p]))
+ translation = trans[p];
+ }
+
+ return translation;
+};
+
+
+/*
+
+=head2 strargs (string, argument_array)
+
+ string : a string that potentially contains formatting characters.
+ argument_array : an array of positional replacement values
+
+This is a utility method to provide some way to support positional parameters within a string, as javascript lacks a printf() method.
+
+The format is similar to printf(), but greatly simplified (ie. fewer features).
+
+Any percent signs followed by numbers are replaced with the corrosponding item from the B<argument_array>.
+
+Example:
+
+ var string = "%2 roses are red, %1 violets are blue";
+ var args = new Array("10", "15");
+ var result = Gettext.strargs(string, args);
+ // result is "15 roses are red, 10 violets are blue"
+
+The format numbers are 1 based, so the first itme is %1.
+
+A lone percent sign may be escaped by preceeding it with another percent sign.
+
+A percent sign followed by anything other than a number or another percent sign will be passed through as is.
+
+Some more examples should clear up any abmiguity. The following were called with the orig string, and the array as Array("[one]", "[two]") :
+
+ orig string "blah" becomes "blah"
+ orig string "" becomes ""
+ orig string "%%" becomes "%"
+ orig string "%%%" becomes "%%"
+ orig string "%%%%" becomes "%%"
+ orig string "%%%%%" becomes "%%%"
+ orig string "tom%%dick" becomes "tom%dick"
+ orig string "thing%1bob" becomes "thing[one]bob"
+ orig string "thing%1%2bob" becomes "thing[one][two]bob"
+ orig string "thing%1asdf%2asdf" becomes "thing[one]asdf[two]asdf"
+ orig string "%1%2%3" becomes "[one][two]"
+ orig string "tom%1%%2%aDick" becomes "tom[one]%2%aDick"
+
+This is especially useful when using plurals, as the string will nearly always contain the number.
+
+It's also useful in translated strings where the translator may have needed to move the position of the parameters.
+
+For example:
+
+ var count = 14;
+ Gettext.strargs( gt.ngettext('one banana', '%1 bananas', count), [count] );
+
+NOTE: this may be called as an instance method, or as a class method.
+
+ // instance method:
+ var gt = new Gettext(params);
+ gt.strargs(string, args);
+
+ // class method:
+ Gettext.strargs(string, args);
+
+=cut
+
+*/
+/* utility method, since javascript lacks a printf */
+Gettext.strargs = function (str, args) {
+ // make sure args is an array
+ if ( null == args ||
+ 'undefined' == typeof(args) ) {
+ args = [];
+ } else if (args.constructor != Array) {
+ args = [args];
+ }
+
+ // NOTE: javascript lacks support for zero length negative look-behind
+ // in regex, so we must step through w/ index.
+ // The perl equiv would simply be:
+ // $string =~ s/(?<!\%)\%([0-9]+)/$args[$1]/g;
+ // $string =~ s/\%\%/\%/g; # restore escaped percent signs
+
+ var newstr = "";
+ while (true) {
+ var i = str.indexOf('%');
+ var match_n;
+
+ // no more found. Append whatever remains
+ if (i == -1) {
+ newstr += str;
+ break;
+ }
+
+ // we found it, append everything up to that
+ newstr += str.substr(0, i);
+
+ // check for escpaed %%
+ if (str.substr(i, 2) == '%%') {
+ newstr += '%';
+ str = str.substr((i+2));
+
+ // % followed by number
+ } else if ( match_n = str.substr(i).match(/^%(\d+)/) ) {
+ var arg_n = parseInt(match_n[1]);
+ var length_n = match_n[1].length;
+ if ( arg_n > 0 && args[arg_n -1] != null && typeof(args[arg_n -1]) != 'undefined' )
+ newstr += args[arg_n -1];
+ str = str.substr( (i + 1 + length_n) );
+
+ // % followed by some other garbage - just remove the %
+ } else {
+ newstr += '%';
+ str = str.substr((i+1));
+ }
+ }
+
+ return newstr;
+}
+
+/* instance method wrapper of strargs */
+Gettext.prototype.strargs = function (str, args) {
+ return Gettext.strargs(str, args);
+}
+
+/* verify that something is an array */
+Gettext.prototype.isArray = function (thisObject) {
+ return this.isValidObject(thisObject) && thisObject.constructor == Array;
+};
+
+/* verify that an object exists and is valid */
+Gettext.prototype.isValidObject = function (thisObject) {
+ if (null == thisObject) {
+ return false;
+ } else if ('undefined' == typeof(thisObject) ) {
+ return false;
+ } else {
+ return true;
+ }
+};
+
+Gettext.prototype.sjax = function (uri) {
+ var xmlhttp;
+ if (window.XMLHttpRequest) {
+ xmlhttp = new XMLHttpRequest();
+ } else if (navigator.userAgent.toLowerCase().indexOf('msie 5') != -1) {
+ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
+ } else {
+ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
+ }
+
+ if (! xmlhttp)
+ throw new Error("Your browser doesn't do Ajax. Unable to support external language files.");
+
+ xmlhttp.open('GET', uri, false);
+ try { xmlhttp.send(null); }
+ catch (e) { return; }
+
+ // we consider status 200 and 0 as ok.
+ // 0 happens when we request local file, allowing this to run on local files
+ var sjax_status = xmlhttp.status;
+ if (sjax_status == 200 || sjax_status == 0) {
+ return xmlhttp.responseText;
+ } else {
+ var error = xmlhttp.statusText + " (Error " + xmlhttp.status + ")";
+ if (xmlhttp.responseText.length) {
+ error += "\n" + xmlhttp.responseText;
+ }
+ alert(error);
+ return;
+ }
+}
+
+Gettext.prototype.JSON = function (data) {
+ return eval('(' + data + ')');
+}
+
+
+/*
+
+=head1 NOTES
+
+These are some notes on the internals
+
+=over
+
+=item LOCALE CACHING
+
+Loaded locale data is currently cached class-wide. This means that if two scripts are both using Gettext.js, and both share the same gettext domain, that domain will only be loaded once. This will allow you to grab a new object many times from different places, utilize the same domain, and share a single translation file. The downside is that a domain won't be RE-loaded if a new object is instantiated on a domain that had already been instantiated.
+
+=back
+
+=head1 BUGS / TODO
+
+=over
+
+=item error handling
+
+Currently, there are several places that throw errors. In GNU Gettext, there are no fatal errors, which allows text to still be displayed regardless of how broken the environment becomes. We should evaluate and determine where we want to stand on that issue.
+
+=item syncronous only support (no ajax support)
+
+Currently, fetching language data is done purely syncronous, which means the page will halt while those files are fetched/loaded.
+
+This is often what you want, as then following translation requests will actually be translated. However, if all your calls are done dynamically (ie. error handling only or something), loading in the background may be more adventagous.
+
+It's still recommended to use the statically defined <script ...> method, which should have the same delay, but it will cache the result.
+
+=item domain support
+
+domain support while using shortcut methods like C<_('string')> or C<i18n('string')>.
+
+Under normal apps, the domain is usually set globally to the app, and a single language file is used. Under javascript, you may have multiple libraries or applications needing translation support, but the namespace is essentially global.
+
+It's recommended that your app initialize it's own shortcut with it's own domain. (See examples/wrapper/i18n.js for an example.)
+
+Basically, you'll want to accomplish something like this:
+
+ // in some other .js file that needs i18n
+ this.i18nObj = new i18n;
+ this.i18n = this.i18nObj.init('domain');
+ // do translation
+ alert( this.i18n("string") );
+
+If you use this raw Gettext object, then this is all handled for you, as you have your own object then, and will be calling C<myGettextObject.gettext('string')> and such.
+
+
+=item encoding
+
+May want to add encoding/reencoding stuff. See GNU iconv, or the perl module Locale::Recode from libintl-perl.
+
+=back
+
+
+=head1 COMPATABILITY
+
+This has been tested on the following browsers. It may work on others, but these are all those to which I have access.
+
+ FF1.5, FF2, FF3, IE6, IE7, Opera9, Opera10, Safari3.1, Chrome
+
+ *FF = Firefox
+ *IE = Internet Explorer
+
+
+=head1 REQUIRES
+
+bin/po2json requires perl, and the perl modules Locale::PO and JSON.
+
+=head1 SEE ALSO
+
+bin/po2json (included),
+examples/normal/index.html,
+examples/wrapper/i18n.html, examples/wrapper/i18n.js,
+Locale::gettext_pp(3pm), POSIX(3pm), gettext(1), gettext(3)
+
+=head1 AUTHOR
+
+Copyright (C) 2008, Joshua I. Miller E<lt>unrtst@cpan.orgE<gt>, all rights reserved. See the source code for details.
+
+=cut
+
+*/
+
diff --git a/js/raphael-min.js b/js/raphael-min.js
new file mode 100755
index 0000000..eac42bb
--- /dev/null
+++ b/js/raphael-min.js
@@ -0,0 +1,7 @@
+/*
+ * Raphael 1.0 RC1.4 - JavaScript Vector Library
+ *
+ * Copyright (c) 2008 - 2009 Dmitry Baranovskiy (http://raphaeljs.com)
+ * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
+ */
+window.Raphael=(function(){var Y=/[, ]+/,g=document,L=window,P={was:"Raphael" in window,is:window.Raphael},f=function(){return l.apply(f,arguments);},b={},q={"clip-rect":"0 0 10e9 10e9",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/",opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",translation:"0 0",width:0,x:0,y:0},u={"clip-rect":"csv",cx:"number",cy:"number",fill:"colour","fill-opacity":"number","font-size":"number",height:"number",opacity:"number",path:"path",r:"number",rotation:"csv",rx:"number",ry:"number",scale:"csv",stroke:"colour","stroke-opacity":"number","stroke-width":"number",translation:"csv",width:"number",x:"number",y:"number"},v=["click","dblclick","mousedown","mousemove","mouseout","mouseover","mouseup"];f.version="1.0 RC1.4";f.type=(window.SVGAngle||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML");f.svg=!(f.vml=f.type=="VML");f.idGenerator=0;f.fn={};f.is=function(i,e){e=(e+"").toLowerCase();if(e=="undefined"&&typeof i=="undefined"){return true;}if(i==null&&e=="null"){return true;}return Object.prototype.toString.call(i).replace(/^\[object\s+|\]$/gi,"").toLowerCase()==e;};f.setWindow=function(e){L=e;g=L.document;};f.hsb2rgb=X(function(af,ad,aj){if(f.is(af,"object")&&"h" in af&&"s" in af&&"b" in af){aj=af.b;ad=af.s;af=af.h;}var aa,ab,ak;if(aj==0){return{r:0,g:0,b:0,hex:"#000"};}if(af>1||ad>1||aj>1){af/=255;ad/=255;aj/=255;}var ac=Math.floor(af*6),ag=(af*6)-ac,Z=aj*(1-ad),R=aj*(1-(ad*ag)),al=aj*(1-(ad*(1-ag)));aa=[aj,R,Z,Z,al,aj,aj][ac];ab=[al,aj,aj,R,Z,Z,al][ac];ak=[Z,Z,al,aj,aj,R,Z][ac];aa*=255;ab*=255;ak*=255;var ah={r:aa,g:ab,b:ak},e=Math.round(aa).toString(16),ae=Math.round(ab).toString(16),ai=Math.round(ak).toString(16);if(e.length==1){e="0"+e;}if(ae.length==1){ae="0"+ae;}if(ai.length==1){ai="0"+ai;}ah.hex="#"+e+ae+ai;return ah;},f);f.rgb2hsb=X(function(e,i,ad){if(f.is(e,"object")&&"r" in e&&"g" in e&&"b" in e){ad=e.b;i=e.g;e=e.r;}if(f.is(e,"string")){var af=f.getRGB(e);e=af.r;i=af.g;ad=af.b;}if(e>1||i>1||ad>1){e/=255;i/=255;ad/=255;}var ac=Math.max(e,i,ad),R=Math.min(e,i,ad),aa,Z,ab=ac;if(R==ac){return{h:0,s:0,b:ac};}else{var ae=(ac-R);Z=ae/ac;if(e==ac){aa=(i-ad)/ae;}else{if(i==ac){aa=2+((ad-e)/ae);}else{aa=4+((e-i)/ae);}}aa/=6;if(aa<0){aa+=1;}if(aa>1){aa-=1;}}return{h:aa,s:Z,b:ab};},f);f._path2string=function(){var Z="",ac;for(var R=0,aa=this.length;R<aa;R++){for(var e=0,ab=this[R].length;e<ab;e++){Z+=this[R][e];e&&e!=ab-1&&(Z+=",");}R!=aa-1&&(Z+="\n");}return Z.replace(/,(?=-)/g,"");};function X(Z,i,e){function R(){var aa=Array.prototype.splice.call(arguments,0,arguments.length),ab=aa.join("\u25ba");R.cache=R.cache||{};R.count=R.count||[];if(ab in R.cache){return e?e(R.cache[ab]):R.cache[ab];}if(R.count.length>1000){delete R.cache[R.count.unshift()];}R.count.push(ab);R.cache[ab]=Z.apply(i,aa);return e?e(R.cache[ab]):R.cache[ab];}return R;}f.getRGB=X(function(e){var af={aliceblue:"#f0f8ff",amethyst:"#96c",antiquewhite:"#faebd7",aqua:"#0ff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000",blanchedalmond:"#ffebcd",blue:"#00f",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#0ff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#f0f",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#789",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#0f0",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#f0f",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#f00",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#fff",whitesmoke:"#f5f5f5",yellow:"#ff0",yellowgreen:"#9acd32"},ab;if((e+"").toLowerCase() in af){e=af[e.toString().toLowerCase()];}if(!e){return{r:0,g:0,b:0,hex:"#000"};}if(e=="none"){return{r:-1,g:-1,b:-1,hex:"none"};}var R,Z,ae,ac=(e+"").match(/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgb\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|rgb\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\)|hs[bl]\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+)\s*\)|hs[bl]\(\s*([\d\.]+%\s*,\s*[\d\.]+%\s*,\s*[\d\.]+%)\s*\))\s*$/i);if(ac){if(ac[2]){ae=parseInt(ac[2].substring(5),16);Z=parseInt(ac[2].substring(3,5),16);R=parseInt(ac[2].substring(1,3),16);}if(ac[3]){ae=parseInt(ac[3].substring(3)+ac[3].substring(3),16);Z=parseInt(ac[3].substring(2,3)+ac[3].substring(2,3),16);R=parseInt(ac[3].substring(1,2)+ac[3].substring(1,2),16);}if(ac[4]){ac=ac[4].split(/\s*,\s*/);R=parseFloat(ac[0]);Z=parseFloat(ac[1]);ae=parseFloat(ac[2]);}if(ac[5]){ac=ac[5].split(/\s*,\s*/);R=parseFloat(ac[0])*2.55;Z=parseFloat(ac[1])*2.55;ae=parseFloat(ac[2])*2.55;}if(ac[6]){ac=ac[6].split(/\s*,\s*/);R=parseFloat(ac[0]);Z=parseFloat(ac[1]);ae=parseFloat(ac[2]);return f.hsb2rgb(R,Z,ae);}if(ac[7]){ac=ac[7].split(/\s*,\s*/);R=parseFloat(ac[0])*2.55;Z=parseFloat(ac[1])*2.55;ae=parseFloat(ac[2])*2.55;return f.hsb2rgb(R,Z,ae);}ac={r:R,g:Z,b:ae};var i=Math.round(R).toString(16),aa=Math.round(Z).toString(16),ad=Math.round(ae).toString(16);(i.length==1)&&(i="0"+i);(aa.length==1)&&(aa="0"+aa);(ad.length==1)&&(ad="0"+ad);ac.hex="#"+i+aa+ad;ab=ac;}else{ab={r:-1,g:-1,b:-1,hex:"none"};}return ab;},f);f.getColor=function(i){var R=this.getColor.start=this.getColor.start||{h:0,s:1,b:i||0.75},e=this.hsb2rgb(R.h,R.s,R.b);R.h+=0.075;if(R.h>1){R.h=0;R.s-=0.2;if(R.s<=0){this.getColor.start={h:0,s:1,b:R.b};}}return e.hex;};f.getColor.reset=function(){delete this.start;};f.parsePathString=X(function(e){if(!e){return null;}var R={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},i=[];if(f.is(e,"array")&&f.is(e[0],"array")){i=t(e);}if(!i.length){(e+"").replace(/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,function(aa,Z,ad){var ac=[],ab=Z.toLowerCase();ad.replace(/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig,function(af,ae){ae&&ac.push(+ae);});while(ac.length>=R[ab]){i.push([Z].concat(ac.splice(0,R[ab])));if(!R[ab]){break;}}});}i.toString=f._path2string;return i;});var C=X(function(ag){if(!ag){return{x:0,y:0,width:0,height:0};}ag=O(ag);var ad=0,ac=0,Z=[],R=[];for(var aa=0,af=ag.length;aa<af;aa++){if(ag[aa][0]=="M"){ad=ag[aa][1];ac=ag[aa][2];Z.push(ad);R.push(ac);}else{var ab=J(ad,ac,ag[aa][1],ag[aa][2],ag[aa][3],ag[aa][4],ag[aa][5],ag[aa][6]);Z=Z.concat(ab.min.x,ab.max.x);R=R.concat(ab.min.y,ab.max.y);}}var e=Math.min.apply(0,Z),ae=Math.min.apply(0,R);return{x:e,y:ae,width:Math.max.apply(0,Z)-e,height:Math.max.apply(0,R)-ae};}),t=function(ac){var Z=[];if(!f.is(ac,"array")||!f.is(ac&&ac[0],"array")){ac=f.parsePathString(ac);}for(var R=0,aa=ac.length;R<aa;R++){Z[R]=[];for(var e=0,ab=ac[R].length;e<ab;e++){Z[R][e]=ac[R][e];}}Z.toString=f._path2string;return Z;},c=X(function(aa){if(!f.is(aa,"array")||!f.is(aa&&aa[0],"array")){aa=f.parsePathString(aa);}var ag=[],ai=0,ah=0,al=0,ak=0,Z=0;if(aa[0][0]=="M"){ai=aa[0][1];ah=aa[0][2];al=ai;ak=ah;Z++;ag.push(["M",ai,ah]);}for(var ad=Z,am=aa.length;ad<am;ad++){var e=ag[ad]=[],aj=aa[ad];if(aj[0]!=aj[0].toLowerCase()){e[0]=aj[0].toLowerCase();switch(e[0]){case"a":e[1]=aj[1];e[2]=aj[2];e[3]=aj[3];e[4]=aj[4];e[5]=aj[5];e[6]=+(aj[6]-ai).toFixed(3);e[7]=+(aj[7]-ah).toFixed(3);break;case"v":e[1]=+(aj[1]-ah).toFixed(3);break;case"m":al=aj[1];ak=aj[2];default:for(var ac=1,ae=aj.length;ac<ae;ac++){e[ac]=+(aj[ac]-((ac%2)?ai:ah)).toFixed(3);}}}else{e=ag[ad]=[];if(aj[0]=="m"){al=aj[1]+ai;ak=aj[2]+ah;}for(var ab=0,R=aj.length;ab<R;ab++){ag[ad][ab]=aj[ab];}}var af=ag[ad].length;switch(ag[ad][0]){case"z":ai=al;ah=ak;break;case"h":ai+=+ag[ad][af-1];break;case"v":ah+=+ag[ad][af-1];break;default:ai+=+ag[ad][af-2];ah+=+ag[ad][af-1];}}ag.toString=f._path2string;return ag;},0,t),w=X(function(aa){if(!f.is(aa,"array")||!f.is(aa&&aa[0],"array")){aa=f.parsePathString(aa);}var af=[],ah=0,ag=0,ak=0,aj=0,Z=0;if(aa[0][0]=="M"){ah=+aa[0][1];ag=+aa[0][2];ak=ah;aj=ag;Z++;af[0]=["M",ah,ag];}for(var ad=Z,al=aa.length;ad<al;ad++){var e=af[ad]=[],ai=aa[ad];if(ai[0]!=(ai[0]+"").toUpperCase()){e[0]=(ai[0]+"").toUpperCase();switch(e[0]){case"A":e[1]=ai[1];e[2]=ai[2];e[3]=ai[3];e[4]=ai[4];e[5]=ai[5];e[6]=+(ai[6]+ah);e[7]=+(ai[7]+ag);break;case"V":e[1]=+ai[1]+ag;break;case"H":e[1]=+ai[1]+ah;break;case"M":ak=+ai[1]+ah;aj=+ai[2]+ag;default:for(var ac=1,ae=ai.length;ac<ae;ac++){e[ac]=+ai[ac]+((ac%2)?ah:ag);}}}else{for(var ab=0,R=ai.length;ab<R;ab++){af[ad][ab]=ai[ab];}}switch(e[0]){case"Z":ah=ak;ag=aj;break;case"H":ah=e[1];break;case"V":ag=e[1];break;default:ah=af[ad][af[ad].length-2];ag=af[ad][af[ad].length-1];}}af.toString=f._path2string;return af;},null,t),d=function(i,Z,e,R){return[i,Z,e,R,e,R];},x=function(i,Z,ab,aa,e,R){return[2/3*i+1/3*ab,2/3*Z+1/3*aa,2/3*i+1/3*e,2/3*Z+1/3*R,e,R];},r=function(ak,aP,au,ar,al,af,aa,aj,aO,am){var aq=Math.PI*120/180,e=Math.PI/180*(+al||0),ay=[],av,aL=X(function(aQ,aT,i){var aS=aQ*Math.cos(i)-aT*Math.sin(i),aR=aQ*Math.sin(i)+aT*Math.cos(i);return{x:aS,y:aR};});if(!am){av=aL(ak,aP,-e);ak=av.x;aP=av.y;av=aL(aj,aO,-e);aj=av.x;aO=av.y;var R=Math.cos(Math.PI/180*al),ah=Math.sin(Math.PI/180*al),aA=(ak-aj)/2,az=(aP-aO)/2;au=Math.max(au,Math.abs(aA));ar=Math.max(ar,Math.abs(az));var Z=au*au,aD=ar*ar,aF=(af==aa?-1:1)*Math.sqrt(Math.abs((Z*aD-Z*az*az-aD*aA*aA)/(Z*az*az+aD*aA*aA))),ao=aF*au*az/ar+(ak+aj)/2,an=aF*-ar*aA/au+(aP+aO)/2,ae=Math.asin((aP-an)/ar),ad=Math.asin((aO-an)/ar);ae=ak<ao?Math.PI-ae:ae;ad=aj<ao?Math.PI-ad:ad;ae<0&&(ae=Math.PI*2+ae);ad<0&&(ad=Math.PI*2+ad);if(aa&&ae>ad){ae=ae-Math.PI*2;}if(!aa&&ad>ae){ad=ad-Math.PI*2;}}else{ae=am[0];ad=am[1];ao=am[2];an=am[3];}var ai=ad-ae;if(Math.abs(ai)>aq){var ap=ad,at=aj,ag=aO;ad=ae+aq*(aa&&ad>ae?1:-1);aj=ao+au*Math.cos(ad);aO=an+ar*Math.sin(ad);ay=r(aj,aO,au,ar,al,0,aa,at,ag,[ad,ap,ao,an]);}ai=ad-ae;var ac=Math.cos(ae),aN=Math.sin(ae),ab=Math.cos(ad),aM=Math.sin(ad),aB=Math.tan(ai/4),aE=4/3*au*aB,aC=4/3*ar*aB,aK=[ak,aP],aJ=[ak+aE*aN,aP-aC*ac],aI=[aj+aE*aM,aO-aC*ab],aG=[aj,aO];aJ[0]=2*aK[0]-aJ[0];aJ[1]=2*aK[1]-aJ[1];if(am){return[aJ,aI,aG].concat(ay);}else{ay=[aJ,aI,aG].concat(ay).join(",").split(",");var aw=[];for(var aH=0,ax=ay.length;aH<ax;aH++){aw[aH]=aH%2?aL(ay[aH-1],ay[aH],e).y:aL(ay[aH],ay[aH+1],e).x;}return aw;}},A=X(function(i,e,ao,am,ab,aa,ad,ac,ai){var ag=Math.pow(1-ai,3)*i+Math.pow(1-ai,2)*3*ai*ao+(1-ai)*3*ai*ai*ab+Math.pow(ai,3)*ad,ae=Math.pow(1-ai,3)*e+Math.pow(1-ai,2)*3*ai*am+(1-ai)*3*ai*ai*aa+Math.pow(ai,3)*ac,ak=i+2*ai*(ao-i)+ai*ai*(ab-2*ao+i),aj=e+2*ai*(am-e)+ai*ai*(aa-2*am+e),an=ao+2*ai*(ab-ao)+ai*ai*(ad-2*ab+ao),al=am+2*ai*(aa-am)+ai*ai*(ac-2*aa+am),ah=(1-ai)*i+ai*ao,af=(1-ai)*e+ai*am,Z=(1-ai)*ab+ai*ad,R=(1-ai)*aa+ai*ac;return{x:ag,y:ae,m:{x:ak,y:aj},n:{x:an,y:al},start:{x:ah,y:af},end:{x:Z,y:R}};}),J=X(function(i,e,Z,R,am,al,ai,af){var ak=(am-2*Z+i)-(ai-2*am+Z),ah=2*(Z-i)-2*(am-Z),ae=i-Z,ac=(-ah+Math.sqrt(ah*ah-4*ak*ae))/2/ak,aa=(-ah-Math.sqrt(ah*ah-4*ak*ae))/2/ak,ag=[e,af],aj=[i,ai],ad=A(i,e,Z,R,am,al,ai,af,ac>0&&ac<1?ac:0),ab=A(i,e,Z,R,am,al,ai,af,aa>0&&aa<1?aa:0);aj=aj.concat(ad.x,ab.x);ag=ag.concat(ad.y,ab.y);ak=(al-2*R+e)-(af-2*al+R);ah=2*(R-e)-2*(al-R);ae=e-R;ac=(-ah+Math.sqrt(ah*ah-4*ak*ae))/2/ak;aa=(-ah-Math.sqrt(ah*ah-4*ak*ae))/2/ak;ad=A(i,e,Z,R,am,al,ai,af,ac>0&&ac<1?ac:0);ab=A(i,e,Z,R,am,al,ai,af,aa>0&&aa<1?aa:0);aj=aj.concat(ad.x,ab.x);ag=ag.concat(ad.y,ab.y);return{min:{x:Math.min.apply(Math,aj),y:Math.min.apply(Math,ag)},max:{x:Math.max.apply(Math,aj),y:Math.max.apply(Math,ag)}};}),O=X(function(al,ag){var aa=w(al),ah=ag&&w(ag),ai={x:0,y:0,bx:0,by:0,X:0,Y:0},e={x:0,y:0,bx:0,by:0,X:0,Y:0},ac=function(am,an){var i,ao;if(!am){return["C",an.x,an.y,an.x,an.y,an.x,an.y];}switch(am[0]){case"M":an.X=am[1];an.Y=am[2];break;case"A":am=["C"].concat(r.apply(0,[an.x,an.y].concat(am.slice(1))));break;case"S":i=an.x+(an.x-(an.bx||an.x));ao=an.y+(an.y-(an.by||an.y));am=["C",i,ao].concat(am.slice(1));break;case"T":i=an.x+(an.x-(an.bx||an.x));ao=an.y+(an.y-(an.by||an.y));am=["C"].concat(x(an.x,an.y,i,ao,am[1],am[2]));break;case"Q":am=["C"].concat(x(an.x,an.y,am[1],am[2],am[3],am[4]));break;case"L":am=["C"].concat(d(an.x,an.y,am[1],am[2]));break;case"H":am=["C"].concat(d(an.x,an.y,am[1],an.y));break;case"V":am=["C"].concat(d(an.x,an.y,an.x,am[1]));break;case"Z":am=["C"].concat(d(an.x,an.y,an.X,an.Y));break;}return am;},R=function(am,an){if(am[an].length>7){am[an].shift();var ao=am[an];while(ao.length){am.splice(an++,0,["C"].concat(ao.splice(0,6)));}am.splice(an,1);aj=Math.max(aa.length,ah&&ah.length||0);}},Z=function(aq,ap,an,am,ao){if(aq&&ap&&aq[ao][0]=="M"&&ap[ao][0]!="M"){ap.splice(ao,0,["M",am.x,am.y]);an.bx=0;an.by=0;an.x=aq[ao][1];an.y=aq[ao][2];aj=Math.max(aa.length,ah&&ah.length||0);}};for(var ae=0,aj=Math.max(aa.length,ah&&ah.length||0);ae<aj;ae++){aa[ae]=ac(aa[ae],ai);R(aa,ae);ah&&(ah[ae]=ac(ah[ae],e));ah&&R(ah,ae);Z(aa,ah,ai,e,ae);Z(ah,aa,e,ai,ae);var ad=aa[ae],ak=ah&&ah[ae],ab=ad.length,af=ah&&ak.length;ai.bx=ad[ab-4]||0;ai.by=ad[ab-3]||0;ai.x=ad[ab-2];ai.y=ad[ab-1];e.bx=ah&&(ak[af-4]||0);e.by=ah&&(ak[af-3]||0);e.x=ah&&ak[af-2];e.y=ah&&ak[af-1];}return ah?[aa,ah]:aa;},null,t),n=X(function(ah){if(f.is(ah,"string")){ah=ah.split(/\s*\-\s*/);var Z=ah.shift();if(Z.toLowerCase()=="v"){Z=90;}else{if(Z.toLowerCase()=="h"){Z=0;}else{Z=parseFloat(Z);}}Z=-Z;var af={angle:Z,type:"linear",dots:[],vector:[0,0,Math.cos(Z*Math.PI/180).toFixed(3),Math.sin(Z*Math.PI/180).toFixed(3)]},ag=1/(Math.max(Math.abs(af.vector[2]),Math.abs(af.vector[3]))||1);af.vector[2]*=ag;af.vector[3]*=ag;if(af.vector[2]<0){af.vector[0]=-af.vector[2];af.vector[2]=0;}if(af.vector[3]<0){af.vector[1]=-af.vector[3];af.vector[3]=0;}af.vector[0]=af.vector[0];af.vector[1]=af.vector[1];af.vector[2]=af.vector[2];af.vector[3]=af.vector[3];for(var ac=0,ai=ah.length;ac<ai;ac++){var e={},ae=ah[ac].match(/^([^:]*):?([\d\.]*)/);e.color=f.getRGB(ae[1]).hex;ae[2]&&(e.offset=ae[2]+"%");af.dots.push(e);}for(var ac=1,ai=af.dots.length-1;ac<ai;ac++){if(!af.dots[ac].offset){var R=parseFloat(af.dots[ac-1].offset||0),aa=false;for(var ab=ac+1;ab<ai;ab++){if(af.dots[ab].offset){aa=af.dots[ab].offset;break;}}if(!aa){aa=100;ab=ai;}aa=parseFloat(aa);var ad=(aa-R)/(ab-ac+1);for(;ac<ab;ac++){R+=ad;af.dots[ac].offset=R+"%";}}}return af;}else{return ah;}}),G=function(){var R,i,aa,Z,e;if(f.is(arguments[0],"string")||f.is(arguments[0],"object")){if(f.is(arguments[0],"string")){R=g.getElementById(arguments[0]);}else{R=arguments[0];}if(R.tagName){if(arguments[1]==null){return{container:R,width:R.style.pixelWidth||R.offsetWidth,height:R.style.pixelHeight||R.offsetHeight};}else{return{container:R,width:arguments[1],height:arguments[2]};}}}else{if(f.is(arguments[0],"number")&&arguments.length>3){return{container:1,x:arguments[0],y:arguments[1],width:arguments[2],height:arguments[3]};}}},a=function(e,R){var i=this;for(var Z in R){if(R.hasOwnProperty(Z)&&!(Z in e)){switch(typeof R[Z]){case"function":(function(aa){e[Z]=e===i?aa:function(){return aa.apply(i,arguments);};})(R[Z]);break;case"object":e[Z]=e[Z]||{};a.call(this,e[Z],R[Z]);break;default:e[Z]=R[Z];break;}}}};if(f.svg){b.svgns="http://www.w3.org/2000/svg";b.xlink="http://www.w3.org/1999/xlink";var N=function(e){return +e+(Math.floor(e)==e)*0.5;};var z=function(ab){for(var R=0,Z=ab.length;R<Z;R++){if(ab[R][0].toLowerCase()!="a"){for(var e=1,aa=ab[R].length;e<aa;e++){ab[R][e]=N(ab[R][e]);}}else{ab[R][6]=N(ab[R][6]);ab[R][7]=N(ab[R][7]);}}return ab;};var B=function(R,e){if(e){for(var i in e){if(e.hasOwnProperty(i)){R.setAttribute(i,e[i]);}}}else{return g.createElementNS(b.svgns,R);}};f.toString=function(){return"Your browser supports SVG.\nYou are running Rapha\u00ebl "+this.version;};var W=function(e,Z){var i=B("path");Z.canvas&&Z.canvas.appendChild(i);var R=new m(i,Z);R.type="path";F(R,{fill:"none",stroke:"#000",path:e});return R;};var M=function(ad,ab,ae){ab=n(ab);var aa=B((ab.type||"linear")+"Gradient");aa.id="r"+(f.idGenerator++).toString(36);if(ab.vector&&ab.vector.length){B(aa,{x1:ab.vector[0],y1:ab.vector[1],x2:ab.vector[2],y2:ab.vector[3]});}ae.defs.appendChild(aa);var ac=true;for(var R=0,Z=ab.dots.length;R<Z;R++){var e=B("stop");if(ab.dots[R].offset){ac=false;}B(e,{offset:ab.dots[R].offset?ab.dots[R].offset:(R==0)?"0%":"100%","stop-color":f.getRGB(ab.dots[R].color).hex||"#fff"});aa.appendChild(e);}if(ac&&ab.dots[Z-1].opacity!=null){B(e,{"stop-opacity":ab.dots[Z-1].opacity});}B(ad,{fill:"url(#"+aa.id+")",opacity:1,"fill-opacity":1});ad.style.fill="";ad.style.opacity=1;ad.style.fillOpacity=1;};var s=function(i){var e=i.getBBox();B(i.pattern,{patternTransform:f.format("translate({0},{1})",e.x,e.y)});};var F=function(ah,aq){var ak={"":[0],none:[0],"-":[3,1],".":[1,1],"-.":[3,1,1,1],"-..":[3,1,1,1,1,1],". ":[1,3],"- ":[4,3],"--":[8,3],"- .":[4,3,1,3],"--.":[8,3,1,3],"--..":[8,3,1,3,1,3]},am=ah.node,ai=ah.attrs,ae=ah.attr("rotation"),ab=function(ay,ax){ax=ak[(ax+"").toLowerCase()];if(ax){var av=ay.attrs["stroke-width"]||"1",at={round:av,square:av,butt:0}[ay.attrs["stroke-linecap"]||aq["stroke-linecap"]]||0,aw=[];var au=ax.length;while(au--){aw[au]=ax[au]*av+((au%2)?1:-1)*at;}B(am,{"stroke-dasharray":aw.join(",")});}};parseFloat(ae)&&ah.rotate(0,true);for(var al in aq){if(aq.hasOwnProperty(al)){if(!(al in q)){continue;}var aj=aq[al];ai[al]=aj;switch(al){case"href":case"title":case"target":var ao=am.parentNode;if(ao.tagName.toLowerCase()!="a"){var Z=B("a");ao.insertBefore(Z,am);Z.appendChild(am);ao=Z;}ao.setAttributeNS(ah.paper.xlink,al,aj);break;case"clip-rect":var i=(aj+"").split(Y);if(i.length==4){ah.clip&&ah.clip.parentNode.parentNode.removeChild(ah.clip.parentNode);var R=B("clipPath"),an=B("rect");R.id="r"+(f.idGenerator++).toString(36);B(an,{x:i[0],y:i[1],width:i[2],height:i[3]});R.appendChild(an);ah.paper.defs.appendChild(R);B(am,{"clip-path":"url(#"+R.id+")"});ah.clip=an;}if(!aj){var ap=g.getElementById(am.getAttribute("clip-path").replace(/(^url\(#|\)$)/g,""));ap&&ap.parentNode.removeChild(ap);B(am,{"clip-path":""});delete ah.clip;}break;case"path":if(aj&&ah.type=="path"){ai.path=z(w(aj));B(am,{d:ai.path});}case"width":am.setAttribute(al,aj);if(ai.fx){al="x";aj=ai.x;}else{break;}case"x":if(ai.fx){aj=-ai.x-(ai.width||0);}case"rx":if(al=="rx"&&ah.type=="rect"){break;}case"cx":am.setAttribute(al,aj);ah.pattern&&s(ah);break;case"height":am.setAttribute(al,aj);if(ai.fy){al="y";aj=ai.y;}else{break;}case"y":if(ai.fy){aj=-ai.y-(ai.height||0);}case"ry":if(al=="ry"&&ah.type=="rect"){break;}case"cy":am.setAttribute(al,aj);ah.pattern&&s(ah);break;case"r":if(ah.type=="rect"){B(am,{rx:aj,ry:aj});}else{am.setAttribute(al,aj);}break;case"src":if(ah.type=="image"){am.setAttributeNS(ah.paper.xlink,"href",aj);}break;case"stroke-width":am.style.strokeWidth=aj;am.setAttribute(al,aj);if(ai["stroke-dasharray"]){ab(ah,ai["stroke-dasharray"]);}break;case"stroke-dasharray":ab(ah,aj);break;case"rotation":ae=aj;ah.rotate(aj,true);break;case"translation":var ac=(aj+"").split(Y);ah.translate((+ac[0]+1||2)-1,(+ac[1]+1||2)-1);break;case"scale":var ac=(aj+"").split(Y);ah.scale(+ac[0]||1,+ac[1]||+ac[0]||1,+ac[2]||null,+ac[3]||null);break;case"fill":var aa=(aj+"").match(/^url\(['"]?([^\)]+)['"]?\)$/i);if(aa){var R=B("pattern"),ag=B("image");R.id="r"+(f.idGenerator++).toString(36);B(R,{x:0,y:0,patternUnits:"userSpaceOnUse"});B(ag,{x:0,y:0});ag.setAttributeNS(ah.paper.xlink,"href",aa[1]);R.appendChild(ag);var ar=g.createElement("img");ar.style.position="absolute";ar.style.top="-9999em";ar.style.left="-9999em";ar.onload=function(){B(R,{width:this.offsetWidth,height:this.offsetHeight});B(ag,{width:this.offsetWidth,height:this.offsetHeight});g.body.removeChild(this);b.safari();};g.body.appendChild(ar);ar.src=aa[1];ah.paper.defs.appendChild(R);am.style.fill="url(#"+R.id+")";B(am,{fill:"url(#"+R.id+")"});ah.pattern=R;ah.pattern&&s(ah);break;}delete aq.gradient;delete ai.gradient;if(!f.is(ai.opacity,"undefined")&&f.is(aq.opacity,"undefined")){am.style.opacity=ai.opacity;B(am,{opacity:ai.opacity});}if(!f.is(ai["fill-opacity"],"undefined")&&f.is(aq["fill-opacity"],"undefined")){am.style.fillOpacity=ai["fill-opacity"];B(am,{"fill-opacity":ai["fill-opacity"]});}case"stroke":am.style[al]=f.getRGB(aj).hex;am.setAttribute(al,f.getRGB(aj).hex);break;case"gradient":M(am,aj,ah.paper);break;case"opacity":case"fill-opacity":if(ai.gradient){var e=g.getElementById(am.getAttribute("fill").replace(/^url\(#|\)$/g,""));if(e){var ad=e.getElementsByTagName("stop");ad[ad.length-1].setAttribute("stop-opacity",aj);}break;}default:al=="font-size"&&(aj=parseInt(aj,10)+"px");var af=al.replace(/(\-.)/g,function(at){return at.substring(1).toUpperCase();});am.style[af]=aj;am.setAttribute(al,aj);break;}}}T(ah,aq);parseInt(ae,10)&&ah.rotate(ae,true);};var K=1.2;var T=function(e,aa){if(e.type!="text"||!("text" in aa||"font" in aa||"font-size" in aa||"x" in aa||"y" in aa)){return;}var af=e.attrs,R=e.node,ah=R.firstChild?parseInt(g.defaultView.getComputedStyle(R.firstChild,"").getPropertyValue("font-size"),10):10;if("text" in aa){while(R.firstChild){R.removeChild(R.firstChild);}var Z=(aa.text+"").split("\n");for(var ab=0,ag=Z.length;ab<ag;ab++){var ad=B("tspan");ab&&B(ad,{dy:ah*K,x:af.x});ad.appendChild(g.createTextNode(Z[ab]));R.appendChild(ad);}}else{var Z=R.getElementsByTagName("tspan");for(var ab=0,ag=Z.length;ab<ag;ab++){ab&&B(Z[ab],{dy:ah*K,x:af.x});}}B(R,{y:af.y});var ac=e.getBBox(),ae=af.y-(ac.y+ac.height/2);ae&&B(R,{y:af.y+ae});};var m=function(i,e){var Z=0,R=0;this[0]=i;this.node=i;this.paper=e;this.attrs=this.attrs||{};this.transformations=[];this._={tx:0,ty:0,rt:{deg:0,cx:0,cy:0},sx:1,sy:1};};m.prototype.rotate=function(i,e,Z){if(i==null){if(this._.rt.cx){return[this._.rt.deg,this._.rt.cx,this._.rt.cy].join(" ");}return this._.rt.deg;}var R=this.getBBox();i=(i+"").split(Y);if(i.length-1){e=parseFloat(i[1]);Z=parseFloat(i[2]);}i=parseFloat(i[0]);if(e!=null){this._.rt.deg=i;}else{this._.rt.deg+=i;}(Z==null)&&(e=null);this._.rt.cx=e;this._.rt.cy=Z;e=e==null?R.x+R.width/2:e;Z=Z==null?R.y+R.height/2:Z;if(this._.rt.deg){this.transformations[0]=f.format("rotate({0} {1} {2})",this._.rt.deg,e,Z);this.clip&&B(this.clip,{transform:f.format("rotate({0} {1} {2})",-this._.rt.deg,e,Z)});}else{this.transformations[0]="";this.clip&&B(this.clip,{transform:""});}B(this.node,{transform:this.transformations.join(" ")});return this;};m.prototype.hide=function(){this.node.style.display="none";return this;};m.prototype.show=function(){this.node.style.display="block";return this;};m.prototype.remove=function(){this.node.parentNode.removeChild(this.node);};m.prototype.getBBox=function(){if(this.type=="path"){return C(this.attrs.path);}if(this.node.style.display=="none"){this.show();var Z=true;}var ad={};try{ad=this.node.getBBox();}catch(ab){}finally{ad=ad||{};}if(this.type=="text"){ad={x:ad.x,y:Infinity,width:ad.width,height:0};for(var R=0,aa=this.node.getNumberOfChars();R<aa;R++){var ac=this.node.getExtentOfChar(R);(ac.y<ad.y)&&(ad.y=ac.y);(ac.y+ac.height-ad.y>ad.height)&&(ad.height=ac.y+ac.height-ad.y);}}Z&&this.hide();return ad;};m.prototype.attr=function(){if(arguments.length==1&&f.is(arguments[0],"string")){if(arguments[0]=="translation"){return this.translate();}if(arguments[0]=="rotation"){return this.rotate();}if(arguments[0]=="scale"){return this.scale();}return this.attrs[arguments[0]];}if(arguments.length==1&&f.is(arguments[0],"array")){var e={};for(var i in arguments[0]){if(arguments[0].hasOwnProperty(i)){e[arguments[0][i]]=this.attrs[arguments[0][i]];}}return e;}if(arguments.length==2){var R={};R[arguments[0]]=arguments[1];F(this,R);}else{if(arguments.length==1&&f.is(arguments[0],"object")){F(this,arguments[0]);}}return this;};m.prototype.toFront=function(){this.node.parentNode.appendChild(this.node);return this;};m.prototype.toBack=function(){if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild);}return this;};m.prototype.insertAfter=function(e){if(e.node.nextSibling){e.node.parentNode.insertBefore(this.node,e.node.nextSibling);}else{e.node.parentNode.appendChild(this.node);}return this;};m.prototype.insertBefore=function(e){var i=e.node;i.parentNode.insertBefore(this.node,i);return this;};m.prototype.blur=function(e){if(e!="none"){var i=B("filter"),R=B("feGaussianBlur");i.id="r"+(f.idGenerator++).toString(36);B(R,{stdDeviation:+e||1.5});i.appendChild(R);this.paper.defs.appendChild(i);this._blur=i;B(this.node,{filter:"url(#"+i.id+")"});}else{if(this._blur){this._blur.parentNode.removeChild(this._blur);delete this._blur;}this.node.removeAttribute("filter");}};var D=function(i,e,ab,aa){e=N(e);ab=N(ab);var Z=B("circle");i.canvas&&i.canvas.appendChild(Z);var R=new m(Z,i);R.attrs={cx:e,cy:ab,r:aa,fill:"none",stroke:"#000"};R.type="circle";B(Z,R.attrs);return R;};var I=function(R,e,ad,i,ab,ac){e=N(e);ad=N(ad);var aa=B("rect");R.canvas&&R.canvas.appendChild(aa);var Z=new m(aa,R);Z.attrs={x:e,y:ad,width:i,height:ab,r:ac||0,rx:ac||0,ry:ac||0,fill:"none",stroke:"#000"};Z.type="rect";B(aa,Z.attrs);return Z;};var h=function(i,e,ac,ab,aa){e=N(e);ac=N(ac);var Z=B("ellipse");i.canvas&&i.canvas.appendChild(Z);var R=new m(Z,i);R.attrs={cx:e,cy:ac,rx:ab,ry:aa,fill:"none",stroke:"#000"};R.type="ellipse";B(Z,R.attrs);return R;};var p=function(R,ac,e,ad,i,ab){var aa=B("image");B(aa,{x:e,y:ad,width:i,height:ab,preserveAspectRatio:"none"});aa.setAttributeNS(R.xlink,"href",ac);R.canvas&&R.canvas.appendChild(aa);var Z=new m(aa,R);Z.attrs={x:e,y:ad,width:i,height:ab,src:ac};Z.type="image";return Z;};var H=function(i,e,ab,aa){var Z=B("text");B(Z,{x:e,y:ab,"text-anchor":"middle"});i.canvas&&i.canvas.appendChild(Z);var R=new m(Z,i);R.attrs={x:e,y:ab,"text-anchor":"middle",text:aa,font:q.font,stroke:"none",fill:"#000"};R.type="text";F(R,R.attrs);return R;};var E=function(i,e){this.width=i||this.width;this.height=e||this.height;this.canvas.setAttribute("width",this.width);this.canvas.setAttribute("height",this.height);return this;};var l=function(){var aa=G.apply(null,arguments),R=aa.container,ac=aa.x,ab=aa.y,Z=aa.width,ad=aa.height;if(!R){throw new Error("SVG container not found.");}b.canvas=B("svg");var e=b.canvas,ae=e.style;e.setAttribute("width",Z||512);b.width=Z||512;e.setAttribute("height",ad||342);b.height=ad||342;if(R==1){g.body.appendChild(e);ae.position="absolute";ae.left=ac+"px";ae.top=ab+"px";}else{if(R.firstChild){R.insertBefore(e,R.firstChild);}else{R.appendChild(e);}}R={canvas:e,clear:function(){while(this.canvas.firstChild){this.canvas.removeChild(this.canvas.firstChild);}this.desc=B("desc");this.defs=B("defs");this.desc.appendChild(g.createTextNode("Created with Rapha\u00ebl"));this.canvas.appendChild(this.desc);this.canvas.appendChild(this.defs);}};for(var i in b){if(b.hasOwnProperty(i)){if(i!="create"){R[i]=b[i];}}}a.call(R,R,f.fn);R.clear();R.raphael=f;return R;};b.remove=function(){this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas);};if({"Apple Computer, Inc.":1,"Google Inc.":1}[navigator.vendor]){b.safari=function(){var e=this.rect(-99,-99,this.width+99,this.height+99);setTimeout(function(){e.remove();});};}else{b.safari=function(){};}}if(f.vml){var y=function(ac){var aa=O(ac);for(var R=0,Z=aa.length;R<Z;R++){aa[R][0]=(aa[R][0]+"").toLowerCase();aa[R][0]=="z"&&(aa[R][0]="x");for(var e=1,ab=aa[R].length;e<ab;e++){aa[R][e]=Math.round(aa[R][e]);}}return(aa+"");};f.toString=function(){return"Your browser doesn\u2019t support SVG. Assuming it is Internet Explorer and falling down to VML.\nYou are running Rapha\u00ebl "+this.version;};var W=function(e,ab){var Z=V("group"),ac=Z.style;ac.position="absolute";ac.left=0;ac.top=0;ac.width=ab.width+"px";ac.height=ab.height+"px";Z.coordsize=ab.coordsize;Z.coordorigin=ab.coordorigin;var R=V("shape"),i=R.style;i.width=ab.width+"px";i.height=ab.height+"px";R.path="";R.coordsize=this.coordsize;R.coordorigin=this.coordorigin;Z.appendChild(R);var aa=new m(R,Z,ab);aa.isAbsolute=true;aa.type="path";aa.path=[];aa.Path="";if(e){aa.attrs.path=f.parsePathString(e);aa.node.path=y(aa.attrs.path);}F(aa,{fill:"none",stroke:"#000"});aa.setBox();ab.canvas.appendChild(Z);return aa;};var F=function(af,aj){af.attrs=af.attrs||{};var ah=af.node,ak=af.attrs,ac=ah.style,Z,ao=af;for(var ad in aj){if(aj.hasOwnProperty(ad)){ak[ad]=aj[ad];}}aj.href&&(ah.href=aj.href);aj.title&&(ah.title=aj.title);aj.target&&(ah.target=aj.target);if(aj.path&&af.type=="path"){ak.path=f.parsePathString(aj.path);ah.path=y(ak.path);}if(aj.rotation!=null){af.rotate(aj.rotation,true);}if(aj.translation){Z=(aj.translation+"").split(Y);af.translate(Z[0],Z[1]);}if(aj.scale){Z=(aj.scale+"").split(Y);af.scale(+Z[0]||1,+Z[1]||+Z[0]||1,+Z[2]||null,+Z[3]||null);}if("clip-rect" in aj){var e=(aj["clip-rect"]+"").split(Y);if(e.length==4){e[2]=+e[2]+(+e[0]);e[3]=+e[3]+(+e[1]);var ae=ah.clipRect||g.createElement("div"),an=ae.style,ab=ah.parentNode;an.clip=f.format("rect({0}px {2}px {3}px {1}px)",e);if(!ah.clipRect){an.position="absolute";an.top=0;an.left=0;an.width=af.paper.width+"px";an.height=af.paper.height+"px";ab.parentNode.insertBefore(ae,ab);ae.appendChild(ab);ah.clipRect=ae;}}if(!aj["clip-rect"]){ah.clipRect&&(ah.clipRect.style.clip="");}}if(af.type=="image"&&aj.src){ah.src=aj.src;}if(af.type=="image"&&aj.opacity){ah.filterOpacity=" progid:DXImageTransform.Microsoft.Alpha(opacity="+(aj.opacity*100)+")";ac.filter=(ah.filterMatrix||"")+(ah.filterOpacity||"");}aj.font&&(ac.font=aj.font);aj["font-family"]&&(ac.fontFamily='"'+aj["font-family"].split(",")[0].replace(/^['"]+|['"]+$/g,"")+'"');aj["font-size"]&&(ac.fontSize=aj["font-size"]);aj["font-weight"]&&(ac.fontWeight=aj["font-weight"]);aj["font-style"]&&(ac.fontStyle=aj["font-style"]);if(aj.opacity!=null||aj["stroke-width"]!=null||aj.fill!=null||aj.stroke!=null||aj["stroke-width"]!=null||aj["stroke-opacity"]!=null||aj["fill-opacity"]!=null||aj["stroke-dasharray"]!=null||aj["stroke-miterlimit"]!=null||aj["stroke-linejoin"]!=null||aj["stroke-linecap"]!=null){ah=af.shape||ah;var ai=(ah.getElementsByTagName("fill")&&ah.getElementsByTagName("fill")[0]),al=false;!ai&&(al=ai=V("fill"));if("fill-opacity" in aj||"opacity" in aj){var i=((+ak["fill-opacity"]+1||2)-1)*((+ak.opacity+1||2)-1);i<0&&(i=0);i>1&&(i=1);ai.opacity=i;}aj.fill&&(ai.on=true);if(ai.on==null||aj.fill=="none"){ai.on=false;}if(ai.on&&aj.fill){var R=aj.fill.match(/^url\(([^\)]+)\)$/i);if(R){ai.src=R[1];ai.type="tile";}else{ai.color=f.getRGB(aj.fill).hex;ai.src="";ai.type="solid";}}al&&ah.appendChild(ai);var aa=(ah.getElementsByTagName("stroke")&&ah.getElementsByTagName("stroke")[0]),am=false;!aa&&(am=aa=V("stroke"));if((aj.stroke&&aj.stroke!="none")||aj["stroke-width"]||aj["stroke-opacity"]!=null||aj["stroke-dasharray"]||aj["stroke-miterlimit"]||aj["stroke-linejoin"]||aj["stroke-linecap"]){aa.on=true;}(aj.stroke=="none"||aa.on==null||aj.stroke==0||aj["stroke-width"]==0)&&(aa.on=false);aa.on&&aj.stroke&&(aa.color=f.getRGB(aj.stroke).hex);var i=((+ak["stroke-opacity"]+1||2)-1)*((+ak.opacity+1||2)-1);i<0&&(i=0);i>1&&(i=1);aa.opacity=i;aj["stroke-linejoin"]&&(aa.joinstyle=aj["stroke-linejoin"]||"miter");aa.miterlimit=aj["stroke-miterlimit"]||8;aj["stroke-linecap"]&&(aa.endcap={butt:"flat",square:"square",round:"round"}[aj["stroke-linecap"]]||"miter");aj["stroke-width"]&&(aa.weight=(parseFloat(aj["stroke-width"])||1)*12/16);if(aj["stroke-dasharray"]){var ag={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};aa.dashstyle=ag[aj["stroke-dasharray"]]||"";}am&&ah.appendChild(aa);}if(ao.type=="text"){var ac=b.span.style;ak.font&&(ac.font=ak.font);ak["font-family"]&&(ac.fontFamily=ak["font-family"]);ak["font-size"]&&(ac.fontSize=ak["font-size"]);ak["font-weight"]&&(ac.fontWeight=ak["font-weight"]);ak["font-style"]&&(ac.fontStyle=ak["font-style"]);b.span.innerHTML=ao.node.string.replace(/</g,"&#60;").replace(/&/g,"&#38;").replace(/\n/g,"<br>");ao.W=ak.w=b.span.offsetWidth;ao.H=ak.h=b.span.offsetHeight;ao.X=ak.x;ao.Y=ak.y+Math.round(ao.H/2);switch(ak["text-anchor"]){case"start":ao.node.style["v-text-align"]="left";ao.bbx=Math.round(ao.W/2);break;case"end":ao.node.style["v-text-align"]="right";ao.bbx=-Math.round(ao.W/2);break;default:ao.node.style["v-text-align"]="center";break;}}};var o=function(i,e,aa,Z){var R=Math.round(Math.atan((parseFloat(aa)-parseFloat(i))/(parseFloat(Z)-parseFloat(e)))*57.29)||0;if(!R&&parseFloat(i)<parseFloat(e)){R=180;}R-=180;if(R<0){R+=360;}return R;};var M=function(ad,ac){ac=n(ac);ad.attrs=ad.attrs||{};var R=ad.attrs,ab=ad.node.getElementsByTagName("fill");ad.attrs.gradient=ac;ad=ad.shape||ad.node;if(ab.length){ab=ab[0];}else{ab=V("fill");}if(ac.dots.length){ab.on=true;ab.method="none";ab.type=((ac.type+"").toLowerCase()=="radial")?"gradientTitle":"gradient";if(!f.is(ac.dots[0].color,"undefined")){ab.color=f.getRGB(ac.dots[0].color).hex;}if(!f.is(ac.dots[ac.dots.length-1].color,"undefined")){ab.color2=f.getRGB(ac.dots[ac.dots.length-1].color).hex;}var ae=[];for(var Z=0,aa=ac.dots.length;Z<aa;Z++){if(ac.dots[Z].offset){ae.push(ac.dots[Z].offset+" "+f.getRGB(ac.dots[Z].color).hex);}}var e=f.is(ac.dots[ac.dots.length-1].opacity,"undefined")?(f.is(R.opacity,"undefined")?1:R.opacity):ac.dots[ac.dots.length-1].opacity;if(ae.length){ab.colors.value=ae.join(",");e=f.is(R.opacity,"undefined")?1:R.opacity;}else{ab.colors&&(ab.colors.value="0% "+ab.color);}ab.opacity=e;if(!f.is(ac.angle,"undefined")){ab.angle=(-ac.angle+270)%360;}else{if(ac.vector){ab.angle=o.apply(null,ac.vector);}}if((ac.type+"").toLowerCase()=="radial"){ab.focus="100%";ab.focusposition="0.5 0.5";}}};var m=function(aa,ac,e){var ab=0,R=0,i=0,Z=1;this[0]=aa;this.node=aa;this.X=0;this.Y=0;this.attrs={};this.Group=ac;this.paper=e;this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1};};m.prototype.rotate=function(i,e,R){if(i==null){if(this._.rt.cx){return[this._.rt.deg,this._.rt.cx,this._.rt.cy].join(" ");}return this._.rt.deg;}i=(i+"").split(Y);if(i.length-1){e=parseFloat(i[1]);R=parseFloat(i[2]);}i=parseFloat(i[0]);if(e!=null){this._.rt.deg=i;}else{this._.rt.deg+=i;}(R==null)&&(e=null);this._.rt.cx=e;this._.rt.cy=R;this.setBox(this.attrs,e,R);this.Group.style.rotation=this._.rt.deg;return this;};m.prototype.setBox=function(ab,ac,aa){var R=this.Group.style,ad=(this.shape&&this.shape.style)||this.node.style;ab=ab||{};for(var ae in ab){if(ab.hasOwnProperty(ae)){this.attrs[ae]=ab[ae];}}ac=ac||this._.rt.cx;aa=aa||this._.rt.cy;var ah=this.attrs,ak,aj,al,ag;switch(this.type){case"circle":ak=ah.cx-ah.r;aj=ah.cy-ah.r;al=ag=ah.r*2;break;case"ellipse":ak=ah.cx-ah.rx;aj=ah.cy-ah.ry;al=ah.rx*2;ag=ah.ry*2;break;case"rect":case"image":ak=ah.x;aj=ah.y;al=ah.width||0;ag=ah.height||0;break;case"text":this.textpath.v=["m",Math.round(ah.x),", ",Math.round(ah.y-2),"l",Math.round(ah.x)+1,", ",Math.round(ah.y-2)].join("");ak=ah.x-Math.round(this.W/2);aj=ah.y-this.H/2;al=this.W;ag=this.H;break;case"path":if(!this.attrs.path){ak=0;aj=0;al=this.paper.width;ag=this.paper.height;}else{var af=C(this.attrs.path);ak=af.x;aj=af.y;al=af.width;ag=af.height;}break;default:ak=0;aj=0;al=this.paper.width;ag=this.paper.height;break;}ac=(ac==null)?ak+al/2:ac;aa=(aa==null)?aj+ag/2:aa;var Z=ac-this.paper.width/2,ai=aa-this.paper.height/2;if(this.type=="path"||this.type=="text"){(R.left!=Z+"px")&&(R.left=Z+"px");(R.top!=ai+"px")&&(R.top=ai+"px");this.X=this.type=="text"?ak:-Z;this.Y=this.type=="text"?aj:-ai;this.W=al;this.H=ag;(ad.left!=-Z+"px")&&(ad.left=-Z+"px");(ad.top!=-ai+"px")&&(ad.top=-ai+"px");}else{(R.left!=Z+"px")&&(R.left=Z+"px");(R.top!=ai+"px")&&(R.top=ai+"px");this.X=ak;this.Y=aj;this.W=al;this.H=ag;(R.width!=this.paper.width+"px")&&(R.width=this.paper.width+"px");(R.height!=this.paper.height+"px")&&(R.height=this.paper.height+"px");(ad.left!=ak-Z+"px")&&(ad.left=ak-Z+"px");(ad.top!=aj-ai+"px")&&(ad.top=aj-ai+"px");(ad.width!=al+"px")&&(ad.width=al+"px");(ad.height!=ag+"px")&&(ad.height=ag+"px");var am=(+ab.r||0)/(Math.min(al,ag));if(this.type=="rect"&&this.arcsize!=am&&(am||this.arcsize)){var e=V(am?"roundrect":"rect");e.arcsize=am;this.Group.appendChild(e);this.node.parentNode.removeChild(this.node);this.node=e;this.arcsize=am;F(this,this.attrs);this.setBox(this.attrs);}}};m.prototype.hide=function(){this.Group.style.display="none";return this;};m.prototype.show=function(){this.Group.style.display="block";return this;};m.prototype.getBBox=function(){if(this.type=="path"){return C(this.attrs.path);}return{x:this.X+(this.bbx||0),y:this.Y,width:this.W,height:this.H};};m.prototype.remove=function(){this[0].parentNode.removeChild(this[0]);this.Group.parentNode.removeChild(this.Group);this.shape&&this.shape.parentNode.removeChild(this.shape);};m.prototype.attr=function(){if(arguments.length==1&&f.is(arguments[0],"string")){if(arguments[0]=="translation"){return this.translate();}if(arguments[0]=="rotation"){return this.rotate();}if(arguments[0]=="scale"){return this.scale();}return this.attrs[arguments[0]];}if(this.attrs&&arguments.length==1&&f.is(arguments[0],"array")){var e={};for(var R=0,Z=arguments[0].length;R<Z;R++){e[arguments[0][R]]=this.attrs[arguments[0][R]];}return e;}var aa;if(arguments.length==2){aa={};aa[arguments[0]]=arguments[1];}if(arguments.length==1&&f.is(arguments[0],"object")){aa=arguments[0];}if(aa){if(aa.gradient){M(this,aa.gradient);}if(aa.text&&this.type=="text"){this.node.string=aa.text;}F(this,aa);this.setBox(this.attrs);}return this;};m.prototype.toFront=function(){this.Group.parentNode.appendChild(this.Group);return this;};m.prototype.toBack=function(){if(this.Group.parentNode.firstChild!=this.Group){this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild);}return this;};m.prototype.insertAfter=function(e){if(e.Group.nextSibling){e.Group.parentNode.insertBefore(this.Group,e.Group.nextSibling);}else{e.Group.parentNode.appendChild(this.Group);}return this;};m.prototype.insertBefore=function(e){e.Group.parentNode.insertBefore(this.Group,e.Group);return this;};m.prototype.blur=function(e){var i=this.node.style,R=i.filter;R=R.replace(/progid:DXImageTransform\.Microsoft\.Blur\(pixelradius\=[^\)]+\)/g,"");if(e!="none"){i.filter=R+" progid:DXImageTransform.Microsoft.Blur(pixelradius="+(+e||1.5)+")";i.margin=f.format("-{0}px 0 0 -{0}px",Math.round(+e||1.5));}else{i.filter=R;i.margin=0;}};var D=function(i,ae,ad,e){var aa=V("group"),Z=aa.style,R=V("oval"),ac=R.style;Z.position="absolute";Z.left=0;Z.top=0;Z.width=i.width+"px";Z.height=i.height+"px";aa.coordsize=i.coordsize;aa.coordorigin=i.coordorigin;aa.appendChild(R);var ab=new m(R,aa,i);ab.type="circle";F(ab,{stroke:"#000",fill:"none"});ab.attrs.cx=ae;ab.attrs.cy=ad;ab.attrs.r=e;ab.setBox({x:ae-e,y:ad-e,width:e*2,height:e*2});i.canvas.appendChild(aa);return ab;};var I=function(i,ae,ad,af,aa,e){var ab=V("group"),Z=ab.style,R=V(e?"roundrect":"rect"),ag=(+e||0)/(Math.min(af,aa));R.arcsize=ag;Z.position="absolute";Z.left=0;Z.top=0;Z.width=i.width+"px";Z.height=i.height+"px";ab.coordsize=i.coordsize;ab.coordorigin=i.coordorigin;ab.appendChild(R);var ac=new m(R,ab,i);ac.type="rect";F(ac,{stroke:"#000"});ac.arcsize=ag;ac.setBox({x:ae,y:ad,width:af,height:aa,r:+e});i.canvas.appendChild(ab);return ac;};var h=function(e,af,ae,R,i){var ab=V("group"),aa=ab.style,Z=V("oval"),ad=Z.style;aa.position="absolute";aa.left=0;aa.top=0;aa.width=e.width+"px";aa.height=e.height+"px";ab.coordsize=e.coordsize;ab.coordorigin=e.coordorigin;ab.appendChild(Z);var ac=new m(Z,ab,e);ac.type="ellipse";F(ac,{stroke:"#000"});ac.attrs.cx=af;ac.attrs.cy=ae;ac.attrs.rx=R;ac.attrs.ry=i;ac.setBox({x:af-R,y:ae-i,width:R*2,height:i*2});e.canvas.appendChild(ab);return ac;};var p=function(i,e,af,ae,ag,aa){var ab=V("group"),Z=ab.style,R=V("image"),ad=R.style;Z.position="absolute";Z.left=0;Z.top=0;Z.width=i.width+"px";Z.height=i.height+"px";ab.coordsize=i.coordsize;ab.coordorigin=i.coordorigin;R.src=e;ab.appendChild(R);var ac=new m(R,ab,i);ac.type="image";ac.attrs.src=e;ac.attrs.x=af;ac.attrs.y=ae;ac.attrs.w=ag;ac.attrs.h=aa;ac.setBox({x:af,y:ae,width:ag,height:aa});i.canvas.appendChild(ab);return ac;};var H=function(i,af,ae,ag){var ab=V("group"),aa=ab.style,Z=V("shape"),ad=Z.style,ah=V("path"),e=ah.style,R=V("textpath");aa.position="absolute";aa.left=0;aa.top=0;aa.width=i.width+"px";aa.height=i.height+"px";ab.coordsize=i.coordsize;ab.coordorigin=i.coordorigin;ah.v=["m",Math.round(af),", ",Math.round(ae),"l",Math.round(af)+1,", ",Math.round(ae)].join("");ah.textpathok=true;ad.width=i.width;ad.height=i.height;aa.position="absolute";aa.left=0;aa.top=0;aa.width=i.width;aa.height=i.height;R.string=ag;R.on=true;Z.appendChild(R);Z.appendChild(ah);ab.appendChild(Z);var ac=new m(R,ab,i);ac.shape=Z;ac.textpath=ah;ac.type="text";ac.attrs.text=ag;ac.attrs.x=af;ac.attrs.y=ae;ac.attrs.w=1;ac.attrs.h=1;F(ac,{font:q.font,stroke:"none",fill:"#000"});ac.setBox();i.canvas.appendChild(ab);return ac;};var E=function(R,e){var i=this.canvas.style;this.width=parseFloat(R||this.width);this.height=parseFloat(e||this.height);i.width=this.width+"px";i.height=this.height+"px";i.clip="rect(0 "+this.width+"px "+this.height+"px 0)";this.coordsize=this.width+" "+this.height;return this;};g.createStyleSheet().addRule(".rvml","behavior:url(#default#VML)");try{!g.namespaces.rvml&&g.namespaces.add("rvml","urn:schemas-microsoft-com:vml");var V=function(e){return g.createElement("<rvml:"+e+' class="rvml">');};}catch(U){var V=function(e){return g.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');};}var l=function(){var Z=G.apply(null,arguments),i=Z.container,ae=Z.height,af,R=Z.width,ad=Z.x,ac=Z.y;if(!i){throw new Error("VML container not found.");}var ab=b.canvas=g.createElement("div"),aa=ab.style;R=parseFloat(R)||"512px";ae=parseFloat(ae)||"342px";b.width=R;b.height=ae;b.coordsize=R+" "+ae;b.coordorigin="0 0";b.span=g.createElement("span");af=b.span.style;ab.appendChild(b.span);af.position="absolute";af.left="-99999px";af.top="-99999px";af.padding=0;af.margin=0;af.lineHeight=1;af.display="inline";aa.width=R+"px";aa.height=ae+"px";aa.position="absolute";aa.clip="rect(0 "+R+"px "+ae+"px 0)";if(i==1){g.body.appendChild(ab);aa.left=ad+"px";aa.top=ac+"px";i={style:{width:R,height:ae}};}else{i.style.width=R;i.style.height=ae;if(i.firstChild){i.insertBefore(ab,i.firstChild);}else{i.appendChild(ab);}}for(var e in b){if(b.hasOwnProperty(e)){i[e]=b[e];}}a.call(i,i,f.fn);i.clear=function(){while(ab.firstChild){ab.removeChild(ab.firstChild);}};i.raphael=f;return i;};b.remove=function(){this.canvas.parentNode.removeChild(this.canvas);};b.safari=function(){};}var j=(function(){if(g.addEventListener){return function(aa,R,i,e){var Z=function(ab){return i.call(e,ab);};aa.addEventListener(R,Z,false);return function(){aa.removeEventListener(R,Z,false);return true;};};}else{if(g.attachEvent){return function(ab,Z,R,i){var aa=function(ac){return R.call(i,ac||L.event);};ab.attachEvent("on"+Z,aa);var e=function(){ab.detachEvent("on"+Z,aa);return true;};if(Z=="mouseover"){ab.attachEvent("onmouseenter",aa);return function(){ab.detachEvent("onmouseenter",aa);return e();};}else{if(Z=="mouseout"){ab.attachEvent("onmouseleave",aa);return function(){ab.detachEvent("onmouseleave",aa);return e();};}}return e;};}}})();for(var Q=v.length;Q--;){(function(e){m.prototype[e]=function(i){if(f.is(i,"function")){this.events=this.events||{};this.events[e]=this.events[e]||{};this.events[e][i]=this.events[e][i]||[];this.events[e][i].push(j(this.shape||this.node,e,i,this));}return this;};m.prototype["un"+e]=function(i){this.events&&this.events[e]&&this.events[e][i]&&this.events[e][i].length&&this.events[e][i].shift()()&&!this.events[e][i].length&&delete this.events[e][i];};})(v[Q]);}b.circle=function(e,R,i){return D(this,e,R,i);};b.rect=function(e,aa,i,R,Z){return I(this,e,aa,i,R,Z);};b.ellipse=function(e,Z,R,i){return h(this,e,Z,R,i);};b.path=function(e){e&&!f.is(e,"string")&&!f.is(e[0],"array")&&(e+="");return W(f.format.apply(f,arguments),this);};b.image=function(Z,e,aa,i,R){return p(this,Z,e,aa,i,R);};b.text=function(e,R,i){return H(this,e,R,i);};b.set=function(e){arguments.length>1&&(e=Array.prototype.splice.call(arguments,0,arguments.length));return new k(e);};b.setSize=E;m.prototype.stop=function(){clearTimeout(this.animation_in_progress);return this;};m.prototype.scale=function(aj,ai,Z,R){if(aj==null&&ai==null){return{x:this._.sx,y:this._.sy,toString:function(){return this.x+" "+this.y;}};}ai=ai||aj;!+ai&&(ai=aj);var an,al,am,ak,aA=this.attrs;if(aj!=0){var ah=this.getBBox(),ae=ah.x+ah.width/2,ab=ah.y+ah.height/2,az=aj/this._.sx,ay=ai/this._.sy;Z=(+Z||Z==0)?Z:ae;R=(+R||R==0)?R:ab;var ag=Math.round(aj/Math.abs(aj)),ad=Math.round(ai/Math.abs(ai)),aq=this.node.style,aC=Z+(ae-Z)*ag*az,aB=R+(ab-R)*ad*ay;switch(this.type){case"rect":case"image":var af=aA.width*ag*az,ap=aA.height*ad*ay,ac=aC-af/2,aa=aB-ap/2;this.attr({width:af,height:ap,x:ac,y:aa});break;case"circle":case"ellipse":this.attr({rx:aA.rx*az,ry:aA.ry*ay,r:aA.r*az,cx:aC,cy:aB});break;case"path":var at=c(aA.path),au=true;for(var aw=0,ao=at.length;aw<ao;aw++){var ar=at[aw];if(ar[0].toUpperCase()=="M"&&au){continue;}else{au=false;}if(f.svg&&ar[0].toUpperCase()=="A"){ar[at[aw].length-2]*=az;ar[at[aw].length-1]*=ay;ar[1]*=az;ar[2]*=ay;ar[5]=+(ag+ad?!!+ar[5]:!+ar[5]);}else{for(var av=1,ax=ar.length;av<ax;av++){ar[av]*=(av%2)?az:ay;}}}var e=C(at),an=aC-e.x-e.width/2,al=aB-e.y-e.height/2;at=c(at);at[0][1]+=an;at[0][2]+=al;this.attr({path:at.join(" ")});break;}if(this.type in {text:1,image:1}&&(ag!=1||ad!=1)){if(this.transformations){this.transformations[2]="scale(".concat(ag,",",ad,")");this.node.setAttribute("transform",this.transformations.join(" "));an=(ag==-1)?-aA.x-(af||0):aA.x;al=(ad==-1)?-aA.y-(ap||0):aA.y;this.attr({x:an,y:al});aA.fx=ag-1;aA.fy=ad-1;}else{this.node.filterMatrix=" progid:DXImageTransform.Microsoft.Matrix(M11=".concat(ag,", M12=0, M21=0, M22=",ad,", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')");aq.filter=(this.node.filterMatrix||"")+(this.node.filterOpacity||"");}}else{if(this.transformations){this.transformations[2]="";this.node.setAttribute("transform",this.transformations.join(" "));aA.fx=0;aA.fy=0;}else{this.node.filterMatrix="";aq.filter=(this.node.filterMatrix||"")+(this.node.filterOpacity||"");}}aA.scale=[aj,ai,Z,R].join(" ");this._.sx=aj;this._.sy=ai;}return this;};f.easing_formulas={linear:function(e){return e;},"<":function(e){return Math.pow(e,3);},">":function(e){return Math.pow(e-1,3)+1;},"<>":function(e){e=e*2;if(e<1){return Math.pow(e,3)/2;}e-=2;return(Math.pow(e,3)+2)/2;},backIn:function(i){var e=1.70158;return i*i*((e+1)*i-e);},backOut:function(i){i=i-1;var e=1.70158;return i*i*((e+1)*i+e)+1;},elastic:function(R){if(R==0||R==1){return R;}var i=0.3,e=i/4;return Math.pow(2,-10*R)*Math.sin((R-e)*(2*Math.PI)/i)+1;},bounce:function(Z){var i=7.5625,R=2.75,e;if(Z<(1/R)){e=i*Z*Z;}else{if(Z<(2/R)){Z-=(1.5/R);e=i*Z*Z+0.75;}else{if(Z<(2.5/R)){Z-=(2.25/R);e=i*Z*Z+0.9375;}else{Z-=(2.625/R);e=i*Z*Z+0.984375;}}}return e;}};m.prototype.animate=function(at,aj,ai,aa){clearTimeout(this.animation_in_progress);if(f.is(ai,"function")||!ai){aa=ai||null;}var am={},R={},ag={},af={x:0,y:0};for(var ak in at){if(at.hasOwnProperty(ak)){if(ak in u){am[ak]=this.attr(ak);(am[ak]==null)&&(am[ak]=q[ak]);R[ak]=at[ak];switch(u[ak]){case"number":ag[ak]=(R[ak]-am[ak])/aj;break;case"colour":am[ak]=f.getRGB(am[ak]);var al=f.getRGB(R[ak]);ag[ak]={r:(al.r-am[ak].r)/aj,g:(al.g-am[ak].g)/aj,b:(al.b-am[ak].b)/aj};break;case"path":var ab=O(am[ak],R[ak]);am[ak]=ab[0];R[ak]=ab[1];ag[ak]=[];for(var ao=0,ae=am[ak].length;ao<ae;ao++){ag[ak][ao]=[0];for(var an=1,aq=am[ak][ao].length;an<aq;an++){ag[ak][ao][an]=(R[ak][ao][an]-am[ak][ao][an])/aj;}}break;case"csv":var e=(at[ak]+"").split(Y),ad=(am[ak]+"").split(Y);switch(ak){case"translation":am[ak]=[0,0];ag[ak]=[e[0]/aj,e[1]/aj];break;case"rotation":am[ak]=(ad[1]==e[1]&&ad[2]==e[2])?ad:[0,e[1],e[2]];ag[ak]=[(e[0]-am[ak][0])/aj,0,0];break;case"scale":at[ak]=e;am[ak]=(am[ak]+"").split(Y);ag[ak]=[(e[0]-am[ak][0])/aj,(e[1]-am[ak][1])/aj,0,0];break;case"clip-rect":am[ak]=(am[ak]+"").split(Y);ag[ak]=[];var ao=4;while(ao--){ag[ak][ao]=(e[ao]-am[ak][ao])/aj;}break;}R[ak]=e;}}}}var Z=+new Date,ah=0,ar=function(i){return +i>255?255:+i;},ac=this;(function ap(){var av=new Date-Z,aD={},au;if(av<aj){var aB=f.easing_formulas[ai]?f.easing_formulas[ai](av/aj):av/aj;for(var az in am){if(am.hasOwnProperty(az)){switch(u[az]){case"number":au=+am[az]+aB*aj*ag[az];break;case"colour":au="rgb("+[ar(Math.round(am[az].r+aB*aj*ag[az].r)),ar(Math.round(am[az].g+aB*aj*ag[az].g)),ar(Math.round(am[az].b+aB*aj*ag[az].b))].join(",")+")";break;case"path":au=[];for(var ax=0,aE=am[az].length;ax<aE;ax++){au[ax]=[am[az][ax][0]];for(var aw=1,ay=am[az][ax].length;aw<ay;aw++){au[ax][aw]=+am[az][ax][aw]+aB*aj*ag[az][ax][aw];}au[ax]=au[ax].join(" ");}au=au.join(" ");break;case"csv":switch(az){case"translation":var aC=ag[az][0]*(av-ah),aA=ag[az][1]*(av-ah);af.x+=aC;af.y+=aA;au=[aC,aA].join(" ");break;case"rotation":au=+am[az][0]+aB*aj*ag[az][0];am[az][1]&&(au+=","+am[az][1]+","+am[az][2]);break;case"scale":au=[+am[az][0]+aB*aj*ag[az][0],+am[az][1]+aB*aj*ag[az][1],(2 in at[az]?at[az][2]:""),(3 in at[az]?at[az][3]:"")].join(" ");break;case"clip-rect":au=[];var ax=4;while(ax--){au[ax]=+am[az][ax]+aB*aj*ag[az][ax];}break;}break;}aD[az]=au;}}ac.attr(aD);ac.animation_in_progress=setTimeout(ap);f.svg&&b.safari();}else{(af.x||af.y)&&ac.translate(-af.x,-af.y);ac.attr(at);clearTimeout(ac.animation_in_progress);f.svg&&b.safari();(f.is(aa,"function"))&&aa.call(ac);}ah=av;})();return this;};m.prototype.translate=function(e,R){if(e==null){return{x:this._.tx,y:this._.ty};}this._.tx+=+e;this._.ty+=+R;switch(this.type){case"circle":case"ellipse":this.attr({cx:+e+this.attrs.cx,cy:+R+this.attrs.cy});break;case"rect":case"image":case"text":this.attr({x:+e+this.attrs.x,y:+R+this.attrs.y});break;case"path":var i=c(this.attrs.path);i[0][1]+=+e;i[0][2]+=+R;this.attr({path:i});break;}return this;};var k=function(e){this.items=[];this.length=0;if(e){for(var R=0,Z=e.length;R<Z;R++){if(e[R]&&(e[R].constructor==m||e[R].constructor==k)){this[this.items.length]=this.items[this.items.length]=e[R];this.length++;}}}};k.prototype.push=function(){var aa,e;for(var R=0,Z=arguments.length;R<Z;R++){aa=arguments[R];if(aa&&(aa.constructor==m||aa.constructor==k)){e=this.items.length;this[e]=this.items[e]=aa;this.length++;}}return this;};k.prototype.pop=function(){delete this[this.length--];return this.items.pop();};for(var S in m.prototype){if(m.prototype.hasOwnProperty(S)){k.prototype[S]=(function(e){return function(){for(var R=0,Z=this.items.length;R<Z;R++){this.items[R][e].apply(this.items[R],arguments);}return this;};})(S);}}k.prototype.attr=function(R,ac){if(R&&f.is(R,"array")&&f.is(R[0],"object")){for(var e=0,ab=R.length;e<ab;e++){this.items[e].attr(R[e]);}}else{for(var Z=0,aa=this.items.length;Z<aa;Z++){this.items[Z].attr.apply(this.items[Z],arguments);}}return this;};k.prototype.getBBox=function(){var e=[],ac=[],R=[],aa=[];for(var Z=this.items.length;Z--;){var ab=this.items[Z].getBBox();e.push(ab.x);ac.push(ab.y);R.push(ab.x+ab.width);aa.push(ab.y+ab.height);}e=Math.min.apply(Math,e);ac=Math.min.apply(Math,ac);return{x:e,y:ac,width:Math.max.apply(Math,R)-e,height:Math.max.apply(Math,aa)-ac};};f.registerFont=function(i){if(!i.face){return i;}this.fonts=this.fonts||{};var Z={w:i.w,face:{},glyphs:{}},R=i.face["font-family"];for(var ac in i.face){if(i.face.hasOwnProperty(ac)){Z.face[ac]=i.face[ac];}}if(this.fonts[R]){this.fonts[R].push(Z);}else{this.fonts[R]=[Z];}if(!i.svg){Z.face["units-per-em"]=parseInt(i.face["units-per-em"],10);for(var aa in i.glyphs){if(i.glyphs.hasOwnProperty(aa)){var ab=i.glyphs[aa];Z.glyphs[aa]={w:ab.w,k:{},d:ab.d&&"M"+ab.d.replace(/[mlcxtrv]/g,function(ad){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[ad]||"M";})+"z"};if(ab.k){for(var e in ab.k){if(ab.khasOwnProperty(e)){Z.glyphs[aa].k[e]=ab.k[e];}}}}}}return i;};b.getFont=function(ae,af,R,aa){aa=aa||"normal";R=R||"normal";af=+af||{normal:400,bold:700,lighter:300,bolder:800}[af]||400;var ab=f.fonts[ae];if(!ab){var Z=new RegExp("(^|\\s)"+ae.replace(/[^\w\d\s+!~.:_-]/g,"")+"(\\s|$)","i");for(var e in f.fonts){if(f.fonts.hasOwnProperty(e)){if(Z.test(e)){ab=f.fonts[e];break;}}}}var ac;if(ab){for(var ad=0,ag=ab.length;ad<ag;ad++){ac=ab[ad];if(ac.face["font-weight"]==af&&(ac.face["font-style"]==R||!ac.face["font-style"])&&ac.face["font-stretch"]==aa){break;}}}return ac;};b.print=function(ag,af,ad,R,ak){var ab=this.set(),ae=(ad+"").split(""),e=0,aj="",aa;f.is(R,"string")&&(R=this.getFont(R));if(R){aa=(ak||16)/R.face["units-per-em"];for(var ac=0,ah=ae.length;ac<ah;ac++){var Z=ac&&R.glyphs[ae[ac-1]]||{},ai=R.glyphs[ae[ac]];e+=ac?(Z.w||R.w)+(Z.k&&Z.k[ae[ac]]||0):0;ai&&ai.d&&ab.push(this.path(ai.d).attr({fill:"#000",stroke:"none",translation:[e,0]}));}ab.scale(aa,aa,0,af).translate(ag,(ak||16)/2);}return ab;};f.format=function(i){var e=f.is(arguments[1],"array")?[0].concat(arguments[1]):arguments;i&&f.is(i,"string")&&e.length-1&&(i=i.replace(/\{(\d+)\}/g,function(Z,R){return e[++R]==null?"":e[R];}));return i;};f.ninja=function(){var R=window.Raphael,i;if(P.was){window.Raphael=P.is;}else{try{delete window.Raphael;}catch(Z){window.Raphael=i;}}return R;};f.el=m.prototype;return f;})(); \ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..d3fea70
--- /dev/null
+++ b/package.json
@@ -0,0 +1,9 @@
+{
+ "name": "myFirstKarmaLesson",
+ "description": "My first Karma lesson",
+ "keywords": ["javascript", "karma"],
+ "author": "",
+ "main": "",
+ "type": "zip",
+ "location": "http://yoururl.org/"
+}
diff --git a/package.json.~1~ b/package.json.~1~
new file mode 100644
index 0000000..ca45191
--- /dev/null
+++ b/package.json.~1~
@@ -0,0 +1,9 @@
+{
+ "name": "karma-test",
+ "description": "A dummy package to test creating narwhal packages",
+ "keywords": ["javascript", "dummy"],
+ "author": "Bryan Berry (http://www.renaissancegeek.org/)",
+ "main": "lib/karma-test.js",
+ "type": "zip",
+ "location": "http://github.com/bryanwb/karma-test/zipball/master"
+}