/* A function to add focus to a field in a form
 * param: field - the name of the field
 */
function focusField(field) {
	//get the object
	obj=eval("document."+field);
	//set focus.
	obj.focus();
}

function focusByID(id) {
	obj=document.getElementById(id);
	obj.focus();
}


/* A function to check that we really want to delete a resource */
function chkResDelete(dest) {
	return chkDelete(dest, "Are you sure you want to delete this resource?");
}

/* A function to check that we really want to delete a user. I know same as above apart from message. Should sort this really */
function chkUserDelete(dest) {
	return chkDelete(dest, "Are you sure you want to delete this user?");
}

function chkResFileDelete(dest) {
	return chkDelete("Are you sure you want to delete this file?");
}

function chkDelete(dest, msg) {
	a=confirm(msg);
	if (a) {
		//redirect
		window.location=dest;
		return true;
	}

	return false;
}