function popup(img){
	var obj = $(document);
	$("body",obj).append('<div id="bkd"></div><div id="foto-big"><a href="#" id="foto-close"></a></div>');
	
	$("#foto-big",obj).append('<div id="foto-mid"></div>');	
	
	$("#foto-big").css('background','none');
	$("#foto-close").css('color','#fff');
	$("#foto-mid").css('background','#900 url(\''+img+'\') no-repeat center center');
	
	
	
	$("#bkd").animate({opacity:0.0}, 10, function(){
				$(this).show().animate({opacity:0.9}, 500, function(){
					
				});				
			});
	$("#bkd").click(function(){
				closeFoto();
	});
	
	
	
	var imgTesting = new Image();

			function CreateDelegate(contextObject, delegateMethod)
			{
				return function()
				{
					return delegateMethod.apply(contextObject, arguments);
				}
			}

			function imgTesting_onload()
			{
				//alert(this.width + " by " + this.height);
				$("#foto-mid").css('width', imgTesting.width+'px');
				$("#foto-mid").css('height', imgTesting.height+'px');
				$("#foto-big").css('width', imgTesting.width+50+'px');
				$("#foto-big").css('height', imgTesting.height+50+'px');
				
				$("#foto-big").css('margin','-200px -'+$("#foto-big",obj).width()/2+'px auto');
				
				
				
				$("#foto-big").show('scale', {percent: 100},500,function(){
					var totalH = $(document).height()+50;
					$("#bkd").css('height',totalH+"px");
				});
				$("#foto-close").click(function(){
					closeFoto();
				}); 
				
				
			}

			imgTesting.onload = CreateDelegate(imgTesting, imgTesting_onload);
			imgTesting.src = img;
	
	
	function closeFoto(){
			$("#foto-big").hide('scale',{percent: 0},500,function(){
				$("#foto-big").detach();
				$("#bkd").animate({opacity:0.0}, 500, function(){
					$(this).detach();
				});
			});
	   }
}
