(function(a){var b,c,d,e,f,g,h,i,j,k,l;b=document.namespaces,has_canvas=!!document.createElement("canvas").getContext;if(!has_canvas&&!b){a.fn.maphilight=function(){return this};return}has_canvas?(h=function(a,b,c){b<=1&&(a.style.opacity=b,window.setTimeout(h,10,a,b+.1,10))},i=function(a){return Math.max(0,Math.min(parseInt(a,16),255))},j=function(a,b){return"rgba("+i(a.substr(0,2))+","+i(a.substr(2,2))+","+i(a.substr(4,2))+","+b+")"},c=function(b){var c=a('<canvas style="width:'+b.width+"px;height:"+b.height+'px;"></canvas>').get(0);return c.getContext("2d").clearRect(0,0,c.width,c.height),c},d=function(a,b,c,d,e){var f,g=a.getContext("2d");g.beginPath();if(b=="rect")g.rect(c[0],c[1],c[2]-c[0],c[3]-c[1]);else if(b=="poly"){g.moveTo(c[0],c[1]);for(f=2;f<c.length;f+=2)g.lineTo(c[f],c[f+1])}else b=="circ"&&g.arc(c[0],c[1],c[2],0,Math.PI*2,!1);g.closePath(),d.fill&&(g.fillStyle=j(d.fillColor,d.fillOpacity),g.fill()),d.stroke&&(g.strokeStyle=j(d.strokeColor,d.strokeOpacity),g.lineWidth=d.strokeWidth,g.stroke()),d.fade&&h(a,0)},e=function(a,b){a.getContext("2d").clearRect(0,0,a.width,a.height)}):(c=function(b){return a('<var style="zoom:1;overflow:hidden;display:block;width:'+b.width+"px;height:"+b.height+'px;"></var>').get(0)},d=function(b,c,d,e,f){var g,h,i,j;g='<v:fill color="#'+e.fillColor+'" opacity="'+(e.fill?e.fillOpacity:0)+'" />',h=e.stroke?'strokeweight="'+e.strokeWidth+'" stroked="t" strokecolor="#'+e.strokeColor+'"':'stroked="f"',i='<v:stroke opacity="'+e.strokeOpacity+'"/>',c=="rect"?j=a('<v:rect name="'+f+'" filled="t" '+h+' style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:'+d[0]+"px;top:"+d[1]+"px;width:"+(d[2]-d[0])+"px;height:"+(d[3]-d[1])+'px;"></v:rect>'):c=="poly"?j=a('<v:shape name="'+f+'" filled="t" '+h+' coordorigin="0,0" coordsize="'+b.width+","+b.height+'" path="m '+d[0]+","+d[1]+" l "+d.join(",")+' x e" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:0px;left:0px;width:'+b.width+"px;height:"+b.height+'px;"></v:shape>'):c=="circ"&&(j=a('<v:oval name="'+f+'" filled="t" '+h+' style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:'+(d[0]-d[2])+"px;top:"+(d[1]-d[2])+"px;width:"+d[2]*2+"px;height:"+d[2]*2+'px;"></v:oval>')),j.get(0).innerHTML=g+i,a(b).append(j)},e=function(b){a(b).find("[name=highlighted]").remove()}),f=function(a){var b,c=a.getAttribute("coords").split(",");for(b=0;b<c.length;b++)c[b]=parseFloat(c[b]);return[a.getAttribute("shape").toLowerCase().substr(0,4),c]},l=function(b,c){var d=a(b);return a.extend({},c,a.metadata?d.metadata():!1,d.data("maphilight"))},k=function(a){return a.complete?typeof a.naturalWidth!="undefined"&&a.naturalWidth==0?!1:!0:!1},g={position:"absolute",left:0,top:0,padding:0,border:0};var m=!1;a.fn.maphilight=function(b){b=a.extend({},a.fn.maphilight.defaults,b);if(a.browser.msie&&!m){document.namespaces.add("v","urn:schemas-microsoft-com:vml");var h=document.createStyleSheet(),i=["shape","rect","oval","circ","fill","stroke","imagedata","group","textbox"];a.each(i,function(){h.addRule("v\\:"+this,"behavior: url(#default#VML); antialias:true")}),m=!0}return this.each(function(){var h,i,j,m,n,o,p,q,r;h=a(this);if(!k(this))return window.setTimeout(function(){h.maphilight(b)},200);j=a.extend({},b,a.metadata?h.metadata():!1,h.data("maphilight")),r=h.get(0).getAttribute("usemap"),m=a('map[name="'+r.substr(1)+'"]');if(!(h.is("img")&&r&&m.size()>0))return;if(h.hasClass("maphilighted")){var s=h.parent();h.insertBefore(s),s.remove()}i=a("<div></div>").css({display:"block",background:"url("+this.src+")",position:"relative",padding:0,width:this.width,height:this.height}),j.wrapClass&&(j.wrapClass===!0?i.addClass(a(this).attr("class")):i.addClass(j.wrapClass)),h.before(i).css("opacity",0).css(g).remove(),a.browser.msie&&h.css("filter","Alpha(opacity=0)"),i.append(h),n=c(this),a(n).css(g),n.height=this.height,n.width=this.width,p=function(b){var c,e;e=l(this,j);if(!e.neverOn&&!e.alwaysOn){c=f(this),d(n,c[0],c[1],e,"highlighted");if(e.groupBy&&a(this).attr(e.groupBy)){var g=this;m.find("area["+e.groupBy+"="+a(this).attr(e.groupBy)+"]").each(function(){if(this!=g){var a=l(this,j);if(!a.neverOn&&!a.alwaysOn){var b=f(this);d(n,b[0],b[1],a,"highlighted")}}})}}},j.alwaysOn?a(m).find("area[coords]").each(p):(a(m).find("area[coords]").each(function(){var b,e;e=l(this,j),e.alwaysOn&&(o||(o=c(h.get()),a(o).css(g),o.width=h.width(),o.height=h.height(),h.before(o)),b=f(this),a.browser.msie?d(n,b[0],b[1],e,""):d(o,b[0],b[1],e,""))}),a(m).find("area[coords]").mouseover(p).mouseout(function(a){e(n)})),h.before(n),h.addClass("maphilighted")})},a.fn.maphilight.defaults={fill:!0,fillColor:"000000",fillOpacity:.2,stroke:!0,strokeColor:"ff0000",strokeOpacity:1,strokeWidth:1,fade:!0,alwaysOn:!1,neverOn:!1,groupBy:!1,wrapClass:!0}})(jQuery)
