
// Javascript to support the functions of the
// module ImageViewLite

function InvokeImagePopup(url, width, height, alignment) {

	// 1	Top Left
	// 2	Top Center
	// 3	Top Right
	// 4	Middle Left
	// 5	Screen Center
	// 6	Middle Right
	// 7	Bottom Left
	// 8	Bottom Center
	// 9	Bottom Right
	
	var top, left, minVal, sWidth, sHeight;

	minVal = 20;

	sWidth = (screen.availWidth) ? (screen.availWidth) : 0;
	sHeight = (screen.availHeight) ? (screen.availHeight) : 0;	
	
	if (alignment) {
		if (alignment == 1) {
				left = minVal;
				top = minVal;
		} else if (alignment == 2) {
				left = (sWidth - width)/2;
				top = minVal;
		} else if (alignment == 3) {
				left = (sWidth - width) - minVal;
				top = minVal;
		} else if (alignment == 4) {
				left = minVal;
				top = (sHeight - height)/2;
		} else if (alignment == 5) {
				left = (sWidth - width)/2;
				top = (sHeight - height)/2;
		} else if (alignment == 6) {
				left = (sWidth - width) - minVal;
				top = (sHeight - height)/2;
		} else if (alignment == 7) {
				left = minVal;
				top = (sHeight - height) - minVal;
		} else if (alignment == 8) {
				left = (sWidth - width)/2;
				top = (sHeight - height) - minVal;
		} else if (alignment == 9) {
				left = (sWidth - width) - minVal;
				top = (sHeight - height) - minVal;
		}
	} else {
		left = minVal;
		top = minVal;
	}

	var newWindow; 
	newWindow = new Object(); 
	newWindow = window.open(url,"Image","top=" + top + ",left=" + left + ",menubar=no,status=no,toolbar=no,resizable=no,fullscreen=no,width=" + width + ",height=" + height);
	newWindow.opener = self; 
	newWindow.focus();
}
