// JavaScript Document


jQuery.easing.easeOutQuart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};


jQuery(function( $ ){

				$('#slide_box').serialScroll({
						items:'img',
						prev:'.lewo',
						next:'.prawo',
						offset:-10, //when scrolling to photo, stop 230 before reaching it (from the left) - to margines od obrazka
						start:0, //as we are centering it, start at the 2nd
						duration:1200,
						force:true,
						stop:true,
						axis:'x',
						lock:false,
						cycle:false, //don't pull back once you reach the end
						easing:'easeOutQuart', //use this easing equation for a funny effect
						jump: false, //click on the images to scroll to them
						onBefore:function( elem ){
							if (preload>=ilosc_realizacji) return;							
							MM_preloadImages(r_dane[preload]['foto']);
							preload++;
						}
					});


				$('#slide_box2').serialScroll({
						items:'img',
						prev:'.lewo2',
						next:'.prawo2',
						offset:-10, //when scrolling to photo, stop 230 before reaching it (from the left) - to margines od obrazka
						start:0, //as we are centering it, start at the 2nd
						duration:1200,
						force:true,
						stop:true,
						axis:'x',
						lock:false,
						cycle:false, //don't pull back once you reach the end
						easing:'easeOutQuart', //use this easing equation for a funny effect
						jump: false, //click on the images to scroll to them
						onBefore:function( elem ){
							if (preload>=ilosc_realizacji) return;							
							MM_preloadImages(r_dane[preload]['foto']);
							preload++;
						}
					});

	
	
				});


GB_myShow = function(caption, url, /* optional */ height, width, callback_fn) {
	if (url=='')
	{
		alert('System wewnętrzny - adres internetowy niedostępny!');
		
		return false;
	}
    var options = {
        caption: caption,
        height: height || '90%',
        width: width || '90%',
        fullscreen: true,
        show_loading: true,
        callback_fn: callback_fn
    }
    var win = new GB_Window(options);
    return win.show(url);
}
	
	
function realizacja(nr)
{
	
	$('#realizacja img').animate({
						 'opacity': 0
						 }, 300, function(){
							//alert(r_dane[nr]['tytul']);
							$(this).attr('src', r_dane[nr]['foto'])
									.animate({
									 'opacity': 1
									 }, 800)
						 });	
	

	r_tytul = r_dane[nr]['tytul'];
	r_link = r_dane[nr]['link'];
									
	
	$('#r_txt').animate({
						 'opacity': 0
						 }, 300, function(){							
							$(this).html(r_dane[nr]['opis'])
									.animate({
									 'opacity': 1
									 }, 800)
						 });	
	
				
	
}

function MM_preloadImages() { //v3.0
 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];}}
}
