function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(findimg);


function findimg()
{
 var imgs,i;
// loop through all images of the document
 imgs=document.getElementsByTagName('img');
 for(i=0;i<imgs.length;i++)
 {
// test if the class 'roll' exists
  if(/roll/.test(imgs[i].className))
  {
// add the function roll to the image onmouseover and onmouseout and send
// the image itself as an object
   imgs[i].onmouseover=function(){roll(this);};
   imgs[i].onmouseout=function(){roll(this);};
  }
 }
}


function roll(o){
 var src,ftype,newsrc;
 // get the src of the image, and find out the file extension
 src = o.src;
 ftype = src.substring(src.lastIndexOf('.'), src.length);
 // check if the src already has an _on and delete it, if that is the case 
 if(/_on/.test(src)){
  newsrc = src.replace('_on','');
  }else{
  // else, add the _on to the src 
  newsrc = src.replace(ftype, '_on'+ftype);
  }
 o.src=newsrc;
}


/* highlight function */
function highlight() {
  if (!document.getElementsByTagName) return false;
  if (!document.getElementById) return false;
  if (!document.getElementById("submenu")) return false;
  var nav = document.getElementById("submenu");
  var links = nav.getElementsByTagName("a");
  for (var j=0; j<links.length; j++) {
    var linkurl = links[j].getAttribute("href");
    var currenturl = window.location.href;
    if (currenturl.indexOf(linkurl) != -1) {
      //links[j].classname = "here";
      alert(links[j].src)
    }
  }
}