jqApplication = function()
{
    return {
        openModule : function(title, moduleURL)
        { 
            jQuery('#jqDesktopTabs').tabs('add', moduleURL, title, 0);
        },
        showFormSearch : function(searchURL, dialogCloseAction)
        {   
            jQuery('#formSearchDialogCloseAction').val(dialogCloseAction);
            var formSearchDialog = jQuery('#formSearchDialog');
            searchURL = encodeURI(searchURL);
            formSearchDialog.load(
                  searchURL, 
                  {},
                  function (responseText, textStatus, XMLHttpRequest) {
                      formSearchDialog.dialog('open');
                  }
            );
        },
        showFormEditor : function(recordId, editURL, title)
        {   
        	var requestURL = editURL.replace('{id}', recordId);            
            var formEditorDialog = jQuery('#formEditorDialog');
            requestURL = encodeURI(requestURL);
            formEditorDialog.load(
              requestURL, 
              {},
              function (responseText, textStatus, XMLHttpRequest) {
                  formEditorDialog.dialog('open');
                  if (xaphoo.type(title) != 'undefined'){
                      formEditorDialog.dialog('option', 'title' , title);
                  }else{
                      formEditorDialog.dialog('option', 'title' , 'Formulario de edición');
                  }
              }
            );
        },
        showPrintDialog : function(printURL)
        {   
            var desktopWidth = xaphoo.getScreenWidth() - 5;
            var desktopHeight =  xaphoo.getScreenHeight() - 5;
            //window.open(printURL ,'print','status=yes,scrollbars=yes,resizable=yes,width='+ desktopWidth - 200 + ',height='+ desktopHeight - 100 );
            printURL = encodeURI(printURL);
            window.open(printURL);
            return;
//            var printDialog = jQuery('#printDialog');
//            printDialog.load(
//              printURL, 
//              {},
//              function (responseText, textStatus, XMLHttpRequest) {
//                  printDialog.dialog('open');
//              }
//            );
        },
        showDeleteDialog : function(recordsId, editURL, successAction)
        {   
            var requestURL = editURL.replace('{id}', recordsId);
            requestURL = encodeURI(requestURL);
            jQuery('#deleteConfirmDialogRequestURL').val(requestURL);
            jQuery('#deleteConfirmDialogSuccessAction').val(successAction);
            jQuery('#deleteConfirmDialog').dialog('open');
        }        
    };
}();

