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