/*
 * Copyright (c) 2008 Simo Kinnunen.
 * Licensed under the MIT license.
 */
var Cufon=new function(){var S=this.DOM={ready:(function(){var X=false,Z={loaded:1,complete:1};var W=[],Y=function(){if(X){return}X=true;for(var a;a=W.shift();a()){}};if(document.addEventListener){document.addEventListener("DOMContentLoaded",Y,false);window.addEventListener("pageshow",Y,false)}if(!window.opera&&document.readyState){(function(){Z[document.readyState]?Y():setTimeout(arguments.callee,10)})()}if(document.readyState&&document.createStyleSheet){(function(){try{document.body.doScroll("left");Y()}catch(a){setTimeout(arguments.callee,1)}})()}N(window,"load",Y);return function(a){if(!arguments.length){Y()}else{X?a():W.push(a)}}})()};var L=this.CSS={Size:function(X,W){this.value=parseFloat(X);this.unit=String(X).match(/[a-z%]*$/)[0]||"px";this.convert=function(Y){return Y/W*this.value};this.convertFrom=function(Y){return Y/this.value*W};this.toString=function(){return this.value+this.unit}},getStyle:function(X){var W=document.defaultView;if(W&&W.getComputedStyle){return new A(W.getComputedStyle(X,null))}if(X.currentStyle){return new A(X.currentStyle)}return new A(X.style)},ready:(function(){var Y=false;var X=[],Z=function(){Y=true;for(var b;b=X.shift();b()){}};var W=Object.prototype.propertyIsEnumerable?E("style"):{length:0};var a=E("link");S.ready(function(){var e=0,d;for(var c=0,b=a.length;d=a[c],c<b;++c){if(!d.disabled&&d.rel.toLowerCase()=="stylesheet"){++e}}if(document.styleSheets.length>=W.length+e){Z()}else{setTimeout(arguments.callee,10)}});return function(b){if(Y){b()}else{X.push(b)}}})(),supports:function(Y,X){var W=document.createElement("span").style;if(W[Y]===undefined){return false}W[Y]=X;return W[Y]===X},textDecoration:function(b,a){if(!a){a=this.getStyle(b)}var X={underline:null,overline:null,"line-through":null};for(var W=b;W.parentNode&&W.parentNode.nodeType==1;){var Z=true;for(var Y in X){if(X[Y]){continue}if(a.get("textDecoration").indexOf(Y)!=-1){X[Y]=a.get("color")}Z=false}if(Z){break}a=this.getStyle(W=W.parentNode)}return X},textShadow:J(function(a){if(a=="none"){return null}var Z=[],b={},W,X=0;var Y=/(#[a-f0-9]+|[a-z]+\(.*?\)|[a-z]+)|(-?[\d.]+[a-z%]*)|,/ig;while(W=Y.exec(a)){if(W[0]==","){Z.push(b);b={},X=0}else{if(W[1]){b.color=W[1]}else{b[["offX","offY","blur"][X++]]=W[2]}}}Z.push(b);return Z}),color:J(function(X){var W={};W.color=X.replace(/^rgba\((.*?),\s*([\d.]+)\)/,function(Z,Y,a){W.opacity=parseFloat(a);return"rgb("+Y+")"});return W}),textTransform:function(X,W){return X[{uppercase:"toUpperCase",lowercase:"toLowerCase"}[W.get("textTransform")]||"toString"]()}};this.VML={parsePath:function(Z){var W=[],Y=/([mrvxe])([^a-z]*)/g,X;while(X=Y.exec(Z)){W.push({type:X[1],coords:X[2].split(",")})}return W}};function O(X){var W=[],Z=false;function Y(){if(Z||!W.length){return}Z=true;setTimeout(function(){W.shift().call(X);Z=false;Y()},1)}this.add=function(a){W.push(a);Y()}}function P(X){var W=this.face=X.face;this.glyphs=X.glyphs;this.w=X.w;this.baseSize=parseInt(W["units-per-em"],10);this.family=W["font-family"].toLowerCase();this.weight=W["font-weight"];this.style=W["font-style"]||"normal";this.viewBox=(function(){var Y=W.bbox.split(/\s+/);return{minX:parseInt(Y[0],10),minY:parseInt(Y[1],10),width:parseInt(Y[2],10)-parseInt(Y[0],10),height:parseInt(Y[3],10)-parseInt(Y[1],10),toString:function(){return[this.minX,this.minY,this.width,this.height].join(" ")}}})();this.ascent=-parseInt(W.ascent,10);this.descent=-parseInt(W.descent,10);this.height=-this.ascent+this.descent}function D(){this.styles={};this.add=function(W){(this.styles[W.style]||(this.styles[W.style]={}))[W.weight]=W};this.get=function(X,Z){var W=this.styles[X],Y;if(!W){return null}Z={normal:400,bold:700}[Z]||parseInt(Z,10);if(W[Z]){return W[Z]}for(var a in W){a=parseInt(a,10);if(!Y||(a<Z&&a>Y)){Y=a}}return W[Y]}}function V(){var Y={},W=0;function X(Z){return Z.cufid||(Z.cufid=++W)}this.get=function(Z){var a=X(Z);return Y[a]||(Y[a]={})}}function A(W){var Y={},X={};this.get=function(Z){return Y[Z]!=undefined?Y[Z]:W[Z]};this.getSize=function(a,Z){return X[a]||(X[a]=new L.Size(this.get(a),Z))};this.extend=function(Z){for(var a in Z){Y[a]=Z[a]}return this}}function I(W){return W==null||W instanceof Array?W:[W]}function N(X,W,Y){if(X.addEventListener){X.addEventListener(W,Y,false)}else{if(X.attachEvent){X.attachEvent("on"+W,function(){return Y.apply(X,arguments)})}}}function J(W){var X={};return function(Y){if(!X.hasOwnProperty(Y)){X[Y]=W.apply(null,arguments)}return X[Y]}}function B(b,a){if(!a){a=L.getStyle(b)}var X=a.get("fontFamily").split(/\s*,\s*/),Z;for(var Y=0,W=X.length;Y<W;++Y){Z=X[Y].toLowerCase();if(Z[0]=='"'||Z[0]=="'"){Z=Z.substring(1,Z.length-1)}if(H[Z]){return H[Z].get(a.get("fontStyle"),a.get("fontWeight"))}}return null}function E(W){return document.getElementsByTagName(W)}function F(){var W={},Z;for(var Y=0,X=arguments.length;Y<X;++Y){for(Z in arguments[Y]){W[Z]=arguments[Y][Z]}}return W}function M(Y,f,W,g,Z,X){if(g.separateWords){var d=document.createDocumentFragment(),b;var e=f.split(/\s+/);if(Q){if(/^\s/.test(f)){e.unshift("")}if(/\s$/.test(f)){e.push("")}}for(var c=0,a=e.length;c<a;++c){b=U[g.engine](Y,e[c]+(c<a-1?" ":""),W,g,Z,X);if(b){d.appendChild(b)}}return d}return U[g.engine].apply(null,arguments)}function K(X,e){var c=C.get(X);if(!e){e=c.options}var Y,W,b;for(var Z=X.firstChild;Z;Z=b){b=Z.nextSibling;if(Z.nodeType==1){if(!Z.firstChild){continue}if(!/cufon/.test(Z.className)){arguments.callee(Z,e);continue}}var d=Z.nodeType==3?Z.data:Z.alt;if(d===""){continue}if(!W){W=L.getStyle(X).extend(e)}if(!Y){Y=B(X,W)}if(!Y){continue}var a=M(Y,d,W,e,Z,X);if(a){Z.parentNode.replaceChild(a,Z)}else{Z.parentNode.removeChild(Z)}}if(!c.options){c.options=e}}var Q=" ".split(/\s+/).length==0;var G=new O(this),C=new V();var T=[];var U={},H={},R={enableTextDecoration:false,engine:null,printable:true,responsive:false,selector:(window.Sizzle||(window.$$&&function(W){return $$(W)})||window.$||(document.querySelectorAll&&function(W){return document.querySelectorAll(W)})||E),separateWords:true,textShadow:"none"};this.registerEngine=function(X,W){if(!W){return this}U[X]=W;return this.set("engine",X)};this.registerFont=function(Y){var W=new P(Y),X=W.family;if(!H[X]){H[X]=new D()}H[X].add(W);return this.set("fontFamily",X)};this.refresh=function(){var Y=T.splice(0,T.length);for(var X=0,W=Y.length;X<W;++X){this.replace.apply(this,Y[X])}return this};this.replace=function(Z,Y,W){Y=F(R,Y);if(typeof Y.textShadow=="string"){Y.textShadow=L.textShadow(Y.textShadow)}if(!Y.engine){return this}if(!W){T.push(arguments)}var X=function(){if(!Y.responsive){return K.apply(null,arguments)}var a=arguments;G.add(function(){K.apply(null,a)})};if(Z.nodeType||typeof Z=="string"){Z=[Z]}L.ready(function(){for(var b=0,a=Z.length;b<a;++b){var c=Z[b];if(typeof c=="string"){Cufon.replace(Y.selector(c),Y,true)}else{X(c,Y)}}});return this};this.set=function(W,X){R[W]=X;return this}};Cufon.registerEngine("canvas",(function(){var B=document.createElement("canvas");if(!B||!B.getContext||!B.getContext.apply){return null}B=null;var A=Cufon.CSS.supports("display","inline-block");var E=document.createElement("style");E.type="text/css";E.appendChild(document.createTextNode("@media screen,projection{.cufon-canvas{display:inline;display:inline-block;position:relative;vertical-align:middle;font-size:1px;line-height:1px}"+(A?".cufon-canvas canvas{position:relative}":".cufon-canvas canvas{position:absolute}")+".cufon-canvas .cufon-alt{display:none}}@media print{.cufon-canvas{padding:0 !important}.cufon-canvas canvas{display:none}.cufon-canvas .cufon-alt{display:inline}}"));document.getElementsByTagName("head")[0].appendChild(E);function D(N,H){var M=0,L=0;var F=Cufon.VML.parsePath(N);var G=new Array(F.length-1);generate:for(var J=0,I=F.length;J<I;++J){var K=F[J].coords;switch(F[J].type){case"v":G[J]={m:"bezierCurveTo",a:[M+Number(K[0]),L+Number(K[1]),M+Number(K[2]),L+Number(K[3]),M+=Number(K[4]),L+=Number(K[5])]};break;case"r":G[J]={m:"lineTo",a:[M+=Number(K[0]),L+=Number(K[1])]};break;case"m":G[J]={m:"moveTo",a:[M=Number(K[0]),L=Number(K[1])]};break;case"x":G[J]={m:"closePath"};break;case"e":break generate}H[G[J].m].apply(H,G[J].a)}return G}function C(J,I){for(var H=0,G=J.length;H<G;++H){var F=J[H];I[F.m].apply(I,F.a)}}return function(o,R,h,N,V,p){var T=o.viewBox;var H=h.getSize("fontSize",o.baseSize);var e=h.get("letterSpacing");e=(e=="normal")?0:H.convertFrom(parseInt(e,10));var U=0,f=0,d=0,P=0;var S=N.textShadow,b=[];if(S){for(var n=0,j=S.length;n<j;++n){var X=S[n];var a=H.convertFrom(parseFloat(X.offX));var Z=H.convertFrom(parseFloat(X.offY));b[n]=[a,Z];if(Z<U){U=Z}if(a>f){f=a}if(Z>d){d=Z}if(a<P){P=a}}}var s=Cufon.CSS.textTransform(R,h).split("");var F=0;var G=H.convert(T.height);var r=Math.ceil(G);var Q=null;for(var n=0,j=s.length;n<j;++n){var O=o.glyphs[s[n]]||o.missingGlyph;if(!O){continue}F+=Q=Number(O.w||o.w)+e}if(Q===null){return null}f+=(T.width-Q);P+=T.minX;var M=document.createElement("span");M.className="cufon cufon-canvas";M.alt=R;var I=document.createElement("canvas");var t=M.style;var Y=I.style;I.width=Math.ceil(H.convert(F+f-P));I.height=Math.ceil(H.convert(T.height-U+d));U+=T.minY;Y.top=Math.round(H.convert(U-o.ascent))+"px";Y.left=Math.round(H.convert(P))+"px";var c=r/G;var L=Math.ceil(H.convert(F*c))+"px";if(A){t.width=L;t.height=H.convert(o.height)+"px"}else{t.paddingLeft=L;t.paddingBottom=(H.convert(o.height)-1)+"px"}var q=I.getContext("2d"),W=r/T.height;q.scale(W,W);q.translate(-P,-U);q.lineWidth=o.face["underline-thickness"];q.save();function J(i,g){q.strokeStyle=g;q.beginPath();q.moveTo(0,i);q.lineTo(F,i);q.stroke()}var K=N.enableTextDecoration?Cufon.CSS.textDecoration(p,h):{};if(K.underline){J(-o.face["underline-position"],K.underline)}if(K.overline){J(o.ascent,K.overline)}q.fillStyle=h.get("color");function m(){for(var u=0,g=s.length;u<g;++u){var v=o.glyphs[s[u]]||o.missingGlyph;if(!v){continue}q.beginPath();if(v.d){if(v.code){C(v.code,q)}else{v.code=D("m"+v.d,q)}}q.fill();q.translate(Number(v.w||o.w)+e,0)}}if(S){for(var n=0,j=S.length;n<j;++n){var X=S[n];q.save();q.fillStyle=X.color;q.translate.apply(q,b[n]);m();q.restore()}}m();q.restore();if(K["line-through"]){J(-o.descent,K["line-through"])}M.appendChild(I);if(N.printable){var k=document.createElement("span");k.className="cufon-alt";k.appendChild(document.createTextNode(R));M.appendChild(k)}return M}})());Cufon.registerEngine("vml",(function(){if(!document.namespaces){return}document.write('<!--[if vml]><script type="text/javascript">Cufon.vmlEnabled=true;<\/script><![endif]-->');if(!Cufon.vmlEnabled){return}if(document.namespaces.cvml==null){document.namespaces.add("cvml","urn:schemas-microsoft-com:vml");document.write('<style type="text/css">@media screen{cvml\\:*{behavior:url(#default#VML);display:inline-block;antialias:true;position:absolute}.cufon-vml{display:inline-block;position:relative;vertical-align:middle}.cufon-vml .cufon-alt{display:none}a .cufon-vml{cursor:pointer}}@media print{.cufon-vml cvml\\:*{display:none}.cufon-vml .cufon-alt{display:inline}}</style>')}var C=0;function B(E,F){return A(E,/(?:em|ex|%)$/i.test(F)?"1em":F)}function A(H,I){if(/px$/i.test(I)){return parseFloat(I)}var G=H.style.left,F=H.runtimeStyle.left;H.runtimeStyle.left=H.currentStyle.left;H.style.left=I;var E=H.style.pixelLeft;H.style.left=G;H.runtimeStyle.left=F;return E}function D(F,H){var E=document.createElement("cvml:shapetype");E.id="cufon-glyph-"+C++;F.typeRef="#"+E.id;E.stroked="f";E.coordsize=H.width+","+H.height;E.coordorigin=H.minX+","+H.minY;var G="m"+H.minX+","+H.minY+" r"+H.width+","+H.height;E.path=(F.d?"m"+F.d+"x":"")+G;document.body.insertBefore(E,document.body.firstChild)}return function(h,R,d,O,V,j){var U=h.viewBox;var G=d.computedFontSize||(d.computedFontSize=new Cufon.CSS.Size(B(j,d.get("fontSize"))+"px",h.baseSize));var b=d.computedLSpacing;if(b==undefined){b=d.get("letterSpacing");d.computedLSpacing=b=(b=="normal")?0:G.convertFrom(A(j,b))}var N=document.createElement("span");N.className="cufon cufon-vml";N.alt=R;var H=document.createElement("cvml:group");var q=N.runtimeStyle;var X=H.runtimeStyle;var F=G.convert(U.height);X.height=Math.ceil(F);X.top=Math.round(G.convert(U.minY-h.ascent));X.left=Math.round(G.convert(U.minX));var a=parseInt(X.height,10)/F;q.height=G.convert(-h.ascent+h.descent)+"px";var J=O.enableTextDecoration?Cufon.CSS.textDecoration(j,d):{};var Q=d.get("color");var n=Cufon.CSS.textTransform(R,d).split("");var E=0,Z=0,K=null;var T=O.textShadow;for(var g=0,e=n.length;g<e;++g){var P=h.glyphs[n[g]]||h.missingGlyph;if(!P){continue}if(!P.typeRef){D(P,U)}var L=document.createElement("cvml:shape");L.type=P.typeRef;var k=L.runtimeStyle;k.width=U.width;k.height=U.height;k.top=0;k.left=Z;L.fillcolor=Q;H.appendChild(L);if(T){for(var Y=0,c=T.length;Y<c;++Y){var W=T[Y];var o=Cufon.CSS.color(W.color);var I=L.cloneNode(false),S=I.runtimeStyle;S.top=G.convertFrom(parseFloat(W.offY));S.left=Z+G.convertFrom(parseFloat(W.offX));S.zIndex=-1;I.fillcolor=o.color;if(o.opacity){var m=document.createElement("cvml:fill");m.opacity=o.opacity;I.appendChild(m)}H.appendChild(I)}}K=Number(P.w||h.w)+b;E+=K;Z+=K}if(K===null){return null}var M=-U.minX+E+(U.width-K);H.coordsize=M+","+U.height;X.width=G.convert(M*a);q.width=Math.max(Math.ceil(G.convert(E*a)),0);N.appendChild(H);if(O.printable){var f=document.createElement("span");f.className="cufon-alt";f.innerText=R;N.appendChild(f)}return N}})());
