//send an ajax request for the line that shows if the user is signed in
function showSignedIn($status)
{
    if(authenticated=="")
	variables="error=1";
    else
	variables="";
    if($status="logged out")
	variables="";
    $.post("php/signedIn.php", variables, function(response){
	    $("div#signedIn").html(response);
	});
}

function sendLoginRequest(parameters)
{
    $.post("php/login.php", parameters, function(response){
	    var data=eval('(' + response + ')');
	    authenticated=data.authenticated;
	    user=data.username;
	    showSignedIn();
	    loadMainPage();
	});

}

//deletes the cookie and logs the user out, refreshing the 'signed in' line when 
//everything goes through.
//also, clears the signups and meeting divs
function logout()
{
    $.post("php/logout.php", function(response){
	    user="";
	    authenticated="";
	    showSignedIn("logged out");
	});
    $('div#meetingsPage').html("");
    $('div#signupsPage').html("");
    $('div#initialMeetingsPage').html("");
}