function ismaxlength(obj){
	var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
	if (obj.getAttribute && obj.value.length>mlength)
	obj.value=obj.value.substring(0,mlength)
	$('.charsRemaining').html('You have ' + (mlength - obj.value.length) + ' characters remaining');
}

function connection(cmd, user_id) {
	jQuery("#connection-" + user_id).fadeTo("slow", 0.20, function() {
		jQuery("#connection-" + user_id).load(root_url + "/controllers/connections.php?user_id=" + user_id + "&cmd=" + cmd, function() {
			jQuery("#connection-" + user_id).fadeTo("slow", 1)
		})
	});
}

function updateStatus(user_id) {
	var statusText = document.getElementById("status_message").value;
	if (statusText.length > 0) {
		document.getElementById("submit_status").value = "Updating status...";
		document.getElementById("submit_status").disabled = true;
		jQuery("#account_status_update").load(root_url + "/controllers/scrappy.php?set=status&cmd=update&content=" + escape(statusText));
	} else {
		alert("To post a status update, you need to enter text in the status update text box.");
	}
}
