
var flashvars = {};
var params = { "wmode" : "transparent", "play" : "true", "allowscriptaccess" : "always", "allownetworking" : "all" };
var attributes = { "id" : "flash", "styleclass" : "fl" };

swfobject.embedSWF("media/site/swf/loader.swf", "flash", "900", "750", "10.0.0", "media/site/swf/expressInstall.swf", flashvars, params, attributes);

galeria = function(id) {
		$(function() {
			var gal = $("#galeria").overlay({
				expose: { 
				color: '#333',
				opacity: 0.1
				},
				closeOnClick: true,
				onBeforeClose: function(event) {
					$('#galeria').empty();
				},
				api: true
		}).load();
		$('#galeria').load('/muzeo/fotos/'+id+'/ #gallery_wrapper', function(){
			$("img.rounded").load( function () {
				var img = $(this);
				if ( $("div.rounded_wrapper").length == 0 ) {
					var wrapper = $('<div class="rounded_wrapper"></div>');
					wrapper.width(img.width());
					wrapper.height(img.height());		
					wrapper.css('float', img.css('float'));
					img.css('float', 'none');
					wrapper.css('margin-right', img.css('margin-right'));
					img.css('margin-right', '0');
					wrapper.css('margin-left', img.css('margin-left'));
					img.css('margin-left', '0');
					wrapper.css('margin-bottom', img.css('margin-bottom'));
					img.css('margin-bottom', '0');
					wrapper.css('margin-top', img.css('margin-top'));
					img.css('margin-top', '0');
					wrapper.css('display', 'block');
					img.css('display', 'block');
					img.wrap(wrapper);
					img.after('<div class="tl"></div>');
					img.after('<div class="tr"></div>');
					img.after('<div class="bl"></div>');
					img.after('<div class="br"></div>');
				} else {		
					var wrapper = $('div.rounded_wrapper');
					wrapper.width(img.width());
					wrapper.height(img.height());
				}
			});

			$(".items img").click(function() {
				$('img#pic').attr('src','/media/site/img/big_blank.gif');
				var src_thumb = $(this).attr('src');
				var src_thumb_parsed = src_thumb.split('.');
				src_thumb_parsed[src_thumb_parsed.length-2] = '533x400';		
				var src_big = src_thumb_parsed.join('.');
				$imgPreload = $('<img id="imgPreload" />');
				$imgPreload.load(function(){
					$('img#pic').attr('src',src_big);
				}).attr('src', src_big);
			});
	
			 $("div.scrollable").scrollable({
				vertical:true,  
				size: 6
			 });
			 $(".items img:eq(0)").click();
		});
	});
}