	var galleries = {};
	var links = [];
	var items = [];
	$(document).ready(function()
	{
		
		

		
		/*var zIndexNumber = 1000;
		$('div').each(function()
		{
			$(this).css('zIndex', zIndexNumber);
			zIndexNumber -= 10;
		});	*/
	
	});	
	
	$(window).scroll(function()
	{		
		var scrollpos = $(window).height() + $(window).scrollTop();
		$("div.scrollable").each(function()
		{
			var id = $(this).attr("id");
			
			if(scrollpos >= $(this).position().top)
			{
				if(!galleries[id] == true)
				{
					galleries[id] = true;
					var pageId = links[$(this).attr("id")];
					pageId = pageId.substring(pageId.length-4);
					
					$.ajax({
						type: "GET",
						url: links[$(this).attr("id")],
						data: null,
						success: function(msg)
						{
							try
							{
								$("#"+id.replace("scrollable", "items")).html($(msg).filter("div"));							
								$("div.scrollable").scrollable({ 
									horizontal:true,  
									size: 2
								});
								
						
								$('a.gal'+pageId+'').lightBox({
									fixedNavigation:true,
									overlayBgColor: '#000',
									imageLoading: '/Files/HTML/images/lightbox-ico-loading.gif',
						    		imageBtnClose: '/Files/HTML/images/hotel_luk.gif',
									imageBtnPrev: '/Files/HTML/images/lightbox-btn-prev.gif',
									imageBtnNext: '/Files/HTML/images/lightbox-btn-next.gif'
									
								});
								/*$(".items a").lightBox({
									fixedNavigation:true,
									overlayBgColor: '#000',
									imageLoading: '/Files/HTML/images/lightbox-ico-loading.gif',
						    		imageBtnClose: '/Files/HTML/images/hotel_luk.gif',
									imageBtnPrev: '/Files/HTML/images/lightbox-btn-prev.gif',
									imageBtnNext: '/Files/HTML/images/lightbox-btn-next.gif'
									
								});*/
							}
							catch(err)
							{
								//alert("#"+id.replace("scrollable", "items"));
							}
							//setTimeout("Base.Trace($('.items a').length);", 200);
						}
					});
				}
			}				
		})
    });
