/* Slider na JQuery - (C) ProXy 2011 */

jQuery.noConflict();


function px_slide_start(obiekt, animacja, czas)
{
	var px_ile=document.getElementById(obiekt).getElementsByTagName('li').length;
	
	if(!animacja || animacja==0)animacja=1;
	animacja=animacja*1;
	if(animacja>5)animacja=1;
	
	
	
	setInterval("px_slide('"+obiekt+"', "+(animacja*1)+", "+(czas*1)+")", czas*px_ile);
	jQuery('#'+obiekt+' li').each(function(index){jQuery(this).hide();});
	px_slide(obiekt, animacja, czas);
}

function px_slide(obiekt, animacja, czas)
{
	var animacja=animacja;
	if(!animacja || animacja==0)animacja=1;
	animacja=animacja*1;
	if(animacja>5)animacja=5;
	
	var czas=czas*1;
	
	jQuery('#'+obiekt+' li').queue("fx");
	jQuery('#'+obiekt+' li').each(function(index)
	{
		var self = this;
		setTimeout(function ()
		{
			if(animacja==1)
			{
				jQuery(self).fadeIn(80);
				jQuery(self).delay(czas);
				jQuery(self).fadeOut(80);
			}
			else if(animacja==2)
			{
				jQuery(self).show({direction: "right" }, 500);
				jQuery(self).delay(czas);
				jQuery(self).hide({direction: "left" }, 500);
			}
			else if(animacja==3)
			{
				jQuery(self).show({direction: "left" }, 500);
				jQuery(self).delay(czas);
				jQuery(self).hide({direction: "right" }, 500);
			}
			else if(animacja==4)
			{
				jQuery(self).fadeIn(500);
				jQuery(self).delay(czas);
				jQuery(self).hide({direction: "down" }, 500);
			}
			else if(animacja==5)
			{
				jQuery(self).show({direction: "up" }, 500);
				jQuery(self).delay(czas);
				jQuery(self).fadeOut(500);
			}
			else if(animacja==6)
			{
				jQuery(self).slideToggle(500,{direction: "up" });
				jQuery(self).delay(czas);
				jQuery(self).slideToggle(500,{direction: "up" });
			}
		}, index*czas+1000)
	});
}
