<% Option Explicit %>
<%
Function RegExpTest(Str, s_Pattern)
    Dim re
    Set re = New RegExp
    re.IgnoreCase = True
    re.Global = True
    re.Pattern = s_Pattern
    RegExpTest = re.Test(Str)
    Set re = Nothing
End Function

Function FormatTime(s_Time, n_Flag)
    Dim y, m, d, h, mi, s
    FormatTime = ""
    If IsDate(s_Time) = False Then Exit Function
    y = CStr(Year(s_Time))
    m = CStr(Month(s_Time))
    If Len(m) = 1 Then m = "0" & m
    d = CStr(Day(s_Time))
    If Len(d) = 1 Then d = "0" & d
    h = CStr(Hour(s_Time))
    If Len(h) = 1 Then h = "0" & h
    mi = CStr(Minute(s_Time))
    If Len(mi) = 1 Then mi = "0" & mi
    s = CStr(Second(s_Time))
    If Len(s) = 1 Then s = "0" & s
    Select Case n_Flag
        Case 1
            FormatTime = y & "-" & m & "-" & d & " " & h & ":" & mi & ":" & s
        Case 2
            FormatTime = y & "-" & m & "-" & d
        Case 3
            FormatTime = h & ":" & mi & ":" & s
        Case 4
            FormatTime = y & m & d
        Case 5
            FormatTime = y & m & d & h & mi & s
    End Select
End Function

Function IsInt(Str)
    IsInt = False
    If Str = "" Then
        Exit Function
    End If
    If RegExpTest(Str, "[^0-9]+") = False Then
        IsInt = True
    End If
End Function

Function GetSAPIvalue(s_SessionKey, s_ParamName)
    GetSAPIvalue = Trim(Session("eWebEditor_" & s_SessionKey & "_" & s_ParamName))
End Function

Function IsOkSParams(s_SParams, s_EncryptKey)
    IsOkSParams = False
    If s_SParams = "" Then Exit Function
    Dim a, n, s1, s2
    n = InStr(s_SParams, "|")
    If n <= 0 Then Exit Function
    s1 = Left(s_SParams, n - 1)
    s2 = Mid(s_SParams, n + 1)
    If MD5(s_EncryptKey & s2) <> s1 Then Exit Function
    IsOkSParams = True
End Function
%>