ASPxClientUploadControlIDSuffix = {
 FlagHiddenInput: "_dxeUpload",
 ProgressKeyHiddenName: "DXUploadingKey", 
 ErrorRow: "_ErrR_",
 ErrorRowTemplate: "_ErrR_RT",
 UploadIFrame: "_UploadIframe",
 FileInput: "_Input_",
 FileInputTemplate: "_Input_T",
 AddUploadButtonsSeparator: "_AddUploadR",
 AddUploadButtonsPanelRow: "_AddUploadPanelR",
 InputCountHidden: "_IC",
 AddButtonCell: "_Add",
 UploadButtonCell: "_Upload",
 RemoveButtonCell: "_Remove_",
 CancelButtonCell: "_Cancel",
 CommonErrorDiv: "_CErr",
 ButtonImageIdPostfix: "Img",
 UploadInputsTable: "_UploadInputs",
 ProgressPanel: "_ProgressPanel",
 ProgressControl: "_UCProgress"
};
var __aspxErrorTextResponsePrefix = "DXER:";
var __aspxRemoveButtonCellClassName = "dxRB";
var __aspxProgressInfoQueryParamName = "DXProgressInfo";
var __aspxUploadingCallbackQueryParamName = "DXUploadingCallback";
var __aspxProgressHandlerKeyQueryParamName = "DXProgressHandlerKey";
var __aspxCancelUploadFakeQueryParamName = "DXFakeQueryParam";
ASPxClientUploadControl = _aspxCreateClass(ASPxClientControl, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.generalErrorText = "";
  this.invalidWindowsPathErrorText = "";
  this.fileInputSpacing = "";
  this.progressHandlerPage = "";
  this.uploadingKey = null;
  this.isInCallback = false;
  this.isCancel = false;
  this.uploadingTimerID = null;
  this.isProgressWaiting = false;
  this.templateDisabledRemoveItem = null;
  this.FileUploadComplete = new ASPxClientEvent();
  this.FilesUploadComplete = new ASPxClientEvent();
  this.FileUploadStart = new ASPxClientEvent();
  this.UploadingProgressChanged = new ASPxClientEvent();
  this.TextChanged = new ASPxClientEvent();
  this.FileInputCountChanged = new ASPxClientEvent();
 },
 Initialize: function() {
  ASPxClientControl.prototype.Initialize.call(this);
  if (__aspxFirefox)
   this.CorrectFileInputSize();
  this.CreateClearFileInput();
  if (__aspxOpera && !_aspxIsExists(frames[this.GetFakeIframeName()]))
   this.ReinitializeIFrame(this.GetFakeIframe());
  _aspxAttachEventToElement(__aspxIE ? this.GetFakeIframeElement() : this.GetFakeIframe(), "load",
     new Function("aspxFakeUploadIframeOnLoad('" + this.name + "');"));
  this.InitializeForm();
  this.InitializeTemplates();
  this.GetIFrameUrl();
 },
 InitializeTemplates: function() {
  this.fileInputRowTemplateNode = this.GetFileInputRowTemplate().cloneNode(true);
  this.errorRowTemplateNode = this.GetErrorRowTemplate().cloneNode(true);
  this.fileInputSeparatorTemplateNode = this.GetFileInputSeparatorRowTemplate().cloneNode(true);
  _aspxSetElementDisplay(this.fileInputRowTemplateNode, true);
  _aspxSetElementDisplay(this.fileInputSeparatorTemplateNode, true);
 },
 InitializeForm: function() {
  var form = _aspxGetParentByTagName(this.GetMainElement(), "FORM");
  if (form)
   form.enctype = form.encoding = "multipart/form-data";
 },
 ReinitializeIFrame: function(iframe) {
  var divElem = document.createElement("DIV");
  _aspxSetElementDisplay(divElem, false);
  var parentIframe = iframe.parentNode;
  parentIframe.appendChild(divElem);
  divElem.appendChild(iframe);
 },
 CreateClearFileInput: function() {
  this.clearFileInputTempalteHtml = _aspxGetChildByTagName(this.GetFileInputRowTemplate(), "TD", 0).innerHTML;
 },
 CorrectFileInputSize: function() {
  var width = this.GetInputWidth();
  var fontSize = this.GetInputFontSize();
  var size = this.FindInputSize(width, fontSize);
  this.GetFileInputElement("T").size = size;
  var fileInputCount = this.GetFileInputCountInternal();
  for (var i = 0; i < fileInputCount; i++)
   this.GetFileInputElement(i).size = size;
 },
 GetInputWidth: function() {
  var width = 0;
  if (this.GetFileInputCountInternal() > 0)
   width = this.GetFileInputElement(0).clientWidth;
  else {
   _aspxSetElementDisplay(this.GetFileInputRowTemplate(), true);
   width = this.GetFileInputElement("T").clientWidth;
   _aspxSetElementDisplay(this.GetFileInputRowTemplate(), false);
  }
  return width;
 },
 GetInputFontSize: function() {
  if (this.GetFileInputCountInternal() > 0)
   return _aspxGetCurrentStyle(this.GetFileInputElement(0)).fontSize;
  else
   return _aspxGetCurrentStyle(this.GetFileInputElement("T")).fontSize;
 },
 FindInputSize: function(width, fontSize) {
  var spanInput = document.createElement("SPAN");
  document.body.appendChild(spanInput);
  var fakeInput = document.createElement("INPUT");
  fakeInput.type = "file";
  fakeInput.size = 0;
  fakeInput.style.fontSize = fontSize;
  spanInput.appendChild(fakeInput);
  var stepSize = 1;
  while (true) {
   var previousInputWidth = spanInput.offsetWidth;
   fakeInput.size += stepSize;
   if(previousInputWidth == spanInput.offsetWidth) {
    fakeInput.size = 0;
    break;
   }
   if (spanInput.offsetWidth == width)
    break;
   else if (spanInput.offsetWidth > width) {
    if (stepSize > 1) {
     fakeInput.size -= stepSize;
     stepSize = 1;
    } else {
     fakeInput.size -= 1;
     break;
    }
   }
   else
    stepSize *= 2;
  }
  var inputSize = fakeInput.size;
  _aspxRemoveElement(fakeInput);
  _aspxRemoveElement(spanInput);
  return inputSize;
 },
 GetSelectedInputFileCount: function() {
  if (!_aspxIsExists(this.selectedInputFileCount)) {
   this.selectedInputFileCount = 0;
   var fileInputCount = this.GetFileInputCountInternal();
   for (var i = 0; i < fileInputCount; i++)
    if (this.GetFileInputElement(i).value != "")
    this.selectedInputFileCount++;
  }
  return this.selectedInputFileCount;
 },
 GetFileInputCountInternal: function() {
  var element = this.GetInputCountHiddenField();
  return parseInt(element.value, 10);
 },
 SetFileInputCountInternal: function(value) {
  this.GetInputCountHiddenField().value = value;
 },
 GetInputCountHiddenField: function() {
  if (!_aspxIsExists(this.inputCountHiddenField)) {
   var id = this.name + ASPxClientUploadControlIDSuffix.InputCountHidden;
   this.inputCountHiddenField = _aspxGetElementById(id);
  }
  return this.inputCountHiddenField;
 },
 GetProgressInfoKeyHiddenField: function() {
  if (!_aspxIsExists(this.progressKeyHiddenField)) {
   this.progressKeyHiddenField = _aspxGetElementById(ASPxClientUploadControlIDSuffix.ProgressKeyHiddenName);
   if (!_aspxIsExists(this.progressKeyHiddenField) && this.uploadingKey) {
    this.progressKeyHiddenField = _aspxCreateHiddenField(ASPxClientUploadControlIDSuffix.ProgressKeyHiddenName,
                  ASPxClientUploadControlIDSuffix.ProgressKeyHiddenName);
    this.progressKeyHiddenField.value = this.uploadingKey;
    document.body.appendChild(this.progressKeyHiddenField);
   }
  }
  return this.progressKeyHiddenField;
 },
 GetIFrameUrl: function() {
  if (!_aspxIsExists(this.iframeUrl)) {
   var iframe = __aspxIE ? this.GetFakeIframeElement() : this.GetFakeIframe();
   this.iframeUrl = iframe.attributes["src"].value;
  }
  return this.iframeUrl;
 },
 SetIFrameUrl: function(url) {
  var iframe = __aspxIE ? this.GetFakeIframeElement() : this.GetFakeIframe();
  iframe.attributes["src"].value = url;
 },
 GetProgressInfoKey: function() {
  var field = this.GetProgressInfoKeyHiddenField();
  return _aspxIsExists(field) ? field.value : null;
 },
 GetErrorRow: function(index) {
  return this.GetChild(ASPxClientUploadControlIDSuffix.ErrorRow + index);
 },
 GetErrorCell: function(index) {
  return _aspxGetElementsByTagName(this.GetErrorRow(index), "td")[0];
 },
 GetErrorRowTemplate: function() {
  return this.GetChild(ASPxClientUploadControlIDSuffix.ErrorRowTemplate);
 },
 GetFakeIframe: function() {
  var name = this.GetFakeIframeName();
  return __aspxIE ? frames[name] : _aspxGetElementById(name);
 },
 GetFakeIframeName: function() {
  return this.name + ASPxClientUploadControlIDSuffix.UploadIFrame;
 },
 GetFakeIframeElement: function() {
  return this.GetFakeIframe().frameElement;
 },
 GetFakeIframeDocument: function() {
  return __aspxIE ? this.GetFakeIframe().document : this.GetFakeIframe().contentDocument;
 },
 GetFakeIframeResponseString: function() {
  return _aspxDecodeHtml(this.GetFakeIframeDocument().body.innerHTML);
 },
 GetFileInputElement: function(index) {
  return _aspxGetInputElementById(this.name + ASPxClientUploadControlIDSuffix.FileInput + index);
 },
 GetFileInputRow: function(index) {
  return _aspxGetParentByTagName(this.GetFileInputElement(index), "TR");
 },
 GetFileInputRowTemplate: function() {
  var inputTemplate = this.GetChild(ASPxClientUploadControlIDSuffix.FileInputTemplate);
  return _aspxGetParentByTagName(inputTemplate, "TR");
 },
 GetFileInputsTBody: function() {
  if (!_aspxIsExists(this.tbody))
   this.tbody = _aspxGetParentByTagName(this.GetFileInputRowTemplate(), "TBODY");
  return this.tbody;
 },
 GetUploadInputsTable: function() {
  return this.GetChild(ASPxClientUploadControlIDSuffix.UploadInputsTable);
 },
 GetProgressPanel: function() {
  return this.GetChild(ASPxClientUploadControlIDSuffix.ProgressPanel);
 },
 GetProgressControl: function() {
  if (!_aspxIsExists(this.progressControl)) {
   var name = this.name + ASPxClientUploadControlIDSuffix.ProgressControl;
   this.progressControl = aspxGetControlCollection().Get(name);
  }
  return this.progressControl;
 },
 GetRemoveButtonCell: function(index) {
  return this.GetRemoveButtonCellByInput(this.GetFileInputElement(index));
 },
 GetRemoveButtonCellByInput: function(input) {
  return _aspxGetChildsByClassName(_aspxGetParentByTagName(input, "TR"), __aspxRemoveButtonCellClassName)[0];
 },
 GetAddButtonCell: function() {
  return this.GetChild(ASPxClientUploadControlIDSuffix.AddButtonCell);
 },
 GetUploadButtonCell: function() {
  return this.GetChild(ASPxClientUploadControlIDSuffix.UploadButtonCell);
 },
 GetCancelButtonCell: function() {
  return this.GetChild(ASPxClientUploadControlIDSuffix.CancelButtonCell);
 },
 GetAddButtonLink: function() {
  return _aspxGetChildByTagName(this.GetAddButtonCell(), "A", 0);
 },
 GetUploadButtonLink: function() {
  return _aspxGetChildByTagName(this.GetUploadButtonCell(), "A", 0);
 },
 GetAddUploadButtonsSeparatorRow: function() {
  return this.GetChild(ASPxClientUploadControlIDSuffix.AddUploadButtonsSeparator);
 },
 GetAddUploadButtonsPanelRow: function() {
  return this.GetChild(ASPxClientUploadControlIDSuffix.AddUploadButtonsPanelRow);
 },
 GetFileInputSeparatorRow: function(index) {
  if (this.fileInputSpacing == "" || this.GetFileInputCountInternal() == 1)
   return null;
  if (!_aspxIsExists(index))
   index = 0;
  var ret = null;
  var firstErrorRow = this.GetErrorRow(index);
  if (_aspxIsExists(firstErrorRow)) {
   var parent = firstErrorRow.parentNode;
   var rowIndex = _aspxArrayIndexOf(parent.childNodes, firstErrorRow);
   var element = parent.childNodes[rowIndex + 1];
   if (!_aspxIsExists(element.id) || (element.id == ""))
    ret = parent.childNodes[rowIndex + 1];
  }
  return ret;
 },
 GetFileInputSeparatorRowTemplate: function() {
  if (this.fileInputSpacing == "")
   return null;
  var errRowTemplate = this.GetErrorRowTemplate();
  var parent = errRowTemplate.parentNode;
  var errRowIndex = _aspxArrayIndexOf(parent.childNodes, errRowTemplate);
  return parent.childNodes[errRowIndex + 1];
 },
 GetCommonErrorDivElement: function() {
  return this.GetChild(ASPxClientUploadControlIDSuffix.CommonErrorDiv);
 },
 SetEnabledInternal: function(enabled) {
  for (var i = 0; i < this.GetFileInputCountInternal(); i++) {
   var inputElement = this.GetFileInputElement(i);
   if (_aspxIsExists(inputElement)) {
    inputElement.disabled = !enabled;
    this.SetButtonEnabled(this.GetRemoveButtonCell(i), enabled);
   }
  }
  var addButtonCell = this.GetAddButtonCell();
  if (_aspxIsExists(addButtonCell))
   this.SetButtonEnabled(addButtonCell, enabled);
  var uploadButtonCell = this.GetUploadButtonCell();
  if (_aspxIsExists(uploadButtonCell))
   this.SetButtonEnabled(uploadButtonCell, enabled);
 },
 SetButtonEnabled: function(element, enabled) {
  this.ChangeButtonEnabledState(element, enabled);
  this.ChangeButtonEnabledAttributes(element, _aspxChangeAttributesMethod(enabled), enabled);
 },
 GetIsResponseValid: function() {
  var ret = false;
  try {
   if (eval(this.GetFakeIframeResponseString()) != null)
    ret = true;
  }
  catch (e) {
   if (__aspxIE)
    this.GetFakeIframe().window.location = this.GetIFrameUrl(); 
  }
  return ret;
 },
 GetValue: function(index) {
  var fileInputElement = this.GetFileInputElement(index);
  if (_aspxIsExists(fileInputElement))
   return fileInputElement.value;
  return null;
 },
 ChangeButtonEnabledState: function(element, enabled) {
  if (_aspxIsExists(element))
   aspxGetStateController().SetElementEnabled(element, enabled);
 },
 ChangeButtonEnabledAttributes: function(element, method, enabled) {
  if (_aspxIsExists(element)) {
   method(element, "onclick");
   if (!__aspxIE && enabled)
    element.onclick = new Function(element.getAttribute("onclick"));
  }
 },
 AddFileInput: function() {
  var tBody = this.GetFileInputsTBody();
  var addUploadButtonsElement = this.GetAddUploadButtonsSeparatorRow();
  if (addUploadButtonsElement == null)
   addUploadButtonsElement = this.GetAddUploadButtonsPanelRow();
  if (this.fileInputSpacing != "" && this.GetFileInputCountInternal() != 0) {
   var separatorRow = this.fileInputSeparatorTemplateNode.cloneNode(true);
   tBody.insertBefore(separatorRow, addUploadButtonsElement);
  }
  tBody.insertBefore(this.CreateFileInputRow(this.GetFileInputCountInternal()), addUploadButtonsElement);
  tBody.insertBefore(this.CreateErrorRow(this.GetFileInputCountInternal()), addUploadButtonsElement);
  this.SetFileInputCountInternal(this.GetFileInputCountInternal() + 1);
  var element = this.GetAddUploadButtonsSeparatorRow();
  if (_aspxIsExists(element) && this.GetFileInputCountInternal() > 0 && !_aspxGetElementDisplay(element))
   _aspxSetElementDisplay(element, true);
  this.RaiseFileInputCountChanged();
 },
 RemoveFileInput: function(index) {
  var tBody = this.GetFileInputsTBody();
  _aspxRemoveElement(this.GetFileInputSeparatorRow((index == 0) ? index : index - 1));
  _aspxRemoveElement(this.GetFileInputRow(index));
  _aspxRemoveElement(this.GetErrorRow(index));
  this.RedefineAttributtes(index + 1);
  this.SetFileInputCountInternal(this.GetFileInputCountInternal() - 1);
  var element = this.GetAddUploadButtonsSeparatorRow();
  if (_aspxIsExists(element) && this.GetFileInputCountInternal() == 0 && _aspxGetElementDisplay(element))
   _aspxSetElementDisplay(element, false);
  this.RaiseFileInputCountChanged();
 },
 RedefineAttributtes: function(startIndex) {
  var tBody = this.GetFileInputsTBody();
  for (var index = startIndex; index < this.GetFileInputCountInternal(); index++) {
   var newIndex = index - 1;
   var fileInput = this.GetFileInputElement(index);
   var removeButton = this.GetRemoveButtonCell(index);
   var errorRow = this.GetErrorRow(index);
   this.RedefineInputAttributes(fileInput, newIndex);
   this.RedefineRemoveAttributes(removeButton, newIndex);
   errorRow.id = this.name + ASPxClientUploadControlIDSuffix.ErrorRow + newIndex;
  }
 },
 RedefineInputAttributes: function(inputElement, index) {
  inputElement.id = this.name + ASPxClientUploadControlIDSuffix.FileInput + index;
  inputElement.name = inputElement.id;
  inputElement.onchange = new Function("aspxUTextChanged('" + this.name + "'," + index + ");");
 },
 RedefineRemoveAttributes: function(removeButton, newIndex) {
  if (_aspxIsExists(removeButton)) {
   var newId = this.name + ASPxClientUploadControlIDSuffix.RemoveButtonCell + newIndex;
   removeButton.id = newId;
   var onclick = "aspxURemoveFileInputClick('" + this.name + "'," + newIndex + ");";
   removeButton.setAttribute("onclick", onclick);
   removeButton.onclick = new Function(onclick);
   var img = _aspxGetChildByTagName(removeButton, "IMG", 0);
   if (_aspxIsExists(img))
    img.id = newId + ASPxClientUploadControlIDSuffix.ButtonImageIdPostfix;
  }
 },
 SetAddButtonTextInternal: function(text) {
  var link = this.GetAddButtonLink();
  if (_aspxIsExists(link))
   link.innerHTML = text;
 },
 SetUploadButtonTextInternal: function(text) {
  var link = this.GetUploadButtonLink();
  if (_aspxIsExists(link))
   link.innerHTML = text;
 },
 GetAddButtonTextInternal: function() {
  var link = this.GetAddButtonLink();
  if (_aspxIsExists(link))
   return link.innerHTML;
  return null;
 },
 GetUploadButtonTextInternal: function() {
  var link = this.GetUploadButtonLink();
  if (_aspxIsExists(link))
   return link.innerHTML;
  return null;
 },
 CreateFileInputRow: function(index) {
  var row = this.fileInputRowTemplateNode.cloneNode(true);
  var fileInput = _aspxGetChildByTagName(row, "INPUT", 0);
  fileInput.id = this.name + ASPxClientUploadControlIDSuffix.FileInput + index;
  fileInput.name = fileInput.id;
  if (_aspxIsExists(fileInput.onchange))
   fileInput.onchange = new Function("aspxUTextChanged('" + this.name + "'," + index + ");");
  var removeButton = this.GetRemoveButtonCellByInput(fileInput);
  if (_aspxIsExists(removeButton)) {
   removeButton.id = this.name + ASPxClientUploadControlIDSuffix.RemoveButtonCell + index;
   var onclick = "aspxURemoveFileInputClick('" + this.name + "'," + index + ");";
   removeButton.setAttribute("onclick", onclick);
   removeButton.onclick = new Function(onclick);
   var img = _aspxGetChildByTagName(removeButton, "IMG", 0);
   if (_aspxIsExists(img))
    img.id = removeButton.id + ASPxClientUploadControlIDSuffix.ButtonImageIdPostfix;
   this.CreateRemoveDisabledState(index);
  }
  return row;
 },
 CreateRemoveDisabledState: function(index) {
  if (_aspxIsExists(this.templateDisabledRemoveItem)) {
   aspxGetStateController().AddDisabledItem(this.name + ASPxClientUploadControlIDSuffix.RemoveButtonCell + index,
    this.templateDisabledRemoveItem.className, this.templateDisabledRemoveItem.cssText,
    this.templateDisabledRemoveItem.postfixes, this.templateDisabledRemoveItem.imageUrls,
    this.templateDisabledRemoveItem.imagePostfixes);
  }
 },
 CreateErrorRow: function(index) {
  var row = this.errorRowTemplateNode.cloneNode(true);
  row.id = this.name + ASPxClientUploadControlIDSuffix.ErrorRow + index;
  return row;
 },
 UploadFileFromUser: function() {
  if (!this.isInCallback && !this.AreEmptyInputs()) {
   if ((__aspxIE && !this.ValidateWindowsFileNames()) || this.OnStartFileUpload()) return;
   var form = _aspxGetServerForm();
   var sourceTarget = form.target;
   var soureActionString = form.action;
   var progressInfoKey = this.GetProgressInfoKey();
   var prefix = form.action.indexOf("?") >= 0 ? "&" : "?";
   if (_aspxIsExists(progressInfoKey))
    form.action += prefix + __aspxProgressInfoQueryParamName + "=" + progressInfoKey;
   prefix = form.action.indexOf("?") >= 0 ? "&" : "?";
   form.action += prefix + __aspxUploadingCallbackQueryParamName + "=" + this.name;
   form.target = this.GetFakeIframe().name;
   var isInternalErrorOccured = false;
   try {
    form.submit();
   }
   catch (e) {
    isInternalErrorOccured = true;
    this.WriteResponseString(__aspxErrorTextResponsePrefix + this.generalErrorText);
    this.OnCompleteFileUpload();
   }
   if (!isInternalErrorOccured)
    this.SetEnabledInternal(false);
   form.target = sourceTarget;
   form.action = soureActionString;
   if (this.IsUploadProcessingEnabled())
    this.BeginProcessUploading();
  }
 },
 CancelUploadingFileFromUser: function() {
  if (this.isInCallback) {
   var iFrame = __aspxIE ? this.GetFakeIframeElement() : this.GetFakeIframe();
   this.isCancel = true;
   var iframeUrl = this.GetIFrameUrl();
   if (__aspxOpera)
    this.SetIFrameUrl(iframeUrl + "&" + __aspxCancelUploadFakeQueryParamName + "=" + (new Date()).valueOf());
   this.SetIFrameUrl(iframeUrl);
   this.EndProcessUploading();
  }
 },
 IsUploadProcessingEnabled: function() {
  return _aspxIsExists(this.GetProgressInfoKey());
 },
 IsShowProgressPanel: function() {
  return _aspxIsExists(this.GetProgressPanel());
 },
 CreateXmlHttpRequestObject: function() {
  if (typeof (XMLHttpRequest) != 'undefined')
   return new XMLHttpRequest();
  else if (typeof (ActiveXObject) != 'undefined')
   return new ActiveXObject('Microsoft.XMLHTTP');
  return null;
 },
 BeginProcessUploading: function() {
  if (this.IsShowProgressPanel())
   window.setTimeout('aspxShowProgressInfoPanel(\'' + this.name + '\')', 600);
  this.UpdateCommonErrorDiv("", false);
  this.CleanUploadingInfoPanel();
  this.uploadingTimerID = _aspxSetInterval('aspxUploadProcessing(\'' + this.name + '\')', 1000);
 },
 EndProcessUploading: function() {
  if (this.IsShowProgressPanel())
   this.ShowProgressInfoPanel(false);
  this.CleanUploadingInfo();
  this.selectedInputFileCount = null;
  if (this.uploadingTimerID != null)
   this.uploadingTimerID = _aspxClearInterval(this.uploadingTimerID);
 },
 IsServerError: function(info) {
  return _aspxIsExists(info.errorText) && info.errorText != "";
 },
 GetUploadingInfo: function() {
  if (this.uploadingInfo == null) {
   this.uploadingInfo = new Object();
   this.CleanUploadingInfo();
  }
  return this.uploadingInfo;
 },
 CleanUploadingInfo: function() {
  this.uploadingInfo.isUploadingStart = false;
  this.uploadingInfo.isComplete = false;
  this.uploadingInfo.currentFileName = "";
  this.uploadingInfo.currentContentType = "";
  this.uploadingInfo.uploadedLength = 0;
  this.uploadingInfo.totalLength = 0;
  this.uploadingInfo.progress = 0;
  this.uploadingInfo.errorText = "";
 },
 UploadProcessing: function() {
  if (this.isProgressWaiting) return;
  this.isProgressWaiting = true;
  var xmlHttp = this.CreateXmlHttpRequestObject();
  if (xmlHttp == null) {
   this.isProgressWaiting = false;
   this.EndProcessUploading();
   return;
  }
  if (!this.GetUploadingInfo().isComplete) {
   var url = this.progressHandlerPage + '?' + __aspxProgressHandlerKeyQueryParamName + '=' + this.GetProgressInfoKey();
   xmlHttp.open('GET', url, false);
   xmlHttp.send('');
   if (xmlHttp.status == 200) {
    this.UpdateUploadingInfo(xmlHttp.responseXML);
    var info = this.GetUploadingInfo();
    if (this.IsServerError(info)) {
     this.UpdateCommonErrorDiv(info.errorText, true);
     this.ClearErrorMessageCell();
     this.Cancel();
     this.RaiseFilesUploadComplete();
     this.UpdateUploadingInfo(null);
    }
    else {
     if (info.isUploadingStart || info.isComplete) {
      if (this.IsShowProgressPanel())
       this.UpdateUploadingInfoPanel(info);
      this.OnUploadingProgressChanged(this.GetSelectedInputFileCount(), info);
     }
    }
   }
  }
  if (!this.GetUploadingInfo().isUploadingStart && !this.isInCallback)
   this.EndProcessUploading();
  this.isProgressWaiting = false;
 },
 UpdateUploadingInfo: function(responseXML) {
  var info = this.GetUploadingInfo();
  if (responseXML == null || this.GetXmlAttribute(responseXML, 'empty') == 'true') {
   if (info.isUploadingStart) {
    info.isUploadingStart = false;
    info.isComplete = true;
    info.progress = 100;
    info.uploadedLength = info.totalLength;
    this.SetButtonEnabled(this.GetCancelButtonCell(), false);
   }
   return;
  }
  info.isUploadingStart = true;
  info.errorText = this.GetXmlAttribute(responseXML, 'errorText');
  info.currentFileName = this.GetXmlAttribute(responseXML, 'fileName');
  info.currentContentType = this.GetXmlAttribute(responseXML, 'contentType');
  info.uploadedLength = parseInt(this.GetXmlAttribute(responseXML, 'size'));
  info.totalLength = parseInt(this.GetXmlAttribute(responseXML, 'totalSize'));
  info.progress = parseInt(this.GetXmlAttribute(responseXML, 'progress'));
 },
 ShowProgressInfoPanel: function(show) {
  var inputsTable = this.GetUploadInputsTable();
  _aspxSetStyleSize(this.GetProgressPanel(), inputsTable.clientWidth, inputsTable.clientHeight);
  _aspxSetElementDisplay(inputsTable, !show);
  _aspxSetElementDisplay(this.GetProgressPanel(), show);
  if (show) {
   var progressControl = this.GetProgressControl();
   if (progressControl != null)
    progressControl.AdjustControl();
  }
  this.SetButtonEnabled(this.GetCancelButtonCell(), true);
 },
 CleanUploadingInfoPanel: function() {
  this.UpdateProgress(0);
 },
 UpdateUploadingInfoPanel: function(info) {
  this.UpdateProgress(info.progress);
 },
 UpdateProgress: function(percent) {
  if (!(percent > 0 && percent <= 100))
   percent = percent > 0 ? 100 : 0;
  var element = this.GetProgressControl();
  if (element != null)
   element.SetPosition(percent);
 },
 AreEmptyInputs: function() {
  for (var i = 0; i < this.GetFileInputCountInternal(); i++)
   if (_aspxTrim(this.GetText(i)) != "") return false;
  return true;
 },
 ClearInputText: function() {
  for (var i = 0; i < this.GetFileInputCountInternal(); i++) {
   if (_aspxIsExistsElement(this.GetFileInputElement(i))) {
    var parentNode = _aspxGetParentByTagName(this.GetFileInputElement(i), "TD");
    parentNode.removeChild(this.GetFileInputElement(i));
    parentNode.innerHTML = this.clearFileInputTempalteHtml;
    this.RedefineInputAttributes(_aspxGetChildByTagName(parentNode, "INPUT", 0), i);
   }
  }
 },
 UpdateCommonErrorDiv: function(text, display) {
  var commonErrorDiv = this.GetCommonErrorDivElement();
  if (_aspxIsExists(commonErrorDiv)) {
   commonErrorDiv.innerHTML = text;
   _aspxSetElementDisplay(commonErrorDiv, display);
  }
 },
 GetXmlAttribute: function(xmlDoc, attrName) {
  return xmlDoc.documentElement.getAttribute(attrName);
 },
 ProcessResponse: function() {
  try {
   return eval(this.GetFakeIframeResponseString());
  }
  catch (e) { }
  return null;
 },
 ClearErrorMessageCell: function() {
  for (var i = 0; i < this.GetFileInputCountInternal(); i++)
   this.UpdateErrorMessageCell(i, "", true);
 },
 UpdateErrorMessageCell: function(index, errorText, isValid) {
  if (_aspxIsExists(this.GetErrorRow(index))) {
   var errorCell = this.GetErrorCell(index);
   _aspxSetElementDisplay(this.GetErrorRow(index), !isValid);
   if (errorText != "")
    errorCell.innerHTML = errorText;
  }
 },
 ValidateWindowsFileNames: function() {
  for (var i = 0; i < this.GetFileInputCountInternal(); i++) {
   if (!ASPxClientUploadControl.IsValidWindowsFileName(_aspxTrim(this.GetText(i)))) {
    alert(this.invalidWindowsPathErrorText.replace("{0}", this.GetText(i)));
    return false;
   }
  }
  return true;
 },
 WriteResponseString: function(responseString) {
  try {
   this.GetFakeIframeDocument().body.innerHTML = responseString;
  }
  catch (e) { }
 },
 OnCompleteFileUpload: function() {
  var responseObj = null;
  if (this.GetIsResponseValid()) {
   responseObj = this.ProcessResponse();
   if (_aspxIsExists(responseObj.isCancel))
    this.isCancel = true;
  }
  else if ((__aspxIE && __aspxBrowserMajorVersion == 6 || __aspxChrome) && this.IsUploadProcessingEnabled())
   this.isCancel = true;
  if (_aspxIsExists(responseObj) && !this.isCancel) {
   for (var i = 0; i < this.GetFileInputCountInternal(); i++) {
    this.UpdateErrorMessageCell(i, responseObj.errorTexts[i], responseObj.isValidArray[i]);
    if (this.GetText(i) != "")
     this.RaiseFileUploadComplete(i, responseObj);
   }
   this.RaiseFilesUploadComplete();
  }
  if (this.IsShowProgressPanel())
   this.UpdateProgress(100);
  if (!this.isCancel)
   this.ClearInputText();
  this.SetEnabledInternal(true);
  this.isInCallback = false;
  this.isCancel = false;
  this.responseHashTable = {};
  if (__aspxIE) {
   try {
    this.GetFakeIframeDocument().write("");
    this.GetFakeIframeDocument().close();
   }
   catch (e) { }
  }
 },
 OnUploadingProgressChanged: function(fileCount, info) {
  this.RaiseUploadingProgressChanged(fileCount, info.currentFileName, info.totalLength, info.uploadedLength, info.progress);
 },
 OnTextChanged: function(index) {
  this.RaiseTextChanged(index);
 },
 OnStartFileUpload: function() {
  var isCancel = this.RaiseFileUploadStart();
  if (!isCancel)
   this.isInCallback = true;
  return isCancel;
 },
 RaiseUploadingProgressChanged: function(fileCount, currentFileName, totalContentLength, uploadedContentLength, progress) {
  if (!this.UploadingProgressChanged.IsEmpty()) {
   var args = new ASPxClientUploadControlUploadingProgressChangedEventArgs(fileCount, currentFileName, totalContentLength, uploadedContentLength, progress);
   this.UploadingProgressChanged.FireEvent(this, args);
  }
 },
 RaiseTextChanged: function(index) {
  if (!this.TextChanged.IsEmpty()) {
   var args = new ASPxClientUploadControlTextChangedEventArgs(index);
   this.TextChanged.FireEvent(this, args);
  }
 },
 RaiseFileUploadComplete: function(index, responseObj) {
  if (!this.FileUploadComplete.IsEmpty()) {
   var args = new ASPxClientUploadControlFileUploadCompleteEventArgs(index, responseObj.isValidArray[index],
    responseObj.errorTexts[index], responseObj.callbackDataArray[index]);
   this.FileUploadComplete.FireEvent(this, args);
  }
 },
 RaiseFilesUploadComplete: function() {
  if (_aspxIsExists(window.aspxGetHtmlEditorsCollection))
   aspxGetHtmlEditorsCollection().RemoveSyncLockedAttribute();
  var args = new ASPxClientEventArgs();
  this.FilesUploadComplete.FireEvent(this, args);
 },
 RaiseFileUploadStart: function() {
  var ret = false;
  if (!this.FileUploadStart.IsEmpty()) {
   var args = new ASPxClientUploadControlFileUploadStartEventArgs(false);
   this.FileUploadStart.FireEvent(this, args);
   ret = args.cancel;
  }
  return ret;
 },
 RaiseFileInputCountChanged: function() {
  if (!this.FileInputCountChanged.IsEmpty()) {
   var args = new ASPxClientEventArgs();
   this.FileInputCountChanged.FireEvent(this, args);
  }
 },
 ClearText: function() {
  this.ClearInputText();
 },
 GetText: function(index) {
  if (!_aspxIsExists(index))
   index = 0;
  var value = this.GetValue(index);
  return value != null ? value : "";
 },
 UploadFile: function() {
  this.UploadFileFromUser();
 },
 Upload: function() {
  this.UploadFileFromUser();
 },
 Cancel: function() {
  this.CancelUploadingFileFromUser();
 },
 GetFileInputCount: function() {
  return this.GetFileInputCountInternal();
 },
 SetAddButtonText: function(text) {
  this.SetAddButtonTextInternal(text);
 },
 SetUploadButtonText: function(text) {
  this.SetUploadButtonTextInternal(text);
 },
 GetAddButtonText: function() {
  return this.GetAddButtonTextInternal();
 },
 GetUploadButtonText: function() {
  return this.GetUploadButtonTextInternal();
 }
});
var windowsFileNameRegExpTemplate = "^([a-zA-Z]\\:|\\\\\\\\[^\\/\\\\:*?\\\"<>|]+\\\\[^\\/\\\\:*?\\\"<>|]+)(\\\\[^\\/\\\\:*?\\\"<>|]+)+(\\.[^\\/\\\\:*?\\\"<>|]+)?$";
windowsRootDirectoryNameRegExpTemplate = "[a-zA-Z]\\:";
ASPxClientUploadControl.IsValidWindowsFileName = function(fileName) {
 var windowsRootDirectoryNameRegExp = new RegExp(windowsRootDirectoryNameRegExpTemplate, "gi");
 var windowsFileNameRegExp = new RegExp(windowsFileNameRegExpTemplate, "gi");
 return (fileName == "" || windowsFileNameRegExp.test(fileName)) || (fileName.length == 3 && windowsRootDirectoryNameRegExp.test(fileName));
}
ASPxClientUploadControlFileUploadStartEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(cancel) {
  this.constructor.prototype.constructor.call(this);
  this.cancel = cancel;
 }
});
ASPxClientUploadControlFileUploadCompleteEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(inputIndex, isValid, errorText, callbackData){
  this.constructor.prototype.constructor.call(this);
  this.inputIndex = inputIndex;
  this.isValid = isValid;
  this.errorText = errorText;
  this.callbackData = callbackData;
 }
});
ASPxClientUploadControlTextChangedEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(inputIndex){
  this.constructor.prototype.constructor.call(this);
  this.inputIndex = inputIndex;
 }
});
ASPxClientUploadControlUploadingProgressChangedEventArgs = _aspxCreateClass(ASPxClientEventArgs, {
 constructor: function(fileCount, currentFileName, totalContentLength, uploadedContentLength, progress){
  this.constructor.prototype.constructor.call(this);
  this.fileCount = fileCount;
  this.currentFileName = currentFileName;
  this.totalContentLength = totalContentLength;
  this.uploadedContentLength = uploadedContentLength;
  this.progress = progress;
 }
});
function aspxUTextChanged(name, index) {
 var uploader = aspxGetControlCollection().Get(name);
 if (uploader != null)
  uploader.OnTextChanged(index);
}
function aspxUAddFileInputClick(name) {
 var uploader = aspxGetControlCollection().Get(name);
 if (uploader != null)
  uploader.AddFileInput();
}
function aspxURemoveFileInputClick(name, index) {
 var uploader = aspxGetControlCollection().Get(name);
 if (uploader != null)
  uploader.RemoveFileInput(index);
}
function aspxUUploadFileClick(name) {
 var uploader = aspxGetControlCollection().Get(name);
 if (uploader != null)
  uploader.Upload();
}
function aspxUCancelFileClick(name) {
 var uploader = aspxGetControlCollection().Get(name);
 if (uploader != null)
  uploader.Cancel();
}
function aspxFakeUploadIframeOnLoad(name) {
 var uploader = aspxGetControlCollection().Get(name);
 if ((uploader != null) && uploader.isInCallback)
  uploader.OnCompleteFileUpload();
}
function aspxUploadProcessing(name) {
 var uploader = aspxGetControlCollection().Get(name);
 if (uploader != null)
  uploader.UploadProcessing();
}
function aspxShowProgressInfoPanel(name) {
 var uploader = aspxGetControlCollection().Get(name);
 if (uploader != null && uploader.isInCallback)
  uploader.ShowProgressInfoPanel(true);
}

