// Function to detect page location
// By: Wade Murray 2009

function thisLink(linkURL,linkName)
{
var sPage = window.location.href;
var sHost = window.location.host;
var listType;
var listLink;
sPage = sPage.substring(sHost.length + 7);

if(sPage == linkURL)
{listType = "<li id=active>";}
else
{listType = "<li>";}
listLink=listType + "<a href=" + linkURL + ">" + linkName + "</a>";
return listLink;
}

// Function to add commas to given variable
// Rudy Affandi 2009

function addCommas(nStr)
{
   nStr += '';
   x = nStr.split('.');
   x1 = x[0];
   x2 = x.length > 1 ? '.' + x[1] : '';
   var rgx = /(\d+)(\d{3})/;
   while (rgx.test(x1)) {
      x1 = x1.replace(rgx, '$1' + ',' + '$1');
   }
   return x1 + x2;
}

// Function to automatically generate side nav menu for News Releases
// Takes 3 parameter:
// sectInstance: section instance number
// startYear: the latest year of the list
// endYear: the earliest year of the list
// Rudy Affandi 2010

function createNRMenu(sectInstance,startYear,endYear) {
   var sectInstance;
   var startYear;
   var endYear;
   while (startYear>=endYear)
   {
      document.write("<li><a href=\"<%=Section|HREF|NewsReleases|" + sectInstance + "%>?DateRange=" + startYear + "/01/01..." + startYear + "/12/31/\">" + startYear + " News</a></li>");
      startYear--;
   }
}

