transfers = []; 	// keeps track of transfers

transfers.add = function(taskID, fileName, filePath, size, offset, progressRow, viewWhenComplete) {
    this.push(new TransferInfo(taskID, fileName, filePath, size, offset, progressRow, viewWhenComplete));
};
transfers.remove = function(propertyName, propertyValue) {
    var index = this.findIndex(propertyName, propertyValue);
    if (index !== null) {
        this.splice(index, 1);
    }
};
transfers.findIndex = function(propertyName, propertyValue) {
    for (var i in this) {
        if (this[i][propertyName] === propertyValue) {
            return i;
        }
    }
    return null;
};
transfers.find = function(propertyName, propertyValue) {
    var index = this.findIndex(propertyName, propertyValue);
    if (index !== null) {
        return this[index];
    } else {
        return null;
    }
};

function TransferInfo(taskID, fileName, filePath, size, offset, progressRow, viewWhenComplete) {
    this.taskID = Number(taskID);
    this.fileName = String(fileName);
    this.filePath = String(filePath);
    this.size = Number(size);
    this.offset = Number(offset);
    this.progressRow = progressRow;
    this.viewWhenComplete = viewWhenComplete;
}

