// bump-cookie  invoke via < script src=bump-cookie.js >  just after  <BODY  and
// let user know about View; text size
// DGG 10/08/01 add delete of junk U , C, and UC
// DGG 03/12/03 Finally don't use path . remove that junk about expiring stale cookies
//              and ditch that domain=   stuff
// 04/05/03 move cgi logging from end-o-doc to here so logging occurs eariler
// 06/14/03 seems like end-o-doc.js got changed and bump-cookie.js (this) didn't
// 10/16/03 add slash after path so sub directories and root use same cookie
//   There is a document.write here 
// which actually does the logging and "displays" a 3x3 white square

// This function writes or replaces the cookie Name/Value 
//	(browser decides if only update or new)

function setCookie (name, value) {   // 6 months =24 * 7 *26 = 4368
//                              .--now---.                .- 6months in minutes
//                              |        |                |          |  
// var ExpDate = (   new Date( (new Date())  .getTime() + 4368*3600000 )  ).toGMTString();
//                             '---------now in minutes + 6Months -----'
//     GMT string   of   "================================================"
var expDate = (new Date((new Date()).getTime() + 4368*3600000)).toGMTString(); 
 document.cookie = name + "=" + value +	";path=/;expires=" + expDate  ;
 					//cookie string has no training semi 
// did he accept a persistant cookie?   : nope a try session cookie (i.e. date=0)
if ( document.cookie == null ) document.cookie = name + "=" + value; 
}
// get a SINGLE value from the cookie   or  .FALSE.
function WM_getCookieValue(name) {
  var firstChar, lastChar;
  var theBigCookie = document.cookie;    // Why not just use document.cookie? (objectness?)
  firstChar = theBigCookie.indexOf(name);
  if(firstChar != -1) {
    firstChar += name.length + 1;
    lastChar = theBigCookie.indexOf(";", firstChar);
    if(lastChar == -1) lastChar = theBigCookie.length;   // no ending ; so must be last n=v pair
    return theBigCookie.substring(firstChar, lastChar);  // not nice might return string  OR
  } else { return false; } ;                             //          might return boolean
}

//------------- set up cookies        
var User, Cnt, LastVisit, PriorVisit ;
LastVisit = new Date().getTime(); 
if( !( WM_getCookieValue("U") ) ){  User = LastVisit; setCookie("U",User+ ""); 
				                      setCookie("C","0" );  };
User=  WM_getCookieValue("U"); 
 User=parseInt( User ); if(isNaN(User) )User = LastVisit;
Cnt =  WM_getCookieValue("C"); 
 Cnt =parseInt( Cnt  ); if(isNaN(Cnt ) )Cnt =1000;   
 if(Cnt>9999) Cnt%=1000;   
Cnt++; 

setCookie("U",User     + "" );
setCookie("C",Cnt      + "" ); 
setCookie("L",LastVisit+ "" )
//                             ////  end of bc.js ///                    ////// 
