Sub askForLicence(path,vidId,contId,eventId,partnerId,userId,rightsId) dim qString if len(userId) > 0 then qString = "&userId=" & userId end if if len(rightsId) > 0 then qString = qString & "&rightsId=" & rightsId end if if len(partnerId) > 0 then qString = qString & "&partnerId=" & partnerId end if if len(vidId) > 0 then qString = qString & "&vidId=" & vidId end if if len(contId) > 0 then qString = qString & "&contId=" & contId end if if len(eventId) > 0 then qString = qString & "&eventId=" & eventId end if On Error Resume Next GetLicenseObj.GetLicenseFromURL "", document.Location.Protocol & "//" & document.Location.HostName & path & "?predeliver=1" & qString End sub Sub checkCookiesAndGetLicenceIfCookiesOk (useCookie,numDays,path,vidId,contId,eventId,partnerId,userId,rightsId) Dim gotLicence, x, cookieName if useCookie then cookieName = generatePredeliveryLicenseCookieName(vidId, contId) gotLicence = GetCookie(cookieName) If gotLicence = "" Then call askForLicence(path,vidId,contId,eventId,partnerId,userId,rightsId) If 0 = Err.Number Then x = SetCookie(cookieName, 1, Date()+numDays, Time()) End If else end if else call askForLicence(path,vidId,contId,eventId,partnerId,userId,rightsId) end if end sub Function generatePredeliveryLicenseCookieName(vidId, contId) generatePredeliveryLicenseCookieName = "DRMLicence_" & contId & "_" & vidId End Function Sub deleteLicenceCookie (vidId, contId) Dim x x = DelCookie(generateLicensePredliveryCookieName(vidId, contId)) End Sub Function FormatDate(ByVal DateIn) Dim Days Dim Months Dim TempDate Days = "SunMonTueWedThuFriSat" Months = "JanFebMarAprMayJunJulAugSepOctNovDec" TempDate = CDate(DateIn) FormatDate = Mid(Days, Weekday(TempDate) * 3 - 2, 3) & ", " & Right("00" & Day(TempDate), 2) & "-" & Mid(Months, Month(TempDate) * 3 - 2, 3) & "-" & Right(Year(TempDate),2) End Function Function FormatTime(ByVal TimeIn) Dim TempTime TempTime = CDate(TimeIn) FormatTime = Right("00" & Hour(TempTime), 2) & ":" & Right("00" & Minute(TempTime), 2) & ":" & Right("00" & Second(TempTime), 2) End Function Function GetCookie(Name) Dim CookieVal,SrchArg,Pos1,Pos2 CookieVal = Document.Cookie SrchArg = Name & "=" Pos1 = Instr(CookieVal, SrchArg) If Pos1 <= 0 Then GetCookie = "" Else Pos1 = Pos1 + Len(SrchArg) Pos2 = Instr(Pos1, CookieVal, ";") If Pos2 <= 0 Then Pos2 = Len(CookieVal) + 1 End If GetCookie = Mid(CookieVal, Pos1, Pos2 - Pos1) End If End Function Function SetCookie(name, value, expiresDate, expiresTime) Document.Cookie = name & "=" & value & "; expires=" & FormatDate(expiresDate) & " " & FormatTime(expiresTime) & " GMT; path=/" End Function Function DelCookie(Name) Document.Cookie = Name & "=; expires=Thu, 01-Jan-70 00:00:01 GMT; path=/" End Function