function diapos(id){
	this.id=id;
	this.api;
	this.time=10000;
	this.current;

	this.init=function(){
		var obj=this;
		$("#"+this.id).scrollable({
			circular:true
		}).autoscroll({
			interval:obj.time
		});

		this.getApi();
		this.selectionListener();

	}

	this.getApi=function(){
		this.api=$("#"+this.id).data("scrollable");
	}


	this.selectionListener=function(){
		if(typeof(this.api)!="undefined"){
			var obj=this;

			this.api.onSeek(function(){
				obj.visible();
			});

			$(".sel").click(function(){
				var diapo=$(this).attr('rel');
				obj.api.seekTo(diapo);
			});
		}
	}

	this.visible=function(){
		this.current=this.api.getIndex();
		$(".sel").removeClass('current');
		$('.sel[rel="'+this.current+'"]').addClass('current');
	}

	this.init();

}

$(document).ready(function(){

	var presentation=new diapos("presentation-window");

	$('#comments-container').hide();
	$("#comments-expander").click(function(){
		$("#comments-container").slideDown();
		$(this).remove();
	});

	$(".prod-story").hover(function(){
		$(this).find('span').animate({'opacity':'0.6','margin-top':'34'});
	},function(){
		$(this).find('span').animate({'opacity':'0','margin-top':'0'});
	}).find('span').css('opacity',0);

});
