cash_img = new Image(); function preload_images(name,path,count,start) { if (start) count += start - 1; i = (start) ? start : 1; for (; i <= count; i++) { idx = name + i; cash_img[idx] = new Image(); cash_img[idx].src = path + i + '.gif'; on_idx ='on_' + name + i; cash_img[on_idx] = new Image(); cash_img[on_idx].src = path + i + 'a.gif'; } } preload_images('m', 'http://i.domik.net/map/z', 9); preload_images('sm', 'http://i.domik.net/map/z', 4); cash_img['cmd2'] = new Image(); cash_img['cmd2'].src = 'http://i.domik.net/map/zs.gif'; cash_img['on_cmd2'] = new Image(); cash_img['on_cmd2'].src = 'http://i.domik.net/map/zsa.gif'; cash_img['cmd3'] = new Image(); cash_img['cmd3'].src = 'http://i.domik.net/map/zi.gif'; cash_img['on_cmd3'] = new Image(); cash_img['on_cmd3'].src = 'http://i.domik.net/map/zia.gif'; cash_img['cmd4'] = new Image(); cash_img['cmd4'].src = 'http://i.domik.net/map/zo.gif'; cash_img['on_cmd4'] = new Image(); cash_img['on_cmd4'].src = 'http://i.domik.net/map/zoa.gif'; cash_img['cmd5'] = new Image(); cash_img['cmd5'].src = 'http://i.domik.net/map/zc.gif'; cash_img['on_cmd5'] = new Image(); cash_img['on_cmd5'].src = 'http://i.domik.net/map/zca.gif';