//<!-- JS Download Code v1.0 - All rights reserved -->
function js_download(fileName)
{
  //alert('js_download('+fileName+')');
  var fileUrl = 'assets/'+fileName;
  //alert('fileUrl : '+fileUrl);
  newDLNow(fileUrl);
}

function newDLNow(fileUrl)
{
  var isIe = (window.navigator.userAgent.toUpperCase().indexOf('MSIE') != -1);

  if (!isIe) // Not IE
  {
    //alert('Browser is not IE');
    // first try to download file in same window
    location.href = fileUrl;
  }
  else
  {
    //alert('Browser is IE');
    var myDLWindow = window.open('download_window.php?fileUrl='+fileUrl,'_blank','width=300,height=150');
  }

}

function dlNow(file,redUrl,extUrl)
{
    // skip if external url or old browser
   // if (extUrl == 0 && document.readyState) {
        // first try to download file in same window
   //     location.href = file;
        // mozilla readyState is always undefined
        // safari readyState is always complete
        // ie readyState is loading -> interactive -> complete
   //     if (document.readyState && document.readyState == 'loading') {
            // possible to detect when download dialog starts
            // check readyState every 250ms and
            // redirect to post download page with initiate download disabled
    //        setTimeout('dlComplete(\'' + redUrl + '%3Fidl=n\')', 250);
    //        return false;
    //    }
    //}
    // not possible to detect when download dialog starts
    // just follow href to post download page and let it initiate the download
    //location.href = redUrl;
    //return true;
    newDLNow(file,redUrl,extUrl);
    return false;
}

//<!-- End of JS Download Code v1.0 -->
