//
//	Use this set of routines to pop up a file upload tool.
// Once the file is found, populate the specified text/hidden fields with
// the chosen value.
//
var uploaders = [];

//
//  An uploader object handles the GUI heavy lifting.
//
function uploader(fileTarget) {
//
//  Define the method to handle displaying a finder popup:
//
  this.popup = uploaderPopup;

//
//  Validate the input parameters. One parameter must have been specified
// (target field to filename).
//
  if ( !fileTarget ) {
    return(uploader_error("Error calling uploader: No target field specified."));
  }
  if ( fileTarget.value == null ) {
    return(uploader_error("Error calling uploader: Parameter specified is not valid target control"));
  }
  this.fileTarget = fileTarget;

// register in global collections
  this.id = uploaders.length;
  uploaders[this.id] = this;

  return true;
}

function uploaderPopup () {
  var uploaderWindow = window.open('/cfs/uploadForm.jsp?id=' + this.id,
    'fileUploader',
    'width=800,height=125,status=no,resizable=yes,scrollbars=no,top=200,left=200,dependent=yes,alwaysRaised=yes'
  );
  uploaderWindow.opener = window;
  uploaderWindow.focus();
}

