Public Function EncodeHTML(s)
	dim i
	dim sOut
	dim tmp
	
	If IsNull(s) Then EncodeHTML = "":	exit function
	if len(s) = 0 then EncodeHTML = "": exit function
	
	
	for i = 1 to len(s)
		tmp = cstr(hex(asc(mid(s,i,1))))
		if len(tmp) = 1 then tmp = "0" & tmp
		
		sOut = sOut & tmp
	next
	
	EncodeHTML = sOut
End Function


Public Function UnencodeHTML(s)
	dim i
	dim sOut
	
	s = trim(s)
	
	if len(s) < 2 then UnencodeHTML = "": exit function
	
	for i = 1 to len(s) step 2
		sOut = sOut & chr(cint("&h" & mid(s,i,2)))
	next
	
	UnencodeHTML = sOut
End Function


Public Function vbFormatCurrencyWrapper(sNumber, DigitsAfterDecimal, IncludeLeadingDigit, UseParensForNegativeNumbers, GroupDigits)
	if IsNumeric(sNumber) then
		vbFormatCurrencyWrapper = FormatCurrency(sNumber, DigitsAfterDecimal, IncludeLeadingDigit, UseParensForNegativeNumbers, GroupDigits)
	else
		vbFormatCurrencyWrapper = "NaN"
	end if
	
End Function

Public Function vbFormatNumberWrapper(sNumber, DigitsAfterDecimal, IncludeLeadingDigit, UseParensForNegativeNumbers, GroupDigits)
    if IsNumeric(sNumber) then
	    vbFormatNumberWrapper = FormatNumber(sNumber,DigitsAfterDecimal,IncludeLeadingDigit,UseParensForNegativeNumbers,GroupDigits)
	else
	    vbFormatNumberWrapper = "NaN"
	End IF
End Function


Public Function vbMsgboxWrapper(sPrompt, iButtons, sTitle)
	vbMsgboxWrapper  = msgbox(sPrompt, iButtons, sTitle)
End Function

Public Function vbToCurrencyWrapper(val, NumDigitsAfterDecimal, IncludeLeadingDigit, UseParensForNegatives, GroupDigits)
	if not isnumeric(val) then val = 0	
	vbToCurrencyWrapper = FormatCurrency(val, NumDigitsAfterDecimal, IncludeLeadingDigit, UseParensForNegatives, GroupDigits)
End Function