// use this file to control VTJ by doing these things to your html document:// 1. in your <script> block, you can optionally define these variables;//		var documentName = 'AcctPricing/IMA001';		what document would you like to start out with? If omitted, default is no document (blank image area)//		var properties = 'VTJsupply.properties';		what is the name of the properties file? If omitted, default will be "external.properties"//														properties file relative to javabin directory//		var javabinPath = '/vtj/javabin';				where is the javabin directory? If omitted, default will be "/intranet/javabin"//														use absolute path unless all files are in one directory, some browsers take relative path from calling file, others from defining file//		var imagingURL = '../viewtiff/viewimage.html';	where is the viewimage file? If omitted, default will be viewimage.html in the current directory.//		var vtj		= parent.frame["ImageViewer"];		If the viewer is within a frame named "ImageViewer"// 2. after your script block ends, add this line: 	<script src="[path to file]/display.js" type="text/javascript" language="javascript"></script>// 3. Now you can call: DisplayImage(newDocName); anywhere in your html document, or more important, you can call//		parent.DisplayImage(newDocName); from a frame when your html document is a frameset//		opener.DisplayImage(newDocName); from a window that you open from your html document // 'newDocName' is the URL to the image, relative to the "BufferVol" parameter of the applet//// The standard approach to using this function to display an image from a HTML link://  <A href='javascript:DisplayImage("newDocName")' title='Link fly-over pop-up message if desired' onMouseOver='self.status="Status line message here"; return true;'//			onMouseOut='self.status=""; return true;'><img src='link image URL if any' border=1>Link Text if any</a>//// If you are opening viewer in a separate window and client computers may have pop-up blockers, a different approach will open directly from the link if a pop-up// blocker prevents opening a window from Javascript, construct a link to display an image as follows:////  <A href='viewimage.html#docname' target=ImageViewer onClick='return DisplayImage("docname");' (see above for other link options)>Link Text if any</a>if ((typeof vtj) == "undefined") var vtj = null;if (((typeof documentName)== "undefined") || documentName== null) var documentName = "";if (((typeof imagingURL)  == "undefined") || imagingURL  == null) var imagingURL = "viewimage.html";// IE uses different screen positioning (see below)var isIE = (navigator.userAgent.indexOf("MSIE") >= 0);// used to detect a pop-up blocker that stops the Javascriptvar popupBlocked = false;// This function will return false if the window cannot be opened (pop-up blocker), this allows an HTML link to directly// open the window if DisplayImage() called from 'onClick' function of the link and failsfunction DisplayImage(newDocName) {		 	// this variable is picked up by 'viewimage.html' and used to display the image:	if(pad0>0) {		var zerosStr = "000000000000";		documentName=zerosStr.substr(0,pad0-newDocName.length) + newDocName;	}	else documentName=newDocName; 	if (vtj == null || vtj.closed) {	// if viewing in separate window, and window not opened yet or was closed...		// some pop-up blockers will kill the javascript right at window.open, so we set a flag here so at least		// on the next click we won't try and window will be opened directly from the link		if (popupBlocked) return(false);		popupBlocked = true;		// These sizes (650 by 860) show an 8 by 11 page at full size		bestWidth = 650;		bestHeight = 860;		winHeight = screen.availHeight - 50;	// leave room for windows start menu bar, and status line		winWidth = screen.availWidth - 10;		xpos = 0;		ypos = 0;		if (winWidth > bestWidth) {			xpos = (winWidth - bestWidth) - 10;		// place window on right side			winWidth = bestWidth;			}		if (winHeight > bestHeight) {			ypos = (winHeight - bestHeight) / 2;	// center window vertically			winHeight = bestHeight;			}		if (isIE) screenPosOption = "left="+xpos+",top="+ypos;		else screenPosOption = "screenX="+xpos+",screenY="+ypos;		vtj = window.open(imagingURL, "ImageViewer", "width="+winWidth+",height="+winHeight+"," + screenPosOption + ",status=yes,resizable=yes");		popupBlocked = false;		if (vtj == null || vtj.closed) // pop-up blocker detected			return false; // return false, we failed to display the image, the link will bring up image manually	}	else {	// window is open, just tell applet new document name		fetchImage(documentName);	}	return true;}// Certain browsers (e.g. IE on Macintosh) do not support calls from Javascript to Java, so we must reload the applet// Some browsers cannot handle onerror either, so we have to detect whether the JavaScript to Java fails.var saveOnError = self.onerror;var errorOccured;var noJS2J = false;function reloadVTJ(msg, url, line) {	noJS2J = true;	errorOccured = true;	// may need to use vtj.location.replace(imagingURL); if using frame and not loaded with viewimage.html to start	vtj.location.reload();	return true;}function fetchImage(newDocName) {	documentName=newDocName;		// used if applet page reloaded on window resize	vtj.focus();	if (noJS2J) {		reloadVTJ("No JavaScript to Java", "self", "0");	} else {		errorOccured = false;		noJS2J = true;		self.onerror = reloadVTJ;		if ((typeof vtj.document.viewer) == "undefined") {			reloadVTJ("No JavaScript to Java", "self", "0");			noJS2J = false;	// this is probably a user double-click, so don't give up on JS2J			return;		}		vtj.document.viewer.setDocName(newDocName);		noJS2J = errorOccured;		self.onerror = saveOnError;	}}
