/* Miscellaneous declarations for the date-related functions below                              */
var months = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');

function fourdigits(number)	{
  return (number < 1000) ? number + 1900 : number;
}

/* Function to write the supplied date, and if it is less than 14 days from today it will also  */
/*   write NEW Modification!!!.   Used for the books and general examples.                      */
function newdt(mon,day,yr,mod){
  var modDate=new Date();
  var expDate = new Date();
  var today = new Date();
  modDate.setFullYear(yr,mon-1,day);
  expDate.setFullYear(yr,mon-1,day);
  expDate.setDate(expDate.getDate()+14);
  var date = ((modDate.getDate()<10) ? "0" : "")+ modDate.getDate();
  var modDate1 = date + "-" + months[modDate.getMonth()] + "-" + (fourdigits(modDate.getYear()));

  if (expDate>today) {
    pobj = modDate1 + "<span style='font-style: italic; font-weight: bold; color: #FF3366; padding-left: 2em;'>NEW";
	if (mod) pobj = pobj + " Modification";
	pobj = pobj + "!!!</span>"
    document.write(pobj);
  } else { document.write(modDate1); }
}

/* Function to write NEW!!! if the supplied date is less than 14 days from today.  Used for      */
/*   the journals and the creation date for books and general examples.                          */
function newdt2(mon,day,yr){
  var expDate = new Date();
  var today = new Date();
  expDate.setFullYear(yr,mon-1,day);
  expDate.setDate(expDate.getDate()+14);
  if (expDate>today) { document.write("<span style='font-style: italic; font-weight: bold; color: #FF3366; padding-right: 5px;'>NEW!!!</span>"); } 
}

/* Function to write the last modified date.                                                     */
function lastModified() {
  var dateObj = new Date(document.lastModified)
  document.write("Last modified on " + dateObj.getDate() + "-" + months[dateObj.getMonth()] + "-" + fourdigits(dateObj.getYear()));
}


/* Places the header banner at the top of the page                                                */
function pbanr(home) {
  var pobj;
  pobj = "<div id='banner'>";
  pobj = pobj + "fishR <span id='tagline'>using R for fisheries analyses</span>";
  pobj = pobj + "<div id='Rlogo'><a href='http://www.r-project.org'><img src='";
  pobj = pobj + home + "admin/Rlogo.png' height='50' alt='R home' border='0' /></a></div>";
  pobj = pobj + "</div>";
  document.write(pobj);
}


/* Places the navigation tabs in the header of a page                                             */
/* The home argument shows how to get back to the main fishR page -- where index.html is located. */
/* The curr argument is used to identify which tab should be labeled as current                   */
/* Example -- pnav("../","Book") -- to make the Book tab current and it is one layer from index.  */
function pnav(home,curr) {
  var pobj 
  pobj = "<div id='nav'>"
  pobj = pobj + "<ul>"
  if (curr=="Home") { pobj = pobj + "<li id='current'>"; }
    else { pobj = pobj + "<li>"; }
  pobj = pobj + "<a href='" + home + "index.html'>Home</a></li>";
  if (curr=="General") { pobj = pobj + "<li id='current'>"; }
    else { pobj = pobj + "<li>"; }
  pobj = pobj + "<a href='" + home + "gnrlex/gnrlex.html'>General Examples</a></li>";
  if (curr=="Book") { pobj = pobj + "<li id='current'>"; }
    else { pobj = pobj + "<li>"; }
  pobj = pobj + "<a href='" + home + "bookex/bookex.html'>Book Examples</a></li>";
  if (curr=="Journal") { pobj = pobj + "<li id='current'>"; }
    else { pobj = pobj + "<li>"; }
  pobj = pobj + "<a href='" + home + "jrnlex/jrnlex.html'>Journal Examples</a></li>";
  if (curr=="Packages") { pobj = pobj + "<li id='current'>"; }
    else { pobj = pobj + "<li>"; }
  pobj = pobj + "<a href='" + home + "packages/packages.html'>Packages</a></li>";
  if (curr=="Courses") { pobj = pobj + "<li id='current'>"; }
    else { pobj = pobj + "<li>"; }
  pobj = pobj + "<a href='" + home + "courses/courses.html'>Courses</a></li>";
  if (curr=="GetInvolved") { pobj = pobj + "<li id='current'>"; }
    else { pobj = pobj + "<li>"; }
  pobj = pobj + "<a href='" + home + "getInvolved/GetInvolved.html'>Get Involved!</a></li>";
  if (curr=="News") { pobj = pobj + "<li id='current'>"; }
    else { pobj = pobj + "<li>"; }
  pobj = pobj + "<a href='http://fishr.wordpress.com/' target='_blank'>News</a></li>";

  pobj = pobj + "</ul>" + "</div>";
  document.write(pobj);
}

/* Places various objects into the footer.                                                        */
function pfoot() {
  var pobj
  pobj = "<div id='comments'><a href='mailto: dogle@northland.edu'>Comments / Questions?</a></div>"
  pobj = pobj + "<div id='ftrtag'><a href='http://www.ncfaculty.net/fishR'>www.ncfaculty.net/fishR</a></div>"
  pobj = pobj + "<div id='lastmod'><SCRIPT>lastModified()</script></div>"
  document.write(pobj);
}

/* Places a creative commons license statement in a document */
function pcclicense() {
  var pobj
  pobj = "<div id='cclicense'>All content in these examples is licensed under the "
  pobj = pobj + "<a href='http://creativecommons.org/licenses/by-nc-sa/3.0/us/' target='_blank'>Creative Commons Attribution-Noncommercial-Share Alike 3.0 License</a>"
  pobj = pobj + " by the author of the example.  Please protect the author, yourself, and the concept of sharing knowledge by reading and abiding by this license."
  pobj = pobj + "</div>"
  document.write(pobj);
}

<!-- Start of StatCounter Code -->
/* declarations for the StatCounter Code */
var sc_project=5579271; 
var sc_invisible=1; 
var sc_partition=60; 
var sc_click_stat=1; 
var sc_security="1efa1d93"; 

function statcounter() {
  var pobj
  pobj = "<script type='text/javascript' src='http://www.statcounter.com/counter/counter.js'></script><noscript>"
  pob = pobj + "<div class='statcounter'><a title='myspace views counter' href='http://www.statcounter.com/myspace/' target='_blank'>"
  pobj = pobj + "<img class='statcounter' src='http://c.statcounter.com/5579271/0/1efa1d93/1/'"
  pobj = pobj + "alt='myspace views counter'></a></div></noscript>"
  document.write(pobj);
}

