stacked conditions for featured item on home page

I'm trying to display a random featured item with:
(1) an embedded object if the current item has that field and isn't empty OR (2) the default display_random_featured_item if the embedded field is empty or if that field doesn't exist. Am I close with the following? Thanks.


<?php
$featured = random_featured_item();
set_current_item($featured);
if(item_has_type('Music-Related Instructional Video'))
{
$hasEmbeddedField = item('Item Type Metadata', 'Embedded Object');
if($hasEmbeddedField == '')
{
echo display_random_featured_item();
}
else
{
echo $hasEmbeddedField;
}
endif;
}
else
{
echo display_random_featured_item();
}
endif;
?>

I realize now that those endif; statements don't belong there. It still doesn't work right, though, because when I echo display_random_featured_item() within those ifs, I'm pretty sure it must reset the current item to a new random item. What I actually want to do is echo the same elements of that function, but for the item that's already set before the conditions.

Never mind (!): I got it with:

echo '<h3>' . link_to_item(item('Dublin Core', 'Title')) . '</h3>';