var newWin;
var currentImage;
var features = "menubar=no, resizable=no, scrollbars=no, toolbar=no, status=no, width=50, height=50, screenX=100, screenY=100";


function openWindow(theURL,winName) {
if (!newWin || newWin.closed)
  newWin = window.open(theURL,winName,features);
else if (newWin.focus) {
        // window is already open and focusable, so bring it to the front
        newWin.focus( );
    }
       // newWin.window.setTimeout("setImageToView("+toView+")", 50);
}
function displayImage(imageToView){
	currentImage = imageToView;
	window.setTimeout("setImageToView( )", 1000);
	//window.setTimeout("alert(" + sMsg + ")", 1000);
}
function setImageToView(){
	if(newWin.document.getElementById){
		//imageHolder = newWin.document.getElementById("viewImage");
		//imageHolder.src = currentImage;
		p = newWin.document.getElementById("placeholder");
		p.innerHTML = "<img src='"+currentImage+"' alt='' id='' />";
        setTimeout("resizeToImageSize( )", 1000);
	}
}
function resizeToImageSize(){
	newWin.window.resizeTo(newWin.document.images[0].width+50,newWin.document.images[0].height+90);
	newWin.focus( );
}
