﻿var Widgets = {
    // Vyvolání hlasování u ankety
    surveyVote: function(_blockId, _surveyId, _voteId, _ctrlHash) {
        var _langId = __langId;
        $.ajax({
            type: "POST",
            url: "/Services/Widgets.asmx/SurveyVote",
            data: "{langId: '" + _langId + "', surveyId: '" + _surveyId + "', voteId: '" + _voteId + "', ctrlHash: '" + _ctrlHash + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(msg) {
                $("#survey_" + _blockId).html(msg.d);
            }
        });
    },

    // Vyvolání události kliknutí na libovolný element
    clickElement: function(e) {
        if (typeof e == 'object') {
            if (document.createEvent) {
                var evObj = document.createEvent('MouseEvents');
                evObj.initEvent('click', true, true);
                e.dispatchEvent(evObj);
                return false;
            }
            else if (document.createEventObject) {
                e.fireEvent('onclick');
                return false;
            }
            else {
                e.click();
                return false;
            }
        }
    }
}
