(function($) { var has_VML, create_canvas_for, add_shape_to, clear_canvas, shape_from_area, canvas_style, fader, hex_to_decimal, css3color, is_image_loaded; has_VML = document.namespaces; has_canvas = document.createElement('canvas'); has_canvas = has_canvas && has_canvas.getContext; if(!(has_canvas || has_VML)) { $.fn.maphilight = function() { return this; }; return; } if(has_canvas) { fader = function(element, opacity, interval) { if(opacity <= 1) { element.style.opacity = opacity; window.setTimeout(fader, 10, element, opacity + 0.1, 10); } }; hex_to_decimal = function(hex) { return Math.max(0, Math.min(parseInt(hex, 16), 255)); }; css3color = function(color, opacity) { return 'rgba('+hex_to_decimal(color.substr(0,2))+','+hex_to_decimal(color.substr(2,2))+','+hex_to_decimal(color.substr(4,2))+','+opacity+')'; }; create_canvas_for = function(img) { var c = $('').get(0); c.getContext("2d").clearRect(0, 0, c.width, c.height); return c; }; add_shape_to = function(canvas, shape, coords, options) { var i, context = canvas.getContext('2d'); context.beginPath(); if(shape == 'rect') { context.rect(coords[0], coords[1], coords[2] - coords[0], coords[3] - coords[1]); } else if(shape == 'poly') { context.moveTo(coords[0], coords[1]); for(i=2; i < coords.length; i+=2) { context.lineTo(coords[i], coords[i+1]); } } else if(shape == 'circ') { context.arc(coords[0], coords[1], coords[2], 0, Math.PI * 2, false); } context.closePath(); if(options.fill) { context.fillStyle = css3color(options.fillColor, options.fillOpacity); context.fill(); } if(options.stroke) { context.strokeStyle = css3color(options.strokeColor, options.strokeOpacity); context.lineWidth = options.strokeWidth; context.stroke(); } if(options.fade) { fader(canvas, 0); } }; clear_canvas = function(canvas, area) { canvas.getContext('2d').clearRect(0, 0, canvas.width,canvas.height); }; } else { if(!document.documentMode || document.documentMode < 8) { document.createStyleSheet().addRule("v\\:*", "behavior: url(#default#VML); antialias: true;"); document.namespaces.add("v", "urn:schemas-microsoft-com:vml"); } // IE 8 else if (document.documentMode && document.documentMode >= 8) { var ss = document.createStyleSheet(); ss.addRule("v\\:shape", "behavior:url(#default#VML); display:inline-block; antialias:true"); ss.addRule("v\\:shape", "behavior:url(#default#VML); display:inline-block; antialias:true"); ss.addRule("v\\:group", "behavior:url(#default#VML); display:inline-block; antialias:true"); ss.addRule("v\\:polyline", "behavior:url(#default#VML); display:inline-block; antialias:true"); ss.addRule("v\\:stroke", "behavior:url(#default#VML); display:inline-block; antialias:true"); ss.addRule("v\\:fill", "behavior:url(#default#VML); display:inline-block; antialias:true"); ss.addRule("v\\:rect", "behavior:url(#default#VML); display:inline-block; antialias:true"); ss.addRule("v\\:oval", "behavior:url(#default#VML); display:inline-block; antialias:true"); } create_canvas_for = function(img) { return $('').get(0); }; add_shape_to = function(canvas, shape, coords, options) { var fill, stroke, opacity, e; fill = ''; stroke = (options.stroke ? 'strokeweight="'+options.strokeWidth+'" stroked="t" strokecolor="#'+options.strokeColor+'"' : 'stroked="f"'); opacity = ''; if(shape == 'rect') { e = $(''); } else if(shape == 'poly') { e = $(''); } else if(shape == 'circ') { e = $(''); } e.get(0).innerHTML = fill+opacity; $(canvas).append(e); }; clear_canvas = function(canvas) { $(canvas).empty(); }; } shape_from_area = function(area) { var i, coords = area.getAttribute('coords').split(','); for (i=0; i < coords.length; i++) { coords[i] = parseFloat(coords[i]); } return [area.getAttribute('shape').toLowerCase().substr(0,4), coords]; }; is_image_loaded = function(img) { if(!img.complete) { return false; } // IE if(typeof img.naturalWidth != "undefined" && img.naturalWidth == 0) { return false; } // Others return true; } canvas_style = { position: 'absolute', left: 0, top: 0, padding: 0, border: 0 }; $.fn.maphilight = function(opts) { opts = $.extend({}, $.fn.maphilight.defaults, opts); return this.each(function() { var img, wrap, options, map, canvas, mouseover; img = $(this); if(!is_image_loaded(this)) { return window.setTimeout(function() { img.maphilight(); }, 200); } options = $.metadata ? $.extend({}, opts, img.metadata()) : opts; map = $('map[name="'+img.attr('usemap').substr(1)+'"]'); if(!(img.is('img') && img.attr('usemap') && map.size() > 0 && !img.hasClass('maphilighted'))) { return; } wrap = $('
').css({display:'block',background:'url('+this.src+')',position:'relative',padding:0,width:this.width,height:this.height}); img.before(wrap).css('opacity', 0).css(canvas_style).remove(); if($.browser.msie) { img.css('filter', 'Alpha(opacity=0)'); } wrap.append(img); canvas = create_canvas_for(this); $(canvas).css(canvas_style); canvas.height = this.height; canvas.width = this.width; mouseover = function(e) { var shape = shape_from_area(this); add_shape_to(canvas, shape[0], shape[1], $.metadata ? $.extend({}, options, $(this).metadata()) : options); }; if(options.alwaysOn) { $(map).find('area[coords]').each(mouseover); } else { $(map).find('area[coords]').mouseover(mouseover).mouseout(function(e) { clear_canvas(canvas); }); } img.before(canvas); // if we put this after, the mouseover events wouldn't fire. img.addClass('maphilighted'); }); }; $.fn.maphilight.defaults = { fill: true, fillColor: '000000', fillOpacity: 0.2, stroke: true, strokeColor: 'ff0000', strokeOpacity: 1, strokeWidth: 1, fade: true, alwaysOn: false }; })(jQuery); $(document).ready(function(){ $.fn.maphilight.defaults = { fill: true, fillColor: '000000', fillOpacity: 0.4, stroke: true, strokeColor: '999999', strokeOpacity: 1, strokeWidth: 2, fade: true, alwaysOn: false } $('.map').maphilight(); $("#mapPopUp area").mouseover(function(e){ // get mouse position var mouseX = e.clientX - 150; var mouseY = e.clientY + 40; $("#divDialog").dialog('destroy'); var html = ''; switch($(this).attr('rel')) { case 'a': html = '

Acoustics

Researches have linked classroom background noise and reverberation time to reading, spelling, behavior, attention and concentration problems. Improved acoustics raises student achievement levels.' break; case 'b': html = '

Artificial Lighting

Incorporating day lighting and artificial lighting systems effectively can save up to 40 % of the districts electrical energy costs.
> More Information ' break; case 'c': html = '

Daylight

Research is consistently finding increased test scores and as much as 20-25% faster progress in correctly day lit environments.
> More Information' break; case 'd': html = '

Facility Planning

Evaluation of the Mechanical and Electrical Systems is a crucial component of any Master Plan. Planning saves costs by identifying proper equipment requirements, project scheduling, and cost efficiencies. See how MSIP standards can be meet.
> More Information' break; case 'e': html = '

Indoor Air Quality

Poor IAQ can cause headaches, fatigue, sinus congestion, coughing, and sneezing; it can promote the spread of airborne infectious diseases. Asthma is the leading cause of school absenteeism. Poor ventilation allows triggers of Asthma to remain. Of special concern is elevated CO2 concentrations that cause drowsiness, sleepiness and lethargy.
> More Information' break case 'f': html = '

Thermal Comfort

Research shows the best learning and assessment scores are recorded in temperatures that range between 68º and 74º.
> More Information' break; } $("#divDialog").html(html); $("#divDialog").css('display','inline'); $("#divDialog").dialog({ close: closeDialogMapPopUp, modal: false, draggable: false, resizable: false, position: [mouseX,mouseY], title: "" }); }); function closeDialogMapPopUp() { $("#divDialog").dialog('destroy'); } });