/**
 * @author Mirosław Bogacz
 */
/**
 * @author Mirosław Bogacz
 * @namespace RovelImg
 * @version 1.0 22-05-2009
 */
var RovelImg = {
    start: function(){
        var e = document.getElementsByTagName('img');
        for (var i = 0; i < e.length; i++) {
            if (e[i].src.match(/(_off.)/gi)) {
				RovelImg.active(e[i])
                RovelImg.over(e[i]);
                RovelImg.out(e[i]);
            }
        }
    },
    over: function(e){
        e.onmouseover = function(){
            this.src = this.src.replace('_off.', '_on.');
        }
    },
    out: function(e){
        e.onmouseout = function(){
			if (e.active == false) {
				this.src = this.src.replace('_on.', '_off.');
			}
        }
    },
	active: function (e) {
		this.href = e.parentNode.href;
		this.location = document.location.href;
		
		if (this.location.match(this.href)) {
			e.active = true;
			e.src = e.src.replace('_off.', '_on.');
		} else {
			e.active = false;
		}
	}
};
$(document).ready(function(){
	if ($('.lightbox')) {
		$('.lightbox').lightBox();
	}
	
	if ($('.Photo-lightBox')) {
		$('.Photo-lightBox').lightBox();
	}
	RovelImg.start();
});
