// submit a vote
                submitVote($type, $vote_count, $id, $uid, $db_conn);
            } else {
                // undo a vote submission
                undoVote($type, $vote_count, $id, $uid, $db_conn);
            }
        } elseif ($type == 'F') {
            // Get the current vote count
            $vote_count = getCurrentVotes($type, $id, $db_conn);
            if ($vote == "true") {
                // submit a vote
                submitVote($type, $vote_count, $id, $uid, $db_conn);
            } else {
                // undo a vote submission
                undoVote($type, $vote_count, $id, $uid, $db_conn);
            }
        }
        mysql_close($db_conn);
    }
}
if (isset($_POST['type']) && isset($_POST['id']) && isset($_POST['uid']) && isset($_POST['vote'])) {
    $type = $_POST['type'];
    // Type of the submission ('Q' or 'F')
    $id = $_POST['id'];
    // ID of the question or feedback
    $uid = $_POST['uid'];
    // User's ID
    $vote = $_POST['vote'];
    // "true" if we want to submit a vote, "false" if we want to undo a previous submission
    processVote($type, $id, $uid, $vote);
}
        return 0;
    }
    return 100 * round($items[$idx] / $total, 2);
}
function displayBar($width, $idx, $height, $color)
{
    return "<div id='poll_bar_{$idx}' " . "style='display:none;width:{$width}px;height:{$height}px;background-color:{$color};'>" . "</div>";
}
function getCount($idx)
{
    $idx--;
    global $items;
    return sprintf("%d", $items[$idx]);
}
if (isset($_REQUEST['vote'])) {
    processVote($_REQUEST['vote']);
    die;
}
?>

var xmlhttp;

function onVote()
{
	var f = document.getElementById( "poll_form" );
	var a = f.answer;
	var sel = -2;
	for ( var i = 0; i < a.length; i++ )
	{
		if ( a[i].checked)
		{