function checkform ( form )
{
if (form.imie.value == "") {
        alert( "Proszę wprowadzić imię." );
        form.imie.focus();
        return false ;
    }
if (form.nazwisko.value == "") {
        alert( "Proszę wprowadzić nazwisko." );
        form.nazwisko.focus();
        return false ;
    }
if (form.nazwa_podmiotu.value == "") {
        alert( "Proszę wprowadzić nazwę podmiotu." );
        form.nazwa_podmiotu.focus();
        return false ;
    }
if (form.stanowisko.value == "") {
        alert( "Proszę wprowadzić zajmowane stanowisko." );
        form.stanowisko.focus();
        return false ;
    }    
if (form.adres.value == "") {
        alert( "Proszę wprowadzić adres." );
        form.adres.focus();
        return false ;
    } 
if (form.telefon.value == "") {
        alert( "Proszę wprowadzić telefon." );
        form.telefon.focus();
        return false ;
    } 
if (form.email.value == "") {
        alert( "Proszę wprowadzić adres e-mail." );
        form.email.focus();
        return false ;
    }  
    
   
 if (form.imie_1.value == "") {
        alert( "Proszę wprowadzić imię." );
        form.imie_1.focus();
        return false ;
    }
if (form.nazwisko_1.value == "") {
        alert( "Proszę wprowadzić nazwisko." );
        form.nazwisko_1.focus();
        return false ;
    }      
 if (form.stanowisko_1.value == "") {
        alert( "Proszę wprowadzić zajmowane stanowisko." );
        form.stanowisko_1.focus();
        return false ;
    } 
  if (form.telefon_1.value == "") {
        alert( "Proszę wprowadzić telefon." );
        form.telefon_1.focus();
        return false ;
    } 
if (form.email_1.value == "") {
        alert( "Proszę wprowadzić adres e-mail." );
        form.email_1.focus();
        return false ;
    }      
}

function IloscOsob(){
		
		var ilosc_osob = $( 'ilosc_osob' ).value
		
		advAJAX.get({
			url: 'ile_osob.php?ile='+ilosc_osob,
			onInitialization : function() {
				$( 'ilosc_osob_div' ).innerHTML = '<div style="font-weight:bold; color: green;">czekaj...</div>';
			},
			onSuccess : function(obj) {	
			
				$( 'ilosc_osob_div' ).innerHTML = obj.responseText;
			 //	window.location.reload(); 	
			},
			onError : function(obj) {
				$( 'ilosc_osob_div' ).innerHTML = '<div style="font-weight:bold; color: red;">blad...</div>';
			}	
		});
	}

function dodajKomentarz (id) {
oBj = $('blad');
Button = $('button');
$( 'komunikat' ).innerHTML = '';
F = $('Formularz');
if (oBj.style.display=="none") {oBj.style.display = ""; Button.style.display = "none";}
else {
advAJAX.get({
	url: 'index.php?module=komentarz&ajax=1&id_art='+id+'&nick='+F.nick.value+'&wpis='+F.komentarz.value,
		onInitialization : function() {
		$( 'komunikat' ).innerHTML = 'trwa zapisywanie';
		},
	onSuccess : function(obj) {	
		oBj.style.display = "none"; 
		Button.style.display = "";
		$( 'komunikat' ).innerHTML = obj.responseText;	
		F.komentarz.value = '';
		F.nick.value = '';
		},
	onError : function(obj) {
		$( 'komunikat' ).innerHTML = 'bł±d zapisu';
	}	
});

	
	
	}
}
/* Okno zwin */
function checkPolec( ster ){
		var spradz = /^([^ ][a-zA-Z0-9±ż¶ˇęółćˇŻ¦¬ĘÓŁĆ]{1,})$/;
		var sprMai = /^([a-zA-Z0-9._-]{1,})@([a-zA-Z0-9._-]{1,})\.([a-zA-Z]{1,4})$/;
		
		if(ster == 1)
			var tresc = $('tresc').value;
		
		var kontr = new Array();
			kontr[0] = false;
			kontr[1] = false;
			if(ster == 1) {
				kontr[2] = false;
				var dane = $('dane1').value;
				var mail = $('email1').value;
			} else {
				var dane = $('dane').value;
				var mail = $('email').value;
			}			
		
		
		if(ster == 1){
			
			if( !spradz.test(dane) ){
			$('dane1').style.border = '1px solid #01ACE2';
			kontr[0] = false;
			} else {
				$('dane1').style.border = '1px solid #98BD26';
				kontr[0] = true;
			}
				
			if( !sprMai.test(mail) ){
				$('email1').style.border = '1px solid #01ACE2';
				kontr[1] = false;
			} else {
				$('email1').style.border = '1px solid #98BD26';
				kontr[1] = true;
			}
			
			if( !spradz.test(tresc) ){
				$('tresc').style.border = '1px solid #01ACE2';
			kontr[2] = false;
			} else {
				$('tresc').style.border = '1px solid #98BD26';
				kontr[2] = true;
			}
			
			if( kontr[0] && kontr[1] && kontr[2] )
				$('wyslij').submit();
				
			
		} else {
		
			if( !spradz.test(dane) ){
			$('dane').style.border = '1px solid #01ACE2';
			kontr[0] = false;
			} else {
				$('dane').style.border = '1px solid #98BD26';
				kontr[0] = true;
			}
				
			if( !sprMai.test(mail) ){
				$('email').style.border = '1px solid #01ACE2';
				kontr[1] = false;
			} else {
				$('email').style.border = '1px solid #98BD26';
				kontr[1] = true;
			}
		
			if( kontr[0] && kontr[1] ){
				
				advAJAX.get({
						url: 'index.php?module=send&akcja=powiadom&ajax=1&dane='+dane+'&email='+mail,
						onInitialization : function() {
							$( 'komuni' ).innerHTML = '<img src="tpl/images/czekaj_ico.gif" alt="czekaj" />';
						},
						onSuccess : function(obj) {	
								$( 'komuni' ).innerHTML = '<div style="font-weight:bold; color: green;">wyslano...</div>';	
								$('dane').value = '';
								$('email').value = '';	
								setTimeout( "zwin_okno()", 3000 );							
						},
						onError : function(obj) {
							$( 'komuni' ).innerHTML = '<div style="font-weight:bold; color: red;">blad...</div>';
						}	
					});
				
			}
		}	
			
			
		

	}
	
	var widt = 0;
	function zwin(){
		
		  
		  widt = widt + 20;
		  $('powiadom').style.margin = '-'+widt+'px 0px 0px 200px';
			
		 if (widt == 400){
	          window.clearInterval(animeInt);
			  $('powiadom').style.display = "none";
			  widt = 0;
		 }
	}
	
	var wid = 200;
	
	function rozwin() {
		  wid = wid - 20;
		  $('powiadom').style.margin = '-'+wid+'px 0px 0px 200px';
			
		 if (wid == 0){
	          window.clearInterval(animeInt);
			  wid = 200;
		 }
	  
	}
	
	function zwin_okno() {
	    animeInt = setInterval("zwin()", 1);
	}
	
	function pokaz_okno() {
	    $('powiadom').style.display = "block";
	    animeInt = setInterval("rozwin()", 1);
	}
/* koniec okno polec */
function bookmark(url, description) {
    if (url == null) { // if description is not passed then default to page title
        url = window.location.href;
    }
    if (description == null) { // if description is not passed then default to page title
        description = document.title;
    }
    if (document.all){ // Test If: Internet Explorer
    window.external.AddFavorite(url, description); // AddFavorite is IE specific
    }
    else if (window.sidebar){ // Test If: Mozilla, Netscape, or FireFox
    window.sidebar.addPanel(description, url, ""); // sidebar.addPanel is Mozilla specific
    }
    else { // If all others
    window.alert("Press CTRL+T to bookmark this page"); // CTRL + T typically for Opera and other browsers
    }
    
}
function Email(Name,what) {
Form = $(Name);
if (!chkEmail(Form.email.value)) {
	$('komunikat').innerHTML = "Adres email jest niepoprawny!";
	}
else {
	advAJAX.get({
   url: "index.php?ajax=1&module=newsletter&akcja="+what+"&email="+Form.email.value,
	onInitialization : function() {
		$('komunikat').innerHTML = 'Proszę czekać trwa wysyłanie wiadomo¶ci';	
    },
    onSuccess : function(obj) {
		$('komunikat').innerHTML = obj.responseText;
		Form.email.value = '';
	 },
    onError : function(obj) { alert("Error: " + obj.status); }
	});
	
	}
}
function newsletter(oBj) {
return false;
}
function clean(oBj) {
oBj.value = '';
}
function sendMeil() {
	oBj = $('Wyslij');
	advAJAX.get({
    url: "index.php?ajax=1&module=wyslij&imie="+oBj.imie.value+"&nazwisko="+oBj.nazwisko.value+"&email="+oBj.email.value+"&informacja="+oBj.informacja.value,
	onInitialization : function() {
		$('komunikat').innerHTML = 'Proszę czekać trwa wysyłanie wiadomo¶ci';	
    },
    onSuccess : function(obj) {
		$('komunikat').innerHTML = obj.responseText;
		oBj.imie.value = '';
		oBj.nazwisko.value = '';
		oBj.informacja.value = '';
		oBj.email.value = '';
	 },
    onError : function(obj) { alert("Error: " + obj.status); }
	});
return false;
}
function closeWpis() {
objFirma = document.getElementById('galeria');
objFirma.style.display="none";
objBlock = document.getElementById('tlo_block');
objBlock.style.display="none";
window.location.reload( false );
return false;
}
function chkEmail(email) {
var regEmail = /^([a-zA-Z0-9._-]{1,})@([a-zA-Z0-9._-]{1,})\.([a-zA-Z]{1,4})$/;
if (!regEmail.test(email)) return false;
else return true;
}
function chkWpis() {
oBj = $('wpis');
if (oBj.nick.value=='' || oBj.wpis.value=='') {
	alert("Proszę uzupełnić wymagane pola");
	}
else {
	advAJAX.get({
    url: "index.php?ajax=1&module=dodaj&nick="+oBj.nick.value+"&wpis="+oBj.wpis.value+"&email="+oBj.email.value,
    onSuccess : function(obj) {
	 objFirma = document.getElementById('galeria');
		objFirma.style.display="none";
		objBlock = document.getElementById('tlo_block');
		objBlock.style.display="none";
		document.location.href = 'ksiega_gosci,pokaz,1.html';
	 },
    onError : function(obj) { alert("Error: " + obj.status); }
	});
	
	
	}
return false;
}
function dodajwpis() {
objFirma = document.getElementById('galeria');
objFirma.style.display="block";
objBlock = document.getElementById('tlo_block');
objBlock.style.display="block";
setLeft('galeria', 400);
setTop('galeria', 150);
var arrayPageSize = getPageSize();
	 setHeight('tlo_block', arrayPageSize[1]);
text='<form onsubmit="return chkWpis()" id="wpis" name="wpis">';
text+='<table cellspacing="2" cellpadding="2" width="400" class="wpis">';
text+='<tr><td colspan="2" class="center"><b>Księga go¶ci</b></td></tr>';
text+='<tr><td class="small">wpisał</td><td><input type="text" name="nick" id="nick" class="text" /></td></tr>';
text+='<tr><td class="small">wpis</td><td><textarea name="wpis" id="wpis"></textarea></td></tr>';
text+='<tr><td class="small">adres email*</td><td><input type="text" name="email" id="email" class="text"/></td></tr>';
text+='<tr><td class="small"></td><td><input type="submit" value="dodaj" class="submit"/> <input type="submit" value="anuluj" class="submit" onclick="return closeWpis();"/></form>';
text+='</td></tr>';
text+='</table>';
objFirma.innerHTML = text;
}


function rateIt(id,rate) {
	object = $("ocen");
	advAJAX.get({
		url: 'index.php?module=pokaz&akcja=film&row='+id+'&rate='+rate+'&ajax=1',
		onSuccess: function(obj) {
			object.innerHTML = obj.responseText;
			},
		onInitialization: function(obj) {
			object.innerHTML = '<p style="margin-bottom: 46px;">Trwa zapisywania...</p>';
			},
		onError: function(obj) {
			object.innerHTML = "Wyst±pił bł±d!";
			}
		});
	}
function reloadItem(name,stan) {
var Tablica = Array();
for (i=0;i<5;i++) {
	id = "ocen_" + i;
	Tablica[i] = document.getElementById(id);
	
	
	if (stan>=i+1) {
		Tablica[i].src = 'tpl/images/img_star_on.gif';
		}
	else {
		Tablica[i].src = 'tpl/images/img_star_off.gif';
		}

	
	
	}
}
function chgItem(name) {
var Tablica = Array();
for (i=0;i<5;i++) {
	id = "ocen_" + i;
	Tablica[i] = document.getElementById(id);
	}
iId = name.id.substr(5);
for (i=0;i<5;i++) {
	if (iId>=i) {
		Tablica[i].src = 'tpl/images/img_star_on.gif';
		}
	else {
		Tablica[i].src = 'tpl/images/img_star_off.gif';
		}
	}

}
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}
if (navigator.appName=='Microsoft Internet Explorer') window.attachEvent("onload", correctPNG);

    function poprawPNG() {
        var divs = document.getElementsByTagName('DIV');
       
        for(var i=0; i<divs.length; i++) {

            var div = divs[i];
            var back = eval('div.currentStyle.backgroundImage');
            if(back.indexOf(".png") != -1) {
                div.style.backgroundImage = 'none';
                div.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + back.substring(5, back.length-2) + "', sizingMethod='scale')";
            }           

        }
    }

    if(window.attachEvent) {
        window.attachEvent('onload', poprawPNG);
    }
	 
function showSubmenu(name) {
	$(name).style.display = "";
}
function hideSubmenu(name) {
	$(name).style.display = "none";
}
function PokazUkryj(Nazwa) {
objFirma = document.getElementById(Nazwa);
if (objFirma.style.display=="block") objFirma.style.display="none";
else objFirma.style.display="block";
}

function $( ide ){
	return document.getElementById( ide );
}

function wyswietlMenu( ide ){
	var kont = $( 'kontMenu'+ide );
	
		
	//$('id'+ide).style.color = '#A31113';

		
	advAJAX.get({
				url: 'index.php?module=katalog&akcja=pokazPod&row='+ide+'&ajax=1',
				onInitialization : function() {
					kont.innerHTML = '<img src="tpl/images/czekaj_ico.gif" alt="czekaj" />';
				},
				onSuccess : function(obj) {	
						kont.innerHTML = obj.responseText;	
				},
				onError : function(obj) {
					kont.innerHTML = '<div style="font-weight:bold; color: red;">blad...</div>';
				}	
			});
	
}






function MM_swapImage() { 
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { 
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}


browserversion = parseInt(navigator.appVersion);
}
function FirmaRoll(Nazwa, Boks) {

advAJAX.get({
		url: 'index.php?module=katalog_firm&akcja=pokaz&ajax=1&op='+Nazwa,
		onInitialization : function() {
			$( Boks ).innerHTML = '<div style="color: #6C0000;">Proszę czekać, trwa ładowanie...</div>';
		},
		onSuccess : function(obj) {	
			$( Boks ).innerHTML = obj.responseText+'<a href="?module=katalog_firm&akcja=dodajfirme&pakiet='+Nazwa+'"><img src=\"tpl/images/rejestruj.gif\" border="0" align="right" alt=\"\"></a>';
			
		},
		onError : function(obj) {
			$( Boks ).innerHTML = '<div style="font-weight:bold; color: red;">blad...</div>';
		}	
	});

}
function rollOutFlash(myToggle,Nazwa)
{
objIn = document.getElementById(Nazwa);
objIn.SetVariable ("_root.myToggle"," " + myToggle);
}
function chkNewsletter() {
objZapisz1_1 = document.getElementById('NewsLetter1_1');
objZapisz1_2 = document.getElementById('NewsLetter1_2');
objWypisz2_1 = document.getElementById('NewsLetter2_1');
objWypisz2_2 = document.getElementById('NewsLetter2_2');
if (objZapisz1_1.style.display == 'inline') {
	objZapisz1_1.style.display = 'none';
	objZapisz1_2.style.display = 'inline';
	objWypisz2_1.style.display = 'inline';
	objWypisz2_2.style.display = 'none';
	}
else {
	objZapisz1_1.style.display = 'inline';
	objZapisz1_2.style.display = 'none';
	objWypisz2_1.style.display = 'none';
	objWypisz2_2.style.display = 'inline';
	}
}
function correctNewsletter() {
wpis = document.getElementById('newsletter');
objZapisz1_1 = document.getElementById('NewsLetter1_1');
todo = document.getElementById('todo');
if (objZapisz1_1.style.display == 'none') todo.value = 'Wypisz';
else todo.value = 'Zapisz';
var regEmail = /^([a-zA-Z0-9._-]{1,})@([a-zA-Z0-9._-]{1,})\.([a-zA-Z]{1,4})$/;
if (!regEmail.test(wpis.value)) {
	alert( "Podaj prawidłowy format e-maila." );
	return false ;
	}
else return true;
}
function chgMenu(name) {
Act = name.substr(5,6);
listObj = document.getElementsByTagName('div');
for (i=0;i<listObj.length;i++) {
	if (listObj[i].id.substr(0,7)=='SubMenu') {
		if (listObj[i].id.substr(8,9) == Act) listObj[i].style.display = "block";
		else listObj[i].style.display = "none";
		};
	}
}

/* gwiazdki */
		var g_clear = 'tpl/images/gw_pusta.gif';
		var g_fill = 'tpl/images/gw_pelna.gif';
		var ile = 5;
		
		var x = 8;
		var y = 7;

	
  
	function generuj( id, start, module){
			
			var iden = $( 'ocena'+id );
			
			for( i = 0; i < ile; i++ ){
			
			docBody = $( 'ocena'+id );
			element = document.createElement("img");
			element.id = i;
			docBody.appendChild(element);
			
			incre = i + 1;
			
			element.setAttribute( "style", "cursor:pointer;" );
			
			if( start > i )
				element.setAttribute( "src", g_fill );
			else
				element.setAttribute( "src", g_clear );
				
			element.setAttribute( "width", x );
			element.setAttribute( "height", y );
			element.setAttribute( "id", 'oc_'+incre+'_'+id );
			element.setAttribute( "name", 'oc_'+incre+'_'+id );

			element.onmouseover=function () { zmien(this.name, id); };
			element.onclick=function () { zlicz(this.name, id, module); };
			element.onmouseout=function () { czysc(id, start);};
			}
			
		}
		
		function zlicz( nr, id, module ){
			var aNum = nr.split( "_" ); 

			
			advAJAX.get({
				url: '?module='+module+'&akcja=zapisz_ocene&ajax=1&ocena='+aNum[1]+'&row='+id,
				onInitialization : function() {
					$( 'ocena'+id ).innerHTML = '<span style="color: green;">zapisuje...</span>';
				},
				onSuccess : function(obj) {	
					$( 'ocena'+id ).innerHTML = '';
					generuj( id, obj.responseText, module ); 
					
				},
				onError : function(obj) {
					$( 'ocena'+id ).innerHTML = '<div style="font-weight:bold; color: red;">blad...</div>';
				}	
			});
			
			
		}
		
		function zmien( nr, id ){
			var aNum = nr.split( "_" ); 
			var a = 1;
			for(i = 0; i < aNum[1]; i++){
				$( 'oc_'+a+'_'+id ).setAttribute("src", g_fill);	
				a++;
			}	
		}
		
		function czysc( id, start ){
			var i = 0;
			var a = 1;
			for( i; i < ile; i++ ){
				$( 'oc_'+a+'_'+id ).setAttribute("src", g_clear);	
				a++;	
			}
			
			//$( 'ocena'+id ).addEventListener('mouseout',doSomething,false);	
		}
		
	
		
	/* koniec gwiazdki */

// Event and Listners //
//if (document.addEventListener){ // Mozilla, Netscape, Firefox
//	window.addEventListener("load", chkNewsletter, false);
//} else { // IE
//	document.attachEvent('onload', chkNewsletter);
//}
function SprawdzLogin( Boks ) {

var login = $( 'login' ).value;

advAJAX.get({
		url: 'index.php?module=formularz&akcja=sprawdzlogin&ajax=1&login='+login,
		onInitialization : function() {
		
		},
		onSuccess : function(obj) {	
			$( Boks ).innerHTML = obj.responseText;
			$( Boks ).style.color = 'red';
		},
		onError : function(obj) {
			$( Boks ).innerHTML = '<div style="font-weight:bold; color: red;">blad...</div>';
		}	
	});

}
function WpiszMail( Boks ) {
$( 'subdomena' ).value = $( Boks ).value = $( 'subdomena' ).value.toLowerCase();
$( 'subdomena' ).value = $( Boks ).value = $( 'subdomena' ).value.replace(/\ /g,'_');
$( 'subdomena' ).value = $( Boks ).value = $( 'subdomena' ).value.replace(/\±/g,'a');
$( 'subdomena' ).value = $( Boks ).value = $( 'subdomena' ).value.replace(/\ę/g,'e');
$( 'subdomena' ).value = $( Boks ).value = $( 'subdomena' ).value.replace(/\ó/g,'o');
$( 'subdomena' ).value = $( Boks ).value = $( 'subdomena' ).value.replace(/\ł/g,'l');
$( 'subdomena' ).value = $( Boks ).value = $( 'subdomena' ).value.replace(/\¶/g,'s');
$( 'subdomena' ).value = $( Boks ).value = $( 'subdomena' ).value.replace(/\ć/g,'c');
$( 'subdomena' ).value = $( Boks ).value = $( 'subdomena' ).value.replace(/\ż/g,'z');
$( 'subdomena' ).value = $( Boks ).value = $( 'subdomena' ).value.replace(/\ˇ/g,'z');
}
function SprawdzSlowaKluczowe( Boks, Pakiet ) {

var slowa_kluczowe = $( 'slowa_kluczowe' ).value;

advAJAX.get({
		url: 'index.php?module=formularz&akcja=sprawdzslowa&ajax=1&slowa='+slowa_kluczowe+'&pakiet='+Pakiet,
		onInitialization : function() {

		},
		onSuccess : function(obj) {	
			$( Boks ).innerHTML = obj.responseText;
			
		},
		onError : function(obj) {
			$( Boks ).innerHTML = '<div style="font-weight:bold; color: red;">blad...</div>';
		}	
	});

}



function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}

// -----------------------------------------------------------------------------------

//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		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
		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 = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function setWidth(element,w) {
	   	element = $(element);
    		element.style.width = w +"px";
			}
function setHeight(element,h) {
   		element = $(element);
    		element.style.height = h +"px";
			}
function setInnerHTML(element,content) {
			element = $(element);
			element.innerHTML = content;
			}
function setTop(element,t) {
	   	element = $(element);
	    	element.style.top = t +"px";
			}
function setLeft(element,t) {
	   	element = $(element);
	    	element.style.left = t +"px";
			}

	
function start(szer, foto) {	
	  
	  
		// stretch overlay to fill page and fade in
		var arrayPageSize = getPageSize();
		setHeight('tlo_block', arrayPageSize[1]);
		//new Effect.Appear('tlo_block', { duration: 0.2, from: 0.0, to: 0.8 });

	  	// calculate top offset for the lightbox and display 
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();
		var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 15);
		
		var ile = (arrayPageSize[2]-szer)/2-16
		
		setLeft('galeria', ile);
		setTop('galeria', lightboxTop);
		
	}

function PodmienFoto(tresc, szer){
//var objLoadingImage = document.getElementById( 'foto' );
//objLoadingImage.setAttribute('src', foto_img);

Galeria('galeria', tresc, szer);
}
	
function Galeria(Nazwa,tresc,szer) {

var anchors = document.getElementsByTagName('img');
z=0;
nast=0;
var imageArray = new Array;
var imageSzerArray = new Array;
	
	for (var i=0; i<anchors.length; i++){
		  var anchor = anchors[i];

		  if (anchor.getAttribute('src') && (anchor.getAttribute('rel') == 'galeria_multi'))
		  	  {
				
				asd = anchor.getAttribute('src').replace('/min','');
				szero = anchor.getAttribute('name');
			
			  	if (asd == tresc){
					nast = z;
					}
				imageArray[z] = asd;
				imageSzerArray[z] = szero;
				z++;
			  }
	}
	
		var arrayPageSize = getPageSize();
		setHeight('tlo_block', arrayPageSize[1]);
		//new Effect.Appear('tlo_block', { duration: 0.2, from: 0.0, to: 0.8 });

	  	// calculate top offset for the lightbox and display 
		var arrayPageSize = getPageSize();
		var arrayPageScroll = getPageScroll();
		var lightboxTop = arrayPageScroll[1] + (arrayPageSize[3] / 15);
		
		var ile = (arrayPageSize[2]-szer)/2-16

		setLeft('galeria', ile);
		setTop('galeria', lightboxTop);
	
objFirma = document.getElementById( 'galeria' );
objFirma.style.display="block";

objBlock = document.getElementById('tlo_block');
objBlock.style.display="block";



text='<table cellspacing=0 cellpadding=0 cellpadding=2>';
text+='<tr><td align="left"><img src="tpl/images/logo.gif" class="lgo"></td></tr>';
text+='<tr>';
text+='<td align="right" style="background-color: #ffffff;">';
text+='<img src="tpl/images/zamknij.gif" alt="" onclick="javascript:Galeria_close();"; style="cursor: pointer;margin:12px;margin-bottom:0px;">';
text+='</td></tr>';
text+='<tr><td style="font-size: 12px; background-color: #ffffff; font-size: 11px; text-align:left;"><img src="'+tresc+'" alt="" style="margin:12px;" id="foto">';
text+='</td></tr>';
text+='<tr><td style="background-color: #ffffff; height:40px;" valign="top">';
if (imageArray[nast+1]) text+='<img src="tpl/images/nastepne.gif" class="nastepne" onclick=\'javascript:PodmienFoto("'+imageArray[nast+1]+'", "'+imageSzerArray[nast+1]+'");\' style="cursor: pointer">';
 else text+='<img src="tpl/images/nastepne_non.gif" class="nastepne">';
if (imageArray[nast-1]) text+='<img src="tpl/images/poprzednie.gif" class="poprzednie" onclick=\'javascript:PodmienFoto("'+imageArray[nast-1]+'", "'+imageSzerArray[nast-1]+'");\' style="cursor: pointer"/>';
 else text+='<img src="tpl/images/poprzednie_non.gif" class="poprzednie" />';

text+='</td></tr></table>';
document.getElementById(Nazwa).innerHTML=text;
}

function Galeria_close() {
 objFirma = document.getElementById('galeria');
 objFirma.style.display="none";
 objBlock = document.getElementById('tlo_block');
 objBlock.style.display="none";
}

MM_preloadImages('public/images/menu_01_on.gif','public/images/menu_02_on.gif','public/images/menu_03_on.gif','public/images/menu_04_on.gif');