(function() {
var imgArr = ['url(./img/pic_0.png)','url(./img/pic_1.png)','url(./img/pic_2.png)','url(./img/pic_3.png)','url(./img/pic_4.png)'];
var background = ['url(./img/podlojka.png)','url(./img/podlojka_empty.png)']
var red = ['#430606','#cd5d5d'];
var yellow = ['#ffc601','#ff8d06'];
var wallpaper=document.getElementById('wallpaper').style;
function toggle(e) {
var i=this.id.slice(-1);
var type=+((e||window.event).type=='mouseover');
this.style.backgroundImage = background[type];
document.getElementById('under_price'+i).style.color = red[type];
document.getElementById('old_price'+i).style.color = yellow[type];
wallpaper.backgroundImage = imgArr[i-type];
}
for (var i=0;4>i++;) {
var element = document.getElementById('price'+i);
element.onmouseover = element.onmouseout = toggle;
}
})()
Как-то так. Но на самом деле это делается через css классы.