$(document).ready( function (){
	$('body').append('<div class="newsletter_box"></div>')
	
	
	
	$('.newsletter_box').css({
			width:380,
			
			position:'fixed',
			right:-345,
			top:80, 
			zIndex:5000
		})
		
	$.get('/newslettery_pastor.html', function(data) {
  		$('.newsletter_box').html(data);
		$('.kliknij').click(function() {
		  	$('.newsletter_box').animate({
				right:0
		  	}).css('cursor', 'default');
		});
		$('#close_new').click( function () {
			$('.newsletter_box').animate({
				right:-345
		  	})
			$('.kliknij').css('cursor', 'pointer');
		});
  		
	});
});

function CheckMultiple34(frm, name) {
	for (var i=0; i < frm.length; i++)
	{
		fldObj = frm.elements[i];
		fldId = fldObj.id;
		if (fldId) {
			var fieldnamecheck=fldObj.id.indexOf(name);
			if (fieldnamecheck != -1) {
				if (fldObj.checked) {
					return true;
				}
			}
		}
	}
	return false;
}
function CheckForm34(f) {
	var email_re = /[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/i;
	if (!email_re.test(f.email.value)) {
		alert("Proszę podać adres e-mail");
		f.email.focus();
		return false;
	}
	if(!document.getElementById('zg').checked)
	{
		alert("Proszę zaznaczyć pole ze zgodą na przetwarzanie danych.");

		return false;	
	}
	return true;
}


function popupup()
{
	if(getCookie('popWas') == 1)
	{
		getCookie('popWas');
	}
	else
	{
		var W = $('body').outerWidth();
		$('.newsletter_box').animate({
			right:(W-580)/2
		})
		
		
		setCookie('popWas',1,2);
	}	
}
			
			
function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
}		
	
function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
  x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
  y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
  x=x.replace(/^\s+|\s+$/g,"");
  if (x==c_name)
    {
    return unescape(y);
    }
  }
}
			
			
			
			
			
			
			
			
			
			
