/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


var MecaJS = {
    test : function () {
        alert('test');
    },

    loadEvents : function () {
        jQuery('.button').live('mouseenter', function () {
            $(this).css("text-decoration", "underline");
        });

        jQuery('.button').live('mouseout', function () {
            $(this).css("text-decoration", "none");
        });
    },

    postform : function (event, formid) {
        var $inputs = $('#'+formid+' :input:checked');

        events = eval('{'+event+'}');
        event = events[0];

        event.answers = {};
        
        $inputs.each(function() {
            if (this.name == "") {
                if (this.id == "") {
                    alert('Submitting a input without name?');
                    return;
                }
                this.name = this.id;
            }

            event.answers[this.name] = $('#'+this.id).val();
        });

        events[0] = event;
        CrappleCommon.doEvents(events, true);
    }
}
