    /////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
   //            JavaScript code for Hall Xtra!              \\
  //  Written by Kevin Stanek of Stanek Software Development  \\
 //                         26 Feb 2003                        \\
/////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

// variables defined in locations.js
// urlBookSite
// urlContact
// urlDiscipline
// urlDisclaimer
// urlFreeSite
// urlGetFlash
// urlGetQuickTime
// urlHelp
// urlSWCollege
// urlWebmaster

// determine the computer platform
var platMac = (navigator.appVersion.indexOf("Mac") != -1);
var platWin = (navigator.appVersion.indexOf("Win") != -1);

// determine the browser in use
var browNet  = (navigator.appName.indexOf("Netscape") != -1);
var browNet6 = (browNet && navigator.appVersion.substr(0,1) > "4");
var browMic  = (navigator.appName.indexOf("Microsoft") != -1);

var popWin = null;
var currChapFolder = this.location.toString().split("/");
	currChapFolder = currChapFolder[(currChapFolder.length)-2];


// -----------------------------------------------
// BuyProduct
// -----------------------------------------------
function BuyProduct(url)
{
	if (url != "")
	{
		OpenSecWin(600, 400, url, true, true, 2);
	}
}

// -----------------------------------------------
// ChapterIntroVideo
// -----------------------------------------------
function ChapterIntroVideo(spd)
{
	if (spd != "")
	{
		OpenSecWin(600, 400, urlFreeSite + currChapFolder + "/chap_intro_video_" + spd + ".htm", true, true, 3);
	}
}

// -----------------------------------------------
// CopyrightDisclaimer
// -----------------------------------------------
function CopyrightDisclaimer()
{
	OpenSecWin(600, 400, urlDisclaimer, true, true, 5);
}

// -----------------------------------------------
// CopyrightWebmaster
// -----------------------------------------------
function CopyrightWebmaster()
{
	OpenSecWin(600, 400, urlWebmaster, true, true, 6);
}

// -----------------------------------------------
// GetFlash
// -----------------------------------------------
function GetFlash()
{
	OpenSecWin(760, 400, urlGetFlash, true, true, 20);
}

// -----------------------------------------------
// GetQuickTime
// -----------------------------------------------
function GetQuickTime()
{
	OpenSecWin(760, 400, urlGetQuickTime, true, true, 21);
}

// -----------------------------------------------
// Help
// -----------------------------------------------
function Help(topic)
{
	OpenSecWin(500, 300, urlFreeSite + "help/" + topic + ".htm", true, true, 26);
}

// -----------------------------------------------
// JavaApplet
// -----------------------------------------------
function JavaApplet(url)
{
	if (url != "")
	{
		OpenSecWin(600, 400, url, false, false, 27);
	}
}

// -----------------------------------------------
// LearnObj
// -----------------------------------------------
function LearnObj(which)
{
	OpenSecWin(600, 400, urlFreeSite + currChapFolder + "/objective_" + which + ".htm", false, false, 28);
}

// -----------------------------------------------
// OpenSecWin
// -----------------------------------------------
function OpenSecWin(wd, ht, URL, showAddr, showTbar, winNum)
{
	winLeft = Math.floor((screen.width - wd) / 2);
	if (platMac)
	{
		winLeft -= 8;
	}
	else
	{
		winLeft -= 6;
	}
	if (winLeft < 0)
	{
		winLeft = 0;
	}
	else if (winLeft > screen.width - wd)
	{
		winLeft = screen.width - wd;
		if (platMac)
		{
			if (browNet)
			{
				winLeft -= 12;
			}
			else
			{
				winLeft -= 30;
			}
		}
		else
		{
			winLeft -= 12;
		}
	}
	// form features with which to open the window
	if (browMic || browNet6)
	{
		openFeatures = "height=" + ht;
		openFeatures = openFeatures + ",width=" + wd;
		openFeatures = openFeatures + ",left=" + winLeft;
		openFeatures = openFeatures + ",top=0";
	}
	else
	{
		openFeatures = "innerHeight=" + ht;
		openFeatures = openFeatures + ",innerWidth=" + wd;
		openFeatures = openFeatures + ",screenX=" + winLeft;
		openFeatures = openFeatures + ",screenY=0";
	}
	openFeatures = openFeatures + ",menubar=yes";
	openFeatures = openFeatures + ",resizable=yes";
	openFeatures = openFeatures + ",scrollbars=yes";
	openFeatures = openFeatures + ",status=yes";
	if (showTbar)
	{
		openFeatures = openFeatures + ",toolbar=yes";
	}
	else
	{
		openFeatures = openFeatures + ",toolbar=no";
	}
	if (showAddr)
	{
		openFeatures = openFeatures + ",location=yes";
	}
	else
	{
		openFeatures = openFeatures + ",location=no";
	}

	// open the window
	win = window.open(URL, "______________________________".substr(1,winNum), openFeatures, "");

	// bring the window to the top
	win.focus();

	// in 1/2 second, raise the window under Windows
	if (platWin)
	{
		popWin = win;
		setTimeout("OpenSecWinPop()",1500);
	}
}

// -----------------------------------------------
// OpenSecWinPop
// -----------------------------------------------
function OpenSecWinPop()
{
	if (typeof popWin != "undefined")
	{
		if (!popWin.closed)
		{
			popWin.focus();
		}
	}
}


