$(document).ready(function() {
        $('#quickquestion').each(function() {
                t = $(this);
                var qqInstruction = t.val();
                var qqInstColor = t.css('color');
                $(this).focus(function() {
                        t = $(this);
                        if(t.val() == qqInstruction) {
                                t.val('');
                                t.css('color', '#000');
                        }
                });
                $(this).blur(function() {
                        t = $(this);
                        if(t.val() == '') {
                                t.val(qqInstruction);
                                t.css('color', qqInstColor);
                        }
                });
        });

        do_ajax_poll();
});

function poll_submitted(data) {
    $("#submit_block").empty().html("Je stem werd verwerkt");
}

function do_ajax_poll() {
    $("#poll_form").submit(function() {
            var choice = null;
            $("//[@name=\"choice\"]").each(function() {
                if(this.checked == true)
                    choice = $(this).val();
            });
            if(choice == null)
                return false;
            $.post($(this).attr("action"), {"ajax": 1, "choice": choice}, poll_submitted);
            return false;
    });
}
