function openDatePicker(fieldname) {
	// This is used along with the Calendar form in Notes. It is called from a link or hotspot located next to a 
	// date field on a form.

	// Verify the current URL location is a string
	var currHref = document.location.href + "&";
	// *** make a second string that is lower case, for searching for db ext
	var currHrefLC = currHref.toLowerCase();
	// *** Find the index for the end of the db name
	var idxDb = currHrefLC.indexOf(".nsf") + 4;
	// From the current location, cut everything after the db name
	var dbName = currHref.substring(0, idxDb);
	// New URL is everything up to the db name and ?OpenForm
	var newURL = dbName + "/Calendar?OpenForm";
	// Add on the field name
	newURL += "&F=" + fieldname;
	// See if there is currently a value in the date field
	var formula = "value = document.forms[0]." + fieldname + ".value";
	var currVal = eval(formula);
	// If there is a date, pass month & year to the new form
	if ((currVal != null) && (currVal != "")) {
		// The month is everything up to the first slash
		 var fieldMonth = currVal.substring(0, currVal.indexOf("/"));
		// The year is everything after the last slash
		var fieldYear = currVal.substring(currVal.lastIndexOf("/") + 1, currVal.length);
		// Since users can manually enter date into field, they may enter 2 digits. Notes assumes 50-99 are 1900,
		// and 0-49 are 2000. To ensure proper year, add 1900 to any year 50-99. Add 2000 to any year 0-49.
		var intYear = parseInt(fieldYear);
		if ((intYear >= 0) && (intYear <= 49)) {
			var yearNumber = 2000 + intYear;
		} else if ((intYear >= 50) && (intYear <= 99)) {
			var yearNumber = 1900 + intYear;
		} else {
			var yearNumber = intYear;
		}

		// Build a JavaScript date for the first of the month & year. Months are zero-based.
		//The month string may have a leading zero, which confuses parseInt, so fix it
		//by subtracting zero first, which makes it a number rather than a string.
		var parmDate = new Date(yearNumber, parseInt(fieldMonth - 0) - 1, 1);
	} else { 
		// The date field is empty, so use current month & year
		var parmDate = new Date();
	}

	// Out of the parmDate variable, get the month & year to pass to the new window
	var currYear = parmDate.getYear();
	// If a new JS date is created, it may be in JS format, which starts dates at 1900:
	// yr 1900 = JS 0, yr 2000 = JS 100, etc.
	// However, we need to pass 4-digit years to the calendar form.
	// To ensure proper years, add 1900 to any year number with less than 4 digits.
	if (currYear < 1000) { currYear += 1900; }
	// Build the &Y= and &M= parameters to the URL
	newURL += "&Y=" + currYear;
	// Javascript will convert these numbers to strings.
	newURL += "&M=" + (parmDate.getMonth() + 1); // Months are stored 0-11

	// Set parameters for window size, toolbar, etc. This makes a plain window with no frills.
	var winParms = "top=100,left=200,width=200,height=225,toolbar=no,directories=no,";
	winParms += "status=no,scrollbars=no,resize=no,menubar=no";
	// Open the new window, everything else happens there
	var newWindow = window.open(newURL, "", winParms);
}
