(function(C){var A,B,I,J,K,G,E,D,F,H;A=document.namespaces;has_canvas=document.createElement("canvas");has_canvas=has_canvas&&has_canvas.getContext;if(!(has_canvas||A)){C.fn.maphilight=function(){return this};return }if(has_canvas){E=function(M,N,L){if(N<=1){M.style.opacity=N;window.setTimeout(E,10,M,N+0.1,10)}};D=function(L){return Math.max(0,Math.min(parseInt(L,16),255))};F=function(L,M){return"rgba("+D(L.substr(0,2))+","+D(L.substr(2,2))+","+D(L.substr(4,2))+","+M+")"};B=function(L){var M=C('<canvas style="width:'+L.width+"px;height:"+L.height+'px;"></canvas>').get(0);M.getContext("2d").clearRect(0,0,M.width,M.height);return M};I=function(R,M,L,Q,N){var P,O=R.getContext("2d");O.beginPath();if(M=="rect"){O.rect(L[0],L[1],L[2]-L[0],L[3]-L[1])}else{if(M=="poly"){O.moveTo(L[0],L[1]);for(P=2;P<L.length;P+=2){O.lineTo(L[P],L[P+1])}}else{if(M=="circ"){O.arc(L[0],L[1],L[2],0,Math.PI*2,false)}}}O.closePath();if(Q.fill){O.fillStyle=F(Q.fillColor,Q.fillOpacity);O.fill()}if(Q.stroke){O.strokeStyle=F(Q.strokeColor,Q.strokeOpacity);O.lineWidth=Q.strokeWidth;O.stroke()}if(Q.fade){E(R,0)}};J=function(L,M){L.getContext("2d").clearRect(0,0,L.width,L.height)}}else{document.createStyleSheet().addRule("v\\:*","behavior: url(#default#VML); antialias: true;");document.namespaces.add("v","urn:schemas-microsoft-com:vml");B=function(L){return C('<var style="zoom:1;overflow:hidden;display:block;width:'+L.width+"px;height:"+L.height+'px;"></var>').get(0)};I=function(N,P,S,Q,L){var T,R,M,O;T='<v:fill color="#'+Q.fillColor+'" opacity="'+(Q.fill?Q.fillOpacity:0)+'" />';R=(Q.stroke?'strokeweight="'+Q.strokeWidth+'" stroked="t" strokecolor="#'+Q.strokeColor+'"':'stroked="f"');M='<v:stroke opacity="'+Q.strokeOpacity+'"/>';if(P=="rect"){O=C('<v:rect name="'+L+'" filled="t" '+R+' style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:'+S[0]+"px;top:"+S[1]+"px;width:"+(S[2]-S[0])+"px;height:"+(S[3]-S[1])+'px;"></v:rect>')}else{if(P=="poly"){O=C('<v:shape name="'+L+'" filled="t" '+R+' coordorigin="0,0" coordsize="'+N.width+","+N.height+'" path="m '+S[0]+","+S[1]+" l "+S.join(",")+' x e" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:0px;left:0px;width:'+N.width+"px;height:"+N.height+'px;"></v:shape>')}else{if(P=="circ"){O=C('<v:oval name="'+L+'" filled="t" '+R+' style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:'+(S[0]-S[2])+"px;top:"+(S[1]-S[2])+"px;width:"+(S[2]*2)+"px;height:"+(S[2]*2)+'px;"></v:oval>')}}}O.get(0).innerHTML=T+M;C(N).append(O)};J=function(L){C(L).find("[name=highlighted]").remove()}}K=function(N){var M,L=N.getAttribute("coords").split(",");for(M=0;M<L.length;M++){L[M]=parseFloat(L[M])}return[N.getAttribute("shape").toLowerCase().substr(0,4),L]};H=function(L){if(!L.complete){return false}if(typeof L.naturalWidth!="undefined"&&L.naturalWidth==0){return false}return true};G={position:"absolute",left:0,top:0,padding:0,border:0};C.fn.maphilight=function(L){L=C.extend({},C.fn.maphilight.defaults,L);return this.each(function(){var Q,O,T,N,S,P,U,R;Q=C(this);if(!H(this)){return window.setTimeout(function(){Q.maphilight(L)},200)}T=C.metadata?C.extend({},L,Q.metadata()):L;N=C('map[name="'+Q.attr("usemap").substr(1)+'"]');if(!(Q.is("img")&&Q.attr("usemap")&&N.size()>0)){return }if(Q.hasClass("maphilighted")){var M=Q.parent();Q.insertBefore(M);M.remove()}O=C("<div>").css({display:"block",background:"url("+this.src+")",position:"relative",padding:0,width:this.width,height:this.height});Q.before(O).css("opacity",0).css(G).remove();if(C.browser.msie){Q.css("filter","Alpha(opacity=0)")}O.append(Q);S=B(this);C(S).css(G);S.height=this.height;S.width=this.width;U=function(X){var V,W;W=C.metadata?C.extend({},T,C(this).metadata()):T;if(!W.alwaysOn){V=K(this);I(S,V[0],V[1],W,"highlighted")}};if(T.alwaysOn){C(N).find("area[coords]").each(U)}else{if(C.metadata){C(N).find("area[coords]").each(function(){var V,W;W=C.metadata?C.extend({},T,C(this).metadata()):T;if(W.alwaysOn){if(!P){P=B(Q.get());C(P).css(G);P.width=Q.width();P.height=Q.height();Q.before(P)}V=K(this);if(C.browser.msie){I(S,V[0],V[1],W,"")}else{I(P,V[0],V[1],W,"")}}})}C(N).find("area[coords]").mouseover(U).mouseout(function(V){J(S)})}Q.before(S);Q.addClass("maphilighted")})};C.fn.maphilight.defaults={fill:true,fillColor:"000000",fillOpacity:0.2,stroke:true,strokeColor:"ff0000",strokeOpacity:1,strokeWidth:1,fade:true,alwaysOn:false}})(jQuery);
