function initForm(){
	alert("Hello");
	var dt=new Date();
	var cur_mon=dt.getMonth() + 1;
	var cur_day=dt.getDate();
	var cur_yr=dt.getFullYear();
	var cur_hr=dt.getHours();
	document.getElementById('dlstSMon').value = cur_mon;
	document.getElementById('dlstSYear').value = cur_yr;
	MonthChanged('dlstSMon','dlstSYear','dlstSDay');
	document.getElementById('dlstSDay').value = cur_day;
	document.getElementById('dlstEMon').value = cur_mon;
	document.getElementById('dlstEYear').value = cur_yr;
	MonthChanged('dlstEMon','dlstEYear','dlstEDay');
	document.getElementById('dlstEDay').value = cur_day;
	calculateEndDate();
	
}

function toggleTimeSelectors(){
	var chk = document.getElementById("adx_allday");
	/* Enable or disable time dropdowns according to the users selection */
	document.getElementById("dlstSHr").disabled = chk.checked;
	document.getElementById("dlstSMin").disabled = chk.checked;
	document.getElementById("dlstSAMPM").disabled = chk.checked;
	document.getElementById("dlstEHr").disabled = chk.checked;
	document.getElementById("dlstEMin").disabled = chk.checked;
	document.getElementById("dlstEAMPM").disabled = chk.checked;
	document.getElementById("adx_midnight").disabled = chk.checked;
	validShedule();
}

function toggleForMidnight(){
	var chk = document.getElementById("adx_midnight");
	/* Enable or disable time dropdowns according to the users selection */
	document.getElementById("dlstEHr").disabled = chk.checked;
	document.getElementById("dlstEMin").disabled = chk.checked;
	document.getElementById("dlstEAMPM").disabled = chk.checked;
	document.getElementById("adx_allday").disabled = chk.checked;
	validShedule();
}

function showErrorMessage(id, text){
    if(document.getElementById(id)!=null){
        document.getElementById(id).style.visibility = "visible";
    	document.getElementById(id).innerHTML = text;
    	
    }
}

function hideErrorMessage(id){
    if(document.getElementById(id)!=null){
	    document.getElementById(id).style.visibility = "hidden";
	    document.getElementById(id).innerHTML = "";
	}
}

function validOpenEntryForm(){
    var SubmitterIsValid = validSubmitter();
    var EventInformationIsValid = validEventInformation();
    var ScheduleIsValid = validShedule();
    var ImageIsValid = validImage();
    var AttachmentIsValid = validAttachment();
    var OtherInformationIsValid  = validOtherInformation();
   
    
    /* Return if the form was valid or not */
    return (SubmitterIsValid && EventInformationIsValid && ScheduleIsValid && ImageIsValid && AttachmentIsValid && OtherInformationIsValid );  
}

function validSubmitter(){
	/* The default is true */
	var valid_Submitter = true;
	
	/* Submitter First Name */
	if(document.getElementById("adx_fname") != null){
		var FName = trimStr(document.getElementById("adx_fname").value); /* 50 */
		if(FName == ""){
			showErrorMessage("adx_fnameerror","<br>Please enter a First Name in the field provided.");
			valid_Submitter = false;
		}
		else{hideErrorMessage("adx_fnameerror");}
	}
	
	/* Submitter Last Name */
	if(document.getElementById("adx_lname") != null){
		var LName = trimStr(document.getElementById("adx_lname").value); /* 50 */
		if(LName == ""){
			showErrorMessage("adx_lnameerror","<br>Please enter a Last Name in the field provided.");
			valid_Submitter = false;
		}
		else{hideErrorMessage("adx_lnameerror");}
	}
	
	/* Submitter Email */
	if(document.getElementById("adx_email") != null){
		var Email = trimStr(document.getElementById("adx_email").value); /* 100 */
		if(Email == ""){
			showErrorMessage("adx_emailerror","<br>Please enter an Email Address in the field provided.");
			valid_Submitter = false;
		}
		else if(CheckEmail(Email)==false){
			showErrorMessage("adx_emailerror","<br>The Email Address entered is not valid.");
			valid_Submitter = false;
		}
		else{hideErrorMessage("adx_emailerror");}
	}
	
	/* Submitter Organization */
	if(document.getElementById("adx_organizationRequired") != null){
		/* Organization is required */
		var Organization = trimStr(document.getElementById("adx_organization").value); /* 50 */
		if(Organization == ""){
			showErrorMessage("adx_organizationerror","<br>Please enter an Organization in the field provided.");
			valid_Submitter = false;
		}
		else{hideErrorMessage("adx_organizationerror");}
	}
	
	/* Submitter Phone */
	if(document.getElementById("adx_phoneRequired") != null){
		/* Phone is required */
		var Phone = document.getElementById("adx_phone").value; /* 100 */
		if(Phone == ""){
			showErrorMessage("adx_phoneerror","<br>Please enter a Phone # in the field provided.");
			valid_Submitter = false;
		}
		else{hideErrorMessage("adx_phoneerror");}
	}
	
	return valid_Submitter;
}

function validEventInformation(){
	/* The default is true */
	var valid_EventInformation = true;
	
	/* Event Name */
	if(document.getElementById("adx_eventname") != null){
		var EventName = trimStr(document.getElementById("adx_eventname").value); /* 100 */
		if(EventName == ""){
			showErrorMessage("adx_eventnameerror","<br>Please enter an Event Name in the field provided.");
			valid_EventInformation = false;
		}
		else if (EventName.length>100){
		    showErrorMessage("adx_eventnameerror","<br>The Event Name allows for 100 characters.  There are currently "+EventName.length+" entered.");
			valid_EventInformation = false;
		}
		else{hideErrorMessage("adx_eventnameerror");}
	}
	
	/* Event Categorization */
	if(document.getElementById("adx_eventcategorizations") != null){
		var EventCategorization = document.getElementById("adx_eventcategorizations").value; /* 1000 */
		if(EventCategorization == "0-0"){
			showErrorMessage("adx_eventcategorizationserror","<br>Please select an Event Categorization from the field provided.");
			valid_EventInformation = false;
		}
		else{hideErrorMessage("adx_eventcategorizationserror");}
	}
	
	/* Event Description */
	if(document.getElementById("adx_eventdescription") != null){
		var EventDescription = trimStr(document.getElementById("adx_eventdescription").value); /* 1000 */
		if(EventDescription == ""){
			showErrorMessage("adx_eventdescriptionerror","<br>Please enter an Event Description in the field provided.");
			valid_EventInformation = false;
		}
		else if (EventDescription.length>1000){
		    showErrorMessage("adx_eventdescriptionerror","<br>The Event Description allows for 1000 characters.  There are currently "+EventDescription.length+" entered.");
			valid_EventInformation = false;
		}
		else{hideErrorMessage("adx_eventdescriptionerror");}
	}
	
	return valid_EventInformation;
}

function validShedule(){
	var valid_Schedule = true;/* The default is true */
	
	/* Get the date information from the form */
	var StartDate = getDateInput("S");
	/* This sets the start date with no time specified */
	var StartDateNoTime = new Date();
	StartDateNoTime.setFullYear(StartDate.getFullYear(), StartDate.getMonth(), StartDate.getDate());
	StartDateNoTime.setHours(0,0,0,0);
	var EndDate = getDateInput("E");
	
	/* These are the time elements the user chose */
	var allday = document.getElementById("adx_allday").checked;
	var midnight = document.getElementById("adx_midnight").checked;
	var sHour;
	var eHour;
	if(allday==true){
		/* All Day Is Checked */
		sHour = "00";
		eHour = "00";
	}
	else if(midnight==true){
	    /* Midnight Is Checked */
	    eHour = "00";
	}
	else{
		/* All Day Is Not Checked */
		sHour = document.getElementById("dlstSHr").value;
		eHour = document.getElementById("dlstEHr").value;
	}
	
	if(midnight==true){
	    if(sHour == "00"){
		    /* Midnight without a start time is invalid */
		    showErrorMessage("adx_dateerror","A Start Time must be specified when an event ends at Midnight.");
		    return(false);
	    }
	}
	
	/* Always make sure error message are hidden */
	hideErrorMessage("adx_dateerror")
	if(sHour == "00" && eHour != "00"){
		/* An end time without a start time is invalid */
		showErrorMessage("adx_dateerror","An end time cannot be specified without a start time.");
		valid_Schedule = false;
	}
	else{
		if(sHour != "00" && eHour != "00"){
			/* Start & End Times */
			if(StartDate >= EndDate){
				/* The starting date must be less than the ending date. */
				showErrorMessage("adx_dateerror","The start date selected cannot be after the end date. Please change your selections.");
				valid_Schedule = false;
			}
		}
		else if(sHour != "00" && eHour == "00"){
			/* Start Time & No End Time */
			if(StartDateNoTime > EndDate){
				showErrorMessage("adx_dateerror","The start date selected cannot be after the end date. Please change your selections.");
				valid_Schedule = false;
			}
		}
		else{
			/* No Time */
			if(StartDate > EndDate){
		
				showErrorMessage("adx_dateerror","The start date selected cannot be after the end date. Please change your selections.");
				valid_Schedule = false;
			}
		}	
	}	
	
	if(document.getElementById("adx_recurtype").value == "One Time" && valid_Schedule == true){
		/* This should only be done when the schedule is valid. */
		document.getElementById("adx_occurcount").value = "1";
	}
		
	/* Return if this was a valid schedule */
	return valid_Schedule;
}

function Multidaydropdown(){
    /*GET THE START DATE*/
    var StartDate = getDateInput("S");
    StartDate.setHours(0,0,0,0);
 
    /*GET THE END DATE*/
    var EndDate = getDateInput("E");
    EndDate.setHours(0,0,0,0);
  
    /*CALCULATE THE DAYS BETWEEN THE TWO DATES*/
    var one_day=1000*60*60*24;
    var days_apart = Math.ceil((EndDate-StartDate)/one_day);
    
  
    /*GET A REFERRENCE TO THE DROPDOWN TO MODIFY*/
    var ctrl = document.getElementById("adx_recurtype");
    
    /*GET A REFERRENCE TO THE CURRENTLY SELECTED OPTION & HOW MANY ITEMS THERE ARE*/
    var startingSelectedIndex = ctrl.selectedIndex;
    var startingItemsCount = ctrl.options.length;  // how many items are in the dropdown
            
    /*REMOVE THE OLD OPTIONS*/
    while(ctrl.options.length>1) { ctrl.options[1] = null; }
    
    /*READD ALL THE OPTIONS*/
    ctrl.options[0] = new Option("None","One Time");
    ctrl.options[1] = new Option("Daily","Interval1");
    ctrl.options[2] = new Option("Weekly","Weekly1");
    ctrl.options[3] = new Option("Monthly","Monthly by Date1");
    ctrl.options[4] = new Option("Yearly","Yearly by Date");
    
    if(days_apart>=30){
        //THE EVENT SPANS 30+ CONTINUOUS DAYS
        ctrl.options[1] = null; /*REMOVE DAILY*/
        ctrl.options[1] = null; /*REMOVE WEEKLY*/
        ctrl.options[1] = null; /*REMOVE MONTHLY*/
    }
    else if(days_apart>=7){
        //THE EVENT SPANS 7-30 CONTINUOUS DAYS
        ctrl.options[1] = null; /*REMOVE DAILY*/
        ctrl.options[1] = null; /*REMOVE WEEKLY*/
    }
    else if(days_apart>=1){
        //THE EVENT SPANS 2-6 CONTINUOUS DAYS
        ctrl.options[1] = null; /*REMOVE DAILY*/
    }
    
    /*RESELECT THE ITEM THE USER LAST HAD SELECTED*/
    var endingItemDelta = ctrl.options.length - startingItemsCount;
    var endingSelectedIndex = startingSelectedIndex+endingItemDelta;         
    if(endingSelectedIndex>0){
        ctrl.selectedIndex = endingSelectedIndex;
    }
      MultidayEvent();
  
}


function MultidayEvent(){
    /*GET THE START DATE*/
    var StartDate = getDateInput("S");
    StartDate.setHours(0,0,0,0);
 
    /*GET THE END DATE*/
    var EndDate = getDateInput("E");
    EndDate.setHours(0,0,0,0);
   
    /*CALCULATE THE DAYS BETWEEN THE TWO DATES*/
    var one_day=1000*60*60;
    var hoursDiff// = ((hoursDiff / 1000) / 60) / 60);
    var days_apart = Math.ceil((EndDate-StartDate)/one_day);
    
    /* No Time */
    var multi_day = true;
    
	if(days_apart > 1) {
	    showErrorMessage("adx_multidayerror","You have selected a date and time pattern that makes this a multi-day event and not a single day event that follows a recurring series pattern.  This multi-day event has a continous duration of <B> "  +   days_apart  +  " hours.</B>  Are you sure that you want to create a multi-day event or a single day event that recurs on multiple days?  You may either edit your schedule selections above or continue forward with your current selections by completing the remainder of the form and using the appropriate buttons at the bottom of this form.");
    	if(document.getElementById("adx_multidayerror")!=null){
	        if(document.getElementById("adx_multidayerror").style.visibility = "visible"){
    		    multi_day = true;
            }
            else if (document.getElementById("adx_multidayerror").style.visibility = "hidden"){
                multi_day = false;
                document.getElementById("adx_multidayerror").style.visibility = "visible";
                document.getElementById("adx_multidayerror").innerHTML = text;
	            multi_day = true;
	        }
	    }
	} 
	return multi_day;				
}

function validOtherInformation(){
	/* The default is true */
	var valid_OtherInformation = true;
	
	/* This validates all the custom imput fields. */
	var AddmissionInformation = validOtherInformationHelper("adx_admission"); /* 255 */
	var OtherDetails = validOtherInformationHelper("adx_otherdetails"); /* 500 */
	var Custom1 = validOtherInformationHelper("adx_custom1"); /* 255 */
	var Custom2 = validOtherInformationHelper("adx_custom2"); /* 255 */
	
	var InternalNotes; /* 1000 */
	if(document.getElementById("adx_internalnotes") != null){
		InternalNotes = document.getElementById("adx_internalnotes").value;
	}
	
	var facilityRoomSelection = true;
	hideErrorMessage("adx_eventlocationserror"); /*Hide error messages by default*/
	if(document.getElementById("adx_facilitycalendar")!=null){
	    /*There is a facility identifier*/
	    if(document.getElementById("adx_facilitycalendar").value=="Y"){
	        if(document.getElementById("adx_eventlocations")!=null){
	            /*This is a facility calendar*/
	            var fac = document.getElementById("adx_eventlocations").value.split("-");
	            if(fac[0]=="0"){
	                /*No Facility Was Selected*/
	            }
	            else{
	                /*There is a facility selected, make sure a room is selected*/
	                if(fac[2]=="0"){
	                    facilityRoomSelection=false;
	                    showErrorMessage("adx_eventlocationserror", "<br />Please select a Room from the dropdown provided.");
	                }
	            }
	        } 
	    }
	}
	return AddmissionInformation && OtherDetails && Custom1 && Custom2 && facilityRoomSelection;
}

function validOtherInformationHelper(customControlName){
    var validInput=true;
    if(document.getElementById(customControlName) != null){
        var customInput="";/*This is the custom selection-input*/
        if(document.getElementById(customControlName).value == null){
            /* Checkboxes */
            var index=0;
            while(document.getElementById(customControlName+"_"+index)!=null){
                if(document.getElementById(customControlName+"_"+index).checked == true){
                    /* This checkbox was checked */
                    customInput="valid selection";
                }
                index++;
            }
        }
        else{
            /* Dropdown or Textbox */
            customInput = trimStr(document.getElementById(customControlName).value);
        }
        
        if(document.getElementById(customControlName+"Required") != null){
		    if(trimStr(customInput) == ""){
		        /* Tell the user to select or enter something.*/
			    showErrorMessage(customControlName+"error","<br>This is a required event field.");
			    validInput=false;
		    }
		    else{
		        hideErrorMessage(customControlName+"error");
		    }
	    }
    }  
    return validInput;
}

function validImage(){
	if(document.getElementById("adx_image") != null){
		/* Validate the Extention */
		var filepath = document.getElementById("adx_image").value;
			
		if(trimStr(filepath) != ""){
			/* The user selected a file to upload, validate the extention and alt text */
			var filename = filepath.substring(filepath.lastIndexOf("\\") + 1);
			var extention = filename.substring(filename.lastIndexOf(".") + 1);
			
			switch(extention){
				case "gif":/* Graphical Interchange Format */
				case "jpg":/* Joint Photographic Experts Group */
				case "jpeg":/* Joint Photographic Experts Group */
					/* These are the only valid image extentions */
					hideErrorMessage("adx_imageerror");
					break;
				default:
					/* The image uploaded is not valid */
					showErrorMessage("adx_imageerror","<br>The image being uploaded is not a valid type.");
					return(false);
					break;
			}
				
			/* Get the alt text entered by the user */
			var ImageAlt = document.getElementById("adx_imagealt").value;
			if(trimStr(ImageAlt) == ""){
				/* Image Alt Text is REQUIRED */
				showErrorMessage("adx_imagealterror","<br>Please enter Image Alt Text in the field provided.");
				return(false);
			}
			else{
				/* Hide any error message */
				hideErrorMessage("adx_imagealterror");
			}	
		}
	}
	return(true);	
}

function validAttachment(){
	if(document.getElementById("adx_attachment") != null){
		/* Validate the Extention */
		var filepath = document.getElementById("adx_attachment").value;
		
		if(trimStr(filepath) != ""){
			/* The user selected a file to upload, validate the extention and alt text */
			var filename = filepath.substring(filepath.lastIndexOf("\\") + 1);
			var extention = filename.substring(filename.lastIndexOf(".") + 1);
			
			switch(extention){
				case "gif":/* Graphical Interchange Format */
				case "jpg":/* Joint Photographic Experts Group */
				case "jpeg":/* Joint Photographic Experts Group */
				case "png":/* Portable Network Graphics */
				case "mov":/* Movie */
				case "qt":/* Quick Time */
				case "avi":/* Audio Video Interleave */
				case "wmv":/* Windows Media Video */
				case "wma":/* Windows Media Audio */
				case "wmf":/* Windows Meta File */
				case "wav":/* Wave Type */
				case "mp3":/* Mpeg-3 Type */
				case "m4a":/* Mpeg-4 Audio File Type (iTunes) */
				case "ram":/* Real Audio Media */
				case "doc":/* MS Word */
				case "xls":/* MS Excel */
				case "ppt":/* MS Power Point */
				case "vsd":/* MS Visio */
				case "pdf":/* Personal Document File */
				case "txt":/* Text */
				case "swf":/* Flash */
				case "docx":/* MS Word 2007 */
				case "xlsx":/* MS Excel 2007 */
				case "pptx":/* MS Power Point 2007 */
				case "vsdx":/* MS Visio 2007 */
					/* These are the valid attachment extentions */
					hideErrorMessage("adx_attachmenterror");
					break;
				default:
					/* The attachment uploaded is not valid */
					showErrorMessage("adx_attachmenterror","<br>The attachment being uploaded is not a valid type.");
					return(false);
					break;
			}
			
			/* Get the attachmentB text entered by the user */
			var AttachmentText = document.getElementById("adx_attachmenttext").value;
			if(trimStr(AttachmentText) == ""){
				/* Image Alt Text is REQUIRED */
				showErrorMessage("adx_attachmenttexterror","<br>Please enter Attachment Link Text in the field provided.");
				return(false);
			}
			else{
				/* Hide any error message */
				hideErrorMessage("adx_attachmenttexterror");
			}	
		}
	}
	return(true);
}

function getDateInput(start_end){
	/* Check the dates and times entered */
	var theYear = document.getElementById("dlst" + start_end + "Year").value;
	var theMonth = document.getElementById("dlst" + start_end + "Mon").value;
	var theDay = document.getElementById("dlst" + start_end + "Day").value;
	var theHour = document.getElementById("dlst" + start_end + "Hr").value;
	var theMinute = document.getElementById("dlst" + start_end + "Min").value;
	var theAMPM = document.getElementById("dlst" + start_end + "AMPM").value;
	
	var allday = document.getElementById("adx_allday").checked;
	if(allday){
		theHour = "";
		theMinute = "";
	}
	
	var theDate = new Date();
	theDate.setFullYear(theYear, theMonth - 1, theDay);
		
	if(theHour != "" && theMinute != ""){
		if(theAMPM == "PM"){
			if(theHour == "12"){
				theDate.setHours(theHour,theMinute,0,0);
			}
			else{
				theDate.setHours(parseInt(theHour) + 12,theMinute,0,0);
			}
		}
		else{
			if(theHour == "12"){
				theDate.setHours(0,theMinute,0,0);
			}
			else{
				theDate.setHours(theHour,theMinute,0,0);
			}
		}
	}
	else{
		theDate.setHours(null,null,null,null);
	}
	
	/* This is the date scraped from the form */
	return (theDate);
}

function calculateEndDate(){
	var rectype = document.getElementById("adx_recurtype").value;
	var count = document.getElementById("adx_occurcount").value;
	var dt = new Date();	
	
	if(count == ""){
		/* There must be at least 1 occurrence */
		document.getElementById("adx_occurcount").value = 1;
		count=1;
	}
	
	/* Make sure the occurrence input field is enabled */
	/* document.getElementById("adx_occurcount").disabled = false; */
	
	/* This ensures the count variable will be treated as an integer */
	count = parseInt(count);
	count--; /* Always decrement the count value by 1 before starting */
	
	/* Get the start date of the event input by the user, without time. */
	dt = getDateInput("S");
	dt.setHours(0,0,0,0);
	
	/* Hide any date references */
	hideErrorMessage("adx_occurdate");
	if (rectype == "One Time"){
		/* Make the occurrence counter 1 */
		document.getElementById("adx_occurcount").value = "1";
		/* document.getElementById("adx_occurcount").disabled = true; */
	}
	else if(rectype == "Interval1"){
		while(count > 0)
		{
			/* These are all occurrences of the event */
			dt.setFullYear(dt.getFullYear(),dt.getMonth(),dt.getDate()+1);
			count--;
		}
		showErrorMessage("adx_occurdate","Last Occurrence Date: " + (dt.getMonth() + parseInt(1)) + "/" + dt.getDate() + "/" + dt.getFullYear());
	}
	else if(rectype == "Weekly1"){
		while(count > 0)
		{
			/* These are all occurrences of the event */
			dt.setFullYear(dt.getFullYear(),dt.getMonth(),dt.getDate()+7);
			count--;
		}
		showErrorMessage("adx_occurdate","Last Occurrence Date: " + (dt.getMonth() + parseInt(1)) + "/" + dt.getDate() + "/" + dt.getFullYear());
	}
	else if(rectype == "Monthly by Date1"){
		var tempDate = new Date();
		tempDate.setHours(0,0,0,0); /* There should be no time */
		var dayVal = dt.getDate(); /* Day we are looking for */
		var numDays; /* Num days in a month */
		while(count > 0)
		{
			tempDate.setFullYear(dt.getFullYear(),dt.getMonth()+1,1); /* How many days are in the next month */
			numDays = DaysInMonth(tempDate.getFullYear(),tempDate.getMonth());
			while(numDays < dayVal){
				/* Look at the next month, until it has the right # of days */
				tempDate.setFullYear(tempDate.getFullYear(),tempDate.getMonth()+1,1);
				numDays = DaysInMonth(tempDate.getFullYear(),tempDate.getMonth());
				/* This block correct cases where the month does not have 31 or 30 days */
				/* This generally affects the month of Feb. or when the event occurres  */
				/* on a monthly basisi on day 31 */
			}
			/* This is the next occurrence */	
			dt.setFullYear(tempDate.getFullYear(),tempDate.getMonth(),dayVal);
			count--;
		}
		showErrorMessage("adx_occurdate","Last Occurrence Date: " + (dt.getMonth() + parseInt(1)) + "/" + dt.getDate() + "/" + dt.getFullYear());
	}
	else if(rectype == "Yearly by Date"){
		while(count > 0)
		{
			/* These are all occurrences of an event */
			dt.setFullYear(dt.getFullYear()+1,dt.getMonth(),dt.getDate());
			count--;
		}
		showErrorMessage("adx_occurdate","Last Occurrence Date: " + (dt.getMonth() + parseInt(1)) + "/" + dt.getDate() + "/" + dt.getFullYear());
	}
}

function openGrid(url, month, day, year){
	var qs = "month=" + month + "&day=" + day + "&year=" + year;
	window.open(url + "openentryjscalendar.aspx?" + qs,'','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=190,height=200,left=212,top=50');
}

function syncDateSelectors(){
	//Set the dates with no time
	var sDt = new Date();
	sDt = getDateInput("S");
	sDt.setHours(0,0,0,0);
	
	//Set the end date selectors
	document.getElementById("dlstEMon").value = sDt.getMonth() + 1;
	document.getElementById("dlstEDay").value = sDt.getDate();
	document.getElementById("dlstEYear").value = sDt.getFullYear();
	MonthChanged('dlstEMon','dlstEYear','dlstEDay');
}