<%@ master language="VB" inherits="Template_PageView, MachSol.MachPanel.Web" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolKit" %>
<%@ Register Assembly="AjaxControls" Namespace="AjaxControls" TagPrefix="ajaxCtrl" %>


<!DOCTYPE html>
<html>

<head id="Head" runat="server">
    <title>Master Page</title>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

    <!-- Google Fonts -->
    <%--<link href="https://fonts.googleapis.com/css?family=Roboto:400,700&subset=latin,cyrillic-ext" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" type="text/css">--%>

    <link href="/css/google/material-icons.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type='text/css' href="<%# ResolveUrl("~/JS/jquery-ui-1.11.2/jquery-ui.min.css?") + ProductVersion %>" />

    <!-- Bootstrap Core Css -->
    <link href="<%# ResolveUrl("~/plugins/bootstrap/css/bootstrap.css?") + ProductVersion %>" rel="stylesheet">

    <!-- Waves Effect Css -->
    <link href="<%# ResolveUrl("~/plugins/node-waves/waves.css?") + ProductVersion %>" rel="stylesheet" />

    <!-- Animation Css -->
    <link href="<%# ResolveUrl("~/plugins/animate-css/animate.css?") + ProductVersion %>" rel="stylesheet" />

    <!-- Morris Chart Css-->
    <link href="<%# ResolveUrl("~/plugins/morrisjs/morris.css?") + ProductVersion %>" rel="stylesheet" />

    <link href="<%# ResolveUrl("~/plugins/nestable/jquery-nestable.css?") + ProductVersion %>" rel="stylesheet">


    <!-- Bootstrap Select Css -->
    <link href="<%# ResolveUrl("~/plugins/bootstrap-select/css/bootstrap-select.css?") + ProductVersion %>" rel="stylesheet" />

    <%--   <!-- JQuery DataTable Css -->
    <link href="~/plugins/jquery-datatable/skin/bootstrap/css/dataTables.bootstrap.css" rel="stylesheet">--%>

    <!-- Custom Css -->
    <link href="<%# ResolveUrl("~/css/style.css?") + ProductVersion %>" rel="stylesheet">

    <%--font-glyphs css--%>
    <link href="<%# ResolveUrl("~/css/font-glyphs.css?") + ProductVersion %>" rel="stylesheet">

    <%--menu css--%>
    <link href="<%# ResolveUrl("~/css/menu.css?") + ProductVersion %>" rel="stylesheet">

    <!-- AdminBSB Themes. You can choose a theme from css/themes instead of get all themes -->
    <link href="<%# ResolveUrl("~/css/themes/all-themes.css?") + ProductVersion  %>" rel="stylesheet" />
    <link href="<%# ResolveUrl("~/css/themes/custom-themes.css?") + ProductVersion + SkinId %>" rel="stylesheet" />

    <link href="<%# ResolveUrl("~/css/Calendar.css?") + ProductVersion %>" rel="stylesheet">
    <link href="<%# ResolveUrl("~/JS/cal/cal.css?") + ProductVersion %>" rel="stylesheet" type="text/css" />
    
    <%--searchable option list library--%>
    <%--<link rel="stylesheet" type='text/css' href="/JS/searchablelist/sol-2.0.2.css" />--%>

    <%--JQuery Framework References--%>
    <script language="javascript" type="text/javascript" src="/plugins/jquery/jquery.min.js?<%# ProductVersion %>"></script>
    <script language="javascript" type="text/javascript" src="/JS/jquery-ui-1.11.2/jquery-ui.min.js?<%# ProductVersion %>"></script>

    <%--<script language="javascript" type="text/javascript" src="/JS/bjqs-1.3.min.js?<%# ProductVersion %>"></script>--%>
    <%--Custom References of Controls Used for Help--%>
    <script language="javascript" type="text/javascript" src="/JS/RoboHelp_CSH.js?<%# ProductVersion %>"></script>
    <%--searchable option list js library--%>
    <script language="javascript" type="text/javascript" src="/JS/searchablelist/sol-2.0.2.js?<%# ProductVersion %>"></script>

    <%--MachPanel Custom JS files--%>
    <script language="javascript" type="text/javascript" src="/JS/date.js?<%# ProductVersion %>"></script>
    <script language="javascript" type="text/javascript" src="/JS/WebServiceCalls.js?<%# ProductVersion %>"></script>
    <script language="javascript" type="text/javascript" src="/JS/Utility.js?<%# ProductVersion %>"></script>
    <script language="javascript" type="text/javascript" src="/JS/Network.js?<%# ProductVersion %>"></script>
    <script language="javascript" type="text/javascript" src="/JS/menu.js?<%# ProductVersion %>"></script>
    <script language="javascript" type="text/javascript" src="/JS/HelpDesk.js?<%# ProductVersion %>"></script>
    <script language="javascript" type="text/javascript" src="/JS/inc_code.js?<%# ProductVersion %>"></script>
    <script language="javascript" type="text/javascript" src="/JS/service-q.js?<%# ProductVersion %>"></script>
    <script language="javascript" type="text/javascript" src="/JS/ProductBasicInfo.js?<%# ProductVersion %>"></script>
    <script language="javascript" type="text/javascript" src="/JS/Exchange.js?<%# ProductVersion %>"></script>
    <script language="javascript" type="text/javascript" src="/JS/cal/cal.js?<%# ProductVersion %>"></script>
    <script language="javascript" type="text/javascript" src="/JS/Lync.js?<%# ProductVersion %>"></script>
    <script language="javascript" type="text/javascript" src="/JS/vps-states.js?<%# ProductVersion %>"></script>

    <script language="javascript" type="text/javascript" src="/JS/vue/vue.js?<%# ProductVersion %>"></script>
    <script language="javascript" type="text/javascript" src="/JS/vue/vue-resource.js?<%# ProductVersion %>"></script>

    <script language="javascript" type="text/javascript" src="/JS/Duo/Duo-Web-v2.js?<%# ProductVersion %>"></script>

    <script>
        Vue.http.headers.common['content-type'] = 'application/json; charset=utf-8';
        Vue.http.interceptor.before = function (request, next) {
            /*request.uploadProgress = function (e) {
                console.log(e);
                if (e.lengthComputable) {
                    console.log('Upload:' + e.loaded / e.total * 100);
                }
            }

            request.downloadProgress = function (e) {
                console.log(e);
                if (e.lengthComputable) {
                    console.log('Download:' + e.loaded / e.total * 100);
                }
            }*/
            $('.page-loader-wrapper').show();
            request.progress = function (e) {
                if (e.lengthComputable) {
                    if ((e.loaded / e.total * 100) >= 100)
                        $('.page-loader-wrapper').hide();
                }
            };

            next(function (response) { return response; });
        }

    </script>


    <%--System alert box--%>
    <script src="/JS/pages/ui/notifications.js?<%# ProductVersion %>"></script>
    <!-- Bootstrap Notify Plugin Js -->
    <script src="/plugins/bootstrap-notify/bootstrap-notify.js?<%# ProductVersion %>"></script>
    <%--Client Helper JS files for custom purposes--%>
    <script language="javascript" type="text/javascript" src="/JS/functions.js?<%# ProductVersion %>"></script>


    <script language="javascript" type="text/javascript">
        if (!window.XMLHttpRequest && 'ActiveXObject' in window) {
            window.XMLHttpRequest = function () {
                return new ActiveXObject('MSXML2.XMLHttp');
            };
        }


        function chk(evt) {
            var isIE = (navigator.appName == "Microsoft Internet Explorer");
            var IEversion = navigator.appVersion;
            if (isIE) {
                IEversion = parseInt(IEversion.substr(IEversion.indexOf("MSIE") + 4));
            } else { IEversion = 0; }

            if (IEversion == 6) {
                if (evt.keyCode == 116) {
                    evt.keyCode = 0;
                    evt.returnValue = false;
                    evt.cancelBubble = true;

                    return false;
                }
                else if (evt.ctrlKey && evt.keyCode == 116) {
                    evt.keyCode.cancelBubble = false;
                    return false;
                }
            }
            else {
                if (evt.keyCode == 116) {
                    evt.keyCode.cancelBubble = false;
                    return false;
                }
                else if (evt.ctrlKey && evt.keyCode == 116) {
                    evt.keyCode.cancelBubble = false;
                    return false;
                }
            }


        }

    </script>
    <link rel="icon" href="" type="image/ico" sizes="16x16" id="link_favicon" runat="server">
</head>

<body class="theme-indigo" runat="server" id="MasterBody" onkeydown="return chk(event);">
    <%If MachSol.MachPanel.DBCore.SystemSettings.IsDMP() Then %>
        <link href="/css/sar-customizations.css" rel="stylesheet" />
    <%End If%>
    <!-- Page Loader -->
    <div class="page-loader-wrapper">
        <div class="sk-cube-grid">
            <div class="sk-cube sk-cube1"></div>
            <div class="sk-cube sk-cube2"></div>
            <div class="sk-cube sk-cube3"></div>
            <div class="sk-cube sk-cube4"></div>
            <div class="sk-cube sk-cube5"></div>
            <div class="sk-cube sk-cube6"></div>
            <div class="sk-cube sk-cube7"></div>
            <div class="sk-cube sk-cube8"></div>
            <div class="sk-cube sk-cube9"></div>
        </div>
    </div>

    <!-- #END# Page Loader -->
    <!-- Overlay For Sidebars -->
    <div class="overlay"></div>
    <!-- #END# Overlay For Sidebars -->

    <form id="form1" runat="server" autocomplete="off" defaultbutton="Btn_FormDummy">
        <ajax:ScriptManager ID="SM_Master" EnablePartialRendering="true" EnableScriptGlobalization="true"
            EnableScriptLocalization="true" runat="server" AsyncPostBackTimeout="360">
        </ajax:ScriptManager>

        <!-- Dummy button to disable search bar post back on clicking enter in form fields when panel default button is not set -->
        <asp:Button ID="Btn_FormDummy" runat="server" CssClass="btn-dummy" Enabled="false" />

     
        <section class="content">
            <div class="container-fluid">

                <div style="display: none">
                    <input type="password" id="DummyPassword" />
                    <input type="text" id="DummyUserId" />
                </div>
                <div id='noscript_div' runat="server" style='position: fixed; z-index: 20000000; height: 100%; width: 100%; line-height: 100%;'>
                    <div style="color: red; font-size: 14px; padding-top: 300px; padding-left: 400px; float: left;">
                        <b>
                            <asp:Literal ID="Literal7" runat="server" EnableViewState="false" Text="<%$ Resources:Content,FAM00155 %>" /></b>
                    </div>
                </div>

                <div id="LoginPage" style="width: 100%; height: 100%;">

                    <input type="hidden" id="HF_Ajax" value="0" />

                    <!--control panel content area-->
                    <div class="MainContextArea">
                        <!-- Success or Error Message Start -->
                        <ajax:UpdatePanel ID="UP_Message" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <div id="Div_UPMessage" runat="server" class="container-fluid status-message" style="display: none">
                                    <div class="alert alert-dismissible sys-alert">
                                        <button type="button" class="close" data-dismiss="alert">&times;</button>
                                        <div id="Div_Message" class="successMsg" runat="server" visible="false" />
                                    </div>
                                </div>

                                <!--  the below repleated Error Div's and Success Div are for Vue -->
                                <div id="Div_UPMessageForJS" runat="server" class="container-fluid" style="display: none">
                                    <div class="alert alert-dismissible sys-alert">
                                        <button type="button" class="close" onclick="$('#ctl00_Div_UPMessageForJS').attr('style', 'display: none')">&times;</button>
                                        <div id="Div_MessageForJS" class="successMsg" runat="server" />
                                    </div>
                                </div>
                            </ContentTemplate>
                        </ajax:UpdatePanel>
                        <!-- //end Success or Error Message -->

                        <!--content/data start-->
                        <asp:ContentPlaceHolder EnableViewState="true" ID="CPH_Content" runat="server" />
                        <!--//end content/data-->

                    </div>

                </div>

            </div>
            
        </section>


    </form>

    <!-- Jquery Core Js -->
    <script src="/plugins/jquery/jquery.min.js?<%# ProductVersion %>"></script>

    <!-- Bootstrap Core Js -->
    <script src="/plugins/bootstrap/js/bootstrap.js?<%# ProductVersion %>"></script>

    <!-- Slimscroll Plugin Js -->
    <script src="/plugins/jquery-slimscroll/jquery.slimscroll.js?<%# ProductVersion %>"></script>
    <!-- Waves Effect Plugin Js -->
    <script src="/plugins/node-waves/waves.js?<%# ProductVersion %>"></script>

    <!-- Jquery CountTo Plugin Js -->
    <script src="/plugins/jquery-countto/jquery.countTo.js?<%# ProductVersion %>"></script>

    <!-- Morris Plugin Js -->
    <script src="/plugins/raphael/raphael.min.js?<%# ProductVersion %>"></script>
    <script src="/plugins/morrisjs/morris.js?<%# ProductVersion %>"></script>
    <script src="/plugins/nestable/jquery.nestable.js?<%# ProductVersion %>"></script>

    <!-- ChartJs -->
    <script src="/plugins/chartjs/Chart.min.js?<%# ProductVersion %>"></script>
    <script src="/plugins/chartjs/Chart.bundle.min.js?<%# ProductVersion %>"></script>

    <!-- Flot Charts Plugin Js -->
    <%--<script src="/plugins/flot-charts/jquery.flot.js?<%# ProductVersion %>"></script>
    <script src="/plugins/flot-charts/jquery.flot.resize.js?<%# ProductVersion %>"></script>
    <script src="/plugins/flot-charts/jquery.flot.pie.js?<%# ProductVersion %>"></script>
    <script src="/plugins/flot-charts/jquery.flot.categories.js?<%# ProductVersion %>"></script>
    <script src="/plugins/flot-charts/jquery.flot.time.js?<%# ProductVersion %>"></script>--%>

    <!-- Sparkline Chart Plugin Js -->
    <%--<script src="/plugins/jquery-sparkline/jquery.sparkline.js?<%# ProductVersion %>"></script>--%>

    <!-- Select Plugin Js -->
    <script src="/plugins/bootstrap-select/js/bootstrap-select.js?<%# ProductVersion %>"></script>

    <script src="/plugins/bootstrap-fileupload/js/bootstrap-fileupload.js?<%# ProductVersion %>"></script>

    <script src="/JS/Master_Ready.js?<%# ProductVersion %>"></script>
    
    <script type="text/javascript" src="/JS/multi-selectable.js?<%# ProductVersion %>"></script>

    <script src="/JS/admin.js?<%# ProductVersion %>"></script>

    <script src="/JS/jquery-ui-1.12.1/jquery-ui-1.12.1.min.js"></script>
    <script type="text/javascript" src="/JS/jquery-cookie 1.4.1/jquery.cookie.min.js"></script>

    <script language="javascript" type="text/javascript">

        var oldPostBack;
        var myForm = document.forms['aspnetForm'];
        if (!myForm) {
            myForm = document.aspnetForm;
        }
        if (!myForm) {
            myForm = document.forms[0];
        }


        oldPostBack = __doPostBack;
        __doPostBack = customPostBackHandler;

        function customPostBackHandler(eventTarget, eventArgument) {

            $('.page-loader-wrapper').show();
            if (myForm && (!myForm.onsubmit || (myForm.onsubmit() != false))) {
                HandleInputHtmlTags();
                return oldPostBack(eventTarget, eventArgument);
            }
            else
                return oldPostBack(eventTarget, eventArgument);
        }




        //$(function () {
        //    $(".itemDrag").draggable();
        //});
        $(function () {

            // configura drag and drop
            $(".recebeDrag").sortable({
                connectWith: ['.recebeDrag'],
                placeholder: 'my-placeholder',
                handle: '.contenttitle',
                scroll: true,
                revert: true,
                stop: function (e, ui) {
                    salvaCookie();
                }
            });

            // set cookie
            if ($.cookie('df_draganddr')) {
                var esquerda = $.cookie('df_draganddr').split(',');
                // set positions
                for (i = 0; i <= esquerda.length; i++)
                    $('#drop-esquerda').append($('#' + esquerda[i]));

            } else {
                $.cookie('df_draganddr', '', { expires: 7, path: '/' });
            }

            $(".ui-content").draggable({
                stop: function (ev, ui) {
                    //if (dropped)
                    //alert(ev);
                    alert(ui.position.top); //.item.attr("id"));
                    //else alert("Not dropped");
                }
            });
            // save cookie
            var salvaCookie = function () {
                var ordem = $('#drop-esquerda').sortable('toArray');
                $.cookie('df_draganddr', ordem);
                //alert(ordem);
            };
        });

        $(document).ready(function () {
            if ($("#DRChat") != null) {
                $('#DRChat').click(function () {
                    //alert('clicked');
                    CheckChatOption();
                });

                setTimeout(function () {
                    CheckChatOption();
                }, 2000);

            }
        });

        function CheckChatOption() {
            if ($("#DRChat") != null) {
                if ($("#DRChat").find("#sc2IhR:not([class])").length > 0 || $("#DRChat").find("#sc2IhR").hasClass("ps_rvm__hidden"))
                    UpdateChatSession(false); //alert('hidden');
                else
                    UpdateChatSession(true); //alert('visible');
            }
        }

        function UpdateChatSession(DoShow) {

            var params = "{'DoShow': '" + DoShow + "'}";
            $.ajax({
                type: "POST",
                url: "/WebServices/Voice.asmx/UpdateChatSession",
                async: true,
                data: params,
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (msg) {
                    if (msg.d.indexOf('Error') < 0) {

                    }
                    else {
                        //alert(msg.d);
                    }
                },
                error: function (errorMessage) {
                    console.log(errorMessage);
                }
            });
            //}
        }
    </script>
    <script lang="javascript" type="text/javascript" src="/JS/custom-fixes-rcc.js?<%# ProductVersion %>"></script>
    <script lang="javascript" type="text/javascript" src="/JS/adal.js?<%# ProductVersion %>"></script>


</body>
</html>
