function Assigned(AObject) Assigned=IsValidObject(AObject) end function function BoolToStr(ABoolean) if VarType(ABoolean) = vbBoolean then if ABoolean then BoolToStr = "1" :else: BoolToStr = "0" else BoolToStr="0" end if end function function CancelRightClick if Window.Event.Button = 2 then Window.Event.CancelBubble = True Window.Event.ReturnValue=False CancelRightClick=False end if end function sub CenterHTMLObject(AObject) if IsValidObject(AObject) then AObject.Style.Left = (ClientWidth - GetControlWidth(AObject)) / 2 AObject.Style.Top=(ClientHeight - GetControlHeight(AObject)) / 2 end if end sub sub ChangeVMLFillColor(AVMLButton, AColor) AVMLButton.Style.Visibility="hidden" AVMLButton.Fillcolor=AColor AVMLButton.Style.Visibility="visible" end sub sub ChangeVMLFontColor(AVMLButton, AColor) AVMLButton.Style.Color=AColor end sub function ClientHeight Err.Clear on error resume next ClientHeight=Document.Body.ClientHeight if not IsEmptyStr(Err.Description) or (ClientHeight = 0) then ClientHeight = Screen.AvailHeight end function function ClientWidth Err.Clear on error resume next ClientWidth=Document.Body.ClientWidth if not IsEmptyStr(Err.Description) or (ClientWidth = 0) then ClientWidth = Screen.AvailWidth end function function CollectionToList(Collection) set CollectionToList=new clsList dim li for li=0 to Collection.Length-1 CollectionToList.Add(Collection.Item(li)) next end function function ControlTypeToInteger(AControlType) select case AControlType case uctNonCbt ControlTypeToInteger="0" case uctEdit ControlTypeToInteger="1" case uctButton ControlTypeToInteger="2" case uctCheck ControlTypeToInteger="3" case uctCombo ControlTypeToInteger="4" case uctHotSpot ControlTypeToInteger="5" case uctLabel ControlTypeToInteger="6" case uctMenu ControlTypeToInteger="7" case uctRadio ControlTypeToInteger="8" case uctTab ControlTypeToInteger="9" case uctPEntry ControlTypeToInteger="10" case uctPage ControlTypeToInteger="11" case uctFrame ControlTypeToInteger="12" case uctImage ControlTypeToInteger="13" case uctPanel ControlTypeToInteger="14" case uctListBox ControlTypeToInteger="15" case uctGroupBox ControlTypeToInteger="16" case uctScroll ControlTypeToInteger="17" case uctActiveX ControlTypeToInteger="18" case uctClientArea ControlTypeToInteger="19" case uctNode ControlTypeToInteger="20" case uctHyperLink ControlTypeToInteger="21" case uctSapToolBar ControlTypeToInteger="22" case uctStatusBar ControlTypeToInteger="23" case else ControlTypeToInteger=AControlType end select end function function ControlXCenter(AControl) dim a__,b__ a__=GetAbsoluteLeft(AControl) b__=GetControlWidth(AControl) ControlXCenter=a__ + Round((b__ / 2), 0) end function function ControlYCenter(AControl) dim a__,b__ a__=GetAbsoluteTop(AControl) b__=GetControlHeight(AControl) ControlYCenter=a__ + Round((b__ / 2), 0) end function function CreateDOMObject if GetBrowserVersion < 6 then set CreateDOMObject = CreateObject("MSXML2.DOMDocument.4.0") :else: set CreateDOMObject = CreateObject("MSXML2.DOMDocument") CreateDOMObject.Async=false end function sub CreateButton(AHtmlElement, ATextElement, AButtonID, AMinimumWidth, AMinimumHeight, AOnClickEvent) dim a__,b__,c__,d__,e__,f__,g__ c__=GetAbsoluteTop(AHtmlElement) d__=GetAbsoluteLeft(AHtmlElement) e__=GetControlWidth(ATextElement) + (cVMLButtonSidePadding * 2) if e__ < AMinimumWidth then e__ = AMinimumWidth f__=GetControlHeight(ATextElement) if f__ < AMinimumHeight then f__ = AMinimumHeight b__=GetArcPercentage(e__, f__, cVMLButtonCornerRadius) g__=Round((f__ - GetControlHeight(ATextElement)) / 2, 0) + 2 if IsNumeric(g__) then if g__ < 0 then g__ = cVMLButtonTopPadding else g__=cVMLButtonTopPadding end if a__=cVMLButtonTemplate a__=Replace(a__, "id='VML'", "id='btnvml_" & AButtonID & "'", 1, -1, vbTextCompare) a__=Replace(a__, "id='TEXT'", "id='btntext_" & AButtonID & "'", 1, -1, vbTextCompare) a__=Replace(a__, "arcsize=''", "arcsize='" & b__ & "%'", 1, -1, vbTextCompare) a__=Replace(a__, "onclick=''", "onclick='" & AOnClickEvent & "'", 1, -1, vbTextCompare) a__=Replace(a__, "top:;", "top:" & c__ & "px;", 1, -1, vbTextCompare) a__=Replace(a__, "left:;", "left:" & d__ & "px;", 1, -1, vbTextCompare) a__=Replace(a__, "width:;", "width:" & e__ & "px;", 1, -1, vbTextCompare) a__=Replace(a__, "height:;", "height:" & f__ & "px;", 1, -1, vbTextCompare) a__=Replace(a__, "padding-top:px;", "padding-top:" & g__ & "px;", 1, -1, vbTextCompare) a__=Replace(a__, "padding-left:px;", "padding-left:" & cVMLButtonSidePadding & "px;", 1, -1, vbTextCompare) a__=Replace(a__, "padding-right:px;", "padding-right:" & cVMLButtonSidePadding & "px;", 1, -1, vbTextCompare) a__=Replace(a__, "", ATextElement.OuterHTML & " ", 1, -1, vbTextCompare) AHtmlElement.InnerHTML=a__ end sub sub CreateImageOnlyButton(AHtmlElement, ATextElement, AButtonID) CreateButton AHtmlElement, ATextElement, AButtonID, 28, 28 end sub sub CreateStandardButton(AHtmlElement, ATextElement, AButtonID, AOnClickEvent) CreateButton AHtmlElement, ATextElement, AButtonID, cVMLButtonMinimumWidth, cVMLButtonMinimumHeight, AOnClickEvent end sub function DetermineHighestOrderNode(ANode1, ANode2) set DetermineHighestOrderNode=nothing if IsValidObject(ANode1) and IsValidObject(ANode2) then if ANode1.ParentNode is ANode2.ParentNode then dim li,a__ set a__=ANode1.ParentNode for li=0 to a__.ChildNodes.Length-1 if ANode1 is a__.ChildNodes.Item(li) then set DetermineHighestOrderNode = ANode1 exit for end if if ANode2 is a__.ChildNodes.Item(li) then set DetermineHighestOrderNode = ANode2 exit for end if next end if else if IsValidObject(ANode1) and not IsValidObject(ANode2) then set DetermineHighestOrderNode = ANode1 else if not IsValidObject(ANode1) and IsValidObject(ANode2) then set DetermineHighestOrderNode = ANode2 end if end if end function function Diff(Int1, Int2) dim a__ a__=Int1 - Int2 if a__ < 0 then a__ = a__ * -1 Diff=a__ end function function Encrypt(sPwd) dim c,i,ln,a__,b__ Randomize ln=len(sPwd) a__="" b__=65 + CInt(rnd(20)*20) for i=0 to ln-1 c=(Asc(Mid(sPwd,i+1,1)) + b__) mod 256 a__=a__ + Chr(c) next Encrypt=Chr(b__) + a__ end function function EntityTypeToControlType(AEntityType) dim a__ a__=LCase(EntityType) select case a__ case "etedit" EnitityTypeToString=uctEdit case "etbutton" EnitityTypeToString=uctButton case "etcheck" EnitityTypeToString=uctCheck case "etcombo" EnitityTypeToString=uctCombo case "ethotspot" EnitityTypeToString=uctHotSpot case "etlabel" EnitityTypeToString=uctLabel case "etmenu" EnitityTypeToString=uctMenu case "etradio" EnitityTypeToString=uctRadio case "ettab" EnitityTypeToString=uctTab case "etpentry" EnitityTypeToString=uctPEntry case "tpage" EnitityTypeToString=uctPage case "etframe" EnitityTypeToString=uctFrame case "etimage" EnitityTypeToString=uctImage case "etpanel" EnitityTypeToString=uctPanel case "etlistbox" EnitityTypeToString=uctListBox case "etgroupbox" EnitityTypeToString=uctGroupBox case "etscroll" EnitityTypeToString=uctScroll case "etactivex" EnitityTypeToString=uctActiveX case "etclientarea" EnitityTypeToString=uctClientArea case "etsaptoolbar" EnitityTypeToString=uctSapToolBar case "etstatusbar" EnitityTypeToString=uctStatusBar case "etnoncbt" EnitityTypeToString=uctNonCbt case else EnitityTypeToString="" end select end function function EntityTypeToGIFFileName(EntityType) select case LCase(EntityType) case "etbutton" EntityTypeToGIFFileName="button.gif" case "etcheck" EntityTypeToGIFFileName="check_box.gif" case "etcombo" EntityTypeToGIFFileName="combo_box.gif" case "etedit" EntityTypeToGIFFileName="edit_box.gif" case "ethotspot" EntityTypeToGIFFileName="hotspot.gif" case "etimage" EntityTypeToGIFFileName="image.gif" case "etlabel" EntityTypeToGIFFileName="label.gif" case "etradio" EntityTypeToGIFFileName="radio_button.gif" case else EntityTypeToGIFFileName="" end select end function function ExtractFileExt(AFileName) dim a__,b__ ExtractFileExt="" a__=StrReverse(AFileName) b__=InStr(1, a__, ".") if (b__ > 0) then ExtractFileExt = StrReverse(Mid(a__, 1, b__)) end function function ExtractFileName(AFileName) dim a__,b__ a__=StrReverse(AFileName) b__=InStr(1, a__, "/") if b__ = 0 then b__ = InStr(1, a__, "\") ExtractFileName=StrReverse(Mid(a__, 1, b__-1)) end function function ExtractFolderPath(APath) dim a__,b__ a__=StrReverse(APath) b__=InStr(1, a__, "/") if b__ = 0 then b__ = InStr(1, a__, "\") ExtractFolderPath=StrReverse(Mid(a__, b__)) end function function ExtractFolderName(APath) dim a__,b__ if SubStr(APath, "file") then a__ = Replace(APath, "\", "/") a__=Mid(a__, 2) else a__=APath end if b__=StrReverse(a__) b__=Mid(b__, InStr(1, b__, "/")) b__=Mid(b__, 1, InStr(2, b__, "/")) b__=Replace(b__, "/", "") b__=StrReverse(b__) ExtractFolderName=b__ end function function FindTagInString(AString, AStartPos, ATagName) dim a__,b__ if not SubStr(ATagName, "<") then b__ = "<" & ATagName :else: b__ = ATagName if SubStr(b__, ">") then b__ = Replace(b__, ">", "") b__=Trim(b__) a__=InStr(AStartPos, AString, b__, vbTextCompare) if a__ > 0 then dim c__ c__=InStr(a__, AString, ">", vbTextCompare) + 1 FindTagInString=Mid(AString, a__, c__-a__) else FindTagInString="" end if end function function GetAbsoluteLeft(AObject) if IsValidObject(AObject) then GetAbsoluteLeft = GetAbsoluteLeft(AObject.ParentElement) + GetLeft(AObject) :else: GetAbsoluteLeft = 0 end function function GetAbsoluteTop(AObject) if IsValidObject(AObject) then GetAbsoluteTop = GetAbsoluteTop(AObject.ParentElement) + GetTop(AObject) :else: GetAbsoluteTop = 0 end function function GetArcPercentage(AWidth, AHeight, AArcPixelSize) on error resume next Err.Clear dim a__ if AWidth > AHeight then a__ = AHeight :else: a__ = AWidth dim b__ b__=(AArcPixelSize * 100) / a__ if Err.Number = 0 then GetArcPercentage = Round(b__, 2) :else: GetArcPercentage = 5 end function function GetComputerName dim a__ on error resume next Err.Clear set a__=CreateObject("WScript.NetWork") if Err.Number = 0 then GetComputerName = a__.ComputerName :else: GetComputerName = "" set a__=nothing end function function GetControlHeight(AObject) on error resume next if IsValidObject(AObject) then if IsValidObject(AObject.ParentElement) then if SubStr(AObject.ParentElement.ID, "container_") then set AObject = AObject.ParentElement end if dim a__ a__=StrToInt(AObject.Style.Height) if not IsNumeric(a__) then a__ = StrToInt(AObject.OffsetHeight) else if (a__ < 0) then a__ = StrToInt(AObject.OffsetHeight) end if GetControlHeight=a__ else GetControlHeight=0 end if if (IsEmptyStr(a__) or (a__ < 0)) and Environment.RepositorySettings.DebugMode then Msgbox "GetControlWidth could not find the value for control '" & GetSafeAttribute(AObject, "id") & "', object data:" & vbCrLf & AObject.OuterHTML end function function GetControlWidth(AObject) on error resume next if IsValidObject(AObject) then if IsValidObject(AObject.ParentElement) then if SubStr(AObject.ParentElement.ID, "container_") then set AObject = AObject.ParentElement end if dim a__ a__=StrToInt(AObject.Style.Width) if not IsNumeric(a__) then a__ = StrToInt(AObject.OffsetWidth) else if (a__ < 0) then a__ = StrToInt(AObject.OffsetWidth) end if GetControlWidth=a__ else GetControlWidth=0 end if if (IsEmptyStr(a__) or (a__ < 0)) and Environment.RepositorySettings.DebugMode then Msgbox "GetControlWidth could not find the value for control '" & GetSafeAttribute(AObject, "id") & "', object data:" & vbCrLf & AObject.OuterHTML end function function GetCookieValue(Name) GetCookieValue="" if window.clientinformation.cookieEnabled then if InStr(1, Document.Cookie, Name, vbTextCompare) > 0 then lLength = len(Name) lStart=InStr(1, Document.Cookie, Name, vbTextCompare) + lLength + 1 if not SubStr(Document.Cookie, ";") then GetCookieValue = Mid(Document.Cookie, lStart) else lEnd = InStr(lStart, Document.Cookie, ";") if not (lEnd = 0) then lLength = lEnd - lStart :else: lLength = len(Document.Cookie) - lStart + 1 GetCookieValue=Mid(Document.Cookie, lStart, lLength) end if end if end if end function function GetCurrentDirectoryName dim a__,b__ if SubStr(Window.Location.Protocol, "file") then a__ = Replace(Window.Location.Pathname, "\", "/") a__=Mid(a__, 2) else a__=Window.Location.Pathname end if b__=StrReverse(a__) b__=Mid(b__, InStr(1, b__, "/")) b__=Mid(b__, 1, InStr(2, b__, "/")) b__=Replace(b__, "/", "") b__=StrReverse(b__) GetCurrentDirectoryName=b__ end function public function GetDisplayDate(DateEntryXMLNode) GetDisplayDate="" dim a__,b__,c__,d__,e__,f__,g__ if IsValidObject(DateEntryXMLNode) then a__ = GetRequiredDate(DateEntryXMLNode) b__=DatePart("d", a__) c__=DatePart("m", a__) d__=DatePart("yyyy", a__) if Environment.RepositorySettings.Dates.DayLeadingZero and (len(b__) = 1) then b__ = "0" & b__ if Environment.RepositorySettings.Dates.MonthLeadingZero and (len(c__) = 1) then c__ = "0" & c__ e__=Environment.RepositorySettings.Dates.DateSeparator f__=GetSafeAttribute(DateEntryXMLNode, "dateflags") select case Environment.RepositorySettings.Dates.DateFormat case "doDMY" if SubStr(f__, "dfShowDay") then g__ = b__ if SubStr(f__, "dfShowMonth") then if not IsEmptyStr(g__) then g__ = g__ & e__ & c__ :else: g__ = c__ end if if SubStr(f__, "dfShowYear") then if not IsEmptyStr(g__) then g__ = g__ & e__ & d__ :else: g__ = d__ end if case "doMDY" if SubStr(f__, "dfShowMonth") then g__ = c__ if SubStr(f__, "dfShowDay") then if not IsEmptyStr(g__) then g__ = g__ & e__ & b__ :else: g__ = b__ end if if SubStr(f__, "dfShowYear") then if not IsEmptyStr(g__) then g__ = g__ & e__ & d__ :else: g__ = d__ end if case "doYMD" if SubStr(f__, "dfShowYear") then g__ = d__ if SubStr(f__, "dfShowMonth") then if not IsEmptyStr(g__) then g__ = g__ & e__ & c__ :else: g__ = c__ end if if SubStr(f__, "dfShowDay") then if not IsEmptyStr(g__) then g__ = g__ & e__ & b__ :else: g__ = b__ end if end select GetDisplayDate=g__ end if end function function GetRequiredDate(XMLNode) dim a__ a__=Date if StringsEqual(XMLNode.NodeName, "lsn_dateentry") then dim b__,c__,d__,e__,f__,g__ b__=0 c__=0 d__=0 f__="0,31,28,31,30,31,30,31,31,30,31,30,31" g__=Split(f__, ",") set e__=XMLNode.SelectSingleNode("lsn_fixeddate") select case GetSafeAttribute(XMLNode, "type") case "dtCurrentDate" case "dtFixedDate" dim h__ if IsValidObject(e__) then b__ = GetSafeAttribute(e__, "day") c__=GetSafeAttribute(e__, "month") d__=GetSafeAttribute(e__, "year") if LastDayOfMonth(e__) then b__ = g__(c__) if (c__ = "2") and IsLeapYear(d__) then b__ = "29" end if c__=MonthName(c__) h__=b__ & " " & c__ & " " & d__ a__=DateValue(h__) if RequiredWeekDay(e__) then dim i__,j__ j__=CInt(GetSafeAttribute(e__, "requiredweekday")) i__=Weekday(h__) if j__ < 0 then j__ = j__ * -1 dim k__ if i__ < j__ then k__ = (i__ + (7 - j__)) * -1 a__=DateAdd("d", k__, a__) else if i__ > j__ then k__ = (i__ - j__) * -1 a__=DateAdd("d", k__, a__) else a__=DateAdd("d", -7, a__) end if end if else if i__ < j__ then k__ = j__ + i__ a__=DateAdd("d", k__, a__) else if i__ > j__ then k__ = j__ + (7 - i__) a__=DateAdd("d", k__, a__) else k__=(i__ - j__) * -1 a__=DateAdd("d", 7, a__) end if end if end if end if end if case "dtSpecialDate" set lNode=XMLNode.SelectSingleNode("lsn_relativedate") if IsValidObject(lNode) then dim l__,m__,n__,o__ l__=CInt(GetSafeAttribute(lNode, "day")) m__=CInt(GetSafeAttribute(lNode, "month")) n__=CInt(GetSafeAttribute(lNode, "year")) o__=CInt(GetSafeAttribute(lNode, "week")) if IsValidObject(e__) then b__ = GetSafeAttribute(e__, "day") c__=GetSafeAttribute(e__, "month") d__=GetSafeAttribute(e__, "year") end if a__=Date a__=DateAdd("d", l__, a__) a__=DateAdd("m", m__, a__) a__=DateAdd("yyyy", n__, a__) a__=DateAdd("d", (o__*7), a__) dim p__,q__,r__ p__=Day(a__) q__=MonthName(Month(a__)) r__=Year(a__) if b__ <> 0 then p__ = b__ if c__ <> 0 then q__ = MonthName(c__) if d__ <> 0 then r__ = d__ h__=p__ & " " & q__ & " " & r__ a__=DateValue(h__) end if end select end if GetRequiredDate=a__ end function function GetFullFolderPath dim a__,b__ b__=Window.Location.HRef b__=Replace (b__, "\", "/") b__=StrReverse(b__) a__=InStr(1, b__, "/") if a__ > 0 then b__ = mid(b__, a__) b__=StrReverse(b__) else b__="" end if GetFullFolderPath=b__ end function function GetWindowParamInfo GetWindowParamInfo="" GetWindowParamInfo=Window.Location.Search if IsEmptyStr(GetWindowParamInfo) then GetWindowParamInfo = Window.Location.Hash end function function GetOpenerParamInfo GetOpenerParamInfo="" on error resume next if IsValidObject(Window.Opener) then GetOpenerParamInfo = Window.Opener.Location.Search if IsEmptyStr(GetOpenerParamInfo) then GetOpenerParamInfo = Window.Opener.Location.Hash end if end function function GetHashParameter(ParameterName) GetHashParameter="" dim a__ a__=GetWindowParamInfo if SubStr(a__, ParameterName) then dim b__,c__,d__,e__ b__=ParameterName & "=" if SubStr(a__, b__) then c__ = InStr(1, a__, b__, vbTextCompare) e__=Mid(a__, c__) d__=InStr(1, e__, "&") if d__ > 0 then GetHashParameter = Mid(e__, len(b__)+1, (d__-(len(b__)+1))) :else: GetHashParameter = Mid(e__, len(b__)+1) end if elseif IsValidObject(Window.Opener) then on error resume next GetHashParameter=GetOpenerHashParameter(ParameterName) end if end function function GetOpenerHashParameter(ParameterName) on error resume next GetOpenerHashParameter="" dim a__ a__=GetOpenerParamInfo if SubStr(a__, ParameterName) then dim b__,c__,d__,e__ b__=ParameterName & "=" if SubStr(a__, b__) then c__ = InStr(1, a__, b__, vbTextCompare) e__=Mid(a__, c__) d__=InStr(1, e__, "&") if d__ > 0 then GetOpenerHashParameter = Mid(e__, len(b__)+1, (d__-(len(b__)+1))) :else: GetOpenerHashParameter = Mid(e__, len(b__)+1) end if end if end function function GetQueryString(Parameters) GetQueryString="" if not IsEmptyStr(Parameters) then if (GetBrowserVersion < 7) and not RunningFromWebServer then GetQueryString = "#" & Parameters :else: GetQueryString = "?" & Parameters end if end function function GetLeft(AObject) if IsValidObject(AObject) then if IsNumeric(StrToInt(AObject.Style.Left)) and (StrToInt(AObject.Style.Left) >= 0) then GetLeft = StrToInt(AObject.Style.Left) :else: GetLeft = AObject.OffSetLeft else GetLeft=0 end if end function function GetTop(AObject) if IsValidObject(AObject) then if IsNumeric(StrToInt(AObject.Style.Top)) and (StrToInt(AObject.Style.Top) >= 0) then GetTop = StrToInt(AObject.Style.Top) :else: GetTop = AObject.OffSetTop else GetTop=0 end if end function function HasHashParameter(ParameterName) dim a__ a__=GetWindowParamInfo HasHashParameter=SubStr(a__, ParameterName) on error resume next if not HasHashParameter then a__ = GetOpenerParamInfo HasHashParameter=SubStr(a__, ParameterName) end if end function function GetSafeAttribute(AObject, AttributeName) dim a__ a__="" if IsValidObject(AObject) then Err.Clear on error resume next dim b__ set b__=AObject.Attributes.GetNamedItem(AttributeName) if Err.Number <> 0 then dim li for li=0 to AObject.Attributes.Length-1 if StringsEqual(AObject.Attributes.Item(li).NodeName, AttributeName) then a__ = AObject.Attributes.Item(li).NodeValue next else if IsValidObject(b__) then a__ = b__.Value end if end if if (VarType(a__) = vbEmpty) or (VarType(a__) = vbNull) then GetSafeAttribute = "" :else: GetSafeAttribute = a__ end function function GetFrameNamed(AFrameName) dim li for li=0 to Top.Frames.Length-1 if StringsEqual(AFrameName, Top.Frames.Item(li).Name) then set GetFrameNamed = Top.Frames.Item(li) exit for end if next end function function GetWindowsLoginName dim a__ on error resume next Err.Clear set a__=CreateObject("WScript.NetWork") if Err.Number = 0 then GetWindowsLoginName = a__.UserName :else: GetWindowsLoginName = "" set a__=nothing end function function InFrameSet Err.Clear on error resume next InFrameSet=not(Top is Document) if not IsEmptyStr(Err.Description) then InFrameSet = false end function function IntegerToActionType(AInteger) select case AInteger case "1" IntegerToActionType=atLClick case "2" IntegerToActionType=atRClick case "3" IntegerToActionType=atPEClick case "4" IntegerToActionType=atDblClick case "5" IntegerToActionType=atText case "6" IntegerToActionType=atMultiText case "7" IntegerToActionType=atSelect case "8" IntegerToActionType=atDeselect case "9" IntegerToActionType=atDragDrop case "10" IntegerToActionType=atMultiSelect case "11" IntegerToActionType=atActiveControlChange case "12" IntegerToActionType=atInvalidClick case else IntegerToActionType=atNone end select end function function IntegerToControlType(AInteger) select case AInteger case "0" IntegerToControlType=uctNonCbt case "1" IntegerToControlType=uctEdit case "2" IntegerToControlType=uctButton case "3" IntegerToControlType=uctCheck case "4" IntegerToControlType=uctCombo case "5" IntegerToControlType=uctHotSpot case "6" IntegerToControlType=uctLabel case "7" IntegerToControlType=uctMenu case "8" IntegerToControlType=uctRadio case "9" IntegerToControlType=uctTab case "10" IntegerToControlType=uctPEntry case "11" IntegerToControlType=uctPage case "12" IntegerToControlType=uctFrame case "13" IntegerToControlType=uctImage case "14" IntegerToControlType=uctPanel case "15" IntegerToControlType=uctListBox case "16" IntegerToControlType=uctGroupBox case "17" IntegerToControlType=uctScroll case "18" IntegerToControlType=uctActiveX case "19" IntegerToControlType=uctClientArea case "20" IntegerToControlType=uctNode case "21" IntegerToControlType=uctHyperLink case "22" IntegerToControlType=uctSapToolBar case "23" IntegerToControlType=uctStatusBar case else IntegerToControlType=AInteger end select end function function GetBrowserVersion GetBrowserVersion=0 dim a__,b__ a__=Navigator.UserAgent if not IsEmptyStr(a__) then b__ = InStr(1, a__, "msie", vbTextCompare) + 5 err.Clear on error resume next GetBrowserVersion=cint(Mid(a__, b__, 1)) if err.number <> 0 then GetBrowserVersion = 0 end if end function function IsCorrectBrowserVersion IsCorrectBrowserVersion=false err.Clear on error resume next if not(GetBrowserVersion >= cMinimumBrowserVersion) and IsEmptyStr(Err.Description) then lResult = MsgBox ("Incorrect browser version or unable to determine version, continue anyway?", vbYesNo, "Browser Error") = vbYes :else: IsCorrectBrowserVersion = true end function function IsEmptyStr(TestString) Err.Clear on error resume next if VarType(TestString) = vbString then IsEmptyStr = (len(Trim(TestString)) = 0) else lString = cStr(TestString) IsEmptyStr=(len(Trim(lString))=0) end if if Err.Number <> 0 then IsEmptyStr = true end function function IsFrameXMLNode(XMLNode) IsFrameXMLNode=False if IsValidObject(XMLNode) then IsFrameXMLNode = StringsEqual(XMLNode.NodeName, "lsn_frame") end function function IsHexidecimal(HexNumber) if not IsEmptyStr(HexNumber) then IsHexidecimal = true dim li,a__ for li=1 to len(HexNumber) a__=Mid(HexNumber, li, 1) if not IsNumeric(a__) then select case lCase(a__) case "a", "b", "c", "d", "e", "f" case else IsHexidecimal=false exit for end select end if next else IsHexidecimal=false end if end function function IsValidObject(AObject) on error resume next err.clear if IsObject(AObject) then IsValidObject = not(AObject is nothing) :else: IsValidObject = false IsValidObject=IsValidObject and (err.number=0) end function function MergeArrays(Array1, Array2) dim a__,li,lj redim a__(0) for li=0 to UBound(Array1)-1 for lj=0 to UBound(Array2)-1 if StringsEqual(Array1(li), Array2(lj)) then redim preserve a__(UBound(a__) + 1) a__(UBound(a__))=Array1(li) end if next next MergeArrays=a__ end function function GetRootFolder(ABaseFolder) dim a__,b__ if SubStr(ABaseFolder, "://") then a__ = InStr(1, ABaseFolder, "://") + 3 b__=InStr(a__, ABaseFolder, "/") if b__ > 0 then GetRootFolder = Mid(ABaseFolder, 1, b__-1) :else: GetRootFolder = ABaseFolder else if SubStr(ABaseFolder, ":\") then a__ = InStr(1, ABaseFolder, ":\") + 2 b__=InStr(a__, ABaseFolder, "\") if b__ > 0 then GetRootFolder = Mid(ABaseFolder, 1, b__-1) :else: GetRootFolder = ABaseFolder else if SubStr(ABaseFolder, "\\") then a__ = InStr(1, ABaseFolder, "\\") + 2 b__=InStr(a__, ABaseFolder, "\") if b__ > 0 then GetRootFolder = Mid(ABaseFolder, 1, b__-1) :else: GetRootFolder = ABaseFolder else GetRootFolder=ABaseFolder end if end if end if end function function LauncherTypeFromString(ALauncherString) select case ALauncherString case "stthelp" LauncherTypeFromString=ltSTTHelp case "sttmanager" LauncherTypeFromString=ltSTTManager case "lessonmanager" LauncherTypeFromString=ltLessonManager case else LauncherTypeFromString=ltUnknown end select end function function LauncherStringFromType(ALauncherType) select case ALauncherType case ltSTTHelp LauncherStringFromType="stthelp" case ltSTTManager LauncherStringFromType="sttmanager" case ltLessonManager LauncherStringFromType="lessonmanager" case else LauncherStringFromType="" end select end function function SubStrCount(AString, ASubStr) dim a__,b__ a__=AString b__=0 while InStr(1, a__, "../")=1 b__=b__ + 1 a__=Mid(a__, 4) wend SubStrCount=b__ end function function RelativeToAbsolutePath(BasePath, RelativePath) dim a__,b__,c__ a__=Replace(BasePath, "\", "/") b__=Replace(RelativePath, "\", "/") if (InStr(1, b__, "/") = 1) then c__ = InStr(1, a__, "/") if InStr(1, a__, "/") = InStr(1, a__, "//") then a__ = Mid(a__, 1, c__+1) :else: a__ = Mid(a__, 1, c__) b__=Mid(b__, 2) elseif (InStr(1, b__, "../")>0) then a__=StrReverse(a__) do while (InStr(1, b__, "../")>0) c__=InStr(2, a__, "/") if (c__ > 0) then a__ = Mid(a__, c__) b__=Replace(b__, "../", "", 1, 1) else a__="" b__=Replace(b__, "../", "") exit do end if loop a__=StrReverse(a__) elseif (InStr(1, b__, "./")>0) then b__=Replace(b__, "./", "") end if RelativeToAbsolutePath=a__ + b__ end function function RemoveServerNameFromPath(APath) on error resume next Err.Clear RemoveServerNameFromPath=Replace(APath, Location.Protocol & "//" & Location.Host, "") if Err.Number <> 0 then RemoveServerNameFromPath = APath end function function RemoveSubDirsFromPath(APath, ARemoveCount) dim li,a__,b__,c__ c__="\" a__=StrReverse(APath) if InStr(1, a__, "\") = 1 then a__ = Mid(a__, 2) else if InStr(1, a__, "/") = 1 then a__ = Mid(a__, 2) c__="/" end if end if for li=1 to ARemoveCount b__=InStr(1, a__, "\") if b__ = 0 then b__ = InStr(1, a__, "/") if b__ > 0 then a__ = Mid(a__, b__+1) next RemoveSubDirsFromPath=StrReverse(a__) + c__ end function sub MaximizeWindowSize Window.ResizeTo Screen.AvailWidth, Screen.AvailHeight end sub function MaxButtonSize(FormPixelWidth, NoOfButtons, ButtonPixelSpacing) dim a__,b__,c__ a__=StrToInt(FormPixelWidth) b__=StrToInt(NoOfButtons) c__=StrToInt(ButtonPixelSpacing) on error resume next Err.Clear MaxButtonSize=((a__ - (c__ * (b__ + 1))) / b__) if Err.Number <> 0 then MaxButtonSize = 75 end function function MergePaths(ABaseFolder, ARelativePath) if SubStr(ARelativePath, "../") or SubStr(ARelativePath, "..\") then dim a__,b__,c__ a__=SubStrCount(ARelativePath, "../") if a__ = 0 then a__ = SubStrCount(ARelativePath, "..\") b__=RemoveSubDirsFromPath(ABaseFolder, a__) c__=Replace(ARelativePath, "../", "") c__=Replace(c__, "..\", "") MergePaths=b__ & c__ else if (InStr(1, ARelativePath, "/") = 1) or (InStr(1, ARelativePath, "\") = 1) then MergePaths = GetRootFolder & ARelativePath else if InStr(1, ARelativePath, ".") <> 1 then dim d__ d__=Mid(ABaseFolder, len(ABaseFolder), 1) if (d__ <> "/") and (d__ <> "\") then ABaseFolder = ABaseFolder & "/" MergePaths=ABaseFolder & ARelativePath end if end if end if end function sub OnVMLButtonMouseDown(AVMLElement) ChangeVMLFillColor AVMLElement, "#202020" end sub sub OnVMLButtonMouseOver(AVMLElement) ChangeVMLFillColor AVMLElement, Environment.RepositorySettings.UserInterface.Color ChangeVMLFontColor AVMLElement, Environment.RepositorySettings.UserInterface.FontColor end sub sub OnVMLButtonMouseOut(AVMLElement) ChangeVMLFillColor AVMLElement, "#808080" ChangeVMLFontColor AVMLElement, "#000000" end sub sub OnVMLButtonMouseUp(AVMLElement) ChangeVMLFillColor AVMLElement, "#808080" end sub function RunningFromWebServer RunningFromWebServer=SubStr(Window.Location.Protocol, "http:") or SubStr(Window.Location.Protocol, "https:") end function function IsRelativePath(APath) if not SubStr(APath, "http:") then dim a__ a__=Replace(APath, "/", "\") a__=Replace(a__, "file:\\\", "") IsRelativePath=not SubStr(a__, ":\\") and not SubStr(a__, ":\") and not SubStr(a__, "\\") else IsRelativePath=false end if end function sub BatchSetAttributeValue(XML, XPathQuery, AttributeName, AttributeValue) dim li,a__ set a__=XML.SelectNodes(XPathQuery) for li=0 to a__.Length-1 SetSafeAttribute a__.Item(li), AttributeName, AttributeValue next set a__=nothing end sub sub SetCookieValue(AName, AValue) if window.clientinformation.cookieEnabled then if not IsEmptyStr(AName) and not IsEmptyStr(AValue) then dim a__ a__="Saturday, 31-Dec-2050 23:59:59 GMT" dim b__ if RunningFromWebServer then b__ = RemoveServerNameFromPath(RelativeToAbsolutePath(GetFullFolderPath, csRepositoryFolder)) :else: b__ = ExtractFolderName(RelativeToAbsolutePath(GetFullFolderPath, csRepositoryFolder)) dim c__ c__=AName & "=" & AValue & ";expires=" & a__ & ";path=" & b__ Document.Cookie=c__ end if end if end sub sub SetSafeAttribute(AObject, AttributeName, NewAttributeValue) if IsValidObject(AObject) and not IsEmptyStr(AttributeName) then AObject.SetAttribute AttributeName, NewAttributeValue end sub function SetXSLVariable(AXSLDocument, AVariableName, AVariableValue) on error resume next Err.Clear dim a__ set a__=AXSLDocument.SelectSingleNode("//xsl:variable[@name='" & AVariableName & "']") if IsValidObject(a__) then a__.Text = AVariableValue set a__=nothing SetXSLVariable=(Err.Number=0) end function function StringsEqual(String1, String2) StringsEqual=(StrComp(String1, String2, vbTextCompare)=0) end function function STTStrToDbl(AString) Err.Clear on error resume next if VarType(AString) = vbString then if SubStr(AString, ".") then dim a__,b__,c__,d__ d__=Split(AString, ".") if IsEmptyStr(d__(lBound(d__))) then a__ = 0 :else: a__ = CDbl(d__(lBound(d__))) b__=CDbl(d__(uBound(d__))) c__=d__(uBound(d__)) b__=b__ * (10^-(len(c__))) STTStrToDbl=a__ + b__ else dim e__ e__=Replace(AString, "px", "", 1, -1, vbTextCompare) e__=Replace(e__, "pt", "", 1, -1, vbTextCompare) e__=Replace(e__, "%", "", 1, -1, vbTextCompare) STTStrToDbl=CDbl(e__) end if else STTStrToDbl=CDbl(AString) end if if not IsEmptyStr(Err.Description) then STTStrToDbl = 0 end function function STTStrToInt(AString) STTStrToInt=Round(STTStrToDbl(AString)) end function function StrToArray(AString) dim a__() redim a__(0) if not IsEmptyStr(AString) then dim li redim a__(len(AString)-1) for li=1 to len(AString) a__(li-1)=Mid(AString, li, 1) next end if StrToArray=a__ end function function StrToInt(AString) dim a__ a__=Replace(AString, "px", "") a__=Replace(a__, "pt", "") a__=Replace(a__, " ", "") Err.Clear on error resume next StrToInt=CInt(a__) if not IsEmptyStr(Err.Description) then StrToInt = -1 end function function SubStr(String1, String2) SubStr=InStr(1, String1, String2, vbTextCompare)>0 end function function StartsWith(String1, String2) StartsWith=InStr(1, String1, String2, vbTextCompare)=1 end function function EndsWith(String1, String2) dim a__ a__=InStr(1, String1, String2, vbTextCompare) if a__ > 0 then EndsWith = ((len(String1) - len(String2)) = (a__ - 1)) :else: EndsWith = false end function function STTEscape(AString) dim a__,b__,c__,d__ c__=Escape(AString) c__=Replace(c__, "%20", " ") c__=Replace(c__, "%21", "!") c__=Replace(c__, "%23", "#") c__=Replace(c__, "%24", "$") c__=Replace(c__, "%25", "%") c__=Replace(c__, "%26", "&") c__=Replace(c__, "%27", "'") c__=Replace(c__, "%28", "(") c__=Replace(c__, "%29", ")") c__=Replace(c__, "%5E", "^") c__=Replace(c__, "%60", "`") b__=InStr(1, c__, "%") while b__>0 d__=Mid(c__, b__+1, 2) if IsHexidecimal(d__) then a__ = "&#" & d__ & ";" d__="%" & d__ c__=Replace(c__, d__, a__, 1, len(c__), vbTextCompare) b__=InStr(1, c__, "%") else b__=InStr(b__+1, c__, "%") end if wend STTEscape=c__ end function function URLEncode(ARawURL) URLEncode="" on error resume next dim a__,b__,c__ b__="" const sValidChars="1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz:/.?=_-$(){}~&" if not IsEmptyStr(ARawURL) then for a__ = 1 to len(ARawURL) c__=Mid(ARawURL, a__, 1) if InStr(1, sValidChars, c__, vbBinaryCompare) = 0 then c__ = Hex(Asc(c__)) if c__ = "20" then c__ = "+" else if len(c__) = 1 then c__ = "%0" & c__ :else: c__ = "%" & c__ end if b__=b__ & c__ else b__=b__ & c__ end if next URLEncode=b__ end if end function function WindowOnPrimaryDisplay on error resume next Err.Clear dim a__,b__ a__=(Window.screenLeft >=0) and (Window.screenLeft=0) and (Window.screenTop "0" end function function IsLeapYear(AYear) IsLeapYear=(AYear mod 4=0) and ((AYear mod 100 <> 0) or (AYear mod 400=0)) end function