// When DOM is ready
$(document).ready(function(){

// Launch MODAL BOX if the Login Link is clicked
$("#login_link").click(function(){
$('#login_form').modal();
});

// When the form is submitted
$("#status > form").submit(function(){  

// 'this' refers to the current submitted form  
var str = $(this).serialize();  

// -- Start AJAX Call --

$.ajax({  
    type: "POST",
    url: "login.php",  // Send the login info to this page
    data: str,  
    success: function(msg){  
   
$("#status").ajaxComplete(function(event, request, settings){    

if(msg == 'OK') // LOGIN OK?
{  
	window.location = 'login_redirect.php'; 
}else{  
	var login_response = msg;
	$('#login_response').html(login_response);
}  
      
});  
   
}  
   
});  
  
// -- End AJAX Call --

return false;

}); // end submit event

});