function initialize_json_form(formID, target) {
  $(formID).ajaxForm({ 
    // dataType identifies the expected content type of the server response 
    dataType:  'json', 
 
    // success identifies the function to invoke when the server response 
    // has been received 
    success:   processJSON 
  });
  
  function processJSON(data) {
    if (data.error != null)
    { 
      $("#global_notice").html(
        '<div class="notice"><span class="error_notice">' + data.error + '</span></div>'
      );
      $("#global_notice").show().animate({opacity: 1.0}, 5000).fadeOut('slow');
    }
    else if (data.success) {
      $("#global_notice").html(
        '<div class="notice"><span class="success_notice">' + data.success + '</span></div>'
      );
      $("#global_notice").show().animate({opacity: 1.0}, 5000).fadeOut('slow');
    }

    if (target.length > 0) {
    	// Then change the data inside the registration box
    	$(target).html(data.html);
    	$(target).show('fast');
    }
  }
}

function initialize_json_link(url, target) {
  $.getJSON(url, function (data) {
    if (data.error != null)
    {
      $("#global_notice").html(
        '<div class="notice"><span class="error_notice">' + data.error + '</span></div>'
      );
      $("#global_notice").show().animate({opacity: 1.0}, 5000).fadeOut('slow');
    }
    else if (data.success) {
      $("#global_notice").html(
        '<div class="notice"><span class="success_notice">' + data.success + '</span></div>'
      );
      $("#global_notice").show().animate({opacity: 1.0}, 5000).fadeOut('slow');
    }

    if (target.length > 0) {
    	// Then change the data inside the registration box
    	$(target).html(data.html);
    	$(target).show('fast');
    }
  });
}