/**
 * Zestaw parametrów i metod konfiguracyjnych
 */
var _config = {
	/* adres bazowy strony - wartość ustawiana w init */
	base_url :null,

	/* kontroler i akcja (wypełniane w head) */
	controller :null,
	action :null,
	
	user_logged :null,
	lang :null,
	ip :null,
	sesja :null,

	/* operacje wykonywane po załadowaniu dokumentu */
	init_common : function(){
		// bazowy URL strony
		this.base_url = location.href.match(/^(https?:\/\/[^\/]*\/)/)[1];
	
		// konfiguracja AJAX-a
		$.ajaxSetup({
			cache :false
		});
	
		this.init();
	},
	
	/**
	 * Ta metoda jest wywoływana zawsze po init_common. Metodę nadpisujemy w
	 * rozszerzeniach poprzez: jQuery.extend( _config, { init: { <tutaj kod> } } );
	 */
	init : function(){
	}
};




/**
 * Główny zestaw metod
 */  
 
var _main = {
	_this :null,

	/* operacje wykonywane po załadowaniu dokumentu */
	init_common : function(){
		/* nadanie linkom zewnetrznym atrybutu target="_blank" */
		this.external_links();

		this.init();

		/* inicjalizacja kodu dla kontrolera i akcji */
		/*
		WYLACZONE Z POWODU BLEDU
		var controller = _config.controller.charAt(0).toUpperCase() +
						 _config.controller.substr(1).replace(/-[a-z]/ig, function(s){ return s.substr(1, 1).toUpperCase(); });
		if (typeof (window[controller]) == "object") {
			this._this = window[controller];
			var action = _config.action.replace(/-[a-z]/ig, function(s){ return s.substr(1, 1).toUpperCase(); }) + "Action";
			if (typeof (window[controller]["init"]) == "function") { window[controller]["init"](); }
			if (typeof (window[controller][action]) == "function") { window[controller][action](); }
		}
	
*/
		
		
	},

	
	/**
	 * Ta metoda jest wywoływana zawsze po init_common (ale przed wywołaniem
	 * akcji kontrolera). Metodę nadpisujemy w rozszerzeniach poprzez:
	 * jQuery.extend( _main, { init: { <tutaj kod> } } );
	 */
	init : function(){	
		
		$('#search_frase').inputHint();				
		$('#polec_znajomemu_a').bind('click',function(){
			komunikaty.pokaz('polec-znajomemu', '', '');
			$('#polecenie .button').bind('mouseover',function(){ $(this).addClass('hover'); }).bind('mouseout',function(){ $(this).removeClass('hover'); });
			$('#polecenie .button a').bind('click', _main.polec_znajomemu)
			return false;
		});
		$('#newsletter_a').bind('click',function(){
			komunikaty.pokaz('newsletter', '', '');
			$('#polecenie .button').bind('mouseover',function(){ $(this).addClass('hover'); }).bind('mouseout',function(){ $(this).removeClass('hover'); });
			$('#newsletter_dodaj').bind('click', function(){ _config.newsletter_action = 'add'; _main.newsletter(); return false; });
			$('#newsletter_usun').bind('click', function(){ _config.newsletter_action = 'dell'; _main.newsletter(); return false; });
			$('#polecenie').bind('submit', function(e) { e.preventDefault(); });
			return false;
		});
		$('#nav').droppy({speed:100});
		
		// ogolne submity
		$('#submit').bind('click',function(){
			$(this).parents('form:first').submit();
			return false;
		});
		
		// przycisk wyszukiwarki
		$('#search_button').bind('click',function(e){
			e.preventDefault();
			document.getElementById('form_wyszukiwarka').submit();
			return false;
		});
		// klikniecie entera w polu wyszukiwarki
		$('#search_frase').bind('keypress',function(e){
			if($.browser.msie && (window.event && window.event.keyCode == 13)){
				document.getElementById('form_wyszukiwarka').submit();
			}
		});
		
		$('#bookmarksite').bind('click',function(){
			_main.bookmarksite();
		});
		$('#artykul div.pag a.inactive, a.empty').bind('click',function(){ return false; });
		
		if($.browser.msie){
			$('#artykul .galeria a').hover(
					function(){ $(this).children('img.lupa').css({'height':'144px','width':'144px','display':'block'}); },
					function(){ $(this).children('img.lupa').css({'height':'0px','width':'144px','display':'none'}); }
			);
		}
		
	},

	// przewija stronę na samą górę (bez użycia "#")
	scrollToTop : function(){
		$(document).scrollTop(0);
	},

	/* nadanie linkom zewnetrznym atrybutu target="_blank" */
	external_links : function(){
		$("a[rel='external']").each( function(i){
			this.target = "_blank";
		});
	},
	
	polec_znajomemu : function(){		
		var dane = {
			 'rodzaj_akcji'		: 'polec-znajomemu'
			,'email_odbiorcy'	: document.getElementById('email_odbiorcy').value
			,'imie_nazwisko'	: document.getElementById('imie_nazwisko').value
			,'email_nadawcy'	: document.getElementById('email_nadawcy').value
			,'tresc'			: document.getElementById('tresc').value
		}
		$.post(_config.base_url + "polec.html", dane, function(data){
			$('#polecenie span').not('.button').html('').css('display','none');
			if(!data.ok){
				for(x in data.bledy){
					//alert( x + ': ' + data.bledy[x] );
					$('#'+x+'_error').css('display','block').text(data.bledy[x]);
				}
			}else{
				document.getElementById('polec-naglowek').innerHTML = 'Wiadomość wysłana pomyślnie';
				document.getElementById('polecenie').innerHTML = '<p style="text-align:left;padding-left:12px;margin-top:8px;">Dziękujemy za polecenie naszej strony</p>';
			}
		}, 'json');
		return false;
	},

	potwierdz_kontakt : function(){		
		var dane = {
			 'rodzaj_akcji'		: 'potwierdz-kontakt'
		}
		$.post(_config.base_url + "polec.html", dane, function(data){
			$('#polecenie span').not('.button').html('').css('display','none');			
			document.getElementById('polec-naglowek').innerHTML = 'Wiadomość wysłana pomyślnie';
			document.getElementById('polecenie').innerHTML = '<p style="text-align:left;padding-left:12px;margin-top:8px;">Dziękujemy za kontakt z naszym zespołem</p>';			
		}, 'json');
		return false;
	},

	
	bookmarksite : function(){
		
		// add a "rel" attrib if Opera 7+
		// don't overwrite the rel attrib if already set
		if(window.opera) if ($("#bookmarksite").attr("rel") != "") $("#bookmarksite").attr("rel","sidebar");
		
		$("#bookmarksite").click(function(event){
			event.preventDefault(); // prevent the anchor tag from sending the user off to the link
			var url = location.href;
			var title = this.title;
			
			if (window.sidebar) { // Mozilla Firefox Bookmark
				window.sidebar.addPanel(title, url,"");
			} else if( window.external ) { // IE Favorite
				window.external.AddFavorite( url, title);
			} else if(window.opera) { // Opera 7+
				return false; // do nothing - the rel="sidebar" should do the trick
			} else { // for Safari, Konq etc - browsers who do not support bookmarking scripts (that i could find anyway)
				return false;
			}
		});
	},

	newsletter: function(){		
		if(_main.email(document.getElementById('newsletter_email').value)){
			//http://www.mailpro.pl/mailpro/ajaxact.php?mail=lp@positive-power.pl&grup=1&ip=1.1.1.1&sesja=08ddbe61f374676d26d505755ea9a7a7&userid=53&action=add
			var dane = {
				 'mail'		: document.getElementById('newsletter_email').value
				,'grup'		: '10'
				,'userid'	: '126'
				,'ip'		: _config.ip
				,'sesja'	: _config.sesja
				,'action'	: _config.newsletter_action
			};			
			// wywolujemy funckję mailproFeedback z obiektu _main
			$.getJSON( 'http://www.mailpro.pl/mailpro/ajaxact.php?object=_main&call=?', dane );
		}else{
			$('#newsletter_komunikat').css('display','none').text(Translator.newsletter['bledny_email']).show('slow').animate({opacity:1.0},2000).hide('slow');
		}
		
		return false;
	},
	
	mailproFeedback: function(data){
		var komunikat = Translator.newsletter[data.komunikat];
		komunikat = komunikat || 'brak tlumaczenia'
		$('#newsletter_komunikat').css('display','none').text(komunikat).show('slow').animate({opacity:1.0},2000).hide('slow');
	},
	// email validation
	email: function(value, element) {
		// contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
		return /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(value);
	}

};


$(document).ready( function(){
	_config.init_common();
	_main.init_common();
	
});

try { document.execCommand('BackgroundImageCache', false, true); } catch (e) {}

/**
 * Komunikaty
 */

var komunikaty = {
	/* inicjalizacja komunikatu wyświetlonego przez skrypt po stronie serwera */
	init : function(){
		this.ustaw_przyciski();
	},

	/* wyświetla komunikat danego rodzaju */
	pokaz : function(rodzaj, tytul, tresc, link_ok, link_anuluj){
		//alert("rodzaj="+rodzaj+"\n"+tytul+"\n"+tresc);		
		
		
		if (document.komunikaty_tpl[rodzaj]) {
			if (typeof (link_ok) == "undefined") {
				link_ok = location.href;
			}
			if (typeof (link_anuluj) == "undefined") {
				link_anuluj = location.href;
			}			
			/* pobranie szablonu komunikatu */
			var komunikat = document.komunikaty_tpl[rodzaj];			
			//var komunikat = document.komunikaty_tpl['polec-znajomemu'];			
			/* ustawienie treści */
			komunikat = komunikat.replace('{TYTUL}', tytul).replace('{TRESC}',
					tresc).replace('{LINK_OK}', link_ok).replace(
					'{LINK_ANULUJ}', link_anuluj);

			/* usunięcie poprzedniego komunikatu, jeśli istnieje */
			if ($('#warstwa')[0]) {
				komunikaty.usun();
			}

			/* wyświetlenie komunikatu */
			$("body").prepend('<div id="over" class="overlay"></div><div id="wrapper"></div>');
			$("#wrapper").prepend(komunikat);
			//$("#warstwa").pngfix();

			$('#over').css({'height':$(document).height(), 'opacity':'0.8' });
			_main.scrollToTop();
			var szerokosc = ( $(document).width() - $('#warstwa').width() ) / 2;
			$('#warstwa').css({'left':szerokosc});

			/* oprogramowanie przycisków */
			komunikaty.ustaw_przyciski();					
			return true;
		}
		
		return false;
	},

	/* zamyka komunikat */
	usun : function(){
		if (o = document.getElementById('warstwa')) $(o).remove();
		if (o = document.getElementById('warstwa_')) $(o).remove();
		if (o = document.getElementById('over')) $(o).remove();
	},

	/* domyślne ustawienie przycisków */
	ustaw_przyciski : function(){
		if (!$(".kom_anuluj")[0]) {
			$('.kom_close,.kom_ok').each( function(i){
				this.onclick = function(e){
					if(typeof this.href != undefined && this.href != location.href){
						//alert(location.href+"\n"+this.href);
						location.href = this.href;
					}
					komunikaty.usun();
					return false;
				};
			});
		} else {
			$('.kom_anuluj').each( function(i){
				this.onclick = function(){
					komunikaty.usun();
					return false;
				};
			});
		}
	}
};

function xshow(o) {
	s = '';
	for(e in o) {s += e+'='+o[e]+'\n';}
	alert( s );
}

function initMenu(m,l) {		
		var flashvars = {
		zmienna: m,
		jezyk: l
		};

		var attributes = {
		id: "idDiva",
		name: "idDiva"
		};

		var params = {
		menu: "false",
		wmode: "transparent",
		salign: "lt"
		};

		if (l==2) {
			swfobject.embedSWF("template/flash/menu_en.swf", "idDiva", "740", "40", "9.0.0", "", flashvars,  params,  attributes);	
		} else {
			swfobject.embedSWF("template/flash/menu.swf", "idDiva", "740", "40", "9.0.0", "", flashvars,  params,  attributes);	
		}
}

 function sleep(delay)
 {
     var start = new Date().getTime();
     while (new Date().getTime() < start + delay);
 }

function wyslijFormularzKontaktowy(){
	document.getElementById('ContactForm').submit();
}

function wyswietlKomunikatPoFormularzuKontaktowym(){
	komunikaty.pokaz('polec-znajomemu', '', '');
	$('#polecenie .button').bind('mouseover',function(){ $(this).addClass('hover'); }).bind('mouseout',function(){ $(this).removeClass('hover'); });
	$('#polecenie .button a').bind('click', _main.polec_znajomemu);									
	document.getElementById('polec-naglowek').innerHTML = 'Wiadomość wysłana pomyślnie';
	document.getElementById('polecenie').innerHTML = '<p style="text-align:left;padding-left:12px;margin-top:8px;">Dziękujemy za kontakt z Naszym Zespołem</p>';	
}

function wyswietlKomunikatPoFormularzuKontaktowymEn(){
	komunikaty.pokaz('polec-znajomemu', '', '');
	$('#polecenie .button').bind('mouseover',function(){ $(this).addClass('hover'); }).bind('mouseout',function(){ $(this).removeClass('hover'); });
	$('#polecenie .button a').bind('click', _main.polec_znajomemu);									
	document.getElementById('polec-naglowek').innerHTML = 'E-mail has been send.';
	document.getElementById('polecenie').innerHTML = '<p style="text-align:left;padding-left:12px;margin-top:8px;">Thank You for contact./p>';	
}


 function mapaStart_bez_znaczników()    
 {    
     if(GBrowserIsCompatible())  // sprawdzamy, czy przeglądarka jest kompatybilna    
     {    
         // tworzymy nowy obiekt mapy, i umieszczamy go w elemencie blokowym o ID "mapka"    
         var mapa = new GMap2(document.getElementById("g_mapka"));    
         // centrujemy mapę w okolicy Szczecina na poziomie zoom = 10    
         mapa.setCenter(new GLatLng(50.100505,19.204102,14.58160400390625),10);    		  
     }    	
 }

function mapaStart(){
	if(GBrowserIsCompatible())  
    { 
		var mapa = new GMap2(document.getElementById("g_mapka"));    
		mapa.setCenter(new GLatLng(50.222799,19.233483,14.58160400390625),12);    		  		
		
		var punkt = new GLatLng(50.222,19.233); // definiujemy punkt o współrzędnych 53.400,14.400  
		var marker = new GMarker(punkt,{title: 'Riser - siedziba firmy'}); // drugi argument (opcje) można pominąć, tak jak tutaj  
		mapa.addOverlay(marker);  						
		
	}
}
 

function wybierzBanner(lang, podstrona){			
	var losowa = Math.floor(Math.random() * 4 + 1);
	var baner = document.getElementById("banerDoPodmiany");	
	if (lang==2){
		switch(losowa){
		case 1: 
		  document.getElementById("banerDoPodmiany").setAttribute("class", "baner"+podstrona+"Nr1_en");	
		  document.getElementById("banerDoPodmiany").className="baner"+podstrona+"Nr1_en";
		  break;
		case 2:	  	  
		  document.getElementById("banerDoPodmiany").setAttribute("class", "baner"+podstrona+"Nr2_en");	
		  document.getElementById("banerDoPodmiany").className="baner"+podstrona+"Nr2_en";
		  break;
		case 3:	  
		  document.getElementById("banerDoPodmiany").setAttribute("class", "baner"+podstrona+"Nr3_en");	
		  document.getElementById("banerDoPodmiany").className="baner"+podstrona+"Nr3_en";
		  break;	  
		default:	  
		  document.getElementById("banerDoPodmiany").setAttribute("class", "baner"+podstrona+"Nr4_en");	
		  document.getElementById("banerDoPodmiany").className="baner"+podstrona+"Nr4_en";	  
		}		
	}		
	else{
		switch(losowa){
		case 1: 
		  document.getElementById("banerDoPodmiany").setAttribute("class", "baner"+podstrona+"Nr1");	
		  document.getElementById("banerDoPodmiany").className="baner"+podstrona+"Nr1";
		  break;
		case 2:	  	  
		  document.getElementById("banerDoPodmiany").setAttribute("class", "baner"+podstrona+"Nr2");	
		  document.getElementById("banerDoPodmiany").className="baner"+podstrona+"Nr2";
		  break;
		case 3:	  
		  document.getElementById("banerDoPodmiany").setAttribute("class", "baner"+podstrona+"Nr3");	
		  document.getElementById("banerDoPodmiany").className="baner"+podstrona+"Nr3";
		  break;	  
		default:	  
		  document.getElementById("banerDoPodmiany").setAttribute("class", "baner"+podstrona+"Nr4");	
		  document.getElementById("banerDoPodmiany").className="baner"+podstrona+"Nr4";	  
		}				
	}
}



function rozwinRealizacje() {
	var obj = document.getElementById("galeriaReferencje");	 
	var obj2 = document.getElementById("BottomContent");  //referencjeInfoContainer	
	if (parseInt(obj.style.height)<9000){
		obj.style.height = parseInt(obj.style.height)+1000 + 'px';
		if (parseInt(obj.style.height)>370)
			obj2.style.marginTop = parseInt(obj2.style.marginTop)+10 + 'px';
		//obj2.style.height = parseInt(obj2.style.height)+10 + 'px';				
	}
	if (parseInt(obj.style.height)>8800){
		var obj3 = document.getElementById("zwijka");
		obj3.innerHTML="zwiń";				
	}
}

function zwinRealizacje() {
	var obj = document.getElementById("galeriaReferencje");	 
	var obj2 = document.getElementById("BottomContent");  //referencjeInfoContainer	
	if (parseInt(obj.style.height)>230){
		obj.style.height = parseInt(obj.style.height)-100 + 'px';
		if (parseInt(obj.style.height)>370)
			obj2.style.marginTop = parseInt(obj2.style.marginTop)-10 + 'px';
		//obj2.style.height = parseInt(obj2.style.height)+10 + 'px';				
	}
	if (parseInt(obj.style.height)<230){
		var obj3 = document.getElementById("zwijka");
		obj3.innerHTML="rozwiń";				
	}
}

function przed_wywolaj() {
	var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;
	var obj = document.getElementById("galeriaReferencje");	 
	if (ie7 == true) {
		obj.style.height = 450 + 'px';
	}
}

function wywolaj() {
	//alert(document.getElementById("zwijka").innerHTML);
	var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;
	var obj = document.getElementById("galeriaReferencje");	 
	var obj2 = document.getElementById("BottomContent");  //referencjeInfoContainer		
	var obj3 = document.getElementById("zwijka");
	var wys = 0;
	if ((document.getElementById("zwijka").innerHTML == "zwiń")||(document.getElementById("zwijka").innerHTML == "zwiń ")||(document.getElementById("zwijka").innerHTML == " zwiń")||(document.getElementById("zwijka").innerHTML == " zwiń ")||(document.getElementById("zwijka").innerHTML == "Hide")||(document.getElementById("zwijka").innerHTML == " Hide")||(document.getElementById("zwijka").innerHTML == "Hide ")||(document.getElementById("zwijka").innerHTML == " Hide ")){		
		//if (parseInt(obj.style.height)>290){
			obj.style.height = 520 + 'px';
			//if (parseInt(obj.style.height)<370)
				obj2.style.marginTop = 0 + 'px';
				
			if (ie7 == true) {
			  // IE 7, mozilla, safari, opera 9
			  obj.style.height = 450 + 'px';			  
			} 				
				
			//obj2.style.height = parseInt(obj2.style.height)+10 + 'px';				
		//}	
		/*while (parseInt(obj.style.height)>270){
			obj.style.height = parseInt(obj.style.height)-10 + 'px';
			if (parseInt(obj.style.height)>370)
				obj2.style.marginTop = parseInt(obj2.style.marginTop)-10 + 'px';
			//obj2.style.height = parseInt(obj2.style.height)+10 + 'px';				
		}*/
		//if (parseInt(obj.style.height)<300){
			if (document.getElementById("zwijka").innerHTML == "zwiń")		
				obj3.innerHTML="rozwiń";				
			else
				obj3.innerHTML="More informations";
		//}
	}
	else{		
		if (parseInt(obj.style.height)<8900){
			obj.style.height = 1300 + 'px'; // bylo 8900
			if(navigator.appName == 'Microsoft Internet Explorer'){
				obj.style.height = 11400 + 'px'; //11400
			}		
			//if (parseInt(obj.style.height)>370){				
				if(navigator.appName == 'Microsoft Internet Explorer'){
					obj.style.height = 0 + 'px';
				}				
				else
					obj2.style.marginTop = 1330 + 'px'; // bylo 8330
			//}
			//obj2.style.height = parseInt(obj2.style.height)+10 + 'px';				

			if (ie7 == true) { //if (typeof document.body.style.maxHeight != "undefined") {
			  // IE 7, mozilla, safari, opera 9
			  obj.style.height = 7780 + 'px';
			  obj2.style.marginTop = 7300 + 'px';
			} 
			
		}
		/*
		while (parseInt(obj.style.height)<8100){
			obj.style.height = parseInt(obj.style.height)+10 + 'px';
			if (parseInt(obj.style.height)>370)
				obj2.style.marginTop = parseInt(obj2.style.marginTop)+10 + 'px';
			//obj2.style.height = parseInt(obj2.style.height)+10 + 'px';				
		}
		*/
//		if (parseInt(obj.style.height)>7800){			
			if ((document.getElementById("zwijka").innerHTML == "rozwiń")||(document.getElementById("zwijka").innerHTML == "rozwin")||(document.getElementById("zwijka").innerHTML == "rozwiń ")||(document.getElementById("zwijka").innerHTML == "rozwin ")||(document.getElementById("zwijka").innerHTML == " rozwin ")||(document.getElementById("zwijka").innerHTML == " rozwiń "))
				obj3.innerHTML="zwiń";				
			else
				obj3.innerHTML="Hide";				
//		}		
	}
	
	
	
	/*
	if (document.getElementById("zwijka").innerHTML == "zwiń"){
		alert("jestem w zwin");
		setInterval("zwinRealizacje()", 100);
	}
	else{
		var obj = document.getElementById("galeriaReferencje");		
		obj.style.display = "block";
		//var obj2 = document.getElementById("referencjeInfoContainer");	
//		obj2.style.height = "9000"; 	
		//obj2.style.display = "block";
		setInterval("rozwinRealizacje()", 100);
	}		
	*/
}


function rozwin(doIlu, skok) {
	var obj = document.getElementById("galeriaPodklad");	 
	var rozwiniecie = 100*(Math.round($("#galeriaPodklad > div").size()/4 - 0.5)+1);
	var obj3 = document.getElementById("zwijka");	
	var middleContent = document.getElementById("middlecontent");	
	//alert(obj3.innerHTML);
	if ((obj3.innerHTML == " więcej ")||(obj3.innerHTML == "więcej ")){		
		while (parseInt(obj.style.height)<rozwiniecie){
			obj.style.height = parseInt(obj.style.height) + skok + 'px';			
		}
		if (parseInt(obj.style.height)>100){			
			obj3.innerHTML="zwiń";		
		}
		//middleContent.style.height = parseInt(middleContent.style.height) + skok + 'px';
		var wysok = parseInt(obj.style.height) + 400;
		//alert(wysok);
		middleContent.style.height = wysok + 'px';
	}
	else{		
		while (parseInt(obj.style.height)>100){
			obj.style.height = parseInt(obj.style.height) - skok + 'px';
		}
		if (parseInt(obj.style.height)==100){
			var obj3 = document.getElementById("zwijka");
			obj3.innerHTML=" więcej ";		
		}	
		middleContent.style.height = '';
	}
		
}

function wywolajRozwijanie() {
	var obj = document.getElementById("galeriaPodklad");	
	//alert($("#galeriaPodklad > div").size());
	//var iloscZdjec = $("#galeriaPodklad > div").size());
	//var rozwiniecie = 100*(Math.round($("#galeriaPodklad > div").size()/4 - 0.5)+1);
	//alert(rozwiniecie);
	obj.style.display = "block";	
	//setInterval("rozwin(100,10)", 1);
	rozwin(100,10);
	
	
	
}



