'************************************************************************************************************* 'FUNCIONES EN VBSCRIPT PARA OAS FRECUENCY CAPS 'AGREGAR EN OAS; AL TARGET, TEXTO COOKIE: ((variable!?)OR(variable greater-than, >= greater-than or equals, ~ contains, or !~ does not contain. 'Spaces are NOT allowed before or after operators. Expressions may use "and", "or", and parenthesis.) '************************************************************************************************************* function convGMT() Dim weekdays(6) weekdays(0)="Sun" weekdays(1)="Mon" weekdays(2)="Tue" weekdays(3)="Wed" weekdays(4)="Thu" weekdays(5)="Fri" weekdays(6)="Sat" Dim months(11) months(0)="Jan" months(1)="Feb" months(2)="Mar" months(3)="Apr" months(4)="May" months(5)="Jun" months(6)="Jul" months(7)="Aug" months(8)="Sep" months(9)="Oct" months(10)="Nov" months(11)="Dec" myWeekday=Weekday(now)-1 myDay=Day(now) if myDay<10 then myDay="0" & myDay myMonth=Month(now)-1 myYear=Year(now) convGMT=weekdays(myWeekday) & ", " & myDay & " " & months(myMonth) & " " & myYear & " 00:00:00 GMT" end function Function SetVariable(strVariableName) 'alert(strVariableName & "=" & cstr(cint(ReadVariable(strVariableName)) + 1) & "; PATH=/;DOMAIN=.lnol.com.ar; expires=" & convGMT()) 'document.cookie = strVariableName & "=" & cstr(cint(ReadVariable(strVariableName)) + 1) & "; PATH=/;DOMAIN=.lnol.com.ar; expires=" & convGMT() document.cookie = strVariableName & "=" & cstr(cint(ReadVariable(strVariableName)) + 1) & "; PATH=/;DOMAIN=.lanacion.com.ar; expires=" & convGMT() End Function Function ReadVariable(strVariableName) 'these five variables are used in the string manipulation 'code that finds the variable in the cookie. Dim intLocation Dim intNameLength Dim intValueLength Dim intNextSemicolon Dim strTemp 'calculate length and location of variable name intNameLength = Len(strVariableName) intLocation = Instr(document.cookie, strVariableName) 'check for existence of variable name If intLocation = 0 Then 'variable not found, so it can't be read ReadVariable = "0" Else 'get a smaller substring to work with strTemp = Right(document.cookie, Len(document.cookie) - intLocation + 1) 'check to make sure we found the full string, not just a substring If Mid(strTemp, intNameLength + 1, 1) <> "=" Then 'oops, only found substring, not good enough ReadVariable = "0" 'note that this will incorrectly give a not found result if and only if 'a search for a variable whose name is a substring of a preceding 'variable is undertaken. For example, this will fail: ' 'search for: MyVar 'cookie contains: MyVariable=2;MyVar=1 Else 'found full string intNextSemicolon = Instr(strTemp, ";") 'if not found, then we need the last element of the cookie If intNextSemicolon = 0 Then intNextSemicolon = Len(strTemp) + 1 'check for empty variable (Var1=;) If intNextSemicolon = (intNameLength + 2) Then 'variable is empty ReadVariable = "0" Else 'calculate value normally intValueLength = intNextSemicolon - intNameLength - 2 ReadVariable = Mid(strTemp, intNameLength + 2, intValueLength) End If End If End if End Function