highlights = new Array();
var objCount = 0;
var mydatenow = new Date();
var mydatenow_year = mydatenow.getFullYear();
var mydatenow_month = mydatenow.getMonth() + 1;
var mydatenow_date = mydatenow.getDate();
   		
//Creates an array of highlights to list
function loadevent(date, description, url) {
	highlights[objCount] = new Array(3);
	highlights[objCount][0] = date;
	highlights[objCount][1] = description;
	highlights[objCount][2] = url;
	objCount++;	
}

function sortNumber(a, b)
{
	return a - b;
}


function displaycurrent()
{
	document.write("Today is " + mydatenow);
	document.write("<br />");
	document.write("<br />");
	//document.write(mydatenow.toLocaleDateString());
	//document.write("<br />");

	document.write('<table border="0" cellpadding="0" cellspacing="0" width="550">');
	document.write('<tbody>');

	var sortedhighlights = highlights.sort();

	for (i = 0; i< sortedhighlights.length; i++) {
		var dstr = sortedhighlights[i][0]

		if ( mydatenow_year < dstr.split("-",3)[0]) {
		//Repeated because the function call was not working on the unix server
			document.write('<tr>');
			document.write('<td class="newsheader">');
			document.write('<a href="');
			document.write(sortedhighlights[i][2]);
			document.write('" title="');
			document.write(sortedhighlights[i][1]);
			document.write('">');
			document.write(sortedhighlights[i][1]);
			document.write('</a>');
			document.write('</td>');
			document.write('</tr>');
			document.write('<tr>');
			document.write('<td>');
			document.write(dstr.split("-",3)[1] +"/"+ dstr.split("-",3)[2] +"/"+ dstr.split("-",3)[0]);
			document.write('</td>');
			document.write('</tr>');
			document.write('<tr>');
			document.write('<td class="FaintLinks" align="right">');
			document.write('<a href="');
			document.write(sortedhighlights[i][2]);
			document.write('" title="Read More">Read More</a>');
			document.write('</td>');
			document.write('</tr>');
			document.write('<tr>');
			document.write('<td>');
			document.write('<hr>');
			document.write('</td>');
			document.write('</tr>');
			document.write('<tr>');
			document.write('<td class="newsSpacer">');
			document.write('</td>');
			document.write('</tr>');
		} else if ( mydatenow_year == dstr.split("-",3)[0] && mydatenow_month < dstr.split("-",3)[1]) {
		//Repeated because the function call was not working on the unix server
			document.write('<tr>');
			document.write('<td class="newsheader">');
			document.write('<a href="');
			document.write(sortedhighlights[i][2]);
			document.write('" title="');
			document.write(sortedhighlights[i][1]);
			document.write('">');
			document.write(sortedhighlights[i][1]);
			document.write('</a>');
			document.write('</td>');
			document.write('</tr>');
			document.write('<tr>');
			document.write('<td>');
			document.write(dstr.split("-",3)[1] +"/"+ dstr.split("-",3)[2] +"/"+ dstr.split("-",3)[0]);
			document.write('</td>');
			document.write('</tr>');
			document.write('<tr>');
			document.write('<td class="FaintLinks" align="right">');
			document.write('<a href="');
			document.write(sortedhighlights[i][2]);
			document.write('" title="Read More">Read More</a>');
			document.write('</td>');
			document.write('</tr>');
			document.write('<tr>');
			document.write('<td>');
			document.write('<hr>');
			document.write('</td>');
			document.write('</tr>');
			document.write('<tr>');
			document.write('<td class="newsSpacer">');
			document.write('</td>');
			document.write('</tr>');
		} else if ( mydatenow_year == dstr.split("-",3)[0] && mydatenow_month == dstr.split("-",3)[1] && mydatenow_date <= dstr.split("-",3)[2]) {
		//Repeated because the function call was not working on the unix server
			document.write('<tr>');
			document.write('<td class="newsheader">');
			document.write('<a href="');
			document.write(sortedhighlights[i][2]);
			document.write('" title="');
			document.write(sortedhighlights[i][1]);
			document.write('">');
			document.write(sortedhighlights[i][1]);
			document.write('</a>');
			document.write('</td>');
			document.write('</tr>');
			document.write('<tr>');
			document.write('<td>');
			document.write(dstr.split("-",3)[1] +"/"+ dstr.split("-",3)[2] +"/"+ dstr.split("-",3)[0]);
			document.write('</td>');
			document.write('</tr>');
			document.write('<tr>');
			document.write('<td class="FaintLinks" align="right">');
			document.write('<a href="');
			document.write(sortedhighlights[i][2]);
			document.write('" title="Read More">Read More</a>');
			document.write('</td>');
			document.write('</tr>');
			document.write('<tr>');
			document.write('<td>');
			document.write('<hr>');
			document.write('</td>');
			document.write('</tr>');
			document.write('<tr>');
			document.write('<td class="newsSpacer">');
			document.write('</td>');
			document.write('</tr>');
		}
	}

	document.write('</tbody>');
	document.write('</table>');
}

function displaycurrenthome()
{
	var shownumberofitems = 6;
	document.write("Today is " + mydatenow);
	document.write("<br />");
	//document.write(mydatenow.toLocaleDateString());
	//document.write("<br />");
	
	var sortedhighlights = highlights.sort();
	
	var olddates = 0;
	for (i = 0; i< sortedhighlights.length; i++) {
		var dstr = sortedhighlights[i][0]
		if ( mydatenow_year < dstr.split("-",3)[0]) {
		} else if ( mydatenow_year == dstr.split("-",3)[0] && mydatenow_month < dstr.split("-",3)[1]) {
		} else if ( mydatenow_year == dstr.split("-",3)[0] && mydatenow_month == dstr.split("-",3)[1] && mydatenow_date <= dstr.split("-",3)[2]) {
		} else {
			olddates++;
		}
	}
	var minnum = Math.min(shownumberofitems + olddates, sortedhighlights.length);
	
	//document.write("show " + minnum);
	//document.write("<br />");

	document.write('<table border="0" cellpadding="0" cellspacing="0" width="550">');
	document.write('<tbody>');

	for (i = olddates; i< minnum; i++) {
		var dstr = sortedhighlights[i][0]

		if ( mydatenow_year < dstr.split("-",3)[0]) {
		//Repeated because the function call was not working on the unix server
			document.write('<tr>');
			document.write('<td class="BulletSpacing"><img src="/shared/images/arrow1.gif"></td>');
			document.write('<td>');
			document.write(dstr.split("-",3)[1] +"/"+ dstr.split("-",3)[2] +"/"+ dstr.split("-",3)[0]);
			document.write(': <a href="');
			document.write(sortedhighlights[i][2]);
			document.write('" title="');
			document.write(sortedhighlights[i][1]);
			document.write('">');
			document.write(sortedhighlights[i][1]);
			document.write('</a>');
			document.write('</td>');
			document.write('</tr>');
			document.write('<tr>');
			document.write('<td class="ContentAreaLinksSpacer"></td>');
			document.write('</tr>');
		} else if ( mydatenow_year == dstr.split("-",3)[0] && mydatenow_month < dstr.split("-",3)[1]) {
		//Repeated because the function call was not working on the unix server
			document.write('<tr>');
			document.write('<td class="BulletSpacing"><img src="/shared/images/arrow1.gif"></td>');
			document.write('<td>');
			document.write(dstr.split("-",3)[1] +"/"+ dstr.split("-",3)[2] +"/"+ dstr.split("-",3)[0]);
			document.write(': <a href="');
			document.write(sortedhighlights[i][2]);
			document.write('" title="');
			document.write(sortedhighlights[i][1]);
			document.write('">');
			document.write(sortedhighlights[i][1]);
			document.write('</a>');
			document.write('</td>');
			document.write('</tr>');
			document.write('<tr>');
			document.write('<td class="ContentAreaLinksSpacer"></td>');
			document.write('</tr>');
		} else if ( mydatenow_year == dstr.split("-",3)[0] && mydatenow_month == dstr.split("-",3)[1] && mydatenow_date <= dstr.split("-",3)[2]) {
		//Repeated because the function call was not working on the unix server
			document.write('<tr>');
			document.write('<td class="BulletSpacing"><img src="/shared/images/arrow1.gif"></td>');
			document.write('<td>');
			document.write(dstr.split("-",3)[1] +"/"+ dstr.split("-",3)[2] +"/"+ dstr.split("-",3)[0]);
			document.write(': <a href="');
			document.write(sortedhighlights[i][2]);
			document.write('" title="');
			document.write(sortedhighlights[i][1]);
			document.write('">');
			document.write(sortedhighlights[i][1]);
			document.write('</a>');
			document.write('</td>');
			document.write('</tr>');
			document.write('<tr>');
			document.write('<td class="ContentAreaLinksSpacer"></td>');
			document.write('</tr>');
		}
	}
	document.write('<tr>');
	document.write('<td colspan="2" class="FaintLinks"><a title="Read More" href="/hhsa/highlights/index.html">Read More</a></td>');
	document.write('</tr>');
	document.write('</tbody>');
	document.write('</table>');
}


