$(document).ready(function() {
	$('a.deletePage').click(function () { confirmDelete( 'page', $(this).attr("href")); return false;	});
	$('a.deleteGroup').click(function () { confirmDelete( 'group', $(this).attr("href")); return false;	});
	$('a.deleteUser').click(function () { confirmDelete( 'user', $(this).attr("href")); return false;	});
	$('a.delete').click(function () { confirmDelete( '', $(this).attr("href")); return false;	});
	
	/* Delete link confirmation */
	function confirmDelete( type, delUrl )
	{	/* Set up the confirmation text based on the type provided, if none was provided then use some generic text as default. */
		if ( type == 'page' )
		{	var confirmText = "Are you sure you want to delete this page and all of its children?"	}
		else if ( type == 'group' )
		{	var confirmText = "Are you sure you want to delete this group?"	}
		else if ( type == 'user' )
		{	var confirmText = "Are you sure you want to delete this user?"	}
		else
		{	var confirmText = "Are you sure you want to delete?";	}
		
		if ( confirm(confirmText) ) {	document.location = delUrl;	}
		return false;
	}
	
}); 