$("form").submit(function (event) {
    var $form = $(this);
    if ($form.valid()) {
        waitingDialog.show(Languages_BackOffice_Resource_Pleasewait);
    }
});


function Generic_Forms_SelectTab()
{
    /// <summary>Select the tab based in URL # char</summary>
    /// <returns type="void"></returns>
    var url = document.location.toString();
    if (url.match('#')) {
        $('.nav-tabs a[href=#' + url.split('#')[1] + ']').tab('show');
    }

}

function Generic_Forms_LoadDialog()
{
    waitingDialog.show(Languages_BackOffice_Resource_Pleasewait);
}

function Generic_Forms_CloseLoadDialog() {
    waitingDialog.hide();
}


function Generic_Forms_OpenLookUp(fieldId, urlPath, value) {
    /// <summary>Open lookup. if FieldID is null, the value will be place as ID</summary>
    /// <returns type="void"></returns>
    var idRecord = null;

    if (fieldId != "") {
        idRecord = $("#" + fieldId).val();
    } else {
        idRecord = value;
    }


    if (idRecord != "") {
        var url = ZB_Relative_Path+ "ZBAdmin/" + urlPath + "/" + idRecord;
        var win = window.open(url, '_blank');
        win.focus();
    } else {
        BootstrapDialog.alert('Please select one');
    }

}
