// Preload Images
img1 = new Image(16, 16);  
img1.src="http://www.top40.ro/images/modal/spinner.gif";

img2 = new Image(220, 19);  
img2.src="http://www.top40.ro/images/modal/ajax-loader.gif";

$j(document).ready(function(){

$j("#status > form").submit(function(){  

// Hide 'Submit' Button
$j('#submit').hide();

// Show Gif Spinning Rotator
$j('#ajax_loading').show();

// 'this' refers to the current submitted form  
var str = $j(this).serialize();  

    $j.ajax({  
    type: "POST",  
    url: "http://www.top40.ro/actions/do-login.php",  
    data: str,  
    success: function(msg){  
   
 $j("#status").ajaxComplete(function(event, request, settings){  
 
 // Show 'Submit' Button
$j('#submit').show();

// Hide Gif Spinning Rotator
$j('#ajax_loading').hide();  

 if(msg == 'OK') // LOGIN OK?
 {  
 var login_response = '<div id="logged_in"><div style="width: 350px; float: left; margin-left: 70px;"><div style="width: 40px; float: left;"><img style="margin: 10px 0px 10px 0px;" align="absmiddle" src="http://www.top40.ro/images/modal/ajax-loader.gif"></div><div style="margin: 10px 0px 0px 10px; float: right; text-align: left; width: 300px;">Sunteti autentificat cu succes! <br /> Va rugam asteptati...</div></div>';  

$j('a.modalCloseImg').hide();  

$j('#simplemodal-container').css("width","500px");
$j('#simplemodal-container').css("height","120px");
 
 $j(this).html(login_response); 

 setTimeout('go_to_private_page()', 3000);
 }  
 else // ERROR?
 {  
 var login_response = msg;
 $j('#login_response').html(login_response);
 }  
      
 });  
   
 }  
   
  });  

return false;
});

});

function go_to_private_page()
{
window.location = 'http://www.top40.ro/cp.html'; // Members Area
}