var img = new Array(); var img2 = new Array(); var img3 = new Array(); var img4 = new Array(); var color = new Array(); color[1] = '#d1a3c7'; color[2] = '#bf90c6'; color[3] = '#9e79ba'; color[4] = '#8264ac'; function replaceBg (obj, i, stat) { var obj2 = document.getElementById('c'+i); if (stat == 0) { obj.style.background = 'url('+img2[i].src+') no-repeat 100% 0'; obj2.style.background = '#0147b1 url('+img[i].src+') no-repeat'; } else { obj.style.background = 'url('+img4[i].src+') no-repeat 100% 0'; obj2.style.background = color[i] + ' url('+img3[i].src+') no-repeat'; } } function preloadMain(root) { for (var i=1; i<=4; i++) { img[i] = new Image(); img[i].src = root + "i/block"+i+"_bg1_hover.gif"; img2[i] = new Image(); img2[i].src = root + "i/block"+i+"_bg2_hover.jpg"; img3[i] = new Image(); img3[i].src = root + "i/block"+i+"_bg1.gif"; img4[i] = new Image(); img4[i].src = root + "i/block"+i+"_bg2.jpg"; } }