// Global Deglarations //
var win =0;
var preloadImage = "";

// Function that centers a window on the screen given the window handle,width and height //
function centerOnScreen(WIN, WIDTH, HEIGHT){
	WIN.moveTo((screen.width - WIDTH) / 2, (screen.height - HEIGHT) / 2);
}

function openPreview(imageURL) { 
	preloadImage = imageURL;
	var features ='scrollbars=no,status=no, width=400, height=200';
	if (win !=0) {
		win.close();
	}
	win=window.open("popup.html","Preview",features);
}

function closeWin(){
	if (win !=0) {
		win.close();
		preloadImage = "";
	}
}