jQuery.fn.skilllearn = function(logged_in_user_id) {
	
	// If the user is not logged in, we can't really do anything, so return.
	if(logged_in_user_id == 0){
		return this;
	}
	
	// Replace the learn/forget links with checkboxes
	this.each(function() {
		
		var $link = $(this);
		var skill_id = $link.get(0).id.substring(9);
		var learned = $link.hasClass('forget-link'); // if the user has learned it, a forget link will be showing
		var checkbox_html = '<input type="checkbox" class="actioncheckbox" title="Uncheck to forget; check to learn" value="'+skill_id+'"';
		if (learned) {
			checkbox_html += ' checked="checked" ';
		}
		checkbox_html += ' />';
		
		var $parent = $(this).parents(':first');
		$parent.html(checkbox_html);
	});
	
	// attach an ajax call to the change event of the checkboxes
	$('input.actioncheckbox').change(function(){
		
		var $box = $(this);
		$box.hide();
		
		var $box_parent = $box.parents(':first');
		
		var indicator_image = new Image();
		$(indicator_image).attr({
			src: webroot+'img/ajax-loader-gray-16.gif',
			height: '16',
			width: '16',
			alt: 'loading'
		}).addClass('indicator-image');
		$box_parent.append(indicator_image);
		
		var checked = $box.attr('checked'); // this will be "false" if we want to forget the skill
		
		var request_url = webroot
		if(checked){
			request_url += 'skills/learn.json';
		}else{
			request_url += 'skills/forget.json';
		}
		
		var get_data = {
			format: 'json',
			user: logged_in_user_id,
			skill: $box.attr('value')
		};
		
		$.getJSON(request_url, get_data, function(data){
			
			$(indicator_image).remove();
			$box.show();
			
			if(data){
				// TODO: display learned/forgotten placards
			}else{
				$box.attr('checked', !checked);
			}
			
		});
	});
	
	return this;
};