jQuery(document).ready(function() {
	jQuery('a#delete_newsletter').click(function() {
		jQuery.ajax({
			type: "POST",
			url: "index.php",
			data: "delete_newsletter=1&newsletter_email="+jQuery('#pre_newsletter_email').val(),
			error: function (){
                alert("Wystąpił błąd. Spróbuj ponownie");
			},
			success: function(msg) {
				alert("Twoje dane zostały usunięte z bazy danych.");
			}
		});
	});
});

function formValid(id,mask) {
	//var id = jQuery('a[title=zapisz]').attr('href');
		
	var maskHeight = jQuery(document).height();
	var maskWidth = jQuery(window).width();
     
	//Set height and width to mask to fill up the whole screen
	jQuery(mask).css({'width':maskWidth,'height':maskHeight});
         
	//transition effect    
	jQuery(mask).fadeIn(1000);   
	jQuery(mask).fadeTo("slow",0.8); 
     
	//Get the window height and width
	var winH = jQuery(window).height();
	var winW = jQuery(window).width();
               
	//Set the popup window to center
	jQuery(id).css('top',  winH/2-jQuery(id).height()/2);
	jQuery(id).css('left', winW/2-jQuery(id).width()/2);
     
	//transition effect
	jQuery(id).fadeIn(2000);
}
