Ah ok. You got the solution worked out or you still need the loop. Assuming you do, try...
Code:
function expand(id)
{
var layer = document.getElementById(id).style;
if(i != 60)
{
i += 1;
layer.width = i + "%";
}
time = setInterval("expand(" + id + ")", 1000)
}
Without seeing your code I can't be sure whether the parameters of the setInterval is correct.