document.createElement("canvas").getContext||function(){function p(){return this.context_||(this.context_=new G(this))}function h(a,b){var c=L.call(arguments,2);return function(){return a.apply(b,c.concat(L.call(arguments)))}}function n(a){var b=a.srcElement;switch(a.propertyName){case "width":b.style.width=b.attributes.width.nodeValue+"px";b.getContext().clearRect();break;case "height":b.style.height=b.attributes.height.nodeValue+"px";b.getContext().clearRect();break}}function t(a){a=a.srcElement; if(a.firstChild){a.firstChild.style.width=a.clientWidth+"px";a.firstChild.style.height=a.clientHeight+"px"}}function H(){return[[1,0,0],[0,1,0],[0,0,1]]}function y(a,b){for(var c=H(),d=0;d<3;d++)for(var e=0;e<3;e++){for(var q=0,k=0;k<3;k++)q+=a[d][k]*b[k][e];c[d][e]=q}return c}function I(a,b){b.fillStyle=a.fillStyle;b.lineCap=a.lineCap;b.lineJoin=a.lineJoin;b.lineWidth=a.lineWidth;b.miterLimit=a.miterLimit;b.shadowBlur=a.shadowBlur;b.shadowColor=a.shadowColor;b.shadowOffsetX=a.shadowOffsetX;b.shadowOffsetY= a.shadowOffsetY;b.strokeStyle=a.strokeStyle;b.globalAlpha=a.globalAlpha;b.arcScaleX_=a.arcScaleX_;b.arcScaleY_=a.arcScaleY_;b.lineScale_=a.lineScale_}function M(a){var b,c=1;a=String(a);if(a.substring(0,3)=="rgb"){b=a.indexOf("(",3);var d=a.indexOf(")",b+1);d=a.substring(b+1,d).split(",");b="#";for(var e=0;e<3;e++)b+=l[Number(d[e])];if(d.length==4&&a.substr(3,1)=="a")c=d[3]}else b=a;return{color:b,alpha:c}}function J(a){switch(a){case "butt":return"flat";case "round":return"round";case "square":default:return"square"}} function G(a){this.m_=H();this.mStack_=[];this.aStack_=[];this.currentPath_=[];this.fillStyle=this.strokeStyle="#000";this.lineWidth=1;this.lineJoin="miter";this.lineCap="butt";this.miterLimit=s*1;this.globalAlpha=1;this.canvas=a;var b=a.ownerDocument.createElement("div");b.style.width=a.clientWidth+"px";b.style.height=a.clientHeight+"px";b.style.overflow="hidden";b.style.position="absolute";a.appendChild(b);this.element_=b;this.lineScale_=this.arcScaleY_=this.arcScaleX_=1}function K(a,b,c,d){a.currentPath_.push({type:"bezierCurveTo", cp1x:b.x,cp1y:b.y,cp2x:c.x,cp2y:c.y,x:d.x,y:d.y});a.currentX_=d.x;a.currentY_=d.y}function A(a,b,c){var d;a:{for(d=0;d<3;d++)for(var e=0;e<2;e++)if(!isFinite(b[d][e])||isNaN(b[d][e])){d=false;break a}d=true}if(d){a.m_=b;if(c)a.lineScale_=Q(B(b[0][0]*b[1][1]-b[0][1]*b[1][0]))}}function m(a){this.type_=a;this.r1_=this.y1_=this.x1_=this.r0_=this.y0_=this.x0_=0;this.colors_=[]}function r(){}var i=Math,j=i.round,o=i.sin,u=i.cos,B=i.abs,Q=i.sqrt,s=10,z=s/2,L=Array.prototype.slice,C={init:function(a){if(/MSIE/.test(navigator.userAgent)&& !window.opera){a=a||document;a.createElement("canvas");a.attachEvent("onreadystatechange",h(this.init_,this,a))}},init_:function(a){a.namespaces.g_vml_||a.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml","#default#VML");a.namespaces.g_o_||a.namespaces.add("g_o_","urn:schemas-microsoft-com:office:office","#default#VML");if(!a.styleSheets.ex_canvas_){var b=a.createStyleSheet();b.owningElement.id="ex_canvas_";b.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}g_vml_\\:*{behavior:url(#default#VML)}g_o_\\:*{behavior:url(#default#VML)}"}a= a.getElementsByTagName("canvas");for(b=0;b<a.length;b++)this.initElement(a[b])},initElement:function(a){if(!a.getContext){a.getContext=p;a.innerHTML="";a.attachEvent("onpropertychange",n);a.attachEvent("onresize",t);var b=a.attributes;if(b.width&&b.width.specified)a.style.width=b.width.nodeValue+"px";else a.width=a.clientWidth;if(b.height&&b.height.specified)a.style.height=b.height.nodeValue+"px";else a.height=a.clientHeight}return a}};C.init();for(var l=[],g=0;g<16;g++)for(var x=0;x<16;x++)l[g*16+ x]=g.toString(16)+x.toString(16);g=G.prototype;g.clearRect=function(){this.element_.innerHTML=""};g.beginPath=function(){this.currentPath_=[]};g.moveTo=function(a,b){var c=this.getCoords_(a,b);this.currentPath_.push({type:"moveTo",x:c.x,y:c.y});this.currentX_=c.x;this.currentY_=c.y};g.lineTo=function(a,b){var c=this.getCoords_(a,b);this.currentPath_.push({type:"lineTo",x:c.x,y:c.y});this.currentX_=c.x;this.currentY_=c.y};g.bezierCurveTo=function(a,b,c,d,e,q){e=this.getCoords_(e,q);a=this.getCoords_(a, b);c=this.getCoords_(c,d);K(this,a,c,e)};g.quadraticCurveTo=function(a,b,c,d){a=this.getCoords_(a,b);c=this.getCoords_(c,d);d={x:this.currentX_+2/3*(a.x-this.currentX_),y:this.currentY_+2/3*(a.y-this.currentY_)};K(this,d,{x:d.x+(c.x-this.currentX_)/3,y:d.y+(c.y-this.currentY_)/3},c)};g.arc=function(a,b,c,d,e,q){c*=s;var k=q?"at":"wa",f=a+u(d)*c-z,v=b+o(d)*c-z;d=a+u(e)*c-z;e=b+o(e)*c-z;if(f==d&&!q)f+=0.125;a=this.getCoords_(a,b);f=this.getCoords_(f,v);d=this.getCoords_(d,e);this.currentPath_.push({type:k, x:a.x,y:a.y,radius:c,xStart:f.x,yStart:f.y,xEnd:d.x,yEnd:d.y})};g.rect=function(a,b,c,d){this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath()};g.strokeRect=function(a,b,c,d){var e=this.currentPath_;this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+c,b+d);this.lineTo(a,b+d);this.closePath();this.stroke();this.currentPath_=e};g.fillRect=function(a,b,c,d){var e=this.currentPath_;this.beginPath();this.moveTo(a,b);this.lineTo(a+c,b);this.lineTo(a+ c,b+d);this.lineTo(a,b+d);this.closePath();this.fill();this.currentPath_=e};g.createLinearGradient=function(a,b,c,d){var e=new m("gradient");e.x0_=a;e.y0_=b;e.x1_=c;e.y1_=d;return e};g.createRadialGradient=function(a,b,c,d,e,q){var k=new m("gradientradial");k.x0_=a;k.y0_=b;k.r0_=c;k.x1_=d;k.y1_=e;k.r1_=q;return k};g.drawImage=function(a){var b,c,d,e,q,k,f,v;d=a.runtimeStyle.width;e=a.runtimeStyle.height;a.runtimeStyle.width="auto";a.runtimeStyle.height="auto";var D=a.width,E=a.height;a.runtimeStyle.width= d;a.runtimeStyle.height=e;if(arguments.length==3){b=arguments[1];c=arguments[2];q=k=0;f=d=D;v=e=E}else if(arguments.length==5){b=arguments[1];c=arguments[2];d=arguments[3];e=arguments[4];q=k=0;f=D;v=E}else if(arguments.length==9){q=arguments[1];k=arguments[2];f=arguments[3];v=arguments[4];b=arguments[5];c=arguments[6];d=arguments[7];e=arguments[8]}else throw Error("Invalid number of arguments");var w=this.getCoords_(b,c),F=[];F.push(" <g_vml_:group",' coordsize="',s*10,",",s*10,'"',' coordorigin="0,0"', ' style="width:',10,"px;height:",10,"px;position:absolute;");if(this.m_[0][0]!=1||this.m_[0][1]){var N=[];N.push("M11=",this.m_[0][0],",","M12=",this.m_[1][0],",","M21=",this.m_[0][1],",","M22=",this.m_[1][1],",","Dx=",j(w.x/s),",","Dy=",j(w.y/s),"");var O=this.getCoords_(b+d,c),P=this.getCoords_(b,c+e);b=this.getCoords_(b+d,c+e);w.x=i.max(w.x,O.x,P.x,b.x);w.y=i.max(w.y,O.y,P.y,b.y);F.push("padding:0 ",j(w.x/s),"px ",j(w.y/s),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",N.join(""),", sizingmethod='clip');")}else F.push("top:", j(w.y/s),"px;left:",j(w.x/s),"px;");F.push(' ">','<g_vml_:image src="',a.src,'"',' style="width:',s*d,"px;"," height:",s*e,'px;"',' cropleft="',q/D,'"',' croptop="',k/E,'"',' cropright="',(D-q-f)/D,'"',' cropbottom="',(E-k-v)/E,'"'," />","</g_vml_:group>");this.element_.insertAdjacentHTML("BeforeEnd",F.join(""))};g.stroke=function(a){var b=[],c=M(a?this.fillStyle:this.strokeStyle),d=c.color;c=c.alpha*this.globalAlpha;b.push("<g_vml_:shape",' filled="',!!a,'"',' style="position:absolute;width:',10, "px;height:",10,'px;"',' coordorigin="0 0" coordsize="',s*10," ",s*10,'"',' stroked="',!a,'"',' path="');for(var e={x:null,y:null},q={x:null,y:null},k=0;k<this.currentPath_.length;k++){var f=this.currentPath_[k];switch(f.type){case "moveTo":b.push(" m ",j(f.x),",",j(f.y));break;case "lineTo":b.push(" l ",j(f.x),",",j(f.y));break;case "close":b.push(" x ");f=null;break;case "bezierCurveTo":b.push(" c ",j(f.cp1x),",",j(f.cp1y),",",j(f.cp2x),",",j(f.cp2y),",",j(f.x),",",j(f.y));break;case "at":case "wa":b.push(" ", f.type," ",j(f.x-this.arcScaleX_*f.radius),",",j(f.y-this.arcScaleY_*f.radius)," ",j(f.x+this.arcScaleX_*f.radius),",",j(f.y+this.arcScaleY_*f.radius)," ",j(f.xStart),",",j(f.yStart)," ",j(f.xEnd),",",j(f.yEnd));break}if(f){if(e.x==null||f.x<e.x)e.x=f.x;if(q.x==null||f.x>q.x)q.x=f.x;if(e.y==null||f.y<e.y)e.y=f.y;if(q.y==null||f.y>q.y)q.y=f.y}}b.push(' ">');if(a)if(typeof this.fillStyle=="object"){d=this.fillStyle;f=0;a={x:0,y:0};c=0;var v=1;if(d.type_=="gradient"){f=d.x1_/this.arcScaleX_;e=d.y1_/ this.arcScaleY_;k=this.getCoords_(d.x0_/this.arcScaleX_,d.y0_/this.arcScaleY_);f=this.getCoords_(f,e);f=Math.atan2(f.x-k.x,f.y-k.y)*180/Math.PI;if(f<0)f+=360;if(f<1.0E-6)f=0}else{k=this.getCoords_(d.x0_,d.y0_);c=q.x-e.x;v=q.y-e.y;a={x:(k.x-e.x)/c,y:(k.y-e.y)/v};c/=this.arcScaleX_*s;v/=this.arcScaleY_*s;k=i.max(c,v);c=2*d.r0_/k;v=2*d.r1_/k-c}e=d.colors_;e.sort(function(P,R){return P.offset-R.offset});q=e.length;var D=e[0].color,E=e[q-1].color,w=e[0].alpha*this.globalAlpha,F=e[q-1].alpha*this.globalAlpha, N=[];for(k=0;k<q;k++){var O=e[k];N.push(O.offset*v+c+" "+O.color)}b.push('<g_vml_:fill type="',d.type_,'"',' method="none" focus="100%"',' color="',D,'"',' color2="',E,'"',' colors="',N.join(","),'"',' opacity="',F,'"',' g_o_:opacity2="',w,'"',' angle="',f,'"',' focusposition="',a.x,",",a.y,'" />')}else b.push('<g_vml_:fill color="',d,'" opacity="',c,'" />');else{a=this.lineScale_*this.lineWidth;if(a<1)c*=a;b.push("<g_vml_:stroke",' opacity="',c,'"',' joinstyle="',this.lineJoin,'"',' miterlimit="', this.miterLimit,'"',' endcap="',J(this.lineCap),'"',' weight="',a,'px"',' color="',d,'" />')}b.push("</g_vml_:shape>");this.element_.insertAdjacentHTML("beforeEnd",b.join(""))};g.fill=function(){this.stroke(true)};g.closePath=function(){this.currentPath_.push({type:"close"})};g.getCoords_=function(a,b){var c=this.m_;return{x:s*(a*c[0][0]+b*c[1][0]+c[2][0])-z,y:s*(a*c[0][1]+b*c[1][1]+c[2][1])-z}};g.save=function(){var a={};I(this,a);this.aStack_.push(a);this.mStack_.push(this.m_);this.m_=y(H(),this.m_)}; g.restore=function(){I(this.aStack_.pop(),this);this.m_=this.mStack_.pop()};g.translate=function(a,b){A(this,y([[1,0,0],[0,1,0],[a,b,1]],this.m_),false)};g.rotate=function(a){var b=u(a);a=o(a);A(this,y([[b,a,0],[-a,b,0],[0,0,1]],this.m_),false)};g.scale=function(a,b){this.arcScaleX_*=a;this.arcScaleY_*=b;A(this,y([[a,0,0],[0,b,0],[0,0,1]],this.m_),true)};g.transform=function(a,b,c,d,e,q){A(this,y([[a,b,0],[c,d,0],[e,q,1]],this.m_),true)};g.setTransform=function(a,b,c,d,e,q){A(this,[[a,b,0],[c,d,0], [e,q,1]],true)};g.clip=function(){};g.arcTo=function(){};g.createPattern=function(){return new r};m.prototype.addColorStop=function(a,b){b=M(b);this.colors_.push({offset:a,color:b.color,alpha:b.alpha})};G_vmlCanvasManager=C;CanvasRenderingContext2D=G;CanvasGradient=m;CanvasPattern=r}(); (function(p){function h(m){var r=[];p.extend(this,{width:m.width,height:m.height,ctx:m.getContext("2d"),save:function(){this.ctx.save();r.push({width:this.width,height:this.height})},restore:function(){this.ctx.restore();p.extend(this,r.pop())}})}function n(m){return p.extend({},K,{paint:function(r){r.save();this.action.opts=p.extend(true,this.action.savedOpts);p.each(m,function(){this.paint(r)});r.restore()},setAction:function(r){this.action=r;p.each(m,function(){this.action=r})}},{opts:void 0,savedOpts:void 0})} function t(m){function r(l){msg=l+" at "+C+": ..."+m.substring(C)+"\nin "+m;alert(msg);throw msg;}function i(){return m.charAt(C)}function j(){return m.charAt(C++)}function o(){for(;/\s/.exec(i());)j()}function u(l){o();for(var g=0;g<l.length;++g){i()!=l.charAt(g)&&r("Expected '"+l.charAt(g)+"' found '"+i()+"'");j()}}function B(){o();for(var l=[];/\w/.exec(i());l.push(j()));return l.join("")}function Q(){o();if(/\d/.exec(i())){o();for(var l=[];/\d/.exec(i());l.push(j()));return parseInt(l.join(""))}if(/['"]/.exec(i())){o(); l=[];var g=i();/[^\'\"]/.exec(g)&&r("String expected");for(j();i()!=g;){i()=="\\"&&l.eat();l.push(j())}u(g);return l.join("")}o();for(l=[];/[^;}]/.exec(i());l.push(j()));return l.join("")}function s(){var l=B();o();var g;if(i()=="{"){u("{");o();for(g={};i()!="}";){var x=B();u(":");g[x]=Q();o();if(i()=="}")break;u(";")}u("}");g=g}else g={};g=opts=g;x=G[l];if(!x)throw"Unknown plugin: "+l;g=p.extend({},x.defaultOpts||{},g);return p.extend({},K,x,{opts:g,savedOpts:g})}function z(){var l;o();if(i()=="["){u("["); o();for(l=[];i()!="]";){l.push(s());o()}u("]");l=n(l)}else l=s();l=l;u("=>");var g;o();if(i()=="("){j();g=L();u(")")}else g=s();l.setAction(g);return l}function L(){for(var l=[];;){l.push(z());o();if(i()!=",")break;u(",")}return A(l)}m+=" ";var C=0;return L()}function H(m,r){var i=p(m),j=i.data("liquid-canvas");if(j){var o=j.canvas,u=p(o),B=i.outerWidth();i=i.outerHeight();if(r||o.width!=B||o.height!=i||o.offsetTop!=m.offsetTop||o.offsetLeft!=m.offsetLeft){J=100;u.css({left:m.offsetLeft+"px",top:m.offsetTop+ "px"});o.width=B;o.height=i;o=new h(o);o.save();j.paint(o);o.restore()}}}function y(m){p.each(M,function(){H(this,m)})}function I(){y();J--;if(J<0){J=0;setTimeout(I,1E3)}else setTimeout(I,1E3/60)}var M=[],J=0,G={},K=function(){var m=function(r,i){r.ctx.translate(i,i);r.width-=2*i;r.height-=2*i};return{action:{paint:function(){}},shrink:m,defaultShrink:m,setAction:function(r){this.action=r}}}(),A=n;jQuery.fn.extend({liquidCanvas:function(m){this.each(function(){var r;if(window.G_vmlCanvasManager){p(this).before('<div width="0" height="0" style="position:absolute; top:0px; left:0px;"></div>'); r=G_vmlCanvasManager.initElement(p(this).prev("div").get(0))}else{p(this).before('<canvas width="0" height="0" style="position:absolute; top:0px; left:0px;"></canvas>');r=p(this).prev("canvas").get(0)}var i;if(p.isFunction(m))i=m;else{var j=t(m);i=function(o){j.paint(o)}}p(this).data("liquid-canvas",{canvas:r,paint:i});p(this).css({background:"transparent"});p(this).css("position")!="absolute"&&p(this).css({position:"relative"});M.push(this);H(this,true)})}});jQuery.extend({registerLiquidCanvasPlugin:function(m){G[m.name]= p.extend({},K,m)}});p(document).ready(y);I()})(jQuery); (function(p){p.registerLiquidCanvasPlugin({name:"rect",paint:function(h){h.ctx.beginPath();h.ctx.rect(0,0,h.width,h.height);h.ctx.closePath();this.action&&this.action.paint(h)}});p.registerLiquidCanvasPlugin({name:"roundedRect",defaultOpts:{radius:20},paint:function(h){var n=h.ctx,t=this.opts;n.beginPath();n.moveTo(0,t.radius);n.lineTo(0,h.height-t.radius);n.quadraticCurveTo(0,h.height,t.radius,h.height);n.lineTo(h.width-t.radius,h.height);n.quadraticCurveTo(h.width,h.height,h.width,h.height-t.radius); n.lineTo(h.width,t.radius);n.quadraticCurveTo(h.width,0,h.width-t.radius,0);n.lineTo(t.radius,0);n.quadraticCurveTo(0,0,0,t.radius);n.closePath();this.action&&this.action.paint(h)},shrink:function(h,n){this.defaultShrink(h,n);this.opts.radius-=n}});p.registerLiquidCanvasPlugin({name:"fill",defaultOpts:{color:"#aaa"},paint:function(h){h.ctx.fillStyle=this.opts.color;this.action.paint(h);h.ctx.fill()}});p.registerLiquidCanvasPlugin({name:"image",defaultOpts:{url:"http://www.ruzee.com/files/liquid-canvas-image.png"}, paint:function(h){var n=new Image;n.src=this.opts.url;n.onload=function(){h.ctx.drawImage(this,0,0)}}});p.registerLiquidCanvasPlugin({name:"gradient",defaultOpts:{from:"#fff",to:"#666"},paint:function(h){var n=h.ctx.createLinearGradient(0,0,0,h.height);n.addColorStop(0,this.opts.from);n.addColorStop(1,this.opts.to);h.ctx.fillStyle=n;this.action.paint(h);h.ctx.fill()}});p.registerLiquidCanvasPlugin({name:"shadow",defaultOpts:{width:3,color:"#000",shift:2},paint:function(h){var n=this.opts.width;h.ctx.fillStyle= this.opts.color;h.ctx.globalAlpha=1/n;for(var t=0;t<n;++t){this.action.paint(h);h.ctx.fill();this.action.shrink(h,1)}h.ctx.globalAlpha=1;h.ctx.translate(0,-this.opts.shift)}});p.registerLiquidCanvasPlugin({name:"border",defaultOpts:{color:"#8f4",width:3},paint:function(h){var n=this.opts.width;h.ctx.strokeStyle=this.opts.color;h.ctx.lineWidth=n;this.action.shrink(h,n/2);this.action.paint(h);h.ctx.stroke();this.action.shrink(h,n/2)}})})(jQuery);
