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