function user_only () {
  window.alert ("You must be logged in to use this feature");
  return false;
}

function link_category () {
  sel = document.getElementById ('add_link_form').CatID;
  
  switch (sel.value) {
    // other
    case "5":
      document.getElementById ('other_cat').className = '';
      break;
      
    default:
      document.getElementById ('other_cat').className = 'invisible';
      break;
  }
}

function append_redir_hash () {
  var redir = document.getElementById ('redir');
  if (redir && redir.value != '' && !redir.value.match ('#') && window.location.hash != '') {
    redir.value += window.location.hash;
  }
}

function forum_subscription_handler () {
  this.process = function (top_node) {
    var value = top_node.getAttribute ('value');
    var result_p = document.getElementById ('forum_subscribe_result');
    if (!result_p) return;
    if (value == '1') {
      result_p.innerHTML = 'You are now subscribed to this topic';
    } else {
      result_p.innerHTML = 'You are no longer subscribed to this topic';
    }
    result_p.className = 'confirmation';
  }
}

function forum_subscribe (input) {
  var id = input.value;
  var checked = '0';
  if (input.checked) {
    checked = '1';
  }
  var post_data = 'id=' + id + '&checked=' + checked;
  queue.request ('POST', 'ajax/forum_subscribe.php', new forum_subscription_handler (), post_data);
}

