﻿
function new_image(url, name)
{
var img = new Image();

img.src = url;


if(img.complete)
{

	var w = img.width+25;
	var h = img.height+25;
	var w1 = img.width;
	var h1 = img.height;

	var title = 'Waterlilly - inspiring furniture';
	//title = name;

	var wleft = (screen.width - w) / 2;
	var wtop = (screen.height - h) / 2;
	
	var bilde=url;
	while (bilde.indexOf("/")>0)
	{
		bilde = bilde.substring(bilde.indexOf("/")+1);
		//alert(bilde.indexOf("/"));
	}
	

	var win = window.open("", name, 'width=' + w + ', height=' + h + ', ' + 'left=' + wleft + ', top=' + wtop + ', location=no, menubar=no, status=no, toolbar=no, scrollbars=no, resizable=no');
	
	win.document.open();
	win.document.writeln("<html>");
	win.document.writeln("<head>");
	win.document.writeln("<title>"+title+"</title>");
	win.document.writeln('<link href="../wlilly.css" rel="stylesheet" type="text/css" />');

	win.document.writeln('</head>');
	win.document.writeln('<body>');
	win.document.writeln('<table id="tabula"\>');
	win.document.writeln('<tr>');
	win.document.writeln('<td>');
	win.document.writeln('<center>');
	win.document.writeln('<a href="javascript:window.close();"><img src="'+url+'" width="'+w1+'" height="'+h1+'" border="0" /></a>');
	win.document.writeln('</tr>');
	win.document.writeln('</td>');
	win.document.writeln('</table');
	win.document.writeln('</body>');
	win.document.writeln('</html>');
	Win.document.close();
	
	return false;
}

else
{
	setTimeout("new_image('"+url+"', '"+name+"');", 25); 
}
}


