ASPxClientProgressBarIDSuffix = {
 DivIndicator: "_DI",
 ValueIndicatorCell: "_VIC"
};
ASPxClientProgressBarBase = _aspxCreateClass(ASPxClientControl, {
 constructor: function(name) {
  this.constructor.prototype.constructor.call(this, name);
  this.minimum = 0;
  this.maximum = 0;
  this.position = 0;
  this.onePercentValue = 0;
  this.hasOwner = true;
 },
 InlineInitialize: function(calledByOwner) {
  if(calledByOwner || !this.hasOwner) {
   this.onePercentValue = (this.maximum - this.minimum) / 100;
   if(this.IsIndicatorDivWidthCorrectionRequired())
    this.SetCalculatedDivIndicatorWidth();
  }
 },
 GetMainCell: function() {
  if(!this.mainCell)
   this.mainCell = _aspxGetChildByTagName(this.GetMainElement(), "TD", 0);
  return this.mainCell;
 },
 GetIndicatorDiv: function() {
  if(!this.divIndicator)
   this.divIndicator = _aspxGetElementById(this.name + ASPxClientProgressBarIDSuffix.DivIndicator);
  return this.divIndicator;
 },
 GetValueIndicatorTable: function() {
  if(!this.valueIndicatorTable)
   this.valueIndicatorTable = _aspxGetParentByTagName(this.GetValueIndicatorCell(), "TABLE");
  return this.valueIndicatorTable;
 },
 GetValueIndicatorCell: function() {
  if(!this.valueIndicatorCell)
   this.valueIndicatorCell = _aspxGetElementById(this.name + ASPxClientProgressBarIDSuffix.ValueIndicatorCell);
  return this.valueIndicatorCell;
 },
 AdjustControlCore: function() {
  ASPxClientControl.prototype.AdjustControlCore.call(this);
  this.CorrectIndicatorHeight();
 },
 CorrectIndicatorHeight: function() {
  var mainCell = this.GetMainCell();
  var height = _aspxGetClearClientHeight(mainCell);
  _aspxSetOffsetHeight(this.GetIndicatorDiv(), height);
  var valueIndicatorTable = this.GetValueIndicatorTable();
  if(valueIndicatorTable)
   _aspxSetOffsetHeight(valueIndicatorTable, height);
  var valueIndicatorCell = this.GetValueIndicatorCell();
  if(valueIndicatorCell)
   valueIndicatorCell.innerHTML = valueIndicatorCell.innerHTML;
 },
 GetCalculatedIndicatorDivWidth: function(percent) {
  var progressWidth = _aspxGetClearClientWidth(this.GetMainCell());
  var indicatorDivStyle = _aspxGetCurrentStyle(this.GetIndicatorDiv());
  progressWidth -= _aspxPxToInt(indicatorDivStyle.borderLeftWidth) + _aspxPxToInt(indicatorDivStyle.borderRightWidth);
  return progressWidth / 100 * percent;
 }, 
 UpdateIndicators: function() {
  if(this.IsIndicatorDivWidthCorrectionRequired())
   this.SetCalculatedDivIndicatorWidth();
  else
   this.GetIndicatorDiv().style.width = this.GetPercent() + "%";
  var valueIndicatorCell = this.GetValueIndicatorCell();
  if(valueIndicatorCell)
   valueIndicatorCell.innerHTML = this.GetPercent() + "%";
 },
 SetCalculatedDivIndicatorWidth: function() {
  var indicatorWidth = this.GetCalculatedIndicatorDivWidth(this.GetPercent());
  if(indicatorWidth >= 0)
   this.GetIndicatorDiv().style.width = indicatorWidth;
 },
 IsIndicatorDivWidthCorrectionRequired: function() {
  var indicatorDivStyle = _aspxGetCurrentStyle(this.GetIndicatorDiv());
  return _aspxPxToInt(indicatorDivStyle.borderLeftWidth) > 0 || _aspxPxToInt(indicatorDivStyle.borderRightWidth) > 0;
 },
 SetPosition: function(value) {
  this.position = Math.min(Math.max(value, this.minimum), this.maximum);
  this.UpdateIndicators();
 },
 GetPosition: function() {
  return this.position;
 },
 GetPercent: function() {
  return (this.position - this.minimum) / this.onePercentValue;
 }
});
