$(document).ready(function(){
	// Set the active menuitem
	var url_res = window.location.pathname.match(/^\/([0-9a-zA-Z_-]+)/);
	var type = url_res ? url_res[0] : '/home';
		
    // The navigation hover effect
    $('img.nav').each(function() {
		if ($(this).attr('src').indexOf(type.substring(1)) != -1) {
			$(this).attr('src', $(this).attr('src').replace(/\.png/, '_a.png'));
		} else {		
			$(this).mouseover(function() {
				$(this).attr('src', $(this).attr('src').replace(/\.png/, '_a.png'));
			});
			$(this).mouseout(function() {
				$(this).attr('src', $(this).attr('src').replace(/_a\.png/, '.png'));
			});
		}
    });
    
    var c = 0;
    $('#images img').each(function(){
    	$(this).addClass('link_trigger'+c);
    	var u = $(this).parent().attr('href');
    	$('#archiv_overview li a').each(function(){
    		if ($(this).attr('href')==u) { $(this).addClass('link'+c); }
    	});
    	c++;
    	$(this).hover(function(){
    		var n = $(this).attr('class').replace(/link_trigger/,'');
    		$('#archiv_overview .link'+n).addClass('link_hovered');
    	},function(){
    		var n = $(this).attr('class').replace(/link_trigger/,'');
    		$('#archiv_overview .link'+n).removeClass('link_hovered');
    	});
    });
});