$(document).ready(function(){
	
	$(function() {
		$("div#makeMeScrollable").smoothDivScroll({ 
					autoScroll: "onstart",
					autoScrollDirection: "endlessloopright",
					autoScrollStep: 1,
					autoScrollInterval: 15,
					startAtElementId: "startAtMe",
					visibleHotSpots: "always"
					});
	});
	
	
	$('.boxgrid.captionfull').hover(function(){		
		$(".cover", this).stop().animate({top:'-110px'},{queue:false,duration:160});		
	}, function() {		
		$(".cover", this).stop().animate({top:'-150px'},{queue:false,duration:160});
	});
	
	$("div#makeMeScrollable").bind("mouseover", function(){
		$("div#makeMeScrollable").smoothDivScroll("stopAutoScroll");
	});		
	$("div#makeMeScrollable").bind("mouseout", function(){
		$("div#makeMeScrollable").smoothDivScroll("startAutoScroll");
	});
	
	$("#imgscroll").hide();	
	
	$('span.ribbon').mouseover(function() {		
			$(this).css({color: "#76868e"});
		}).mouseout(function(){
			$(this).css({color: "#9eb1b8"});
		}
	);
	$('span.ribbon').toggle(function() {
			$(this).html("Скрыть ленту работ");
			$("#imgscroll").show();			
		}, function() {
			$(this).html("Показать ленту работ");
			$("#imgscroll").hide();
		}
	);
	
	var box=$('a[rel=project]').clone().slimbox({
			overlayOpacity: 0.6,			
			counterText: "{x} из {y}"			
	});	
	$('#gallery').galleria({
		extend: function() {
			this.bind(Galleria.LOADFINISH, function(e) {
				var index = this.active;
				$(e.imageTarget).bind('click', { active: this.active }, function(ev) {
					box.eq(ev.data.active).click();
				});
			});
		},
    image_crop: true,
     debug: true
	});
	


}); 
