
  /* Modified by Alex Spooner, 2009-03-16 08:04:27 EST */
  
  $(document).ready(function(){
  
    $("form[name='SubscribeForm'] input").focus(function(){
      $(this).select();
    });

    $("select[name='category']").change(function(){
      var obj = document.SubscribeForm.classification;
      obj.options.length = 2;
      obj.options[0].text = "Loading...";
      obj.options[0].value = "";
      $.getJSON("/ajax/classifications_json.php?category="+document.SubscribeForm.category.value,function(data){
        if (data.size) l = data.size + 1;
        else l = 1
        obj.options.length = l;
        obj.options[0].text = "All";
        obj.options[0].value = "";
        var i = 1;
        $.each(data.opts,function(l,n) {
          obj.options[i].text = n;
          obj.options[i].value = l;
          i = i + 1;
        });
      });
    });
  
    $("form[name='SubscribeForm']").submit(function(){
      var loc = '/subscribe/';
      if (document.SubscribeForm.category.value>"") loc = loc + document.SubscribeForm.category.value + "/"; 
      if (document.SubscribeForm.classification.value>"") loc = loc + document.SubscribeForm.classification.value + "/"; 
      if (document.SubscribeForm.assignment.value>"") loc = loc + document.SubscribeForm.assignment.value + "/"; 
      if (document.SubscribeForm.state.value>"") loc = loc + document.SubscribeForm.state.value + "/"; 
      document.SubscribeForm.action = loc;
      return true;
    });
 
  });
  
