
$(document).ready(function() {
	if ($("#infinite").length>0){

//alert('Elements:'+$("#infinite .items a").size());

		if($("#infinite .items a").size()==1){
			$(".scrollable").css("height", "136px");
		}
		else if($("#infinite .items a").size()==2){
			$(".scrollable").css("height", "272px");
		}
		else if($("#infinite .items a").size()>2){
			$(".scrollable").css("height", "408px");
		}

		$("#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'
		});
	}
});
