// RollOver
$(function () {
    $.rollover = {
        init: function () {
            $('a img,input[type="iamge"]').not('[@src*="_on."]')
                .bind('mouseover', this.over)
                .bind('mouseout',  this.out)
                .each(this.preload);
        },

        over : function () {
            this.setAttribute('src', this.getAttribute('src').replace('_off.', '_on.'));
        },

        out : function () {
            this.setAttribute('src', this.getAttribute('src').replace('_on.', '_off.'));
        },

        preload : function () {
            new Image().src = this.getAttribute('src').replace('_off.', '_on.');
        }
    };

    $.rollover.init();
});


// Highlight
function highlightpage(){
	if(!document.getElementsByTagName) return false;
	if(!document.getElementById) return false;
	if(!document.getElementById("body")) return false;
	var nav = document.getElementById("body");
	var links = nav.getElementsByTagName("a");
	
	for(var i=0; i<links.length; i++){
            var linkurl = links[i].getAttribute("href");
	    var currenturl = window.location.href;
		if(currenturl.indexOf(linkurl) != -1){
		 links[i].className = "selected";		
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", highlightpage, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", highlightpage);
}


//lightbox
$(function() {
	$('.gallery li a').lightBox();
});