
	function onClick_GoTo(page) {
 		location.href=page+'.html';
	}

	function set_bg(elem_name,color) {
		var elem=document.getElementById(elem_name);
		elem.style.backgroundColor=color;
	}
		
	function image_click(number) {
		present_picture=number;
		document.mainimage.src=pictures[number];
		
		
		x = document.getElementById('galeria_image');
		y = document.getElementById('galeria_miniatury');

		img=new Image();
		img.src=pictures[number];
		if ( img.width>maxPictureWidth ) document.mainimage.width=maxPictureWidth;
		else document.mainimage.width=img.width;
		
//		document.write(img.width);
		
			
		y.style.display='none';	
		x.style.display='';
		
//		galeria=document.getElementById('galeria_image_all');
//		galeria.style.width=document.mainimage.width+'px';
//		galeria.style.height=document.mainimage.height+'px';
		
		
//		opis_text=document.getElementById('galeria_opis');
//		opis_text.innerHTML=opis[number];
			
//		opis_bgx=document.getElementById('galeria_opis_bg');	
//		opis_bgx.style.width=document.mainimage.width+'px';		
		
		
	}
	
	
	function image_close() {
		x = document.getElementById('galeria_image');
		y = document.getElementById('galeria_miniatury');
		x.style.display='none';	
		y.style.display='';
		document.mainimage.src='images/blank.jpg';	
		
	}
	
	function image_prev() {
		if (present_picture==0) present_picture=pictures_count-1;
		else present_picture--;		
	
		img=new Image();
		img.src=pictures[present_picture];
		if ( img.width>maxPictureWidth ) document.mainimage.width=maxPictureWidth;
		else document.mainimage.width=img.width;
		
		document.mainimage.src=pictures[present_picture];
//		document.getElementById('galeria_opis').innerHTML=opis[present_picture];
	}
	function image_next() {
		if (present_picture==pictures_count-1) present_picture=0;
		else present_picture++;		
	
		img=new Image();
		img.src=pictures[present_picture];
		if ( img.width>maxPictureWidth ) document.mainimage.width=maxPictureWidth;
		else document.mainimage.width=img.width;	
		
		document.mainimage.src=pictures[present_picture];
//		document.getElementById('galeria_opis').innerHTML=opis[present_picture];		
	}
	
	function preload_pictures() {
		imageObj = Array();
		i=1;
		
		for (i=1000; i<pictures_count; i++) {
			imageObj[i] = new Image();		
			setTimeout("imageObj["+i+"].src='zdjecia/'+pictures["+i+"]",i*10);
		}
		
	}


	function set_opis() {
		var elem=document.getElementById(elem_name);
		elem.style.backgroundColor=color;
	}
		


	///////////////////////////////////////////////////////
	//    FUNKCJE ODNOŚNIE KARTECZKI INFO I COOKIE      //
	///////////////////////////////////////////////////////
	
	// funkcja ustawia w cookie wartosc o podanej nazwie na czas nieokreslony
	function setCookieN(nazwa, wartosc) {
		document.cookie = nazwa + '=' + escape(wartosc) + ';expires=Fri, 31 Dec 2099 23:59:59 GMT;';
	}
	
	//function setCookieN(c_name,value,expiredays) {
	//	var exdate=new Date();
	//	exdate.setDate(exdate.getDate()+expiredays);
	//	document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
	//}

	function setCookie(nazwa,wartosc) {
		var exdate=new Date();
		exdate.setDate(exdate.getDate()+1);
		document.cookie=nazwa + "=" + escape(wartosc)+";expires="+exdate.toGMTString();
	}
	
		
	// funkcja zwraca wartość ustawioną w cookie pod nazwą 'nazwa'
	function getCookie(nazwa) {
		if (document.cookie!="") {
			var toCookie=document.cookie.split("; ");
			for (i=0; i<toCookie.length; i++) {
	 			var nazwaCookie=toCookie[i].split("=")[0];
	 			var wartoscCookie=toCookie[i].split("=")[1];
	 			if (nazwaCookie==nazwa) return unescape(wartoscCookie)
			}
		}
	}
	
	
	$(function(){		
		
		$('#infobox').hide();
		
		$('.dark').css({
			'background-color':'black',
			'opacity':'0.4'
		})
		
		
		showInfobox=getCookie('showinfobox');
		if ( showInfobox!=1 ) {
			setCookie('showinfobox',2);
			$('#infobox').show('slow');
		} 
		//else {

		//}
	
		
		$('#infoboxOpen').click(function(){
			//$('#infobox').slideToggle('slow');	
			$('#infobox').toggle('slow');	
				
			showInfobox=getCookie('showinfobox');
			if ( showInfobox==2 ) {
				setCookie('showinfobox',1);
			} else {
				setCookie('showinfobox',2);					
			}
			
		});
				
		$('#infoboxClose').click(function(){
			//$('#infobox').slideToggle('slow');	
			$('#infobox').hide('slow');	
			setCookie('showinfobox',1);
		});
		
	
	})
	
	

		


