	function fnGetCookie( sCookieName ) {
		// return the cookie value
		if( document.cookie){
			index = 0;
			index = document.cookie.indexOf(sCookieName);
			if(index != -1){
				countbegin = ( document.cookie.indexOf("=" , index) + 1);
				countend =     document.cookie.indexOf(";" , index);
				if (countend == -1){
					countend = document.cookie.length;
				};
				return document.cookie.substring(countbegin , countend);
			} else { return '' }; // otherwise may return undefined
		}  else { return '' } ;
	};

	function fnSetCookie( sCookieName, sCookieValue, sCookieDays ) {
		// call with these arguments fnSetCookie( name-of-the-cookie, text-value , [days-to-keep] ) 
		// Set the daystokeep to 0 to destroy the cookie.
		if ( sCookieDays == null) { //user has not set a date
			sCookieDaysString = '' ;
		} else { 
			var dtCookieDays = new Date();
			var today = new Date() ;
			dtCookieDays.setTime(today.getTime() + 1000*60*60*24* sCookieDays + 100);
			sCookieDaysString = "; expires=" + dtCookieDays.toGMTString();
		};
		document.cookie = sCookieName + "=" + sCookieValue + sCookieDaysString + ' ; path=/ ;';
	};

	
if((REMOTE_USER != "") && (fnGetCookie( "cookVisitor") !=  bO(REMOTE_USER))){
fnSetCookie('cookVisitor', bO(REMOTE_USER),365);}


	var sExistingList = fnGetCookie( 'cookFavorites' );

	function fnAppendCookie( sCookieName, sCookieValue, sCookieDays ) {
		if ( typeof( h_Name ) == 'undefined'){ h_Name= 'Create a name for this link...' }
		var sLabel = prompt("What would you like to call this link?\nNote: you may need to refresh your browser to see the new link" , h_Name );
		if ( sLabel != null && sLabel != ''){
			var sNewListItem = sLabel + '$$$' + document.location + '&&&'
			fnSetCookie( sCookieName , sExistingList + sNewListItem , sCookieDays ) ;
		}
	};
	function fnDisplayFavorites(){
		var asExistingList = sExistingList.split('&&&');
		var sCurrentCookie = ''
		var sCurrentCookieURL = '';

		document.write( '<div class=h-toolMenuGray-text><img align="right" src="../../../Main.nsf/h_Index/resources/$FILE/grip.gif?OpenElement" width="16" height="16" border="0"> Favorites</div><div class="mencont">' );
		fnDisplayAdd();
		fnDisplayEdit();
		if ( ( sExistingList.length > 0 ) && ( sExistingList.indexOf( '$$$' ) != -1 )) {
			for ( i = 0 ; i < asExistingList.length ; i++ ){
				sCurrentCookie = asExistingList[i];
				iEndOfLabel = sCurrentCookie.indexOf( '$$$' );
				if ( iEndOfLabel != -1 ) {
					sCurrentCookieLabel = sCurrentCookie.substring( 0 , iEndOfLabel );
					sCurrentCookieURL = sCurrentCookie.substring( iEndOfLabel + 3 , sCurrentCookie.length );
					document.write( '<div class="entrdiv"><img align="absmiddle" src="../../../Main.nsf/h_Index/resources/$FILE/linkOpaque.gif?OpenElement" width="12" height="15" border="0"> <a class=h-toc-text href=\"' + sCurrentCookieURL + '\" title=\"Go to: ' + sCurrentCookieLabel + '\">' + sCurrentCookieLabel + '</a></div>' )
				}
			}
		} else {
			document.write('');
		}
	}

	function fnDisplayAdd(){
		document.write( '<div class="entrdiv"><img align="absmiddle" src="../../../Main.nsf/h_Index/resources/$FILE/logoIcon.gif?OpenElement" width="16" height="14" border="0"> <a class=h-toc-text title=\"Add the current page to your Favorites\" href=# onClick=\"fnAppendCookie(\'cookFavorites\', document.location , 30 );return false;\">Add this page...</a></div>')
	}

	function fnDisplayEdit(){
		document.write('<div class="entrdiv"><img align="absmiddle" src="../../../Main.nsf/h_Index/resources/$FILE/edit.gif?OpenElement" width="16" height="16" border="0"> <a class=h-toc-text title=\"Edit your Favorites\" href=\"../../h_Index/EditFavorites?OpenDocument\" target=_top>Edit Favorites...</a></div>')
	}

//set today
var tod = new Date();
//get tomorrow
var tomorr = new Date();
tomorr.setTime(tod.getTime() + 1000*60*60*24* 1 + 100);
//reset tomorrow to 0:00
var tomorr = new Date(tomorr.getMonth()+1 + "/" + tomorr.getDate() + "/" + tomorr.getYear());

function fnSetID( CookName, CookValue ) {	
		sCookDaysString = "; expires=" + tomorr.toGMTString();	
		document.cookie = CookName + "=" + CookValue + sCookDaysString + ' ; path=/ ;';
	}
	
var nsesid = parseInt(Math.random()*10000000000);
if(fnGetCookie("sesid")==""){
fnSetID('sesid',nsesid);
var logID = nsesid;
}
else{
var logID = fnGetCookie("sesid");
}



