var Utils = {
	
	//config
	introDuration: 800,				//ms
	introPause: 3000,				//ms
	carosuelDuration: 500,			//ms
	carouselPause: 3000,			//ms

	init: function()
	{
		$("body").css("min-height", $(window).height());
		$("#page").css("padding-bottom", $("#footer").css("height"));
	
		$(".boxes-carousel").jCarouselLite({
			auto: Utils.introPause,
			speed: Utils.introDuration,
			visible: 4
		});	
		
		$("#intro .text > ul > li:first-child").addClass("active-item");
		
		setInterval(function(){
			Utils.animateIntro();
		}, Utils.introPause);
		
	},
	
	animateIntro: function()
	{
		
		var currentEl = $("#intro .text > ul > li.active-item");
		var nextEl = $("#intro .text > ul > li.active-item").next();
		
		if($(nextEl).index()==-1)
		{
			nextEl = $("#intro .text > ul > li:first-child");
		}
		
		$(currentEl).fadeOut(Utils.introDuration, 
			function()
			{
				$(this).removeClass("active-item");
			});
			
		$(nextEl).fadeIn(Utils.introDuration, 
			function()
			{
				$(this).addClass("active-item");
			});
	}

}

$(document).ready(function()
{

	Utils.init();
	
});

function mark(o){o.focus();o.select();}

function changeLanguage()
{
	alert('Niedostępne - w budowie ;-)');	
}

function goto(url)
{
	if (url.length > 3)
		document.location.href=url;
}

function url(u,a)
{
	u = u.substring(0,7) == 'http://'?u:('http://'+u);
	a = a.length == 0?u:a;
	document.write('<a href="'+u+'" target="_blank">'+a+'</a>');
}

function imgurl(u,src,a)
{
	u = u.substring(0,7) == 'http://'?u:('http://'+u);
	wtxt('<a href="'+u+'" rel="nofollow" target="_blank" title="'+a+'"><img src="'+src+'" alt="'+a+'"/></a>');
}

function closeMessageBox(){$('#message-box').hide('slow');}

function wtxt(t){document.write(t);}

