﻿	
	// Function to resize and reposition a max view.
	// 
	// If this is a from a double-page display of title page or page 1, then
	// scroll right to display the text (as LH page is blank in these cases)
	//
	// If from a single-page display, then show half-size to allow 2 pages to be compared,
	// and position R or L depending on which image was expanded.
	// If single-page view was of a RH page, then scroll right to show it.
	function resize(LPage, showRight)
	{
	
		if (window.name == "FullWin" )
		{ 
			window.moveTo (0,0)
			window.resizeTo (screen.availWidth, screen.availHeight);
	
			if ( LPage == 0  || LPage == -2 )
			{
				self.scrollTo(800,0);
			}
		}
		else
		{	
			window.resizeTo (screen.availWidth/2, screen.availHeight);
	
			if (window.name == "RHWin" )
			{	
				window.moveTo (screen.availWidth/2, 0) 
			}
			else
			{	
				window.moveTo (0,0)
			}

			if ( showRight == 1 )
			{
				self.scrollTo(800,0);				
			}
			else
			{
				self.scrollTo(250,0);
			}
		}

		return true
	}

	// Functions to pop up the maximum view window
	// 
	// popUpL and popUpR show the LH and RH pages respectively. The resize() 
	// called by PageMax fits these to half-screen size, and setting the focus
	// to the other window first ensures that they are seen tiled.
	//
	// popUp is used from the single-view page and just pops up it's max view.
	//
	var lhWindow = null;
	var rhWindow = null;

	function popUpL(url, name) {
		if (rhWindow && !rhWindow.closed)
		{
			rhWindow.focus();
		}
		lhWindow=window.open(url, name, "toolbar=no,scrollbars=yes,resizable=yes");
		lhWindow.focus();
	}
	
	function popUpR(url, name) {
		if (lhWindow && !lhWindow.closed)
		{
			lhWindow.focus();
		}
		rhWindow=window.open(url, name, "toolbar=no,scrollbars=yes,resizable=yes");
		rhWindow.focus();
	}
	
	function popUp(url, name) 
	{
		newWindow=window.open(url, name, "toolbar=no,scrollbars=yes,resizable=yes");
		newWindow.focus();
	}
	
	// Function to pop up the Help window for information on this quarto.
	
	function popUpHelp(url, name) 
	{
		newWindow=window.open(url, name, "height=550,width=600,top=0,left=0,toolbar=no,scrollbars=yes,resizable=yes");
		newWindow.focus();
	}
	function reposition() 
	{
			self.scrollTo(0,160);
	}
	
function imgOn(name)
{	
	if (document.images[name]) document.images[name].src = window[name+"on"].src;
}

function imgOff(name)
{
	if (document.images[name]) document.images[name].src = window[name+"off"].src;
}

