
            $(document).ready(function(){
  $("#loginBox").hide();
  });

        function show()
        {document.getElementById("loginBox").style.left=(window.screen.availWidth)/2-150
            
            if(typeof(window.pageYOffset)=='number') {
            document.getElementById("loginBox").style.top=(window.screen.availHeight)/4;
            }
            else {
               document.getElementById("loginBox").style.top=document.activeElement.offsetParent.offsetTop;
            }

        
            $("#loginBox").fadeIn("fast");
            document.getElementById("userName").focus()

        }

        function hideBox()
        {
            $("#loginBox").fadeOut();
            document.getElementById("password").value=""
            document.getElementById("userName").value=""
        }

        function beginLogin()
         {
             var password=document.getElementById("password").value
             var userName=document.getElementById("userName").value

             if (password=="")
                 {window.alert("Please input password");
                 document.getElementById("password").focus();
                 return;}

             if (userName=="")
                 {window.alert("Please input user name");
                 document.getElementById("userName").focus();
                 return}

             $('#approvalSpan').load("includes/loginApproval.php","n=" +userName+"&p="+password, finishLogin);
         }
       
       function finishLogin()
       { 
           var approval=document.getElementById("approvalSpan").innerHTML
           
             if(approval=="false")
             {window.alert("User name or password incorrect, please try again");
             document.getElementById("password").value="";
             document.getElementById("userName").value="";
             document.getElementById("userName").focus();
            }
            else
                {
                window.open("admin/accessAllowed.php")
                hideBox();
                }
       }

        function requestPassword()
        {
            var email=window.prompt("please input your email address", "email")

            if (email==null)
                {return}

            $('#approvalSpan').load("includes/requestPassword.php","n=" +userName, finishRequest);
        }

        function finishRequest()
        {
            var approval=document.getElementById("approvalSpan").innerHTML
            if(approval=="false")
             {window.alert("Sorry, we can't find that email address in our records.  Please register");}
           else
             {window.alert("Your password is being sent to your email account.  Please wait a few minutes. Thank you.")}
        }
