// set the default values of the diary input form	function diary_input_default() {				date = new Date();				dayofweek = date.getDay() + 1;			date_month = date.getMonth() + 1;		date_day = date.getDate();		date_year = date.getFullYear();		time_hour = date.getHours();		time_minute = date.getMinutes();				time_minute = time_minute - (time_minute % 5); // round down to the nearest five minute interval		time_minute = time_minute / 5; // convert from the actual minute value to the index of the menu				if (time_hour > 12) {			time_ampm = 2;			time_hour = time_hour - 12;		} else {			time_ampm = 1;		}				document.diary_input.dayofweek.selectedIndex = dayofweek;		document.diary_input.date_month.selectedIndex = date_month;		document.diary_input.date_day.selectedIndex = date_day;		document.diary_input.date_year.selectedIndex = date_year - document.diary_input.date_year.options[1].value + 1;		document.diary_input.time_hour.selectedIndex = time_hour;		document.diary_input.time_minute.selectedIndex = time_minute + 1;		//document.diary_input.time_ampm.selectedIndex = time_ampm; // for menu		document.diary_input.time_ampm[time_ampm - 1].checked = true; // for radio button		}// grab name/value pairs from the URL and set JavaScript variables accordingly// - PHP does this automatically	function getVars() {			if (document.URL.indexOf('?') != -1) {					queryString = document.URL.substring(document.URL.indexOf('?') + 1, document.URL.length);			queryPairs = queryString.split("&")						for (i=0; i < queryPairs.length; i++) {				pair = queryPairs[i].split("=")				key = pair[0]				value = pair[1]				eval(key + " = '" + value + "'")			}						if (queryString.indexOf("args=") != -1 ){				argsPieces = args.split(",")				for (i=0; i < argsPieces.length; i++) {					j = i + 1					eval("arg" + j + " = '" + argsPieces[i] + "'")				}			}				} else {			queryString = ""; queryPairs = ""; template = ""; args = ""		}				}	// return a value up to the delimiter, or the original value if the delimiter isn't there// - this is used most often when parsing an argstring to set button states	function crop(value,delimiter) {		result = (value.indexOf(delimiter) != -1) ? value.substring(0, value.indexOf(delimiter)) : value ;		return result	}	// open a generic popup window, specifying source and size	function popup(source,width,height) {		now = new Date()		window_name = now.getTime()		popup_window = window.open(source,window_name,"width="+String(width)+",height="+String(height)+",location=no,menubar=no,directories=no,toolbar=no,scrollbars=yes,resizable=yes,status=yes");		popup_window.focus()	}// the simplest possible rollover function	function swap(name,state) {		eval('document.images.' + name + '.src = ' + name + '_' + String(state) + '.src')	}	// rollovers with sticky highlights// - used in navigation frames where the buttons persist but other pages are changing	var previous = null	var current = null	function stickySwap(name,state,hold) {		if (hold == 1) {			// set previously lit button to normal			previous = current			if (previous != null) {				eval('document.images.' + previous + '.src = ' + previous + '_0.src')			}		}		if ((name != null) && (name != current)) {			// set new button state			eval('document.images.' + name + '.src = ' + name + '_' + String(state) + '.src')			if (hold == 1) {current = name}		}	}	// rollovers with separate but linked button and label graphics// - highlights both the button and label if you mouse over either one // - requires graphics to be named like "button_0.gif" and "button_label_0.gif"	function labelSwap(name,state) {		eval('document.images.' + name + '.src = ' + name + '_' + String(state) + '.src')				// change the label if one exists		if (eval('document.images.' + name + '_label')) {			eval('document.images.' + name + '_label.src = ' + name + '_label_' + String(state) + '.src')		}				// change the button if this is a label		if (name.indexOf("_label") != -1) {			name = name.substr(0,(name.length - 6))			if (eval('document.images.' + name)) {				eval('document.images.' + name + '.src = ' + name + '_' + String(state) + '.src')			}		}	}	// write a block of code that preloads a list of graphics// - this version makes on and off states and is most often used for button rollovers	function preloadButtons(names) {		names = names.split(",")		for (i=0; i < names.length; i++) {			thisName = names[i]			eval(thisName+"_0 = new Image()")			eval(thisName+"_0.src = '../graphics/"+thisName+"_0.gif'")			eval(thisName+"_1 = new Image()")			eval(thisName+"_1.src = '../graphics/"+thisName+"_1.gif'")			if (thisName.indexOf("menu_") != -1) {				eval(thisName+"_2 = new Image()")				eval(thisName+"_2.src = '../graphics/"+thisName+"_2.gif'")			}		}	}	// write a block of code that preloads a list of graphics// - this version just makes an on state and is most often used for tips associated with button rollovers	function preloadTips(names) {		names = names.split(",")		for (i=0; i < names.length; i++) {			thisName = names[i]			eval(thisName+" = new Image()")			eval(thisName+".src = '../graphics/"+thisName+".gif'")		}	}	// write a block of code that preloads a list of graphics// - this version uses the same source file for each instance and is most often used for markers associated with button rollovers	function preloadMarkers(names,marker_name) {		names = names.split(",")		for (i=0; i < names.length; i++) {			thisName = names[i]			eval(thisName+"_0 = new Image()")			eval(thisName+"_0.src = '../graphics/"+marker_name+"_0.gif'")			eval(thisName+"_1 = new Image()")			eval(thisName+"_1.src = '../graphics/"+marker_name+"_1.gif'")		}	}	// leave this here to catch calls to the original preload script	function makePreloads(names) {		preloadButtons(names)	}	// returns the index of an array element, something that ought to be built into JavaScript but isn't!// returns "" if not present	function getPosition(string, array) {		for (i=0; i < array.length; i++) {			if (array[i] == string) {				return i				break			}		}		return ""	}// this is handy for preventing the Return key from submitting forms (set form action to "JavaScript:nothing()")		function nothing() {}		