// bump  invoke via < script src=bump.js defer > <!-- no document.write in here ?? -->
// DGG 12/28/03   
// version 4.00 uses   "/" for path; save LastVisit; if C is junk get a new userID too
//	Perhaps another version would use complete filename. 
//	This would facilitate displaying " you have not seen changed pages a,d,g,h,q,r...
//	 if one page vould retreive all dates
//		or maybe string of cookies like  
//	p8=dir/subdir/index;d8=mmddyylongago;p7=dir/subdir/ppp;d7=mmddyyrecently;p0=thispage;d0=mmddyytoday;
// 01/17/04 smarter LastVIsit neeeded i.e. don't set if it is within last 60*60*1000

function setCookie (name, value){   // 6 months =24 * 7 *26 = 4368 (about)   60*60 milliseconds
 var expDate = (new Date(    (new Date()).getTime()      +   4368*3600000)).toGMTString(); 
 document.cookie = name + "=" + value +  ";expires=" + expDate + ";path=/" ;
// did he accept a persistant cookie ?  nope a try session cookie (i.e. date=0)
if ( document.cookie == null ) { document.cookie = name + "=" + value + ";path=/"  }; // omit date     
}

function getCookieValue(name) {	//    or  .FALSE.
  var firstChar, lastChar;
  var CookieString = document.cookie;    // make it a string 
  firstChar = CookieString.indexOf(name);
  if(firstChar != -1) {
    firstChar += name.length + 1;
    lastChar = CookieString.indexOf(";", firstChar);
    if(lastChar == -1) lastChar = CookieString.length;   // no ending ; so must be last n=v pair
    return CookieString.substring(firstChar, lastChar);
  } else { return false; } ;
}  	
	//--------set UserID =current millicecsnds, bump counter,& set lastvisit
var User, Cnt, LastVisit, now ;
now = new Date().getTime(); 
if(      !(  getCookieValue("U") )   ){  setCookie("U",now); setCookie("C","0");  };  // new user; assign him U####
User= getCookieValue("U");   Cnt = getCookieValue("C"); LastVisit = getCookieValue("L");
Cnt = parseInt( Cnt );  /* Junk? How? */    if(isNaN(Cnt) ) {Cnt =1000;setCookie("U",now);};   if(Cnt>9999) Cnt%=1000;  
Cnt++; 
setCookie("U",User     );   // put the UserID back out with new expire         
setCookie("C",Cnt + "" );   // Cnt in text
setCookie("L",now);         // lastVisit
//                                                  ////  end of bump-cookie.js ///      ////// 

