
$('.showI').click(function() {
						   showI($(this).attr('src'));
						   });



function showI(s) {
	// skapa ny div
	$('<div>',{'id':'ake','class':'showidiv','click':function(){showIclose();}}).appendTo("body")
							.css({'z-index':10,'width':$(window).width(),'height':$(window).height()});
	s = s.replace(/\/[0-9]+\/[0-9]+\//,'/'+Math.floor($(window).width())+'/'+Math.floor($(window).height())+'/');
	$('<img>',{'id':'akeimg','click':function(){showIclose();},'src':s,'style':'z-index:9'}).appendTo("#ake")
			.css({'margin':'auto'})
			.load(function() {
							   iw = $(this).width();
							   ih = $(this).height();
							   ww = $(window).width();
							   wh = $(window).height();
							   $(this).css({'z-index':11,'position':'fixed','top':Math.round((wh-ih)/2),'left':Math.round((ww-iw)/2),'cursor':'default'});
							   $('#ake').css({'cursor':'default'});
							   });
    return false;
}

function showIclose() {
	$('#ake').remove();
	$('#akeimg').remove();
}


$(window).resize(function() {
						  if(iw = $('#akeimg').width()) {
							   ih = $('#akeimg').height();
							   ww = $(window).width();
							   wh = $(window).height();
							   ir = ih/iw;
							   iw = ww;
							   ih = iw*ir;
							   if(ih>wh) {
								   ih = wh;
								   iw = ih/ir;
							   }
								$('#ake').css({'width':$(window).width(),'height':$(window).height()});
								$('#akeimg').css({'width':iw,'height':ih,'top':Math.round((wh-ih)/2),'left':Math.round((ww-iw)/2)});
							  }
						});

