
function Czytania()
{
var r=document.getElementById('rok');
var o=document.getElementById('okres');

var rok=r.options[r.selectedIndex].value;
var okres=o.options[o.selectedIndex].value;

  prepareObject();
  if(!req)
  {    
    alert('Przeglądarka nie obsługuje wymaganych narzędzi do obsługi tego żądania');
    return;
   }


try
{
  req.onreadystatechange=handleResponse;
  req.open("GET",'getDays.php?rok='+rok+'&okres='+okres,true);
req.send(null);
  
}
catch(e)
{
  alert('Wystąpił problem z komunikacją z serwerem');
}
  
}
function handleResponse()
{
try
{
  if(req.readyState==4 )
  {
    
    	if(req.status==200)
    	{
	
		     document.getElementById('msg').innerHTML=req.responseText;
		   
		
		  
		}
		else
		{
		  alert('Wystąpił problem z komunikacją z serwerem');
		}
    
	}
}
catch(e)
{
  alert('Wystąpił problem z komunikacją z serwerem');
} 
 
}



 function powieksz(id)
 { 
 document.getElementById('srodek').className='content'+id;
 }

 function display_menu(id)
{
var kategorie=new Array();
  kategorie[-1]=new Array();
  // kategorie[-1][4]='Bieżące aktualności';
 kategorie[-1][1]='Zapowiedzi';
 kategorie[-1][2]='Nowości wydawnicze';
 kategorie[-1][3]='Archiwum';
 kategorie[-2]=new Array();
 kategorie[-2][1]='Filmy';
 kategorie[-2][2]='Płyty duszpasterstwa';
 kategorie[-2][3]='Wyślij ekartkę';
 kategorie[-2][4]='Galerie';
 
var statyczne= new Array();
statyczne[-1]=new Array();
statyczne[-1][1]='zapowiedzi.html';
statyczne[-1][2]='nowosc.html';
statyczne[-1][3]='archiwum.html';
//statyczne[-1][4]='news.html';
statyczne[-2]=new Array();
statyczne[-2][1]='multimedia.html';
statyczne[-2][2]='mp3.html';
statyczne[-2][3]='http://www.edycja.pl/index.php?mod=gratisy';
statyczne[-2][4]='galeria.html';



 var michal=document.getElementById('display_menu_items');	 
michal.innerHTML='';

 for(var i=1;i<kategorie[id].length;i++)
 {
 michal.innerHTML+='<li><a href="'+statyczne[id][i]+'">'+kategorie[id][i]+'</a></li>'; 

 }

}




 function txt_length(pole,max)
{


if(max-(pole.value.length)<0)
{
 alert('Maksymalna ilość znaków wynosi '+max);
pole.value=pole.value.substr(0,max)

}

}


function prepareObject()
{
		if(window.XMLHttpRequest)
		{
		  req=new XMLHttpRequest();	
		}
		else if(window.ActiveXObject)
		{
		  req=new ActiveXObject("Msxml2.XMLHTTP");
		  
		  if(!req)
		  req=new ActiveXObject("Microsoft.XMLHTTP");
		}


}

function sendMailRequest(formularz,url,asynch)
{
  prepareObject();
  if(!req)
  {    
    alert('Przeglądarka nie obsługuje wymaganych narzędzi do obsługi tego żądania');
    return;
   }
var form=document.forms[formularz];

try
{
  req.onreadystatechange=newsletterResponse;
  req.open(form.method,url,asynch);
req.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=utf-8");
req.send('email='+encodeURIComponent(form.email.value)+'&nadawca='+encodeURIComponent(form.nadawca.value)+'&tresc='+encodeURIComponent(form.tresc.value));
  
}
catch(e)
{
  alert('Wystąpił problem z komunikacją z serwerem');
}
  
}


function newsletterResponse()
{
try
{
  if(req.readyState==4 )
  {
    
    	if(req.status==200)
    	{
	
		     document.getElementById('mail_div').innerHTML=req.responseText;
		   
		
		  
		}
		else
		{
		  alert('Wystąpił problem z komunikacją z serwerem');
		}
    
	}
}
catch(e)
{
  alert('Wystąpił problem z komunikacją z serwerem');
} 
 
}

