[ Index ]

PHP Cross Reference of Nuke-Evolution v2.0.5

title

Body

[close]

/includes/ -> blockscript.js (source)

   1  function GetCookie(name) {
   2    var arg=name+"=";
   3    var alen = arg.length;
   4    var clen = document.cookie.length;
   5    var i  = 0;
   6    while (i < clen) {
   7      var j = i + alen;
   8      if (document.cookie.substring(i,j) == arg)
   9        return getCookieVal (j);
  10      i = document.cookie.indexOf(" ", i) + 1;
  11      if (i == 0) break;
  12    }
  13    return null;
  14  }
  15  
  16  function getCookieVal (offset) {
  17     var endstr = document.cookie.indexOf (";", offset);
  18       if (endstr == 1)
  19         endstr = document.cookie.length;
  20       return unescape(document.cookie.substring(offset, endstr));
  21  }
  22  
  23  function SetCookie (name, value, expires) {
  24    var exp = new Date();
  25    var expiro = (exp.getTime() + (24 * 60 * 60 * 1000 * expires));
  26    exp.setTime(expiro);
  27    var expstr = "; expires=" + exp.toGMTString();
  28    document.cookie = name + "=" + escape(value) + expstr;
  29  }
  30  
  31  function DeleteCookie(name){
  32    if (GetCookie(name)) {
  33      document.cookie = name + "=" + "; expires = Thu, 01-Jan-70 00:00:01 GMT";
  34    }
  35  }
  36  
  37  var imagepath = "images/";
  38  ////////////////////////////////////
  39  blockarray = new Array();
  40  var blockarrayint = -1;
  41  
  42  function doblocks(imgpath) {
  43    if (imgpath != null) imagepath = imgpath;
  44    for (var q = 0; q < blockarray.length; q++) {
  45      xyzswitch(blockarray[q]);
  46    }
  47  }
  48  
  49  function xswitch(listID) {
  50    if(listID.style.display=="none") {
  51      listID.style.display="";
  52    } else {
  53      listID.style.display="none";
  54    }
  55  }
  56  
  57  function icoswitch(bid) {
  58    icoID = document.getElementById('pic'+bid);
  59    if(icoID.src.indexOf("minus") != -1) {
  60      icoID.src = imagepath+"plus.gif";
  61      SetCookie('block'+bid,'yes',365);
  62    } else {
  63      icoID.src = imagepath+"minus.gif";
  64      DeleteCookie('block'+bid);
  65    }
  66  }
  67  
  68  function xyzswitch(bid) {
  69      xswitch(document.getElementById('ph'+bid));
  70      xswitch(document.getElementById('pe'+bid));
  71      icoswitch(bid);
  72  }
  73  
  74  function addblock(bid) {
  75      var blockopen=GetCookie('block'+bid);
  76      if (blockopen != null) {
  77          blockarrayint += 1;
  78          blockarray[blockarrayint] = bid;
  79      }
  80  }
  81  
  82  ////////////////////////////////////
  83  var hiddenblocks = new Array();
  84  var blocks = GetCookie('hiddenblocks');
  85  if (blocks != null) {
  86    var hidden = blocks.split(":");
  87    for (var loop = 0; loop < hidden.length; loop++) {
  88      var hiddenblock = hidden[loop];
  89      hiddenblocks[hiddenblock] = hiddenblock;
  90    }
  91  }
  92  
  93  function blockswitch(bid) {
  94    var bph  = document.getElementById('ph'+bid);
  95    var bpe  = document.getElementById('pe'+bid);
  96    var bico = document.getElementById('pic'+bid);
  97    if (bph.style.display=="none") {
  98      bph.style.display="";
  99      bpe.style.display="none";
 100      hiddenblocks[bid] = bid;
 101      bico.src = imagepath+"plus.gif";
 102    } else {
 103      bph.style.display="none";
 104      bpe.style.display="";
 105      hiddenblocks[bid] = null;
 106      bico.src = imagepath+"minus.gif";
 107    }
 108    var cookie = null;
 109    for (var q = 1; q < hiddenblocks.length; q++) {
 110      if (hiddenblocks[q] != null) {
 111        if (cookie != null) {
 112          cookie = (cookie+":"+hiddenblocks[q]);
 113        } else {
 114          cookie = hiddenblocks[q];
 115        }
 116      }
 117    }
 118    if (cookie != null) {
 119      SetCookie('hiddenblocks', cookie, 365);
 120    } else {
 121      DeleteCookie('hiddenblocks');
 122    }
 123  }


Generated: Wed Jun 6 11:38:01 2007 Cross-referenced by PHPXref 0.7