Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.ProgressAreaContainerName="Panel";
function getRadProgressArea(_1){
return $find(_1);
}
Telerik.Web.UI.RadProgressArea=function(_2){
Telerik.Web.UI.RadProgressArea.initializeBase(this,[_2]);
this._progressManagerFound=false;
this._popupVisible=false;
this._width="";
this._height="";
this._skin="";
this._rtlCalculated=false;
this._isRightToLeft=false;
this._bodyElement=($telerik.standardsMode)?document.documentElement:document.body;
};
Telerik.Web.UI.RadProgressArea.prototype={initialize:function(){
Telerik.Web.UI.RadProgressArea.callBaseMethod(this,"initialize");
if(!this._progressManagerFound){
alert("Could not find an instance of RadProgressManager on the page. Are you missing the control declaration?");
}
if(this._getIsRightToLeft()){
this._applyRightToLeft();
}
this._setupControls();
this.cancelClicked=false;
if(this._cancelButtonElement){
$addHandlers(this._cancelButtonElement,{"click":this.cancelRequest},this);
}
if(typeof (Telerik.Web.UI.ProgressAreas)=="undefined"){
Telerik.Web.UI.ProgressAreas=[];
}
Telerik.Web.UI.ProgressAreas[Telerik.Web.UI.ProgressAreas.length]=this;
},dispose:function(){
if(this._cancelButtonElement){
$clearHandlers(this._cancelButtonElement);
}
Telerik.Web.UI.RadProgressArea.callBaseMethod(this,"dispose");
},_addSafariDefinition:function(_3){
_3[_3.length]=String.format("{0} = new SafariProgressArea('{0}');",this.get_id());
},_setupControls:function(){
this._clientId=this.get_id();
this._element=$get(this._clientId);
this._primaryProgressBarElement=this._findElement("PrimaryProgressBarInnerDiv");
this._primaryTotalElement=this._findElement("PrimaryTotal");
this._primaryValueElement=this._findElement("PrimaryValue");
this._primaryPercentElement=this._findElement("PrimaryPercent");
this._secondaryProgressBarElement=this._findElement("SecondaryProgressBarInnerDiv");
this._secondaryTotalElement=this._findElement("SecondaryTotal");
this._secondaryValueElement=this._findElement("SecondaryValue");
this._secondaryPercentElement=this._findElement("SecondaryPercent");
this._currentOperationElement=this._findElement("CurrentOperation");
this._timeElapsedElement=this._findElement("TimeElapsed");
this._timeEstimatedElement=this._findElement("TimeEstimated");
this._speedElement=this._findElement("Speed");
this._cancelButtonElement=this._findElement("CancelButton");
},_setupSafariProgressAreaControls:function(){
if($telerik.isSafari){
this._getSafariProgressArea()._primaryProgressBarElement=this._primaryProgressBarElement;
this._getSafariProgressArea()._primaryTotalElement=this._primaryTotalElement;
this._getSafariProgressArea()._primaryValueElement=this._primaryValueElement;
this._getSafariProgressArea()._primaryPercentElement=this._getSafariProgressArea();
this._getSafariProgressArea()._secondaryProgressBarElement=this._secondaryProgressBarElement;
this._getSafariProgressArea()._secondaryTotalElement=this._secondaryTotalElement;
this._getSafariProgressArea()._secondaryValueElement=this._secondaryValueElement;
this._getSafariProgressArea()._secondaryPercentElement=this._secondaryPercentElement;
this._getSafariProgressArea()._currentOperationElement=this._currentOperationElement;
this._getSafariProgressArea()._timeElapsedElement=this._timeElapsedElement;
this._getSafariProgressArea()._timeEstimatedElement=this._timeEstimatedElement;
this._getSafariProgressArea()._speedElement=this._speedElement;
this._getSafariProgressArea()._cancelButtonElement=this._cancelButtonElement;
this._getSafariProgressArea()._width=this._width;
this._getSafariProgressArea()._height=this._height;
if(!this._element){
this._element=$get(this._clientId);
}
this._getSafariProgressArea()._element=this._element;
}
},_getSafariProgressArea:function(){
if(!this._safariProgressArea){
this._safariProgressArea=getRadProgressManager()._safariPoller.contentWindow[this.get_id()];
}
return this._safariProgressArea;
},_getIsRightToLeft:function(){
if(!this._rtlCalculated){
var _4=this.get_element();
this._isRightToLeft=$telerik.getCurrentStyle(_4,"direction","ltr")=="rtl";
return this._isRightToLeft;
this._rtlCalculated=true;
}
return this._isRightToLeft;
},_applyRightToLeft:function(){
var _5=this.get_element();
if(/ruProgressArea_rtl/.test(_5.className)){
return;
}
$telerik.addCssClasses(_5,["ruProgressArea_rtl",String.format("RadUpload_{0}_rtl",this._skin)]);
},_findElement:function(_6){
var _7=this._clientId+"_"+Telerik.Web.UI.ProgressAreaContainerName+"_"+_6;
return $get(_7);
},cancelRequest:function(){
this.cancelClicked=true;
},update:function(_8){
if(!$telerik.isSafari){
var _9=new Sys.CancelEventArgs();
_9._progressData=_8;
_9.get_progressData=function(){
return this._progressData;
};
this.raiseEvent("progressUpdating",_9);
if(_9.get_cancel()){
return;
}
this.show();
_9._progressValue=_8.PrimaryPercent;
_9._progressBarElementName="PrimaryProgressBar";
_9._progressBarElement=this._primaryProgressBarElement;
_9.get_progressValue=function(){
return this._progressValue;
};
_9.get_progressBarElementName=function(){
return this._progressBarElementName;
};
_9.get_progressBarElement=function(){
return this._progressBarElement;
};
this.raiseEvent("progressBarUpdating",_9);
if(!_9.get_cancel()&&!isNaN(_8.PrimaryPercent)){
this.updateHorizontalProgressBar(this._primaryProgressBarElement,_8.PrimaryPercent);
}
_9._progressValue=_8.SecondaryPercent;
_9._progressBarElementName="SecondaryProgressBar";
_9._progressBarElement=this._secondaryProgressBarElement;
this.raiseEvent("progressBarUpdating",_9);
if(!_9.get_cancel()&&!isNaN(_8.SecondaryPercent)){
this.updateHorizontalProgressBar(this._secondaryProgressBarElement,_8.SecondaryPercent);
}
}else{
this.show();
this.updateHorizontalProgressBar(this._primaryProgressBarElement,_8.PrimaryPercent);
this.updateHorizontalProgressBar(this._secondaryProgressBarElement,_8.SecondaryPercent);
}
this.updateTextIndicator(this._primaryTotalElement,_8.PrimaryTotal);
this.updateTextIndicator(this._primaryValueElement,_8.PrimaryValue);
this.updateTextIndicator(this._primaryPercentElement,_8.PrimaryPercent);
this.updateTextIndicator(this._secondaryTotalElement,_8.SecondaryTotal);
this.updateTextIndicator(this._secondaryValueElement,_8.SecondaryValue);
this.updateTextIndicator(this._secondaryPercentElement,_8.SecondaryPercent);
this.updateTextIndicator(this._currentOperationElement,_8.CurrentOperationText);
this.updateTextIndicator(this._timeElapsedElement,_8.TimeElapsed);
this.updateTextIndicator(this._timeEstimatedElement,_8.TimeEstimated);
this.updateTextIndicator(this._speedElement,_8.Speed);
},show:function(){
if(!this._element){
this._element=$get(this._clientId);
}
if($telerik.isSafari){
this._element.style.visibility="visible";
this._element.style.width=this._width?this._width:"auto";
this._element.style.height=this._height?this._height:"auto";
}
this._element.style.display="";
if(!$telerik.isSafari&&this._element.style.position=="absolute"){
if(!this._popupBehavior){
this._popupBehavior=$create(Telerik.Web.PopupBehavior,{"id":(new Date()-100)+"PopupBehavior","parentElement":this._bodyElement},null,null,this._element);
}
if(this._popupVisible==false){
this._popupVisible=true;
var _a=$telerik.getBounds(this._element);
var _b=this._element.style;
var x=_b.left?parseInt(_b.left):_a.x;
var y=_b.top?parseInt(_b.top):_a.y;
this._popupBehavior.set_x(x);
this._popupBehavior.set_y(y);
this._popupBehavior.show();
}
}
},hide:function(){
this._element.style.display="none";
if(this._popupBehavior){
this._popupBehavior.hide(true);
}
},updateTextIndicator:function(_e,_f){
if(!_e||typeof (_f)=="undefined"){
return;
}
if(typeof (_e.value)=="string"){
_e.value=_f;
}else{
if(typeof (_e.innerHTML)=="string"){
_e.innerHTML=_f;
}
}
},updateHorizontalProgressBar:function(_10,_11){
if(_10&&typeof (_11)!="undefined"){
_10.style.width=_11+"%";
}
},updateVerticalProgressBar:function(_12,_13){
if(_12&&typeof (_13)!="undefined"){
_12.style.height=_13+"%";
}
},get_progressManagerFound:function(){
return this._progressManagerFound;
},set_progressManagerFound:function(_14){
this._progressManagerFound=_14;
},add_progressUpdating:function(_15){
this.get_events().addHandler("progressUpdating",_15);
},remove_progressUpdating:function(_16){
this.get_events().removeHandler("progressUpdating",_16);
},add_progressBarUpdating:function(_17){
this.get_events().addHandler("progressBarUpdating",_17);
},remove_progressBarUpdating:function(_18){
this.get_events().removeHandler("progressBarUpdating",_18);
}};
Telerik.Web.UI.RadProgressArea.registerClass("Telerik.Web.UI.RadProgressArea",Telerik.Web.UI.RadWebControl);

