$(document).ready(function(){
    $.fn.tagName = function() {
        return this.get(0).tagName.toLowerCase();
    }
    
    $.fn.getForm = function() {
        object = this.parent();
        while (object.tagName() != "form") {
            object = object.parent();
        }
        return object;
    }

    $.fn.setForm = function() {
        form = this.getForm();
        this.attr("form", form.attr("name"));
    }

    function in_array(what, where) {
        for (var i = 0; i < where.length; i++) {
            if (what == where[i]) {
                return true;
            }
        }
        return false;
    }
});
