img1 = new Image(16, 16);  
img1.src="templates/plugmod/images/loader.gif";
img2 = new Image(220, 19);
img2.src="templates/plugmod/images/ajax-loader.gif";

$(document).ready(function(){

$("form").submit(function(){

$('#submit').hide(500);

$('#login_ajax_loading').show(1000);

var str = $(this).serialize();
$.ajax({
    type: "POST",
    url: "login.php",  // Send the login info to this page
    data: str,
    success: function(msg){
$("#status").ajaxComplete(function(event, request, settings){

$('#submit').show(1000);

$('#login_ajax_loading').hide();
 if(msg == 'OK')
 {
 var login_response = '<div><span class="log"><b>You are successfully logged in!<br/>Please wait while you\'re redirected...</b><br/><br/><img src="templates/plugmod/images/loader.gif"></span></div>';
$(this).html(login_response); // Refers to 'status'

setTimeout(go_to_private_page(), 2000);
 }
 else
 {
 var login_response = msg;
 $('#login_response').html('<div class="msg">'+login_response+'</div>');
 }
 });
 }
  });
return false;
}); 
});
function go_to_private_page()
{
    window.location = "index.php";
}
