var first=true;
var stop=false;
var items_per_scroll=0;
var items_height;
var max_scrolable_index;
var count_items;
var list, items;
var timeOutAutoSwith = 5000;
var timeOutEvent;
var globalTime = 0;
var efect = 'fade';




$jq142(document).ready(function(){
	$jq142(".scrollable").scrollable({		
		vertical: true,
		mousewheel: false,
		circular : true,
		next : '#next-slide',
		prev : '#prev-slide',
		onBeforeSeek : function()
		{
		},
		onSeek : function()
		{
			var indexElement = this.getIndex();
			show_picture('fragment-' + (indexElement+1));			
		}
	}).autoscroll({
		autoplay : true,
		autopause : true,
		interval: timeOutAutoSwith
	});
	
	var api = $jq142(".scrollable").data("scrollable");
	
	$jq142('#navi-pause').click(function()
	{
		api.stop();
	});
	
	$jq142('#navi-play').click(function()
	{
		api.play();
	});
	
});




// funckeje do przegladania zdjęć z efektami


//podstawowe funkcje przełaczania
function show_picture(id)
{
	var el_id=id.substring(1);
	var arr_id=el_id.split('-');

	//ustawieni tytułu artykułu
	$jq142('.record_title_bignews').hide();
	$jq142('#title-'+arr_id[1]).show();

	//ustawienie numerka aktualnego artykułu
	$jq142('#current_item_number').html(arr_id[1]);


	show_picture_standard(arr_id[1]);
	
}

function show_picture_script(id)
{
	//ustawieni tytułu artykułu
	$jq142('.record_title_bignews').hide();
	$jq142('#title-'+id).show();

	//ustawienie numerka aktualnego artykułu
	$jq142('#current_item_number').html(id);

	show_picture_standard(id);
	
}

// brak efektu przejscia
function show_picture_standard(id)
{
	$jq142('.ui-tabs-panel-slide').hide();
	$jq142('.ui-tabs-panel-slide').removeClass('active');
	$jq142('#fragment-'+id).show();//fadeTo("fast",1.0);
	$jq142('#fragment-'+id).addClass('active');
	$jq142('.ui-tabs-nav-item-slide').removeClass('ui-tabs-selected-slide');
	$jq142('#nav-fragment-'+id + ':not(.cloned)').addClass('ui-tabs-selected-slide');
}
