﻿function ImgOver(ImgName, SrcName)
{
  if ((ImgName == "") || (SrcName == ""))
  {
    return true;
  }
  if (document.images)
  {
    document[ImgName].src = eval(SrcName + "_down.src");
  }
  window.status = ImgName + "." + SrcName;
}

function ImgOut(ImgName, SrcName)
{
  if ((ImgName == "") || (SrcName == ""))
  {
    return true;
  }
  if (document.images)
  {
    document[ImgName].src = eval(SrcName + "_up.src");
  }
  window.status = "";
}

function Download(FileName, NewWindow)
{
  var type = location.href.substring(0,5);
  var remoteftproot;
  var localftproot = "file://P:/Internet/WebSites/Programming Systems/www.artbv.nl/";
  var www_root_products = location.href.lastIndexOf("products");
  var www_root_support = location.href.lastIndexOf("support");
  var domain;
  var www_domain_artbvnl = location.href.lastIndexOf("artbv.nl/");
  var www_domain_artbveu = location.href.lastIndexOf("artbv.eu/");
  var www_domain_artprogsyscom = location.href.lastIndexOf("artprogsys.com/");

  if (www_domain_artbvnl > 0)
  {
	domain = "artbv.nl/";
  }
  else
  {
    if (www_domain_artbveu > 0)
    {
      domain = "artbv.eu/";
    }
    else
    {
      if (www_domain_artprogsyscom > 0)
      {
        domain = "artprogsys.com/";
      }
      else
      {
	    type = "Domain_Decode";
      }
    }
  }

  if (type == "http:")
  {
	remoteftproot = "http://download." + domain;
  }
  else
  {
    if (type == "file:")
    {
      remoteftproot = localftproot + "ftp_artbv/";
    }
    else
    {
	  if (type != "Domain_Decode")
	  {
	    type = "Location_Decode:" + type;
	  }

      remoteftproot = "/DOWNLOAD_ERROR:" + type +
                      "_SOURCE:" + location.href + 
                      "_REQUEST:";
      alert("Page location: " + location.href + "\n" +
            "Page type: " + type + "\n" +
            "Content is: " + "UNKNOWN!\n" +
            "Domain artbv.nl: " + www_domain_artbvnl + "\n" +
            "Domain artbv.eu: " + www_domain_artbveu + "\n" +
            "\n" +
            "Selected file: " + FileName + "\n");
    }
  }

/*
  alert("Location.href: " + location.href + "\n" +
        "'products' pos: " + www_root_products + "\n" +
        "'support' pos: " + www_root_support + "\n" +
        "Domain artbv.nl: " + www_domain_artbvnl + "\n" +
        "Domain artbv.eu: " + www_domain_artbveu + "\n" +
        "ftp site: " + remoteftproot + "\n" +
        "file name: " + FileName + "\n" +
        "Total: " + remoteftproot + FileName);
*/
  if (NewWindow == 0)
  {
    document.location.href = remoteftproot + FileName;
  }
  else
  {
    window.open(remoteftproot + FileName);
  }
}

function stopError()
{
  return true;
}

function GenerateImages(DirLevel)
{
  if (DirLevel == "")
  {
    DirLevel = "../../../";
  }

  if (document.images)
  {
    pdf_down     = new Image();
    pdf_up       = new Image();
    pdf_down.src = DirLevel + "images/pdffile_d.gif";
    pdf_up.src   = DirLevel + "images/pdffile_u.gif";
    
    exe_down     = new Image();
    exe_up       = new Image();
    exe_down.src = DirLevel + "images/exefile_d.gif";
    exe_up.src   = DirLevel + "images/exefile_u.gif";

    txt_down     = new Image();
    txt_up       = new Image();
    txt_down.src = DirLevel + "images/txtfile_d.gif";
    txt_up.src   = DirLevel + "images/txtfile_u.gif";

    win_down     = new Image();
    win_up       = new Image();
    win_down.src = DirLevel + "images/winexe_d.gif";
    win_up.src   = DirLevel + "images/winexe_u.gif";

    dos_down     = new Image();
    dos_up       = new Image();
    dos_down.src = DirLevel + "images/dosexe_d.gif";
    dos_up.src   = DirLevel + "images/dosexe_u.gif";

    zip_down     = new Image();
    zip_up       = new Image();
    zip_down.src = DirLevel + "images/zipfile_d.gif";
    zip_up.src   = DirLevel + "images/zipfile_u.gif";
  }
}

window.onerror = stopError;

