Here's a couple methods, depending on what's needed:
1. To grab the 'post_name' of the direct parent to the Page:
<?php
$page = $wp_query->post;
$parent_name = $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE ID = '$page->post_parent;'");
?>
And to display the parent Page's name:
<body id="<?php echo $parent_name; ?>">
2. To collect it for the *top* parent, that is the one at the top of a Page parent<>child heirarchy, we can modify the code from jpepper's link:
<?php
$current_page = $post->ID;
$parent = 1;
while($parent) {
$page_query = $wpdb->get_row("SELECT post_name, post_parent FROM $wpdb->posts WHERE ID = '$current_page'");
$parent = $current_page = $page_query->post_parent;
if(!$parent)
$parent_name = $page_query->post_name;
}
?>
Then use the same method as above to display the name.