var thisController = '';

$(document).ready(function()
{
	if (location.pathname == '/') {
		thisController = 'home';
	} else {
		endIndex = location.pathname.indexOf('/', 1);
		
		if (endIndex == -1) {
			thisController = location.pathname.substring(1, location.pathname.length);
		} else {
			thisController = location.pathname.substring(1, endIndex);
		}
	}
	
	$('#' + thisController + '-icon').css('display', 'block');
	$('#' + thisController + '-over').css('display', 'block');
	$('#grey-out').css('height', $('body').outerHeight() + 'px');
	$('#grey-out').click(showHideLogin());
});

function consoleOut(itemName)
{
	if (itemName != thisController) {
		$('#' + itemName + '-over').css('display', 'none');
	}
}

function consoleOver(itemName)
{
	$('#' + itemName + '-over').css('display', 'block');
}

function consoleSearch()
{
	$('#console-search').submit();
}

function showHideLogin()
{
	if ($('#loginbox').css('display') != 'none') {
		$('#loginbox').css('display', 'none');
		$('#login').css('display', 'block');
		$('#signup').css('display', 'none');
		$('#grey-out').css('display', 'none');
	} else {
		$('#loginbox').css('display', 'block');
		$('#grey-out').css('display', 'block');
		$('#grey-out').css('height', $('body').outerHeight() + 'px');
	}
}

function showSignUp()
{
	$('#login').css('display', 'none');
	$('#signup').css('display', 'block');
}


