function getCookie(NameOfCookie){
  if (document.cookie.length > 0) {              
  begin = document.cookie.indexOf(NameOfCookie+"=");       
  if (begin != -1) {           
    begin += NameOfCookie.length+1;       
    end = document.cookie.indexOf(";", begin);
    if (end == -1) end = document.cookie.length;
      return unescape(document.cookie.substring(begin, end));
    } 
  }
  return null;
}

function setCookie(NameOfCookie, value, expiredays) {
  var ExpireDate = new Date ();
  ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
  document.cookie = NameOfCookie + "=" + escape(value) + 
  ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}

function mod_graphics() { 
  obj = document.getElementById('pict');
  var num = (Math.round(Math.random() * 6)) + 1; 
  newBg = num;    
  if (preBg == newBg) { mod_graphics(); } else { obj.style.backgroundImage = newBg; }  
  return newBg;
}

function change_graphics() {
  preBg=getCookie('preBg');
  if (preBg==null) { setCookie('preBg',num,null) }    
  newBg = mod_graphics();   
  setCookie('preBg',newBg,null);
}