@using System.Configuration;
@using SharpConnector.Constants;

@{
    var message = (Tuple<string, string>)TempData[Const.Message] ?? new Tuple<string, string>("", "");
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="content-type" content="text/html" />
    <meta charset="UTF-8" />
    <base href='@Url.Content("~/")'>
    <title>@ConfigurationManager.AppSettings["FXC:name"]</title>
    @Styles.Render("~/Content/css/style.css")
    @Scripts.Render("~/scripts/mfp.js?v=1")
    @Scripts.Render("~/scripts/script.js?v=1")
    @Scripts.Render("~/scripts/json2.js")
</head>

<body id="login">
    <!-- HEADER START -->
    <div id="header">
        <div id="logo">
            <img src="@Url.Content("~/Content/Images/small_logo.png")" width="40" />
        </div>
    </div>
    <!-- HEADER END -->
    <!-- BODY START -->
    <div id="body_wrapper" class="full-height">
        <div id="main" class="full-height">
            <div id="wrapper">
                <div class="inner_wrapper">
                    @RenderBody()
                </div>
            </div>
        </div>
    </div>
    <!-- CUSTOM SCRIPTS -->
    <script type="text/javascript">       
        var _mfpApi = '@ConfigurationManager.AppSettings["MFP:apiUrl"]';
        var _mfpVer = '@ConfigurationManager.AppSettings["MFP:apiVersion"]';
        var _projectURl = '@ConfigurationManager.AppSettings["MFP:projectUrl"]';

        window.onload = function () {
            cAlert("@message.Item1", "@message.Item2");
            if ($('#Username').value != '' && $('#Password').value != '') {
                if ($('#login_form') != null) {
                    $('#login_form').submit();
                }
            }

            if ($('#login_sso_form') != null) {
                GetLoginUser();
            }

            initStyle();
        };

        GetDeviceSettings();

        function GetDeviceSettings() {
            var reqStr = _mfpApi + 'mfpcommon/GetDeviceSettings/' + _mfpVer + '?res=jsonp&callback=errorCheckFunc';
            reqStr += '&vkey=' + '@HttpUtility.UrlEncode(HttpContext.Current.Session[MFP.APIKey].ToString())';
            jsonpRequest(reqStr, "GetDeviceSettingsCallBack");
        }

        function GetDeviceSettingsCallBack(_retParam) {
            var data = JSON.stringify(_retParam["result"]["GetDeviceSettingsResponse"], null, " ");
            mfpLog("GetDeviceSettingsResponse", data);
            GetCapability();
        }

        function GetCapability() {
            var reqStr = _mfpApi + 'mfpcommon/Capability/' + _mfpVer + '?res=jsonp&callback=errorCheckFunc';
            reqStr += '&vkey=' + '@HttpUtility.UrlEncode(HttpContext.Current.Session[MFP.APIKey].ToString())';
            jsonpRequest(reqStr, "GetCapabilityCallBack");
        }

        function GetCapabilityCallBack(_retParam) {
            var data = JSON.stringify(_retParam["result"]["CapabilityResponse"], null, " ");
            mfpLog("CapabilityResponse", data);
        }
    </script>
    @RenderSection("scripts", required: false)
</body>
</html>
