$(document).ready(function(){
	// Вертикальная галерея
	if ($("#infinite").length>0){
	//alert('Elements:'+$("#infinite .items a").size());
			var galsize = $("#infinite .items a").size();
			if(galsize==1){
				$(".scrollable").css("height", "136px");
			}
			else if(galsize==2){
				$(".scrollable").css("height", "272px");
			}
			else if(galsize>2){
				$(".scrollable").css("height", "430px");
			}
			if(galsize>3)
				$("a.up").css("display","block");
			
			$("#infinite").scrollable({ vertical: true }).find("a").tooltip({
				// use this single tooltip element for all trigger elements
				tip: '#tooltip',
		//		effect: 'fade',
				onBeforeHide: function() {
					$("#tooltip").empty();
				},
				onShow: function() {
					if(!$("#tooltip").text()){
						this.getTip().hide();
					}
				}
			}).overlay({
				// each trigger uses the same overlay with id "gallery"
				target: '#gallery',		
				// optional exposing effect with custom color
				expose: { 
			 
					color: '#000000', 
					loadSpeed: 200, 
					opacity: 0.8 
				}		
			// gallery plugin
			}).gallery({		
				// do not use the same disabled class name as scrollable
				disabledClass: 'inactive'
			});
	}
});
