//lhs57.js
// GLOBAL VARS
self.status = "Please Wait...";
// begin buildHorizMenu Frames Version
var m_sOpenId='';
var m_sPrevId='none';
var m_btnWidth='160';					// button width
var m_btnHeight='34';					// button height
var m_btnFileExt = 'gif';		//Button File Extension (gif or jpg)
var m_navFrameWidth='176';		// width of nav frame
var m_lastReunionPage = '19';	// Last Reunion Photos Page Number

menuPageNames = new Array(
"home",
"news",
"themesong",
"memorylane",
"prosepoetry",
"photoalbum",
"inmemoriam",
"missing",
"program",
"50thphotos_1",
"links"
);
//"50thphotos_1",
//"directions",
//"contact",

// preload_images
var buttoncnt = menuPageNames.length;
var onbtn = new Array(buttoncnt);
var offbtn = new Array(buttoncnt);
var activePage = '';

for(var i=0;i<buttoncnt;i++) 
{
  onbtn[i] = new Image();
  onbtn[i].src = './buttons/bn'+menuPageNames[i]+'_on.'+m_btnFileExt; 
  offbtn[i] = new Image();
  offbtn[i].src = './buttons/bn'+menuPageNames[i]+'_off.'+m_btnFileExt;
}
// Set Cookie 
var url=location.href;
var lastSlash = url.lastIndexOf("/");
var curPage = url.substring(lastSlash+1,url.length);
var dot = curPage.indexOf(".");
curPage = curPage.substring(0,dot);

if(curPage != "index" && curPage != "menu" && curPage != "tophits1954"){
	for(var xx=0;xx<buttoncnt;xx++){ 
		if(menuPageNames[xx] == curPage.substring(0,menuPageNames[xx].length)){
			curPage = menuPageNames[xx];
			xx = buttoncnt;
		}
	}
	if(GetCookie(curPage) != curPage){
		SetCookie("curPage", curPage);
		if(parent.length > 0) {
			parent.frames[1].document.location.href = "menu.html";
		}
	}
}

function rollOver(name){
	if(m_sOpenId == "contact"){
		m_sOpenId = name;
		document.images[name].src = './buttons/bn'+name+'_on.'+m_btnFileExt;
	}
	if(name == m_sOpenId)
		return;
	if(navigator.usrFamily == "opera" && m_sOpenId == null){
		m_sOpenId = "home";
		document.images[name].src = './buttons/bn'+name+'_on.'+m_btnFileExt; 
	}		
	if(document.images){
		document.images[m_sOpenId].src = './buttons/bn'+m_sOpenId+'_off.'+m_btnFileExt;
		document.images[name].src = './buttons/bn'+name+'_on.'+m_btnFileExt; 
	}
}
function rollOut(name){
	if(name == m_sOpenId)
		return;
	if(document.images){
		document.images[name].src = './buttons/bn'+name+'_off.'+m_btnFileExt;
		document.images[m_sOpenId].src = './buttons/bn'+m_sOpenId+'_on.'+m_btnFileExt; 
	}
}

function setActivePg(imgName){
	m_sPrevId = m_sOpenId;
	m_sOpenId = imgName;
}
function drillDown(id,optn){
	 rollOver(id);
	 return;
}

function buildNavTable(curpage){
	var button = '';
	var fileExtension = '';	//default file extension
	var s = '' +
	'<table  border="0" cellpadding="0" cellspacing="0" summary="navtable">' +
  '<tr><td width="'+m_navFrameWidth+'" align="center">' +
  '<table  width="'+m_navFrameWidth+'" align="center" cellpadding="0" cellspacing="0" border="0" summary="nav table">';
	for(var i=0;i<buttoncnt;i++) 
	{
			// file extension substitutions
/*			
		if(menuPageNames[i] == 'contact'){ 
			fileExtension = '.php';
		}else{
			fileExtension = '.html';
		}
*/
		fileExtension = '.html';

		if(menuPageNames[i].indexOf("50thphotos_") == 0){
			s+='<tr id="reunionpics"><td align="center">';
			s+= '<a href="javascript:window.close();" onclick="openRemote(\'' + menuPageNames[i]+ fileExtension + '\', \'REUNIONPICS\', 1000, 620);"';
			s+=' onMouseover="drillDown(\'' +menuPageNames[i]+ '\',\'no\');" onMouseout="rollOut(\'' +menuPageNames[i]+ '\');">';
		}else{
			s+='<tr><td align="center"><a href="';
			s+= menuPageNames[i]+ fileExtension;
			s+='" target="mainframe"';
			s+=' onMouseover="drillDown(\'' +menuPageNames[i]+ '\',\'no\');" onclick="setActivePg(\'' +menuPageNames[i]+ '\');" onMouseout="rollOut(\'' +menuPageNames[i]+ '\');">';
		}
		
		s+='<img  width="' + m_btnWidth + '" height="' + m_btnHeight + '" name="' + menuPageNames[i]+ '" src="';
		button=doButton(curpage, menuPageNames[i]);
		s+=button+'" border="0" alt=""/></a></td></tr>';
	}
 	s+='<tr><td><img src="./images/spacer.gif" width="1" height="2" border="0" alt=""/></td></tr></table></td></tr></table>';
	document.write(s);
}	//End buildNavTable

function doButton(sCurPage,sName){
  var button='';
  if(sName == sCurPage)
    button = './buttons/bn' + sName+'_on.'+m_btnFileExt; 
  else
		button = "./buttons/bn" + sName+'_off.'+m_btnFileExt; 
  return button;
}

function changemindoption(filename,x,y) {
	if(confirm("This download not recommended unless you have high speed internet access.  Continue?")==true){
//		openRemote(filename,'JUMBO',x,y,1,1);
		openRemote(openPopupWindow,x,y,1,1);
	}
	return;
}

function doBackDoor(pageName,pgWidth){
	var sCopy = '';
	if(parent.length == 0) {
		if(!pgWidth){pgWidth = '564';}
		sCopy += '<table width="' + pgWidth + '" align="center" cellspacing="0" cellpadding="2" border="0">';	
		sCopy += '<tr><td width="40" class="cTitle"><a href="javascript:wheretoNext();" onmouseover="this.className=\'cButton1\';" onmouseout="this.className=\'cButton0\';" class="cButton0">Home</a></td>';
		sCopy += '<td align="center" width="' + pgWidth + '" class="cTitle">Livingston, NJ High School Class of 1957 - ' + pageName + '</td>';
		sCopy += '<td width="40" class="cTitle"><a href="javascript:wheretoNext();" onmouseover="this.className=\'cButton1\';" onmouseout="this.className=\'cButton0\';" class="cButton0">Home</a></td></tr></table></td></tr>';
		sCopy += '</table>';
		document.write(sCopy);
	}

}	//End doBackDoor
function wheretoNext(nextpage){
	if(window.name.indexOf("REUNIONPICS") == 0){
		window.close();
	}else{
		window.location.href="index.html";
	}	
}

function doBusinessHours(){
/*	var sCopy = '';
	sCopy += '<br/><span class="cHours">';
	sCopy += 'Livingston, NJ High School Class of 1957<br/>';
	sCopy += '&quot;<i>THE ORIGINAL LIVINGSTON LANCERS – CLASS OF 1957 - FIRST TO FIFTY</i>&quot;<br/>';
	sCopy += '</span>';
	document.write(sCopy);
*/
}	//End doBusinessHours
function doNavTop(){
	var sCopy = '';
/*
	sCopy += '<map name="navtop" id="navtop">'; 
	sCopy += '<area href="#topofpage" shape="rect" coords="0,0,49,24" alt="Return to Top of Page"/>';
	sCopy += '</map>';
	sCopy += '<p style="text-align:center;" class="linkclass">';
	sCopy += '<img src="./images/navtop.gif" width="49" height="24" border="0" hspace="4" usemap="#navtop" alt="return to top Page" longdesc="image for Top of Page button"/>&nbsp;';
*/	
	sCopy += '<a href="#"><img src="./images/navtop.gif" width="49" height="24" border="0" alt="return to top Page" longdesc="image for Top of Page button" /></a>';
	sCopy += '<br/><br/>';
	document.write(sCopy);
}
function doLinkLine(){
	var sCopy = '';
	sCopy += '<br/>';
	sCopy += '<map name="navtop" id="navtop">'; 
	sCopy += '<area href="#topofpage" shape="rect" coords="0,0,49,24" alt="Return to Top of Page"/>';
	sCopy += '</map>';
	sCopy += '<p style="text-align:center;" class="linkclass">';
	sCopy += '<img src="./images/navtop.gif" width="49" height="24" border="0" hspace="4" usemap="#navtop" alt="return to top Page" longdesc="image for Top of Page button"/>&nbsp;';
	sCopy += '<br/><br/>';
	sCopy += '<a href="http://www.lhsclassof57.org">Home</a> | <a href="news.html">News</a> | <a href="themesong.html">Theme Song</a> | <a href="memorylane.html">Memory&nbsp;Lane</a> | <a href="prosepoetry.html">Prose &amp; Poetry</a> | <a href="photoalbum.html">Photo Album</a> | <a href="inmemoriam.html">Memoriam</a> | <a href="missing.html">The Missing</a> | <a href="program.html">Program</a> | <a href="contact.html">Contact Us</a> | <a href="links.html">Links</a></p><br/>';
	document.write(sCopy);
} // End doLinkline

function getCompEnv(){
	var screenRes = '';
	var cmptrEnv = 'U.A.=' + navigator.userAgent + ', OS=' + window.navigator.platform + ', CPU=' + window.navigator.cpuClass;
	if ( window.screen ){
		screenRes += window.screen.width; 
		screenRes += 'x'; 
		screenRes += window.screen.height;
	}else{
		screenRes = 'Unknown';
	}
	cmptrEnv += ', Resolution=';
	cmptrEnv += screenRes;
	return cmptrEnv;
} // End getCompEnv

function findCurPageName(){
	var url=location.href;
	var lastSlash = url.lastIndexOf("/");
	var curPageName = url.substring(lastSlash+1,url.length);
	var dot = curPageName.indexOf(".");
	curPagePrefix = curPageName.substring(0,dot);
	return curPageName;
} // End findCurPageName

function doFootingA(userAgent){
	var pLine = '' +
    '<br/><span class="footnote">For best viewing, always use the latest browsers.<br/>' +
    '<a class="footerA" href="http://www.upsdell.com/BrowserNews/find.htm" target="_blank">Click here for FREE browser upgrades</a>.<br/>' +
		'<span class="footnote">Please report any problems viewing this site to the ' +
		'<a class="footnote" href="mailto:'+g_WEBMASTERMAILTO + '?subject=Re: Website=' + g_CLIENTURL + ', Page=' + findCurPageName() + ', ';
	pLine +=getCompEnv();
	pLine += '">Webmaster</a></span><br/><br/>';
	document.write(pLine);
}	//End doFootingA
function doFootingB(){
	var pLine = '';
	pLine +='<table width="100%"  valign="top" cellpadding="0" cellspacing="0" border="0" summary="page footing">';
	pLine +='<tr><td colspan="2"><img class="botline" src="./images/spacer.gif" width="100%" height="2" border="0" alt=""/></td></tr>';
	pLine +='<tr><td align="left" valign="top"><img src="./images/spacer.gif" style="width:50px;height:2em;border:none;" alt="" /></td>';
	pLine +='<td class="footer" align="left" valign="top">&copy;&nbsp;' + g_COPYRIGHT + '.&nbsp;&nbsp;All rights reserved.';
	pLine +='<br/>Please report problems viewing this site as ';
	pLine +='<a class="footnote" href="mailto:'+g_WEBMASTERMAILTO + '?subject=Re: Website=' + g_CLIENTURL + ', Page=' + findCurPageName() + ', ';
	pLine +=getCompEnv();
	pLine +='">Comments to Webmaster</a><br/>';
	var sLine= 'Site last modified ' + g_sLASTUPDATE + ', Reviewed ' + g_sLASTREVIEW + '&nbsp;by ' +
		'<a class="footer" href="' + g_WEBMASTERURL + '" target="_blank">' + g_WEBMASTERNM + '</a>&nbsp; ' + 
		'<br/></td></tr></table>';
	pLine += sLine;
	document.write(pLine);
}	//End doFootingB

function doPageLinks(pageNo)
{
  var pgMax = m_lastReunionPage;	// *********** Last Page Number ********
  var prevPage = pageNo;
  var nextPage = pageNo;
  prevPage --;
  nextPage ++;
  if(prevPage == 0){
		prevPage = pgMax;
	}
	if(nextPage > pgMax){
		nextPage = 1;
	}
  var pLine = '';
  pLine += '<p class="linkclass" style="font-size:9pt;font-weight:bold;">';
//  pLine += '<a href="50thphotos_' + prevPage + '.html" target="_self">&laquo;</a>&nbsp;&nbsp;';
  pLine += '<a href="50thphotos_' + prevPage + '.html" target="_self"><img src="./images/arrowLft_blk.gif" width="5" height="9" border="0" alt=""/><span class="cPageMenu">&nbsp;<strong>Prev</strong>&nbsp;&nbsp;</span></a>&nbsp;&nbsp;';
  for(x=1;x<=pgMax;x++){
		if(x == pageNo) {
			bgcolor = '#ffffff';
			fgcolor = 'red';
			txtdecor = 'none';
		}else{
			bgcolor = '#ffffff';
			txtdecor = 'underline';
			fgcolor = '';
		}
		pLine += '<a href="50thphotos_' + x + '.html" target="_self"><span style="text-decoration:' + txtdecor + ';background-color:' + bgcolor +';color:' + fgcolor + ';">' + x + '</span></a>&nbsp;&nbsp;';
	}
//  pLine += '<a href="50thphotos_' + nextPage + '.html" target="_self">&raquo;</a>&nbsp;&nbsp;';
  pLine += '<a href="50thphotos_' + nextPage + '.html" target="_self"><span class="cPageMenu">&nbsp;&nbsp;<strong>Next</strong>&nbsp;&nbsp;</span><img src="./images/arrowRht_blk.gif" width="5" height="9" border="0" alt=""/></a>&nbsp;&nbsp;';

	pLine += '</p>';
	document.write(pLine);
} // End doPageLinks


function openPopupWindow(url, winWidth, winHeight, winName) {
	var W=winWidth;
	var H=winHeight;
	var X_unrounded=(screen.availWidth/2)-(winWidth/2);
	var Y_unrounded=(screen.availHeight/2) - (winHeight/2);
	
	var X=Math.round(X_unrounded); 
	var Y=Math.round(Y_unrounded);
	
	var popUpName = ''; 
	if(winName) popUpName = winName;	// If winName is available, use it
	else if(typeof g_PopUpName != 'undefined') popUpName = g_PopUpName;	// if popup name is still null and a global name is available, use it
	else popUpName = 'DEFLT';					// Default Window Name
	
	winWidth += 30;		// allow for scroll bar width
	winHeight += 30;	// allow for scroll bar height
	var winParms = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' + winWidth + ',height=' + winHeight + ',Left=' + X + ',Top=' + Y + ',left=' + X + ',top=' + Y;

	var htmlcode='';
	htmlcode='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"';
  htmlcode+='"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
  htmlcode+='<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">';
	htmlcode+='<head><title>&nbsp;</title>';
	htmlcode+='<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />';
	htmlcode+='<meta http-equiv="Content-language" content="en-US" />';
	htmlcode+='<body style="font-family:Arial,Verdana,Helvetica,Geneva,sans-serif;font-size:12px;font-weight:bold;background-color:#072507;color:#ffffff;margin:0px 4px 4px 4px;text-align:center;">';
	htmlcode+='Click Image to Close Window<br />';
	htmlcode+='<a href="javascript:window.close();"><img src="' + url + '" style="border:#009900 3px solid;" alt="" /></a>';
	htmlcode+='</body></html>';

	var ran_unrounded=Math.random()*100;									// Generate a random number from 1 - 100
	var ran_number=Math.round(ran_unrounded); 
	var randomname = popUpName+ran_number;								// Append the random number to the window name
	
	var winObj = window.open(url, randomname, winParms);	// Create window object
	winObj.document.writeln(htmlcode);										// Send the html code generated above to the window
	return;
}	// End openPopupWindow

function openRemote(url,winName,winWidth,winHeight,x,y)
{
	var W=winWidth;
	var H=winHeight;
	var X_unrounded=(screen.availWidth/2)-(winWidth/2);
	var Y_unrounded=(screen.availHeight/2) - (winHeight/2);
	var X=Math.round(X_unrounded); 
	var Y=Math.round(Y_unrounded); 

//	window.open("./gallery/"+url,"REMOTEpopup","width="+W+",height="+H+",screenX="+X+",screenY="+Y+",left="+X+",top="+Y+",dependent=0,directories=0,location=0,menubar=0,personalbar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0")

//	var winParms = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=' + winWidth + ',height=' + winHeight';
	var winParms = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' + winWidth + ',height=' + winHeight + ',Left=' + X + ',Top=' + Y + ',left=' + X + ',top=' + Y;

	var ran_unrounded=Math.random()*100;
	var ran_number=Math.round(ran_unrounded); 
	var randomName = winName+ran_number;

	var winObj = window.open(url,randomName,winParms);
	if(winObj.opener == null){
		winObj.opener = window;
	}
//	if(x)	randomName.moveTo(x,y);

//	winObj.opener.name = "mainframe";	// sets new target <!--form target="mainframe" action="searcg.cgi"-->
//	winObj.moveTo(x,y);		// js ver 1.5

	return;
}	//End openRemote
self.status='';