var kdjs = {

  createCookie:function(name,value,days) {
    if (days) {
      var date = new Date();
      date.setTime(date.getTime()+(days*24*60*60*1000));
      var expires = "; expires="+date.toGMTString();
    }
    else expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
  },

  readCookie:function(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++) {     //>
      var c = ca[i];
      while (c.charAt(0)==' ') c = c.substring(1,c.length);
      if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
    }
    return null;
  },
  
  eraseCookie:function(name) {
    anonUI.createCookie(name,"",-1);
    alert(name+' erased');
  },
  
  newin:function(mypage) {
    var winl = (screen.width - 740) / 2;
    var wint = (screen.height - 500) / 4;
    winprops = 'height=500,width=740,top='+wint+',left='+winl+',toolbar=no,scrollbars=yes,resizable';
    win = window.open(mypage, 'toolwin', winprops);
    if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
  },
  
  newinun:function(mypage,myname) {
    var winl = (screen.width - 740) / 2;
    var wint = (screen.height - 500) / 4;
    winprops = 'height=500,width=740,top='+wint+',left='+winl+',toolbar=no,scrollbars=yes,resizable';
    win = window.open(mypage, myname, winprops);
    if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
  },
  
  ss:function(which) {    
    var d = document.getElementById('main');
    d.className = which;
    kdjs.createCookie('kdtext', which, 365);
  }

}

