
/// <reference path="jquery-1.2.6.min.js">
var Poll = { }

Poll.Submit = function(pollId) {
    var selectedChoice = $(".pollChoice:checked").val();
    if (Poll.Validate(selectedChoice))
    {
        var container = $("div.poll");
        container.load("/templates/units/opinionPoll.aspx?evt=submit", { Choice: selectedChoice, PollID: pollId });
    }
}

Poll.Validate = function(arg) {
    if (arg == undefined || arg == null) {
        alert('Please choose an option before voting')
        return false;
    }
    return true;
}

Poll.Load = function(pollId) {
    $("#uxPoll").load("/templates/units/opinionPoll.aspx", { PollID: pollId });
}

Poll.GetResults = function(pollId) {
    var container = $("div.poll");
    container.load("/templates/units/opinionPoll.aspx?evt=results", { PollID: pollId });
}