	
	// This has been updated so that more than one date textbox can be used on a page at the same
	// time. The only requirement is that all textboxes which use editDate() and presentDate() have
	// unique names. William Foreman 28.06.2004
	
	var tmpDate;
	
	function editDate(txtBox){
		if(GetTempDate(txtBox.id) == null){
			SaveTempDate(txtBox.id, txtBox.value);
		}
		
		txtBox.value = "";
	}
	
	function GetTempDate(txbName){
		if(tmpDate != null){
			var tmpDates = tmpDate.split(';');
			for(count=0; count<tmpDates.length; count++){
				var cTempDate = tmpDates[count].split('=');
				if(cTempDate[0] == txbName){
					if(cTempDate[1] == "null"){
						return null;
					}
					else{
						return cTempDate[1];
					}
				}
			}
		}
		
		return null;
	}
	
	function SaveTempDate(txbName, txbValue){
		if(tmpDate != null){
			if(tmpDate.length > 0){
				var tmpDates = tmpDate.split(';');
				var newTmpDate = "";
				for(count=0; count<tmpDates.length; count++){
					var cTempDate = tmpDates[count].split('=');
					if(cTempDate[0] != txbName){
						if(newTmpDate.length > 0){
							newTmpDate += ";";
						}
						
						newTmpDate += tmpDates[count];
					}
				}

				tmpDate = newTmpDate + ";";
			}
		}
		else{
			tmpDate = "";
		}
		
		tmpDate += txbName + "=" + txbValue;
		return;
	}
	
	// Note: the date string returned is a UTC/GMT date string (chosen for its presentation) which is calculated as the
	// difference between that date and the current locale date. Hence, 6 hours have been added
	// to allow for BST dates and possible other european date/time zones. Without this,
	// when a date is entered during a period under BST in the system locale, a UTC/GMT date will
	// in fact be the night before, and hence the displayed date will be one day less.
	// This code has not been tested on a machine running a US locale. The hour adjustment may
	// need to be changed to cater for this. It should be possible to set the hour adjustment so
	// the same date will be shown regardless of the user locale. Remember the user locale is
	// from the client's machine running the script. William Foreman 07.03.2003
	function presentDate(txtBox){
		if(txtBox.value.length == 6){
			var d = new Date(Number(txtBox.value.substr(4,2))+2000,Number(txtBox.value.substr(2,2))-1,Number(txtBox.value.substr(0,2)));
			if(!isNaN(d)){
				d.setHours(6);
				txtBox.value = d.toGMTString().substr(0,d.toGMTString().length-13);
				SaveTempDate(txtBox.id, null)
			}
			else{
				alert("Invaid date format!\n\nUse DDMMYY\nE.g. 061003 for 6 Oct 2003");
				txtBox.focus();
			}
		}
		else if(txtBox.value.replace(/ /g,"").length > 0){
			alert("Invaid date format!\n\nUse DDMMYY\nE.g. 061003 for 6 Oct 2003");
			txtBox.focus();
		}
		else{
			txtBox.value = GetTempDate(txtBox.id);
		}
	}
