var staten = { "al": { clr: 3, sclr: 4, note: '2011 House Bill 103' }, "ak": { clr: 0, sclr: 0, note: '' }, "az": { clr: 0, sclr: 0, note: '' }, "ar": { clr: 2, sclr: 4, note: '2011 House Bill 1444' }, "ca": { clr: 3, sclr: 0, note: '2011 Senate Bill 315' }, "co": { clr: 3, sclr: 0, note: '2011 Senate Bill 196' }, "ct": { clr: 0, sclr: 0, note: '' }, "de": { clr: 0, sclr: 0, note: '' }, "fl": { clr: 4, sclr: 0, note: '' }, "ga": { clr: 2, sclr: 0, note: '2011 Senate Bill 93' }, "hi": { clr: 2, sclr: 4, note: '2011 House Bill 35' }, "id": { clr: 0, sclr: 0, note: '' }, "il": { clr: 4, sclr: 0, note: '' }, "in": { clr: 2, sclr: 0, note: '2011 House Bill 1030' }, "ia": { clr: 4, sclr: 0, note: '' }, "ks": { clr: 2, sclr: 4, note: '2011 House Bill 2098' }, "ky": { clr: 2, sclr: 4, note: '2011 Senate Bill 45' }, "la": { clr: 4, sclr: 0, note: '' }, "me": { clr: 0, sclr: 0, note: '' }, "md": { clr: 0, sclr: 0, note: '' }, "ma": { clr: 0, sclr: 0, note: '' }, "mi": { clr: 4, sclr: 0, note: '' }, "mn": { clr: 0, sclr: 0, note: '' }, "ms": { clr: 1, sclr: 0, note: '2020' }, "mo": { clr: 3, sclr: 4, note: '2011 House Bill 658' }, "mt": { clr: 0, sclr: 0, note: '' }, "ne": { clr: 4, sclr: 0, note: '' }, "nv": { clr: 3, sclr: 0, note: '2011 Senate Bill 203' }, "nh": { clr: 0, sclr: 0, note: '' }, "nj": { clr: 0, sclr: 0, note: '' }, "nm": { clr: 0, sclr: 0, note: '' }, "ny": { clr: 0, sclr: 0, note: '' }, "nc": { clr: 0, sclr: 0, note: '' }, "nd": { clr: 0, sclr: 0, note: '' }, "oh": { clr: 0, sclr: 0, note: '' }, "ok": { clr: 3, sclr: 4, note: '2011 House Bill 1235' }, "or": { clr: 1, sclr: 0, note: '2006' }, "pa": { clr: 0, sclr: 0, note: '' }, "ri": { clr: 0, sclr: 0, note: '' }, "sc": { clr: 4, sclr: 0, note: '' }, "sd": { clr: 0, sclr: 0, note: '' }, "tn": { clr: 3, sclr: 0, note: 'House Bills 181 and 288; Senate Bill 332' }, "tx": { clr: 0, sclr: 0, note: '' }, "ut": { clr: 0, sclr: 0, note: '' }, "vt": { clr: 0, sclr: 0, note: '' }, "va": { clr: 2, sclr: 0, note: '2011 Senate Bill 878' }, "wa": { clr: 4, sclr: 0, note: '' }, "wv": { clr: 2, sclr: 0, note: '2011 House Bill 2946' }, "wi": { clr: 0, sclr: 0, note: '' }, "wy":{ clr: 0, sclr: 0, note: '' } }; var statecolor = new Array(); var statepalette = new Array("#ffffff","#a7b5c5","#6b86a1","#2d5d8e", "#8aa7c7"); var statetimeout = new Array(); var overbox = false; var oversomething = false; var curdraw = 0; var gotnothing = true; $(document).ready(function (){ $(".statekey").click(function () { drawmap($(this).attr('cl')); $(".statekeyon").removeClass('statekeyon').addClass('statekeyoff'); $(this).removeClass('statekeyoff').addClass('statekeyon'); }); drawmap(1); }); function drawmap (cd) { curdraw = cd; $("#mapcontainer").html(''); for(var st in staten){ if(staten[st].clr == cd || staten[st].sclr == cd){ statecolor[st] = cd; } else { statecolor[st] = 0; } } var mywidth = $("#mapcontainer").width(); var myheight = 710; var ratio = 1; if(mywidth != 980){ ratio = mywidth / 980; myheight = Math.floor(mywidth * .65); $("#mapcontainer").css({ 'height': myheight + 'px' }); } var R = Raphael("mapcontainer", mywidth, myheight), attr = { "fill": "#ffffff", "stroke": "#888888", "stroke-opacity": ".8", "stroke-linejoin": "round", "stroke-miterlimit": "4", "stroke-width": "0.75", "stroke-dasharray": "none" }, usRaphael = {}; for (var state in usmap) { usRaphael[state] = R.path(usmap[state]).attr(attr); if(ratio != 1){ usRaphael[state].scale(ratio,ratio,0,0); } usRaphael[state].attr({fill: statepalette[statecolor[state]]}); } for (var state in usRaphael) { (function (st, state) { st[0].style.cursor = "pointer"; $(st[0]).mouseover(function (e) { st.animate({fill: '#ff2400'}, 300); boxon(e.pageX,e.pageY,state) R.safari(); oversomething = true; clearTimeout(statetimeout[state]); }); $(st[0]).mouseout(function () { oversomething = false; statetimeout[state] = setTimeout(function () { st.animate({fill: statepalette[statecolor[state]]}, 300); if(!oversomething) { boxoff(); } }, 200); }); })(usRaphael[state], state); } } function boxon (x,y,statecode){ gotnothing = true; var txt = '' + usmap_longnames[statecode] + ''; if(staten[statecode].clr == 1){ txt += '
+ Has made have made all pseudoephedrine products, such as Sudafed-D and Claritin-D, a prescription-only drug'; if(staten[statecode].note) { txt += ' (' + staten[statecode].note + ')'; } gotnothing = false; } if(staten[statecode].clr == 2){ txt += '
+ Introduced but failed to pass legislation making pseudoephedrine a prescription-only drug'; if(staten[statecode].note) { txt += ' (' + staten[statecode].note + ')'; } gotnothing = false; } if(staten[statecode].clr == 3 || staten[statecode].sclr == 3){ txt += '
+ Pending legislation to make pseudoephedrine a prescription-only drug'; if(staten[statecode].note) { txt += ' (' + staten[statecode].note + ')'; } gotnothing = false; } if(staten[statecode].clr == 4 || staten[statecode].sclr == 4){ txt += '
+ Implemented or plan to implement an electronic tracking system, favored by the pharmaceutical industry, to monitor and potentially block purchases of pseudoephedrine'; gotnothing = false; } $("#mapover").html(txt); boxdetermine(x,y,gotnothing); $("#mapover").show(); overbox = true; } function unobfuscate (txtin){ txtin = txtin.replace(/_/g,' '); var txtout = txtin.charAt(0).toUpperCase() + txtin.slice(1); if(txtout == 'County state'){ txtout = "County & state"; } return txtout; } function boxdetermine (x,y){ var defx = x - 245; var defy = y - 65; if(defy < 350){ defy = y + 10; if(defx < 10){ defx += 230; } } else { if(defx < 200){ defx += 280; } } if(gotnothing){ defy = y - 10; } $("#mapover").css({ 'top': defy + 'px', 'left': defx + 'px' }); } function numfmt (nStr) { nStr += ''; x = nStr.split('.'); x1 = x[0]; x2 = x.length > 1 ? '.' + x[1] : ''; var rgx = /(\d+)(\d{3})/; while (rgx.test(x1)) { x1 = x1.replace(rgx, '$1' + ',' + '$2'); } return x1 + x2; } function boxoff() { $("#mapover").hide(); $("#mapover").unbind('mouseenter'); $("#mapover").unbind('mouseleave'); overbox = false; } $(document).mousemove(function(e){ if(overbox){ boxdetermine(e.pageX,e.pageY); } });