function create (obj) { for (i=0; i < obj.length; ++i) { window [obj[i]] = new Image(); window [obj[i]].src = "Images/" + obj[i] + ".gif" } } create (["SoapRed", "SoapGreen", "HomeRed", "HomeGreen"])