﻿Type.registerNamespace("Telerik.Web.UI");
Telerik.Web.UI.RadToolTipManager=function(a){Telerik.Web.UI.RadToolTipManager.initializeBase(this,[a]);
this._targetControls=null;
this._isToolTipFactory=false;
this._loadOnDemand=false;
this._toolTipZoneID=null;
this._autoTooltipify=false;
this._updatePanelUniqueId="";
this._updatePanelParent=null;
this._tooltips=[];
this._idCounter=100;
this._webServiceSettings=null
};
Telerik.Web.UI.RadToolTipManager.prototype={initialize:function(d){this.set_zIndex($telerik.getCurrentStyle(this.get_element(),"zIndex"));
var c=this.get_updatePanel();
if(c){this._updatePanelParent=c.parentNode
}var b=this.get_visibleOnPageLoad();
this.set_visibleOnPageLoad(false);
var a=this.get_toolTipZoneID();
this.tooltipify(a?$get(a):document,a?this._isDescendant:null);
if(b&&this._tooltips[0]){this._tooltips[0].show()
}window.setTimeout(Function.createDelegate(this,function(){this._trackPageUpdates()
}),0)
},get_updatePanel:function(){return $get(this._getUpdatePanelID())
},dispose:function(){this._moveUpdatePanel();
this._disposeToolTips();
if(this._pageLoadedHandler){var a=Sys.WebForms.PageRequestManager.getInstance();
a.remove_pageLoaded(this._pageLoadedHandler);
this._pageLoadedHandler=null
}this._updatePanelParent=null;
Telerik.Web.UI.RadToolTipManager.callBaseMethod(this,"dispose")
},_disposeToolTips:function(){for(var b=0;
b<this._tooltips.length;
b++){var a=this._tooltips[b];
a.dispose()
}this._tooltips=null
},_isDescendant:function(a,b){return $telerik.isDescendant(a,b)
},_trackPageUpdates:function(){if(Sys.WebForms){this._pageLoadedHandler=Function.createDelegate(this,function(b,c){var e=c.get_panelsUpdated();
if(!e){return
}for(var d=0;
d<e.length;
d++){if(e[d].id==this._getUpdatePanelID()){continue
}this.tooltipify(e[d],this._isDescendant)
}});
var a=Sys.WebForms.PageRequestManager.getInstance();
a.add_pageLoaded(this._pageLoadedHandler)
}},get_toolTips:function(){return this._tooltips
},get_tooltips:function(){return this.get_toolTips()
},getToolTipByElement:function(c){if(!c){return null
}var b=this.get_tooltips();
try{for(var a=0;
a<b.length;
a++){if(b[a].get_targetControl()==c){return b[a]
}}}catch(d){}return null
},createToolTip:function(c,d,g){if(!c){alert("clone error: No target element specified");
return
}var a=c.getAttribute("title");
c.removeAttribute("title");
var b=this.clone(this._getUniqueToolTipID());
b.set_modal(b.isModal());
var f=c.getAttribute("id");
if(f){b.set_targetControlID(f)
}else{b.set_targetControl(c)
}this._tooltips[this._tooltips.length]=b;
if(d&&d!=c.getAttribute("id")){b.set_serverTargetControlID(d)
}if(g){b.set_serverValue(g)
}if(this._loadOnDemand){this._initializeAjaxToolTip(b)
}else{if(this._webServiceSettings){this._initializeWebServiceToolTip(b)
}else{var e=this.get_text();
if(!e){e=a
}b.set_text(e)
}}return b
},tooltipify:function(j,h){if(!j){j=document
}if(!h){h=function(i,k){return true
}
}var b=this.get_targetControls();
if(b.length>0){var f=b.length;
for(var a=0;
a<f;
a++){var d=b[a];
var e=$get(d[0]);
if(e&&h(j,e)){this.createToolTip(e,d[1],d[2])
}}}else{if(!this.get_autoTooltipify()){return
}var b=j.getElementsByTagName("*");
var f=b.length;
for(var a=0;
a<f;
a++){var e=b[a];
var g=e.getAttribute("title");
var c=e.getAttribute("alt");
if(g||c){if(!g){e.setAttribute("title",c);
e.removeAttribute("alt")
}else{if(c){e.removeAttribute("alt")
}}this.createToolTip(e)
}}}},_initializeWebServiceLoader:function(){this._webServiceLoader=new Telerik.Web.UI.WebServiceLoader(this.get_webServiceSettings());
this._webServiceLoader.add_loadingError(Function.createDelegate(this,this._onWebServiceError));
this._webServiceLoader.add_loadingSuccess(Function.createDelegate(this,this._onWebServiceResponse))
},_onWebServiceError:function(a,c){var b=c.get_message();
alert(b)
},_onWebServiceResponse:function(a,d){var c=d.get_data();
var b=document.createElement("DIV");
if(this._currentServicedToolTip){this._currentServicedToolTip.set_contentElement(b);
b.innerHTML=c
}this.raiseEvent("requestEnd")
},_initializeWebServiceToolTip:function(a){a.add_beforeShow(Function.createDelegate(this,function(b,c){if(!this._webServiceLoader){this._initializeWebServiceLoader()
}var d={TargetControlID:a.get_targetControlID(),Value:a.get_serverValue()};
this._currentServicedToolTip=b;
this._webServiceLoader.loadData({context:d});
b.set_content("");
b.showLoadingMessage(true)
}))
},_initializeAjaxToolTip:function(a){a.add_beforeShow(Function.createDelegate(this,function(b,c){this._doLoadOnDemand(b)
}));
a.add_hide(Function.createDelegate(this,function(b,c){var e=this.get_updatePanel();
var f=b.get_popupElement();
var d=$telerik.isDescendant(f,e);
if(d){this._moveUpdatePanel()
}}))
},_doLoadOnDemand:function(c){var b=this._getDefaultParent();
var d=this._moveUpdatePanel(b,true);
c.showLoadingMessage(true);
var e=Sys.WebForms.PageRequestManager.getInstance();
var a=Function.createDelegate(this,function(){c.set_contentElement(d);
e.remove_endRequest(a);
this.raiseEvent("requestEnd")
});
e.add_endRequest(a);
var f=c.get_serverTargetControlID();
if(!f){f=c.get_targetControlID()
}this._ajaxControlID=f;
this._ajaxValue=c.get_serverValue();
this.updateClientState();
__doPostBack(this._updatePanelUniqueId);
this._ajaxControlID=null;
this._ajaxValue=null
},saveClientState:function(){var a={AjaxTargetControl:this._ajaxControlID,Value:this._ajaxValue};
return Sys.Serialization.JavaScriptSerializer.serialize(a)
},_getUpdatePanelID:function(){return this.get_id()+"RTMPanel"
},_getUniqueToolTipID:function(){this._idCounter++;
return(this.get_id()+this._idCounter+(new Date()-100))
},_moveUpdatePanel:function(c,a){if(!c){c=this._updatePanelParent
}if(c&&c.appendChild){var b=this.get_updatePanel();
if(b){if(false!=a){b.style.display="none"
}c.appendChild(b)
}return b
}},set_modal:function(a){if(this._modal!=a){this._modal=a
}},get_webServiceLoader:function(){return this._webServiceLoader
},get_webServiceSettings:function(){return this._webServiceSettings
},set_webServiceSettings:function(a){var b=Sys.Serialization.JavaScriptSerializer.deserialize(a);
this._webServiceSettings=new Telerik.Web.UI.WebServiceSettings(b)
},get_autoTooltipify:function(){return this._autoTooltipify
},set_autoTooltipify:function(a){if(this._autoTooltipify!=a){this._autoTooltipify=a
}},get_toolTipZoneID:function(){return this._toolTipZoneID
},set_toolTipZoneID:function(a){if(this._toolTipZoneID!=a){this._toolTipZoneID=a
}},get_isToolTipFactory:function(){return this._isToolTipFactory
},set_isToolTipFactory:function(a){if(this._isToolTipFactory!=a){this._isToolTipFactory=a
}},get_loadOnDemand:function(){return this._loadOnDemand
},set_loadOnDemand:function(a){if(this._loadOnDemand!=a){this._loadOnDemand=a
}},get_targetControls:function(){return this._targetControls
},set_targetControls:function(a){if(!a){this._targetControls=[]
}else{this._targetControls=eval(a)
}},add_requestEnd:function(a){this.get_events().addHandler("requestEnd",a)
},remove_requestEnd:function(a){this.get_events().removeHandler("requestEnd",a)
}};
Telerik.Web.UI.RadToolTipManager.registerClass("Telerik.Web.UI.RadToolTipManager",Telerik.Web.UI.RadToolTip);
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();