$.Artcom = {
	gallery: {
		init: function() {
			$('pre.lazy').lazyLoad();
			$(window).bind('resize', function() {
				$('#gallery_shadowbox-main').center({transition:300});
			});
			$('#shadowbox-close').click(function() {
				$('#shadowbox').fadeOut();
				$('#shadowbox-content-text').html('');
			});
			$('#shadowbox-main').center();
//			$('#shadowbox-main').draggable();
		},
		showFile: function(id) {
			$('#shadowbox-content-text').empty().html('<img style="margin: 250px" src="/images/ajax-loader.gif" />');
			$('#shadowbox-header-text').empty();
			$('#gallery_shadowbox-main').center();
			$('#gallery_shadowbox-content-text').load("?q=ajax/gallery/publicGallery/get/" + id, this.markupLoaded);
		},
		markupLoaded: function(responseText, textStatus, XMLHttpRequest) {
			var film = $('#gallery_file_type').text();

			$('#shadowbox-header-text').html('<p>'+$('#gallery_file_title').html()+'</p>');
			if (film) {
				var movieWidth = $("#gallery_file_type").attr('width');
				var movieHeigth = $("#gallery_file_type").attr('height');
				
				$("#gallery_file").media({width: movieWidth, height: movieHeigth, bgColor: 'transparent', autoplay: true});	// było height: 240;
			}
			$('#shadowbox').fadeIn();
			$('#gallery_shadowbox-main').center();
		}
	}
}

$(document).ready( function() {
	$.Artcom.gallery.init();
});
