function initJQueryFunkyShit()
{
	initTopNavBtnHover();
	initSignInBtn();
	initRegisterBtn();
}

function initTopNavBtnHover()
{
	$('#topBarNav .btn').hover(function(){
		$(this).addClass('hover');
	}, function(){
		$(this).removeClass('hover');
	});
}

function initSignInBtn()
{
	$('#signInTopLink').unbind('click');
	$('#signInTopLink').toggle(showSignInForm, hideSignInForm);
}

function initRegisterBtn()
{
	$('#registerTopLink').unbind('click');
	$('#registerTopLink').toggle(showRegisterForm, hideRegisterForm);
	$('#notAMemberLink').click(triggerRegisterTopLink);
}

function triggerRegisterTopLink() {	$('#registerTopLink').trigger('click'); }
function triggerSignInTopLink() { $('#signInTopLink').trigger('click'); }
function hideRegisterFormThenShowSignInForm()
{ 
	$('#registerFormShell').slideUp('slow', triggerRegisterTopLinkAndShowSignInForm);
	$('#signInTopLink').removeClass('active');
}

function triggerRegisterTopLinkAndShowSignInForm()
{ 
	$('#registerTopLink').trigger('click');
	showSignInForm();
}

function showSignInForm()
{
	if($('#registerTopLink.active').length>0) hideRegisterFormThenShowSignInForm();
	else 
	{
		$('#signInFormShell').show();
		showTopForm();
		$('#signInTopLink').addClass('active');
	}
}

function hideSignInForm()
{
	hideTopForm();
	$('#signInTopLink').removeClass('active');
	$('#signInFormShell').slideUp('slow');
}

function showRegisterForm()
{
	if($('#signInTopLink.active').length>0) triggerSignInTopLink();
	$('#registerFormShell').show();
	showTopForm();
	$('#registerTopLink').addClass('active');
}

function hideRegisterForm()
{
	hideTopForm();
	$('#registerTopLink').removeClass('active');
	$('#registerFormShell').slideUp('slow');
}

function showTopForm()
{
	$('#topBarForm').slideDown("slow");
}

function hideTopForm()
{
	$('#topBarForm').slideUp("slow");
}

function addUnsavedDrawingMsg()
{
	if($('#unsavedDrawingMsg').length<1) 
	{
		var msg = '<div id="unsavedDrawingMsg"><p>';
		msg += 'Sign in or Register to finish saving your drawing.';
		msg += '</p></div>';
		$('#signInFormShell').before(msg);
		$('#topBarForm').addClass('noPaddingTop');
		$('#topBarForm').removeClass('padTop');
	}
}

function addUnsavedDrawingMsgAndShowSignInForm()
{
	addUnsavedDrawingMsg();
	if($('#signInTopLink.active').length<1) triggerSignInTopLink();
}

function addUnsavedDrawingMsgAndShowRegisterForm()
{
	addUnsavedDrawingMsg();
	if($('#registerTopLink.active').length<1) triggerRegisterTopLink();
}

function changeBrowserTitle(newTitle)
{
	document.title = newTitle;
}

