HxG_5.prototype.JSFProgressBar=function() {
this.type=hX_5.CMP_progressbar;
this.table=null;
this._table="_TABLE";
this.defaultmessage=hX_5._E;
this.percentageDone=0;
this.defaultpercent=5;
this.startpercent=0;
this.normal=false;
this.outward=false;
this.barContainer=null;
this.bar_div=null;
this.percentSpan=null;
this.percentText=null;
this.message_holder=null;
this.timerId=null;
this.CSSPrefix=null;
this.baseClass=hX_5._E;
this.classes=null;
this.CL_TA=0;
this.CL_M=1;
this.CL_B=2;
this.CL_BC=3;
this.CL_BT=4;
this.CL_SZ=5;
this.run=false;
this.itu=1000;
this.firsttime= true;
this.numconverterid=null;
this.numconverter=null;
this.attributeTable=new Array();
this.attributeTable	['css-prefix']=['CSSPrefix',		hX_5.ARG_TO_NAN,	false,	null,	null];
this.attributeTable	['itu']=['itu', hX_5.ARG_TO_NUM, false, 0, 100000];
this.attributeTable	['defaultmessage']=['defaultmessage',		hX_5.ARG_TO_NAN,	false,	null,	null];
this.attributeTable	['normal']=['normal',		hX_5.ARG_IS_TRUE,	false,	null,	null];
this.attributeTable	['defaultpercent']=['defaultpercent',		hX_5.ARG_TO_NUM,	false,	0,	100];
this.attributeTable	['outward']=['outward',		hX_5.ARG_IS_TRUE,	false,	null,	null];
this.attributeTable	['startpercent']=['startpercent',		hX_5.ARG_TO_NUM,	false,	0,	100];
this.attributeTable	['numconverterid']=['numconverterid',		hX_5.ARG_TO_NAN,	false,	null,	null];
this.setAttribute(arguments);
}
HxG_5.prototype.JSFProgressBar.prototype.onPageLoad=function(){
if(this.normal)
this.run=true;
if(!this.normal)
{
this.percentageDone=this.startpercent;
if (this.numconverterid != null && this.numconverter == null)
this.numconverter=hX_5.getConverterById(this.numconverterid);
if (this.numconverter == null)
this.numconverter=new hX_5.NumberConverter("pattern:##0%");
}
this.setupStyle();
this.createTable();
this.redraw();
}
HxG_5.prototype.JSFProgressBar.prototype.setAttribute=function(a) {
hX_5.parseArg (this.attributeTable, this, a);
if(!this.normal)
if (this.numconverterid != null)
this.numconverter=hX_5.getConverterById(this.numconverterid);
}
HxG_5.prototype.JSFProgressBar.prototype.getAttribute=function (attribute) {
return (hX_5.getArg(this.attributeTable, this, attribute));
}
HxG_5.prototype.JSFProgressBar.prototype.setupStyle=function(){
if (!this.DOMobj) return;
var i, test=(this.CSSPrefix != null && this.CSSPrefix.length>0) ? this.CSSPrefix : hX_5.CLASS_PB;
if (test != this.baseClass) {
this.baseClass=test;
this.classes=new Array();
for (i=0; i <= this.CL_SZ; i++)
this.classes.push(this.baseClass + hX_5.CLASS_PBS[i]);
}
}
HxG_5.prototype.JSFProgressBar.prototype.createTable=function(){
if (!this.HTMLrendered && this.DOMobj) {
var w=hX_5.g.getP(this.DOMobj,hX_5._WD);
if (w==hX_5._AUT || w==hX_5._E) this.DOMobj.style.width="100%";
this.table=document.createElement(hX_5._TAB);
this.DOMobj.appendChild(this.table);
this.table.id=this.id + this._table;
this.table.width="100%";
this.table.height="100%";
this.table.className=this.classes[this.CL_TA];
var tbody=document.createElement(hX_5._TBDY);
this.table.appendChild(tbody);
var row2=tbody.insertRow(0);
this.message_holder=row2.insertCell(0);
hX_5.setIHTML(this.message_holder, this.defaultmessage);
this.message_holder.className=this.classes[this.CL_M];
var row3=tbody.insertRow(tbody.rows.length);
var td3=row3.insertCell(0);
if(this.normal && this.outward)
{
td3.align="center";
td3.valign="middle";
}
td3.style.width="95%";
td3.className=this.classes[this.CL_BC];
this.barContainer=td3;
this.createBar(td3);
var row4=tbody.insertRow(tbody.rows.length);
row4.insertCell(0);
if(!this.normal)
{
this.percentSpan=document.createElement(hX_5._SPN);
this.percentSpan.style.position=hX_5._ABS;
this.percentSpan.zIndex=100001;
td3.appendChild(this.percentSpan);
this.bar_div.appendChild(this.percentSpan);
var percentageDonestr=this.numconverter.valueToString(eval(this.percentageDone) /100);
this.percentText=document.createTextNode(percentageDonestr);
this.percentSpan.appendChild(this.percentText);
this.percentSpan.className=this.classes[this.CL_BT];
}
this.HTMLrendered=true;
}
}
HxG_5.prototype.JSFProgressBar.prototype.visible=function(){
this.DOMobj.style.display=hX_5._BLK;
}
HxG_5.prototype.JSFProgressBar.prototype.hide=function(){
this.DOMobj.style.display=hX_5._NO;
}
HxG_5.prototype.JSFProgressBar.prototype.setStatus=function(mess){
if(this.isVisible())
if(mess != null)
hX_5.setIHTML(this.message_holder, mess);
else
 hX_5.setIHTML(this.message_holder, hX_5._E);
}
HxG_5.prototype.JSFProgressBar.prototype.createBar=function(dom_elem_bar_container){
this.bar_div=document.createElement(hX_5._DIV);
dom_elem_bar_container.appendChild(this.bar_div);
this.bar_div.style.position=hX_5._REL;
this.bar_div.className=this.classes[this.CL_B];
this.bar_div.style.width=hX_5._ZPX;
}
HxG_5.prototype.JSFProgressBar.prototype.start=function(message){
if (!this.HTMLrendered) {
if (message) this.defaultmessage=message;
this.timerId=hX_5.i.startTimerTimed(this.id, "bar", "start", this.itu);
return;
}
this.setStatus(message);
if(this.normal) {
if (this.timerId) hX_5.i.killTimerTimed(this.timerId);
this.timerId=hX_5.i.startTimerTimed (this.id, "bar", "update", this.itu,  null, null, true);
}
this.redraw();
}
HxG_5.prototype.JSFProgressBar.prototype.stop=function(message){
if (this.timerId) hX_5.i.killTimerTimed(this.timerId);
this.timerId=null;
this.setStatus(message);
this.run=false;
this.redraw();
}
HxG_5.prototype.JSFProgressBar.prototype.reset=function(){
if(this.normal)
this.run=true;
this.firsttime=true;
this.percentageDone=0;
}
HxG_5.prototype.JSFProgressBar.prototype.redraw=function(){
if(this.HTMLrendered && this.isVisible())
{
this.bar_div.style.width=this.percentageDone+hX_5.STR_percent_char;
if(!this.normal)
{
var percentageDonestr=this.numconverter.valueToString(eval(this.percentageDone) /100);
this.percentText.nodeValue=percentageDonestr;
this.reposition();
}
}
}
HxG_5.prototype.JSFProgressBar.prototype.uirelease=function() {
}
HxG_5.prototype.JSFProgressBar.prototype.destroy=function() {
if (this.timerId) hX_5.i.killTimerTimed(this.timerId);
if (this.attributeTable) delete this.attributeTable;
if (this.classes) delete this.classes;
}
HxG_5.prototype.JSFProgressBar.prototype.reposition=function(){
var x=this.computeLeft();
this.percentSpan.style.left=x+hX_5._PX;
if (hX_5.g.getAbsPosLeft(this.percentSpan) > (hX_5.g.getAbsPosLeft(this.barContainer)+hX_5.g.getRendWidth(this.barContainer)))
this.percentSpan.style.left=-x+hX_5._PX;
this.percentSpan.style.top=this.computeTop()+hX_5._PX;
}
HxG_5.prototype.JSFProgressBar.prototype.isVisible=function(){
return ((this.DOMobj != null) && (this.DOMobj.style.display == hX_5._BLK));
}
HxG_5.prototype.JSFProgressBar.prototype.upDateMessage=function(message){
this.setStatus(message);
}
HxG_5.prototype.JSFProgressBar.prototype.upDate=function(){
this.setPercentageValue();
this.redraw();
}
HxG_5.prototype.JSFProgressBar.prototype.upDatePercentage=function(percent){
if(!this.normal)
{
var p=0;
if(percent != null && percent != 'undefined')
p=eval(percent);
if(p < 0)
percent=0;
if(p > 100)
percent=100;
this.setPercentageValue(p);
return true;
}
else
 return false;
}
HxG_5.prototype.JSFProgressBar.prototype.setPercentageValue=function(percentage){
if(this.normal)
{
if(this.percentageDone >= 100)
this.percentageDone=0;
this.percentageDone=this.percentageDone + this.defaultpercent;
}
else
 {
this.percentageDone=percentage;
if(this.percentageDone >= 100)
this.percentageDone=100;
}
}
HxG_5.prototype.JSFProgressBar.prototype.dispatchTimer=function (item, action) {
this.timerId=null;
if (item=="bar") {
if (action=="start") {
this.start(this.defaultmessage);
} else if (action=="update" && this.run) {
this.upDate();
this.timerId=hX_5.i.startTimerTimed (this.id, "bar", "update", this.itu, null, null, true);
}
}
}
HxG_5.prototype.JSFProgressBar.prototype.computeTop=function()
{
return diff=Math.floor(Math.max(hX_5.g.getRendHeight(this.bar_div)-hX_5.g.getRendHeight(this.percentSpan),0)/2);
}
HxG_5.prototype.JSFProgressBar.prototype.computeLeft=function()
{
return diff=Math.floor(Math.max(hX_5.g.getRendWidth(this.barContainer)-hX_5.g.getRendWidth(this.percentSpan),0)/2);
}

