﻿  
   function openNewWindow(url) {
            window.open(url, 'editWindow', 'width=500,height=500,scrollbars=yes', '');
        }

       
       function makePopUpDivVisible(idName) {
       
            var hlu = document.getElementById("hiddenLinkURL");
            var linkURL = document.getElementById(idName);
            
            hlu.value = linkURL
            
            var pw = document.getElementById("popupWindow");
            var bw = document.getElementById("blanketWindow");

            pw.className = "popUpWindowVisible";
            bw.className = "blanketWindowVisible";
            
            var workWidth = (getMaxWidth() / 2) - 200;

            pw.style.left= workWidth + "px";
            
            bw.style.height = getMaxHeight() +"px";
            bw.style.width = getMaxWidth() +"px";

            window.scrollTo(0, 0);
       }
       
    function getMaxHeight() {
         var hval = document.documentElement.scrollHeight;
         return hval;
    }

    function getMaxWidth() {
         var wval = document.documentElement.scrollWidth ;
         return wval;
    }

    function processCancelRequest() {
        var hlu = document.getElementById("hiddenLinkURL");
        window.top.document.location = hlu.value;
    }

    function processNormalRequest() {
        var txtEmail = document.getElementById("txtEmailAddress");
        var hlu = document.getElementById("hiddenLinkURL");
        window.top.document.location = hlu.value + "&emailAddress=" + txtEmail.value;
    }
      
       
     var aReq;
    function processAnAJAXRequest() {
         var txtEmail = document.getElementById("txtEmailAddress");
         var jpNum = document.getElementById("hiddenjobPostNumber");
 
         if (window.XMLHttpRequest) {
            aReq = new XMLHttpRequest();
         } 
         if (aReq == null) {
            aReq = new ActiveXObject("MSXML2.XMLHTTP.3.0");
         }        
         if (aReq == null) {
            aReq = new ActiveXObject("Microsoft.XMLHTTP");
         }        
         if (aReq != null) {
              var url = "AppEmailHandler.ashx?email=" + txtEmail.value + "&jpNum=" + jpNum.value;
              aReq.onreadystatechange = processReturn;
              aReq.open("GET", url, true);
             aReq.send(null);
         }
    }
    
    function processReturn() {
         if (aReq.readyState==4)  {        // 4 = "loaded"
                if (aReq.status==200)   {    // 200 = OK
//                   alert(aReq.responseText);
                   var hlu = document.getElementById("hiddenLinkURL");
//                   alert(hlu.value);
                   window.top.document.location = hlu.value;
                } else {
                   alert("Problem retrieving XML data");
                   window.top.document.location = hlu.value;
                }
          }
    }