﻿	Function FormatDate(vStr)
		Dim Y, M, D
		A = Split(vStr, "/")
		Y = A(0)
		M = A(1)
		If Len(M) = 1 then M = "0" + M
		D = A(2)
		If Len(D) = 1 then D = "0" + D
		FormatDate = Y + "/" + M + "/" + D
	End Function
	
	Sub SelectCalendarDate(field_id)
		url = "/HWWeb/Control/Calendar.aspx?FieldName=" + Replace(field_id, "img", "txt") + "&FieldValue=" + document.all(Replace(field_id, "img", "txt")).value
		result = window.showModalDialog(url, window, "center:yes; status:no; help:no; resizable:no; scroll:no; dialogWidth:325px; dialogHeight:210px;")
		If result <> "" then
			document.all(Replace(field_id, "img", "txt")).value = result
		End If
	End Sub

	Sub SelectCalendarDatetime(field_id)
		url = "/HWWeb/Control/CalendarDatetime.aspx?FieldName=" + Replace(field_id, "img", "txt") + "&FieldValue=" + document.all(Replace(field_id, "img", "txt")).value
		result = window.showModalDialog(url, window, "center:yes; status:no; help:no; resizable:no; scroll:no; dialogWidth:290px; dialogHeight:280px;")
		If result <> "" then
			document.all(Replace(field_id, "img", "txt")).value = result
		End If
	End Sub

	Sub ShowSearchModalDialog(target, field, width, height) 
		url = "/HWWeb/Control/" + target + "?FieldName=" + field + "&FieldValue=" + document.all(field).value
		result = window.showModalDialog(url, window, "center:yes; status:no; help:no; resizable:no; scroll:no; dialogWidth:" + width + "; dialogHeight:" + height + ";")
		If result <> "" then
			document.all(field).value = result
		End If
	End Sub
	
	Sub ShowSearchModalDialog2(target, field, filter, width, height) 
		url = "/HWWeb/Control/" + target + "?FieldName=" + field + "&FieldValue=" + document.all(field).value + "&FilterValue=" + filter
		result = window.showModalDialog(url, window, "center:yes; status:no; help:no; resizable:no; scroll:no; dialogWidth:" + width + "; dialogHeight:" + height + ";")
		If result <> "" then
			document.all(field).value = result
		End If
	End Sub

	Sub ShowFromMessageBox(msg_id, msg_typ, msg_date, width, height)
		url = "/HWWeb/Control/ShowFormMessageBox.aspx?FormMessageId=" + CStr(msg_id) + "&FormMessageTypeId=" + CStr(msg_typ) + "&CalendarDate=" + CStr(msg_date)
		window.open url, "_ShowFromMessageBox", "center=yes, scrollbars=auto,resizable=yes,status=no,toolbar=no,menubar=no,width=" + Cstr(width) + ",height=" + CStr(height)
	End Sub

	Sub ShowFromMessageModalDialog(msg_id, msg_typ, msg_date, width, height)
		url = "/HWWeb/Control/ShowFormMessageBox.aspx?FormMessageId=" + CStr(msg_id) + "&FormMessageTypeId=" + CStr(msg_typ) + "&CalendarDate=" + CStr(msg_date)
		result = window.showModalDialog(url, window, "center:yes; status:no; help:no; resizable:yes; scroll:auto; dialogWidth:" + width + "; dialogHeight:" + height + ";")
	End Sub

