Adding Body Classes by Node Type in Drupal

<?php 
	if($node->type == 'story') {
		$nodetype_class = 'story';
	}
	elseif($node->type == 'blog') {
		$nodetype_class = 'blog';
	}
	elseif($node->type == 'page') {
		$nodetype_class = 'page';
	}
?>
  <body class="<?php print $nodetype_class; ?>">

This looks at the nodetype of the page and if it's a story node adding the class "story" or else if it's the node type blog it will print out the class "blog", etc.

I've used this on the top of page.tpl.php to create a class depending on the nodetype of the page. Helpful to create css changes to the layout.