// This javascript is used specifically with R10901.
/***********************
It is critical that the following HTML code be located within the BODY tags of the document using the popup:

	<div id="popuplayer" style="position:absolute; visibility:hidden;">
		<table bgcolor="#ffffcc" cellpadding=4 cellspacing=0 border=1><tr><td>
		<p class="TABLE" align="right"><a href="javascript:hidePop()"><img src="x.gif" border=0></a></p><p>
		<div id="content"></div>
		</td></tr></table>
	</div>

***********************/


// alert(screen.availHeight);
// if (document.getElementById && !document.all) { alert(window.innerHeight); }


var y1 = 10;				// increase to position popup further down on the page

// The hidePop() function is very simple.  It looks for a DIV element with an Id of "popuplayer" and then hides it.
// It is used to mimic the closing of a popup window.  Although it appears the popup is being closed, in reality it is just being hidden.
function hidePop() {document.getElementById("popuplayer").style.visibility='hidden';}


// The showPop() function first looks for a DIV element with an Id of "content," then writes the input argument "text" to it.
// Next it looks for a DIV element with an Id of "popuplayer" and makes it visible.
//
// NOTE: The "content" DIV is located within the "popuplayer" DIV.  This was done in order to keep the "text" simple,
//       and to eliminate the repetitive entering of the following code:
//       <p class="TABLE" align="right"><a href="javascript:hidePop()"><img src="x.gif" border=0></a></p><p>

function showPop(image) {
  var imageHTML = "<img src='" + image + "'>";							// format html
  document.getElementById("content").innerHTML = imageHTML;				// write html for image to popup
  document.getElementById("popuplayer").style.visibility='visible';		// show popup
}


// The showPopResize() function works the same as the showPop() function, except that it resizes the image based on the user's viewable area.
// This was done to accomodate users with screen resolutions less than 1280x1024.

function showPopResize(image) {
  var imageH = 770;													// Original height of image.
  var imageW = 595;													// Original width of image.
  var viewable;														// Stores the height of the user's viewable area.
  if (document.all) { viewable = document.body.clientHeight; }		// Internet Explorer
  else { viewable = window.innerHeight; }							// Firefox

  if (viewable < 820) {												// 820 is a general guideline based on the viewable area with a screen resolution of 1280x1024.
	var percent = viewable / 820;
	imageH = 738 * percent;											// 738 = oringal size (770) - top of popup (~32)
	imageW = 570 * percent;											// recalculated based on original aspect ratio and 738 height estimate
  }

/***** RETAINED FOR HISTORICAL PURPOSES ******
  if (screen.height < 768) {			// If user's screen resolution is less than 1024x768, set picture size to 346x268 (45% of original).
	imageH = 346;
	imageW = 268;
  }
  else if (screen.height < 1024 ) {		// If user's screen resolution is less than 1280x1024, set picture size to 501x387 (65% of original).
	imageH = 501;
	imageW = 387;
  }
  else {								// Else set picture size to 770x595 (100% of original).
	imageH = 770;
	imageW = 595;
  }
***** RETAINED FOR HISTORICAL PURPOSES ******/

  var imageHTML = "<img src='" + image + "' height=" + imageH + " width=" + imageW + ">";	// format html
  document.getElementById("content").innerHTML = imageHTML;				// write html for image to popup
  document.getElementById("popuplayer").style.visibility='visible';		// show popup
}

// The placePop() function positions the "popuplayer" DIV element on the page based on the size of the user's browser window and the y1 variable.
// Unlike popups2.js, it also centers the popup vertically on the page.
function placePop() {
  if (document.getElementById && !document.all) {						// Needed for Firefox compatability.
  	document.getElementById("popuplayer").style.top = window.pageYOffset + (window.innerHeight - (window.innerHeight-y1));
  	document.getElementById("popuplayer").style.right = 10;
  }
  if (document.all) {
  	document.all["popuplayer"].style.top = document.body.scrollTop + (document.body.clientHeight - (document.body.clientHeight-y1));
  	document.all["popuplayer"].style.right = 10;
  }
  window.setTimeout("placePop()", 10);
}

window.onload=placePop;		// re-positions the popup if the user changes the size of their browser window

// RBB, 01/08/2007

