		var aktualnaStrona; // zmienna przechowująca wartośśc aktualnej strony
		var loadedobjects=""
		var rootdomain="http://"+window.location.hostname
		
		var wlacz_light;
		wlacz_light = false;
		
		var zalogowany;
		zalogowany = 'logowanie';
		var user_login;
		
		aktualnaStrona = 'onyx';
		
		
		var galeriaId; 	// aktualna galeria w ktorej si&#34810;najdujemy
		var fotkaUrl; 		// url aktualnej fotki
		var fotkaOcena; 	// ocena aktualnej fotki
		
		var speed = 0;
		var step = 0;
		var hide = 1000;
		var moveto = 0;
		var left = 0;
		
		// obsluga jQuery 
		
		/*************************************************************************
		  This code is from Dynamic Web Coding at www.dyn-web.com
		  Copyright 2001-4 by Sharon Paine 
		  See Terms of Use at www.dyn-web.com/bus/terms.html
		  regarding conditions under which you may use this code.
		  This notice must be retained in the code as is!
		*************************************************************************/
		
		function initScrollLayer(strona) 
		{			
			if (strona == 'i')
			{
				document.getElementById("loader").style.display = "none";
				
				jQuery.noConflict();
				
				// formularz logowania inicjalizacja
				advAJAX.assign(document.getElementById("loginForm"), 
				{
					onInitialization : function(obj) 
					{
						user_login = obj.parameters["login"];
						obj.parameters["haslo"] = hex_md5(obj.parameters["haslo"]);
					   document.getElementById("submitBtn").value = "Proszę czekać...";
					},
					
					onComplete : function() 
					{
						document.getElementById("submitBtn").value = "LOGUJ";
					},
					
					onSuccess : function(obj) 
					{
						switch (obj.responseText)
						{
							case "m":
								zmienStrone('miasto.php?akcja=miasto&');
								break;
								
							case "z":
								zmienStrone('weryfikacja.php?akcja=sms&');
								break;
								
							case "p":
								zmienStrone("weryfikacja.php?akcja=potwierdz&");
								break;
								
							case "1":
								zalogowany = 'loguj.php';
								Element.setInnerHTML( 'status_loguj', user_login);
								zmienStrone('loguj.php');
								break;
								
							default:
								zmienStrone('loguj.php');
						}
					},
					
					onError : function(obj) { }
				});		
				
				// **************************************************************	
				
				pokazOnyx();
				ukryjStrony();
			}
			
		  // arguments: id of layer containing scrolling layers (clipped layer), id of layer to scroll, 
		  // if horizontal scrolling, id of element containing scrolling content (table?)
		  var wndo = new dw_scrollObj('scro1', 'kol1');
		  
		  // bSizeDragBar set true by default (explained at www.dyn-web.com/dhtml/scroll/ )
		  // wndo.bSizeDragBar = false;
		  
		  // arguments: dragBar id, track id, axis ("v" or "h"), x offset, y offset
		  // (x/y offsets of dragBar in track)
		  wndo.setUpScrollbar("dragBar1", "track1", "v", 0, 1);
		  
		  // pass id('s) of scroll area(s) if inside table(s)
		  // i.e., if you have 3 (with id's wn1, wn2, wn3): dw_scrollObj.GeckoTableBugFix('wn1', 'wn2', 'wn3');
		  dw_scrollObj.GeckoTableBugFix('scro1'); 
			
		  var wndo = new dw_scrollObj('scro2', 'kol2');	
		  wndo.setUpScrollbar("dragBar2", "track2", "v", 0, 1);
		  dw_scrollObj.GeckoTableBugFix('scro2'); 	
			
		  var wndo = new dw_scrollObj('scro3', 'kol3');	
		  wndo.setUpScrollbar("dragBar3", "track3", "v", 0, 1);
		  dw_scrollObj.GeckoTableBugFix('scro3'); 
		  
		}
		
		// ***********************************************************************************
		
		function ajaxpage(url, containerid)
		{
			document.getElementById("loader").style.display = "block";
			
			url = url + "?RandomKey=" + Math.random() * Date.parse(new Date());
			
			var page_request = false
			if (window.XMLHttpRequest) // if Mozilla, Safari etc
				page_request = new XMLHttpRequest()
			
			else if (window.ActiveXObject)
			{ // if IE
				try 
				{
					page_request = new ActiveXObject("Msxml2.XMLHTTP")
				} 
				catch (e)
				{
					try
					{
						page_request = new ActiveXObject("Microsoft.XMLHTTP")
					}
					catch (e){}
				}
			}
			
			else return false

			page_request.onreadystatechange=function()
			{
				if (page_request.readyState==4)
				{
					document.getElementById("loader").style.display = "none";
				}
				
				loadpage(page_request, containerid)
			}
			
			//page_request.onSuccess= usunLoader;
			page_request.open('GET', url, true)
			page_request.send(null)
		}
		
		function usunLoader() 
		{
			document.getElementById("loader").style.display = "none";
		}

		function loadpage(page_request, containerid)
		{
			if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
				document.getElementById(containerid).innerHTML=page_request.responseText
		}

		function loadobjs()
		{
			if (!document.getElementById) 
			{
				return
				for (i=0; i<arguments.length; i++)
				{
					var file=arguments[i]
					var fileref=""
					
					if (loadedobjects.indexOf(file)==-1)
					{ //Check to see if this object has not already been added to page before proceeding
						
						if (file.indexOf(".js")!=-1)
						{ //If object is a js file
							fileref=document.createElement('script')
							fileref.setAttribute("type","text/javascript");
							fileref.setAttribute("src", file);
						}
						
						else if (file.indexOf(".css")!=-1)
						{ //If object is a css file
							fileref=document.createElement("link")
							fileref.setAttribute("rel", "stylesheet");
							fileref.setAttribute("type", "text/css");
							fileref.setAttribute("href", file);
						}
					}
					
					if (fileref!="")
					{
						document.getElementsByTagName("head").item(0).appendChild(fileref)
						loadedobjects+=file+" " //Remember this object as being already added to page
					}
				}
			}
		}
		
		// ***********************************************************************************
		
		function opacity(id, opacStart, opacEnd, millisec) 
		{ 
    		//speed for each frame 
    		var speed = Math.round(millisec / 100); 
   	 	var timer = 0; 

    		//determine the direction for the blending, if start and end are the same nothing happens 
    		
			if(opacStart > opacEnd) 
			{ 
        		for(i = opacStart; i >= opacEnd; i--) 
				{ 
            	setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            	timer++; 
        		} 
    		} 
			
			else if(opacStart < opacEnd) 
			{ 
        		for(i = opacStart; i <= opacEnd; i++) 
            { 
            	setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            	timer++; 
        		} 
    		} 
		} 

		//change the opacity for different browsers 
		function changeOpac(opacity, id) 
		{ 
    		var object = document.getElementById(id).style; 
    		object.opacity = (opacity / 100); 
    		object.MozOpacity = (opacity / 100); 
    		object.KhtmlOpacity = (opacity / 100); 
    		object.filter = "alpha(opacity=" + opacity + ")"; 
		} 

		function shiftOpacity(id, millisec) 
		{ 
    		//if an element is invisible, make it visible, else make it ivisible 
    		if(document.getElementById(id).style.opacity == 0) 
			{ 
        		opacity(id, 0, 100, millisec); 
    		} 
			
			else 
			{ 
        		opacity(id, 100, 0, millisec); 
    		} 
		} 
		
		// ***********************************************************************************
		
		function pokazOnyx()
		{	
			document.getElementById('coNowego').style.display = 'block';
			document.getElementById('eventy').style.display = 'block';
			document.getElementById('inne').style.display = 'block';		
			
			setTimeout("opacity('coNowego',0, 100, 300)", 300);
			setTimeout("opacity('eventy',0, 100, 300)", 600);
			setTimeout("opacity('inne',0, 100, 300)", 900);
			

		}
		
		function ukryjOnyx()
		{						
			opacity('coNowego',100, 0, 300);
			setTimeout("opacity('eventy',100, 0, 300)", 300);
			setTimeout("opacity('inne',100, 0, 300)", 600);
			
			setTimeout("document.getElementById('coNowego').style.display = 'none'", 900);
			setTimeout("document.getElementById('eventy').style.display = 'none'", 900);
			setTimeout("document.getElementById('inne').style.display = 'none'", 900);
		}
		
		function pokazStrony(czas)
		{			
			setTimeout("document.getElementById('zawartosc').style.display = 'block'", czas);
			
			setTimeout("opacity('zawartosc',0, 100, 300)", czas);
		}
		
		function ukryjStrony(czas)
		{			
			opacity('zawartosc',100, 0, 300);

			setTimeout("document.getElementById('zawartosc').style.display = 'none'", czas);
		}
		
		function pokazLogowanie(czas)
		{			
			setTimeout("document.getElementById('logowanie').style.display = 'block'", czas);
			
			setTimeout("opacity('logowanie',0, 100, 300)", czas);
		}
		
		function ukryjLogowanie(czas)
		{			
			opacity('logowanie',100, 0, 300);

			setTimeout("document.getElementById('logowanie').style.display = 'none'", czas);
		}
		// ***********************************************************************************
		
		function zmienStrone(strona)
		{	
			var czas;
			czas = 900;
			czasS = 300;
			
			if (strona == aktualnaStrona) return;
			
			if (strona == "onyx")
			{
				if (aktualnaStrona != "logowanie") ukryjStrony(czasS);
				else ukryjLogowanie(czasS);
				
				pokazOnyx();
				aktualnaStrona = strona;
				
				akts = aktualnaStrona.substr(0,11);
				
				if (aktualnaStrona == "fotka.php") document.getElementById("fotka_ms_last").style.display = "block";
				else document.getElementById("fotka_ms_last").style.display = "none";
				
				return;
			}
			
			if (strona == "logowanie")
			{
				if (aktualnaStrona != "onyx") 
				{
					ukryjStrony(0)
					czas = 0;
				}
				else ukryjOnyx();

				pokazLogowanie(czas);
				aktualnaStrona = strona;
				
				akts = aktualnaStrona.substr(0,11);
				
				if (aktualnaStrona == "fotka.php") document.getElementById("fotka_ms_last").style.display = "block";
				else document.getElementById("fotka_ms_last").style.display = "none";
				
				return;
			}

			// *****************************************
			
			if (aktualnaStrona == "onyx") 
			{
				ukryjOnyx();
				pokazStrony(czas);
			}
			
			if (aktualnaStrona == "logowanie") 
			{
				ukryjLogowanie(0);
				pokazStrony(300);
			}
			
			urlStrony = '_site/' + strona;
			
			ajaxpage(urlStrony, 'zawartosc');

			aktualnaStrona = strona;
			
			akts = aktualnaStrona.substr(0,11);
				
			if (aktualnaStrona == "fotka.php") document.getElementById("fotka_ms_last").style.display = "block";
			else document.getElementById("fotka_ms_last").style.display = "none";
		}
		
		// ***********************************************************************************
		
		function wyloguj()
		{
			ajaxpage('_site/loguj.php?akcja=wyloguj&', 'zawartosc');
			zalogowany = 'logowanie';
			Element.setInnerHTML( 'status_loguj', 'niezalogowany');

			zmienStrone(zalogowany);

		}
		
		// ***********************************************************************************
		
		function light_on()
		{
			if (!wlacz_light)
			{
				initLightbox();
				wlacz_light = true;
			}
		}
			
		// ***********************************************************************************

	    function jqueryInit(ocena)
	    {
	        init_rating(ocena);
	    }
		 
		 // ***********************************************************************************
		 
		 function formularzRejestracji()
		 {
		 		advAJAX.assign(document.getElementById("rejestrujForm"), 
				{
					onInitialization : function(obj) 
					{
					   document.getElementById("rejestrujBtn").value = "proszę czekać...";
					},
					
					onComplete : function() 
					{
						document.getElementById("rejestrujBtn").value = "zakończono rejestracje";
					},
					
					onSuccess : function(obj) 
					{
						if (obj.responseText == "1") zmienStrone('rejestracja.php?akcja=brak_login&');
						if (obj.responseText == "2") zmienStrone('rejestracja.php?akcja=brak_mail&');
						if (obj.responseText == "3") zmienStrone('rejestracja.php?akcja=zly_mail&');
						if (obj.responseText == "4") zmienStrone('rejestracja.php?akcja=istnieje_login&');
						if (obj.responseText == "5") zmienStrone('rejestracja.php?akcja=istnieje_mail&');
						if (obj.responseText == "6") zmienStrone('rejestracja.php?akcja=dlugosc_login&');
						if (obj.responseText == "7") zmienStrone('rejestracja.php?akcja=zle_hasla&');
						if (obj.responseText == "8") zmienStrone('rejestracja.php?akcja=zle_maile&');
						if (obj.responseText == "9") zmienStrone('rejestracja.php?akcja=brak_hasla&');
						if (obj.responseText == "10") zmienStrone('rejestracja.php?akcja=niepelnoletni&');
						if (obj.responseText == "11") zmienStrone('rejestracja.php?akcja=zly_telefon&');
						if (obj.responseText == "12") zmienStrone('rejestracja.php?akcja=brak_imie&');
						if (obj.responseText == "13") zmienStrone('rejestracja.php?akcja=istnieje_telefon&');
						
						if (obj.responseText == "0") zmienStrone('rejestracja.php?akcja=sukces&');
					},
					
					onError : function(obj) { }
				});	
		 }
		 
		 // ***********************************************************************************
		 
		 function formularzInfoonyx()
		 {
		 		advAJAX.assign(document.getElementById("infoonyxForm"), 
				{
					onInitialization : function(obj) 
					{
					   document.getElementById("infoonyxBtn").value = "proszę czekać...";
					},
					
					onComplete : function() 
					{
						document.getElementById("infoonyxBtn").value = "zakończono rejestracje";
					},
					
					onSuccess : function(obj) 
					{
						if (obj.responseText == "1") zmienStrone('infoonyx.php?akcja=brak_mail&');
						if (obj.responseText == "2") zmienStrone('infoonyx.php?akcja=brak_telefon&');
						if (obj.responseText == "3") zmienStrone('infoonyx.php?akcja=dlugi_mail&');
						if (obj.responseText == "4") zmienStrone('infoonyx.php?akcja=zly_mail&');
						if (obj.responseText == "5") zmienStrone('infoonyx.php?akcja=zly_telefon&');
						if (obj.responseText == "6") zmienStrone('infoonyx.php?akcja=zmiana&');
						
						if (obj.responseText == "0") zmienStrone('infoonyx.php?akcja=sukces&');
					},
					
					onError : function(obj) { }
				});	
		 }
		 
		 // ***********************************************************************************
		 
		 function formularzKontakt()
		 {
		 		advAJAX.assign(document.getElementById("kontaktForm"), 
				{
					onInitialization : function(obj) 
					{
						obj.parameters["galeria"] = galeriaId;
						obj.parameters["zdjecie"] = fotkaUrl;
					   document.getElementById("kontaktBtn").value = "proszę czekać...";
					},
					
					onComplete : function() 
					{
						document.getElementById("kontaktBtn").value = "wyślij wiadomość";
					},
					
					onSuccess : function(obj) 
					{						
						if (obj.responseText == "0") zmienStrone('kontakt.php?wyslano=tak&');
					},
					
					onError : function(obj) { }
				});	
		 }
		 
		 // ***********************************************************************************
		 
		 function formularzWyslijZnaj()
		 {
		 		advAJAX.assign(document.getElementById("wyslijZnajForm"), 
				{
					onInitialization : function(obj) 
					{
						obj.parameters["galeria"] = galeriaId;
						obj.parameters["zdjecie"] = fotkaUrl;
					   document.getElementById("wyslijZnajBtn").value = "proszę czekać...";
					},
					
					onComplete : function() 
					{
						document.getElementById("wyslijZnajBtn").value = "wylij";
					},
					
					onSuccess : function(obj) 
					{						
						if (obj.responseText == "0") ajaxpage('_site/wyslij_zdjecie.php?akcja=sukces&' , 'l_zam');
						if (obj.responseText == "2") ajaxpage('_site/wyslij_zdjecie.php?akcja=blad&' , 'l_zam');
						if (obj.responseText == "3") ajaxpage('_site/wyslij_zdjecie.php?akcja=zly_email&' , 'l_zam');
						if (obj.responseText == "-1") ajaxpage('_site/wyslij_zdjecie.php?akcja=zaloguj&' , 'l_zam');
					},
					
					onError : function(obj) { }
				});	
		 }
		 
		 // ***********************************************************************************
		 
		 function formularzZamowOdb()
		 {
		 		advAJAX.assign(document.getElementById("odbitkaForm"), 
				{
					onInitialization : function(obj) 
					{
						obj.parameters["galeria"] = galeriaId;
						obj.parameters["zdjecie"] = fotkaUrl;
					   document.getElementById("odbitkaBtn").value = "proszę czekać...";
					},
					
					onComplete : function() 
					{
						document.getElementById("odbitkaBtn").value = "zamów";
					},
					
					onSuccess : function(obj) 
					{						
						if (obj.responseText == "0") ajaxpage('_site/odbitka.php?akcja=sukces&' , 'l_zam');
						if (obj.responseText == "2") ajaxpage('_site/odbitka.php?akcja=blad&' , 'l_zam');
						if (obj.responseText == "-1") ajaxpage('_site/odbitka.php?akcja=zaloguj&' , 'l_zam');
					},
					
					onError : function(obj) { }
				});	
		 }
		 
		 // ***********************************************************************************
		 
		 function formularzKariera()
		 {
		 		advAJAX.assign(document.getElementById("karieraForm"), 
				{
					onInitialization : function(obj) 
					{
					   document.getElementById("karieraBtn").value = "proszę czekać...";
					},
					
					onComplete : function() 
					{
						document.getElementById("karieraBtn").value = "wyślij";
					},
					
					onSuccess : function(obj) 
					{						
						if (obj.responseText == "0") zmienStrone('kariera.php?akcja=sukces&');
						if (obj.responseText == "1") zmienStrone('kariera.php?akcja=blad&');
						if (obj.responseText == "2") zmienStrone('kariera.php?akcja=zly_mail&');
					},
					
					onError : function(obj) { }
				});	
		 }
		 
		 // ***********************************************************************************
		 
		 function formularzHaslo()
		 {
		 		advAJAX.assign(document.getElementById("hasloForm"), 
				{
					onInitialization : function(obj) 
					{
					   document.getElementById("hasloBtn").value = "proszę czekać...";
					},
					
					onComplete : function() 
					{
						document.getElementById("hasloBtn").value = "WYŚLIJ";
					},
					
					onSuccess : function(obj) 
					{						
						if (obj.responseText == "0") zmienStrone('haslo.php?akcja=sukces&');
					},
					
					onError : function(obj) { }
				});	
		 }
		 
		 // ***********************************************************************************
		 
		 function formularzMiasto()
		 {
		 		advAJAX.assign(document.getElementById("miastoForm"), 
				{
					onInitialization : function(obj) 
					{
					   document.getElementById("miastoBtn").value = "proszę czekać...";
					},
					
					onComplete : function() 
					{
						document.getElementById("miastoBtn").value = "LOGUJ";
					},
					
					onSuccess : function(obj) 
					{
						if (obj.responseText == "1") 
						{
							zalogowany = 'loguj.php';
							Element.setInnerHTML( 'status_loguj', user_login);
						}
						
						zmienStrone('loguj.php');
					},
					
					onError : function(obj) { }
				});	
		 }
		 
		 // ***********************************************************************************
		 
		 function formularzWeryfikacja()
		 {
		 		advAJAX.assign(document.getElementById("weryfikacjaForm"), 
				{
					onInitialization : function(obj) 
					{
						user_login = obj.parameters["login"];
					   //document.getElementById("weryfikacjaBtn").value = "proszę czekać...";
					},
					
					onComplete : function() 
					{
						//document.getElementById("weryfikacjaBtn").value = "WYŚLIJ HASŁO NA SMS";
					},
					
					onSuccess : function(obj) 
					{
						switch (obj.responseText)
						{
							case "telefon_ok":
								zmienStrone("weryfikacja.php?akcja=potwierdz&");
								break;
								
							case "telefon_jest":
								zmienStrone('weryfikacja.php?akcja=sms&msg=telefon_jest&');
								break;
								
							case "telefon_zly":
								zmienStrone("weryfikacja.php?akcja=sms&msg=telefon_zly&");
								break;
								
							case "weryfikacja_error":
								zmienStrone("weryfikacja.php?akcja=potwierdz&msg=weryfikacja_error&");
								break;
						
							case "weryfikacja_ok":
								zalogowany = 'loguj.php';
								Element.setInnerHTML( "status_loguj", user_login);
								zmienStrone("weryfikacja.php?akcja=sukces&");
								break;
						}
					},
					
					onError : function(obj) { }
				});	
		 }
		 
		 // ***********************************************************************************
		 
		 function formularzUzytkownik()
		 {
		 		advAJAX.assign(document.getElementById("uzytkownikForm"), 
				{
					onInitialization : function(obj) 
					{
					   document.getElementById("uzytkownikBtn").value = "proszę czekać...";
					},
					
					onComplete : function() 
					{
						document.getElementById("uzytkownikBtn").value = "ZAPISZ USTAWIENIA";
					},
					
					onSuccess : function(obj) 
					{
						switch (obj.responseText)
						{
							case "ok":
								zmienStrone("uzytkownik.php?msg=ok&");
								break;
						}
					},
					
					onError : function(obj) { }
				});	
		 }
		 
		 // ***********************************************************************************
		 
		 function pokazWyslijZnaj()
		 {
		 	document.getElementById("l_zam").style.display = "block";
		 	ajaxpage('_site/wyslij_zdjecie.php', 'l_zam');
		 }
		 
		// ***********************************************************************************
		 
		 function pokazZamowOdb()
		 {
		 	document.getElementById("l_zam").style.display = "block";
		 	ajaxpage('_site/odbitka.php', 'l_zam');
		 }
		 
		 // ***********************************************************************************
		 
		 function popup(px, py, purl)
		 {
		 	window.open(purl,"_blank","width="+px+",height="+py+",scrollbars=no,status=no,toolbar=no,menubar=no,location=no");
		 }
		 
		 // ***********************************************************************************
		 
		 function wiecejGalerii()
		 {
		 	if (document.getElementById('galWiecej').style.display == 'none') document.getElementById('galWiecej').style.display = 'block';
			else document.getElementById('galWiecej').style.display = 'none'
		 }
		 
		 // ***********************************************************************************
		 
		function removeElement(divNum) 
		{
		  	var olddiv = document.getElementById(divNum);
		  	document.body.removeChild(olddiv);
		}
		
		// ***********************************************************************************
		
		function video_popup(px, py, purl)
		{
			window.open(purl,"_blank","width="+px+",height="+py+",scrollbars=no,status=no,toolbar=no,menubar=no,location=no");
		}
		
		function openYouTube(id){
				var isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
				
				if (isIE6) 
				{
					video_popup('640', '480', 'http://www.youtube.com/v/' + id);
					return;
				}
				
		      //YouTube Player Parameters
		      var width = 640;
		      var height = 505;
		      var FullScreen = "yes";
		      var AutoPlay = "yes";
		      var HighDef = "yes";
		     
		      //Calculate Page width and height
		      var pageWidth = window.innerWidth;
		      var pageHeight = window.innerHeight;
		      if (typeof pageWidth != "number"){
		      if (document.compatMode == "CSS1Compat"){
		            pageWidth = document.documentElement.clientWidth;
		            pageHeight = document.documentElement.clientHeight;
		      } else {
		            pageWidth = document.body.clientWidth;
		            pageHeight = document.body.clientHeight;
		            }
		      }
		      // Make Background visible...
		      var divbg = document.getElementById('bg');
		      divbg.style.visibility = "visible";
		     
		      //Create dynamic Div container for YouTube Popup Div
		      var divobj = document.createElement('div');
		      divobj.setAttribute('id',id); // Set id to YouTube id
		      divobj.className = "popup";
		      divobj.style.visibility = "visible";
		      var divWidth = width + 4;
		      var divHeight = height + 20;
		      divobj.style.width = divWidth + "px";
		      divobj.style.height = divHeight + "px";
		      var divLeft = (pageWidth - divWidth) / 2;
		      var divTop = (pageHeight - divHeight) / 2 - 10;
		      //Set Left and top coordinates for the div tag
		      divobj.style.left = divLeft + "px";
		      divobj.style.top = divTop + "px";
		     
		      //Create dynamic Close Button Div
		      var closebutton = document.createElement('div');
		      closebutton.style.visibility = "visible";
		      closebutton.innerHTML = "<span onclick=\"closeYouTube('" + id +"')\" class=\"close_button\">X</span>";
		      //Add Close Button Div to YouTube Popup Div container
		      divobj.appendChild(closebutton);

		      //Create dynamic YouTube Div
		      var ytobj = document.createElement('div');
		      ytobj.setAttribute('id', "yt" + id);
		      ytobj.className = "ytcontainer";
		      ytobj.style.width = width + "px";
		      ytobj.style.height = height + "px";
		      if (FullScreen == "yes") FullScreen="&fs=1"; else FullScreen="&fs=0";
		      if (AutoPlay == "yes") AutoPlay="&autoplay=1"; else AutoPlay="&autoplay=0";
		      if (HighDef == "yes") HighDef="&hd=1"; else HighDef="&hd=0";
		      var URL = "http://www.youtube.com/v/" + id + "&hl=en&rel=0&showsearch=0" + FullScreen + AutoPlay + HighDef;
		      var YouTube = "<object width=\"" + width + "\" height=\"" + height + "\">";
		      YouTube += "<param name=\"movie\" value=\"" + URL + "\"></param>";
		      YouTube += "<param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param>";
		      YouTube += "<embed src=\"" + URL + "\" type=\"application/x-shockwave-flash\" ";
		      YouTube += "allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"" + width + "\" height=\"" + height + "\"></embed></object>";
		      ytobj.innerHTML = YouTube;
		      //Add YouTube Div to YouTube Popup Div container
		      divobj.appendChild(ytobj);
		     
		      //Add YouTube Popup Div container to HTML BODY
		      document.body.appendChild(divobj);
		}

		function openVimeo(id){
				var isIE6 = /msie|MSIE 6/.test(navigator.userAgent);

				var id = id.substr(8);

				if (isIE6)
				{
					video_popup('640', '480', 'http://vimeo.com/moogaloop.swf?' + id);
					return;
				}

		      //YouTube Player Parameters
		      var width = 640;
		      var height = 505;

		      //Calculate Page width and height
		      var pageWidth = window.innerWidth;
		      var pageHeight = window.innerHeight;
		      if (typeof pageWidth != "number"){
		      if (document.compatMode == "CSS1Compat"){
		            pageWidth = document.documentElement.clientWidth;
		            pageHeight = document.documentElement.clientHeight;
		      } else {
		            pageWidth = document.body.clientWidth;
		            pageHeight = document.body.clientHeight;
		            }
		      }
		      // Make Background visible...
		      var divbg = document.getElementById('bg');
		      divbg.style.visibility = "visible";

		      //Create dynamic Div container for YouTube Popup Div
		      var divobj = document.createElement('div');
		      divobj.setAttribute('id', id); // Set id to YouTube id
		      divobj.className = "popup";
		      divobj.style.visibility = "visible";
		      var divWidth = width + 4;
		      var divHeight = height + 20;
		      divobj.style.width = divWidth + "px";
		      divobj.style.height = divHeight + "px";
		      var divLeft = (pageWidth - divWidth) / 2;
		      var divTop = (pageHeight - divHeight) / 2 - 10;
		      //Set Left and top coordinates for the div tag
		      divobj.style.left = divLeft + "px";
		      divobj.style.top = divTop + "px";

		      //Create dynamic Close Button Div
		      var closebutton = document.createElement('div');
		      closebutton.style.visibility = "visible";
		      closebutton.innerHTML = "<span onclick=\"closeYouTube('" + id +"')\" class=\"close_button\">X</span>";
		      //Add Close Button Div to YouTube Popup Div container
		      divobj.appendChild(closebutton);

		      //Create dynamic YouTube Div
		      var ytobj = document.createElement('div');
		      ytobj.setAttribute('id', "yt" + id);
		      ytobj.className = "ytcontainer";
		      ytobj.style.width = width + "px";
		      ytobj.style.height = height + "px";

		      var URL = "http://vimeo.com/moogaloop.swf?clip_id=" + id;
		      var YouTube = "<object width=\"" + width + "\" height=\"" + height + "\">";

		      YouTube += "<param name=\"movie\" value=\"" + URL + "\"></param>";
		      YouTube += "<param name=\"allowFullScreen\" value=\"true\"></param><param name=\"allowscriptaccess\" value=\"always\"></param>";

			  YouTube += "<param name=\"flashvars\" value=\"fullscreen=true\"></param>";

		      YouTube += "<embed src=\"" + URL + "\" type=\"application/x-shockwave-flash\" ";
		      YouTube += "allowscriptaccess=\"always\" allowfullscreen=\"true\" width=\"" + width + "\" height=\"" + height + "\" flashvars=\"fullscreen=true\"></embed></object>";
		      ytobj.innerHTML = YouTube;
		      //Add YouTube Div to YouTube Popup Div container
		      divobj.appendChild(ytobj);

		      //Add YouTube Popup Div container to HTML BODY
		      document.body.appendChild(divobj);
		}


		function closeYouTube(id){
		      var divbg = document.getElementById('bg');
		      divbg.style.visibility = "hidden";
		      var divobj = document.getElementById(id);
		      var ytobj = document.getElementById("yt" + id);
		      divobj.removeChild(ytobj); //remove YouTube Div
		      document.body.removeChild(divobj); // remove Popup Div
		}
		
		// ***********************************************************************************
		
		function movein()
		{
  			if (document.layers) 
			{
        		document.layers['message'].pageX = window.pageXOffset + left;
        		left+=step;
        		if(left<moveto) setTimeout('movein()',speed); 
        		else setTimeout('closemessage()',hide);
    		}
   
  			else
			{
				document.getElementById('message').style.left=left+'px';
				left+=step;
				if(left<moveto) setTimeout('movein()',speed); 
				else setTimeout('closemessage()',hide);
  			}
		}
		
		// ***********************************************************************************
		
		function closemessage()
		{
        if (document.layers) document.layers['message'].visibility='hidden';
        else document.getElementById('message').style.visibility='hidden';
		}
		
		// ***********************************************************************************
		
		function wyniki(url, width, height) 
		{
			var Win = window.open(url,"pokaz",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=yes,menubar=no' )
		}
		
		function scrollToGallery(__newUrl)
		{
			//get the top offset of the target anchor
	        var targetOffset = document.getElementById('bottom').offsetTop;
			try
			{
				var targetMinus = document.getElementById('photos-holder').clientHeight +50;
				//alert(targetMinus);
			}
			
			catch (err)
			{
				var targetMinus = 0;
			}

	        //goto that anchor by setting the body scroll top to anchor top
	        scroll(0, (targetOffset - targetMinus));
			
			zmienStrone(__newUrl);
		}
