//------------------------------------------------------------//
//					EDITABLE SECTION BEGINS
//
//var FIRST_PAGE_MESSAGE = "This is the first page."
//var LAST_PAGE_MESSAGE = "This is the last page."
//var IMAGE_PATH = "../graphics"
//var glossary = 0;
//
//					EDITABLE SECTION ENDS
//------------------------------------------------------------//

var Netscape = document.layers;
var act = new Array;
var CURRENT_PAGE = 0


//-----------------------------------------------//
//			   NAVIGATION FUNCTIONS              //
//-----------------------------------------------//

function Page(u,n)
{
	this.url = u
	this.name = n
	this.visited = false
}

function addPage(u,n)
{
	act[act.length] = new Page(u,n)
}

//function addPage(url) 
//{
//	act[act.length] = url;
//}

function init()
{
	CURRENT_PAGE = 0
	goPage()
}

function goPage()
{
	self.main.location.replace(act[CURRENT_PAGE].url)
	trackPage(act[CURRENT_PAGE].url)
}

function goFirst()
{
	if(CURRENT_PAGE > 0)
	{
		CURRENT_PAGE = 0
		goPage()
	}
	else alert("This is the first page")
}

function goPrev()
{
	if(CURRENT_PAGE > 0)
	{
		CURRENT_PAGE--
		goPage()
	}
	else alert("This is the first page")
}

function goNext()
{
	if(CURRENT_PAGE < act.length - 1)
	{
		CURRENT_PAGE++
		goPage()
	}
	else alert("This is the last page")
}

function goLast()
{
	if(CURRENT_PAGE < act.length - 1)
	{
		CURRENT_PAGE = act.length - 1
		goPage()
	}
	else alert(LAST_PAGE_MESSAGE)
}

function trackPage(u)
{
	for(var p = 0 ; p < act.length ; p++)
	{
		if(act[p].url == u)
		{
			act[p].visited = true
			break
		}
	}
}

function getPageNos()
{
	var t = '<div class="txt">'
	+ 'Page ' + (CURRENT_PAGE + 1) + ' of ' + act.length
	+ '</div>'
	return t
}

function getPageNosLinks()
{
	var t = '<div class="txt">'
	for(var p = 0 ; p < act.length ; p++)
	{
		if(p != CURRENT_PAGE)
		{
			t += '<a href="javascript:parent.goToPage(' + (p + 1) + ')" '
			+ 'onMouseOver="window.status=\'Go to page ' + (p + 1) + '\'; return true;" '
			+ 'onMouseOut="window.status=\'\'" ' 
			+ '>' + (p + 1) + '</a>'
		}
		else
			t += '<b>' + (p + 1) + '</b>'
		
		if(p < act.length - 1)
			t += ' - '
	}
	t += '</div>';
	return t
}

function goToPage(p)
{
	p--
	CURRENT_PAGE = p
	goPage()
}


//-----------------------------------------------//
//			    WINDOW FUNCTIONS                 //
//-----------------------------------------------//

var f = "top=50,left=80,screenX=50,screenY=80,width=660,height=490,scrollbars,resizable";

// Intranet pop-up
function goIntranet(u, name)
{
	openCenteredWin(u, name, 760, 470)
}

// Resource Room pop-up
function goResources(u, name)
{
	openCenteredWin(u, name, 720, 470)
}

// Communication Tools pop-up
function goCommtools(u, name)
{
	openCenteredWin(u, name, 720, 470)
}

// Welcome pop-up (parent window)
function goWelcome(u, name)
{
	openCenteredWin(u, name, 660, 470)
}

// Welcome pop-up (child window)
function subWelcome(u, name)
{
	openCenteredWin(u, name, 610, 450)
}

// Database pop-up
function openDataBase(u, name)
{
	openCenteredWin(u, name, 760, 470, "scrollbars, menubar, toolbar")
}

// RTF Documents pop-up
function openForm(u, name)
{
	openCenteredWin(u, name, 640, 400)
}

// External sites
function openURL(u, name)
{
	openCenteredWin(u, name, 640, 300, "menubar, toolbar,scrollbars, status, location, resizable")
}

// Audio player pop-up
function openAudio(u, name) 
{
	openCenteredWin(u, name, 210, 110, "toolbars=0,scrollbars=0,menubar=0,location=0,resizable=0,statusbar=0")
} 

// Centered window function
function openCenteredWin(url,name,w,h,p)
{
	if(url != null)
	{
		if(name == null) name = "jWin";
		if(w == null) w = 640;
		if(h == null) h = 400;
		
		if(p){
		var s = p
		} else {
		var s = "scrollbars,resizable,menubar";
		}
		
		s += ",height=" + h + ",innerHeight=" + h;
		s += ",width=" + w + ",innerWidth=" + w;
		
		if(window.screen)
		{
			var aH = screen.availHeight;
			var aW = screen.availWidth;
			var cY = Math.round((aH - h)/2);
			var cX = Math.round((aW - w)/2);
			s += ",left=" + cX + ",screenX=" + cX;
			s += ",top=" + (cY-30) + " ,screenY=" + (cY-30);
		}
		childWindow = window.open(url,name,s);
	}
}

function openCredits(url,name,w,h,p)
{
	if(url != null)
	{
		if(name == null) name = "jWin";
		if(w == null) w = 640;
		if(h == null) h = 400;
		
		if(p){
		var s = p
		} else {
		var s = "scrollbars,menubar";
		}
		
		s += ",height=" + h + ",innerHeight=" + h;
		s += ",width=" + w + ",innerWidth=" + w;
		
		if(window.screen)
		{
			var aH = screen.availHeight;
			var aW = screen.availWidth;
			var cY = Math.round((aH - h)/2);
			var cX = Math.round((aW - w)/2);
			s += ",left=" + cX + ",screenX=" + cX;
			s += ",top=" + (cY-30) + " ,screenY=" + (cY-30);
		}
		childWindow = window.open(url,name,s);
	}
}
function goNavigate() {
	if (document.forms[0].enhanced.checked) {
		location.href="toolbox/index.htm"; 
	} else {
		location.href="toolbox/home_txt.htm";
	}
}


function getResNav()
{
	var ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	t = '<table width="100%" border="0" cellspacing="0" cellpadding="0" class="alpha">'
    + '<tr>'
    + '<td>'
    + '<table width="100%" border="0" cellspacing="1" cellpadding="0">'
    + '<tr height="15">'
	
	for(var c = 0 ; c < ch.length ; c++)
	{
		t += '<td class="cellContent" align="center" '
		
		if( c==8 || c==10 || c==17 || c==23 ) { 
		t += 'width="3%"' 
		} else {
		t += 'width="4%"'
		}
		
		t += '><a class="noline" title="Go to items starting with '
		+ ch.charAt(c) + '" href="#' + ch.charAt(c) + '" '
		+ 'onMouseOver="window.status=\'Go to items starting with ' 
		+ ch.charAt(c) + '\'; return true;" '
		+ 'onMouseOut="window.status=\'\'" '
		+ '>' + ch.charAt(c) + '</a></td>'
	}

	t += '</tr>'
    + '</table>'
    + '</td>'
    + '</tr>'
    + '</table>'
	
	return t
}

function printPage() {
	if ((navigator.userAgent.indexOf("Mac") != -1) && (navigator.appName.indexOf("Microsoft") != -1)) {
		//This is the Mac IE window
		alert("Sorry, your browser doesn't support this feature. Please use the Print option from the browser's File menu.");
	} else {
		//These are the other windows (pc ie and ns, mac ns)
		window.print();
	}
}

/*function getResNav()
{
	var ch = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	t = '<div align="center">'
	for(var c = 0 ; c < ch.length ; c++)
	{
		t += '<a class="noline" title="Go to items starting with '
		+ ch.charAt(c) + '" href="#' + ch.charAt(c) + '" '
		+ 'onMouseOver="window.status=\'Go to items starting with ' 
		+ ch.charAt(c) + '\'; return true;" '
		+ 'onMouseOut="window.status=\'\'" '
		+ '>' + ch.charAt(c) + '</a>'
		+ ' - '
	}
	t += '</div>'
	return t
}*/

