/* 
The Oyster Bay Sewer District Website (version 2.0)
Designed and Created by LaMa Media Inc. (www.lamamedia.com)
Copyright (c) 1998, 2004.  All rights reserved.
*/

// ****************************************************************
// NEWS FUNCTIONS
// ****************************************************************

function fNewNews(rPath) {
	var tElement = vNewsList[0];
	var tFile = fGetItem(tElement, 0, vDelim);
	var tLink = (rPath + tFile + ".html");
	window.location.replace(tLink);
}

function fNewsLink(rFile) {
	var tLink = (rFile + ".html");
	window.top.location.href = tLink;
}

function fNewsPage()
{ 
	var tForm = document.forms[0].nmenu;
	var tFile = tForm.options[tForm.selectedIndex].value;
	if (tFile) window.top.location.href = (tFile + ".html");
}


function fNewsList(rCurrent) {
	document.open();
	document.write('<div align="center">');
	document.write('<form><select name="nmenu" id="nmenu" class="nselect" onChange="fNewsPage()" size="1">');
	var tLen = (vNewsList.length - 1);
	var tFile, tHeadline, tDate, tNum;
	for (tNum=0; tNum<tLen; tNum++) {
		tElement = vNewsList[tNum];
		tFile = fGetItem(tElement, 0, vDelim);
		tHeadline = fGetItem(tElement, 1, vDelim);
		tHeadline = fReplaceChar(tHeadline, " ", "&nbsp;");
		tDate = fGetItem(tElement, 2, vDelim);
		tDate = fReplaceChar(tDate, " ", "&nbsp;");
		document.write('<option value="' + tFile + '" class=');
		if (tFile == rCurrent) {
			document.write('"nselcurrent" SELECTED' );
		} else {
			document.write('"nselchoice"');
		}
		document.write('>' + tHeadline + '</option>');
	}
	
	document.write('</select></form>');
	document.write('</div>');
	document.write('<div class="lineh">&nbsp;</div>');
	document.close();
}


function fNewsHead(rHeadline, rDate, rSubline) {
	document.open();
	rDate = fReplaceChar(rDate, " ", vCharNB);
	document.write('<div><table class="full" cellpadding="0" cellspacing="0" border="0">');
	document.write('<tr valign="middle"><td id="nhline">' + rHeadline);
	if (rSubline != "") document.write('<br><span id="nhsub">' + rSubline + '</span>');
	document.write('</td><td id="nhdate">' + rDate + '</td></tr></table></div><br>');
	document.close();
}

function fNewsPhoto(rPhoto, rLR, rCaption) {
	if (rPhoto != '') {
		document.open();
		rLR = rLR.toUpperCase();
		var tClass = (rLR == "L") ? "i-left" : "i-right";
		document.write('<table class="' + tClass + '" cellpadding="0" cellspacing="0" border="0" width="1"><tr align="center"><td>' + rPhoto + '</td></tr>');
		if (rCaption != "") {
			document.write('<tr align="center"><td class="ncaption">' + rCaption + '</td></tr>');
		}
		document.write('</table>');
		document.close();
	}
}

