// Preload Images
img1 = new Image(16, 16);  
img1.src="../img/spinner.gif";

img2 = new Image(220, 19);  
img2.src="../img/ajax-loader.gif";

// When DOM is ready
$(document).ready(function(){

// Launch MODAL BOX if the Login Link is clicked
$("#login_link").click(function(){
$('#login_form').modal();
//$('#simplemodal-container').css("position","relative");
//$('#simplemodal-container').css("left","700px");
//$('#simplemodal-container').css("top","27px");
});


// When the form is submitted
$("#login_status > form").submit(function(){

// Hide 'Submit' Button
$('#submit').hide();

// 'this' refers to the current submitted form
var str = $(this).serialize();  

// -- Start AJAX Call --
$.ajax({
    type: "POST",
    url: "login.asp",  // Send the login info to this page
    data: str,  
    success: function(msg){  
   
$("#login_status").ajaxComplete(function(event, request, settings){
 
 // Show 'Submit' Button
$('#submit').show();

// Hide Gif Spinning Rotator
$('#ajax_loading').hide();  

 if(msg == 'OK') // LOGIN OK?
 {
  setTimeout('go_to_private_page()');
 }  
 else // ERROR?
 {  
 var login_response = msg;
 //$('#login_response').html(login_response);
 $('#notification_error').show();
 }
      
 });  
   
 }  
   
  });  
  
// -- End AJAX Call --
return false;

}); // end submit event

});

function go_to_private_page()
{
//window.location = 'private.asp'; // Members Area
window.location.reload(); // po uspesnem prihlaseni reload stranky
}
