
var presINT;
var inPresEffect;

function changeSlider(toThisNumber) {
	$('#accountType').val(thisKind);
	
	$('a',$('#accountTypesChooser')).removeClass("Chosen"); 
	$('div',$('#accountTypesSettings')).css("display","none"); 
	
	$('#chooseActType'+thisKind).addClass("Chosen");
	$('#'+thisKind+"info").css("display", "block");
	$('div',$('#'+thisKind+"info")).css("display","block"); 

}


$('li',$('#presentation_tabs')).click(function() { setTab(this.id, 'this', true); });

$('#presentationNext').click(function() { setTab($('li.presCurrent'), 'next', true); });

$('#presentationPrev').click(function() { setTab($('li.presCurrent'), 'prev', true); });

$('#presentationPLAY').click(function() { presentationStart(); });

$('#presentationPAUSE').click(function() { presentationStop(); });

function setTab(thisOne, isDoing, wasClicked)
{
	if (inPresEffect == true) return false;
	inPresEffect = true;
	if (wasClicked == true) presentationStop();
	
	if(isDoing == 'next'){thisOne = thisOne.next().attr("id");}
	else if (isDoing =='prev'){thisOne = thisOne.prev().attr("id");}
	
	if (thisOne == null) {
		if(isDoing == 'prev'){thisOne = $('li','#presentation_tabs').last().attr("id");}
		else {thisOne = $('li','#presentation_tabs').first().attr("id");};
	}
	
	thisOne = '#'+thisOne;
	$('div.PreSlideCurrent').fadeOut(300, function() {
														$('div.PreSlide','div#presentation_images').removeClass('PreSlideCurrent');
														$(thisOne+'_IMG').fadeIn(300);
														$(thisOne+'_IMG').addClass('PreSlideCurrent');
														inPresEffect = false;
													 });
	$('li',$('#presentation_tabs')).removeClass('presCurrent');
	$(thisOne).addClass('presCurrent');
	return true;
}

function presentationStart() {
		presINT = setInterval( function() { setTab($('li.presCurrent'), 'next'); }, 4000 );
		$('#presentationPLAY').css("display","none");
		$('#presentationPAUSE').css("display","inline");
}
function presentationStop() {
		clearInterval (presINT);
		$('#presentationPLAY').css("display","inline");
		$('#presentationPAUSE').css("display","none");
}



