$.widget("ui.form",{
    _init:function(){
        var self = this;
        var form = this.element;
        var inputs = form.find("input, select, textarea");
			 
        form.addClass("ui-widget");
			
        $.each(inputs, function() {
            if( $(this).is(":reset ,:submit") ) {
                $(this).button();
            }
            else if( $(this).is(":checkbox") || $(this).is(":radio") ) {
                $(this).checkbox();
            }
            else if( $(this).is("input[type='text']") || $(this).is("input[type='file']") || $(this).is("textarea") || $(this).is("input[type='password']")) {
                $(this).addClass('ui-state-default ui-corner-all app-button').hover(function() {
                    $(this).addClass('ui-state-hover');
                },
                function() {
                    if( this != document.activeElement ) {
                        $(this).removeClass('ui-state-hover');
                    }
                }).focus(function() {
                    $(this).addClass('ui-state-hover');
                }).blur(function() {
                    $(this).removeClass('ui-state-hover');
                });
            }
            else if( $(this).is("select") ) {
            $(this).selectmenu({width : 200});
            }
        });
    }
});


