var realizacje;
$(document).ready(function(){
	$('.white_home li').hover(
		function(){
			$(this).addClass('hover');
		},
		function(){
			$(this).removeClass('hover');
		}
	);

	$('.realization ul.left li').hover(
		function(){
		   clearInterval(realizacje);
		   if($('a', this).html()){
			var rel = $('a', this).attr('rel');
			$('.project').hide();
			$('#project'+rel).show();
			$('.realization .selected').removeClass('selected');
			$(this).addClass('selected');
		   }
		},
		function(){
			realizacje = setInterval(function(){nextRealization()}, 10000);
		}
	);
	realizacje = setInterval(function(){nextRealization()}, 10000);

	//onclick="return hs.expand(this)"
	$('a.highslide').each(function() {
    		this.onclick = function() {
			return hs.expand(this, { captionEval: 'this.thumb.alt' });
      			//return hs.expand(this);
    		};
 	});
});

$(window).load(function(){
	$('.zdjecia_last_gallery').cycle({
		fx: 'fade'
	});
});

$(window).load(function(){
	$('.cycle').cycle({
		fx: 'fade',
		//fx: 'scrollHorz',
		//speed: 300,
		pause: 1,
		timeout: 10000,
		pager:  '#control_cycle',
		pagerAnchorBuilder: function(i,el){
			$('#control_cycle #score_'+(i+1)).click(function(){
				$('.cycle').cycle('pause');
				return false;
			});
			return $('#control_cycle #score_'+(i+1));
		}
	});
});
/*
$(window).load(function(){
	var max=100;
	$('.blue .box .in').each(function(){
		if($(this).height() > max)
			max = $(this).height();
	});
	$('.blue .box .in').each(function(){
		$(this).height(max);
	});
});
*/

function focusInput(el, txt){
	$(el).css('text-align', 'left');
	if(el.value == txt){
		el.value=''
	}
}
function blurInput(el, txt){
	if(el.value == ''){
		$(el).css('text-align', 'center');
		el.value=txt;
	}
}

function nextRealization(){
	var el = $('.realization ul.left li.selected').next('.realization ul.left li');
	if(!$('a', el).html()){
		el = $('.realization ul.left li:first')
	}
		var rel = $('a', el).attr('rel');
		$('.project').hide();
		$('#project'+rel).show();
		$('.realization .selected').removeClass('selected');
		$(el).addClass('selected');
}