(function(b){function c(){this._settings=[];this._extensions=[];this.regional=[];this.regional[""]={errorLoadingText:"Error loading",notSupportedText:"This browser does not support SVG"};this.local=this.regional[""];this._uuid=new Date().getTime()}var k="svgwrapper";b.extend(c.prototype,{markerClassName:"hasSVG",svgNS:"http://www.w3.org/2000/svg",xlinkNS:"http://www.w3.org/1999/xlink",_wrapperClass:d,_attachSVG:function(l,n){if(b(l).hasClass(this.markerClassName)){return}b(l).addClass(this.markerClassName);try{var m=document.createElementNS(this.svgNS,"svg");m.setAttribute("version","1.1");m.setAttribute("width",l.clientWidth);m.setAttribute("height",l.clientHeight);l.appendChild(m);this._afterLoad(l,m,n)}catch(o){if(b.browser.msie){if(!l.id){l.id="svg"+(this._uuid++)}this._settings[l.id]=n;l.innerHTML='<embed type="image/svg+xml" width="'+l.clientWidth+'" height="'+l.clientHeight+'" src="'+(n.initPath||"")+'blank.svg"/>'}else{l.innerHTML='<p class="svg_error">'+this.local.notSupportedText+"</p>"}}},_registerSVG:function(){for(var n=0;n<document.embeds.length;n++){var l=document.embeds[n].parentNode;if(!b(l).hasClass(this.markerClassName)||b.data(l,k)){continue}var m=null;try{m=document.embeds[n].getSVGDocument()}catch(o){var p=this;setTimeout(function(){p._registerSVG()},250);return}m=(m?m.documentElement:null);if(m){this._afterLoad(l,m)}}},_afterLoad:function(l,m,n){var n=n||this._settings[l.id];this._settings[l.id]=null;var o=new this._wrapperClass(m,l);b.data(l,k,o);if(n.loadURL){o.load(n.loadURL)}if(n.settings){o.configure(n.settings)}if(n.onLoad){n.onLoad.apply(l,[o])}},_getSVG:function(l){l=(typeof l=="string"?b(l)[0]:(l.jquery?l[0]:l));return b.data(l,k)},_destroySVG:function(l){var m=b(l);if(!m.hasClass(this.markerClassName)){return}m.removeClass(this.markerClassName).empty();b.removeData(l,k)},addExtension:function(m,l){this._extensions.push([m,l])}});function d(m,l){this._svg=m;this._container=l;for(var n=0;n<b.svg._extensions.length;n++){var o=b.svg._extensions[n];this[o[0]]=new o[1](this)}}b.extend(d.prototype,{_width:function(){return this._container.clientWidth},_height:function(){return this._container.clientHeight},root:function(){return this._svg},configure:function(p,m){if(m){for(var o=this._svg.attributes.length-1;o>=0;o--){var l=this._svg.attributes.item(o);if(!(l.nodeName=="onload"||l.nodeName=="version"||l.nodeName.substring(0,5)=="xmlns")){this._svg.attributes.removeNamedItem(l.nodeName)}}}for(var n in p){this._svg.setAttribute(n,p[n])}return this},getElementById:function(l){return this._svg.ownerDocument.getElementById(l)},change:function(m,n){if(m){for(var l in n){if(n[l]==null){m.removeAttribute(l)}else{m.setAttribute(l,n[l])}}}return this},_args:function(m,p,l){p.splice(0,0,"parent");p.splice(p.length,0,"settings");var n={};var q=0;if(m[0]!=null&&(typeof m[0]!="object"||!m[0].nodeName)){n.parent=null;q=1}for(var o=0;o<m.length;o++){n[p[o+q]]=m[o]}if(l){b.each(l,function(r,s){if(typeof n[s]=="object"){n.settings=n[s];n[s]=null}})}return n},title:function(n,p,m){var l=this._args(arguments,["text"]);var o=this._makeNode(l.parent,"title",l.settings||{});o.appendChild(this._svg.ownerDocument.createTextNode(l.text));return o},describe:function(n,p,m){var l=this._args(arguments,["text"]);var o=this._makeNode(l.parent,"desc",l.settings||{});o.appendChild(this._svg.ownerDocument.createTextNode(l.text));return o},defs:function(n,o,m){var l=this._args(arguments,["id"],["id"]);return this._makeNode(l.parent,"defs",b.extend((l.id?{id:l.id}:{}),l.settings||{}))},symbol:function(r,s,n,q,l,o,p){var m=this._args(arguments,["id","x1","y1","x2","y2"]);return this._makeNode(m.parent,"symbol",b.extend({id:m.id,viewBox:m.x1+" "+m.y1+" "+m.x2+" "+m.y2},m.settings||{}))},marker:function(r,l,t,s,o,m,p,n){var q=this._args(arguments,["id","refX","refY","mWidth","mHeight","orient"],["orient"]);return this._makeNode(q.parent,"marker",b.extend({id:q.id,refX:q.refX,refY:q.refY,markerWidth:q.mWidth,markerHeight:q.mHeight,orient:q.orient||"auto"},q.settings||{}))},style:function(n,p,m){var l=this._args(arguments,["styles"]);var o=this._makeNode(l.parent,"style",b.extend({type:"text/css"},l.settings||{}));o.appendChild(this._svg.ownerDocument.createTextNode(l.styles));if(b.browser.opera){b("head").append('<style type="text/css">'+l.styles+"</style>")}return o},script:function(p,l,o,n){var m=this._args(arguments,["script","type"],["type"]);var q=this._makeNode(m.parent,"script",b.extend({type:m.type||"text/javascript"},m.settings||{}));q.appendChild(this._svg.ownerDocument.createTextNode(this._escapeXML(m.script)));if(!b.browser.mozilla){b.globalEval(m.script)}return q},linearGradient:function(t,m,u,n,s,l,r,o){var q=this._args(arguments,["id","stops","x1","y1","x2","y2"],["x1"]);var p=b.extend({id:q.id},(q.x1!=null?{x1:q.x1,y1:q.y1,x2:q.x2,y2:q.y2}:{}));return this._gradient(q.parent,"linearGradient",b.extend(p,q.settings||{}),q.stops)},radialGradient:function(v,m,w,s,p,l,q,n,o){var u=this._args(arguments,["id","stops","cx","cy","r","fx","fy"],["cx"]);var t=b.extend({id:u.id},(u.cx!=null?{cx:u.cx,cy:u.cy,r:u.r,fx:u.fx,fy:u.fy}:{}));return this._gradient(u.parent,"radialGradient",b.extend(t,u.settings||{}),u.stops)},_gradient:function(p,l,o,r){var q=this._makeNode(p,l,o);for(var n=0;n<r.length;n++){var m=r[n];this._makeNode(q,"stop",b.extend({offset:m[0],"stop-color":m[1]},(m[2]!=null?{"stop-opacity":m[2]}:{})))}return q},pattern:function(v,l,u,s,m,w,t,r,o,z,n){var q=this._args(arguments,["id","x","y","width","height","vx","vy","vwidth","vheight"],["vx"]);var p=b.extend({id:q.id,x:q.x,y:q.y,width:q.width,height:q.height},(q.vx!=null?{viewBox:q.vx+" "+q.vy+" "+q.vwidth+" "+q.vheight}:{}));return this._makeNode(q.parent,"pattern",b.extend(p,q.settings||{}))},mask:function(q,s,m,r,p,l,o){var n=this._args(arguments,["id","x","y","width","height"]);return this._makeNode(n.parent,"mask",b.extend({id:n.id,x:n.x,y:n.y,width:n.width,height:n.height},n.settings||{}))},createPath:function(){return new h()},createText:function(){return new e()},svg:function(u,t,r,l,v,s,q,n,w,m){var p=this._args(arguments,["x","y","width","height","vx","vy","vwidth","vheight"],["vx"]);var o=b.extend({x:p.x,y:p.y,width:p.width,height:p.height},(p.vx!=null?{viewBox:p.vx+" "+p.vy+" "+p.vwidth+" "+p.vheight}:{}));return this._makeNode(p.parent,"svg",b.extend(o,p.settings||{}))},group:function(n,o,m){var l=this._args(arguments,["id"],["id"]);return this._makeNode(l.parent,"g",b.extend({id:l.id},l.settings||{}))},use:function(s,r,q,l,t,m,o){var p=this._args(arguments,["x","y","width","height","ref"]);if(typeof p.x=="string"){p.ref=p.x;p.settings=p.y;p.x=p.y=p.width=p.height=null}var n=this._makeNode(p.parent,"use",b.extend({x:p.x,y:p.y,width:p.width,height:p.height},p.settings||{}));n.setAttributeNS(b.svg.xlinkNS,"href",p.ref);return n},link:function(n,p,m){var l=this._args(arguments,["ref"]);var o=this._makeNode(l.parent,"a",l.settings);o.setAttributeNS(b.svg.xlinkNS,"href",l.ref);return o},image:function(s,r,q,l,t,m,o){var p=this._args(arguments,["x","y","width","height","ref"]);var n=this._makeNode(p.parent,"image",b.extend({x:p.x,y:p.y,width:p.width,height:p.height},p.settings||{}));n.setAttributeNS(b.svg.xlinkNS,"href",p.ref);return n},path:function(n,o,m){var l=this._args(arguments,["path"]);return this._makeNode(l.parent,"path",b.extend({d:(l.path.path?l.path.path():l.path)},l.settings||{}))},rect:function(s,r,q,n,t,m,l,o){var p=this._args(arguments,["x","y","width","height","rx","ry"],["rx"]);return this._makeNode(p.parent,"rect",b.extend({x:p.x,y:p.y,width:p.width,height:p.height},(p.rx?{rx:p.rx,ry:p.ry}:{}),p.settings||{}))},circle:function(o,l,q,p,n){var m=this._args(arguments,["cx","cy","r"]);return this._makeNode(m.parent,"circle",b.extend({cx:m.cx,cy:m.cy,r:m.r},m.settings||{}))},ellipse:function(o,l,r,q,p,n){var m=this._args(arguments,["cx","cy","rx","ry"]);return this._makeNode(m.parent,"ellipse",b.extend({cx:m.cx,cy:m.cy,rx:m.rx,ry:m.ry},m.settings||{}))},line:function(r,n,q,l,o,p){var m=this._args(arguments,["x1","y1","x2","y2"]);return this._makeNode(m.parent,"line",b.extend({x1:m.x1,y1:m.y1,x2:m.x2,y2:m.y2},m.settings||{}))},polyline:function(o,n,m){var l=this._args(arguments,["points"]);return this._poly(l.parent,"polyline",l.points,l.settings)},polygon:function(o,n,m){var l=this._args(arguments,["points"]);return this._poly(l.parent,"polygon",l.points,l.settings)},_poly:function(p,l,o,n){var q="";for(var m=0;m<o.length;m++){q+=o[m].join()+" "}return this._makeNode(p,l,b.extend({points:b.trim(q)},n||{}))},text:function(o,l,q,p,n){var m=this._args(arguments,["x","y","value"]);if(typeof m.x=="string"&&arguments.length<4){m.value=m.x;m.settings=m.y;m.x=m.y=null}return this._text(m.parent,"text",m.value,b.extend({x:(m.x&&g(m.x)?m.x.join(" "):m.x),y:(m.y&&g(m.y)?m.y.join(" "):m.y)},m.settings||{}))},textpath:function(n,q,p,m){var l=this._args(arguments,["path","value"]);var o=this._text(l.parent,"textPath",l.value,l.settings||{});o.setAttributeNS(b.svg.xlinkNS,"href",l.path);return o},_text:function(t,l,s,p){var o=this._makeNode(t,l,p);if(typeof s=="string"){o.appendChild(o.ownerDocument.createTextNode(s))}else{for(var q=0;q<s._parts.length;q++){var n=s._parts[q];if(n[0]=="tspan"){var m=this._makeNode(o,n[0],n[2]);m.appendChild(o.ownerDocument.createTextNode(n[1]));o.appendChild(m)}else{if(n[0]=="tref"){var m=this._makeNode(o,n[0],n[2]);m.setAttributeNS(b.svg.xlinkNS,"href",n[1]);o.appendChild(m)}else{if(n[0]=="textpath"){var r=b.extend({},n[2]);r.href=null;var m=this._makeNode(o,n[0],r);m.setAttributeNS(b.svg.xlinkNS,"href",n[2].href);m.appendChild(o.ownerDocument.createTextNode(n[1]));o.appendChild(m)}else{o.appendChild(o.ownerDocument.createTextNode(n[1]))}}}}}return o},other:function(o,m,n){var l=this._args(arguments,["name"]);return this._makeNode(l.parent,l.name,l.settings||{})},_makeNode:function(n,l,m){n=n||this._svg;var o=this._svg.ownerDocument.createElementNS(b.svg.svgNS,l);for(var l in m){var p=m[l];if(p!=null&&p!=null&&(typeof p!="string"||p!="")){o.setAttribute(l,p)}}n.appendChild(o);return o},add:function(n,o){var m=this._args(arguments,["node"]);var l=this;m.parent=m.parent||this._svg;m.node=(m.node.jquery?m.node:b(m.node));m.node.each(function(){var p=l._cloneAsSVG(this);if(p){m.parent.appendChild(p)}});return this},_cloneAsSVG:function(o){var n=null;if(o.nodeType==1){n=this._svg.ownerDocument.createElementNS(b.svg.svgNS,this._checkName(o.nodeName));for(var m=0;m<o.attributes.length;m++){var l=o.attributes.item(m);if(l.nodeName!="xmlns"&&l.nodeValue){if(l.prefix=="xlink"){n.setAttributeNS(b.svg.xlinkNS,l.localName,l.nodeValue)}else{n.setAttribute(this._checkName(l.nodeName),l.nodeValue)}}}for(var m=0;m<o.childNodes.length;m++){var q=this._cloneAsSVG(o.childNodes[m]);if(q){n.appendChild(q)}}}else{if(o.nodeType==3){if(b.trim(o.nodeValue)){n=this._svg.ownerDocument.createTextNode(o.nodeValue)}}else{if(o.nodeType==4){if(b.trim(o.nodeValue)){try{n=this._svg.ownerDocument.createCDATASection(o.nodeValue)}catch(p){n=this._svg.ownerDocument.createTextNode(o.nodeValue.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"))}}}}}return n},_checkName:function(l){l=(l.substring(0,1)>="A"&&l.substring(0,1)<="Z"?l.toLowerCase():l);return(l.substring(0,4)=="svg:"?l.substring(4):l)},load:function(m,o){if(typeof o=="boolean"){o={addTo:o}}else{o=o||{}}if(!o.addTo){this.clear(false)}var n=[this._svg.getAttribute("width"),this._svg.getAttribute("height")];var p=this;var l=b.ajax({url:m,dataType:(b.browser.msie?"text":"xml"),success:function(w){if(b.browser.msie){var t=new ActiveXObject("Microsoft.XMLDOM");t.validateOnParse=false;t.resolveExternals=false;t.loadXML(w);if(t.parseError.errorCode!=0){var v=b.svg.local.errorLoadingText+": "+t.parseError.reason;if(o.onLoad){o.onLoad.apply(p._container,[p,v])}else{p.text(null,10,20,v)}return}w=t}var s={};for(var u=0;u<w.documentElement.attributes.length;u++){var q=w.documentElement.attributes.item(u);if(!(q.nodeName=="version"||q.nodeName.substring(0,5)=="xmlns")){s[q.nodeName]=q.nodeValue}}p.configure(s,true);var r=w.documentElement.childNodes;for(var u=0;u<r.length;u++){p.add(null,r[u])}if(!o.changeSize){p.configure({width:n[0],height:n[1]})}if(o.onLoad){o.onLoad.apply(p._container,[p])}},error:function(r,s,q){s=b.svg.local.errorLoadingText+": "+s+(q?" "+q.message:"");if(o.onLoad){o.onLoad.apply(p._container,[p,s])}else{p.text(null,10,20,s)}}});return this},remove:function(l){l.parentNode.removeChild(l);return this},clear:function(l){if(l){this.configure({},true)}while(this._svg.firstChild){this._svg.removeChild(this._svg.firstChild)}return this},toSVG:function(l){l=l||this._svg;return(typeof XMLSerializer=="undefined"?this._toSVG(l):new XMLSerializer().serializeToString(l))},_toSVG:function(o){var n="";if(!o){return n}if(o.nodeType==3){n=o.nodeValue}else{if(o.nodeType==4){n="<![CDATA["+o.nodeValue+"]]>"}else{n="<"+o.nodeName;if(o.attributes){for(var m=0;m<o.attributes.length;m++){var l=o.attributes.item(m);if(!(b.trim(l.nodeValue)==""||l.nodeValue.match(/^\[object/)||l.nodeValue.match(/^function/))){n+=" "+(l.namespaceURI==b.svg.xlinkNS?"xlink:":"")+l.nodeName+'="'+l.nodeValue+'"'}}}if(o.firstChild){n+=">";var p=o.firstChild;while(p){n+=this._toSVG(p);p=p.nextSibling}n+="</"+o.nodeName+">"}else{n+="/>"}}}return n},_escapeXML:function(l){l=l.replace(/&/g,"&amp;");l=l.replace(/</g,"&lt;");l=l.replace(/>/g,"&gt;");return l}});function h(){this._path=""}b.extend(h.prototype,{reset:function(){this._path="";return this},moveTo:function(l,n,m){m=(g(l)?n:m);return this._coords((m?"m":"M"),l,n)},lineTo:function(l,n,m){m=(g(l)?n:m);return this._coords((m?"l":"L"),l,n)},horizTo:function(l,m){this._path+=(m?"h":"H")+(g(l)?l.join(" "):l);return this},vertTo:function(m,l){this._path+=(l?"v":"V")+(g(m)?m.join(" "):m);return this},curveCTo:function(n,p,m,o,l,r,q){q=(g(n)?p:q);return this._coords((q?"c":"C"),n,p,m,o,l,r)},smoothCTo:function(m,n,l,p,o){o=(g(m)?n:o);return this._coords((o?"s":"S"),m,n,l,p)},curveQTo:function(m,n,l,p,o){o=(g(m)?n:o);return this._coords((o?"q":"Q"),m,n,l,p)},smoothQTo:function(l,n,m){m=(g(l)?n:m);return this._coords((m?"t":"T"),l,n)},_coords:function(o,n,t,m,s,l,r){if(g(n)){for(var p=0;p<n.length;p++){var q=n[p];this._path+=(p==0?o:" ")+q[0]+","+q[1]+(q.length<4?"":" "+q[2]+","+q[3]+(q.length<6?"":" "+q[4]+","+q[5]))}}else{this._path+=o+n+","+t+(m==null?"":" "+m+","+s+(l==null?"":" "+l+","+r))}return this},arcTo:function(o,l,r,u,n,t,s,m){m=(g(o)?l:m);this._path+=(m?"a":"A");if(g(o)){for(var p=0;p<o.length;p++){var q=o[p];this._path+=(p==0?"":" ")+q[0]+","+q[1]+" "+q[2]+" "+(q[3]?"1":"0")+","+(q[4]?"1":"0")+" "+q[5]+","+q[6]}}else{this._path+=o+","+l+" "+r+" "+(u?"1":"0")+","+(n?"1":"0")+" "+t+","+s}return this},close:function(){this._path+="z";return this},path:function(){return this._path}});function e(){this._parts=[]}b.extend(e.prototype,{reset:function(){this._parts=[];return this},string:function(l){this._parts[this._parts.length]=["text",l];return this},span:function(m,l){this._parts[this._parts.length]=["tspan",m,l];return this},ref:function(m,l){this._parts[this._parts.length]=["tref",m,l];return this},path:function(n,m,l){this._parts[this._parts.length]=["textpath",m,b.extend({href:n},l||{})];return this}});b.fn.svg=function(m){var l=Array.prototype.slice.call(arguments,1);if(typeof m=="string"&&m=="get"){return b.svg["_"+m+"SVG"].apply(b.svg,[this[0]].concat(l))}return this.each(function(){if(typeof m=="string"){b.svg["_"+m+"SVG"].apply(b.svg,[this].concat(l))}else{b.svg._attachSVG(this,m||{})}})};var f=b.fn.addClass;b.fn.addClass=function(m){m=m||"";var l=function(n,o){return o+(b.inArray(n,o.split(/\s+/))==-1?(o?" ":"")+n:"")};return this.each(function(){if(this.nodeType==1&&this.namespaceURI==b.svg.svgNS){var n=this;b.each(m.split(/\s+/),function(o,p){if(n.className){n.className.baseVal=l(p,n.className.baseVal)}else{n.setAttribute("class",l(p,n.getAttribute("class")))}})}else{f.apply(b(this),[m])}})};var i=b.fn.removeClass;b.fn.removeClass=function(m){m=m||"";var l=function(o,p){p=p.split(/\s+/);var n=b.inArray(o,p);return b.grep(p,function(r,q){return q!=n}).join(" ")};return this.each(function(){if(this.nodeType==1&&this.namespaceURI==b.svg.svgNS){var n=this;b.each(m.split(/\s+/),function(o,p){if(n.className){n.className.baseVal=l(p,n.className.baseVal)}else{n.setAttribute("class",l(p,n.getAttribute("class")))}})}else{i.apply(b(this),[m])}})};var j=b.fn.toggleClass;b.fn.toggleClass=function(l){this[(this.hasClass(l)?"remove":"add")+"Class"](l)};var a=b.fn.hasClass;b.fn.hasClass=function(l){l=l||"";var m=false;this.each(function(){if(this.nodeType==1&&this.namespaceURI==b.svg.svgNS){var n=(this.className?this.className.baseVal:this.getAttribute("class")).split(/\s+/);if(b.inArray(l,n)>-1){m=true}}else{if(a.apply(b(this),[l])){m=true}}return !m});return m};function g(l){return(l&&l.constructor==Array)}b.svg=new c()})(jQuery);
