I'm looking at the source code for this http://raphaeljs.com/australia.html example, and trying to interpret what has been done in order to create a similar project using the RaphaelJS graphics library.
I am, however, confused about part of the code. Specifically, the author uses a parameter "st" in a function inside a for loop, that has not been defined before, while the second parameter "state" has. I'm not sure what I'm missing, but can someone please explain what's going on here? Is this a generic parameter or a call to something specific?
for (var state in aus) {
aus[state].color = Raphael.getColor();
(function (st, state) {
st[0].style.cursor = "pointer";
st[0].onmouseover = function () {
current && aus[current].animate({fill: "#333", stroke: "#666"}, 500) && (document.getElementById(current).style.display = "");
st.animate({fill: st.color, stroke: "#ccc"}, 500);
st.toFront();
R.safari();
document.getElementById(state).style.display = "block";
current = state;
};
st[0].onmouseout = function () {
st.animate({fill: "#333", stroke: "#666"}, 500);
st.toFront();
R.safari();
};
if (state == "nsw") {
st[0].onmouseover();
}
})(aus[state], state);
}