<!DOCTYPE html>
<html>
  <head>
    <title>Burk Technology ARC Solo</title>
    <script language="javascript" type="text/javascript">
      var LoginVersion = "1.0.56";
      window.onerror = function () {
        alert(
          "ARC Solo firmware is not compatible with Web page version " +
            LoginVersion +
            ".\nUpload WebPages that match the installed firmware version."
        );
      };
    </script>
    <link rel="Stylesheet" type="text/css" href="/style.css" />

    <style type="text/css">
      p.error {
        color: Red;
        font-style: italic;
      }

      p.version {
        color: Gray;
        font-size: 10px;
      }

      div.centered {
        margin-top: 64px;
        margin-left: auto;
        margin-right: auto;
        background-color: white;
        border-radius: 8px;
      }

      table {
        width: 100%;
        padding: 3px;
      }

      td {
        text-align: left;
        padding: 2px;
      }

      .col2 * {
        width: 100%;
      }
    </style>
    <script src="/md5.js"></script>
    <script src="/jquery.min.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
      /*
      * JS Redirection Mobile
      *
      * Copyright (c) 2011 Sebastiano Armeli-Battana (http://sebarmeli.com)
      * Dual licensed under the MIT or GPL Version 3 licenses.
      * @link http://github.com/sebarmeli/JS-Redirection-Mobile-Site/
      * @version 0.9.5
      */
      (function(f,m,b){var d=function(t){var s=new Date();s.setTime(s.getTime()+t);return s;};var n=function(x){if(!x){return;}var s=m.location.search,y=s&&s.substring(1).split("&"),u=0,w=y.length;for(;u<w;u++){var t=y[u],v=t&&t.substring(0,t.indexOf("="));if(v===x){return t.substring(t.indexOf("=")+1,t.length);}}};var a=b.userAgent.toLowerCase(),p="false",o="mobile_redirect",q="m",k=window.location.host+"/mobile/",e=m.location.protocol,l=m.location.host,g=n(o),h=k||(q+"."+(!!l.match(/^www\./i)?l.substring(4):l)),i=1,c=!!(a.match(/(iPhone|iPod|blackberry|android 0.5|htc|lg|midp|mmp|mobile|nokia|opera mini|palm|pocket|psp|sgh|smartphone|symbian|treo mini|Playstation Portable|SonyEricsson|Samsung|MobileExplorer|PalmSource|Benq|Windows Phone|Windows Mobile|IEMobile|Windows CE|Nintendo Wii)/i));if(m.referrer.indexOf(h)>=0||g===p){if(f.sessionStorage){f.sessionStorage.setItem(o,p);}else{m.cookie=o+"="+p+";expires="+d(3600*1000*i).toUTCString();}}var r=(f.sessionStorage)?(f.sessionStorage.getItem(o)===p):false,j=m.cookie?(m.cookie.indexOf(o)>=0):false;if(c&&!(j||r)){m.location.href=e+"//"+h;}}(window,document,navigator));

      		var Version = "";
      		$(document).ready(function(){
      			VerifyVersion();
      			CheckPassword();
      			$('#UpdatePassword').click(UpdatePassword);
      			$('#LogOn').click(CalculateHash);

      			$("#txtPassword").keyup(function(event) {
      				if (event.keyCode === 13) {
      					$("#LogOn").click();
      				}
      			});
      		});
      		function UpdatePassword()
      		{
      			var p1 = $('#txtPassword1').val();
      			var p2 = $('#txtPassword2').val()
      			if( p1 != p2 )
      			{
      				alert("The passwords do not match.");
      				return;
      			}
      			if( p1.length < 6 )
      			{
      				alert("The password must be at least 6 characters.");
      				return;
      			}
      			if( p1.toLowerCase() == "password" )
      			{
      				alert("The password must not be 'password'");
      				return;
      			}

      			data = {};
      			data['UserPassword0'] = p1;
      			$.ajax({
      				method: "POST",
      				url: "post.json",
      				data: data,
      				success: function(){
      					// save the data
      					$.post("post.json", {UsersSaveConfig:true}, function(){
      						location.reload();
      					});
      				},
      				error: function(){
      					location.reload();
      				}
      			});
      		}
      		function CheckPassword()
      		{
      			if(0)
      			{
      				$('#SetPasswordForm').show();
      				$('#LogInForm').hide();
      			}
      			else
      			{
      				$('#SetPasswordForm').hide();
      				$('#LogInForm').show();
      			}
      		}
      		function VerifyVersion()
      		{
      			$.ajax({
      				url: "/version.json",
      				type: "GET",
      				dataType: "json",
      				data: "",
      				timeout: 10000, // set timeout to 10 seconds
      			   error: function(){
      					alert('ARC Solo firmware is not compatible with Web page version ' + LoginVersion + '.\nUpload WebPages that match the installed firmware version.');
      					return;
      				},
      				success: function(data){
      					if( data == null )
      					{
      						alert('ARC Solo firmware is not compatible with Web page version ' + LoginVersion + '.\nUpload WebPages that match the installed firmware version.');
      						return;
      					}
      					Version = data.Version;
      					if( Version != LoginVersion)
      					{
      						alert('ARC Solo version ' + Version + ' and Web page version ' + LoginVersion + ' do not match.\nUpload WebPages that match the installed firmware version ' + Version + '.');
      						return;
      					}
      				}
      			});
      		}
              function RemoveFrame()
              {
                  if(parent.frames.length>=1)
                  {
                      window.top.location.href="login.htm";
                  }
                  document.getElementById("txtUsername").focus();
              }
              function CalculateHash()
              {
      			$.getJSON("/nonce.json", function (data){
      				var username = document.getElementById('txtUsername');
      				var password = document.getElementById('txtPassword');
      				var nonce  = data.Nonce;

      				var inputString = nonce + username.value.toLowerCase() + hex_md5("Burk"+password.value);

      				var hash = hex_md5(inputString);

      				document.getElementById('login').value = hash;
      				document.forms["loginform"].submit();
      			});
              }
              function createCookie(name,value,days) {
                  if (days) {
                      var date = new Date();
                      date.setTime(date.getTime()+(days*24*60*60*1000));
                      var expires = "; expires="+date.toGMTString();
                  }
                  else var expires = "";
                  document.cookie = name+"="+value+expires+"; path=/";
              }
              function eraseCookie(name)
              {
                  createCookie(name,"",-1);
              }
    </script>
  </head>
  <body onload="RemoveFrame();eraseCookie('key')">
    <div style="width: 100%; height: 100%; text-align: center">
      <div class="centered" style="width: 260px; border: solid 1px #acacac; padding: 8px 8px 8px 8px">
        <div id="LogInForm">
          <table>
            <tr>
              <img src="/SoloLogo.png" style="margin-bottom: 10px" />
            </tr>
            <tr>
              <td style="text-align: left">Site:</td>
              <td class="col2">WGBW-AM</td>
            </tr>
            <tr>
              <td style="text-align: left">Username:</td>
              <td class="col2">
                <input id="txtUsername" type="text" style="width: 125px" />
              </td>
            </tr>
            <tr>
              <td style="text-align: left">Password:</td>
              <td class="col2">
                <input id="txtPassword" type="password" style="width: 125px" />
              </td>
            </tr>

            <tr>
              <td></td>
              <td style="text-align: left">
                <button id="LogOn">Log On</button>
              </td>
            </tr>
          </table>
          <form name="loginform" method="post" action="/index.htm" onsubmit="CalculateHash();">
            <input type="hidden" name="login" id="login" />
          </form>
          <p class="error" style="visibility:hidden">Incorrect username or password.</p>
        </div>
        <div id="SetPasswordForm">
          <img src="/SoloLogo.png" style="margin-bottom: 10px" />
          <p>Set the administrator password.</p>
          <table>
            <tr>
              <td style="text-align: left">Username:</td>
              <td class="col2">admin</td>
            </tr>
            <tr>
              <td style="text-align: left">Enter Password:</td>
              <td class="col2">
                <input id="txtPassword1" type="password" autocomplete="off" style="width: 125px" />
              </td>
            </tr>
            <tr>
              <td style="text-align: left">Confirm Password:</td>
              <td class="col2">
                <input id="txtPassword2" type="password" autocomplete="off" style="width: 125px" />
              </td>
            </tr>

            <tr>
              <td></td>
              <td style="text-align: left">
                <button id="UpdatePassword" class="Save SaveBtn">Save</button>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <p class="version">&copy; 2014-2022 Burk Technology, Inc. All rights reserved.<br /></p>
    </div>
  </body>
</html>
