function displayLogIn() {
	$("body").append("<div id='login-dialog' class='dialog'></div>");
	$("#login-dialog").dialog({
		bgiframe: true,
		autoOpen: true,
		open: function(event, ui) {
			$("#login-dialog").load("/accounts/login_dialog");
		},
		close: function(event, ui) {
			$("#login-dialog").remove();
		},
		height: 400,
		width: 400,
		modal: true,
		title: 'Login to Rock On'
	});
}

function processLogin(event) {
	
    // get the form that got submited ( the first parrent element of the element that trigger the event)
    var loginForm = $("#login-form")
    // where to submit the form
    var ajaxurl = $(loginForm).attr("action");
    var loginData = $(loginForm).serialize(); // take the form field values before you disable it

    //disable the form elements while beeing processed
   $("#login-form").attr("disabled",true);

    // get the submit button of the form and show an ajax-loader instead
    $("#login-button").attr("value","Logging In...");

 	$.post(ajaxurl, loginData, function(data, textStatus, request) {
        // evaulate the response (get the errors or run the javascript)
		
        //var result = jQuery.parseJSON(data);
		var result = eval('(' + data +')');

        // clean the errors from the previous run 
        $("#login-errors").hide();

        // if there is an OK attribute in the response, run the javascript
        // if not show the errors in the for_fieldname element
        if ( result.OK ){
            eval(result.OK)
        } else {
            $("#login-errors").show();
        	$("#login-form").removeAttr("disabled"); // enable the form
        	$("#login-button").attr("value","Log In"); // remove the ajax-loader
        }
     });
}

function displaySignUp() {

}

