/* function to popup new window
 *
 * by Tim Patterson, http://tim.rocketry.org
 *
 * winWidth:	width of new window
 * winHeight:	height of new window
 * winTitle:	title to display (optional)
 * txtContent:	if for text supply full text (optional)
 * imgPath:		if for an image supply full path to image (optional)
 */

// variable for new window to write to
var newWindow;

function popWindow( winWidth, winHeight, winTitle, txtContent, imgPath ) {
	// variables submitted as arguments
	var winWidth;
	var winHeight;
	var winTitle;
	var txtContent;
	var imgPath;
	
	// variable to hold window text or image data
	var winContent;
	
	if( imgPath != "" ) {
		// if an image make it so they can click image to close popup window
		winContent = "<a href='javascript:window.close()'><img src='" + imgPath + "' alt='" + winTitle + "' border='0' /></a>";
	} else {
		// if no image path supplied assume text
		winContent = txtContent;
	}
	
	// pop open new window
	newWindow = window.open( '', 'popWindow', 'toolbar=0,location=0,status=0,scrollbars=0,width=' + winWidth + ',height=' + winHeight + ',copyhistory=0' );
	
	// write our content to popup window
	newWindow.document.write( '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml-transitional.dtd">\n' );
	newWindow.document.write( '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">\n' );
	newWindow.document.write( '<head>\n' );
	newWindow.document.write( '<meta http-equiv="content-type" content="text/html; charset=utf-8" />\n' );
	newWindow.document.write( '<meta http-equiv="cache-control" content="no-cache" />\n' );
	newWindow.document.write( '<meta http-equiv="pragma" content="no-cache" />\n' );
	newWindow.document.write( '<meta name="content-language" content="en-US" />\n' );
	newWindow.document.write( '<meta name="author" content="Tim Patterson" />\n' );
	newWindow.document.write( '<meta name="robots" content="no index, no follow" />\n' );
	newWindow.document.write( '<link rel="stylesheet" href="/includes/styles.css" type="text/css" media="screen" />\n' );
	newWindow.document.write( '<title>' + winTitle + '</title>\n' );
	//newWindow.document.write( '<script type=\"text/javascript\" src=\"/includes/targetOpener.js\"></script>\n' );
	newWindow.document.write( '</head>\n' );
	newWindow.document.write( '<body style=\"padding: 0px;\">\n' );
	//newWindow.document.write( '<p class=\"normalBold\">' + winTitle + '</p>\n' );
	newWindow.document.write( '<p>' + winContent + '</p>\n' );
	//newWindow.document.write( '<p class=\"normalSmall\">[<a href=\"javascript:window.close();\">close this window</a>]</p>\n' );
	/*
	 * need to add an if() to see if `txtContent' argument exists (if so we'll do the following)
	 */
	//newWindow.document.write( '</body>\n' );
	//newWindow.document.write( '</html>\n' );
	
	// stop writing to popup window
	newWindow.document.close();
}