if (Drupal.jsEnabled) {

	function jrecent_save_profile(id) {
		if ($("#saved-profile-"+id).length > 0) { return false; }
		$.get("/jrecent/save/profile/"+id, function(data) {

			if ($('#jrecent_content > #recently_saved').length  == 0) {
				// The recently saved section doesn't exist, lets add it to the recent block.
				$('#jrecent_content').append('<div id="recently_saved"><h3>Saved Profiles</h3></div>');
			}
			
			if ($('#jrecent_content > #recently_saved > #saved_profiles_ul').length == 0) {
				// The recent
				$('#recently_saved').append('<ul style="text-align: left;" id=\"saved_profiles_ul"><lh>Profiles</lh></ul>');
			}
			$("#jrecent_content > #recently_saved > #saved_profiles_ul").append(data);
			$("#save_profile_"+id).html("Saved");
		});
		return false;
	}
	
	function jrecent_save_firm(id) {
		if ($("#saved-firm-"+id).length > 0) { return false; }
		$.get("/jrecent/save/firm/"+id, function(data) {
		
			if ($('#jrecent_content > #recently_saved').length  == 0) {
				// The recently saved section doesn't exist, lets add it to the recent block.
				$('#jrecent_content').append('<div id="recently_saved"><h3>Saved Profiles</h3></div>');
			}
			
			if ($('#jrecent_content > #recently_saved > #saved_firms_ul').length == 0) {
				// The recent
				$('#recently_saved').append('<ul style="text-align: left;" id=\"saved_firms_ul"><lh>Firms</lh></ul>');
			}
		
			$("#jrecent_content > #recently_saved > #saved_firms_ul").append(data);
			$("#save_firm_"+id).html("Saved");
		});
		return false;
	}

	function jrecent_delete_profile(id) {
		if ($("#saved-profile-"+id).length == 0) { return false; }
		$("#saved-profile-"+id).remove();
		$("#save_profile_"+id).html("Save");
		$.get("/jrecent/delete/profile/"+id, function(data) {
		});
		return false;
	}
	
	function jrecent_delete_firm(id) {
		if ($("#saved-firm-"+id).length == 0) { return false; }
		$("#saved-firm-"+id).remove();
		$("#save_firm_"+id).html("Save");
		$.get("/jrecent/delete/firm/"+id, function(data) {
		});
		return false;
	}
	
}