(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(Q, M, L, P) { var O, N = Q.getContext("2d"); N.beginPath(); if (M == "rect") { N.rect(L[0], L[1], L[2] - L[0], L[3] - L[1]) } else { if (M == "poly") { N.moveTo(L[0], L[1]); for (O = 2; O < L.length; O += 2) { N.lineTo(L[O], L[O + 1]) } } else { if (M == "circ") { N.arc(L[0], L[1], L[2], 0, Math.PI * 2, false) } } } N.closePath(); if (P.fill) { N.fillStyle = F(P.fillColor, P.fillOpacity); N.fill() } if (P.stroke) { N.strokeStyle = F(P.strokeColor, P.strokeOpacity); N.lineWidth = P.strokeWidth; N.stroke() } if (P.fade) { E(Q, 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");
    document.namespaces.add("v", "urn:schemas-microsoft-com:vml");
    var style = document.createStyleSheet();
    var shapes = ['shape', 'rect', 'oval', 'circ', 'fill', 'stroke', 'imagedata', 'group', 'textbox'];
    $.each(shapes,
    function() {
        style.addRule('v\\:' + this, "behavior: url(#default#VML); antialias:true");
    }
); 

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(P,M,L,O){var R,S,N,Q;R='<v:fill color="#'+O.fillColor+'" opacity="'+(O.fill?O.fillOpacity:0)+'" />';S=(O.stroke?'strokeweight="'+O.strokeWidth+'" stroked="t" strokecolor="#'+O.strokeColor+'"':'stroked="f"');N='<v:stroke opacity="'+O.strokeOpacity+'"/>';if(M=="rect"){Q=C('<v:rect filled="t" '+S+' style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:'+L[0]+"px;top:"+L[1]+"px;width:"+(L[2]-L[0])+"px;height:"+(L[3]-L[1])+'px;"></v:rect>')}else{if(M=="poly"){Q=C('<v:shape filled="t" '+S+' coordorigin="0,0" coordsize="'+P.width+","+P.height+'" path="m '+L[0]+","+L[1]+" l "+L.join(",")+' x e" style="zoom:1;margin:0;padding:0;display:block;position:absolute;top:0px;left:0px;width:'+P.width+"px;height:"+P.height+'px;"></v:shape>')}else{if(M=="circ"){Q=C('<v:oval filled="t" '+S+' style="zoom:1;margin:0;padding:0;display:block;position:absolute;left:'+(L[0]-L[2])+"px;top:"+(L[1]-L[2])+"px;width:"+(L[2]*2)+"px;height:"+(L[2]*2)+'px;"></v:oval>')}}}Q.get(0).innerHTML=R+N;C(P).append(Q)};J=function(L){C(L).empty()}}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 N,Q,P,R,O,M;N=C(this);if(!H(this)){return window.setTimeout(function(){N.maphilight()},200)}P=C.metadata?C.extend({},L,N.metadata()):L;R=C('map[name="'+N.attr("usemap").substr(1)+'"]');if(!(N.is("img")&&N.attr("usemap")&&R.size()>0&&!N.hasClass("maphilighted"))){return }Q=C("<div>").css({display:"block",background:"url("+this.src+")",position:"relative",padding:0,width:this.width,height:this.height});N.before(Q).css("opacity",0).css(G).remove();if(C.browser.msie){N.css("filter","Alpha(opacity=0)")}Q.append(N);O=B(this);C(O).css(G);O.height=this.height;O.width=this.width;M=function(T){var S=K(this);I(O,S[0],S[1],C.metadata?C.extend({},P,C(this).metadata()):P)};if(P.alwaysOn){C(R).find("area[coords]").each(M)}else{C(R).find("area[coords]").mouseover(M).mouseout(function(S){J(O)})}N.before(O);N.addClass("maphilighted")})};C.fn.maphilight.defaults={fill:true,fillColor:"00009f",fillOpacity:0.1,stroke:true,strokeColor:"00ee00",strokeOpacity:0.5,strokeWidth:0.5,fade:true,alwaysOn:false}})(jQuery);
