
<?php if(isset($poll)) : ?>
<script type="text/javascript">
//<![CDATA[
    function validatePollAnswerIsSelected()
    {
        var options = $$('input.poll_vote');
        for( i in options ) {
            if( options[i].checked == true ) {
                return true;
            }
        }
        return false;
    }
//]]>
</script>
<div class="block block-poll">
    <div class="block-title">
        <?php echo $this->__('Community Poll') ?>
    </div>
    <form id="pollForm" action="<?php echo $action ?>" method="post" onsubmit="return validatePollAnswerIsSelected();">
        <div class="block-content">
            <p class="block-subtitle"><?php echo $this->htmlEscape($poll->getPollTitle()); ?></p>
            <?php if( $poll_answers ): ?>
            <ul id="poll-answers">
                <?php foreach( $poll_answers as $answer ): ?>
                <li>
                    <input type="radio" name="vote" class="radio poll_vote" id="vote_<?php echo $answer->getId() ?>" value="<?php echo $answer->getAnswerId() ?>" />
                    <span class="label"><label for="vote_<?php echo $answer->getId() ?>"><?php echo $this->htmlEscape($answer->getAnswerTitle()) ?></label></span>
                </li>
                <?php endforeach; ?>
            </ul>
            <script type="text/javascript">decorateList('poll-answers');</script>
            <?php endif; ?>
            <div class="actions">
                <button type="submit" title="<?php echo $this->__('Vote') ?>" class="button button-vote"><span><?php echo $this->__('Vote') ?></span></button>
            </div>
        </div>
    </form>
</div>
<?php endif; ?>
