﻿// JScript File


  function doDownloadZip() {
                //alert('hello');
                if (window.XMLHttpRequest)
                { // Non-IE browsers
                  req = new XMLHttpRequest();
                  req.onreadystatechange = processStateChange;
                  try
                          {
                                req.open("GET", "/dummy-download.aspx?pwd="+document.getElementById('txtdownloadpwd').value+"&fid="+new Date().getTime()+'&tn='+Math.random(), true);
                         } catch (e) {
                                alert(e);
                  }
                  req.send(null);
                } else if (window.ActiveXObject) { // IE
                  req = new ActiveXObject("Microsoft.XMLHTTP");
                  if (req) {
                        req.onreadystatechange = processStateChange;
                        req.open("GET", "/dummy-download.aspx?pwd="+document.getElementById('txtdownloadpwd').value+"&fid="+new Date().getTime()+'&tn='+Math.random(), true);
                        req.send();
                  }
                }
        }
function processStateChange()
  {
    if (req.readyState == 4)
        { // Complete
      if (req.status == 200)
          { 
           if(req.responseText=="1")
          {
          alert("invalid password");
          document.getElementById('txtdownloadpwd').value="";
          document.getElementById('txtdownloadpwd').focus();
          }
          else
          {  
        document.getElementById('frmdownload').src=req.responseText;
        document.getElementById('frmdownload').style.display = "none";
        //document.getElementById('frmdownload').submit();
        }
      } else {
        alert("Problem: " + req.statusText);
      }
    }
  }

