window.onload = function () { var R = Raphael("container", 600, 500), attr = { "fill": "#d3d3d3", "stroke": "#fff", "stroke-opacity": "1", "stroke-linejoin": "round", "stroke-miterlimit": "4", "stroke-width": "0.75", "stroke-dasharray": "none", "translation": "0, 10" }, usRaphael = {}; //Draw Map and store Raphael paths for (var state in usMap) { usRaphael[state] = R.path(usMap[state]).attr(attr); } var current = null; //Do Work on Map for (var state in usRaphael) { usRaphael[state].scale(0.6,0.6,0,0), (function (st, state) { st[0].onmouseout = function () { document.getElementById(state).style.display = "none"; // st.toFront(); R.safari(); }; st[0].onmouseover = function () { if (current && current != usMap) { state[current].scale(1,1) } document.getElementById(state).style.display = "block"; // st.toFront(); R.safari(); }; // 2-3.9 if ( state == "ND" || state == "SD" ) { st.attr ("fill", colors.color1), st[0].style.cursor = "pointer"} // 4-5.9 if ( state == "HI" || state == "IA" || state == "KS" || state == "MN" || state == "MT" || state == "NE" || state == "NH" || state == "OK" || state == "UT" || state == "VT" || state == "VA" || state == "WY" ) { st.attr ("fill", colors.color2), st[0].style.cursor = "pointer"} // 6-7.9 if ( state == "AL" || state == "AK" || state == "AR" || state == "CO" || state == "DE" || state == "FL" || state == "ID" || state == "LA" || state == "ME" || state == "MD" || state == "MA" || state == "MO" || state == "NM" || state == "NY" || state == "OH" || state == "PA" || state == "TX" || state == "WA" || state == "WV" || state == "WI" ) { st.attr ("fill", colors.color3), st[0].style.cursor = "pointer"} // 8-9.9 if ( state == "AZ" || state == "CA" || state == "CT" || state == "DC" || state == "GA" || state == "IL" || state == "IN" || state == "KY" || state == "MI" || state == "MS" || state == "NV" || state == "NJ" || state == "NC" || state == "OR" || state == "RI" || state == "SC" || state == "TN" ) { st.attr ("fill", colors.color4), st[0].style.cursor = "pointer"} })(usRaphael[state], state); } more_info = R.text(270, 370, "Hover over a state for more information.").attr({stroke: "none", fill: "#666"}); DCBOX = R.rect(520, 160, 10, 10); DCBOX.attr({stroke: "none", fill: colors.color4}); DCBOX.mouseover(function () {document.getElementById("DC").style.display = "block"; }); DCBOX.mouseout(function () {document.getElementById("DC").style.display = "none";}); //more_info = R.text(270, 370, "Hover over a state for more information."), DC_title = R.text(540, 166, "DC").attr(textattr); };