function SlideBaners(efect,group,object_name,autoscroll,interval){
	this.count = 0;
	this.stop = false;
	this.efect = efect;
	this.group = group;	
	this.first = true;
	this.items_per_scroll = 0;
	this.items_height = 0;
	this.max_scrollable_index = 0;
	this.count_items = 0;
	this.scrollable_instance = null;
	this.scrollable_class = ".scrollable_"+group;
	this.object_name = object_name;
	this.next = '.next_'+group;
	this.prev = '.prev_'+group;
	this.autoscroll = autoscroll;
	this.interval = interval;


	var this_ob = this;
	
	
	

	this.start_play = function()
	{
	    this.stop = false;
	};

	this.stop_play = function()
	{
	    this.stop = true;
	};
	
	this.initialize = function(){

	$(document).ready(function(){

			this_ob.scrollable_instance = $(this_ob.scrollable_class).scrollable({ vertical: true, mousewheel: false, next: this_ob.next, prev: this_ob.prev});

		    // get handle to scrollable API
		    this_ob.scrollable_instance = $(this_ob.scrollable_class).data("scrollable");

			//console.log(this_ob.scrollable_instance.getIndex());

		    var item_height = $(".item_"+this_ob.group).height();
		    var area_height = $("#featured_"+this_ob.group).height();

					
		    list = document.getElementById("lists_"+this_ob.group);
		    items = list.getElementsByTagName("li");
		    this_ob.count_items = items.length;

		    this_ob.items_height = item_height * this_ob.count_items;
		    this_ob.items_per_scroll = Math.round(area_height/item_height);
		    this_ob.max_scrolable_index = this_ob.count_items - this_ob.items_per_scroll;

		    if(this_ob.count_items <= this_ob.items_per_scroll)
		    {
			$('.next_'+this_ob.group).hide();
			$('.prev_'+this_ob.group).hide();
		    }

		    var scrolable_index = this_ob.scrollable_instance.getIndex();

		    if(scrolable_index >= this_ob.max_scrolable_index)
			    {
				$('.next_'+this_ob.group).hide();
				$('.prev_'+this_ob.group).hide();
			    }

		    $('.next_'+this_ob.group).click(function(){

				var scrolable_index = this_ob.scrollable_instance.getIndex();

				if(scrolable_index >= this_ob.max_scrolable_index)
					{
						$('.next_'+this_ob.group).hide();
						$('.prev_'+this_ob.group).show();
					}
		    });

		    $('.prev_'+this_ob.group).click(function(){
			      $('.next_'+this_ob.group).show();
		    });




		    $('.scrollable_'+this_ob.group).mousewheel(function(event, delta) {

					    var scrolable_index = this_ob.scrollable_instance.getIndex();

					    if (delta > 0)
									{
				                 this_ob.scrollable_instance.prev();
				                 $('.next_'+this_ob.group).show();
				            }
					    else if (delta < 0)
					    {
				                if(scrolable_index >= (this_ob.max_scrolable_index-1))
				                {
				                    $('.next_'+this_ob.group).hide();
				                    $('.prev_'+this_ob.group).show();
				                }
				                if(scrolable_index < this_ob.max_scrolable_index)
				                {
				                    this_ob.scrollable_instance.next();
				                }
				            }
				            if(this_ob.count_items <= this_ob.items_per_scroll)
				            {
				                $('.next_'+this_ob.group).hide();
				                $('.prev_'+this_ob.group).hide();
				            }
				      event.preventDefault();
		     });

		    //akcja scrola na duzym obrazku
		    $('.sb-tabs-panel-'+this_ob.group).mousewheel(function(event, delta) {

						var scrolable_index = this_ob.scrollable_instance.getIndex();

    					

						if (delta > 0)
						{
				                	var id_p = $('.sb-tabs-selected-'+this_ob.group).attr('id');
				               	 	var arr = id_p.split('-');
				                	id_p = arr[2];							

						if(id_p > 1){
						            this_ob.scrollable_instance.prev();
						            $('.next_'+this_ob.group).show();
						            this_ob.show_picture_script(parseInt(id_p)-1,true);
						        }
				        }
						else if (delta < 0)
						{
						        if(scrolable_index >= (this_ob.max_scrolable_index-1))
						        {
						            $('.next_'+this_ob.group).hide();
						            $('.prev_'+this_ob.group).show();
						        }
						        if(scrolable_index < this_ob.max_scrolable_index)
						        {
						            this_ob.scrollable_instance.next();
						        }

						        var id_p = $('.sb-tabs-selected-'+this_ob.group).attr('id');
						        var arr = id_p.split('-');
						        id_p = arr[2];

							if(this_ob.count_items > id_p){
						            this_ob.show_picture_script(parseInt(id_p)+1,true);
						        }
				            	}

				         if(this_ob.count_items <= this_ob.items_per_scroll)
				            {
				                $('.next_'+this_ob.group).hide();
				                $('.prev_'+this_ob.group).hide();
				            }
				      event.preventDefault();
			});


		


		$('#prev-slide-'+this_ob.group).click(function(){
			var id_p = $('.sb-tabs-selected-'+this_ob.group).attr('id');
			var arr = id_p.split('-');
			id_p=arr[2];
			if(id_p>1){
				this_ob.scrollable_instance.prev();
				$('.next_'+this_ob.group).show();
				this_ob.show_picture_script(parseInt(id_p)-1,true);
			}
		});

		$('#next-slide-'+this_ob.group).click(function(){

		     	var scrolable_index = this_ob.scrollable_instance.getIndex();
			if(scrolable_index >= (this_ob.max_scrolable_index-1))
				{
					$('.next_'+this_ob.group).hide();
					$('.prev_'+this_ob.group).show();
				}
				if(scrolable_index < this_ob.max_scrolable_index)
				{
				  	this_ob.scrollable_instance.next();
				}

				var id_p=$('.sb-tabs-selected-'+this_ob.group).attr('id');
				var arr=id_p.split('-');
				id_p=arr[2];

				if(this_ob.count_items > id_p){
					this_ob.show_picture_script(parseInt(id_p)+1,true);
				}
		});

			if(this_ob.autoscroll){
				this_ob.autoSwitch(this_ob.interval);
			}

		});
	};


	this.autoSwitch = function()
	{

				
	    if(!this_ob.stop)
	    {

		list = document.getElementById("lists_"+this_ob.group);
		items = list.getElementsByTagName("li");
		this_ob.count_items = items.length;
		
		var id=$('.sb-tabs-selected-'+this_ob.group).attr('id');
		arr=id.split('-');

		var next_number = parseInt(arr[2])+1;
		
		if(next_number>this_ob.count_items)
		   { next_number = 1; this_ob.scrollable_instance.begin();}

		if(this_ob.first == true)
		    {next_number = 1; this_ob.first = false;}

		if(this_ob.items_per_scroll == 0)
		{
		    var area_height=$("#featured_"+this_ob.group).height();
		    var item_height=$(".item_"+this_ob.group).height();
		    this_ob.items_per_scroll = area_height/item_height;     
		}

		var scrolable_index = this_ob.scrollable_instance.getIndex();
		
		
		if(next_number > this_ob.items_per_scroll && scrolable_index < this_ob.max_scrolable_index)
		{
			this_ob.scrollable_instance.next();
		}

	       

		var next_id = arr[1]+'-' + next_number + '-' + this_ob.group;
		this_ob.show_picture_script(next_number,false);

		var cur_item = $('.sb-tabs-selected-'+this_ob.group).attr('id').split('-')[2];
		
		if(cur_item == this_ob.count_items || this_ob.count_items <= this_ob.items_per_scroll)
		{
		     $('.next_'+this_ob.group).hide();
		}
		else
		{
		     $('.next_'+this_ob.group).show();
		}

	    }

	    var function_name = this_ob.object_name+'_'+this_ob.group+'.autoSwitch()';
	    setTimeout(function_name,this_ob.interval);
	    
	};


	
	// podstawowe funkcje przełączania elementów 
	// funkcja wykorzystana po kliknięciu
	this.show_picture = function(id)
	{
	    this_ob.stop = true;
	    var el_id = id.substring(1);
	    var arr_id = el_id.split('-');
		switch (this_ob.efect) {
			case 'animate':
				this_ob.show_picture_slide_animate(arr_id[1],true);
				break;
			case 'fade':
				this_ob.show_picture_fade(arr_id[1],true);
				break;
			case 'slide_down':
				this_ob.show_picture_slide_down(arr_id[1],true);
				break;
			case 'standard':
				this_ob.show_picture_standard(arr_id[1],true);
				break;
			default:
				this_ob.show_picture_standard(arr_id[1],true);
			}
	};
	
	// funkcja przełacznia elementów używana w autoSwitch

	this.show_picture_script = function(id,stop_value){
		switch (this_ob.efect) {
			case 'animate':
				this_ob.show_picture_slide_animate(id,stop_value);
				break;
			case 'fade':
				this_ob.show_picture_fade(id,stop_value);
				break;
			case 'slide_down':
				this_ob.show_picture_slide_down(id,stop_value);
				break;
			case 'standard':
				this_ob.show_picture_standard(id,stop_value);
				break;
			default:
				this_ob.show_picture_standard(id,stop_value);
			}
	};


	// efekt przejscia animate rozmycie zdjęcia i pokazywanie się nowego
	this.show_picture_slide_animate = function(id,stop_elem)
	{
		this_ob.stop = stop_elem;
		$('div .active_'+this_ob.group).fadeTo(2500,'0');
		$('#fragment-'+id+'-'+this_ob.group).fadeTo(2500,'1');
		$('.sb-tabs-panel-'+this_ob.group).removeClass('active_'+this_ob.group);
		$('#fragment-'+id+'-'+this_ob.group).addClass('active_'+this_ob.group);
		$('.sb-tabs-nav-item-'+this_ob.group).removeClass('sb-tabs-selected-'+this_ob.group);
	    $('#nav-fragment-'+id+'-'+this_ob.group).addClass('sb-tabs-selected-'+this_ob.group);
	}



	// efekt przejscia slide down
	this.show_picture_slide_down = function(id,stop_elem)
	{
		this_ob.stop = stop_elem;
		$('.sb-tabs-panel-'+this_ob.group).attr('style','display:none');
		$('.sb-tabs-panel-'+this_ob.group).removeClass('active_'+this_ob.group);
		$('.sb-tabs-panel-'+this_ob.group).css('z-index','1');
		$('#fragment-'+id+'-'+this_ob.group).addClass('active_'+this_ob.group);
		$('#fragment-'+id+'-'+this_ob.group).css('z-index','100');
		$('#fragment-'+id+'-'+this_ob.group).slideDown(1200);
	    $('.sb-tabs-nav-item-'+this_ob.group).removeClass('sb-tabs-selected-'+this_ob.group);
	    $('#nav-fragment-'+id+'-'+this_ob.group).addClass('sb-tabs-selected-'+this_ob.group);
	}


	//efek przejscia poprzez znikanie i pojawianie się
	this.show_picture_fade = function(id,stop_elem)
	{
		this_ob.stop = stop_elem;
		var group = this_ob.group;
	    $('.active_'+this_ob.group).fadeOut(1000,function(){
			$('#fragment-'+id+'-'+group).fadeIn(1000);
		});
		$('.sb-tabs-panel-'+this_ob.group).removeClass('active_'+this_ob.group);
		$('#fragment-'+id+'-'+this_ob.group).addClass('active_'+this_ob.group);
	    $('.sb-tabs-nav-item-'+this_ob.group).removeClass('sb-tabs-selected-'+this_ob.group);
	    $('#nav-fragment-'+id+'-'+this_ob.group).addClass('sb-tabs-selected-'+this_ob.group);
	}

	// brak efektu przejscia
	this.show_picture_standard = function(id,stop_elem)
	{
	    this_ob.stop = stop_elem;
		$('.sb-tabs-panel-'+this_ob.group).attr('style','display:none');
		$('.sb-tabs-panel-'+this_ob.group).removeClass('active_'+this_ob.group);
	    $('#fragment-'+id+'-'+this_ob.group).show();//fadeTo("fast",1.0);
		$('#fragment-'+id+'-'+this_ob.group).addClass('active_'+this_ob.group);
		$('.sb-tabs-nav-item-'+this_ob.group).removeClass('sb-tabs-selected-'+this_ob.group);
	    $('#nav-fragment-'+id+'-'+this_ob.group).addClass('sb-tabs-selected-'+this_ob.group);
	}


};

