$(document).ready(function() {
	// $("#slideshow").css("overflow", "hidden");
	// $("#slideshow-nav").css("visibility", "visible");
	// $("#slideshow-nav a[href=#lambo1]").addClass("active");
	
	$("#slideshow-nav").localScroll({
  		target:'#slideshow', axis: 'x'
	});
	
	$("#slideshow-nav a").click(function(){
		$("#slideshow-nav a").removeClass("active");
		$(this).addClass("active");
	});
	
});

	var uxi_rotator = {
		
		this_item: 0,
		we_run: false,
		this_delay: 0,
		this_links_conteiner: '',
		element_count: 0,
		
		run: function(links_conteiner, delay){
			this.we_run = true;
			this.this_delay = delay;
			this.this_links_conteiner = links_conteiner;
			
			this.element_count = $(links_conteiner+' a').size();
			
			func_str = 'uxi_rotator._next()';
			rotator_core = setInterval(func_str, delay);
		},
		_next: function(){
			this_id = this.this_links_conteiner+" a:eq("+this.this_item+")";
			$(this_id).click();
			if(this.this_item == this.element_count){this.this_item = 0}else{
			this.this_item+=1;
			}
		},
		_stop: function (){
				if(this.we_run == true){
				this.we_run = false;
				
				clearInterval(rotator_core);
			}
		},
		_start: function (){
			if(this.we_run == false){
				this.we_run = true;
				
				func_str = 'uxi_rotator._next()';
				rotator_core = setInterval(func_str, this.this_delay);
			}
		},
		set_this: function (num){
			uxi_rotator._stop();
			uxi_rotator.this_item = num;
			uxi_rotator._start();
		}
	}
	$(function (){
		$('#hover_conteiner').hover(
			function() {uxi_rotator._stop();},  
			function() {uxi_rotator._start();}
		);
	});
