$(document).ready(function() { 
	
	var options = { 
	//target:        '#output1',   // target element(s) to be updated with server response 
	beforeSubmit:  showRequest,  // pre-submit callback 
	success:       showResponse  // post-submit callback 
    }; 
 
    // bind form using 'ajaxForm' 
    $('#loginForm').ajaxForm(options); 
});
 
 
 

// pre-submit callback 
function showRequest(formData, jqForm, options) { 
    // formData is an array; here we use $.param to convert it to a string to display it 
    // but the form plugin does this for you automatically when it submits the data 
    var queryString = $.param(formData); 
 
    //alert('About to submit: \n\n' + queryString); 
 
    // here we could return false to prevent the form from being submitted; 
    // returning anything other than false will allow the form submit to continue 
    return true; 
} 
 
// post-submit callback 
function showResponse(responseText, statusText)  { 
	if(statusText=='success')
	{
		var numReg = /[0-9]/;
		if(numReg.test(responseText))
		{
			
			
			$("div#loginSection").load("view/login.php");
			$("div#loginSection:hidden:first").show();  
		}else
		{
			$("#errorMsg").html(responseText);
		}
	}
  
} 

function logout()
{
	$.post("member.php?page=logout",{},
		function(data){ 
			
			/*$("div#loginSection").load("view/login.php");
			$("div#loginSection:hidden:first").show();  
			
			$("div#commentLoginPanel").load("view/reply.form.php?id="+postId);
			$("div#commentLoginPanel").show();  */
			window.location.reload();
			});
}