<%
Function Encrypt(theNumber)
On Error Resume Next
Dim n, szEnc, t, HiN, LoN, i
n = CDbl((theNumber + 1570) ^ 2 - 7 * (theNumber + 1570) - 450)
If n < 0 Then szEnc = "R" Else szEnc = "J"
n = CStr(abs(n))
For i = 1 To Len(n) step 2
t = Mid(n, i, 2)
If Len(t) = 1 Then
szEnc = szEnc & t
Exit For
End If
HiN = (CInt(t) And 240) / 16
LoN = CInt(t) And 15
szEnc = szEnc & Chr(Asc("M") + HiN) & Chr(Asc("C") + LoN)
Next
Encrypt = szEnc
End Function

function wmaencode(str)
if not isnull(str) then
str=Replace(str, "/","XG")
str=Replace(str, "1","YI")
str=Replace(str, "2","ER")
str=Replace(str, "3","SN")
str=Replace(str, "4","SI")
str=Replace(str, "5","WU")
str=Replace(str, "6","LU")
str=Replace(str, "7","QI")
str=Replace(str, "8","BA")
str=Replace(str, "9","JU")
str=Replace(str, "0","LN")
str=Replace(str, ".","XD")
str=Replace(str, "'","""")
str= Replace(str, "wma", "RM")
  wmaencode = str
end if
end function

function dlencode(str)
if not isnull(str) then
str=Replace(str, "/","XG")
str=Replace(str, "1","YI")
str=Replace(str, "2","ER")
str=Replace(str, "3","SN")
str=Replace(str, "4","SI")
str=Replace(str, "5","WU")
str=Replace(str, "6","LU")
str=Replace(str, "7","QI")
str=Replace(str, "8","BA")
str=Replace(str, "9","JU")
str=Replace(str, "0","LN")
str=Replace(str, ".","XD")
str= Replace(str, "wma", "RM")
  wmaencode = str
end if
end function

function wmanocode(str)
if not isnull(str) then
str=Replace(str, "XGEXG",serverurl3)
str=Replace(str, "XGEYG",serverurl2)
str=Replace(str, "XGEZG",serverurl1)
str=Replace(str, "XG","/")
str=Replace(str, "YI","1")
str=Replace(str, "ER","2")
str=Replace(str, "SN","3")
str=Replace(str, "SI","4")
str=Replace(str, "WU","5")
str=Replace(str, "LU","6")
str=Replace(str, "QI","7")
str=Replace(str, "BA","8")
str=Replace(str, "JU","9")
str=Replace(str, "LN","0")
str=Replace(str, "XD",".")
str= Replace(str, "RM", "wma")
  wmanocode = str
end if
end function

function chkstr(str)
str=Replace(str, "'","")
 chkstr=str
end function


Function Decrypt(theNumber)
On Error Resume Next
Dim e, n, sign, t, HiN, LoN, NewN, i
e = theNumber
If Left(e, 1) = "R" Then sign = -1 Else sign = 1
e = Mid(e, 2)
NewN = ""
For i = 1 To Len(e) step 2
t = Mid(e, i, 2)
If Asc(t) >= Asc("0") And Asc(t) <= Asc("9") Then
NewN = NewN & t
Exit For
End If
HiN = Mid(t, 1, 1)
LoN = Mid(t, 2, 1)
HiN = (Asc(HiN) - Asc("M")) * 16
LoN = Asc(LoN) - Asc("C")
t = CStr(HiN Or LoN)
If Len(t) = 1 Then t = "0" & t
NewN = NewN & t
Next
e = CDbl(NewN) * sign
Decrypt = CLng((7 + sqr(49 - 4 * (-450 - e))) / 2 - 1570)
End Function
%>






