	var resizefn = function()
	{
		$('#lewo').height( $(window).height() );
		
		var nh = $(window).height()-20;
		$('#prawo').height( nh + 20 );
		if ( $('#tresc').height() < nh )
			$('#tresc').height( nh );
		
	}
	$(window).bind({'resize':resizefn});
	
	$(document).ready(function()
	{
		$(window).load(function ()
		{
			resizefn();
			$('.obraz').each(function(i)
			{
				$(this).find('.imagecomment').width( $(this).width() - $(this).find('.img').width() - 20 );
			
			//	var nh = $(this).find('.imagecomment').height() + $(this).find('.status').height();
			//	if($(this).height() < nh)
			//		$(this).height( nh );
					
					
					
					
			});
		
			$('.scalewidth').each(function(i)
			{	
				if( $(this).width() > 500 )
					$(this).width(500);
			});
			
		});

		
		$('#menu li a span').hover(function()
		{
			$(this).animate({'padding-left':'+=50'}, 500, function(){});
		}, function()
		{
			$(this).animate({'padding-left':'-=50'}, 500, function(){});
		});
		
		if (!$.browser.msie)
		{
			$('.obraz').each(function(i)
			{	
				cssSandpaper.setTransform(this, "rotate(3deg) scale(1)");
				$(this).css({'z-index':'0'});
			});

			$('#menu').each(function(i) {
					cssSandpaper.setTransform(this, "rotate(7deg)");
			});
		

			$('.obraz').hover(function()
			{
				cssSandpaper.setTransform(this, "rotate(0deg) scale(1.1)");
				$(this).css({'z-index':'1000'});
			}, function(){
				cssSandpaper.setTransform(this, "rotate(3deg) scale(1)");
				$(this).css({'z-index':'0'});
			});
		}
		
		$("a[rel='gallery']").colorbox({scalePhotos:true,maxHeight:'99%', current:'{current}/{total}'});
		$("a[rel='ajax']").colorbox({iframe:true,innerWidth:700, innerHeight:444});
		
		if ($('#menu').height()+80 > $(window).height() )
		{
			$('#menu').css({'top':0});
		}
		if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
		{
			$('body, html').css({'overflow':'visible'});
			$('#prawo').css({'overflow-y':'visible'});
		}
	});
