function wlacz_menu_0(){
	document.getElementById('menu0').className = "wylacz"
	document.getElementById('menu00').className = "wlacz"
}

function wylacz_menu_0(){
	document.getElementById('menu0').className = "wlacz"	
	document.getElementById('menu00').className = "wylacz"	
}

function wlacz_menu_1(){
	document.getElementById('menu1').className = "wylacz"
	document.getElementById('menu11').className = "wlacz"
}

function wylacz_menu_1(){
	document.getElementById('menu1').className = "wlacz"	
	document.getElementById('menu11').className = "wylacz"	
}
function wlacz_menu_2(){
	document.getElementById('menu2').className = "wylacz"
	document.getElementById('menu22').className = "wlacz"
}

function wylacz_menu_2(){
	document.getElementById('menu2').className = "wlacz"	
	document.getElementById('menu22').className = "wylacz"	
}

function wlacz_menu_3(){
	document.getElementById('menu3').className = "wylacz"
	document.getElementById('menu33').className = "wlacz"
}

function wylacz_menu_3(){
	document.getElementById('menu3').className = "wlacz"	
	document.getElementById('menu33').className = "wylacz"	
}

function wlacz_menu_4(){
	document.getElementById('menu4').className = "wylacz"
	document.getElementById('menu44').className = "wlacz"
}

function wylacz_menu_4(){
	document.getElementById('menu4').className = "wlacz"	
	document.getElementById('menu44').className = "wylacz"	
}

function wlacz_menu_5(){
	document.getElementById('menu5').className = "wylacz"
	document.getElementById('menu55').className = "wlacz"
}

function wylacz_menu_5(){
	document.getElementById('menu5').className = "wlacz"	
	document.getElementById('menu55').className = "wylacz"	
}

function wlacz_menu_6(){
	document.getElementById('menu6').className = "wylacz"
	document.getElementById('menu66').className = "wlacz"
}

function wylacz_menu_6(){
	document.getElementById('menu6').className = "wlacz"	
	document.getElementById('menu66').className = "wylacz"	
}

function pokazProgram(_start, _jezyk, _ile) {
	advAJAX.get({
		onInitialization : function() {
	       document.getElementById('loader').className = 'wlacz';
		   document.getElementById('load_program').className = 'wylacz';
	    },
	    url: "engine_program_kw_long.php?start="+_start+"&recon=1"+"&aktualny_jezyk="+_jezyk+"&ile="+_ile,
	    onSuccess : function(obj) {
	    document.getElementById('loader').className = 'wylacz';
		document.getElementById('load_program').className = 'wlacz';
	    document.getElementById('programy_kw_long').innerHTML= obj.responseText;
	     },
	    onError : function(obj) { alert("Error: " + obj.status); }
	});
}

function zmienKolumne(_start,_jezyk,_ile,_rodzaj,_plik) {
	advAJAX.get({
		onInitialization : function() {
	       document.getElementById('loader_'+_rodzaj).className = 'wlacz';
		   //document.getElementById('load_'+_rodzaj).className = 'wylacz';
	    },
	    url: "engine_"+_plik+".php?start="+_start+"&recon=1"+"&aktualny_jezyk="+_jezyk+"&ile="+_ile,
	    onSuccess : function(obj) {
			document.getElementById('loader_'+_rodzaj).className = 'wylacz';
			//document.getElementById('load_'+_rodzaj).className = 'wlacz';
			document.getElementById('cont_'+_rodzaj).innerHTML= obj.responseText;
	    },
	    onError : function(obj) { alert("Error: " + obj.status); }
	});
}

function pokazUczestnika(_start, _jezyk, _ile) {
	advAJAX.get({
		onInitialization : function() {
	       document.getElementById('loader1').className = 'wlacz';
		   document.getElementById('load_uczestnicy').className = 'wylacz';
	    },
	    url: "engine_uczestnicy_long.php?start="+_start+"&recon=1"+"&aktualny_jezyk="+_jezyk+"&ile="+_ile,
	    onSuccess : function(obj) {
	    document.getElementById('loader1').className = 'wylacz';
		document.getElementById('load_uczestnicy').className = 'wlacz';
	    document.getElementById('uczestnicy_long').innerHTML= obj.responseText;
	     },
	    onError : function(obj) { alert("Error: " + obj.status); }
	});
}
function pokazProgramBig(_start, _jezyk) {
	advAJAX.get({
		onInitialization : function() {
	       document.getElementById('loader').className = 'wlacz';
		   document.getElementById('load_programbig').className = 'wylacz';
	    },
	    url: "engine_program.php?start="+_start+"&recon=1"+"&aktualny_jezyk="+_jezyk,
	    onSuccess : function(obj) {
	    document.getElementById('loader').className = 'wylacz';
		document.getElementById('load_programbig').className = 'wlacz';
	    document.getElementById('program').innerHTML= obj.responseText;
	     },
	    onError : function(obj) { alert("Error: " + obj.status); }
	});
}
function pokazProgramBig2(_start, _jezyk) {
	advAJAX.get({
		onInitialization : function() {
	       document.getElementById('loader').className = 'wlacz';
		   document.getElementById('load_programbig').className = 'wylacz';
	    },
	    url: "engine_2program.php?start="+_start+"&recon=1"+"&aktualny_jezyk="+_jezyk,
	    onSuccess : function(obj) {
	    document.getElementById('loader').className = 'wylacz';
		document.getElementById('load_programbig').className = 'wlacz';
	    document.getElementById('program').innerHTML= obj.responseText;
	     },
	    onError : function(obj) { alert("Error: " + obj.status); }
	});
}
function pokazGalerieMain(_start, _jezyk) {
	advAJAX.get({
		onInitialization : function() {
	       document.getElementById('loader').className = 'wlacz';
		   document.getElementById('load_galeria_main').className = 'wylacz';
	    },
	    url: "engine_galerie_main.php?start="+_start+"&recon=1"+"&aktualny_jezyk="+_jezyk,
	    onSuccess : function(obj) {
	    document.getElementById('loader').className = 'wylacz';
		document.getElementById('load_galeria_main').className = 'wlacz';
	    document.getElementById('galeria_main').innerHTML= obj.responseText;
	     },
	    onError : function(obj) { alert("Error: " + obj.status); }
	});
}


function pokazGalerie(_start, _jezyk, _id_foto) {
	advAJAX.get({
		onInitialization : function() {
	       document.getElementById('loader').className = 'wlacz';
		   document.getElementById('load_galeria_main').className = 'wylacz';
	    },
	    url: "engine_galerie.php?start="+_start+"&recon=1"+"&aktualny_jezyk="+_jezyk+"&id_foto="+_id_foto,
	    onSuccess : function(obj) {
	    document.getElementById('loader').className = 'wylacz';
		document.getElementById('load_galeria_main').className = 'wlacz';
	    document.getElementById('galeria_main').innerHTML= obj.responseText;
	     },
	    onError : function(obj) { alert("Error: " + obj.status); }
	});
}

function zmienFoto(_id_foto, _jezyk, _start, _start_n, _start_p) {
	advAJAX.get({
		onInitialization : function() {
	       document.getElementById('loader1').className = 'wlacz';
		   document.getElementById('gal_foto_big').className = 'wylacz';
	    },
	    url: "engine_galerie.php?id_foto="+_id_foto+"&recon=1"+"&aktualny_jezyk="+_jezyk+"&start="+_start+"&start_n="+_start_n+"&start_p="+_start_p,
	    onSuccess : function(obj) {
	    document.getElementById('loader1').className = 'wylacz';
		document.getElementById('gal_foto_big').className = 'wlacz';
	    document.getElementById('galeria_main').innerHTML= obj.responseText;
	     },
	    onError : function(obj) { alert("Error: " + obj.status); }
	});
}

function wlaczFoto(_img,_title){
	
	tb_show(_title, 'http://www.milosz.otwarte.com.pl/'+_img, '');


}
function wylaczFoto(){
	
	$("#foto_gall").fadeOut("slow");
	$("#overlay").fadeOut("slow");
}

function getPageSize(){
	        
	     var xScroll, yScroll;
		
		if (window.innerHeight && window.scrollMaxY) {	
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		
		var windowWidth, windowHeight;
		
		if (self.innerHeight) {	// all except Explorer
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth; 
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) { // other Explorers
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}	
		
		// for small pages with total height less then height of the viewport
		if(yScroll < windowHeight){
			pageHeight = windowHeight;
		} else { 
			pageHeight = yScroll;
		}
	
		// for small pages with total width less then width of the viewport
		if(xScroll < windowWidth){	
			pageWidth = xScroll;		
		} else {
			pageWidth = windowWidth;
		}

		return [pageWidth,pageHeight];
}

function wlaczOswiadczenie() {
	document.getElementById('news_form').className = 'wylacz';
	document.getElementById('oswiadczenie').className = 'wlacz';	
}

function wylaczOswiadczenie() {
	document.getElementById('news_form').className = 'wlacz';
	document.getElementById('oswiadczenie').className = 'wylacz';
}



function dodajAdresEmail() {
	  _adres = document.getElementById('news_adres').value;
	  _jezyk = document.getElementById('news_jezyk').value;
		   
	advAJAX.get({
		onInitialization : function() {
	       document.getElementById('news_form').className = 'wylacz';
		   document.getElementById('news_info').className = 'wlacz';
		   
				document.getElementById('oswiadczenie').className = 'wylacz';
		   document.getElementById('news_info').innerHTML = '<span class="news_white">Trwa wysylanie adresu. Prosze czekac...</span>';
	    },
	    url: "engine_add_email.php?adres="+_adres+"&jezyk="+_jezyk,
	    onSuccess : function(obj) {
	    	if(obj.responseText == 1) {
				alert('Podaj wlasciwy adres email.');
				document.getElementById('news_form').className = 'wlacz';
		  		document.getElementById('news_info').className = 'wylacz';
			}
			if(obj.responseText == 2) {
				alert('Podany adres email znajduje sie juz w bazie.');
				document.getElementById('news_form').className = 'wlacz';
		  		document.getElementById('news_info').className = 'wylacz';
			}
			if(obj.responseText == 3) {
				document.getElementById('news_info').innerHTML = '<span class="news_white">Na podany adres email zostal przeslany link aktywacyjny. Dziekujemy!</span>';
			}
			
			if(obj.responseText == 4) {
				//alert('blad z dodaniem!');
			}
			
			if(obj.responseText == 5) {
				//alert('jezyk!');
			}
	     },
	    onError : function(obj) { alert("Error: " + obj.status); }
	});
}

