<!-- // Begin
// a counter using cookies

// helper functions
function nameDefined(ckie,nme) {
   var sv, i;
   for ( i = 0 ; i < ckie.length ;++i ) {
      sv = ckie[i].split("=");
      if ( sv[0] == nme ) return true;
   }
   return false;
}

function delBlanks(strng) {
   var result="";
   var i, chrn;
   for (i=0;i<strng.length;++i) {
      chrn=strng.charAt(i);
      if (chrn != " ") result += chrn;
   }
   return result;
}

function getCookieValue(ckie,nme) {
   var splitValues;
   var i;
   for( i = 0 ; i < ckie.length ;++i ) {
      splitValues=ckie[i].split("=");
      if(splitValues[0]==nme) return splitValues[1];
   }
   return "";
}

function displayCounter() {
 document.write('<h3 align="center">');
 document.write("You have visited this page ");
 if(counter==1) document.write("for the first time.");
 else document.write("" + counter + " times.");
 document.writeln('</h3>')
}
 
function readCookie() {
 var cookie=document.cookie;
 counter=0;
 var chkdCookie=delBlanks(cookie);
 var nvpair=chkdCookie.split(";");
 if( nameDefined(nvpair,"pageCount") ) {
   counter = parseInt( getCookieValue(nvpair,"pageCount") );
 }
 ++counter;
 var futdate = new Date();
 var expdate = futdate.getTime(); // get ms
 expdate += 3600000 * 24 * 30;  // expires in
 futdate.setTime(expdate);

 var newCookie="pageCount="+counter;
 newCookie += "; expires=" + futdate.toGMTString();
 window.document.cookie=newCookie;
}

// this function is called from the body
function insertCounter() {
 readCookie(); // read, and set cookie
 displayCounter(); // out text
}

// End -->

