$(document).ready(function(){

// latest updates
	$('div.list-box ul.content-list').hide();
	//$('div.list-box ul.content-list:first').show();

	$('div.list-box').each(function() {
		$(this).find('ul.content-list:first').show();
	});
	
// close alert boxes
	$('div.list-box div.content-selector div.inner ul.latest-tab li a').click(function() {
		$(this).parent().parent().parent().parent().parent().find("ul.content-list").hide();
		var type = $(this).attr("title");
		var ul = "ul." + type;
		$(this).parent().parent().parent().parent().parent().find(ul).show();
		return false;
	});

// main navigation
	$("div.top-menu ul li a").click(function() {
		var id = $(this).parent().attr("id");
		if (id == 'home' && $(this).parent().hasClass('selected')) {
			window.location = "/";
		}
		else if (id == 'community') {
			window.location = "http://www.msxbox-world.com/forums/";
		}
		$("div.top-menu ul li").removeClass('selected');
		$("div.top-menu ul li").removeClass('after-selected');
		$(this).parent().addClass('selected');
		$(this).parent().next().addClass('after-selected');
		$("div.sub-menu ul").hide();
		$("div.sub-menu ul").each(function() {
			if($(this).hasClass(id)) {
				$(this).show();
			}
	  	});
		return false;
	});
});
