functions in the tbl_relation.php added to a new file tbl_relation.lib.php