(function (document, $) {
    Joomla.submitbutton = function (pressbutton) {
        var form = document.adminForm;
        if (pressbutton === 'cancel') {
            Joomla.submitform(pressbutton, form);
        } else {
            //Validate the entered data before submitting
            if (jQuery('#jform_title').val() == '') {
                alert(Joomla.JText._('EDOCMAN_ENTER_DOCUMENT_TITLE'));
                jQuery('#jform_title').focus();
                return;
            }
			else if (jQuery('#jformcategory_id').val() == '0') {
                alert(Joomla.JText._('EDOCMAN_SELECT_CATEGORY'));
                jQuery('#jformcategory_id').focus();
                return;
            }
            Joomla.submitform(pressbutton);
        }
    };
})(document, jQuery);