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