// popup a htm file which include the image
//*************** globals vars *****************
var imgWin='';
var dumImg=null;

// create image object and set the source image
function JK_PopImage (nm, nm2)
{
	nm2 = nm2 || nm;
	dumImg = new Image();
	dumImg.src=imgpath + nm;
	var timerID=setTimeout("ppWin('"+nm+ "','" +nm2 + "');", 5000);
}

// obtain the image's width and height, popup a window
function ppWin(nm, nm2)
{
	var WIDTH, HEIGHT, LEFT, TOP, WINFEATURE;
	
	WIDTH = dumImg.width;
	HEIGHT = dumImg.height;
	LEFT = (screen.width-WIDTH)/2;
	TOP = (screen.height-HEIGHT)/2;
	WINFEATURE = "toolbar=no,resizable=no,scrollbars=no,menubar=no,status=no,left=" + LEFT + ",top=" + TOP;
	
	if (!imgWin)
		imgWin = window.open("", "imgWin", "width=" + WIDTH + ",height=" + HEIGHT + ',' + WINFEATURE);
	else {
		if (!imgWin.closed){
			imgWin.close();
		}
		imgWin = window.open("", "imgWin", "width=" + WIDTH + ",height=" + HEIGHT + ',' + WINFEATURE);
	}
	WriteImage(imgWin, nm, nm2);
}

// write out image htm code
function WriteImage(winob, img, nm2)
{
	var result="";
	result += '<html><head><title>'+nm2+'</title></head>';
	result += '<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">'
	result += '<a href="javascript:close();"><IMG src=' + imgpath + img + ' border=0></a><br>';
	result += '</body></html>';
	winob.document.write(result);
	dumImg=null; // reset
}

