//but script behind the body, put id="thebody" on body-tag
var W3CDOM = (document.createElement && document.getElementsByTagName);

var mouseOvers = new Array();
var mouseOuts = new Array();

//window.onload = init;
function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}

addLoadEvent(function() {
    init();
})



function init()
{
	if (!W3CDOM) return;
	//var nav = document.getElementById('thebody'); //body should have an id thebody
	var imgs = document.getElementsByTagName('img');
	for (var i=0;i<imgs.length;i++)
	{
		if (imgs[i].id.indexOf("mo_") == 0) //img should have an id starting with mo_
		{
			imgs[i].onmouseover = mouseGoesOver;
			imgs[i].onmouseout = mouseGoesOut;
			var suffix = imgs[i].src.substring(imgs[i].src.lastIndexOf('.'));
			mouseOuts[i] = new Image();
			mouseOuts[i].src = imgs[i].src;
			mouseOvers[i] = new Image();
			if (imgs[i].src.lastIndexOf("_o")+2 == imgs[i].src.lastIndexOf('.') || imgs[i].src.lastIndexOf("_s")+2 == imgs[i].src.lastIndexOf('.')  )
			{
				mouseOvers[i].src = imgs[i].src.substring(0,imgs[i].src.lastIndexOf('.')-2) + "_o" + suffix;
			}
			else
			{
				mouseOvers[i].src = imgs[i].src.substring(0,imgs[i].src.lastIndexOf('.')) + "_o" + suffix;
			}
			imgs[i].number = i;
		}
	}
}

function mouseGoesOver()
{
	this.src = mouseOvers[this.number].src;
}

function mouseGoesOut()
{
	this.src = mouseOuts[this.number].src;
}