function OpenDoc(doc)
{
	window.open(doc);
}

function SpanLinkOn(obj, on)
{
	obj.className = on ? "BlueTextRegularLinkOn" : "BlueTextRegularLinkOff";
}

function OpenTrimWin(page, name, w, h)
{
	var top = (screen.height-h)/2;
	var left = (screen.width-w)/2;
	
	window.open(page, name, "top="+top+",left="+left+",height="+h+",width="+w+",status=yes,toolbar=no,menubar=no,location=no");
}

// close pop-up image windows
function closeImageWindow() {
	if (ImageWindow != null && !ImageWindow.closed) ImageWindow.close();
}

// open a new, formatted image window
var ImageWindow = null;
function openImage(imageURL, imageTitle, imageWidth, imageHeight) {
	// check if window is open: then close
	closeImageWindow();

	// create an Image Window
	ImageWindow = openCenteredWindow('', 'ImageWindow' + imageWidth + '_' + imageHeight, imageWidth, imageHeight, 'yes');
	// write to, and format, ImageWindow
	ImageWindow.document.open();
	ImageWindow.document.write('<html><head><title>' + imageTitle + '</title></head><body onclick="window.close();" style="margin: 0px; background-color: #000000;"><table cellspacing="0" cellpadding="0" style="width: 100%; height: 100%;"><tr><td style="text-align: center; vertical-align: middle;"><img src="' + imageURL + '" alt="" style="border: 0px;" /></td></tr></table></body></html>');
	ImageWindow.document.close();
}

// open a content window (with consideration for screen size)
function openCenteredWindow(contentURL, contentTitle, contentWidth, contentHeight, scrollBars) {
	// center window on screen
	var winLeft = (screen.width - 1 - contentWidth) / 2;
	var winTop = (screen.height - 1 - contentHeight) / 2;

	if (winLeft < 0) {
		scrollBars = 'yes';
		winLeft = 10;
		contentWidth = screen.width - 30;
	}
	if (winTop < 0) {
		scrollBars = 'yes';
		winTop = 10;
		contentHeight = screen.height - 100;
	}

	var NewWindow = window.open(contentURL, contentTitle, 'scrollbars=' + scrollBars + ', width=' + contentWidth + ', height=' + contentHeight + ', top=' + winTop + ', left=' + winLeft + ', screenX=' + winLeft + ', screenY=' + winTop);
	NewWindow.focus();
	return NewWindow;
}