
img1 = new Image(16, 16); img1.src="/images/spinner.gif";img2 = new Image(220, 19);img2.src="/images/ajax-loader.gif";
$(document).ready(function(){
$("#login_link").click(function(){$('#login_form').modal();});
$("#status > form").submit(function(){  $('#submit').hide(); $('#ajax_loading').show(); var str = $(this).serialize();  
$.ajax({type: "POST",
    url: "/functions/newspaper.php?lang=fa",  // Send the login info to this page
    data: str,  
    success: function(msg){  
   
$("#status").ajaxComplete(function(event, request, settings){  
 
 // Show 'Submit' Button
$('#submit').show();

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

 if(msg == 'OK') // LOGIN OK?
 {  
 var login_response = '<div id="logged_in" style="  margin-top: 30px; ">' +
	 '<div style=" float: right; margin-right: 20px; margin-left: 20px;">' + 
	 '<div style="width: 40px; float: right;">' +
	 '<img style="margin: 10px 10px 10px 0px;" align="absmiddle" src="/images/ajax-loader.gif">' +
	 '</div>' +
	 '<div style=" float: right; margin-top: 20px;margin-right: 20px;  ">'+ 
	 "عضویت شما در خبرنامه  <br /> در حال تکمیل است  ...</div></div>";  

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

//$('#simplemodal-container').css("width","300px");
//$('#simplemodal-container').css("height","120px");
 
 $(this).html(login_response); // Refers to 'status'

// After 3 seconds redirect the 
setTimeout('go_to_private_page()', 3000); 
 }  
 else // ERROR?
 {  
 var login_response = msg;
 $('#login_response').html(login_response);
 }  
      
 });  
   
 }  
   
  });  
  
// -- End AJAX Call --

return false;

}); // end submit event

//contact 

$("#contact_link").click(function(){
	$('#cantact_form').modal();
	$('#simplemodal-container').css("width","420px");
    $('#simplemodal-container').css("height","430px");
});
$("#cantactstatus > form").submit(function(){  $('#submitcontact').hide(); $('#cantact_loading').show(); var str = $(this).serialize();  
$.ajax({type: "POST",
    url: "/functions/contact.php?lang=fa",  // Send the login info to this page
    data: str,  
    success: function(msg){  
   
$("#cantactstatus").ajaxComplete(function(event, request, settings){  
 
 // Show 'Submit' Button
$('#submitcontact').show();

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

 if(msg == 'OK') // LOGIN OK?
 {  
 var contact_response = '<div id="logged_in" style="  margin-top: 150px; ">' +
	 '<div style=" float: right; margin-right: 20px; margin-left: 20px;">' + 
	 '<div style="width: 40px; float: right;">' +
	 '<img style="margin: 10px 0px 10px 0px;" align="absmiddle" src="/images/ajax-loader.gif">' +
	 '</div>' +
	 '<div style=" float: right; margin-top: 20px;margin-right: 20px;  ">'+ 
	 "پیشنهادات و انتقادات شما    <br /> در حال دریافت است  ...</div></div>";  

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


//$('#simplemodal-container').css("width","300px");
//$('#simplemodal-container').css("height","120px");

 $(this).html(contact_response); // Refers to 'status'

// After 3 seconds redirect the 
setTimeout('go_to_private_page()', 3000); 
 }  
 else // ERROR?
 {  
 var contact_response = msg;
 $('#contact_response').html(contact_response);
 }  
      
 });  
   
 }  
   
  });  
  
// -- End AJAX Call --

return false;

}); // end submit event




});


function go_to_private_page(){
	window.location.reload(); }


