function dogodek(elm, tip, fn, ecapture) {
	if (elm.addEventListener) {
		elm.addEventListener(tip, fn, ecapture);
	// "this" ne deluje pri uporabi attachEvent-a
    /*} else if (elm.attachEvent) {
		var d = elm.attachEvent('on' + tip, fn);
		return d;*/
	} else {
		elm['on' + tip] = fn;
	}
}

function init() {
	// nalozimo meni
	var menuImages = $('tablemenu').getElementsByTagName('img');
	for (var i = 0; i < menuImages.length; i++) {
		if (menuImages[i].getAttribute('name')) {
			dogodek(menuImages[i], 'mouseover', slikeover, false);
			dogodek(menuImages[i], 'mouseout', slikeout, false);
			slikaon = menuImages[i].getAttribute('name');
            slikaon = new Image();
            slikaon.src = menuImages[i].src.substr(0,menuImages[i].src.length - 7) + 'on.png';
            slikaoff = new Image();
            slikaoff = menuImages[i].src;
		}
		
	}
}

function slikeover() {
    if (this.src.substr(this.src.length - 6, this.src.length) != 'on.png') {
        var domena = 'http://www.arhitektura-doo.si/';
        this.src = domena + 'images/' + this.getAttribute('name') + '_on.png';
    }
}

function slikeout() {
    if (this.src.substr(this.src.length - 7, this.src.length) != 'off.png') {
        var domena = 'http://www.arhitektura-doo.si/';
        this.src = domena + 'images/' + this.getAttribute('name') + '_off.png';
    }
}

dogodek(window, 'load', init, false);

