That's exactly what I was thinking.
// assuming you have an array of windows called "windows"
function focus (element)
{
element = document.getElementById(element);
i = 0;
for (i = 1; i <= windows.length; i++)
{
windows.style.z-index = i;
}
element.style.z-index = i;
} Not tested, but it should work with a couple of inevitable bug fixes.