//////////////////////////////////////////////
//											//
//	 Bild popup av Henrik Danielsson 2005  	//
//	   Fritt att göra vad ni vill med :)	//
//	            info@d-zon.net				//
//											//
//////////////////////////////////////////////
function popup(filename) {
	
	var myImage = new Image();
    
    myImage.src=filename;
    properties='status = 0, height = 300, width = 300, resizable = 0, scrollbars=NO';
    var imgWindow = window.open('','',properties);
    
    html = '<html>';
    html += '<head>';
    html += '<title>Romarhedensmotor.com</title>';
	html += '<script type="text/javascript">';
	html += 'var temp=self.location.href.split("?");';
	html += 'var picUrl = (temp.length>1)?temp[1]:"";';
	html += 'var NS = (navigator.appName=="Netscape")?true:false;';
	html += 'function fitPic() {';
	html += 'iWidth = (NS)?window.innerWidth:document.body.clientWidth;';
	html += 'iHeight = (NS)?window.innerHeight:document.body.clientHeight;';
	html += 'iWidth2 = document.images[0].width - iWidth;';
	html += 'iHeight2 = document.images[0].height - iHeight;';
	html += 'window.resizeBy(iWidth2+42, iHeight2+42);';
	html += 'windowX = (window.screen.width-((NS)?window.innerWidth:document.body.clientWidth+42))/2;';
	html += 'windowY = (window.screen.height-((NS)?window.innerHeight:document.body.clientHeight+42))/2;';
	html += 'window.moveTo(windowX,windowY);';
	html += 'self.focus();';
	html += '};';
	html += '</script>';
    html += '</head>';
    html += '<body style="margin:0;padding:0;background-color:#363636;overflow:hidden;" onblur="self.close()">';
    html += '<div style="text-align:center;"><img src="'+myImage.src+'" onLoad="fitPic();" onclick="self.close();" style="margin:18px auto;border:1px solid #dadada;" alt="Visar en bild" /></div>';
    html += '</body>';
    html += '</html>';

    imgWindow.document.write(html);
}
