'==================================================================
'Function name: FormatRemoteUrl
'Function: Format the full URL of the current website - convert the relative address to absolute address
'Arguments: url----Url string
'Parameters: CurrentUrl---Of course the website URL
'Return value: Formatted Url
'==================================================================
PublicFunctionFormatRemoteUrl(ByValURL,ByValCurrentUrl)
DimstrUrl
IfLen(URL)<2OrLen(URL)>255OrLen(CurrentUrl)<2Then
FormatRemoteUrl=vbNullString
ExitFunction
EndIf
CurrentUrl=Trim(Replace(Replace(Replace(Replace(Replace(Replace(CurrentUrl,"'",vbNullString),"""",vbNullString),vbNewLine,vbNullString),"/","/","|",vbNullString))
URL=Trim(Replace(Replace(Replace(Replace(Replace(Replace(URL,"'",vbNullString),"""",vbNullString),vbNewLine,vbNullString),"/","/","|",vbNullString))
IfInStr(9,CurrentUrl,"/")=0Then
strUrl=CurrentUrl
Else
strUrl=Left(CurrentUrl,InStr(9,CurrentUrl,"/")-1)
EndIf
IfstrUrl=vbNullStringThinstrUrl=CurrentUrl
SelectCaseLeft(LCase(URL),6)
Case"http:/","https:","ftp://","rtsp:/","mms://"
FormatRemoteUrl=URL
ExitFunction
EndSelect
IfLeft(URL,1)="/"Then
FormatRemoteUrl=strUrl&URL
ExitFunction