Dim iFade Dim iChoose Dim iBlink Dim iMacro Dim iVMsg Dim iTransCount() Dim iChooseCount() Dim iVMsgCount() Dim iSpanRotate 'KL 5/12/03 Dim iVMsg2 dim ddc dim iSwitcher dim iVMsgs const ALL="ALL" dim iSwitcherIndex 'KL 7/29/03 - added UCase to all DDC references so that we have case insensitive comparison Function PadZero(strIn) if cint(strIn) < 10 then PadZero = "0" + cstr(strIn) else PadZero = cstr(strIn) end if End Function Function GetShortMonthName(intMonth) dim Months Months=Array("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") if intMonth >=1 and intMonth <=12 then GetShortMonthName = Months(intMonth) Else GetShortMonthName = "" End If End Function Function GetLongMonthName(intMonth) dim Months Months=Array("","January","February","March","April","May","June","July","August","September","October","November","December") if intMonth >=1 and intMonth <=12 then GetLongMonthName = Months(intMonth) Else GetLongMonthName = "" End If End Function Function GetLongDOW(intDOW) dim D,Days Days=Array("","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday") if intDOW >=1 and intDOW <=7 then GetLongDOW = Days(intDOW) Else GetLongDOW = "" End If End Function Function GetShortDOW(intDOW) dim D,Days Days=Array("","Sun","Mon","Tue","Wed","Thu","Fri","Sat") if intDOW >=1 and intDOW <=7 then GetShortDOW = Days(intDOW) Else GetShortDOW = "" End If End Function Function FormatDateTime(strDate,strFormat) dim i,j,k,strTmp1,strTmp2,strTmp,strOut,strSection,strSectionUC,strFormat2 dim blnAM, blnMinute,blnHasMeridian On Error Goto 0 strOut = "" strFormat2 = strFormat i=1 j=1 if Instr(ucase(strFormat),"AM/PM") > 0 or Instr(ucase(strFormat),"A/P") > 0 or Instr(ucase(strFormat),"AP") > 0 or Instr(ucase(strFormat),"AMPM") > 0 then blnHasMeridian=true else blnHasMeridian=false Do While strFormat2 <> "" strTmp = Mid(strFormat,j,1) Do j=j+1 strTmp2=mid(strFormat,j,1) Loop until strTmp2 <> strTmp if j >= i then strSection = mid(strFormat,i,j-i) strSectionUC = UCase(strSection) Select Case strSection Case "yyyy","yyy" strOut = strOut + CStr(DatePart("yyyy",strDate)) Case "yy" strOut = strOut + mid(DatePart("yyyy",strDate),3) Case "MMM" strOut = strOut + GetShortMonthName(DatePart("m",strDate)) Case "MMMM" strOut = strOut + GetLongMonthName(DatePart("m",strDate)) Case "MM" strOut = strOut + PadZero(DatePart("m",strDate)) Case "M" strOut = strOut + CStr(DatePart("m",strDate)) Case "mm" strOut = strOut + PadZero(DatePart("n",strDate)) Case "m" strOut = strOut + CStr(DatePart("n",strDate)) Case "dd" strOut = strOut + PadZero(DatePart("d",strDate)) Case "d" strOut = strOut + CStr(DatePart("d",strDate)) Case "dddd" strOut = strOut + GetLongDOW(DatePart("w",strDate)) Case "ddd" strOut = strOut + GetShortDOW(DatePart("w",strDate)) Case "h" strTmp = DatePart("h",strDate) mod 12 if strTmp =0 then strTmp = 12 strOut = strOut + CStr(strTmp) Case "hh" strTmp = DatePart("h",strDate) mod 12 if strTmp =0 then strTmp = 12 strOut = strOut + PadZero(strTmp) Case "H" strOut = strOut + CStr(DatePart("h",strDate)) Case "HH" strOut = strOut + PadZero(DatePart("h",strDate)) Case "ss" strOut = strOut + PadZero(DatePart("s",strDate)) Case "s" strOut = strOut + CStr(DatePart("s",strDate)) case "T" strTmp = DatePart("h",strDate) if strTmp < 12 then strOut = strOut + "A" else strOut = strOut + "P" case "tt" strTmp = DatePart("h",strDate) if strTmp < 12 then strOut = strOut + "AM" else strOut = strOut + "PM" Case Else strOut = strOut + strSection End Select end if strFormat2 = mid(strFormat,j) i=j Loop FormatDateTime = strOut End Function Function DoMacro dim oSpan, i, sMacro, sFunction, sFormat Dim iStart, iEnd Dim dNow, iHour, sAMPM Dim sTemp, Parms On Error Resume Next Set oSpan = document.all.tags("SPAN") for i = 0 to oSpan.length - 1 sMacro = "" sMacro = trim(oSpan(i).macro) iStart = instr(sMacro, "(") iEnd = instr(sMacro, ")") sFunction = "" sFunction = left(sMacro, iStart - 1) select case trim(sFunction) case "Now" sFormat = mid(sMacro, iStart + 1, iEnd - iStart - 1) sTemp = "" sTemp = FormatDateTime(Now, sFormat) if oSpan(i).innerHTML <> sTemp AND sTemp <> "" then oSpan(i).innerHTML = sTemp end if case "NowAt" sFormat = mid(sMacro, iStart + 1, iEnd - iStart - 1) Parms = split(sFormat,",") sTemp = "" sTemp = VPDNowAt(Parms(0), Parms(1)) if oSpan(i).innerHTML <> sTemp AND sTemp <> "" then oSpan(i).innerHTML = sTemp oSpan(i).Style.cssText = oSpan(i).Style.cssText + "; " + Parms(2) end if end select next End Function Function BlinkItem(blink) 'KL 5/12/03 On Error Resume Next 'KL 4/15/04 - if no width specified, use visibility if trim(blink.style.width)="" then if blink.style.visibility="" then blink.style.visibility="hidden" else blink.style.visibility="" end if else if blink.title <> "" then blink.innerHTML = blink.title blink.title = "" else blink.title = blink.innerHTML blink.innerHTML = "" end if end if End Function Function DoBlink 'KL 5/12/03 - this routine will handle items with either id="blink" or span style="blink:true" On Error Resume Next dim Blink,i,blnBlink Set blink = document.all("blink") if blink is document.all("blink",0) then BlinkItem blink else for i = 0 to blink.length - 1 BlinkItem blink(i) next end if Set blink = document.all.tags("SPAN") for i = 0 to blink.length - 1 blnBlink = "" blnBlink = lcase(blink(i).style.blink) if blnBlink="true" then BlinkItem blink(i) end if next End Function Function DoChoose dim SpanFilter, i, iSpans, SpanId dim Spans, Choices, Parms on error resume next Set Spans = document.all.tags("SPAN") for i = 0 to Spans.length - 1 SpanFilter = "" SpanFilter = Spans(i).style.Filter 'if len(SpanFilter) > 0 then SpanId = "" SpanId = Spans(i).SpanId if SpanId = "" then Choices="" Choices=Spans(i).choices if Choices <> "" then If len(SpanFilter) > 0 Then 'CMT 04-12-2004 No DHTML Option Spans(i).filters(0).apply() End If Parms = split(Choices,";") iSpans = ubound(Parms) + 1 iChooseCount(i) = iChooseCount(i) + 1 iChooseCount(i) = iChooseCount(i) mod iSpans Spans(i).innerHTML = Parms(iChooseCount(i)) END IF end If 'end if next for i = 0 to Spans.length - 1 SpanId = "" SpanId = Spans(i).SpanId if SpanId = "" then Choices="" Choices=Spans(i).choices if Choices <> "" then SpanFilter = "" SpanFilter = Spans(i).style.Filter if len(SpanFilter) > 0 then Spans(i).style.visibility = "visible" Spans(i).filters(0).play() end if end if end if next 'KL 10/3/02 - call from DoChoose to prevent loss of synch call DoFade End Function Function DoVMsg dim SpanFilter, i, iSpans, SpanId dim Spans, Choices, Parms on error resume next Set Spans = document.all.tags("SPAN") for i = 0 to Spans.length - 1 SpanId = "" SpanId = Spans(i).SpanId if SpanId = "vmsg" then SpanFilter = "" SpanFilter = Spans(i).style.Filter Choices="" Choices=Spans(i).choices if Choices <> "" then Spans(i).filters(0).apply() Parms = split(Choices,"|") iSpans = ubound(Parms) + 1 iVMsgCount(i) = iVMsgCount(i) + 1 iVMsgCount(i) = iVMsgCount(i) mod iSpans Spans(i).innerHTML = Parms(iVMsgCount(i)) END IF end if next for i = 0 to Spans.length - 1 SpanId = "" SpanId = Spans(i).SpanId if SpanId = "vmsg" then Choices="" Choices=Spans(i).choices if Choices <> "" then SpanFilter = "" SpanFilter = Spans(i).style.Filter if len(SpanFilter) > 0 then Spans(i).style.visibility = "visible" Spans(i).filters(0).play() end if end if end if next End Function function doFade Dim ImgFilter, i, iImages Dim Imgs, Choices, Parms Dim sTemp on error resume next Set Imgs = document.all.tags("IMG") for i = 0 to Imgs.length - 1 ImgFilter = "" ImgFilter = Imgs(i).style.Filter 'if len(ImgFilter) > 0 then Choices="" Choices=Imgs(i).choices if Choices <> "" then if len(ImgFilter) > 0 then Imgs(i).filters(0).apply() end if Parms = split(Choices,";") iImages = ubound(Parms) + 1 iTransCount(i) = iTransCount(i) + 1 iTransCount(i) = iTransCount(i) mod iImages sTemp = Parms(iTransCount(i)) if Imgs(i).src <> sTemp then Imgs(i).src = sTemp end if END IF 'end if next for i = 0 to Imgs.length - 1 Choices="" Choices=Imgs(i).choices if Choices <> "" then ImgFilter = "" ImgFilter = Imgs(i).style.Filter if len(ImgFilter) > 0 then Imgs(i).filters(0).play() end if end if next end function Function DoSpanRotationAll On Error Resume Next dim Groups,Group Set Groups = document.all("span-rotate") if not(Groups is nothing) then if Groups is document.all("span-rotate",0) then DoSpanRotation Groups else For each Group in Groups DoSpanRotation Group Next end if end if End Function Function DoSpanRotation(Group) On Error Resume Next dim LastIndex,Spans,Span,i,strTmp set Spans = Group.all.tags("SPAN") 'This function is pointless if we don't have at least two elements 'Since having only 1 causes reference issues, just bail out if Spans.length < 2 then exit function LastIndex = CLng(Group.LastIndex) 'strTmp = "LastIndex: " & LastIndex & " " for i = 0 to Spans.length - 1 Set Span = Spans(i) if i=LastIndex then Span.style.visibility="" 'strTmp = strTmp & i & ":visible " else Span.style.visibility="hidden" 'strTmp = strTmp & i & ":hidden " end if next LastIndex = (LastIndex + 1) mod Spans.length Group.LastIndex = LastIndex end function function StartChoose Dim Imgs, Spans 'KL 5/12/03 ddc = GetDDCName iSwitcherIndex = -1 erase iTranscount erase iChooseCount erase iVMsgCount Set Imgs = document.all.tags("IMG") ReDim iTranscount(Imgs.length - 1) Set Spans = document.all.tags("SPAN") ReDim iChooseCount(Spans.length - 1) ReDim iVMsgCount(Spans.length - 1) 'KL 10/3/02 - call from DoChoose to prevent loss of synch 'if iFade <> 0 then ClearInterval(iFade) if iChoose <> 0 then ClearInterval(iChoose) if iBlink <> 0 then ClearInterval(iBlink) if iMacro <> 0 then ClearInterval(iMacro) if iVMsg <> 0 then ClearInterval(iVMsg) if iSwitcher <> 0 then ClearInterval(iSwitcher) call DoMacro 'KL 10/3/02 - call from DoChoose to prevent loss of synch 'call DoFade call DoChoose call DoVMsg call DoSpanRotationAll call DoVMsgs Call DoVMsgsSwitcher iMacro = SetInterval("DoMacro",1000) 'KL 10/3/02 - call from DoChoose to prevent loss of synch 'iFade = SetInterval("DoFade",4000) iChoose = SetInterval("DoChoose",4000) iBlink = SetInterval("DoBlink",500) iVMsg = SetInterval("DoVMsg",15000) if iSpanRotate <> 0 then ClearInterval(iSpanRotate) iSpanRotate = SetInterval("DoSpanRotationAll",4000) iVMsgs = SetInterval("DoVMsgs",5000) iSwitcher = SetInterval("DoVMsgsSwitcher",2000) End Function Function DoVMsgs On Error Resume Next dim VMsgs,VMsg Set VMsgs = document.all("vmsgs") if not(VMsgs is nothing) then 'Have to test if the method returned a collection or a single node if VMsgs is document.all("vmsgs",0) then DoThisVMsg VMsgs else For each VMsg in VMsgs DoThisVMsg VMsg Next end if end if 'KL 5/13/03 - new addition for determining static areas to display Set VMsgs = document.all("vmsg-static") if not(VMsgs is nothing) then 'Have to test if the method returned a collection or a single node if VMsgs is document.all("vmsgs",0) then DoStaticVMsg VMsgs else For each VMsg in VMsgs DoStaticVMsg VMsg Next end if end if End Function Function DoStaticVMsg(vmsg) On Error Resume Next dim strDDC strDDC = "" strDDC=ucase(vmsg.ddc) if strDDC=ALL or strDDC = ddc then vmsg.style.display="" else vmsg.style.display="none" End Function Function DoThisVMsg(vmsg) On Error Resume Next dim Infos,Info,InfoCount,SpanCount,Spans,i,strAppend,blnConcat strAppend = vmsg.append blnConcat = CBool(vmsg.concat) 'Set Infos=vmsg.children("vmsginfo",0) Set Infos=vmsg.all("vmsginfo",0) Set Spans=vmsg.all("vmsg-placeholder") 'Set Spans=vmsg.children("vmsg-display") i=0 if not(Infos is Nothing) and not(Spans is nothing) then if Spans is vmsg.all("vmsg-placeholder",0) then SpanCount=1 else SpanCount=Spans.length end If if SpanCount>0 and Infos.Children.length>0 then if blnConcat then dim strOut For Each Info in Infos.Children 'KL 10/25/02 the frickin DHTML DOM treats as a separate child! If lcase(Info.TagName)="span" then if ucase(Info.ddc)=ddc or ucase(Info.ddc)=ALL then if i>0 then strOut = strOut & strappend & info.msg else strOut = strOut & info.msg end if i=i+1 end if end if Next vmsg.all("vmsg-placeholder",0).innerHTML = strOut else For Each Info in Infos.Children 'KL 10/25/02 the frickin DHTML DOM treats as a separate child! If lcase(Info.TagName)="span" then if ucase(Info.ddc)=ddc or ucase(Info.ddc)=ALL then if i>0 then 'Spans.children(i).innerHTML = strappend & info.msg & " " vmsg.all("vmsg-placeholder",i).innerHTML = strappend & info.msg & " " else vmsg.all("vmsg-placeholder",0).innerHTML = info.msg & " " end if i=i+1 if i >= SpanCount then exit for end if end if Next end if end if end if End Function Function DoVMsgsSwitcher On Error Resume Next dim VMsgs,VMsg Set VMsgs = document.all("vmsgs-switcher") If not(VMsgs is nothing) then 'Have to test if the method returned a collection or a single node if VMsgs is document.all("vmsgs-switcher",0) Then DoThisVMsgSwitcher VMsgs Else For each VMsg in VMsgs 'DoThisVMsg VMsg 'KL 5/13/03 - logic fix If UCase(ddc) = "DDCTEST2_1" Then End If DoThisVMsgSwitcher VMsg Next end if end if 'KL 5/13/03 - new approach to switcher Set VMsgs = document.all("vmsgs-switcher2") if not(VMsgs is nothing) Then if VMsgs.length > 1 then DoThisVMsgSwitcher2 VMsgs end if end if End Function Function DoThisVMsgSwitcher2(vmsgs) 'KL 5/13/03 On Error Resume Next dim vmsg, i, strDDC, intSwitchCount, blnFound intSwitchCount=0 for each vmsg in vmsgs strDDC = "" strDDC = ucase(vmsg.ddc) if strDDC = ddc or strDDC = ALL then intSwitchCount = intSwitchCount + 1 end if next i=0 'KL 9/25/03 If intSwitchCount > 0 Then iSwitcherIndex = (iSwitcherIndex + 1) mod intSwitchCount Else iSwitcherIndex = 0 End If for each vmsg in vmsgs strDDC = "" strDDC = ucase(vmsg.ddc) if strDDC = ddc or strDDC = ALL then if i=iSwitcherIndex then vmsg.style.display="" else vmsg.style.display="none" i=i+1 end if next End Function Function DoThisVMsgSwitcher(vmsg) On Error Resume Next dim Infos,Info,InfoCount,SpanCount,Spans,strAppend,Span,strDDC,strMsg strAppend = vmsg.append 'Set Infos=vmsg.children("vmsginfo",0) Set Infos=vmsg.all("vmsginfo",0) Set Span = vmsg.all("vmsg-placeholder",0) i=0 If not(Infos is Nothing) and not(Span is nothing) then 'SpanCount=Spans.children.length 'if SpanCount>0 and Infos.Children.length>0 then if Infos.Children.length>0 then Dim Index,Options,i,strTest i=0 strTest="" redim Options(Infos.Children.length) For Each Info in Infos.children 'KL 10/25/02 the frickin DHTML DOM treats as a separate child! If lcase(Info.TagName)="span" then 'strTest=strTest & Info.TagName strDDC="" strMsg="" strDDC=ucase(Info.ddc) strMsg=trim(Info.msg) if (strDDC=ddc or strDDC=ALL) and strMsg<>"" then Options(i)=strMsg i=i+1 end if end if Next 'KL 9/25/03 If i > 0 Then Index = (Span.LastIndex + 1) mod i Span.innerHTML = Options(Index) Else index = 0 End If Span.LastIndex=Index end if end if End Function function GetDDCName On error resume Next Dim strDDC strDDC = "" 'KL 10/25/02 - format is 'Search for first tag with id="ddc" 'GetDDCName=document.all("ddc",0).ddc 'KL 5/13/03 - now we're using the body tag again... strDDC=ucase(document.body.ddc) GetDDCName=strDDC End function Function imageLoadError(sImagebase) On Error Resume Next window.event.srcElement.src = sImageBase & "1pix.gif" End Function 'Keep this at End of File: '#EOF