window.onload = init;
 
function init(){ 
 var a = document.getElementsByTagName("img"); 
 for (i=0; i<a.length; ++i) 
 if(a[i].className=="hoverimg") 
  {
  
   a[i].onmouseover= function() { var pre = new Image(); pre.src=this.src.replace("1","2"); this.src=pre.src; return;}; 
   a[i].onmouseout=function() { var pre = new Image(); pre.src=this.src.replace("2","1"); this.src=pre.src; return;}; 
  }
 }
