
function loadVotingDialog(votingLink, contentId) {
    new Ajax(votingLink,
      {
        method: 'get',
        update: $("votingArea_" + contentId),
        evalScripts: true
      }).request();
  }
function postVoting(contentId, slideVoting) {
    var votingForm = $("votingForm_" + contentId);
    if (!isLoggedInForVoting(contentId)) {
        if (slideVoting) slideVoting.slideIn();
        return false;
    } else {
        submitVoting(contentId);
        return false;
    }
}
function isLoggedInForVoting(contentId) {
    var votingForm = $("votingForm_" + contentId);
    return votingForm.elements["username"]
            && votingForm.elements["username"].value
            && votingForm.elements["username"].value != "";
}
function submitVoting(contentId) {
    var args = {
        method: 'post',
        update: $("votingArea_" + contentId),
        onComplete: function() {
            if (window.loadLoginForm) window.loadLoginForm();
        },
        evalScripts: true
    };
    $("votingForm_" + contentId).send(args);
    return false;
}
