var act = 1
var objects;

function startSlideshow(id,speed)
{
	objects = document.getElementById(id).getElementsByTagName('li')
	test = setInterval("slideNext()",speed)
}

function slideNext()
{
	$(".slideshow_" + act).fadeOut(400)
	if(act >= objects.length) act = 1
	else act += 1
	$(".slideshow_" + act).fadeIn(400)
}

/* BIG SLIDESHOW */

function b_startSlideshow()
{
	if(!b_interval)
	{
		b_interval = setInterval("b_nextSlide()",5000);
	}
}

function b_stopSlideshow()
{
	if(b_interval)
	{
		clearInterval(b_interval);
		b_interval = 0;
	}
}

function b_nextSlide()
{
	$("#b_control > div:nth-child("+b_act+") > img").attr("src",b_buttons[(b_act-1)])
	b_act += 1
	if(b_act > $("#b_slide > li").length)
	{
		b_act = 1
		$("#b_control > div:nth-child("+b_act+") > img").attr("src",b_buttons_act[(b_act-1)])
		$("#b_slide").animate({ top: '+0' },b_speed);
	}
	else
	{
		$("#b_control > div:nth-child("+b_act+") > img").attr("src",b_buttons_act[(b_act-1)])
		$("#b_slide").animate({ top: '-=' + b_height },b_speed);
	}
}

function b_goToSlide(number)
{

	position = (number-b_act) * b_height

	$("#b_control > div:nth-child("+b_act+") > img").attr("src",b_buttons[(b_act-1)])
	b_act = number
	$("#b_control > div:nth-child("+b_act+") > img").attr("src",b_buttons_act[(b_act-1)])

	if(position > 0)
		$("#b_slide").animate({ top: '-=' + position },b_speed)
	else
		$("#b_slide").animate({ top: '+=' + (position*-1) },b_speed)

	clearInterval(b_interval)
	b_startSlideshow()
}


