$(document).ready(function() {	
	// do we need to alter the #header_menu
	if(!$('#header_menu').children('li').children('.active').html()){ // no active link found ... go to work!

		// detect the active url section -> 
		var uri = window.location.toString();
		var parts = uri.split('/');
		var check = parts[4];
		
		// special case /forum(s)? at position 3
		if(parts[3].match(/forum[s]?/)){ // looking at forum. activet forum link
			activate('forum');
		}else{ // looking at a normal section. switch on it and activate it.
			var check = parts[4];
			// cant switch(true) { case check.match(/news/): activate('news') break; } appearantly ... have to do it the dumb way!
			if(check.match(/news/)){ activate('news'); }
			else if(check.match(/article/)) { activate('article'); }
			else if(check.match(/video/)){ activate('video'); }
			else if(check.match(/department/)){ activate('department'); }
			else if(check.match(/column/)){ activate('column'); }
		}
	}
	
	// var closeInSec = 30;
	// setTimeout("$('.folding_banner').fadeOut('slow',function(){ $(this).remove()})",(closeInSec * 1000)); // hide all folding banners 30 seconds after they are shown
	
});

function activate(section){
	$('#hm_' + section).addClass('active');
}

function foldBanner(el){
	$(el).parent().parent().fadeOut('slow',function(){ $(this).remove()});
}
