﻿jQuery(document).ready(function () {

    var y = 2010;
    var m = 09;
    var d = 21;

    //Accordion
    $("#accordion").accordion({ header: "h3" });

    // Tabs
    $('#servicetabs').tabs();

    $('#servicedialogTabs').tabs();

    $('#editservicedialogTabs').tabs();

    $('#eventdialogTabs').tabs();

    $('#editeventdialogTabs').tabs();

    $('#editproviderdialogTabs').tabs();

    $('#adminservicetabs').tabs();

    $('#admineventtabs').tabs();

    $('#adminlocationstabs').tabs();

    $('#admincontactstabs').tabs();

    $('#admindocumentstabs').tabs();

    $('#adminproviderstabs').tabs();

    $('#editadministratordialogTabs').tabs();

    $('#adminworkflowlisttabs').tabs();

    $('#adminworkflowlistproviderstabs').tabs();

    // Dialog			
    $('#servicedialog').dialog({
        autoOpen: false,
        width: 600,
        height: 420,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#eventdialog').dialog({
        autoOpen: false,
        width: 600,
        height: 450,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#editservicedialog').dialog({
        autoOpen: false,
        width: 750,
        height: 460,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#editeventdialog').dialog({
        autoOpen: false,
        width: 750,
        height: 450,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    // Dialog			
    $('#editservicedialogUploadFile').dialog({
        autoOpen: false,
        width: 500,
        height: 370,
        modal: true,
        resizable: false,
        closeOnEscape: false,
        open: function (event, ui) { jQuery('.ui-dialog-titlebar-close').hide(); },
        close: function (event, ui) { jQuery('.ui-dialog-titlebar-close').show(); },
        buttons: {
            "Close": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#editeventdialogUploadFile').dialog({
        autoOpen: false,
        width: 500,
        height: 370,
        modal: true,
        resizable: false,
        closeOnEscape: false,
        open: function (event, ui) { jQuery('.ui-dialog-titlebar-close').hide(); },
        close: function (event, ui) { jQuery('.ui-dialog-titlebar-close').show(); },
        buttons: {
            "Close": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#editdocumentdialogUploadFile').dialog({
        autoOpen: false,
        width: 500,
        height: 370,
        modal: true,
        resizable: false,
        closeOnEscape: false,
        open: function (event, ui) { jQuery('.ui-dialog-titlebar-close').hide(); },
        close: function (event, ui) { jQuery('.ui-dialog-titlebar-close').show(); },
        buttons: {
            "Close": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#editcounsellingservicedialog').dialog({
        autoOpen: false,
        width: 750,
        height: 350,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#editservicetypedialog').dialog({
        autoOpen: false,
        width: 600,
        height: 420,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#editcounsellingservicetypedialog').dialog({
        autoOpen: false,
        width: 600,
        height: 420,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#editlocationdialog').dialog({
        autoOpen: false,
        width: 600,
        height: 350,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#editcontacttypedialog').dialog({
        autoOpen: false,
        width: 600,
        height: 350,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#editcontactsdialog').dialog({
        autoOpen: false,
        width: 600,
        height: 450,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#editdocumentcategorydialog').dialog({
        autoOpen: false,
        width: 600,
        height: 350,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#editprovidersdialog').dialog({
        autoOpen: false,
        width: 600,
        height: 630,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#editadministratorsdialog').dialog({
        autoOpen: false,
        width: 600,
        height: 380,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#servicedialogworkflowlist').dialog({
        autoOpen: false,
        width: 600,
        height: 520,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#eventdialogworkflowlist').dialog({
        autoOpen: false,
        width: 600,
        height: 550,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#editservicedialogworkflowlistProvider').dialog({
        autoOpen: false,
        width: 600,
        height: 600,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#editeventdialogworkflowlistProvider').dialog({
        autoOpen: false,
        width: 750,
        height: 550,
        modal: true,
        resizable: false,
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });

    // Dialog Link
    //    $('#sericedialog_link').click(function () {
    //        alert("hello");
    //        $('#servicedialog').dialog('open');
    //        return false;
    //    });

    //Status Bars
    $('#adminServicesStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
    });

    $('#adminServicesDialogStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminEventsStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminEventsDialogStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#changePasswordStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#loginControlStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#UploadFileControlStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminCounsellingServicesDialogStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminServiceTypeDialogStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminCounsellingServiceTypeDialogStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminLocationsStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminLocationDialogStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminContactsStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminContactTypeDialogStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminContactsDialogStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminDocumentsStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminDocumentCategoryDialogStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminProvidersStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminProvidersDialogStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminAdministratorsDialogStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#passwordRecoveryStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminWorkflowListStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        $('#adminWorkflowListProvidersStatusBar')
        .jnotifyInizialize({
            oneAtTime: false,
            appendType: 'append'
        })
        .css({ 'marginBottom': '5px'
        });

        //Date picker ------------------------------------------------------------------

        $("#dateediteventDialogDetailStartDate").datepicker($.datepicker.regional['en-GB']);
        $("#dateediteventDialogDetailEndDate").datepicker($.datepicker.regional['en-GB']);

        //------------------------------------------------------------------------------


        //Masks-------------------------------------------------------------------------

        $("#dateediteventDialogDetailStartDate").mask("39/19/3999", { placeholder: " " });
        $("#dateediteventDialogDetailEndDate").mask("39/19/3999", { placeholder: " " });

        //------------------------------------------------------------------------------

        //block the UI when loading with jQuery ajax -----------------------------------

        $(document).ajaxStart($.blockUI).ajaxStop($.unblockUI);

        //------------------------------------------------------------------------------
});

