/*
 * Raphael 1.4.3 - JavaScript Vector Library
 *
 * Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com)
 * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
 */
Raphael=function(){function m(){if(m.is(arguments[0],U)){for(var a=arguments[0],b=Aa[K](m,a.splice(0,3+m.is(a[0],O))),c=b.set(),d=0,f=a[o];d<f;d++){var e=a[d]||{};nb.test(e.type)&&c[E](b[e.type]().attr(e))}return c}return Aa[K](m,arguments)}m.version="1.4.3";var V=/[, ]+/,nb=/^(circle|rect|path|ellipse|text|image)$/,p="prototype",z="hasOwnProperty",C=document,X=window,La={was:Object[p][z].call(X,"Raphael"),is:X.Raphael};function G(){}var y="appendChild",K="apply",M="concat",Ba="createTouch"in C,s=
"",P=" ",H="split",Ma="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend orientationchange touchcancel gesturestart gesturechange gestureend"[H](P),Ca={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},Q="join",o="length",ca=String[p].toLowerCase,w=Math,Y=w.max,$=w.min,O="number",ea="string",U="array",N="toString",aa="fill",ob=Object[p][N],D=w.pow,E="push",ga=/^(?=[\da-f]$)/,Na=/^url\(['"]?([^\)]+?)['"]?\)$/i,pb=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+\s*,\s*[\d\.]+\s*,\s*[\d\.]+(?:\s*,\s*[\d\.]+)?)\s*\)|rgba?\(\s*([\d\.]+%\s*,\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,
F=w.round,W="setAttribute",A=parseFloat,da=parseInt,Da=" progid:DXImageTransform.Microsoft",pa=String[p].toUpperCase,qa={blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",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},Ea={along:"along",blur:O,"clip-rect":"csv",cx:O,cy:O,fill:"colour","fill-opacity":O,"font-size":O,height:O,opacity:O,path:"path",r:O,rotation:"csv",rx:O,ry:O,scale:"csv",stroke:"colour","stroke-opacity":O,"stroke-width":O,translation:"csv",width:O,x:O,y:O},I="replace";m.type=X.SVGAngle||C.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure",
"1.1")?"SVG":"VML";if(m.type=="VML"){var ha=C.createElement("div");ha.innerHTML="<!--[if vml]><br><br><![endif]--\>";if(ha.childNodes[o]!=2)return m.type=null;ha=null}m.svg=!(m.vml=m.type=="VML");G[p]=m[p];m._id=0;m._oid=0;m.fn={};m.is=function(a,b){b=ca.call(b);return b=="object"&&a===Object(a)||b=="undefined"&&typeof a==b||b=="null"&&a==null||ca.call(ob.call(a).slice(8,-1))==b};m.setWindow=function(a){X=a;C=X.document};function ra(a){if(m.vml){var b=/^\s+|\s+$/g;ra=T(function(d){var f;d=(d+s)[I](b,
s);try{var e=new X.ActiveXObject("htmlfile");e.write("<body>");e.close();f=e.body}catch(g){f=X.createPopup().document.body}e=f.createTextRange();try{f.style.color=d;var h=e.queryCommandValue("ForeColor");h=(h&255)<<16|h&65280|(h&16711680)>>>16;return"#"+("000000"+h[N](16)).slice(-6)}catch(i){return"none"}})}else{var c=C.createElement("i");c.title="Rapha\u00ebl Colour Picker";c.style.display="none";C.body[y](c);ra=T(function(d){c.style.color=d;return C.defaultView.getComputedStyle(c,s).getPropertyValue("color")})}return ra(a)}
function qb(){return"hsb("+[this.h,this.s,this.b]+")"}function rb(){return this.hex}m.hsb2rgb=T(function(a,b,c){if(m.is(a,"object")&&"h"in a&&"s"in a&&"b"in a){c=a.b;b=a.s;a=a.h}var d;if(c==0)return{r:0,g:0,b:0,hex:"#000"};if(a>1||b>1||c>1){a/=255;b/=255;c/=255}d=~~(a*6);a=a*6-d;var f=c*(1-b),e=c*(1-b*a),g=c*(1-b*(1-a));a=[c,e,f,f,g,c,c][d];b=[g,c,c,e,f,f,g][d];d=[f,f,g,c,c,e,f][d];a*=255;b*=255;d*=255;c={r:a,g:b,b:d,toString:rb};a=(~~a)[N](16);b=(~~b)[N](16);d=(~~d)[N](16);a=a[I](ga,"0");b=b[I](ga,
"0");d=d[I](ga,"0");c.hex="#"+a+b+d;return c},m);m.rgb2hsb=T(function(a,b,c){if(m.is(a,"object")&&"r"in a&&"g"in a&&"b"in a){c=a.b;b=a.g;a=a.r}if(m.is(a,ea)){var d=m.getRGB(a);a=d.r;b=d.g;c=d.b}if(a>1||b>1||c>1){a/=255;b/=255;c/=255}var f=Y(a,b,c),e=$(a,b,c);d=f;if(e==f)return{h:0,s:0,b:f};else{var g=f-e;e=g/f;a=a==f?(b-c)/g:b==f?2+(c-a)/g:4+(a-b)/g;a/=6;a<0&&a++;a>1&&a--}return{h:a,s:e,b:d,toString:qb}},m);var sb=/,?([achlmqrstvxz]),?/gi,sa=/\s*,\s*/,tb={hs:1,rg:1};m._path2string=function(){return this.join(",")[I](sb,
"$1")};function T(a,b,c){function d(){var f=Array[p].slice.call(arguments,0),e=f[Q]("\u25ba"),g=d.cache=d.cache||{},h=d.count=d.count||[];if(g[z](e))return c?c(g[e]):g[e];h[o]>=1000&&delete g[h.shift()];h[E](e);g[e]=a[K](b,f);return c?c(g[e]):g[e]}return d}m.getRGB=T(function(a){if(!a||(a+=s).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1};if(a=="none")return{r:-1,g:-1,b:-1,hex:"none"};!(tb[z](a.substring(0,2))||a.charAt()=="#")&&(a=ra(a));var b,c,d,f,e;if(a=a.match(pb)){if(a[2]){d=da(a[2].substring(5),
16);c=da(a[2].substring(3,5),16);b=da(a[2].substring(1,3),16)}if(a[3]){d=da((e=a[3].charAt(3))+e,16);c=da((e=a[3].charAt(2))+e,16);b=da((e=a[3].charAt(1))+e,16)}if(a[4]){a=a[4][H](sa);b=A(a[0]);c=A(a[1]);d=A(a[2]);f=A(a[3])}if(a[5]){a=a[5][H](sa);b=A(a[0])*2.55;c=A(a[1])*2.55;d=A(a[2])*2.55;f=A(a[3])}if(a[6]){a=a[6][H](sa);b=A(a[0]);c=A(a[1]);d=A(a[2]);return m.hsb2rgb(b,c,d)}if(a[7]){a=a[7][H](sa);b=A(a[0])*2.55;c=A(a[1])*2.55;d=A(a[2])*2.55;return m.hsb2rgb(b,c,d)}a={r:b,g:c,b:d};b=(~~b)[N](16);
c=(~~c)[N](16);d=(~~d)[N](16);b=b[I](ga,"0");c=c[I](ga,"0");d=d[I](ga,"0");a.hex="#"+b+c+d;isFinite(A(f))&&(a.o=f);return a}return{r:-1,g:-1,b:-1,hex:"none",error:1}},m);m.getColor=function(a){a=this.getColor.start=this.getColor.start||{h:0,s:1,b:a||0.75};var b=this.hsb2rgb(a.h,a.s,a.b);a.h+=0.075;if(a.h>1){a.h=0;a.s-=0.2;a.s<=0&&(this.getColor.start={h:0,s:1,b:a.b})}return b.hex};m.getColor.reset=function(){delete this.start};var ub=/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,
vb=/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig;m.parsePathString=T(function(a){if(!a)return null;var b={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},c=[];if(m.is(a,U)&&m.is(a[0],U))c=ta(a);c[o]||(a+s)[I](ub,function(d,f,e){var g=[];d=ca.call(f);e[I](vb,function(h,i){i&&g[E](+i)});if(d=="m"&&g[o]>2){c[E]([f][M](g.splice(0,2)));d="l";f=f=="m"?"l":"L"}for(;g[o]>=b[d];){c[E]([f][M](g.splice(0,b[d])));if(!b[d])break}});c[N]=m._path2string;return c});m.findDotsAtSegment=function(a,b,c,d,f,e,g,h,i){var j=1-i,l=
D(j,3)*a+D(j,2)*3*i*c+j*3*i*i*f+D(i,3)*g;j=D(j,3)*b+D(j,2)*3*i*d+j*3*i*i*e+D(i,3)*h;var n=a+2*i*(c-a)+i*i*(f-2*c+a),r=b+2*i*(d-b)+i*i*(e-2*d+b),q=c+2*i*(f-c)+i*i*(g-2*f+c),k=d+2*i*(e-d)+i*i*(h-2*e+d);a=(1-i)*a+i*c;b=(1-i)*b+i*d;f=(1-i)*f+i*g;e=(1-i)*e+i*h;h=90-w.atan((n-q)/(r-k))*180/w.PI;(n>q||r<k)&&(h+=180);return{x:l,y:j,m:{x:n,y:r},n:{x:q,y:k},start:{x:a,y:b},end:{x:f,y:e},alpha:h}};var va=T(function(a){if(!a)return{x:0,y:0,width:0,height:0};a=ua(a);for(var b=0,c=0,d=[],f=[],e,g=0,h=a[o];g<h;g++){e=
a[g];if(e[0]=="M"){b=e[1];c=e[2];d[E](b);f[E](c)}else{b=wb(b,c,e[1],e[2],e[3],e[4],e[5],e[6]);d=d[M](b.min.x,b.max.x);f=f[M](b.min.y,b.max.y);b=e[5];c=e[6]}}a=$[K](0,d);e=$[K](0,f);return{x:a,y:e,width:Y[K](0,d)-a,height:Y[K](0,f)-e}});function ta(a){var b=[];if(!m.is(a,U)||!m.is(a&&a[0],U))a=m.parsePathString(a);for(var c=0,d=a[o];c<d;c++){b[c]=[];for(var f=0,e=a[c][o];f<e;f++)b[c][f]=a[c][f]}b[N]=m._path2string;return b}var Oa=T(function(a){if(!m.is(a,U)||!m.is(a&&a[0],U))a=m.parsePathString(a);
var b=[],c=0,d=0,f=0,e=0,g=0;if(a[0][0]=="M"){c=a[0][1];d=a[0][2];f=c;e=d;g++;b[E](["M",c,d])}g=g;for(var h=a[o];g<h;g++){var i=b[g]=[],j=a[g];if(j[0]!=ca.call(j[0])){i[0]=ca.call(j[0]);switch(i[0]){case "a":i[1]=j[1];i[2]=j[2];i[3]=j[3];i[4]=j[4];i[5]=j[5];i[6]=+(j[6]-c).toFixed(3);i[7]=+(j[7]-d).toFixed(3);break;case "v":i[1]=+(j[1]-d).toFixed(3);break;case "m":f=j[1];e=j[2];default:for(var l=1,n=j[o];l<n;l++)i[l]=+(j[l]-(l%2?c:d)).toFixed(3)}}else{b[g]=[];if(j[0]=="m"){f=j[1]+c;e=j[2]+d}i=0;for(l=
j[o];i<l;i++)b[g][i]=j[i]}j=b[g][o];switch(b[g][0]){case "z":c=f;d=e;break;case "h":c+=+b[g][j-1];break;case "v":d+=+b[g][j-1];break;default:c+=+b[g][j-2];d+=+b[g][j-1]}}b[N]=m._path2string;return b},0,ta),ka=T(function(a){if(!m.is(a,U)||!m.is(a&&a[0],U))a=m.parsePathString(a);var b=[],c=0,d=0,f=0,e=0,g=0;if(a[0][0]=="M"){c=+a[0][1];d=+a[0][2];f=c;e=d;g++;b[0]=["M",c,d]}g=g;for(var h=a[o];g<h;g++){var i=b[g]=[],j=a[g];if(j[0]!=pa.call(j[0])){i[0]=pa.call(j[0]);switch(i[0]){case "A":i[1]=j[1];i[2]=
j[2];i[3]=j[3];i[4]=j[4];i[5]=j[5];i[6]=+(j[6]+c);i[7]=+(j[7]+d);break;case "V":i[1]=+j[1]+d;break;case "H":i[1]=+j[1]+c;break;case "M":f=+j[1]+c;e=+j[2]+d;default:for(var l=1,n=j[o];l<n;l++)i[l]=+j[l]+(l%2?c:d)}}else{l=0;for(n=j[o];l<n;l++)b[g][l]=j[l]}switch(i[0]){case "Z":c=f;d=e;break;case "H":c=i[1];break;case "V":d=i[1];break;default:c=b[g][b[g][o]-2];d=b[g][b[g][o]-1]}}b[N]=m._path2string;return b},null,ta);function wa(a,b,c,d){return[a,b,c,d,c,d]}function Pa(a,b,c,d,f,e){var g=1/3,h=2/3;return[g*
a+h*c,g*b+h*d,g*f+h*c,g*e+h*d,f,e]}function Qa(a,b,c,d,f,e,g,h,i,j){var l=w.PI,n=l*120/180,r=l/180*(+f||0),q=[],k,t=T(function(J,fa,xa){var xb=J*w.cos(xa)-fa*w.sin(xa);J=J*w.sin(xa)+fa*w.cos(xa);return{x:xb,y:J}});if(j){x=j[0];k=j[1];e=j[2];B=j[3]}else{k=t(a,b,-r);a=k.x;b=k.y;k=t(h,i,-r);h=k.x;i=k.y;w.cos(l/180*f);w.sin(l/180*f);k=(a-h)/2;x=(b-i)/2;B=k*k/(c*c)+x*x/(d*d);if(B>1){B=w.sqrt(B);c=B*c;d=B*d}B=c*c;var L=d*d;B=(e==g?-1:1)*w.sqrt(w.abs((B*L-B*x*x-L*k*k)/(B*x*x+L*k*k)));e=B*c*x/d+(a+h)/2;var B=
B*-d*k/c+(b+i)/2,x=w.asin(((b-B)/d).toFixed(7));k=w.asin(((i-B)/d).toFixed(7));x=a<e?l-x:x;k=h<e?l-k:k;x<0&&(x=l*2+x);k<0&&(k=l*2+k);if(g&&x>k)x-=l*2;if(!g&&k>x)k-=l*2}l=k-x;if(w.abs(l)>n){q=k;l=h;L=i;k=x+n*(g&&k>x?1:-1);h=e+c*w.cos(k);i=B+d*w.sin(k);q=Qa(h,i,c,d,f,0,g,l,L,[k,q,e,B])}l=k-x;f=w.cos(x);e=w.sin(x);g=w.cos(k);k=w.sin(k);l=w.tan(l/4);c=4/3*c*l;l=4/3*d*l;d=[a,b];a=[a+c*e,b-l*f];b=[h+c*k,i-l*g];h=[h,i];a[0]=2*d[0]-a[0];a[1]=2*d[1]-a[1];if(j)return[a,b,h][M](q);else{q=[a,b,h][M](q)[Q]()[H](",");
j=[];h=0;for(i=q[o];h<i;h++)j[h]=h%2?t(q[h-1],q[h],r).y:t(q[h],q[h+1],r).x;return j}}function la(a,b,c,d,f,e,g,h,i){var j=1-i;return{x:D(j,3)*a+D(j,2)*3*i*c+j*3*i*i*f+D(i,3)*g,y:D(j,3)*b+D(j,2)*3*i*d+j*3*i*i*e+D(i,3)*h}}var wb=T(function(a,b,c,d,f,e,g,h){var i=f-2*c+a-(g-2*f+c),j=2*(c-a)-2*(f-c),l=a-c,n=(-j+w.sqrt(j*j-4*i*l))/2/i;i=(-j-w.sqrt(j*j-4*i*l))/2/i;var r=[b,h],q=[a,g];w.abs(n)>1000000000000&&(n=0.5);w.abs(i)>1000000000000&&(i=0.5);if(n>0&&n<1){n=la(a,b,c,d,f,e,g,h,n);q[E](n.x);r[E](n.y)}if(i>
0&&i<1){n=la(a,b,c,d,f,e,g,h,i);q[E](n.x);r[E](n.y)}i=e-2*d+b-(h-2*e+d);j=2*(d-b)-2*(e-d);l=b-d;n=(-j+w.sqrt(j*j-4*i*l))/2/i;i=(-j-w.sqrt(j*j-4*i*l))/2/i;w.abs(n)>1000000000000&&(n=0.5);w.abs(i)>1000000000000&&(i=0.5);if(n>0&&n<1){n=la(a,b,c,d,f,e,g,h,n);q[E](n.x);r[E](n.y)}if(i>0&&i<1){n=la(a,b,c,d,f,e,g,h,i);q[E](n.x);r[E](n.y)}return{min:{x:$[K](0,q),y:$[K](0,r)},max:{x:Y[K](0,q),y:Y[K](0,r)}}}),ua=T(function(a,b){var c=ka(a),d=b&&ka(b);a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null};b={x:0,y:0,
bx:0,by:0,X:0,Y:0,qx:null,qy:null};function f(q,k){var t;if(!q)return["C",k.x,k.y,k.x,k.y,k.x,k.y];!(q[0]in{T:1,Q:1})&&(k.qx=k.qy=null);switch(q[0]){case "M":k.X=q[1];k.Y=q[2];break;case "A":q=["C"][M](Qa[K](0,[k.x,k.y][M](q.slice(1))));break;case "S":t=k.x+(k.x-(k.bx||k.x));k=k.y+(k.y-(k.by||k.y));q=["C",t,k][M](q.slice(1));break;case "T":k.qx=k.x+(k.x-(k.qx||k.x));k.qy=k.y+(k.y-(k.qy||k.y));q=["C"][M](Pa(k.x,k.y,k.qx,k.qy,q[1],q[2]));break;case "Q":k.qx=q[1];k.qy=q[2];q=["C"][M](Pa(k.x,k.y,q[1],
q[2],q[3],q[4]));break;case "L":q=["C"][M](wa(k.x,k.y,q[1],q[2]));break;case "H":q=["C"][M](wa(k.x,k.y,q[1],k.y));break;case "V":q=["C"][M](wa(k.x,k.y,k.x,q[1]));break;case "Z":q=["C"][M](wa(k.x,k.y,k.X,k.Y));break}return q}function e(q,k){if(q[k][o]>7){q[k].shift();for(var t=q[k];t[o];)q.splice(k++,0,["C"][M](t.splice(0,6)));q.splice(k,1);i=Y(c[o],d&&d[o]||0)}}function g(q,k,t,L,B){if(q&&k&&q[B][0]=="M"&&k[B][0]!="M"){k.splice(B,0,["M",L.x,L.y]);t.bx=0;t.by=0;t.x=q[B][1];t.y=q[B][2];i=Y(c[o],d&&
d[o]||0)}}for(var h=0,i=Y(c[o],d&&d[o]||0);h<i;h++){c[h]=f(c[h],a);e(c,h);d&&(d[h]=f(d[h],b));d&&e(d,h);g(c,d,a,b,h);g(d,c,b,a,h);var j=c[h],l=d&&d[h],n=j[o],r=d&&l[o];a.x=j[n-2];a.y=j[n-1];a.bx=A(j[n-4])||a.x;a.by=A(j[n-3])||a.y;b.bx=d&&(A(l[r-4])||b.x);b.by=d&&(A(l[r-3])||b.y);b.x=d&&l[r-2];b.y=d&&l[r-1]}return d?[c,d]:c},null,ta),Ra=T(function(a){for(var b=[],c=0,d=a[o];c<d;c++){var f={},e=a[c].match(/^([^:]*):?([\d\.]*)/);f.color=m.getRGB(e[1]);if(f.color.error)return null;f.color=f.color.hex;
e[2]&&(f.offset=e[2]+"%");b[E](f)}c=1;for(d=b[o]-1;c<d;c++)if(!b[c].offset){a=A(b[c-1].offset||0);e=0;for(f=c+1;f<d;f++)if(b[f].offset){e=b[f].offset;break}if(!e){e=100;f=d}e=A(e);for(e=(e-a)/(f-c+1);c<f;c++){a+=e;b[c].offset=a+"%"}}return b});function Sa(a,b,c,d){if(m.is(a,ea)||m.is(a,"object")){a=m.is(a,ea)?C.getElementById(a):a;if(a.tagName)return b==null?{container:a,width:a.style.pixelWidth||a.offsetWidth,height:a.style.pixelHeight||a.offsetHeight}:{container:a,width:b,height:c}}else return{container:1,
x:a,y:b,width:c,height:d}}function Fa(a,b){var c=this;for(var d in b)if(b[z](d)&&!(d in a))switch(typeof b[d]){case "function":(function(f){a[d]=a===c?f:function(){return f[K](c,arguments)}})(b[d]);break;case "object":a[d]=a[d]||{};Fa.call(this,a[d],b[d]);break;default:a[d]=b[d];break}}function ia(a,b){a==b.top&&(b.top=a.prev);a==b.bottom&&(b.bottom=a.next);a.next&&(a.next.prev=a.prev);a.prev&&(a.prev.next=a.next)}function Ta(a,b){if(b.top!==a){ia(a,b);a.next=null;a.prev=b.top;b.top.next=a;b.top=
a}}function Ua(a,b){if(b.bottom!==a){ia(a,b);a.next=b.bottom;a.prev=null;b.bottom.prev=a;b.bottom=a}}function Va(a,b,c){ia(a,c);b==c.top&&(c.top=a);b.next&&(b.next.prev=a);a.next=b.next;a.prev=b;b.next=a}function Wa(a,b,c){ia(a,c);b==c.bottom&&(c.bottom=a);b.prev&&(b.prev.next=a);a.prev=b.prev;b.prev=a;a.next=b}function Xa(a){return function(){throw new Error("Rapha\u00ebl: you are calling to method \u201c"+a+"\u201d of removed object");}}var Ya=/^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/;if(m.svg){G[p].svgns=
"http://www.w3.org/2000/svg";G[p].xlink="http://www.w3.org/1999/xlink";F=function(a){return+a+(~~a===a)*0.5};var v=function(a,b){if(b)for(var c in b)b[z](c)&&a[W](c,b[c]+s);else{a=C.createElementNS(G[p].svgns,a);a.style.webkitTapHighlightColor="rgba(0,0,0,0)";return a}};m[N]=function(){return"Your browser supports SVG.\nYou are running Rapha\u00ebl "+this.version};var Za=function(a,b){var c=v("path");b.canvas&&b.canvas[y](c);b=new u(c,b);b.type="path";ba(b,{fill:"none",stroke:"#000",path:a});return b},
ma=function(a,b,c){var d="linear",f=0.5,e=0.5,g=a.style;b=(b+s)[I](Ya,function(l,n,r){d="radial";if(n&&r){f=A(n);e=A(r);l=(e>0.5)*2-1;D(f-0.5,2)+D(e-0.5,2)>0.25&&(e=w.sqrt(0.25-D(f-0.5,2))*l+0.5)&&e!=0.5&&(e=e.toFixed(5)-1.0E-5*l)}return s});b=b[H](/\s*\-\s*/);if(d=="linear"){var h=b.shift();h=-A(h);if(isNaN(h))return null;h=[0,0,w.cos(h*w.PI/180),w.sin(h*w.PI/180)];var i=1/(Y(w.abs(h[2]),w.abs(h[3]))||1);h[2]*=i;h[3]*=i;if(h[2]<0){h[0]=-h[2];h[2]=0}if(h[3]<0){h[1]=-h[3];h[3]=0}}b=Ra(b);if(!b)return null;
i=a.getAttribute(aa);(i=i.match(/^url\(#(.*)\)$/))&&c.defs.removeChild(C.getElementById(i[1]));i=v(d+"Gradient");i.id="r"+(m._id++)[N](36);v(i,d=="radial"?{fx:f,fy:e}:{x1:h[0],y1:h[1],x2:h[2],y2:h[3]});c.defs[y](i);c=0;for(h=b[o];c<h;c++){var j=v("stop");v(j,{offset:b[c].offset?b[c].offset:!c?"0%":"100%","stop-color":b[c].color||"#fff"});i[y](j)}v(a,{fill:"url(#"+i.id+")",opacity:1,"fill-opacity":1});g.fill=s;g.opacity=1;return g.fillOpacity=1},Ga=function(a){var b=a.getBBox();v(a.pattern,{patternTransform:m.format("translate({0},{1})",
b.x,b.y)})},ba=function(a,b){var c={"":[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]},d=a.node,f=a.attrs,e=a.rotate();function g(k,t){if(t=c[ca.call(t)]){var L=k.attrs["stroke-width"]||"1";k={round:L,square:L,butt:0}[k.attrs["stroke-linecap"]||b["stroke-linecap"]]||0;for(var B=[],x=t[o];x--;)B[x]=t[x]*L+(x%2?1:-1)*k;v(d,{"stroke-dasharray":B[Q](",")})}}b[z]("rotation")&&(e=b.rotation);var h=
(e+s)[H](V);if(h.length-1){h[1]=+h[1];h[2]=+h[2]}else h=null;A(e)&&a.rotate(0,true);for(var i in b)if(b[z](i))if(qa[z](i)){var j=b[i];f[i]=j;switch(i){case "blur":a.blur(j);break;case "rotation":a.rotate(j,true);break;case "href":case "title":case "target":var l=d.parentNode;if(ca.call(l.tagName)!="a"){var n=v("a");l.insertBefore(n,d);n[y](d);l=n}l.setAttributeNS(a.paper.xlink,i,j);break;case "cursor":d.style.cursor=j;break;case "clip-rect":l=(j+s)[H](V);if(l[o]==4){a.clip&&a.clip.parentNode.parentNode.removeChild(a.clip.parentNode);
var r=v("clipPath");n=v("rect");r.id="r"+(m._id++)[N](36);v(n,{x:l[0],y:l[1],width:l[2],height:l[3]});r[y](n);a.paper.defs[y](r);v(d,{"clip-path":"url(#"+r.id+")"});a.clip=n}if(!j){(j=C.getElementById(d.getAttribute("clip-path")[I](/(^url\(#|\)$)/g,s)))&&j.parentNode.removeChild(j);v(d,{"clip-path":s});delete a.clip}break;case "path":if(a.type=="path")v(d,{d:j?(f.path=ka(j)):"M0,0"});break;case "width":d[W](i,j);if(f.fx){i="x";j=f.x}else break;case "x":if(f.fx)j=-f.x-(f.width||0);case "rx":if(i==
"rx"&&a.type=="rect")break;case "cx":h&&(i=="x"||i=="cx")&&(h[1]+=j-f[i]);d[W](i,F(j));a.pattern&&Ga(a);break;case "height":d[W](i,j);if(f.fy){i="y";j=f.y}else break;case "y":if(f.fy)j=-f.y-(f.height||0);case "ry":if(i=="ry"&&a.type=="rect")break;case "cy":h&&(i=="y"||i=="cy")&&(h[2]+=j-f[i]);d[W](i,F(j));a.pattern&&Ga(a);break;case "r":a.type=="rect"?v(d,{rx:j,ry:j}):d[W](i,j);break;case "src":a.type=="image"&&d.setAttributeNS(a.paper.xlink,"href",j);break;case "stroke-width":d.style.strokeWidth=
j;d[W](i,j);f["stroke-dasharray"]&&g(a,f["stroke-dasharray"]);break;case "stroke-dasharray":g(a,j);break;case "translation":j=(j+s)[H](V);j[0]=+j[0]||0;j[1]=+j[1]||0;if(h){h[1]+=j[0];h[2]+=j[1]}ya.call(a,j[0],j[1]);break;case "scale":j=(j+s)[H](V);a.scale(+j[0]||1,+j[1]||+j[0]||1,isNaN(A(j[2]))?null:+j[2],isNaN(A(j[3]))?null:+j[3]);break;case aa:if(l=(j+s).match(Na)){r=v("pattern");var q=v("image");r.id="r"+(m._id++)[N](36);v(r,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1});v(q,{x:0,y:0});
q.setAttributeNS(a.paper.xlink,"href",l[1]);r[y](q);j=C.createElement("img");j.style.cssText="position:absolute;left:-9999em;top-9999em";j.onload=function(){v(r,{width:this.offsetWidth,height:this.offsetHeight});v(q,{width:this.offsetWidth,height:this.offsetHeight});C.body.removeChild(this);a.paper.safari()};C.body[y](j);j.src=l[1];a.paper.defs[y](r);d.style.fill="url(#"+r.id+")";v(d,{fill:"url(#"+r.id+")"});a.pattern=r;a.pattern&&Ga(a);break}l=m.getRGB(j);if(l.error){if(({circle:1,ellipse:1}[z](a.type)||
(j+s).charAt()!="r")&&ma(d,j,a.paper)){f.gradient=j;f.fill="none";break}}else{delete b.gradient;delete f.gradient;!m.is(f.opacity,"undefined")&&m.is(b.opacity,"undefined")&&v(d,{opacity:f.opacity});!m.is(f["fill-opacity"],"undefined")&&m.is(b["fill-opacity"],"undefined")&&v(d,{"fill-opacity":f["fill-opacity"]})}l[z]("o")&&v(d,{"fill-opacity":l.o/100});case "stroke":l=m.getRGB(j);d[W](i,l.hex);i=="stroke"&&l[z]("o")&&v(d,{"stroke-opacity":l.o/100});break;case "gradient":(({circle:1,ellipse:1})[z](a.type)||
(j+s).charAt()!="r")&&ma(d,j,a.paper);break;case "opacity":case "fill-opacity":if(f.gradient){if(l=C.getElementById(d.getAttribute(aa)[I](/^url\(#|\)$/g,s))){l=l.getElementsByTagName("stop");l[l[o]-1][W]("stop-opacity",j)}break}default:i=="font-size"&&(j=da(j,10)+"px");l=i[I](/(\-.)/g,function(k){return pa.call(k.substring(1))});d.style[l]=j;d[W](i,j);break}}yb(a,b);if(h)a.rotate(h.join(P));else A(e)&&a.rotate(e,true)},$a=1.2,yb=function(a,b){if(!(a.type!="text"||!(b[z]("text")||b[z]("font")||b[z]("font-size")||
b[z]("x")||b[z]("y")))){var c=a.attrs,d=a.node,f=d.firstChild?da(C.defaultView.getComputedStyle(d.firstChild,s).getPropertyValue("font-size"),10):10;if(b[z]("text")){for(c.text=b.text;d.firstChild;)d.removeChild(d.firstChild);b=(b.text+s)[H]("\n");for(var e=0,g=b[o];e<g;e++)if(b[e]){var h=v("tspan");e&&v(h,{dy:f*$a,x:c.x});h[y](C.createTextNode(b[e]));d[y](h)}}else{b=d.getElementsByTagName("tspan");e=0;for(g=b[o];e<g;e++)e&&v(b[e],{dy:f*$a,x:c.x})}v(d,{y:c.y});a=a.getBBox();(a=c.y-(a.y+a.height/2))&&
isFinite(a)&&v(d,{y:c.y+a})}},u=function(a,b){this[0]=a;this.id=m._oid++;this.node=a;a.raphael=this;this.paper=b;this.attrs=this.attrs||{};this.transformations=[];this._={tx:0,ty:0,rt:{deg:0,cx:0,cy:0},sx:1,sy:1};!b.bottom&&(b.bottom=this);(this.prev=b.top)&&(b.top.next=this);b.top=this;this.next=null};u[p].rotate=function(a,b,c){if(this.removed)return this;if(a==null){if(this._.rt.cx)return[this._.rt.deg,this._.rt.cx,this._.rt.cy][Q](P);return this._.rt.deg}var d=this.getBBox();a=(a+s)[H](V);if(a[o]-
1){b=A(a[1]);c=A(a[2])}a=A(a[0]);if(b!=null)this._.rt.deg=a;else this._.rt.deg+=a;c==null&&(b=null);this._.rt.cx=b;this._.rt.cy=c;b=b==null?d.x+d.width/2:b;c=c==null?d.y+d.height/2:c;if(this._.rt.deg){this.transformations[0]=m.format("rotate({0} {1} {2})",this._.rt.deg,b,c);this.clip&&v(this.clip,{transform:m.format("rotate({0} {1} {2})",-this._.rt.deg,b,c)})}else{this.transformations[0]=s;this.clip&&v(this.clip,{transform:s})}v(this.node,{transform:this.transformations[Q](P)});return this};u[p].hide=
function(){!this.removed&&(this.node.style.display="none");return this};u[p].show=function(){!this.removed&&(this.node.style.display="");return this};u[p].remove=function(){if(!this.removed){ia(this,this.paper);this.node.parentNode.removeChild(this.node);for(var a in this)delete this[a];this.removed=true}};u[p].getBBox=function(){if(this.removed)return this;if(this.type=="path")return va(this.attrs.path);if(this.node.style.display=="none"){this.show();var a=true}var b={};try{b=this.node.getBBox()}catch(c){}finally{b=
b||{}}if(this.type=="text"){b={x:b.x,y:Infinity,width:0,height:0};for(var d=0,f=this.node.getNumberOfChars();d<f;d++){var e=this.node.getExtentOfChar(d);e.y<b.y&&(b.y=e.y);e.y+e.height-b.y>b.height&&(b.height=e.y+e.height-b.y);e.x+e.width-b.x>b.width&&(b.width=e.x+e.width-b.x)}}a&&this.hide();return b};u[p].attr=function(a,b){if(this.removed)return this;if(a==null){a={};for(var c in this.attrs)if(this.attrs[z](c))a[c]=this.attrs[c];this._.rt.deg&&(a.rotation=this.rotate());(this._.sx!=1||this._.sy!=
1)&&(a.scale=this.scale());a.gradient&&a.fill=="none"&&(a.fill=a.gradient)&&delete a.gradient;return a}if(b==null&&m.is(a,ea)){if(a=="translation")return ya.call(this);if(a=="rotation")return this.rotate();if(a=="scale")return this.scale();if(a==aa&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;return this.attrs[a]}if(b==null&&m.is(a,U)){b={};c=0;for(var d=a.length;c<d;c++)b[a[c]]=this.attr(a[c]);return b}if(b!=null){c={};c[a]=b;ba(this,c)}else a!=null&&m.is(a,"object")&&
ba(this,a);return this};u[p].toFront=function(){if(this.removed)return this;this.node.parentNode[y](this.node);var a=this.paper;a.top!=this&&Ta(this,a);return this};u[p].toBack=function(){if(this.removed)return this;if(this.node.parentNode.firstChild!=this.node){this.node.parentNode.insertBefore(this.node,this.node.parentNode.firstChild);Ua(this,this.paper)}return this};u[p].insertAfter=function(a){if(this.removed)return this;var b=a.node;b.nextSibling?b.parentNode.insertBefore(this.node,b.nextSibling):
b.parentNode[y](this.node);Va(this,a,this.paper);return this};u[p].insertBefore=function(a){if(this.removed)return this;var b=a.node;b.parentNode.insertBefore(this.node,b);Wa(this,a,this.paper);return this};u[p].blur=function(a){var b=this;if(+a!==0){var c=v("filter"),d=v("feGaussianBlur");b.attrs.blur=a;c.id="r"+(m._id++)[N](36);v(d,{stdDeviation:+a||1.5});c.appendChild(d);b.paper.defs.appendChild(c);b._blur=c;v(b.node,{filter:"url(#"+c.id+")"})}else{if(b._blur){b._blur.parentNode.removeChild(b._blur);
delete b._blur;delete b.attrs.blur}b.node.removeAttribute("filter")}};var ab=function(a,b,c,d){b=F(b);c=F(c);var f=v("circle");a.canvas&&a.canvas[y](f);a=new u(f,a);a.attrs={cx:b,cy:c,r:d,fill:"none",stroke:"#000"};a.type="circle";v(f,a.attrs);return a},bb=function(a,b,c,d,f,e){b=F(b);c=F(c);var g=v("rect");a.canvas&&a.canvas[y](g);a=new u(g,a);a.attrs={x:b,y:c,width:d,height:f,r:e||0,rx:e||0,ry:e||0,fill:"none",stroke:"#000"};a.type="rect";v(g,a.attrs);return a},cb=function(a,b,c,d,f){b=F(b);c=F(c);
var e=v("ellipse");a.canvas&&a.canvas[y](e);a=new u(e,a);a.attrs={cx:b,cy:c,rx:d,ry:f,fill:"none",stroke:"#000"};a.type="ellipse";v(e,a.attrs);return a},db=function(a,b,c,d,f,e){var g=v("image");v(g,{x:c,y:d,width:f,height:e,preserveAspectRatio:"none"});g.setAttributeNS(a.xlink,"href",b);a.canvas&&a.canvas[y](g);a=new u(g,a);a.attrs={x:c,y:d,width:f,height:e,src:b};a.type="image";return a},eb=function(a,b,c,d){var f=v("text");v(f,{x:b,y:c,"text-anchor":"middle"});a.canvas&&a.canvas[y](f);a=new u(f,
a);a.attrs={x:b,y:c,"text-anchor":"middle",text:d,font:qa.font,stroke:"none",fill:"#000"};a.type="text";ba(a,a.attrs);return a},fb=function(a,b){this.width=a||this.width;this.height=b||this.height;this.canvas[W]("width",this.width);this.canvas[W]("height",this.height);return this},Aa=function(){var a=Sa[K](0,arguments),b=a&&a.container,c=a.x,d=a.y,f=a.width;a=a.height;if(!b)throw new Error("SVG container not found.");var e=v("svg");c=c||0;d=d||0;f=f||512;a=a||342;v(e,{xmlns:"http://www.w3.org/2000/svg",
version:1.1,width:f,height:a});if(b==1){e.style.cssText="position:absolute;left:"+c+"px;top:"+d+"px";C.body[y](e)}else b.firstChild?b.insertBefore(e,b.firstChild):b[y](e);b=new G;b.width=f;b.height=a;b.canvas=e;Fa.call(b,b,m.fn);b.clear();return b};G[p].clear=function(){for(var a=this.canvas;a.firstChild;)a.removeChild(a.firstChild);this.bottom=this.top=null;(this.desc=v("desc"))[y](C.createTextNode("Created with Rapha\u00ebl"));a[y](this.desc);a[y](this.defs=v("defs"))};G[p].remove=function(){this.canvas.parentNode&&
this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=Xa(a)}}if(m.vml){var gb={M:"m",L:"l",C:"c",Z:"x",m:"t",l:"r",c:"v",z:"x"},zb=/([clmz]),?([^clmz]*)/gi,Ab=/-?[^,\s-]+/g,na=1000+P+1000,ja=10,oa={path:1,rect:1},Bb=function(a){var b=/[ahqstv]/ig,c=ka;(a+s).match(b)&&(c=ua);b=/[clmz]/g;if(c==ka&&!(a+s).match(b))return a=(a+s)[I](zb,function(i,j,l){var n=[],r=ca.call(j)=="m",q=gb[j];l[I](Ab,function(k){if(r&&n[o]==2){q+=n+gb[j=="m"?"l":"L"];n=[]}n[E](F(k*ja))});return q+n});b=c(a);
var d;a=[];for(var f=0,e=b[o];f<e;f++){c=b[f];d=ca.call(b[f][0]);d=="z"&&(d="x");for(var g=1,h=c[o];g<h;g++)d+=F(c[g]*ja)+(g!=h-1?",":s);a[E](d)}return a[Q](P)};m[N]=function(){return"Your browser doesn\u2019t support SVG. Falling down to VML.\nYou are running Rapha\u00ebl "+this.version};Za=function(a,b){var c=R("group");c.style.cssText="position:absolute;left:0;top:0;width:"+b.width+"px;height:"+b.height+"px";c.coordsize=b.coordsize;c.coordorigin=b.coordorigin;var d=R("shape"),f=d.style;f.width=
b.width+"px";f.height=b.height+"px";d.coordsize=na;d.coordorigin=b.coordorigin;c[y](d);d=new u(d,c,b);f={fill:"none",stroke:"#000"};a&&(f.path=a);d.isAbsolute=true;d.type="path";d.path=[];d.Path=s;ba(d,f);b.canvas[y](c);return d};ba=function(a,b){a.attrs=a.attrs||{};var c=a.node,d=a.attrs,f=c.style,e;e=(b.x!=d.x||b.y!=d.y||b.width!=d.width||b.height!=d.height||b.r!=d.r)&&a.type=="rect";var g=a;for(var h in b)if(b[z](h))d[h]=b[h];if(e){d.path=hb(d.x,d.y,d.width,d.height,d.r);a.X=d.x;a.Y=d.y;a.W=d.width;
a.H=d.height}b.href&&(c.href=b.href);b.title&&(c.title=b.title);b.target&&(c.target=b.target);b.cursor&&(f.cursor=b.cursor);"blur"in b&&a.blur(b.blur);if(b.path&&a.type=="path"||e)c.path=Bb(d.path);b.rotation!=null&&a.rotate(b.rotation,true);if(b.translation){e=(b.translation+s)[H](V);ya.call(a,e[0],e[1]);if(a._.rt.cx!=null){a._.rt.cx+=+e[0];a._.rt.cy+=+e[1];a.setBox(a.attrs,e[0],e[1])}}if(b.scale){e=(b.scale+s)[H](V);a.scale(+e[0]||1,+e[1]||+e[0]||1,+e[2]||null,+e[3]||null)}if("clip-rect"in b){e=
(b["clip-rect"]+s)[H](V);if(e[o]==4){e[2]=+e[2]+ +e[0];e[3]=+e[3]+ +e[1];h=c.clipRect||C.createElement("div");var i=h.style,j=c.parentNode;i.clip=m.format("rect({1}px {2}px {3}px {0}px)",e);if(!c.clipRect){i.position="absolute";i.top=0;i.left=0;i.width=a.paper.width+"px";i.height=a.paper.height+"px";j.parentNode.insertBefore(h,j);h[y](j);c.clipRect=h}}if(!b["clip-rect"])c.clipRect&&(c.clipRect.style.clip=s)}if(a.type=="image"&&b.src)c.src=b.src;if(a.type=="image"&&b.opacity){c.filterOpacity=Da+".Alpha(opacity="+
b.opacity*100+")";f.filter=(c.filterMatrix||s)+(c.filterOpacity||s)}b.font&&(f.font=b.font);b["font-family"]&&(f.fontFamily='"'+b["font-family"][H](",")[0][I](/^['"]+|['"]+$/g,s)+'"');b["font-size"]&&(f.fontSize=b["font-size"]);b["font-weight"]&&(f.fontWeight=b["font-weight"]);b["font-style"]&&(f.fontStyle=b["font-style"]);if(b.opacity!=null||b["stroke-width"]!=null||b.fill!=null||b.stroke!=null||b["stroke-width"]!=null||b["stroke-opacity"]!=null||b["fill-opacity"]!=null||b["stroke-dasharray"]!=null||
b["stroke-miterlimit"]!=null||b["stroke-linejoin"]!=null||b["stroke-linecap"]!=null){c=a.shape||c;f=c.getElementsByTagName(aa)&&c.getElementsByTagName(aa)[0];e=false;!f&&(e=f=R(aa));if("fill-opacity"in b||"opacity"in b){a=((+d["fill-opacity"]+1||2)-1)*((+d.opacity+1||2)-1)*((+m.getRGB(b.fill).o+1||2)-1);a<0&&(a=0);a>1&&(a=1);f.opacity=a}b.fill&&(f.on=true);if(f.on==null||b.fill=="none")f.on=false;if(f.on&&b.fill)if(a=b.fill.match(Na)){f.src=a[1];f.type="tile"}else{f.color=m.getRGB(b.fill).hex;f.src=
s;f.type="solid";if(m.getRGB(b.fill).error&&(g.type in{circle:1,ellipse:1}||(b.fill+s).charAt()!="r")&&ma(g,b.fill)){d.fill="none";d.gradient=b.fill}}e&&c[y](f);f=c.getElementsByTagName("stroke")&&c.getElementsByTagName("stroke")[0];e=false;!f&&(e=f=R("stroke"));if(b.stroke&&b.stroke!="none"||b["stroke-width"]||b["stroke-opacity"]!=null||b["stroke-dasharray"]||b["stroke-miterlimit"]||b["stroke-linejoin"]||b["stroke-linecap"])f.on=true;(b.stroke=="none"||f.on==null||b.stroke==0||b["stroke-width"]==
0)&&(f.on=false);a=m.getRGB(b.stroke);f.on&&b.stroke&&(f.color=a.hex);a=((+d["stroke-opacity"]+1||2)-1)*((+d.opacity+1||2)-1)*((+a.o+1||2)-1);h=(A(b["stroke-width"])||1)*0.75;a<0&&(a=0);a>1&&(a=1);b["stroke-width"]==null&&(h=d["stroke-width"]);b["stroke-width"]&&(f.weight=h);h&&h<1&&(a*=h)&&(f.weight=1);f.opacity=a;b["stroke-linejoin"]&&(f.joinstyle=b["stroke-linejoin"]||"miter");f.miterlimit=b["stroke-miterlimit"]||8;b["stroke-linecap"]&&(f.endcap=b["stroke-linecap"]=="butt"?"flat":b["stroke-linecap"]==
"square"?"square":"round");if(b["stroke-dasharray"]){a={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};f.dashstyle=a[z](b["stroke-dasharray"])?a[b["stroke-dasharray"]]:s}e&&c[y](f)}if(g.type=="text"){f=g.paper.span.style;d.font&&(f.font=d.font);d["font-family"]&&(f.fontFamily=d["font-family"]);d["font-size"]&&(f.fontSize=d["font-size"]);d["font-weight"]&&(f.fontWeight=d["font-weight"]);
d["font-style"]&&(f.fontStyle=d["font-style"]);g.node.string&&(g.paper.span.innerHTML=(g.node.string+s)[I](/</g,"&#60;")[I](/&/g,"&#38;")[I](/\n/g,"<br>"));g.W=d.w=g.paper.span.offsetWidth;g.H=d.h=g.paper.span.offsetHeight;g.X=d.x;g.Y=d.y+F(g.H/2);switch(d["text-anchor"]){case "start":g.node.style["v-text-align"]="left";g.bbx=F(g.W/2);break;case "end":g.node.style["v-text-align"]="right";g.bbx=-F(g.W/2);break;default:g.node.style["v-text-align"]="center";break}}};ma=function(a,b){a.attrs=a.attrs||
{};var c="linear",d=".5 .5";a.attrs.gradient=b;b=(b+s)[I](Ya,function(i,j,l){c="radial";if(j&&l){j=A(j);l=A(l);D(j-0.5,2)+D(l-0.5,2)>0.25&&(l=w.sqrt(0.25-D(j-0.5,2))*((l>0.5)*2-1)+0.5);d=j+P+l}return s});b=b[H](/\s*\-\s*/);if(c=="linear"){var f=b.shift();f=-A(f);if(isNaN(f))return null}var e=Ra(b);if(!e)return null;a=a.shape||a.node;b=a.getElementsByTagName(aa)[0]||R(aa);!b.parentNode&&a.appendChild(b);if(e[o]){b.on=true;b.method="none";b.color=e[0].color;b.color2=e[e[o]-1].color;a=[];for(var g=0,
h=e[o];g<h;g++)e[g].offset&&a[E](e[g].offset+P+e[g].color);b.colors&&(b.colors.value=a[o]?a[Q]():"0% "+b.color);if(c=="radial"){b.type="gradientradial";b.focus="100%";b.focussize=d;b.focusposition=d}else{b.type="gradient";b.angle=(270-f)%360}}return 1};u=function(a,b,c){this[0]=a;this.id=m._oid++;this.node=a;a.raphael=this;this.Y=this.X=0;this.attrs={};this.Group=b;this.paper=c;this._={tx:0,ty:0,rt:{deg:0},sx:1,sy:1};!c.bottom&&(c.bottom=this);(this.prev=c.top)&&(c.top.next=this);c.top=this;this.next=
null};u[p].rotate=function(a,b,c){if(this.removed)return this;if(a==null){if(this._.rt.cx)return[this._.rt.deg,this._.rt.cx,this._.rt.cy][Q](P);return this._.rt.deg}a=(a+s)[H](V);if(a[o]-1){b=A(a[1]);c=A(a[2])}a=A(a[0]);if(b!=null)this._.rt.deg=a;else this._.rt.deg+=a;c==null&&(b=null);this._.rt.cx=b;this._.rt.cy=c;this.setBox(this.attrs,b,c);this.Group.style.rotation=this._.rt.deg;return this};u[p].setBox=function(a,b,c){if(this.removed)return this;var d=this.Group.style,f=this.shape&&this.shape.style||
this.node.style;a=a||{};for(var e in a)if(a[z](e))this.attrs[e]=a[e];b=b||this._.rt.cx;c=c||this._.rt.cy;var g=this.attrs,h;switch(this.type){case "circle":a=g.cx-g.r;e=g.cy-g.r;h=g=g.r*2;break;case "ellipse":a=g.cx-g.rx;e=g.cy-g.ry;h=g.rx*2;g=g.ry*2;break;case "image":a=+g.x;e=+g.y;h=g.width||0;g=g.height||0;break;case "text":this.textpath.v=["m",F(g.x),", ",F(g.y-2),"l",F(g.x)+1,", ",F(g.y-2)][Q](s);a=g.x-F(this.W/2);e=g.y-this.H/2;h=this.W;g=this.H;break;case "rect":case "path":if(this.attrs.path){g=
va(this.attrs.path);a=g.x;e=g.y;h=g.width;g=g.height}else{e=a=0;h=this.paper.width;g=this.paper.height}break;default:e=a=0;h=this.paper.width;g=this.paper.height;break}b=b==null?a+h/2:b;c=c==null?e+g/2:c;b=b-this.paper.width/2;c=c-this.paper.height/2;var i;d.left!=(i=b+"px")&&(d.left=i);d.top!=(i=c+"px")&&(d.top=i);this.X=oa[z](this.type)?-b:a;this.Y=oa[z](this.type)?-c:e;this.W=h;this.H=g;if(oa[z](this.type)){f.left!=(i=-b*ja+"px")&&(f.left=i);f.top!=(i=-c*ja+"px")&&(f.top=i)}else if(this.type==
"text"){f.left!=(i=-b+"px")&&(f.left=i);f.top!=(i=-c+"px")&&(f.top=i)}else{d.width!=(i=this.paper.width+"px")&&(d.width=i);d.height!=(i=this.paper.height+"px")&&(d.height=i);f.left!=(i=a-b+"px")&&(f.left=i);f.top!=(i=e-c+"px")&&(f.top=i);f.width!=(i=h+"px")&&(f.width=i);f.height!=(i=g+"px")&&(f.height=i)}};u[p].hide=function(){!this.removed&&(this.Group.style.display="none");return this};u[p].show=function(){!this.removed&&(this.Group.style.display="block");return this};u[p].getBBox=function(){if(this.removed)return this;
if(oa[z](this.type))return va(this.attrs.path);return{x:this.X+(this.bbx||0),y:this.Y,width:this.W,height:this.H}};u[p].remove=function(){if(!this.removed){ia(this,this.paper);this.node.parentNode.removeChild(this.node);this.Group.parentNode.removeChild(this.Group);this.shape&&this.shape.parentNode.removeChild(this.shape);for(var a in this)delete this[a];this.removed=true}};u[p].attr=function(a,b){if(this.removed)return this;if(a==null){a={};for(var c in this.attrs)if(this.attrs[z](c))a[c]=this.attrs[c];
this._.rt.deg&&(a.rotation=this.rotate());(this._.sx!=1||this._.sy!=1)&&(a.scale=this.scale());a.gradient&&a.fill=="none"&&(a.fill=a.gradient)&&delete a.gradient;return a}if(b==null&&m.is(a,ea)){if(a=="translation")return ya.call(this);if(a=="rotation")return this.rotate();if(a=="scale")return this.scale();if(a==aa&&this.attrs.fill=="none"&&this.attrs.gradient)return this.attrs.gradient;return this.attrs[a]}if(this.attrs&&b==null&&m.is(a,U)){var d={};c=0;for(b=a[o];c<b;c++)d[a[c]]=this.attr(a[c]);
return d}if(b!=null){d={};d[a]=b}b==null&&m.is(a,"object")&&(d=a);if(d){if(d.text&&this.type=="text")this.node.string=d.text;ba(this,d);if(d.gradient&&({circle:1,ellipse:1}[z](this.type)||(d.gradient+s).charAt()!="r"))ma(this,d.gradient);(!oa[z](this.type)||this._.rt.deg)&&this.setBox(this.attrs)}return this};u[p].toFront=function(){!this.removed&&this.Group.parentNode[y](this.Group);this.paper.top!=this&&Ta(this,this.paper);return this};u[p].toBack=function(){if(this.removed)return this;if(this.Group.parentNode.firstChild!=
this.Group){this.Group.parentNode.insertBefore(this.Group,this.Group.parentNode.firstChild);Ua(this,this.paper)}return this};u[p].insertAfter=function(a){if(this.removed)return this;a.Group.nextSibling?a.Group.parentNode.insertBefore(this.Group,a.Group.nextSibling):a.Group.parentNode[y](this.Group);Va(this,a,this.paper);return this};u[p].insertBefore=function(a){if(this.removed)return this;a.Group.parentNode.insertBefore(this.Group,a.Group);Wa(this,a,this.paper);return this};var Cb=/ progid:\S+Blur\([^\)]+\)/g;
u[p].blur=function(a){var b=this.node.style,c=b.filter;c=c.replace(Cb,"");if(+a!==0){this.attrs.blur=a;b.filter=c+Da+".Blur(pixelradius="+(+a||1.5)+")";b.margin=Raphael.format("-{0}px 0 0 -{0}px",Math.round(+a||1.5))}else{b.filter=c;b.margin=0;delete this.attrs.blur}};ab=function(a,b,c,d){var f=R("group"),e=R("oval");f.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";f.coordsize=na;f.coordorigin=a.coordorigin;f[y](e);e=new u(e,f,a);e.type="circle";ba(e,{stroke:"#000",
fill:"none"});e.attrs.cx=b;e.attrs.cy=c;e.attrs.r=d;e.setBox({x:b-d,y:c-d,width:d*2,height:d*2});a.canvas[y](f);return e};function hb(a,b,c,d,f){return f?m.format("M{0},{1}l{2},0a{3},{3},0,0,1,{3},{3}l0,{5}a{3},{3},0,0,1,{4},{3}l{6},0a{3},{3},0,0,1,{4},{4}l0,{7}a{3},{3},0,0,1,{3},{4}z",a+f,b,c-f*2,f,-f,d-f*2,f*2-c,f*2-d):m.format("M{0},{1}l{2},0,0,{3},{4},0z",a,b,c,d,-c)}bb=function(a,b,c,d,f,e){var g=hb(b,c,d,f,e);a=a.path(g);var h=a.attrs;a.X=h.x=b;a.Y=h.y=c;a.W=h.width=d;a.H=h.height=f;h.r=e;h.path=
g;a.type="rect";return a};cb=function(a,b,c,d,f){var e=R("group"),g=R("oval");e.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";e.coordsize=na;e.coordorigin=a.coordorigin;e[y](g);g=new u(g,e,a);g.type="ellipse";ba(g,{stroke:"#000"});g.attrs.cx=b;g.attrs.cy=c;g.attrs.rx=d;g.attrs.ry=f;g.setBox({x:b-d,y:c-f,width:d*2,height:f*2});a.canvas[y](e);return g};db=function(a,b,c,d,f,e){var g=R("group"),h=R("image");g.style.cssText="position:absolute;left:0;top:0;width:"+
a.width+"px;height:"+a.height+"px";g.coordsize=na;g.coordorigin=a.coordorigin;h.src=b;g[y](h);h=new u(h,g,a);h.type="image";h.attrs.src=b;h.attrs.x=c;h.attrs.y=d;h.attrs.w=f;h.attrs.h=e;h.setBox({x:c,y:d,width:f,height:e});a.canvas[y](g);return h};eb=function(a,b,c,d){var f=R("group"),e=R("shape"),g=e.style,h=R("path"),i=R("textpath");f.style.cssText="position:absolute;left:0;top:0;width:"+a.width+"px;height:"+a.height+"px";f.coordsize=na;f.coordorigin=a.coordorigin;h.v=m.format("m{0},{1}l{2},{1}",
F(b*10),F(c*10),F(b*10)+1);h.textpathok=true;g.width=a.width;g.height=a.height;i.string=d+s;i.on=true;e[y](i);e[y](h);f[y](e);g=new u(i,f,a);g.shape=e;g.textpath=h;g.type="text";g.attrs.text=d;g.attrs.x=b;g.attrs.y=c;g.attrs.w=1;g.attrs.h=1;ba(g,{font:qa.font,stroke:"none",fill:"#000"});g.setBox();a.canvas[y](f);return g};fb=function(a,b){var c=this.canvas.style;a==+a&&(a+="px");b==+b&&(b+="px");c.width=a;c.height=b;c.clip="rect(0 "+a+" "+b+" 0)";return this};var R;C.createStyleSheet().addRule(".rvml",
"behavior:url(#default#VML)");try{!C.namespaces.rvml&&C.namespaces.add("rvml","urn:schemas-microsoft-com:vml");R=function(a){return C.createElement("<rvml:"+a+' class="rvml">')}}catch(Kb){R=function(a){return C.createElement("<"+a+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}Aa=function(){var a=Sa[K](0,arguments),b=a.container,c=a.height,d=a.width,f=a.x;a=a.y;if(!b)throw new Error("VML container not found.");var e=new G,g=e.canvas=C.createElement("div"),h=g.style;f=f||0;a=a||0;d=d||512;
c=c||342;d==+d&&(d+="px");c==+c&&(c+="px");e.width=1000;e.height=1000;e.coordsize=ja*1000+P+ja*1000;e.coordorigin="0 0";e.span=C.createElement("span");e.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";g[y](e.span);h.cssText=m.format("width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",d,c);if(b==1){C.body[y](g);h.left=f+"px";h.top=a+"px";h.position="absolute"}else b.firstChild?b.insertBefore(g,
b.firstChild):b[y](g);Fa.call(e,e,m.fn);return e};G[p].clear=function(){this.canvas.innerHTML=s;this.span=C.createElement("span");this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;";this.canvas[y](this.span);this.bottom=this.top=null};G[p].remove=function(){this.canvas.parentNode.removeChild(this.canvas);for(var a in this)this[a]=Xa(a);return true}}G[p].safari=/^Apple|^Google/.test(X.navigator.vendor)&&(!(X.navigator.userAgent.indexOf("Version/4.0")+
1)||X.navigator.platform.slice(0,2)=="iP")?function(){var a=this.rect(-99,-99,this.width+99,this.height+99);X.setTimeout(function(){a.remove()})}:function(){};function Db(){this.returnValue=false}function Eb(){return this.originalEvent.preventDefault()}function Fb(){this.cancelBubble=true}function Gb(){return this.originalEvent.stopPropagation()}var Hb=function(){if(C.addEventListener)return function(a,b,c,d){var f=Ba&&Ca[b]?Ca[b]:b;function e(g){if(Ba&&Ca[z](b))for(var h=0,i=g.targetTouches&&g.targetTouches.length;h<
i;h++)if(g.targetTouches[h].target==a){i=g;g=g.targetTouches[h];g.originalEvent=i;g.preventDefault=Eb;g.stopPropagation=Gb;break}return c.call(d,g)}a.addEventListener(f,e,false);return function(){a.removeEventListener(f,e,false);return true}};else if(C.attachEvent)return function(a,b,c,d){function f(g){g=g||X.event;g.preventDefault=g.preventDefault||Db;g.stopPropagation=g.stopPropagation||Fb;return c.call(d,g)}a.attachEvent("on"+b,f);function e(){a.detachEvent("on"+b,f);return true}return e}}();for(ha=
Ma[o];ha--;)(function(a){m[a]=u[p][a]=function(b){if(m.is(b,"function")){this.events=this.events||[];this.events.push({name:a,f:b,unbind:Hb(this.shape||this.node||C,a,b,this)})}return this};m["un"+a]=u[p]["un"+a]=function(b){for(var c=this.events,d=c[o];d--;)if(c[d].name==a&&c[d].f==b){c[d].unbind();c.splice(d,1);!c.length&&delete this.events;return this}return this}})(Ma[ha]);u[p].hover=function(a,b){return this.mouseover(a).mouseout(b)};u[p].unhover=function(a,b){return this.unmouseover(a).unmouseout(b)};
u[p].drag=function(a,b,c){this._drag={};var d=this.mousedown(function(g){(g.originalEvent?g.originalEvent:g).preventDefault();this._drag.x=g.clientX;this._drag.y=g.clientY;this._drag.id=g.identifier;b&&b.call(this,g.clientX,g.clientY);Raphael.mousemove(f).mouseup(e)});function f(g){var h=g.clientX,i=g.clientY;if(Ba)for(var j=g.touches.length,l;j--;){l=g.touches[j];if(l.identifier==d._drag.id){h=l.clientX;i=l.clientY;(g.originalEvent?g.originalEvent:g).preventDefault();break}}else g.preventDefault();
a&&a.call(d,h-d._drag.x,i-d._drag.y,h,i)}function e(){d._drag={};Raphael.unmousemove(f).unmouseup(e);c&&c.call(d)}return this};G[p].circle=function(a,b,c){return ab(this,a||0,b||0,c||0)};G[p].rect=function(a,b,c,d,f){return bb(this,a||0,b||0,c||0,d||0,f||0)};G[p].ellipse=function(a,b,c,d){return cb(this,a||0,b||0,c||0,d||0)};G[p].path=function(a){a&&!m.is(a,ea)&&!m.is(a[0],U)&&(a+=s);return Za(m.format[K](m,arguments),this)};G[p].image=function(a,b,c,d,f){return db(this,a||"about:blank",b||0,c||0,
d||0,f||0)};G[p].text=function(a,b,c){return eb(this,a||0,b||0,c||s)};G[p].set=function(a){arguments[o]>1&&(a=Array[p].splice.call(arguments,0,arguments[o]));return new Z(a)};G[p].setSize=fb;G[p].top=G[p].bottom=null;G[p].raphael=m;function ib(){return this.x+P+this.y}u[p].resetScale=function(){if(this.removed)return this;this._.sx=1;this._.sy=1;this.attrs.scale="1 1"};u[p].scale=function(a,b,c,d){if(this.removed)return this;if(a==null&&b==null)return{x:this._.sx,y:this._.sy,toString:ib};b=b||a;!+b&&
(b=a);var f,e,g=this.attrs;if(a!=0){var h=this.getBBox(),i=h.x+h.width/2,j=h.y+h.height/2;f=a/this._.sx;e=b/this._.sy;c=+c||c==0?c:i;d=+d||d==0?d:j;h=~~(a/w.abs(a));var l=~~(b/w.abs(b)),n=this.node.style,r=c+(i-c)*f;j=d+(j-d)*e;switch(this.type){case "rect":case "image":var q=g.width*h*f,k=g.height*l*e;this.attr({height:k,r:g.r*$(h*f,l*e),width:q,x:r-q/2,y:j-k/2});break;case "circle":case "ellipse":this.attr({rx:g.rx*h*f,ry:g.ry*l*e,r:g.r*$(h*f,l*e),cx:r,cy:j});break;case "text":this.attr({x:r,y:j});
break;case "path":i=Oa(g.path);for(var t=true,L=0,B=i[o];L<B;L++){var x=i[L],J=pa.call(x[0]);if(!(J=="M"&&t)){t=false;if(J=="A"){x[i[L][o]-2]*=f;x[i[L][o]-1]*=e;x[1]*=h*f;x[2]*=l*e;x[5]=+!(h+l?!+x[5]:+x[5])}else if(J=="H"){J=1;for(var fa=x[o];J<fa;J++)x[J]*=f}else if(J=="V"){J=1;for(fa=x[o];J<fa;J++)x[J]*=e}else{J=1;for(fa=x[o];J<fa;J++)x[J]*=J%2?f:e}}}e=va(i);f=r-e.x-e.width/2;e=j-e.y-e.height/2;i[0][1]+=f;i[0][2]+=e;this.attr({path:i});break}if(this.type in{text:1,image:1}&&(h!=1||l!=1))if(this.transformations){this.transformations[2]=
"scale("[M](h,",",l,")");this.node[W]("transform",this.transformations[Q](P));f=h==-1?-g.x-(q||0):g.x;e=l==-1?-g.y-(k||0):g.y;this.attr({x:f,y:e});g.fx=h-1;g.fy=l-1}else{this.node.filterMatrix=Da+".Matrix(M11="[M](h,", M12=0, M21=0, M22=",l,", Dx=0, Dy=0, sizingmethod='auto expand', filtertype='bilinear')");n.filter=(this.node.filterMatrix||s)+(this.node.filterOpacity||s)}else if(this.transformations){this.transformations[2]=s;this.node[W]("transform",this.transformations[Q](P));g.fx=0;g.fy=0}else{this.node.filterMatrix=
s;n.filter=(this.node.filterMatrix||s)+(this.node.filterOpacity||s)}g.scale=[a,b,c,d][Q](P);this._.sx=a;this._.sy=b}return this};u[p].clone=function(){if(this.removed)return null;var a=this.attr();delete a.scale;delete a.translation;return this.paper[this.type]().attr(a)};var jb=T(function(a,b,c,d,f,e,g,h,i){for(var j=0,l,n=0;n<1.001;n+=0.0010){var r=m.findDotsAtSegment(a,b,c,d,f,e,g,h,n);n&&(j+=D(D(l.x-r.x,2)+D(l.y-r.y,2),0.5));if(j>=i)return r;l=r}});function Ha(a,b){return function(c,d,f){c=ua(c);
for(var e,g,h,i,j="",l={},n=0,r=0,q=c.length;r<q;r++){h=c[r];if(h[0]=="M"){e=+h[1];g=+h[2]}else{i=Ib(e,g,h[1],h[2],h[3],h[4],h[5],h[6]);if(n+i>d){if(b&&!l.start){e=jb(e,g,h[1],h[2],h[3],h[4],h[5],h[6],d-n);j+=["C",e.start.x,e.start.y,e.m.x,e.m.y,e.x,e.y];if(f)return j;l.start=j;j=["M",e.x,e.y+"C",e.n.x,e.n.y,e.end.x,e.end.y,h[5],h[6]][Q]();n+=i;e=+h[5];g=+h[6];continue}if(!a&&!b){e=jb(e,g,h[1],h[2],h[3],h[4],h[5],h[6],d-n);return{x:e.x,y:e.y,alpha:e.alpha}}}n+=i;e=+h[5];g=+h[6]}j+=h}l.end=j;e=a?n:
b?l:m.findDotsAtSegment(e,g,h[1],h[2],h[3],h[4],h[5],h[6],1);e.alpha&&(e={x:e.x,y:e.y,alpha:e.alpha});return e}}var Ib=T(function(a,b,c,d,f,e,g,h){for(var i={x:0,y:0},j=0,l=0;l<1.01;l+=0.01){var n=la(a,b,c,d,f,e,g,h,l);l&&(j+=D(D(i.x-n.x,2)+D(i.y-n.y,2),0.5));i=n}return j}),kb=Ha(1),za=Ha(),Ia=Ha(0,1);u[p].getTotalLength=function(){if(this.type=="path"){if(this.node.getTotalLength)return this.node.getTotalLength();return kb(this.attrs.path)}};u[p].getPointAtLength=function(a){if(this.type=="path")return za(this.attrs.path,
a)};u[p].getSubpath=function(a,b){if(this.type=="path"){if(w.abs(this.getTotalLength()-b)<1.0E-6)return Ia(this.attrs.path,a).end;b=Ia(this.attrs.path,b,1);return a?Ia(b,a).end:b}};m.easing_formulas={linear:function(a){return a},"<":function(a){return D(a,3)},">":function(a){return D(a-1,3)+1},"<>":function(a){a*=2;if(a<1)return D(a,3)/2;a-=2;return(D(a,3)+2)/2},backIn:function(a){var b=1.70158;return a*a*((b+1)*a-b)},backOut:function(a){a-=1;var b=1.70158;return a*a*((b+1)*a+b)+1},elastic:function(a){if(a==
0||a==1)return a;var b=0.3,c=b/4;return D(2,-10*a)*w.sin((a-c)*2*w.PI/b)+1},bounce:function(a){var b=7.5625,c=2.75;if(a<1/c)a=b*a*a;else if(a<2/c){a-=1.5/c;a=b*a*a+0.75}else if(a<2.5/c){a-=2.25/c;a=b*a*a+0.9375}else{a-=2.625/c;a=b*a*a+0.984375}return a}};var S={length:0};function lb(){var a=+new Date;for(var b in S)if(b!="length"&&S[z](b)){var c=S[b];if(c.stop||c.el.removed){delete S[b];S[o]--}else{var d=a-c.start,f=c.ms,e=c.easing,g=c.from,h=c.diff,i=c.to,j=c.t,l=c.prev||0,n=c.el,r=c.callback,q=
{},k;if(d<f){r=m.easing_formulas[e]?m.easing_formulas[e](d/f):d/f;for(var t in g)if(g[z](t)){switch(Ea[t]){case "along":k=r*f*h[t];i.back&&(k=i.len-k);e=za(i[t],k);n.translate(h.sx-h.x||0,h.sy-h.y||0);h.x=e.x;h.y=e.y;n.translate(e.x-h.sx,e.y-h.sy);i.rot&&n.rotate(h.r+e.alpha,e.x,e.y);break;case O:k=+g[t]+r*f*h[t];break;case "colour":k="rgb("+[Ja(F(g[t].r+r*f*h[t].r)),Ja(F(g[t].g+r*f*h[t].g)),Ja(F(g[t].b+r*f*h[t].b))][Q](",")+")";break;case "path":k=[];e=0;for(var L=g[t][o];e<L;e++){k[e]=[g[t][e][0]];
for(var B=1,x=g[t][e][o];B<x;B++)k[e][B]=+g[t][e][B]+r*f*h[t][e][B];k[e]=k[e][Q](P)}k=k[Q](P);break;case "csv":switch(t){case "translation":k=h[t][0]*(d-l);e=h[t][1]*(d-l);j.x+=k;j.y+=e;k=k+P+e;break;case "rotation":k=+g[t][0]+r*f*h[t][0];g[t][1]&&(k+=","+g[t][1]+","+g[t][2]);break;case "scale":k=[+g[t][0]+r*f*h[t][0],+g[t][1]+r*f*h[t][1],2 in i[t]?i[t][2]:s,3 in i[t]?i[t][3]:s][Q](P);break;case "clip-rect":k=[];for(e=4;e--;)k[e]=+g[t][e]+r*f*h[t][e];break}break}q[t]=k}n.attr(q);n._run&&n._run.call(n)}else{if(i.along){e=
za(i.along,i.len*!i.back);n.translate(h.sx-(h.x||0)+e.x-h.sx,h.sy-(h.y||0)+e.y-h.sy);i.rot&&n.rotate(h.r+e.alpha,e.x,e.y)}(j.x||j.y)&&n.translate(-j.x,-j.y);i.scale&&(i.scale+=s);n.attr(i);delete S[b];S[o]--;n.in_animation=null;m.is(r,"function")&&r.call(n)}c.prev=d}}m.svg&&n&&n.paper&&n.paper.safari();S[o]&&X.setTimeout(lb)}function Ja(a){return Y($(a,255),0)}function ya(a,b){if(a==null)return{x:this._.tx,y:this._.ty,toString:ib};this._.tx+=+a;this._.ty+=+b;switch(this.type){case "circle":case "ellipse":this.attr({cx:+a+
this.attrs.cx,cy:+b+this.attrs.cy});break;case "rect":case "image":case "text":this.attr({x:+a+this.attrs.x,y:+b+this.attrs.y});break;case "path":var c=Oa(this.attrs.path);c[0][1]+=+a;c[0][2]+=+b;this.attr({path:c});break}return this}u[p].animateWith=function(a,b,c,d,f){S[a.id]&&(b.start=S[a.id].start);return this.animate(b,c,d,f)};u[p].animateAlong=mb();u[p].animateAlongBack=mb(1);function mb(a){return function(b,c,d,f){var e={back:a};m.is(d,"function")?(f=d):(e.rot=d);b&&b.constructor==u&&(b=b.attrs.path);
b&&(e.along=b);return this.animate(e,c,f)}}u[p].onAnimation=function(a){this._run=a||0;return this};u[p].animate=function(a,b,c,d){if(m.is(c,"function")||!c)d=c||null;var f={},e={},g={};for(var h in a)if(a[z](h))if(Ea[z](h)){f[h]=this.attr(h);f[h]==null&&(f[h]=qa[h]);e[h]=a[h];switch(Ea[h]){case "along":var i=kb(a[h]),j=za(a[h],i*!!a.back),l=this.getBBox();g[h]=i/b;g.tx=l.x;g.ty=l.y;g.sx=j.x;g.sy=j.y;e.rot=a.rot;e.back=a.back;e.len=i;a.rot&&(g.r=A(this.rotate())||0);break;case O:g[h]=(e[h]-f[h])/
b;break;case "colour":f[h]=m.getRGB(f[h]);i=m.getRGB(e[h]);g[h]={r:(i.r-f[h].r)/b,g:(i.g-f[h].g)/b,b:(i.b-f[h].b)/b};break;case "path":i=ua(f[h],e[h]);f[h]=i[0];j=i[1];g[h]=[];i=0;for(l=f[h][o];i<l;i++){g[h][i]=[0];for(var n=1,r=f[h][i][o];n<r;n++)g[h][i][n]=(j[i][n]-f[h][i][n])/b}break;case "csv":j=(a[h]+s)[H](V);i=(f[h]+s)[H](V);switch(h){case "translation":f[h]=[0,0];g[h]=[j[0]/b,j[1]/b];break;case "rotation":f[h]=i[1]==j[1]&&i[2]==j[2]?i:[0,j[1],j[2]];g[h]=[(j[0]-f[h][0])/b,0,0];break;case "scale":a[h]=
j;f[h]=(f[h]+s)[H](V);g[h]=[(j[0]-f[h][0])/b,(j[1]-f[h][1])/b,0,0];break;case "clip-rect":f[h]=(f[h]+s)[H](V);g[h]=[];for(i=4;i--;)g[h][i]=(j[i]-f[h][i])/b;break}e[h]=j}}this.stop();this.in_animation=1;S[this.id]={start:a.start||+new Date,ms:b,easing:c,from:f,diff:g,to:e,el:this,callback:d,t:{x:0,y:0}};++S[o]==1&&lb();return this};u[p].stop=function(){S[this.id]&&S[o]--;delete S[this.id];return this};u[p].translate=function(a,b){return this.attr({translation:a+" "+b})};u[p][N]=function(){return"Rapha\u00ebl\u2019s object"};
m.ae=S;function Z(a){this.items=[];this[o]=0;this.type="set";if(a)for(var b=0,c=a[o];b<c;b++)if(a[b]&&(a[b].constructor==u||a[b].constructor==Z)){this[this.items[o]]=this.items[this.items[o]]=a[b];this[o]++}}Z[p][E]=function(){for(var a,b,c=0,d=arguments[o];c<d;c++)if((a=arguments[c])&&(a.constructor==u||a.constructor==Z)){b=this.items[o];this[b]=this.items[b]=a;this[o]++}return this};Z[p].pop=function(){delete this[this[o]--];return this.items.pop()};for(var Ka in u[p])if(u[p][z](Ka))Z[p][Ka]=function(a){return function(){for(var b=
0,c=this.items[o];b<c;b++)this.items[b][a][K](this.items[b],arguments);return this}}(Ka);Z[p].attr=function(a,b){if(a&&m.is(a,U)&&m.is(a[0],"object")){b=0;for(var c=a[o];b<c;b++)this.items[b].attr(a[b])}else{c=0;for(var d=this.items[o];c<d;c++)this.items[c].attr(a,b)}return this};Z[p].animate=function(a,b,c,d){(m.is(c,"function")||!c)&&(d=c||null);var f=this.items[o],e=f,g,h=this,i;d&&(i=function(){!--f&&d.call(h)});c=m.is(c,ea)?c:i;for(g=this.items[--e].animate(a,b,c,i);e--;)this.items[e].animateWith(g,
a,b,c,i);return this};Z[p].insertAfter=function(a){for(var b=this.items[o];b--;)this.items[b].insertAfter(a);return this};Z[p].getBBox=function(){for(var a=[],b=[],c=[],d=[],f=this.items[o];f--;){var e=this.items[f].getBBox();a[E](e.x);b[E](e.y);c[E](e.x+e.width);d[E](e.y+e.height)}a=$[K](0,a);b=$[K](0,b);return{x:a,y:b,width:Y[K](0,c)-a,height:Y[K](0,d)-b}};Z[p].clone=function(a){a=new Z;for(var b=0,c=this.items[o];b<c;b++)a[E](this.items[b].clone());return a};m.registerFont=function(a){if(!a.face)return a;
this.fonts=this.fonts||{};var b={w:a.w,face:{},glyphs:{}},c=a.face["font-family"];for(var d in a.face)if(a.face[z](d))b.face[d]=a.face[d];if(this.fonts[c])this.fonts[c][E](b);else this.fonts[c]=[b];if(!a.svg){b.face["units-per-em"]=da(a.face["units-per-em"],10);for(var f in a.glyphs)if(a.glyphs[z](f)){c=a.glyphs[f];b.glyphs[f]={w:c.w,k:{},d:c.d&&"M"+c.d[I](/[mlcxtrv]/g,function(g){return{l:"L",c:"C",x:"z",t:"m",r:"l",v:"c"}[g]||"M"})+"z"};if(c.k)for(var e in c.k)if(c[z](e))b.glyphs[f].k[e]=c.k[e]}}return a};
G[p].getFont=function(a,b,c,d){d=d||"normal";c=c||"normal";b=+b||{normal:400,bold:700,lighter:300,bolder:800}[b]||400;if(m.fonts){var f=m.fonts[a];if(!f){a=new RegExp("(^|\\s)"+a[I](/[^\w\d\s+!~.:_-]/g,s)+"(\\s|$)","i");for(var e in m.fonts)if(m.fonts[z](e))if(a.test(e)){f=m.fonts[e];break}}var g;if(f){e=0;for(a=f[o];e<a;e++){g=f[e];if(g.face["font-weight"]==b&&(g.face["font-style"]==c||!g.face["font-style"])&&g.face["font-stretch"]==d)break}}return g}};G[p].print=function(a,b,c,d,f,e){e=e||"middle";
var g=this.set(),h=(c+s)[H](s),i=0;m.is(d,c)&&(d=this.getFont(d));if(d){c=(f||16)/d.face["units-per-em"];var j=d.face.bbox.split(V);f=+j[0];e=+j[1]+(e=="baseline"?j[3]-j[1]+ +d.face.descent:(j[3]-j[1])/2);j=0;for(var l=h[o];j<l;j++){var n=j&&d.glyphs[h[j-1]]||{},r=d.glyphs[h[j]];i+=j?(n.w||d.w)+(n.k&&n.k[h[j]]||0):0;r&&r.d&&g[E](this.path(r.d).attr({fill:"#000",stroke:"none",translation:[i,0]}))}g.scale(c,c,f,e).translate(a-f,b-e)}return g};var Jb=/\{(\d+)\}/g;m.format=function(a,b){var c=m.is(b,
U)?[0][M](b):arguments;a&&m.is(a,ea)&&c[o]-1&&(a=a[I](Jb,function(d,f){return c[++f]==null?s:c[f]}));return a||s};m.ninja=function(){La.was?(Raphael=La.is):delete Raphael;return m};m.el=u[p];return m}();

/*
 * Chart Drawer v 1.1
 * @requires Raphael JavaScript Vector Library
 */
var gChartTypes={BAR_HORIZONTAL:'poziomy',BAR_VERTICAL:'pionowy',LINE:'liniowy'};var gGridTypes={CONSTANT_VALUE:0,CONSTANT_SPACE:1};var gChartConfig={SIZE:[0,0],MARGIN:[5,5,5,5],PADDING:[0,0,0,0],LEGEND_POSITION:[0,0],LEGEND_SIDE:false,LEGEND_PADDING:[10,10,10,10],LEGEND_BACKGROUND_COLOR:'#fff',LEGEND_BORDER_COLOR:'#e5e5e5',LEGEND_BORDER_WIDTH:1,LEGEND_BORDER_DASH:'',BACKGROUND_COLOR:'#fff',LIMIT_X:[false,false],LIMIT_Y:[false,false],CONTAINER:null,PAPER:null,CHART_TYPE:null,CHARTS_SETTINGS:{},GRID_TYPE:gGridTypes.CONSTANT_VALUE,GRID_SETTINGS:{LABEL_FONT_SIZE:'10px',LABEL_FONT_FAMILY:'Arial',LABEL_FONT_COLOR:'#858585',AXES_X_COLOR:'#ececec',AXES_X_WIDTH:1,AXES_X_DASH:'',AXES_Y_COLOR:'#ececec',AXES_Y_WIDTH:1,AXES_Y_DASH:'',AXE_0_COLOR:'#d2d2d2',AXE_0_WIDTH:1.5,AXE_0_DASH:'',DESIRED_SPACE_BETWEEN_X_AXES:40,DESIRED_SPACE_BETWEEN_Y_AXES:30,CONSTANT_SPACE_VALUE_ROUND_FACTOR:0,LABEL_HEIGHT:0,MIN_X_LABEL_WIDTH:0,MAX_X_LABEL_WIDTH:0,MIN_Y_LABEL_WIDTH:0,MAX_Y_LABEL_WIDTH:0}};gChartConfig.CHARTS_SETTINGS[gChartTypes.BAR_HORIZONTAL]={DEFAULT_BAR_HEIGHT:30,DEFAULT_SPACE_BETWEEN_BARS:15,MIN_BAR_HEIGHT:20,MIN_SPACE_BETWEEN_BARS:5,LABEL_FONT_SIZE:'12px',LABEL_FONT_FAMILY:'Georgia',LABEL_FONT_COLOR:'#1c1c1c',LABEL_MARGIN:[0,10,0,0],VALUE_FONT_SIZE:'18px',VALUE_FONT_FAMILY:'Georgia',VALUE_FONT_COLOR:'#3b3b3b',VALUE_MARGIN:[0,0,0,10],IE_LABEL_POSITION_CORRECTION:[0,2]};gChartConfig.CHARTS_SETTINGS[gChartTypes.BAR_VERTICAL]={DEFAULT_BAR_WIDTH:30,DEFAULT_SPACE_BETWEEN_BARS:15,MIN_BAR_WIDTH:20,MIN_SPACE_BETWEEN_BARS:5,LABEL_FONT_SIZE:'12px',LABEL_FONT_FAMILY:'Georgia',LABEL_FONT_COLOR:'#1c1c1c',LABEL_MARGIN:[0,0,10,0],LABEL_MARK_SIZE:10,SHOW_LABEL_MARK:true,VALUE_FONT_SIZE:'14px',VALUE_FONT_FAMILY:'Georgia',VALUE_FONT_COLOR:'#3b3b3b',VALUE_MARGIN:[0,0,4,0],IE_LABEL_POSITION_CORRECTION:[0,2]};gChartConfig.CHARTS_SETTINGS[gChartTypes.LINE]={POINT_RADIUS:5,LINE_WIDTH:1,LINE_DASH:'',LABEL_FONT_SIZE:'12px',LABEL_FONT_FAMILY:'Georgia',LABEL_FONT_COLOR:'#1c1c1c',LABEL_MARGIN:[0,0,10,0],LABEL_MARK_RADIUS:5,SHOW_LABEL_MARK:true,IE_LABEL_POSITION_CORRECTION:[0,3]};var gChart={debug:false,mode:null,log:function(message){if(window.console&&window.console.log&&gChart.debug)window.console.log(message)},writeConfig:function(cfg,opt){for(var i in cfg){if(typeof opt[i]=='undefined')continue;if(typeof opt[i]=='object'){if(opt[i].nodeName===undefined){gChart.writeConfig(cfg[i],opt[i])}else{cfg[i]=opt[i]}}else{cfg[i]=opt[i]}}},f_trm:function(x){return x.replace(/^\s+|\s+$/g,'')},f_ss:function(sel,t){if(typeof sel!='string')return[];function unique(a){var b=[];var c;while(c=a.shift())(function(){for(var i=0,l=b.length;i<l;i++)if(b[i]==c)return;b.push(c)})();return b};function hasClass(a,b){return(' '+a.className+' ').match(' '+b+' ')!=null};function hasClasses(a,b){b=b.split(/\./);for(var i=0,l=b.length;i<l;i++)if(!hasClass(a,b[i]))return false;return true};sel=sel.split(/,/);var result=[];var st=t?t.constructor==Array?t:[t]:[document];for(var si=0,sl=sel.length;si<sl;si++){var s=sel[si].replace(/^\s+|\s+$/g,'').replace(/\s+/g,' ').split(' ');if(s.length==0)break;var e;var r=[];var t=st;while(e=s.shift()){var h=e.indexOf('#');var c=e.indexOf('.');var eTag=(h==-1?c==-1?e:e.slice(0,c):e.slice(0,h)).toUpperCase();var eID=c==-1?e.slice(h+1):e.slice(h+1,c);var eClass=c==-1?'':e.slice(c+1);if(h>=0){var el=document.getElementById(eID);if(el==null||(eTag!=''&&el.tagName.toUpperCase()!=eTag)||(eClass!=''&&!hasClasses(el,eClass)))break;r=[el]}else{r=[];for(var i=0,tl=t.length;i<tl;i++){var _r=t[i].getElementsByTagName(eTag==''?'*':eTag);for(var j=0,rl=_r.length;j<rl;j++)if(eClass==''||hasClasses(_r[j],eClass))r=r.concat(_r[j])};r=unique(r)};t=r;if(r.length==0)break};result=result.concat(r&&r.length>0?r:[])};return result},f_aev:function(obj,type,fn){try{if(obj.addEventListener){obj.addEventListener(type,fn,false)}else if(obj.attachEvent){obj["e"+type+fn]=fn;obj[type+fn]=function(){obj["e"+type+fn](window.event)};obj.attachEvent("on"+type,obj[type+fn])}}catch(e){}},f_hcl:function(obj,clName){var clN=' '+obj.className+' ';return(clN.match(' '+clName+' ')!=null)},f_acl:function(obj,clName){if(!gChart.f_hcl(obj,clName))obj.className=gChart.f_trm(obj.className+' '+clName)},f_rcl:function(obj,clName){if(!gChart.f_hcl(obj,clName))return;var clN=' '+obj.className+' ';eval("obj.className = gChart.f_trm(clN.replace(/ "+clName+" /g,' '));")},f_gpbn:function(obj,tgName){var par=obj.parentNode;if(par){var tn=gChart.f_trm(tgName.toLowerCase());while(gChart.f_trm(par.tagName.toLowerCase())!=tn){par=par.parentNode;if(par.tagName==undefined){par=null;break}}};return par},f_gmp:function(e){var posx=0;var posy=0;if(!e){var e=window.event};if(e.pageX||e.pageY){posx=e.pageX;posy=e.pageY}else if(e.clientX||e.clientY){posx=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;posy=e.clientY+document.body.scrollTop+document.documentElement.scrollTop};return[posx,posy]},f_arm:function(array,from,to){var rest=array.slice((to||from)+1||array.length);array.length=from<0?array.length+from:from;return array.push.apply(array,rest)},f_rgbToHsl:function(r,g,b){r/=255,g/=255,b/=255;var max=Math.max(r,g,b),min=Math.min(r,g,b);var h,s,l=(max+min)/2;if(max==min){h=s=0}else{var d=max-min;s=l>0.5?d/(2-max-min):d/(max+min);switch(max){case r:h=(g-b)/d+(g<b?6:0);break;case g:h=(b-r)/d+2;break;case b:h=(r-g)/d+4;break};h/=6};return[h,s,l]},f_hslToRgb:function(h,s,l){var r,g,b;if(s==0){r=g=b=l}else{function hue2rgb(p,q,t){if(t<0)t+=1;if(t>1)t-=1;if(t<1/6)return p+(q-p)*6*t;if(t<1/2)return q;if(t<2/3)return p+(q-p)*(2/3-t)*6;return p};var q=l<0.5?l*(1+s):l+s-l*s;var p=2*l-q;r=hue2rgb(p,q,h+1/3);g=hue2rgb(p,q,h);b=hue2rgb(p,q,h-1/3)};return[r*255,g*255,b*255]},f_ghc:function(color){var c=Raphael.getRGB(color);var nc={r:c.r,g:c.g,b:c.b};var hsl_color=gChart.f_rgbToHsl(nc.r,nc.g,nc.b);var hover_color=gChart.f_hslToRgb(hsl_color[0],hsl_color[1],hsl_color[2]+.2>1?hsl_color[2]-.15:hsl_color[2]+.15);return Raphael.getRGB('rgb('+parseInt(hover_color[0])+','+parseInt(hover_color[1])+','+parseInt(hover_color[2])+')').hex},f_unique:function(a){var b=[];var c;while(c=a.shift())(function(){for(var i=0,l=b.length;i<l;i++)if(b[i]==c)return;b.push(c)})();return b},f_clone:function(obj){if(obj==null||typeof(obj)!='object'){return obj};var temp=obj.constructor();for(var key in obj){temp[key]=gChart.f_clone(obj[key])};return temp},date:function(format,timestamp){var that=this,jsdate,f,formatChr=/\\?([a-z])/gi,formatChrCb,_pad=function(n,c){if((n=n+"").length<c){return new Array((++c)-n.length).join("0")+n}else{return n}},txt_words=["Sun","Mon","Tues","Wednes","Thurs","Fri","Satur","January","February","March","April","May","June","July","August","September","October","November","December"],txt_ordin={1:"st",2:"nd",3:"rd",21:"st",22:"nd",23:"rd",31:"st"};formatChrCb=function(t,s){return f[t]?f[t]():s};f={d:function(){return _pad(f.j(),2)},D:function(){return f.l().slice(0,3)},j:function(){return jsdate.getDate()},l:function(){return txt_words[f.w()]+'day'},N:function(){return f.w()||7},S:function(){return txt_ordin[f.j()]||'th'},w:function(){return jsdate.getDay()},z:function(){var a=new Date(f.Y(),f.n()-1,f.j()),b=new Date(f.Y(),0,1);return Math.round((a-b)/864e5)+1},W:function(){var a=new Date(f.Y(),f.n()-1,f.j()-f.N()+3),b=new Date(a.getFullYear(),0,4);return 1+Math.round((a-b)/864e5/7)},F:function(){return txt_words[6+f.n()]},m:function(){return _pad(f.n(),2)},M:function(){return f.F().slice(0,3)},n:function(){return jsdate.getMonth()+1},t:function(){return(new Date(f.Y(),f.n(),0)).getDate()},L:function(){var y=f.Y(),a=y&3,b=y%4e2,c=y%1e2;return 0+(!a&&(c||!b))},o:function(){var n=f.n(),W=f.W(),Y=f.Y();return Y+(n===12&&W<9?-1:n===1&&W>9)},Y:function(){return jsdate.getFullYear()},y:function(){return(f.Y()+"").slice(-2)},a:function(){return jsdate.getHours()>11?"pm":"am"},A:function(){return f.a().toUpperCase()},B:function(){var H=jsdate.getUTCHours()*36e2,i=jsdate.getUTCMinutes()*60,s=jsdate.getUTCSeconds();return _pad(Math.floor((H+i+s+36e2)/86.4)%1e3,3)},g:function(){return f.G()%12||12},G:function(){return jsdate.getHours()},h:function(){return _pad(f.g(),2)},H:function(){return _pad(f.G(),2)},i:function(){return _pad(jsdate.getMinutes(),2)},s:function(){return _pad(jsdate.getSeconds(),2)},u:function(){return _pad(jsdate.getMilliseconds()*1000,6)},e:function(){return'UTC'},I:function(){var a=new Date(f.Y(),0),c=Date.UTC(f.Y(),0),b=new Date(f.Y(),6),d=Date.UTC(f.Y(),6);return 0+((a-c)!==(b-d))},O:function(){var a=jsdate.getTimezoneOffset();return(a>0?"-":"+")+_pad(Math.abs(a/60*100),4)},P:function(){var O=f.O();return(O.substr(0,3)+":"+O.substr(3,2))},T:function(){return'UTC'},Z:function(){return-jsdate.getTimezoneOffset()*60},c:function(){return'Y-m-d\\Th:i:sP'.replace(formatChr,formatChrCb)},r:function(){return'D, d M Y H:i:s O'.replace(formatChr,formatChrCb)},U:function(){return jsdate.getTime()/1000|0}};this.date=function(format,timestamp){that=this;jsdate=((typeof timestamp==='undefined')?new Date():(timestamp instanceof Date)?new Date(timestamp):new Date(timestamp*1000));return format.replace(formatChr,formatChrCb)};return this.date(format,timestamp)},cloud:{ready:false,init:function(){if(gChart.cloud.ready==true)return;var _gclctr=document.createElement('div');var _gclctri=document.createElement('div');_gclctr.id='gChart_cloud';_gclctri.className='inner';_gclctr.appendChild(_gclctri);document.body.appendChild(_gclctr);gChart.cloud.ready=true},show:function(e,msg){var cloud=gChart.f_ss('#gChart_cloud')[0];gChart.f_ss('div.inner',cloud)[0].innerHTML=msg;var mp=gChart.f_gmp(e);cloud.style.bottom='auto';cloud.style.visibility='visible';cloud.style.left=(mp[0]-13)+'px';cloud.style.top=(mp[1]-8-cloud.offsetHeight)+'px'},hide:function(){var cloud=gChart.f_ss('#gChart_cloud')[0];cloud.style.visibility='hidden';cloud.style.top='auto';cloud.style.bottom='0px';gChart.f_ss('.inner',cloud)[0].innerHTML=' '},move:function(e){var cloud=gChart.f_ss('#gChart_cloud')[0];var mp=gChart.f_gmp(e);cloud.style.left=(mp[0]-13)+'px';cloud.style.top=(mp[1]-8-cloud.offsetHeight)+'px'}},init:function(options,data){if(typeof(Raphael)!='function'||!Raphael.type){gChart.log('Brak biblioteki Raphael, lub przegl±darka nie wspiera SVG, VML');gChart.error.call(gChart.error.NO_RAPHAEL_LIBRARY);return false}else{gChart.mode=Raphael.type};if(!data||!data.labels||!data.values||data.labels.length<1||data.values.length<1){gChart.log('Nie podano danych');gChart.error.call(gChart.error.NO_DATA_GIVEN);return false};var config=gChart.f_clone(gChartConfig);gChart.writeConfig(config,options);var type=null;if(config.CHART_TYPE){for(var i in gChartTypes){if(gChartTypes[i]==config.CHART_TYPE)type=gChartTypes[i]}};if(!type){gChart.log('Nie podano lub podano z\u0142y typ wykresu');gChart.error.call(gChart.error.WRONG_CHART_TYPE);return false};if(!config.CONTAINER){gChart.log('Nie znaleziono elementu, w kt\u00f3rym ma by\u0107 umieszczony wykres');gChart.error.call(gChart.error.NO_CONTAINER_FOR_CHART);return false};if(config.SIZE[0]<=0||config.SIZE[1]<=0){gChart.log('Rozmar wykresu zosta\u0142 Ľle zdefinowany');gChart.error.call(gChart.error.WRONG_CHART_SIZE);return false};var paper=Raphael(config.CONTAINER,config.SIZE[0],config.SIZE[1]);var _d=new Date();var ts=_d.getTime()/1000;gChart.draw.chart(paper,type,config,data);_d=new Date();var te=_d.getTime()/1000;if(gChart.debug){gChart.log('chart drawed in '+(te-ts)+' seconds')};return true},draw:{chart:function(paper,type,config,data){var start_x=0+config.MARGIN[3];var end_x=config.SIZE[0]-config.MARGIN[1];var start_y=0+config.MARGIN[0];var end_y=config.SIZE[1]-config.MARGIN[2];var _start_x=start_x+config.PADDING[3];var _end_x=end_x-config.PADDING[1];var _start_y=start_y+config.PADDING[0];var _end_y=end_y-config.PADDING[2];if(end_x-start_x<=0||end_y-start_y<=0||_end_x-_start_x<=0||_end_y-_start_y<=0){gChart.log('Za ma\u0142y rozmiar');gChart.error.call(gChart.error.IDIOT_SETTINGS);paper.remove();return false};var value_types={NUMBER:0,DATE:1};var value_formats={SINGLE:0,DOUBLE:1};var x_value_type=null;var value_format=null;if(typeof(data.values[0].value)==='number'){value_format=value_formats.SINGLE;x_value_type=value_types.NUMBER}else if(typeof(data.values[0].value)==='object'){value_format=value_formats.DOUBLE;if(typeof(data.values[0].value[0])==='number'){x_value_type=value_types.NUMBER}else if(typeof(data.values[0].value[0])==='object'&&data.values[0].value[0].constructor===Date)x_value_type=value_types.DATE};if((value_format==value_formats.SINGLE&&x_value_type!=value_types.NUMBER)||(value_format==value_formats.DOUBLE&&typeof(data.values[0].value[1])!=='number'&&(x_value_type!=value_types.NUMBER||x_value_type!=value_types.DATE))){gChart.log('Z\u0142y format danych');gChart.error.call(gChart.error.IDIOT_DATA);paper.remove();return false};var values_length=data.values.length;var x_values=[];var y_values=[];for(var i=0;i<values_length;i++){if(value_format==value_formats.SINGLE){if(config.LIMIT_X[0]&&data.values[i].value<config.LIMIT_X[0]){gChart.f_arm(data.values,i);i--;values_length--;continue};if(config.LIMIT_X[1]&&data.values[i].value>config.LIMIT_X[1]){gChart.f_arm(data.values,i);i--;values_length--;continue};x_values.push(data.values[i].value)};if(value_format==value_formats.DOUBLE){if(config.LIMIT_X[0]&&data.values[i].value[0]<config.LIMIT_X[0]){gChart.f_arm(data.values,i);i--;values_length--;continue};if(config.LIMIT_X[1]&&data.values[i].value[0]>config.LIMIT_X[1]){gChart.f_arm(data.values,i);i--;values_length--;continue};if(config.LIMIT_Y[0]&&data.values[i].value[1]<config.LIMIT_Y[0]){gChart.f_arm(data.values,i);i--;values_length--;continue};if(config.LIMIT_Y[1]&&data.values[i].value[1]>config.LIMIT_Y[1]){gChart.f_arm(data.values,i);i--;values_length--;continue};x_values.push(data.values[i].value[0]);y_values.push(data.values[i].value[1])}};if(values_length<1){gChart.log('Wyci\u0119te dane, sprawdĽ limity');gChart.error.call(gChart.error.IDIOT_SETTINGS|gChart.error.IDIOT_DATA);paper.remove();return false};var settings=config.CHARTS_SETTINGS[type];var max_label_width=0;var labels_length=data.labels.length;var label_height=0;var label=paper.text(10,10,'¦').attr({'font-family':settings.LABEL_FONT_FAMILY,'font-size':settings.LABEL_FONT_SIZE,'fill':settings.LABEL_FONT_COLOR,'text-anchor':'start'});label_height=label.getBBox().height;for(var i=0;i<labels_length;i++){var found=false;data.labels[i].values=[];data.labels[i].extra_values=[];for(var j=0;j<values_length;j++){if(data.labels[i].xx==data.values[j].label_xx){if(found&&value_format==value_formats.SINGLE){gChart.f_arm(data.values,j);gChart.f_arm(x_values,j);values_length--;j--;continue};label.attr({text:''+data.labels[i].name});if(label.getBBox().width>max_label_width)max_label_width=label.getBBox().width;data.labels[i].values.push(data.values[j].value);data.labels[i].extra_values.push(data.values[j].extra_value);found=true}};if(!found){gChart.f_arm(data.labels,i);i--;labels_length--}};label.remove();if(labels_length<1){gChart.log('Nie ma labeli pod kt\u00f3re mog\u0119 podczepi\u0107 warto¶ci');gChart.error.call(gChart.error.IDIOT_DATA);paper.remove();return false};var min_x=config.LIMIT_X[0]?config.LIMIT_X[0]:Math.min.apply(Math,x_values);var max_x=config.LIMIT_X[1]?config.LIMIT_X[1]:Math.max.apply(Math,x_values);var min_y=false;var max_y=false;if(y_values.length>0){var min_y=config.LIMIT_Y[0]?config.LIMIT_Y[0]:Math.min.apply(Math,y_values);var max_y=config.LIMIT_Y[1]?config.LIMIT_Y[1]:Math.max.apply(Math,y_values)};var dates_format={HOURS:'H:i',DAYS:'d.m.Y',MONTHS:'m.Y',YEARS:'Y'};var date_format=dates_format.YEARS;if(x_value_type==value_types.DATE){if(max_x-min_x<31536000000){date_format=dates_format.MONTHS};if(max_x-min_x<2678400000){date_format=dates_format.DAYS};if(max_x-min_x<86400000){date_format=dates_format.HOURS}};var grid_label=paper.text(10,10,x_value_type==value_types.DATE?''+gChart.date(date_format,min_x):''+min_x).attr({'font-family':config.GRID_SETTINGS.LABEL_FONT_FAMILY,'font-size':config.GRID_SETTINGS.LABEL_FONT_SIZE,'fill':config.GRID_SETTINGS.LABEL_FONT_COLOR,'text-anchor':'start'});config.GRID_SETTINGS.LABEL_HEIGHT=grid_label.getBBox().height;config.GRID_SETTINGS.MIN_X_LABEL_WIDTH=grid_label.getBBox().width;grid_label.attr({text:x_value_type==value_types.DATE?''+gChart.date(date_format,max_x):''+max_x});config.GRID_SETTINGS.MAX_X_LABEL_WIDTH=grid_label.getBBox().width;if(value_format==value_formats.DOUBLE){grid_label.attr({text:''+min_y});config.GRID_SETTINGS.MIN_Y_LABEL_WIDTH=grid_label.getBBox().width;grid_label.attr({text:''+max_y});config.GRID_SETTINGS.MAX_Y_LABEL_WIDTH=grid_label.getBBox().width};grid_label.remove();var max_value_width=0;var value_height=0;if(value_format==value_formats.SINGLE){var value=paper.text(10,10,''+data.values[0].value+data.unit).attr({'font-family':settings.VALUE_FONT_FAMILY,'font-size':settings.VALUE_FONT_SIZE,'fill':settings.VALUE_FONT_COLOR,'text-anchor':'start'});value_height=value.getBBox().height;for(var i=1;i<values_length;i++){value.attr({text:''+data.values[i].value+data.unit});if(value.getBBox().width>max_value_width)max_value_width=value.getBBox().width};value.remove()};gChart.cloud.init();switch(type){case gChartTypes.BAR_HORIZONTAL:min_x=0;if(max_x==0)max_x=1;var max_height=_end_y-_start_y-config.GRID_SETTINGS.LABEL_HEIGHT-config.GRID_SETTINGS.AXE_0_WIDTH;var _bar_h=settings.DEFAULT_BAR_HEIGHT;var _bar_s=settings.DEFAULT_SPACE_BETWEEN_BARS;var estimated_height=config.SIZE[0]>300?(_bar_h+_bar_s)*labels_length:(_bar_h+_bar_s+label_height)*labels_length;if(estimated_height>max_height){estimated_height-=(_bar_s-settings.MIN_SPACE_BETWEEN_BARS)*labels_length;_bar_s=settings.MIN_SPACE_BETWEEN_BARS;if(estimated_height>max_height){estimated_height-=(_bar_h-settings.MIN_BAR_HEIGHT)*labels_length;_bar_h=settings.MIN_BAR_HEIGHT;if(estimated_height>max_height){for(var i=0;i<labels_length;i++){data.labels.pop();labels_length--;i--;estimated_height-=config.SIZE[0]>300?(_bar_h+_bar_s):(_bar_h+_bar_s+label_height);if(estimated_height<=max_height)break}}else{_bar_h+=(max_height-estimated_height)/labels_length;estimated_height+=(_bar_h-settings.MIN_BAR_HEIGHT)*labels_length}}else{_bar_s+=(max_height-estimated_height)/labels_length;estimated_height+=(_bar_s-settings.MIN_SPACE_BETWEEN_BARS)*labels_length}};if(labels_length<1){gChart.log('Nie zmieszcze niczego na wykresie');gChart.error.call(gChart.error.IDIOT_SETTINGS|gChart.error.IDIOT_DATA);paper.remove();return false};var max_bar_width=_end_x-_start_x-max_label_width-settings.LABEL_MARGIN[1]-settings.LABEL_MARGIN[3]-_bar_h-config.GRID_SETTINGS.AXE_0_WIDTH-max_value_width-settings.VALUE_MARGIN[1]-settings.VALUE_MARGIN[3];max_bar_width+=(config.SIZE[0]>300?0:max_label_width+settings.LABEL_MARGIN[1]+settings.LABEL_MARGIN[3]);if(estimated_height<max_height){_start_y+=(max_height-estimated_height)/2};var graphics={labels:[],images:[],values:[],bars:[]};var _lVMLc=gChart.mode=='VML'?settings.IE_LABEL_POSITION_CORRECTION:[0,0];for(var i=0;i<labels_length;i++){var lbl=data.labels[i].name;var img=data.labels[i].image;var col=data.labels[i].color;var val=data.labels[i].values[0];var ex_val=data.labels[i].extra_values[0];var _dx=0;var _dy=0;if(config.SIZE[0]<=300){graphics.labels.push(paper.text(_start_x+_dx,i*(_bar_h+_bar_s+label_height)+_start_y+_dy+_lVMLc[1]+0.5*label_height-1,lbl).attr({'font-family':settings.LABEL_FONT_FAMILY,'font-size':settings.LABEL_FONT_SIZE,'fill':settings.LABEL_FONT_COLOR,'text-anchor':'start','stroke':settings.LABEL_FONT_COLOR,'stroke-width':gChart.mode=='VML'?0.1:0}));_dx=0;_dy=label_height}else{graphics.labels.push(paper.text(_start_x+settings.LABEL_MARGIN[3]+_dx,i*(_bar_h+_bar_s)+_start_y+_dy+_lVMLc[1]+0.5*label_height+0.5*(_bar_h-label_height),lbl).attr({'font-family':settings.LABEL_FONT_FAMILY,'font-size':settings.LABEL_FONT_SIZE,'fill':settings.LABEL_FONT_COLOR,'text-anchor':'start','stroke':settings.LABEL_FONT_COLOR,'stroke-width':gChart.mode=='VML'?0.1:0}));_dx=settings.LABEL_MARGIN[3]+max_label_width+settings.LABEL_MARGIN[1];_dy=0;var _lw=graphics.labels[i].getBBox().width;if(_lw<max_label_width){graphics.labels[i].attr({'x':start_x+settings.LABEL_MARGIN[3]+max_label_width-_lw})}};if(img){var _im_re=/(gif|jpg|png)$/i;var _im_f=_im_re.exec(img);if(_im_f){graphics.images.push(paper.image(img,_start_x+_dx,i*(_bar_h+_bar_s+_dy)+_start_y+_dy,_bar_h,_bar_h))}else{graphics.images.push(null)}};_dx+=_bar_h+config.GRID_SETTINGS.AXE_0_WIDTH;graphics.bars.push(paper.rect(_start_x+_dx,i*(_bar_h+_bar_s+_dy)+_start_y+_dy,(max_bar_width/max_x)*val,_bar_h).attr({'fill':col,'stroke':'none'}));_dx+=(max_bar_width/max_x)*val+settings.VALUE_MARGIN[3];graphics.values.push(paper.text(_start_x+_dx,i*(_bar_h+_bar_s+_dy)+_start_y+_dy+0.5*value_height+0.5*(_bar_h-value_height),''+val+data.unit).attr({'font-family':settings.VALUE_FONT_FAMILY,'font-size':settings.VALUE_FONT_SIZE,'fill':settings.VALUE_FONT_COLOR,'text-anchor':'start'}));graphics.bars[i].kolor=col;graphics.bars[i].extra_v=ex_val;graphics.bars[i].label=graphics.labels[i];graphics.bars[i].hover(function(e){if(gChart.mode=='VML'){this.attr({fill:gChart.f_ghc(this.kolor)});this.label.attr({'stroke-width':0.4})}else{this.animate({fill:gChart.f_ghc(this.kolor)},150);this.label.animate({'stroke-width':0.3},150)};if(this.extra_v){gChart.cloud.show(e,'<span class="extra">'+this.extra_v+'</span>')}},function(e){if(gChart.mode=='VML'){this.attr({fill:this.kolor});this.label.attr({'stroke-width':0.1})}else{this.animate({fill:this.kolor},150);this.label.animate({'stroke-width':0},150)};gChart.cloud.hide()});graphics.bars[i].mousemove(function(e){gChart.cloud.move(e)});graphics.labels[i].bar=graphics.bars[i];graphics.labels[i].hover(function(e){if(gChart.mode=='VML'){this.attr({'stroke-width':0.4});this.bar.attr({fill:gChart.f_ghc(this.bar.kolor)})}else{this.animate({'stroke-width':0.3},150);this.bar.animate({fill:gChart.f_ghc(this.bar.kolor)},150)}},function(e){if(gChart.mode=='VML'){this.attr({'stroke-width':0.1});this.bar.attr({fill:this.bar.kolor})}else{this.animate({'stroke-width':0},150);this.bar.animate({fill:this.bar.kolor},150)}})};var _gx=config.SIZE[0]>300?_start_x+settings.LABEL_MARGIN[3]+max_label_width+settings.LABEL_MARGIN[1]+_bar_h:_start_x+_bar_h;gChart.draw.grid(paper,config,_gx,end_y,_end_x-_gx-max_value_width-settings.VALUE_MARGIN[1]-settings.VALUE_MARGIN[3],end_y-start_y,min_x,max_x,false,false,false);break;case gChartTypes.BAR_VERTICAL:min_y=0;if(max_x==0)max_x=1;max_y=max_x;legend_width=max_label_width+config.LEGEND_PADDING[1]+config.LEGEND_PADDING[3]+2*config.LEGEND_BORDER_WIDTH;legend_width+=settings.SHOW_LABEL_MARK?settings.LABEL_MARK_SIZE+10:0;legend_height=config.LEGEND_PADDING[0]+config.LEGEND_PADDING[2]+2*config.LEGEND_BORDER_WIDTH-settings.LABEL_MARGIN[2]+(label_height+settings.LABEL_MARGIN[2])*labels_length;if(config.LEGEND_SIDE){if(config.SIZE[0]>300){end_x-=legend_width;_end_x-=legend_width}else{end_y-=legend_height;_end_y-=legend_height}};_start_x+=config.GRID_SETTINGS.MAX_X_LABEL_WIDTH;if(end_x-start_x<=0||end_y-start_y<=0||_end_x-_start_x<=0||_end_y-_start_y<=0){gChart.log('Za ma\u0142y rozmiar');gChart.error.call(gChart.error.IDIOT_SETTINGS);paper.remove();return false};var max_width=_end_x-_start_x;var _bar_w=settings.DEFAULT_BAR_WIDTH;var _bar_s=settings.DEFAULT_SPACE_BETWEEN_BARS;var estimated_width=(_bar_w+_bar_s)*labels_length;if(estimated_width>max_width){estimated_width-=(_bar_s-settings.MIN_SPACE_BETWEEN_BARS)*labels_length;_bar_s=settings.MIN_SPACE_BETWEEN_BARS;if(estimated_width>max_width){estimated_width-=(_bar_w-settings.MIN_BAR_WIDTH)*labels_length;_bar_w=settings.MIN_BAR_WIDTH;if(estimated_width>max_width){for(var i=0;i<values_length;i++){data.labels.pop();labels_length--;i--;legend_height-=label_height+settings.LABEL_MARGIN[2];if(config.LEGEND_SIDE&&config.SIZE[0]<=300){end_y+=label_height+settings.LABEL_MARGIN[2];_end_y+=label_height+settings.LABEL_MARGIN[2]};estimated_width-=_bar_w+_bar_s;if(estimated_width<max_width)break}}else{_bar_w+=(max_width-estimated_width)/labels_length;estimated_width+=(_bar_w-settings.MIN_BAR_WIDTH)*labels_length}}else{_bar_s+=(max_width-estimated_width)/values_length;estimated_width+=(_bar_s-settings.MIN_SPACE_BETWEEN_BARS)*labels_length}};if(labels_length<1){gChart.log('Nie zmieszcze niczego na wykresie');gChart.error.call(gChart.error.IDIOT_SETTINGS|gChart.error.IDIOT_DATA);paper.remove();return false};var max_bar_height=_end_y-_start_y-_bar_w-config.GRID_SETTINGS.AXE_0_WIDTH-settings.VALUE_MARGIN[2]-value_height;if(estimated_width<max_width){_start_x+=(max_width-estimated_width)/2};var graphics={legend:null,labels:[],images:[],values:[],bars:[]};var _lVMLc=gChart.mode=='VML'?settings.IE_LABEL_POSITION_CORRECTION:[0,0];var _lx=config.LEGEND_SIDE?config.SIZE[0]>300?end_x:start_x:start_x+config.LEGEND_POSITION[0];var _ly=config.LEGEND_SIDE?config.SIZE[0]>300?start_y:end_y:start_y+config.LEGEND_POSITION[1];graphics.legend=paper.rect(_lx,_ly,legend_width,legend_height).attr({'fill':config.LEGEND_BACKGROUND_COLOR,'stroke':config.LEGEND_BORDER_COLOR,'stroke-width':config.LEGEND_SIDE?0:config.LEGEND_BORDER_WIDTH,'stroke-dasharray':config.LEGEND_BORDER_DASH}).toFront();for(var i=0;i<labels_length;i++){var lbl=data.labels[i].name;var img=data.labels[i].image;var col=data.labels[i].color;var val=data.labels[i].values[0];var ex_val=data.labels[i].extra_values[0];var _dx=0;var _dy=0;var _lset=paper.set();if(settings.SHOW_LABEL_MARK){_lset.push(paper.rect(_lx+config.LEGEND_PADDING[3],i*(label_height+settings.LABEL_MARGIN[2])+_ly+config.LEGEND_PADDING[0]+0.5*(label_height-settings.LABEL_MARK_SIZE),settings.LABEL_MARK_SIZE,settings.LABEL_MARK_SIZE).attr({'fill':col,'stroke':'none'}))};_lset.push(paper.text(settings.SHOW_LABEL_MARK?_lx+config.LEGEND_PADDING[3]+settings.LABEL_MARK_SIZE+10:_lx+config.LEGEND_PADDING[3],i*(label_height+settings.LABEL_MARGIN[2])+_ly+config.LEGEND_PADDING[0]+0.5*label_height+_lVMLc[1],lbl).attr({'font-family':settings.LABEL_FONT_FAMILY,'font-size':settings.LABEL_FONT_SIZE,'fill':settings.LABEL_FONT_COLOR,'text-anchor':'start','stroke':settings.LABEL_FONT_COLOR,'stroke-width':gChart.mode=='VML'?0.1:0}).toFront());graphics.labels.push(_lset);if(img){var _im_re=/(gif|jpg|png)$/i;var _im_f=_im_re.exec(img);if(_im_f){graphics.images.push(paper.image(img,i*(_bar_w+_bar_s)+_start_x+_bar_s,_end_y-_bar_w,_bar_w,_bar_w).toBack())}else{graphics.images.push(null)}};_dy=(_end_y-_bar_w-config.GRID_SETTINGS.AXE_0_WIDTH)-(max_bar_height/max_y)*val;graphics.bars.push(paper.rect(i*(_bar_w+_bar_s)+_start_x+_bar_s,_dy,_bar_w,(max_bar_height/max_y)*val).attr({'fill':col,'stroke':'none'}).toBack());_dy-=settings.VALUE_MARGIN[2]+(value_height/2)-_lVMLc[1];graphics.values.push(paper.text(i*(_bar_w+_bar_s)+_start_x+_bar_s+_bar_w/2,_dy,val+data.unit).attr({'font-family':settings.VALUE_FONT_FAMILY,'font-size':settings.VALUE_FONT_SIZE,'fill':settings.VALUE_FONT_COLOR}).toBack());graphics.bars[i].kolor=col;graphics.bars[i].extra_v=ex_val;graphics.bars[i].label=settings.SHOW_LABEL_MARK?graphics.labels[i][1]:graphics.labels[i][0];graphics.bars[i].mark=settings.SHOW_LABEL_MARK?graphics.labels[i][0]:null;graphics.bars[i].hover(function(e){if(gChart.mode=='VML'){this.attr({fill:gChart.f_ghc(this.kolor)});if(this.mark){this.mark.attr({fill:gChart.f_ghc(this.kolor)})};this.label.attr({'stroke-width':0.4})}else{this.animate({fill:gChart.f_ghc(this.kolor)},150);if(this.mark){this.mark.animate({fill:gChart.f_ghc(this.kolor)},150)};this.label.animate({'stroke-width':0.3},150)};if(this.extra_v){gChart.cloud.show(e,'<span class="extra">'+this.extra_v+'</span>')}},function(e){if(gChart.mode=='VML'){this.attr({fill:this.kolor});if(this.mark){this.mark.attr({fill:this.kolor})};this.label.attr({'stroke-width':0.1})}else{this.animate({fill:this.kolor},150);if(this.mark){this.mark.animate({fill:this.kolor},150)};this.label.animate({'stroke-width':0},150)};gChart.cloud.hide()});graphics.bars[i].mousemove(function(e){gChart.cloud.move(e)});if(settings.SHOW_LABEL_MARK){graphics.labels[i][0].bar=graphics.bars[i];graphics.labels[i][1].bar=graphics.bars[i];graphics.labels[i][0].label=graphics.labels[i][1];graphics.labels[i][1].mark=graphics.labels[i][0];graphics.labels[i][0].hover(function(e){if(gChart.mode=='VML'){this.label.attr({'stroke-width':0.4});this.attr({fill:gChart.f_ghc(this.bar.kolor)});this.bar.attr({fill:gChart.f_ghc(this.bar.kolor)})}else{this.label.animate({'stroke-width':0.3},150);this.animate({fill:gChart.f_ghc(this.bar.kolor)},150);this.bar.animate({fill:gChart.f_ghc(this.bar.kolor)},150)}},function(e){if(gChart.mode=='VML'){this.label.attr({'stroke-width':0.1});this.attr({fill:this.bar.kolor});this.bar.attr({fill:this.bar.kolor})}else{this.label.animate({'stroke-width':0},150);this.animate({fill:this.bar.kolor},150);this.bar.animate({fill:this.bar.kolor},150)}});graphics.labels[i][1].hover(function(e){if(gChart.mode=='VML'){this.attr({'stroke-width':0.4});this.mark.attr({fill:gChart.f_ghc(this.bar.kolor)});this.bar.attr({fill:gChart.f_ghc(this.bar.kolor)})}else{this.animate({'stroke-width':0.3},150);this.mark.animate({fill:gChart.f_ghc(this.bar.kolor)},150);this.bar.animate({fill:gChart.f_ghc(this.bar.kolor)},150)}},function(e){if(gChart.mode=='VML'){this.attr({'stroke-width':0.1});this.mark.attr({fill:this.bar.kolor});this.bar.attr({fill:this.bar.kolor})}else{this.animate({'stroke-width':0},150);this.mark.animate({fill:this.bar.kolor},150);this.bar.animate({fill:this.bar.kolor},150)}})}else{graphics.labels[i][0].bar=graphics.bars[i];graphics.labels[i][0].hover(function(e){if(gChart.mode=='VML'){this.attr({'stroke-width':0.4});this.bar.attr({fill:gChart.f_ghc(this.bar.kolor)})}else{this.animate({'stroke-width':0.3},150);this.bar.animate({fill:gChart.f_ghc(this.bar.kolor)},150)}},function(e){if(gChart.mode=='VML'){this.attr({'stroke-width':0.1});this.bar.attr({fill:this.bar.kolor})}else{this.animate({'stroke-width':0},150);this.bar.animate({fill:this.bar.kolor},150)}})}};gChart.draw.grid(paper,config,start_x,end_y-_bar_w,end_x-start_x,end_y-start_y-_bar_w-settings.VALUE_MARGIN[2]-value_height,false,false,min_y,max_y,false);break;case gChartTypes.LINE:if(min_y>0)min_y=0;legend_width=max_label_width+config.LEGEND_PADDING[1]+config.LEGEND_PADDING[3]+2*config.LEGEND_BORDER_WIDTH;legend_width+=settings.SHOW_LABEL_MARK?2*settings.LABEL_MARK_RADIUS+10:0;legend_height=config.LEGEND_PADDING[0]+config.LEGEND_PADDING[2]+2*config.LEGEND_BORDER_WIDTH-settings.LABEL_MARGIN[2]+(label_height+settings.LABEL_MARGIN[2])*labels_length;if(config.LEGEND_SIDE){if(config.SIZE[0]>300){end_x-=legend_width;_end_x-=legend_width}else{end_y-=legend_height;_end_y-=legend_height}};_start_x+=config.GRID_SETTINGS.MAX_Y_LABEL_WIDTH+config.GRID_SETTINGS.AXE_0_WIDTH+0.5*config.GRID_SETTINGS.MAX_X_LABEL_WIDTH-settings.POINT_RADIUS;_end_x-=settings.POINT_RADIUS+0.5*config.GRID_SETTINGS.MAX_X_LABEL_WIDTH;_start_y+=settings.POINT_RADIUS;_end_y-=config.GRID_SETTINGS.LABEL_HEIGHT+config.GRID_SETTINGS.AXE_0_WIDTH+settings.POINT_RADIUS;var _sx=(_end_x-_start_x)/(max_x-min_x);var _sy=(_end_y-_start_y)/(max_y-min_y);var graphics={legend:null,labels:[],points:[]};var _lVMLc=gChart.mode=='VML'?settings.IE_LABEL_POSITION_CORRECTION:[0,0];var _lx=config.LEGEND_SIDE?config.SIZE[0]>300?end_x:start_x:start_x+config.LEGEND_POSITION[0];var _ly=config.LEGEND_SIDE?config.SIZE[0]>300?start_y:end_y:start_y+config.LEGEND_POSITION[1];graphics.legend=paper.rect(_lx,_ly,legend_width,legend_height).attr({'fill':config.LEGEND_BACKGROUND_COLOR,'stroke':config.LEGEND_BORDER_COLOR,'stroke-width':config.LEGEND_SIDE?0:config.LEGEND_BORDER_WIDTH,'stroke-dasharray':config.LEGEND_BORDER_DASH}).toFront();for(var i=0;i<labels_length;i++){var lbl=data.labels[i].name;var img=data.labels[i].image;var col=data.labels[i].color;var val=data.labels[i].values;var ex_val=data.labels[i].extra_values;var val_len=data.labels[i].values.length;var _lset=paper.set();if(settings.SHOW_LABEL_MARK){_lset.push(paper.circle(_lx+config.LEGEND_PADDING[3]+settings.LABEL_MARK_RADIUS,i*(label_height+settings.LABEL_MARGIN[2])+_ly+config.LEGEND_PADDING[0]+settings.LABEL_MARK_RADIUS+0.15*label_height,settings.LABEL_MARK_RADIUS).attr({'fill':col,'stroke':'none'}))};_lset.push(paper.text(settings.SHOW_LABEL_MARK?_lx+config.LEGEND_PADDING[3]+settings.LABEL_MARK_RADIUS+10:_lx+config.LEGEND_PADDING[3],i*(label_height+settings.LABEL_MARGIN[2])+_ly+config.LEGEND_PADDING[0]+0.5*label_height+_lVMLc[1],lbl).attr({'font-family':settings.LABEL_FONT_FAMILY,'font-size':settings.LABEL_FONT_SIZE,'fill':settings.LABEL_FONT_COLOR,'text-anchor':'start','stroke':settings.LABEL_FONT_COLOR,'stroke-width':gChart.mode=='VML'?0.1:0}).toFront());graphics.labels.push(_lset);graphics.labels[i][0].kolor=col;graphics.labels[i][0].points=[];if(settings.SHOW_LABEL_MARK){graphics.labels[i][1].points=[]};var _path=[];for(var j=0,l=0;j<val_len;j++){var x_val=val[j][0];var y_val=val[j][1];var _point=graphics.points.push(paper.circle(_start_x+_sx*(x_val-min_x),_end_y-_sy*(y_val-min_y),settings.POINT_RADIUS).attr({'fill':col,'stroke':'none'}).toBack());if(l==0){_path.push('M',_start_x+_sx*(x_val-min_x),_end_y-_sy*(y_val-min_y))}else{_path.push('L',_start_x+_sx*(x_val-min_x),_end_y-_sy*(y_val-min_y))};l++;graphics.points[_point-1].kolor=col;graphics.points[_point-1].label=settings.SHOW_LABEL_MARK?graphics.labels[i][1]:graphics.labels[i][0];graphics.points[_point-1].mark=settings.SHOW_LABEL_MARK?graphics.labels[i][0]:null;graphics.points[_point-1].extra_v='<strong>'+lbl+' '+y_val+''+data.unit+'</strong>'+(ex_val[j]?ex_val[j]:'')+'<span class="data">Data: '+gChart.date(date_format,x_val)+'</span>';graphics.points[_point-1].hover(function(e){if(gChart.mode=='VML'){this.attr({fill:gChart.f_ghc(this.kolor)});if(this.mark){this.mark.attr({fill:gChart.f_ghc(this.kolor)})};this.label.attr({'stroke-width':0.4})}else{this.animate({fill:gChart.f_ghc(this.kolor)},150);if(this.mark){this.mark.animate({fill:gChart.f_ghc(this.kolor)},150)};this.label.animate({'stroke-width':0.3},150)};if(this.extra_v){gChart.cloud.show(e,this.extra_v)}},function(e){if(gChart.mode=='VML'){this.attr({fill:this.kolor});if(this.mark){this.mark.attr({fill:this.kolor})};this.label.attr({'stroke-width':0.1})}else{this.animate({fill:this.kolor},150);if(this.mark){this.mark.animate({fill:this.kolor},150)};this.label.animate({'stroke-width':0},150)};gChart.cloud.hide()});graphics.points[_point-1].mousemove(function(e){gChart.cloud.move(e)});if(settings.SHOW_LABEL_MARK){graphics.labels[i][0].points.push(graphics.points[_point-1]);graphics.labels[i][0].label=graphics.labels[i][1];graphics.labels[i][1].points.push(graphics.points[_point-1]);graphics.labels[i][1].mark=graphics.labels[i][0]}else{graphics.labels[i][0].points.push(graphics.points[_point-1])}};if(_path.length>0){var _line=paper.path(_path.join(",")).attr({'stroke':col,'stroke-width':settings.LINE_WIDTH,'stroke-dash':settings.LINE_DASH}).toBack();if(settings.SHOW_LABEL_MARK){graphics.labels[i][0].line=_line;graphics.labels[i][1].line=_line}else{graphics.labels[i][0].line=_line}};if(settings.SHOW_LABEL_MARK){graphics.labels[i][0].hover(function(e){if(gChart.mode=='VML'){this.label.attr({'stroke-width':0.4});this.attr({fill:gChart.f_ghc(this.kolor)});this.line({stroke:gChart.f_ghc(this.kolor)});for(var i=0;i<this.points.length;i++){this.points[i].attr({fill:gChart.f_ghc(this.kolor)})}}else{this.label.animate({'stroke-width':0.3},150);this.animate({fill:gChart.f_ghc(this.kolor)},150);this.line.animate({stroke:gChart.f_ghc(this.kolor)},150);for(var i=0;i<this.points.length;i++){this.points[i].animate({fill:gChart.f_ghc(this.kolor)})}}},function(e){if(gChart.mode=='VML'){this.label.attr({'stroke-width':0.1});this.attr({fill:this.kolor});this.line({stroke:this.kolor});for(var i=0;i<this.points.length;i++){this.points[i].attr({fill:this.kolor})}}else{this.label.animate({'stroke-width':0},150);this.animate({fill:this.kolor},150);this.line.animate({stroke:this.kolor},150);for(var i=0;i<this.points.length;i++){this.points[i].animate({fill:this.kolor})}}});graphics.labels[i][1].hover(function(e){if(gChart.mode=='VML'){this.attr({'stroke-width':0.4});this.mark.attr({fill:gChart.f_ghc(this.mark.kolor)});this.line({stroke:gChart.f_ghc(this.mark.kolor)});for(var i=0;i<this.points.length;i++){this.points[i].attr({fill:gChart.f_ghc(this.mark.kolor)})}}else{this.animate({'stroke-width':0.3},150);this.mark.animate({fill:gChart.f_ghc(this.mark.kolor)},150);this.line.animate({stroke:gChart.f_ghc(this.mark.kolor)},150);for(var i=0;i<this.points.length;i++){this.points[i].animate({fill:gChart.f_ghc(this.mark.kolor)})}}},function(e){if(gChart.mode=='VML'){this.attr({'stroke-width':0.1});this.mark.attr({fill:this.mark.kolor});this.line({stroke:this.mark.kolor});for(var i=0;i<this.points.length;i++){this.points[i].attr({fill:this.mark.kolor})}}else{this.animate({'stroke-width':0},150);this.mark.animate({fill:this.mark.kolor},150);this.line.animate({stroke:this.mark.kolor},150);for(var i=0;i<this.points.length;i++){this.points[i].animate({fill:this.mark.kolor})}}})}else{graphics.labels[i][0].hover(function(e){if(gChart.mode=='VML'){this.attr({'stroke-width':0.4});this.line({stroke:gChart.f_ghc(this.kolor)});for(var i=0;i<this.points.length;i++){this.points[i].attr({fill:gChart.f_ghc(this.kolor)})}}else{this.animate({'stroke-width':0.3},150);this.line.animate({stroke:gChart.f_ghc(this.kolor)},150);for(var i=0;i<this.points.length;i++){this.points[i].animate({fill:gChart.f_ghc(this.kolor)})}}},function(e){if(gChart.mode=='VML'){this.attr({'stroke-width':0.1});this.line({stroke:this.kolor});for(var i=0;i<this.points.length;i++){this.points[i].attr({fill:this.kolor})}}else{this.animate({'stroke-width':0},150);this.line.animate({stroke:this.kolor},150);for(var i=0;i<this.points.length;i++){this.points[i].animate({fill:this.kolor})}}})}};gChart.draw.grid(paper,config,start_x,_end_y,end_x-start_x,_end_y-_start_y,min_x,max_x,min_y,max_y,date_format);break};paper.rect(0,0,config.SIZE[0],config.SIZE[1]).attr({'fill':config.BACKGROUND_COLOR,'stroke':'none'}).toBack()},grid:function(paper,config,x,y,w,h,min_x,max_x,min_y,max_y,date_format){var draw_x=(min_x&&max_x);var draw_y=(min_y&&max_y);if(draw_x!==false){var _sx=(w/(max_x-min_x));var axes_x_length=(w/config.GRID_SETTINGS.DESIRED_SPACE_BETWEEN_X_AXES);var best_match=Math.round((max_x-min_y)/axes_x_length);if(best_match<1)best_match=1;axes_x_length=Math.ceil(w/(best_match*_sx));if(!date_format&&(max_x-min_x)>0&&(min_x-max_x)<0){var t=paper.text(x+0.5*config.GRID_SETTINGS.AXE_0_WIDTH+(0-min_x)*_sx,y,''+0).attr({'font-family':config.GRID_SETTINGS.LABEL_FONT_FAMILY,'font-size':config.GRID_SETTINGS.LABEL_FONT_SIZE,'fill':config.GRID_SETTINGS.LABEL_FONT_COLOR,'text-anchor':'start'}).toBack();t.attr({'x':x+0.5*config.GRID_SETTINGS.AXE_0_WIDTH+(0-min_x)*_sx-t.getBBox().width/2,'y':y-t.getBBox().height/2});var _path="M"+(x+0.5*config.GRID_SETTINGS.AXE_0_WIDTH+(0-min_x)*_sx)+' '+(y-config.GRID_SETTINGS.LABEL_HEIGHT)+'V'+(y-h);paper.path(_path).attr({'stroke':config.GRID_SETTINGS.AXE_0_COLOR,'stroke-width':config.GRID_SETTINGS.AXE_0_WIDTH,'stroke-dash':config.GRID_SETTINGS.AXE_0_DASH}).toBack()};if(!date_format){for(var i=min_x;i<=max_x;i+=best_match){if(i==0)continue;var t=paper.text(x+0.5*config.GRID_SETTINGS.AXES_Y_WIDTH+(i-min_x)*_sx,y,i).attr({'font-family':config.GRID_SETTINGS.LABEL_FONT_FAMILY,'font-size':config.GRID_SETTINGS.LABEL_FONT_SIZE,'fill':config.GRID_SETTINGS.LABEL_FONT_COLOR,'text-anchor':'start'}).toBack();t.attr({'x':x+0.5*config.GRID_SETTINGS.AXES_Y_WIDTH+(i-min_x)*_sx-t.getBBox().width/2,'y':y-t.getBBox().height/2});var _path="M"+(x+0.5*config.GRID_SETTINGS.AXES_Y_WIDTH+(i-min_x)*_sx)+' '+(y-config.GRID_SETTINGS.LABEL_HEIGHT)+'V'+(y-h);paper.path(_path).attr({'stroke':config.GRID_SETTINGS.AXES_Y_COLOR,'stroke-width':config.GRID_SETTINGS.AXES_Y_WIDTH,'stroke-dash':config.GRID_SETTINGS.AXES_Y_DASH}).toBack()}};if(date_format){var _w=w-config.GRID_SETTINGS.MAX_Y_LABEL_WIDTH-config.GRID_SETTINGS.MAX_X_LABEL_WIDTH;var _sx=(_w/(max_x-min_x));var axes_x_length=(_w/config.GRID_SETTINGS.DESIRED_SPACE_BETWEEN_X_AXES);var best_match=(max_x-min_x)/axes_x_length;if(best_match>82800000){best_match+=86500000};if(best_match>2592000000){best_match=2678400000};if(best_match>31449600000){best_match=31536000000};var skip=0;if(config.GRID_SETTINGS.MAX_X_LABEL_WIDTH>config.GRID_SETTINGS.DESIRED_SPACE_BETWEEN_X_AXES)skip=Math.ceil(config.GRID_SETTINGS.MAX_X_LABEL_WIDTH/config.GRID_SETTINGS.DESIRED_SPACE_BETWEEN_X_AXES);axes_x_length=Math.ceil(_w/(best_match*_sx));var t=paper.text(x+config.GRID_SETTINGS.MAX_Y_LABEL_WIDTH,y+config.GRID_SETTINGS.LABEL_HEIGHT,gChart.date(date_format,new Date(min_x))).attr({'font-family':config.GRID_SETTINGS.LABEL_FONT_FAMILY,'font-size':config.GRID_SETTINGS.LABEL_FONT_SIZE,'fill':config.GRID_SETTINGS.LABEL_FONT_COLOR,'text-anchor':'start'}).toBack();var _path="M"+(x+config.GRID_SETTINGS.MAX_Y_LABEL_WIDTH+0.5*config.GRID_SETTINGS.MIN_X_LABEL_WIDTH-0.5*config.GRID_SETTINGS.AXES_Y_WIDTH-2)+' '+(y)+'V'+(y-h);paper.path(_path).attr({'stroke':config.GRID_SETTINGS.AXES_Y_COLOR,'stroke-width':config.GRID_SETTINGS.AXES_Y_WIDTH,'stroke-dash':config.GRID_SETTINGS.AXES_Y_DASH}).toBack();for(var i=min_x,j=0;i<=max_x;i+=best_match,j++){if(skip>0&&j%skip!=0)continue;var t=paper.text(x+config.GRID_SETTINGS.MAX_Y_LABEL_WIDTH+(i-min_x)*_sx,y+config.GRID_SETTINGS.LABEL_HEIGHT,gChart.date(date_format,new Date(i))).attr({'font-family':config.GRID_SETTINGS.LABEL_FONT_FAMILY,'font-size':config.GRID_SETTINGS.LABEL_FONT_SIZE,'fill':config.GRID_SETTINGS.LABEL_FONT_COLOR,'text-anchor':'start'}).toBack();var _path="M"+(x+config.GRID_SETTINGS.MAX_Y_LABEL_WIDTH+0.5*config.GRID_SETTINGS.MIN_X_LABEL_WIDTH-0.5*config.GRID_SETTINGS.AXES_Y_WIDTH-2+(i-min_x)*_sx)+' '+(y)+'V'+(y-h);paper.path(_path).attr({'stroke':config.GRID_SETTINGS.AXES_Y_COLOR,'stroke-width':config.GRID_SETTINGS.AXES_Y_WIDTH,'stroke-dash':config.GRID_SETTINGS.AXES_Y_DASH}).toBack()}}};if(draw_y!==false){var _sy=(h/(max_y-min_y));var axes_y_length=(h/config.GRID_SETTINGS.DESIRED_SPACE_BETWEEN_Y_AXES);var best_match=Math.round((max_y-min_y)/axes_y_length);if(best_match<1)best_match=1;axes_y_length=Math.ceil(h/(best_match*_sy));if((max_y-min_y)>0&&(min_y-max_y)<0){var t=paper.text(x,y-config.GRID_SETTINGS.AXE_0_WIDTH-(0-min_y)*_sy,''+0).attr({'font-family':config.GRID_SETTINGS.LABEL_FONT_FAMILY,'font-size':config.GRID_SETTINGS.LABEL_FONT_SIZE,'fill':config.GRID_SETTINGS.LABEL_FONT_COLOR,'text-anchor':'start'}).toBack();t.attr({'x':x+((date_format?config.GRID_SETTINGS.MAX_Y_LABEL_WIDTH:config.GRID_SETTINGS.MAX_X_LABEL_WIDTH)-t.getBBox().width)});var _path="M"+(x+(date_format?config.GRID_SETTINGS.MAX_Y_LABEL_WIDTH:config.GRID_SETTINGS.MAX_X_LABEL_WIDTH)+2)+' '+(y-0.5*config.GRID_SETTINGS.AXE_0_WIDTH-(0-min_y)*_sy)+'H'+(w);paper.path(_path).attr({'stroke':config.GRID_SETTINGS.AXE_0_COLOR,'stroke-width':config.GRID_SETTINGS.AXE_0_WIDTH,'stroke-dash':config.GRID_SETTINGS.AXE_0_DASH}).toBack()};for(var i=min_y;i<=max_y;i+=best_match){if(i==0)continue;var t=paper.text(x,y-config.GRID_SETTINGS.AXES_X_WIDTH-(i-min_y)*_sy,i).attr({'font-family':config.GRID_SETTINGS.LABEL_FONT_FAMILY,'font-size':config.GRID_SETTINGS.LABEL_FONT_SIZE,'fill':config.GRID_SETTINGS.LABEL_FONT_COLOR,'text-anchor':'start'}).toBack();t.attr({'x':x+((date_format?config.GRID_SETTINGS.MAX_Y_LABEL_WIDTH:config.GRID_SETTINGS.MAX_X_LABEL_WIDTH)-t.getBBox().width)});var _path="M"+(x+(date_format?config.GRID_SETTINGS.MAX_Y_LABEL_WIDTH:config.GRID_SETTINGS.MAX_X_LABEL_WIDTH)+2)+' '+(y-0.5*config.GRID_SETTINGS.AXES_X_WIDTH-(i-min_y)*_sy)+'H'+(w);paper.path(_path).attr({'stroke':config.GRID_SETTINGS.AXES_X_COLOR,'stroke-width':config.GRID_SETTINGS.AXES_X_WIDTH,'stroke-dash':config.GRID_SETTINGS.AXES_X_DASH}).toBack()}}}},error:{callback:null,setCallback:function(callback){gChart.error.callback=callback},call:function(errorCode){if(gChart.error.callback&&typeof gChart.error.callback=='function'){gChart.error.callback(errorCode);return true}else{return false}},NO_RAPHAEL_LIBRARY:0,NO_DATA_GIVEN:1,WRONG_CHART_TYPE:2,NO_CONTAINER_FOR_CHART:4,WRONG_CHART_SIZE:8,IDIOT_SETTINGS:16,IDIOT_DATA:32}};

/*
 * Poll Drawer v 1.1
 * @requires Raphael JavaScript Vector Library && Chart Drawer
 */
var gPoll={debug:false,servlet_uri:'/xml/sondazomat',polls:[],log:function(message){if(window.console&&window.console.log&&gPoll.debug)window.console.log(message)},changeChart:function(e){var el;if(window.event&&window.event.srcElement){el=window.event.srcElement};if(e&&e.target){el=e.target};if(!el){return};(e.preventDefault)?e.preventDefault():(e.returnValue=false);if(gChart.f_trm(el.tagName.toLowerCase())!='a')el=gChart.f_gpbn(el,'a');var chCtr=el.container;if(gChart.f_trm(el.tagName.toLowerCase())!='li')el=gChart.f_gpbn(el,'li');if(el&&!gChart.f_hcl(el,'active')){chCl=gChart.f_trm(el.className);var _act=gChart.f_ss('li.active',chCtr);var _new=gChart.f_ss('li.'+chCl,chCtr);for(var i=0,chl=_new.length;i<chl;i++){gChart.f_rcl(_act[i],'active');gChart.f_acl(_new[i],'active')}}},init:function(options){var poll={};if(!gChart.f_ss('#'+options.id)[0]){gPoll.log('Nie znaleziono elementu, w kt\u00f3rym ma byc umieszczony wykres');gPoll.error.call(gPoll.error.NO_ROOT_ELEMENT,poll);return}else{poll.container=gChart.f_ss('#'+options.id)[0]};if(gChart.f_trm(options.xx)==''||gChart.f_trm(options.types_xx)==''){gPoll.log('Nie podano, jaki sondaz lub typy ma byc narysowany');gPoll.error.call(gPoll.error.NOTHING_TO_ASK,poll);return}else{poll.xx=gChart.f_trm(options.xx);poll.types=gChart.f_trm(options.types_xx).split(',')};if(isNaN(parseInt(options.width))||isNaN(parseInt(options.height))||parseInt(options.width)<=0||parseInt(options.height)<=0){gPoll.log('Rozmar wykresu zostal zle zdefinowany');gPoll.error.call(gPoll.error.NO_CHART_DIMENSIONS,poll);return}else{poll.width=parseInt(options.width);poll.height=parseInt(options.height)};poll.legend_x=parseInt(options.legend_x);poll.legend_y=parseInt(options.legend_y);poll.legend_side=options.legend_side==='tak';var pool_index=gPoll.polls.push(poll)-1;gPoll.polls[pool_index].ajax={xmlHttp:null,init:function(){try{gPoll.polls[pool_index].ajax.xmlHttp=new XMLHttpRequest()}catch(e){try{gPoll.polls[pool_index].ajax.xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{gPoll.polls[pool_index].ajax.xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){return false}}};gPoll.polls[pool_index].ajax.xmlHttp.onreadystatechange=gPoll.polls[pool_index].ajax.checkResponse;gPoll.polls[pool_index].ajax.xmlHttp.open("GET",gPoll.servlet_uri+'?sondaz='+gPoll.polls[pool_index].xx+'&typy='+gPoll.polls[pool_index].types.join(','),true);gPoll.polls[pool_index].ajax.xmlHttp.send(null);return true},checkResponse:function(){if(gPoll.polls[pool_index].ajax.xmlHttp.readyState==4){if(gPoll.polls[pool_index].ajax.xmlHttp.status==200){if(gPoll.polls[pool_index].ajax.xmlHttp.responseText){try{gPoll.polls[pool_index].json=JSON.parse(gPoll.polls[pool_index].ajax.xmlHttp.responseText.replace(/\/\*.*?\*\/\s*$/,''))}catch(e){gPoll.log('Zly format danych');gPoll.error.call(gPoll.error.JSON_DATA_ERROR,gPoll.polls[pool_index])};if(gPoll.polls[pool_index].json)gPoll.parseData(pool_index)}else{gPoll.log('Puste dane');gPoll.error.call(gPoll.error.JSON_DATA_EMPTY,gPoll.polls[pool_index])}}else{gPoll.log('Problem z pobraniem danych');gPoll.error.call(gPoll.error.AJAX_ERROR,gPoll.polls[pool_index])}}}};gPoll.polls[pool_index].ajax.init()},parseData:function(index){var poll=gPoll.polls[index];var _d=new Date();poll.time_start=_d.getTime()/1000;if(poll.json.tytul&&gChart.f_trm(poll.json.tytul)!='')poll.chart_title=gChart.f_trm(poll.json.tytul);if(poll.json.lead_sondazu&&gChart.f_trm(poll.json.lead_sondazu)!='')poll.chart_lead=gChart.f_trm(poll.json.lead_sondazu);if(poll.json.rodzaj_wykresu&&gChart.f_trm(poll.json.rodzaj_wykresu)!=''){for(var i in gChartTypes){if(gChartTypes[i]==poll.json.rodzaj_wykresu)poll.chart_type=gChartTypes[i]};if(!poll.chart_type){gPoll.log('Podano z\u0142y typ wykresu');gPoll.error.call(gPoll.error.WRONG_CHART_TYPE,poll);return}}else{gPoll.log('Typ wykresu nie zosta\u0142 podany');gPoll.error.call(gPoll.error.CHART_TYPE_NOT_DEFINED,poll);return};if(poll.json.link_txt&&gChart.f_trm(poll.json.link_txt)!='')poll.chart_link_text=gChart.f_trm(poll.json.link_txt);if(poll.json.link_url&&gChart.f_trm(poll.json.link_url)!='')poll.chart_link_uri=gChart.f_trm(poll.json.link_url);var _cl=poll.json.pomiary_typow?poll.json.pomiary_typow.length:0;if(_cl<=0){gPoll.log('Brak danych do wykresu');gPoll.error.call(gPoll.error.NO_CHART_DATA,poll);return};var _ptl=poll.types.length;poll.charts=[];for(var i=0;i<_ptl;i++){for(var _i in poll.json.pomiary_typow){if(poll.types[i]==poll.json.pomiary_typow[_i].xx){var _pl=poll.json.pomiary_typow[_i].pomiary?poll.json.pomiary_typow[_i].pomiary.length:0;if(_pl>0){poll.charts[i]={};poll.charts[i].values=[];poll.charts[i].y_values=[];poll.charts[i].dates=[];poll.charts[i].samples=[];poll.charts[i].labels=[];poll.charts[i].items_xx=[];poll.charts[i].pom_items_xx=[];poll.charts[i].extra_values=[];poll.charts[i].source=gChart.f_trm(poll.json.pomiary_typow[_i].zrodlo);poll.charts[i].unit=gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[0].jednostka)?gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[0].jednostka):'';for(var j=0;j<_pl;j++){switch(poll.chart_type){case gChartTypes.BAR_HORIZONTAL:case gChartTypes.BAR_VERTICAL:if(j==_pl-1){poll.charts[i].date=gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].data_pomiaru)?gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].data_pomiaru):'';poll.charts[i].sample=gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].proba)?gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].proba):''};poll.charts[i].dates.push(gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].data_pomiaru)?gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].data_pomiaru):'');poll.charts[i].samples.push(gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].proba)?gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].proba):'');poll.charts[i].values.push(parseFloat(gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].wartosc)));poll.charts[i].extra_values.push(gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].wartosc_ekstra));poll.charts[i].labels.push(gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].rzecz_xx));poll.charts[i].pom_items_xx.push(gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].rzecz_xx));break;case gChartTypes.LINE:poll.charts[i].values.push(gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].data_pomiaru_cala));var _datereg=/(([0-9]{4})-([0-9]{2})-([0-9]{2}) ([0-9]{2})\:([0-9]{2})\:([0-9]{2})\.([0-9]))/;var _date=_datereg.exec(poll.charts[i].values[j]);if(_date){poll.charts[i].values[j]=new Date(parseInt(_date[2],10),parseInt(_date[3],10)-1,parseInt(_date[4],10),parseInt(_date[5],10),parseInt(_date[6],10),parseInt(_date[7],10),parseInt(_date[8],10)*100)};poll.charts[i].y_values.push(parseFloat(gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].wartosc)));poll.charts[i].dates.push(gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].data_pomiaru)?gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].data_pomiaru):'');poll.charts[i].samples.push(gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].proba)?gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].proba):'');poll.charts[i].labels.push(gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].rzecz_xx));poll.charts[i].items_xx.push(gChart.f_trm(poll.json.pomiary_typow[_i].pomiary[j].rzecz_xx));break}};if(poll.charts[i].items_xx.length>0){poll.charts[i].labels=gChart.f_unique(poll.charts[i].labels)};for(var j=0,ll=poll.charts[i].labels.length;j<ll;j++){for(var _j in poll.json.pomiary_typow[_i].rzeczy_legendy){if(poll.charts[i].labels[j]==poll.json.pomiary_typow[_i].rzeczy_legendy[_j].xx){poll.charts[i].labels[j]=poll.json.pomiary_typow[_i].rzeczy_legendy[_j];break}}};break}}};if(typeof(poll.charts[i])=='undefined'){gChart.f_arm(poll.types,i);_ptl--;i--}};poll.container.innerHTML=gPoll.generateHTML(poll);var chs=gChart.f_ss('div.node_switch li a',poll.container);if(chs){for(var i=0,chsl=chs.length;i<chsl;i++){chs[i].container=poll.container;gChart.f_aev(chs[i],'click',gPoll.changeChart)}};if(poll.chart_type==gChartTypes.BAR_HORIZONTAL||poll.chart_type==gChartTypes.BAR_VERTICAL){for(var i=0;i<_ptl;i++){var min_date=0;var max_date=0;var max_date_str='';var dates_length=poll.charts[i].dates.length;for(var j=0;j<dates_length;j++){var _dateA=poll.charts[i].dates[j]?gChart.f_trm(poll.charts[i].dates[j]).split('.'):0;var _date=new Date(_dateA[2],_dateA[1]-1,_dateA[0]);if(max_date==0||min_date>_date)max_min=_date;if(max_date==0||max_date<_date)max_date=_date};if(min_date!=max_date){var _day=max_date.getDate();var _month=max_date.getMonth()+1;if(_day<10){_day='0'+_day};if(_month<10){_month='0'+_month};var _year=max_date.getFullYear();max_date_str=_day+'.'+_month+'.'+_year;for(var j=0;j<dates_length;j++){if(poll.charts[i].dates[j]!=max_date_str){gChart.f_arm(poll.charts[i].dates,j);gChart.f_arm(poll.charts[i].labels,j);gChart.f_arm(poll.charts[i].values,j);dates_length--;j--}}}}};for(var i=0;i<_ptl;i++){var chart_data={};chart_data.labels=[];chart_data.values=[];chart_data.unit=poll.charts[i].unit;var chart_options={};var _ctr=gChart.f_ss('div.node_body li',poll.container)[i];var labels_length=poll.charts[i].labels.length;var values_length=poll.charts[i].values.length;chart_options.CONTAINER=_ctr;chart_options.CHART_TYPE=poll.chart_type;chart_options.SIZE=[poll.width,poll.height];chart_options.LEGEND_SIDE=poll.legend_side;chart_options.LEGEND_POSITION=[poll.legend_x,poll.legend_y];for(var j=0;j<labels_length;j++){if(poll.chart_type==gChartTypes.BAR_HORIZONTAL||poll.chart_type==gChartTypes.BAR_VERTICAL){var l={'xx':poll.charts[i].labels[j].xx,'name':poll.charts[i].labels[j].nazwa,'color':poll.charts[i].labels[j].kolor,'image':poll.charts[i].labels[j].foto};chart_data.labels.push(l)};if(poll.chart_type==gChartTypes.LINE){var l={'xx':poll.charts[i].labels[j].xx,'name':poll.charts[i].labels[j].nazwa,'color':poll.charts[i].labels[j].kolor,'image':poll.charts[i].labels[j].foto};chart_data.labels.push(l)}};for(var j=0;j<values_length;j++){if(poll.chart_type==gChartTypes.BAR_HORIZONTAL||poll.chart_type==gChartTypes.BAR_VERTICAL){var d={'label_xx':poll.charts[i].pom_items_xx[j],'value':poll.charts[i].values[j],'extra_value':poll.charts[i].extra_values[j]};chart_data.values.push(d)};if(poll.chart_type==gChartTypes.LINE){var d={'label_xx':poll.charts[i].items_xx[j],'value':[poll.charts[i].values[j],poll.charts[i].y_values[j]],'extra_value':'<span class="source">\u017br\u00f3d\u0142o: '+poll.charts[i].source+'</span>'};chart_data.values.push(d)}};if(!gChart.init(chart_options,chart_data)){gPoll.log('Jaki¶ b\u0142ad w gchart');gPoll.error.call(gPoll.error.GCHART_ERROR,poll);return}};var _d=new Date();poll.time_end=_d.getTime()/1000;poll.generating_time=''+(poll.time_end-poll.time_start)+' seconds';if(gPoll.debug){gPoll.log(poll.container.id+' generated in '+(poll.time_end-poll.time_start)+' seconds')}},generateHTML:function(poll){var htm='';if(!gChart.cloud.ready)gChart.cloud.init();var _ptl=poll.types.length;if(_ptl>0){htm+='<div class="mod mod_chart mod_chart_'+poll.chart_type+'" style="width: '+poll.width+'px;"><div class="mod_inner">';if(poll.chart_title)htm+='<div class="node node_head"><div class="node_inner"><h2>'+poll.chart_title+'</h2></div></div>';htm+='<div class="node node_body"><div class="node_inner">';if(poll.chart_lead)htm+='<p>'+poll.chart_lead+'</p>';htm+='<div class="charts"><ul style="width: '+poll.width+'px; height: '+poll.height+'px;">';for(var i=0;i<_ptl;i++){if(i==0)htm+='<li class="active ch_'+i+'"></li>';else htm+='<li class="ch_'+i+'"></li>'};htm+='</ul></div>';htm+='</div></div>';if(_ptl>1){htm+='<div class="node node_switch"><div class="node_inner"><span>Wybierz: </span><ul>';for(var i=0;i<_ptl;i++){if(i==0)htm+='<li class="active ch_'+i+'"><a href="javascript:void(0)">'+poll.charts[i].source+'</a></li>';else htm+='<li class="ch_'+i+'"><a href="javascript:void(0)">'+poll.charts[i].source+'</a></li>'};htm+='</ul>';if(poll.chart_link_text&&poll.chart_link_uri){htm+='<div class="more"><a href="'+poll.chart_link_uri+'">'+poll.chart_link_text+' &raquo;</a></div>'};htm+="</div></div>"};htm+='<div class="node node_foot"><div class="node_inner"><ul>';for(var i=0;i<_ptl;i++){if(i==0){htm+='<li class="active ch_'+i+'">'}else{htm+='<li class="ch_'+i+'">'};htm+='<span class="source">¬r\u00f3d\u0142o: '+poll.charts[i].source+'</span>';if(poll.charts[i].sample)htm+='<span class="sample">Pr\u00f3ba: '+poll.charts[i].sample+'</span>';if(poll.charts[i].date)htm+='<span class="date">Data: '+poll.charts[i].date+'</span>';htm+='</li>'};htm+='</ul></div></div>';htm+='</div></div>'};return htm},error:{callback:null,setCallback:function(callback){gPoll.error.callback=callback},call:function(errorCode,poll){if(gPoll.error.callback&&typeof gPoll.error.callback=='function'){gPoll.error.callback(errorCode,poll);return true}else{return false}},AJAX_ERROR:1,JSON_DATA_ERROR:2,JSON_DATA_EMPTY:3,NO_CHART_DIMENSIONS:4,NOTHING_TO_ASK:5,NO_ROOT_ELEMENT:6,CHART_TYPE_NOT_DEFINED:7,WRONG_CHART_TYPE:8,NO_CHART_DATA:9,GCHART_ERROR:10}};

gPoll.error.setCallback(function(errCode, poll){
    var _error = null;
         
    if (poll.container) {
        poll.container.innerHTML = '<div class="error" style="visibility: hidden;"><div class="inner"><div><strong>Przepraszamy</strong><p>Serwer nie mo\u017ce teraz pobra\u0107 danych.</p></div></div></div>';
        if(poll.width && poll.height){
            poll.container.style.width = poll.width + 'px';
            poll.container.style.height = poll.height + 'px';   
            _error = gChart.f_ss('.error', poll.container)[0];        
            _mt = (poll.height - _error.offsetHeight) / 2;
            _error.style.marginTop = ( _mt < 0 ? 0 : _mt ) + 'px';
            _error.style.visibility = 'visible'; 
        }
    }
});

$.fn.sanitize_poll = function(options) {
  return this.each(function() {
    var elem = $(this);
    if (elem.find('input').length > 0) 
      $.fn.sanitize_poll.before(elem, options);
    else
      $.fn.sanitize_poll.after(elem, options);
    options.callback();
  });
}

$.fn.sanitize_poll.before = function(elem, options) {
  var elemp = elem;
  elem = elem.find('form').eq(0);
  elem.find('input[type=image]').remove();
  var id = elem.attr('id');
  var title = '<strong>'+elem.find('b').eq(0).html()+'</strong>';

  var hid = elem.find('input[type=hidden]');
  var hids = [];
  hid.each(function() {
    var e = $(this);
    hids.push('<input type="hidden" name="'+e.attr('name')+'" value="'+e.attr('value')+'" />');
  });
  hids.push('<input type="hidden" name="glosuj.x" value="1" />');
  hids.push('<input type="hidden" name="glosuj.y" value="1" />');

  var htm = elem.html().split(/<[iI][nN][pP][uU][tT][^>]+odpowiedz[^>]*>/)
  var htm_l = htm.length;
  var thtm = '';
  var opts = [];
  for (var i = 1; i < htm_l; i++) {
    var j = i - 1;
    var inhtm = '<input type="radio" name="odpowiedz" value="'+j+'" id="'+id+'_opt_'+j+'" />';
    inhtm += '<label for="'+id+'_opt_'+j+'">'+htm[i].split('<br').shift()+'</label>';
    opts.push(inhtm);
  }

  var outhtm = '<fieldset>';
  outhtm += title;
  outhtm += hids.join('');
  outhtm += '<ul><li>';
  outhtm += opts.join('</li><li>');
  outhtm += '</li></ul>';
  outhtm += '<div><input type="image" src="'+options.img_src+'" alt="'+options.img_alt+'" /></div>';
  outhtm += '</fieldset>';

  elemp.addClass(options.class_vote);
 
  elem.html(outhtm);
}

$.fn.sanitize_poll.after = function(elem, options) {
  var ob = elem.find('b');
  var ob_l = ob.length;
  var title = '<strong>'+ob.eq(0).html()+'</strong>';
  var votes = '<p>'+options.all_votes+' <strong>'+ob.eq(ob_l - 1).html()+'</strong></p>';
  var perc = [];

  for (var i = 1; i < ob_l - 1; i++) {
    perc.push(ob.eq(i).html());
  }

  var imgs = [];
  var img_m = elem.html().match(/<[iI][mM][gG][^>]+>/g);
  for (var i = 0; i < img_m.length; i++) {
    var img_w = parseInt(img_m[i].match(/width([^ ]+)/)[1].match(/[0-9]+/).pop());
    imgs.push('<span style="width:'+img_w+'px;"></span>');
  }

  elem.find('b,span').remove();
  var tmpary = elem.html().split(/<[bB][rR][^>]*>/);
  var captions = [];
  var tmpary_l = tmpary.length;
  var thtm = '';
  for (var i = 1; i < tmpary_l; i++) {
    var cpt = $.trim(tmpary[i]);
    if (cpt != '') captions.push(cpt);
  }

  var elems = [];
  var elems_l = perc.length;
  for (var i = 0; i < elems_l; i++) {
    elems.push('<em>'+perc[i]+'</em>'+imgs[i]+'<p>'+captions[i]+'</p>');
  }

  var outhtm = title;
  outhtm += '<ul><li>';
  outhtm += elems.join('</li><li>');
  outhtm += '</li></ul>';
  outhtm += votes;

  elem.addClass(options.class_results);
  elem.html(outhtm);
}

$(document).ready(function() {
	// sondaz
	  if ($('.SONwrp2').length > 0)
		$('.SONwrp2').sanitize_poll({
		  img_src: 'http://bi.gazeta.pl/i/obrazki/wysokieobcasy/glosuj.gif', 
		  img_alt: 'głosuj', 
		  class_vote: 'voting',
		  class_results: 'results',
		  all_votes: 'Liczba oddanych głosów:',
		  callback: function() { $('.SONwrp2').css({ display: 'block' }); }
		});
	$('img.SONimg').prependTo($('.SONwrp fieldset'));
	$('.SONwrp').prepend("<h2>Sondaż</h2>");
	
	// nawigacja
	$('#navH li').gazeta(gfunc.nav, {
		nextClass: 'nextClass',
		prevClass: 'prevClass'
	}); 

 
	// przewijak
    $('.mod_zr_tok4').gazeta(gfunc.gslider, {
		selectors: {
		  bodyOuter: ".node_entries",
		  bodyInner: ".node_inner_entries",
		  bodyElems: ".node_entry",
		  buttonPrev: ".node_prev a",
		  buttonNext: ".node_next a"
		}
   });
   
   //przewijak indeksowy
	$('.indeks_przewijak').prepend('<div class="node_prev"><a href="#"></a></div>');
	$('.indeks_przewijak').append('<div class="node_next"><a href="#"></a></div>');
	$('.indeks_przewijak').gazeta(gfunc.gslider, {
		selectors: {
		  bodyOuter: ".body",
		  bodyInner: ".body ul:first",
		  bodyElems: "li.entry",
		  buttonPrev: ".node_prev a",
		  buttonNext: ".node_next a"
		}
	});
	
	// popup radiowy nad nawigacja
      $('#navtop_wrap .mod_zrRadio .node_he .sluchaj a').click(function(e){
       e.preventDefault();
       var _r = $(this).parents('.mod_zrRadio');
       if(_r.find('.node_bo').css('display') == 'none'){
        _r.find('.node_bo').css({'display': 'block'});
       }else{
        _r.find('.node_bo').css({'display': 'none'});
       }
      });
	$('#navtop_wrap .mod_zrRadio .tubaFM a').click(function(e){
	  e.preventDefault();
	  window.open($(this).attr('href'));
	});

      //breaking news
      $('.mod_zr_breaking_news .close a').click(function(e){
        e.preventDefault();
        $(this).parents('.mod_zr_breaking_news').hide();
      });

       // search
	
	 
    if ($('#navtop_wrap #searchH_sel')) {

     var selOptionsLength = $('#navtop_wrap #searchH_sel option').length;
     
     if(selOptionsLength > 0) {
        
	  var searchHTML = '<div class="searchSel0"><div class="arrow"></div><ul>';

	  //check for active element if not specified get first
	  var activeSearch = $('#navtop_wrap #searchH_sel option').eq(0);
	  if($('#navtop_wrap #searchH_sel option:selected').length > 0){
	   activeSearch =  $('#navtop_wrap #searchH_sel option:selected')
	  }
	  searchHTML += '<li class="selectedVal"><a href="#" class="selectedVal" alt="'+activeSearch.attr("value")+'">'+activeSearch.text()+'</a></li>';

        $('#VE_szukaj_id').each(function(){
         if($.trim($(this).val()) != ''){
          $(this).addClass('hasQuery');
         }else{
          $(this).removeClass('hasQuery');
         }
        }); 

        $('#VE_szukaj_id').addClass(activeSearch.attr("value"));
	  
	  // loop trough services select and create proprer html
	  for(var i = 0; i < selOptionsLength; i++){
	   var currentOption = $('#navtop_wrap #searchH_sel option').eq(i);
         if(i == 0){
	    searchHTML += '<li class="first '+currentOption.attr("value")+'"><a href="#" class="'+currentOption.attr("value")+'" alt="'+currentOption.attr("value")+'"><span>'+currentOption.text()+'</span></a></li>';
         }else{
          searchHTML += '<li class="'+currentOption.attr("value")+'"><a href="#" class="'+currentOption.attr("value")+'" alt="'+currentOption.attr("value")+'"><span>'+currentOption.text()+'</span></a></li>';
         }
	  }

	  searchHTML += '</ul></div>';

	  //build it
	  $('#searchH .b').wrap('<div class="searchSel">');
	  $('.searchSel').prepend(searchHTML);

	  $('#searchH .searchSel0 .arrow').click( function(){ $('#searchH0').hasClass('searchExpanded') ? $('#searchH0').removeClass('searchExpanded') : $('#searchH0').addClass('searchExpanded') });

	  // change search type after click
	  $('.searchSel0 a').click(function(e){
		e.preventDefault();
		if( $(this).hasClass('selectedVal') ) return;
            $('#VE_szukaj_id').removeClass($('.searchSel0 .selectedVal').attr('alt'));
		$('.searchSel0 .selectedVal').text( $(this).text() );
		$('.searchSel0 .selectedVal').attr( 'alt', $(this).attr('alt') );
		$('.searchSel0 a').removeClass('selected');
		$(this).addClass('selected');
            $('#VE_szukaj_id').addClass($('.searchSel0 .selectedVal').attr('alt'));


		$('#searchH_sel option:selected').attr('selected','');
		$('#searchH_sel option[value='+$(this).attr("alt")+']').attr('selected','selected');
		$('#searchH_sel').change( function(){ searchH.searchH_sel = $(this).find(':selected').attr('value') } );  
		$('#searchH_sel').change();
            $('#searchH0').removeClass('searchExpanded')

	  });

        $('#VE_szukaj_id').focus(function(){
         $(this).addClass('inEdit');
        });

        $('#VE_szukaj_id').blur(function(){
         $(this).removeClass('inEdit');
         if($.trim($(this).val()) != ''){
          $(this).addClass('hasQuery');
         }else{
          $(this).removeClass('hasQuery');
         }
        });

        if( document.activeElement == $('#VE_szukaj_id').get(0) ){
		  $('#VE_szukaj_id').addClass('inEdit');
		}		

	 }
       $('#searchH .searchSel0').css({'display':'block'});
    } 
    /* Z OST. CHWILI */
    dNow = new Date;
    dNow.setHours(dNow.getHours()-1);
    $('.indeks_kafle .entry .when').each(function(){
        var date = $(this).html();
        date = date.split(' ');
        var year = date[0];
        var time = date[1];
        year = year.split('-');
        year[1] = year[1]*1-1;
        time = time.split(':');
        dArt = new Date(year[2],year[1],year[0],time[0],time[1]);
        if (dArt>dNow) $(this).html('Z ostatniej chwili').addClass('whenNew');
    });

});

gazeta_pl.flash_holders_tmp = [];
if (gazeta_pl && gazeta_pl.flash_holders && gazeta_pl.flash_holders.length > 0) {
  for (var i = 0; i < gazeta_pl.flash_holders.length; i++) {
    gazeta_pl.flash_holders_tmp[i] = gazeta_pl.flash_holders[i];
  };
  gazeta_pl.flash_holders = null;
};

$(document).ready(function() {
  // embed flash
  (function() {
    if (gazeta_pl.flash_holders_tmp) {
      var l = gazeta_pl.flash_holders_tmp.length;
      if (l > 0) {
        var params = { wmode: 'opaque', allowScriptAccess: 'always' };
        for (var i = 0; i < l; i++) {
          var fl = gazeta_pl.flash_holders_tmp[i];
          params.flashvars = fl.vars.replace(/&amp;/g, '&');
          if (params.flashvars.match(/allowfullscreen/i)) params.allowFullScreen = true;
          swfobject.embedSWF(fl.url, fl.id, fl.width, fl.height, '9.0.0', '/info/expressInstall.swf', {}, params);
        }
      }
    }
  }());
  
  /* wykresy */
  if (gazeta_pl.chart_holders && (l = gazeta_pl.chart_holders.length)) {
    for (i = 0; i < l; i++) {
      gPoll.init(gazeta_pl.chart_holders[i]); 
    }
  }

  //contact form
    $('.mod_contact_ajax form').submit(function(e){
       e.preventDefault();
       var content = $(this).find('#mod_contact_body').val();
       var email = $(this).find('#mod_contact_email').val();
       var author = $(this).find('#mod_contact_author').val();
       var san = $(this).find('input[name=san]').val();
       var ok = $(this).find('input[name=ok]').val();
       var captcha = null;
       if($(this).find('input[name=captcha]').length!=0) captcha = $(this).find('input[name=captcha]').val();
       //validate
       if(content.length==0 || email.length==0 || author.length==0) {
         $(this).parent().find('.error').html(unescape("Uzupe%u0142nij%20wszystkie%20pola%21")).show();
         $(this).removeClass('noSubmit');
         return;
       }
       if(captcha != null && captcha.length==0) {
         $(this).parent().find('.error').html('Przepisz tekst z obrazka!').show();
         $(this).removeClass('noSubmit');
         return;
       }
       if(!email.match(/^([A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4})$/i)) {
         $(this).parent().find('.error').html(unescape("Poda%u0142e%u015B%20z%u0142y%20adres%20email%21")).show();
         $(this).removeClass('noSubmit');
         return;
       }
       $(this).parent().find('.error').hide();
       $('.mod_contact .mod_response a.back').live('click',function(e){
        $('.mod_contact_ajax form').removeClass('noSubmit');
        e.preventDefault();
        $('.mod_contact_ajax .mod_response').hide();
        $('.mod_contact_ajax .mod_inner').show();
       });
       
       var request = {};
       if(captcha != null) {
           request = {tresc: content, email: email, podpis: author, san: san, ok: ok, captcha: captcha};
       } else {
           request = {tresc: content, email: email, podpis: author, san: san, ok: ok};
       }
       //custom inputs
       if($('input.input').length>0) {
          $('input.input').each(function(){
            request[$(this).attr('name')]=$(this).val();
          });
       }
        $.ajaxSetup({
          contentType: 'application/x-www-form-urlencoded; charset=iso-8859-2'
        }); 
       if(!$(this).hasClass('noSubmit')) {
           $.post(
               $(this).attr('action'),
               request,
               function(data){
                 $('.mod_contact_ajax .mod_inner').hide();
                 $('.mod_contact_ajax').append(data);
               }
            );
       }
       if(!$(this).hasClass('noSubmit')) $(this).addClass('noSubmit');
    });
  
});

 
