home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Internet 2000 May / MICD_2000_05.iso / Www / Czas / NEWS / BANNER.JS < prev    next >
Text File  |  2000-02-29  |  3KB  |  90 lines

  1. function getCookieVal (offset)
  2. {
  3.     {
  4.     var endstr = document.cookie.indexOf (";", offset);
  5.     if (endstr == -1)
  6.         endstr = document.cookie.length;
  7.     return unescape(document.cookie.substring(offset, endstr));
  8.     }
  9. }
  10. function GetCookie (name)
  11. {
  12.     {
  13.     var arg = name + "=";
  14.     var alen = arg.length;
  15.     var clen = document.cookie.length;
  16.     var i = 0;
  17.     while (i < clen)
  18.     {
  19.         var j = i + alen;
  20.         if (document.cookie.substring(i, j) == arg)
  21.             return getCookieVal (j);
  22.         i = document.cookie.indexOf(" ", i) + 1;
  23.         if (i == 0)
  24.             break;
  25.     }
  26.     return null;
  27.     }  
  28. }
  29. function SetCookie (name, value)
  30. {
  31.  
  32.     {
  33.     var argv = SetCookie.arguments;
  34.     var argc = SetCookie.arguments.length;
  35.     var expires = (argc > 2) ? argv[2] : null;
  36.     var path = (argc > 3) ? argv[3] : null;
  37.     var domain = (argc > 4) ? argv[4] : null;
  38.     var secure = (argc > 5) ? argv[5] : false;
  39.     document.cookie = name + "=" + escape (value) +
  40.         ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
  41.         ((path == null) ? "" : ("; path=" + path)) +
  42.         ((domain == null) ? "" : ("; domain=" + domain)) +
  43.         ((secure == true) ? "; secure" : "");
  44. }
  45. }
  46.  
  47.  
  48. document.write("<font size=+1>")
  49. var ilejest=6;
  50. day = new Date();
  51. hr1 = day.getSeconds();
  52. hr2 = (hr1 % ilejest) + 1;
  53.  
  54.  
  55. var expdate1 = new Date();
  56. expdate1.setTime(expdate1.getTime() +  (365 * 24 * 60 * 60 * 1000));
  57. var num1;
  58. if(!(num1 = GetCookie("cnl_banner"))) 
  59.  {
  60.  
  61. num1 = hr2 
  62. }
  63.  else
  64. {
  65.  
  66. num1++;
  67. if (num1 == (ilejest+1)) num1=0;
  68. }
  69.      
  70.     SetCookie ("cnl_banner", num1, expdate1);
  71. hr=num1;
  72. document.write('<p align=center>');
  73. if (hr==0) {
  74. document.write('<B>To miejsce na Tw≤j banner.</B><BR>A je┐eli nie przepadasz za bannerami, polecamy Ci program: ');
  75. document.write('<A HREF="http://www.webwasher.com/">WebWasher</A>');
  76. }
  77. if (hr==1) 
  78. document.write('<a href="http://priv6.onet.pl/wro/grafland/"><img src="../pic/grafban.gif" alt="Netmagia" border=0 width=400 height=50 ></a>');
  79. if (hr==2) 
  80. document.write('<a href="http://www.wolf-5.kimip.pl/"><img src="../pic/suwalki.gif" alt="Suwalszczyzna" border=0 width=400 height=50 ></a>');
  81. if (hr==3) 
  82. document.write('<a href="http://www.link.pl/news-pl/"><img src="../pic/news-pl.gif" alt="Za┐ywasz-Przegrywasz" border=0 width=400 height=50></a>');
  83. if (hr==4) 
  84. document.write('<a href="http://www.amnesty.org.pl/"><img src="../pic/amnesty.gif" alt="Amnesty" border=0 width=450 height=50></a>');
  85. if (hr==5) 
  86. document.write('<a href="http://www.creamsoft.com.pl/pajaczek/"><img src="../pic/creamsof.gif" alt="Paj▒czek" border=0 width=400 height=50 ></a>');
  87. if (hr==6) 
  88. document.write('<a href="http://www.reporter.pl/"><img src="../pic/reporter.gif" alt="Reporter" border=0 width=400 height=50></a>');
  89. document.writeln('</p>');
  90.