<!-- 
//----- 12-10-03, 12-19-03 ka1fsb/kbn
//----- 01-28-04
//----- 03-30-04
//----- Open a window on some trigger...
//----- A simple "square" window on demand, with optional text/caption 
//----- All major dimensions can be passed in as arguments...
//----- myFile can be either a jpg or an html file
//----- myFile can also be "this" meaning this "myText" here in the page

function createMyWindow(myTitle, 	// Window bar title
			myFile, 	// Name of image, url, or html
			winSquare, 	// A side of the square window
			picWd, 		// Width of image
			picHt, 		// Height of image
			myText)		// Optional text, caption
{
//----- Inits...
	var myURL    = "";
	var myHeight = "";
	var myWidth  = "";
	var myTest   = "";

//----- If winSquare comes in with a separated list: width.height
//----- Convert to a string... then back to a number, for 000 use 001 etc
	myTest = String(winSquare);

	if ( myTest.match(/\./) )
	{
		var dimens = myTest.split(".");
		myWidth    = Number(dimens[0]);
		myHeight   = Number(dimens[1]);
	}
	else
	{
		myWidth  = winSquare;
		myHeight = winSquare;
	}

	if ( myFile.match(/\.html$/) )
	{
		myURL  = myFile;
		myFile = "";
	}

//----- Data inits...
	var msg = "Detail View Window "+myWidth+"x"+myHeight;
	var statMsg = "status='" + msg + "'; return true;";

//----- Create a new smaller window
//----- No spaces between the quotes for a window.open arg list...
	var w = window.open(myURL,
			"myWindow", 
			"resizable,status,top=90,left=100,width="+myWidth+",height="+myHeight
			);

//----- Do you want to adjust these vars? was w.moveBy
//-----	w.moveTo(100,90);

//----- Bail out here if showing an html document
	if ( !myFile ) return true;

//----- We are only passing text data here... if it is "this"
	if ( myFile.match(/this$/) )
	{
		myFile = "";
	}

//----- Implicitly open this document for writing...
	var d = w.document;

	d.write("<html><head><title>" + myTitle + "</title></head>");
	d.write('<body onload="' + statMsg + '">');

//----- If we have an image file then write...
	if ( myFile )
	{
//----- Position image...
	     d.write('<p><br><center>');

//----- If we supplied dimensions, then use them...
		if ( picWd )
		{
			d.write('<img src='+myFile+' width="'+picWd+'" height="'+picHt+'">');
		}
		else
		{
//----- Else assume the picture will be fully displayed, and is right size.
			d.write("<img src="+myFile+">");
		}

	     d.write("</center><br>");
	}

//----- If we have text then write...
//----- Double quotes are noted as &#34; in the passed-in text itself
//----- This may be a caption for an image, or actual text body
	if ( myText )
	{
		d.write(myText);
	}

//----- This is also for an image file for spacing
//----- If this is not an image file, the passed in lines should handle this...
	if ( myFile )
	{
		d.write("</p><br>");
	}

//----- Close tags at the bottom of the page...
	d.write("</body></html>");


//----- Close the document to further writing, but keep the window up.
//----- NOTE: w.close will close the window before it can be seen.
	d.close();

	return true;
}
//----- End of mywindow.js
//-->
