function FileProgress(file, targetID) {
	this.fileProgressID = file.id;
	this.fileData = file;
	this.fileProgressWrapper = document.getElementById(this.fileProgressID);
	if (!this.fileProgressWrapper) {
		$('#' + targetID).prepend('<div id="' + this.fileProgressID + '" class="item"><div class="b9 b9-active"><div class="b9-w1"><div class="b9-w2"><div class="b9-w3"><div class="b9-w4"><div class="b9-w5"><div class="b9-w6"><div class="b9-w7"><div id="' + this.fileProgressID + '_el" class="b9-w8">' + '<div class="progressBarInProgress" style=""></div><div class="progressBarStatus"></div><span class="progressName">' + file.name + '</span>&nbsp;<img id="' + this.fileProgressID + '_cancel" class="inline progressCancel" src="/images/i/swfupload/cancel.gif" alt="" />' + '</div></div></div></div></div></div></div></div></div></div>');
		this.fileProgressWrapper = x.gebi(this.fileProgressID);
		this.fileProgressElement = x.gebi(this.fileProgressID + '_el');
	} else {
		this.fileProgressElement = x.gebi(this.fileProgressID + '_el');
	}
}
FileProgress.prototype.setProgress = function (percentage) {
	this.fileProgressWrapper.childNodes[0].className = 'b9 b9-active';
	this.fileProgressElement.childNodes[0].className = "progressBarInProgress";
	this.fileProgressElement.childNodes[0].style.width = percentage + "%";
};
FileProgress.prototype.setComplete = function () {
	this.fileProgressWrapper.childNodes[0].className = 'b9';
	this.fileProgressElement.childNodes[0].className = "progressBarComplete";
	this.fileProgressElement.childNodes[0].style.width = "";
	
	this.disappear();
};
FileProgress.prototype.setError = function () {
	this.fileProgressWrapper.title = SWFUpload.msg('block_close');
	this.fileProgressWrapper.childNodes[0].className = 'b9 b9-error';
	this.fileProgressElement.childNodes[0].className = "progressBarError";
	this.fileProgressElement.childNodes[0].style.width = "";

	var oSelf = this;
	$(this.fileProgressWrapper).click(function() {
		$(oSelf.fileProgressWrapper).fadeOut('fast');
	});
};
FileProgress.prototype.setCancelled = function () {
	this.fileProgressWrapper.title = SWFUpload.msg('block_close');
	this.fileProgressWrapper.childNodes[0].className = 'b9 b9-error';
	this.fileProgressElement.childNodes[0].className = "progressBarError";
	this.fileProgressElement.childNodes[0].style.width = "";

	var oSelf = this;
	$(this.fileProgressWrapper).click(function() {
		$(oSelf.fileProgressWrapper).fadeOut('fast');
	});
};
FileProgress.prototype.setStatus = function (status) {
	this.fileProgressElement.childNodes[1].innerHTML = status;
};

FileProgress.prototype.toggleCancel = function (show, swfUploadInstance) {
	if (swfUploadInstance && x.gebi(this.fileProgressID + '_cancel')) {
		var fileID = this.fileProgressID;
		x.gebi(this.fileProgressID + '_cancel').onclick = function () {
			swfUploadInstance.cancelUpload(fileID);
			return false;
		};
	}
};

FileProgress.prototype.disappear = function () {
	if (fileupload.customSettings.previewUrl) reload_content(this.fileProgressWrapper.id, fileupload.customSettings.previewUrl + this.fileData.serverData);
};

