﻿function ValidatePollForm(sender, pollId) {

    var poll = jQuery('.poll');
    var valid = false;

    // check if there is a radiobutton checked
    poll.find('input[type="radio"]').each(function(item, index) {

    if (this.checked && !valid) {
        valid = true;

        // set the cookie for future reference
        Cookie.write('Vote.PoolID', pollId, { duration: 360 * 60 * 60 });
      }
    });

    if (!valid) alert('Please select an answer from the poll.');

    return valid;
    
}