if(!window.PT){window.PT=new Object();window.PT["buildVersion"]='4534';window.PT["host"]='http://forums.abcnews.go.com';window.PT.IncludeScript=function(scriptUrl){var headElm=document.getElementsByTagName('head')[0];var scriptElm=document.createElement('script');scriptElm.setAttribute('type','text/javascript');scriptElm.setAttribute('src',scriptUrl);headElm.appendChild(scriptElm);}} /** Prospero Active Widgets Copyright (c) 2007 Prospero Technologies LLC Prospero Active Widgets are dynamic elements of Prospero-served community or social media content embedded in web pages served by Prospero clients or their affilliates. Each Active Widget may use a token named "__WIDGET_ID__" to deal with namespacing The __WIDGET_ID__ is the unique key passed back to the server and is used as a key to reference the Widget in the registry **/ function PT_WidgetMan() { /** singleton if one already exists then use it **/ if(window.PT_WIDGET_MAN) { /** If the WidgetMan object exists already then exit **/ return; } window.PT_WIDGET_MAN = this; this.Widgets = new Object(); this.Apps = new Object(); /* TODO - load this up from infrastructure; perhaps move to PT? */ this.Apps["forum"] = '/n/pfx/forum.aspx'; this.element_count = 0; this.pollId = 0; // polling ID this.domComplete = false; // flag to test if the DOM is ready if(document.addEventListener && document.readyState) // Safari and Opera { this.startPoll(); // start Polling } this.initialize(); // add listeners to window.document or window } function PT_WidgetMan_StartPolling() { if(this.pollId) { return; } var self = this; this.pollId = setInterval(function(){ self.loadWidgets(); }, 1000); //alert("Start Poll I="+this.pollId+" L="+this.domComplete); } function PT_WidgetMan_StopPolling() { if (!this.pollId) { return; } //alert("Stop Poll I="+this.pollId+" L="+this.domComplete); clearInterval(this.pollId); this.pollId = null; } /** Add listeners to window.document or to the window itself. Once the DOM is ready, stop polling and run loadWidgets one last time. **/ function PT_WidgetMan_Initialize() { var self = this; var callBack = function(){ if(document.readyState) // IE and Opera 9 { if(document.readyState == 'complete') { //alert("onReadyStateChange fired"); self.domComplete = true; self.loadWidgets(); } } else // Firefox { //alert("DOMContentLoaded or onLoad fired"); self.domComplete = true; self.loadWidgets(); } } if(document.addEventListener) // W3C Recommendation { if(document.readyState) // Opera and Safari { //alert("listen to onReadyStateChange via addEventListener"); document.addEventListener("onreadystatechange", callBack, false); } else // Firefox { //alert("listen to DOMContentLoaded via addEventListener"); document.addEventListener("DOMContentLoaded", callBack, false); } } else if(document.attachEvent) // IE { //alert("listen to onReadyStateChange via attachEvent"); document.attachEvent("onreadystatechange", callBack); } else { //window.onload = callBack; } } function PT_WidgetMan_LoadWidgets() { /* Scan for all widgets and kick off each */ var elements = document.getElementsByTagName("paw:widget"); var len = elements.length; /* if (len == 0) { alert("No widgets here!"); } else { alert("Got " + len + " widgets."); } */ for(var elementIndex = 0; elementIndex var pawParent; if(this._Element.parentNode) { pawParent = this._Element.parentNode; //alert("pawParent by parentNode"); } /* else { pawParent = document.getElementById("ptcWidgetParent"); //alert("pawParent by getElementById"); } */ if(pawParent) { //alert("has parentNode"); if(this._Canvas == null) { this._LoadingMessage = document.getElementById("ptcloading"); if(this._LoadingMessage) { this._LoadingMessage.style.display = "none"; } this._Canvas = document.createElement("div"); pawParent.replaceChild(this._Canvas,this._Element); this._Element= this._Canvas; //alert("Element: " + this._Element + "\nCanvas: " + this._Canvas); } this._Canvas.innerHTML = sContent; if(this._debug) { this._DebugCanvas= document.createElement("textarea"); this._DebugCanvas.setAttribute("cols","50"); this._DebugCanvas.setAttribute("rows","10"); this._Canvas.appendChild(this._DebugCanvas); this._DebugCanvas.value=sContent; } } } } function PT_Widget_Load() { var src = PT["host"] + PT_WIDGET_MAN.Apps[this.app] + "?webtag=" + this.webtag + "&widgetId="+ this.__WIDGET_ID__ +"&nav=jsscontent&dst="+escape(new Date().toString()); if (this.type && this.type != "") { src += "&type=" + this.type; } if (this.args && this.args != "") { /* 4/30/07: Fix semicolon in subject title encoding issue */ this.args = this.args.replace(/\%3B/g,'%20'); src += "&args=" + this.args; } if (this.config && this.config != "") { src += "&config=" + this.config; } var dbg = PT["dbg"]; if (dbg && dbg != "") { src += "&dbg=" + dbg; } this.Update(src); } function PT_Widget_Update(src) { if(this._script) { /* remove previously used script. Someday we might make a history of scripts */ document.body.removeChild(this._script); this._script= null; } this._script = document.createElement("script"); this._src= src; //debug //alert(this._src); //window.open(this._src); this._script.setAttribute("src", this._src); document.body.appendChild(this._script); } PT_Widget.prototype = new Object(); PT_Widget.prototype.Load = PT_Widget_Load; PT_Widget.prototype.SetError = PT_Widget_SetError; PT_Widget.prototype.SetContent = PT_Widget_SetContent; PT_Widget.prototype.Update = PT_Widget_Update; PT_Widget.Prefix="PTWidget"; PT_Widget.rev =0; /** Create the singleton global object window.PT_WIDGET_MAN which does all the work of module creation registration and execution **/ new PT_WidgetMan();