var objWin;
var timerID;

function resizeImgWin() {
	myImage = objWin.document.getElementById('myImage');
	if (myImage.complete==undefined || myImage.complete) { 
		clearInterval(timerID);
		w=myImage.width;
		h=myImage.height;
		ua=navigator.userAgent;
		if(ua.indexOf("Firefox",0)>=0) {
			objWin.innerWidth=w;
			objWin.innerHeight=h;
		} else if(ua.indexOf("MSIE",0)>=0) {
			objWin.resizeTo(w,h);
			objWin.resizeBy(w-objWin.document.body.clientWidth,h-objWin.document.body.clientHeight-16);
		}
		objWin.document.close();
	}
}

function popupImgWin(url,imgWidth,imgHeight) {
	var path=url;
	var imgtitle=path.substring(path.lastIndexOf('/',path.length)+1,path.length);
	var imgtitle=imgtitle.substring(imgtitle.lastIndexOf('.',imgtitle.length),-imgtitle.length);
	objWin = window.open("","subWindow","width="+imgWidth+",height="+imgHeight+",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
	objWin.document.open();
	tag = '<html>¥n';
	tag += '<head>¥n';
	tag += '<title>'+imgtitle+'</title>¥n';
	tag += '</head>¥n';
	tag += '<body style="margin:0; padding:0;">¥n';
	tag += '<div>¥n'
	tag += '<a href="javascript:window.close();">¥n'; 
	tag += '<img border="0" src="'+url+'" width="'+imgWidth+'" height="'+imgHeight+'" id="myImage">¥n';
	tag += '</a>';
	tag += '</div>¥n';
	tag += '</body>¥n';
	tag +='</html>';
	objWin.document.write(tag);
	objWin.focus();
	timerID=setInterval('resizeImgWin()', 100);
};


