document.write(""); document.write(""); document.write(""); ///constructor to create a new SiteLifeProxy function SiteLifeProxy(url) { // User Configurable Properties - these can be set at any time // your apiKey, this value must be set! this.apiKey = null; // sniff the browser for custom behaviors this.__isExplorer = navigator.userAgent.toLowerCase().indexOf('msie') != -1; this.__isSafari = navigator.userAgent.toLowerCase().indexOf('safari') != -1; this.__isMac = navigator.platform.toLowerCase().indexOf('mac') != -1; this.__isMacIE = this.__isMac && this.__isExplorer; // if enabled, spit out debug information through alert() this.debug = false; // used to track the id of the handler expecting the results from the immediately preceeding method invocation // this is used only for testing purposes this.lastHandlerId = ""; // Methods You can Overide // // OnSuccess(returnValue) - is passed the return value at the end of a successful call, default does nothing // OnError(msg) - is passed an error message if a problem occurs // OnDebug(msg) - is called when debugging is enabled this.__baseUrl = url; this.__sendInvokeCount = 0; this.__eventHandlers = new Object(); }; SiteLifeProxy.prototype.AddEventHandler = function (event_name, callback) {this.__eventHandlers[event_name] = callback;} SiteLifeProxy.prototype.FireEvent = function (event_name) { var func; if(func = this.__eventHandlers[event_name]) { var A = new Array(); for (var i = 1; i < this.FireEvent.arguments.length; i++){ A[i - 1] = this.FireEvent.arguments[i];} if (func.__Bound) return func(); return this.__eventHandlers[event_name].apply(this, A); } } SiteLifeProxy.prototype.ScriptId = function() { return this.__scriptId = "_bb_script_" + this.__sendInvokeCount++; } // Default error handler for the proxy object, simple alert SiteLifeProxy.prototype.OnError = function(msg) { alert("OnError: " + msg); } // Default debug handler for the proxy object, simple alert SiteLifeProxy.prototype.OnDebug = function(msg) { if (this.debug) alert("Debug: " + msg); } // fetch a named request parameter from the page URL SiteLifeProxy.prototype.GetParameter = function(parameterName) { var key = parameterName + "="; var parameters = document.location.search.substring(1).split("&"); for (var i = 0; i < parameters.length; i++) { if (parameters[i].indexOf(key) == 0) return parameters[i].substring(key.length); } return null; }; // browser independent method to get elements by ID SiteLifeProxy.prototype.GetElement = function(id) { this.OnDebug("GetElement " + id); if (document.getElementById) return document.getElementById(id); if (document.all) return document.all[id]; this.OnError("No support for GetElement() in this browser"); return null; } // browser independent method to get elements by tag name SiteLifeProxy.prototype.GetTags = function(tagName) { this.OnDebug("GetTags " + tagName); if (document.getElementsByTagName) return document.getElementsByTagName(tagName); if (document.all) return document.tags(tagName); this.OnError("No support for GetTags() in this browser"); return null; } SiteLifeProxy.prototype.EscapeValue = function(s) { if (s == null) return null; return encodeURIComponent(s); }; SiteLifeProxy.prototype.__ArrayValidation = function(s) { if ((typeof s == 'undefined') || (s.length < 1)) { return false; } return true; } SiteLifeProxy.prototype.__CheckErrorHandler = function(onError) { this.OnDebug("__CheckErrorHandler " + onError); if ((typeof onError == 'undefined') || (eval("window." + onError) == null)) { return "gSiteLife.OnError"; } return onError; } SiteLifeProxy.prototype.SetCookie = function SetCookie( name, value) { var today = new Date(); today.setTime( today.getTime() ); var expires_date = new Date( today.getTime() + 126144000000 ); document.cookie = name + "=" +escape( value ) + ";expires=" + expires_date.toGMTString() + ";path=/" + ";domain=washingtonpost.com" ; } // validate and fetch arguments, if the argument is missing and optional, we return an empty string SiteLifeProxy.prototype.__GetArgument = function(variableName, variableValue, isRequired, isArray) { this.OnDebug("__GetArgument " + variableName + "," + variableValue + "," + isRequired + "," + isArray); if (typeof variableValue == "undefined" || variableValue == null || variableValue == "") { if (isRequired) { this.OnError("Missing required parameter " + variableName); this.__isValid = false; return ""; } else return ""; } if (isRequired && isArray) { if (!this.__ArrayValidation(variableValue)) { this.OnError("Invalid array parameter " + variableName); this.__isValid = false; return ""; } } return "&" + variableName + "=" + this.EscapeValue(variableValue); }; SiteLifeProxy.prototype.__StripAnchorFromUrl = function(url) { var aIdx = url.indexOf("#"); return aIdx == -1 ? url : url.substring(0, aIdx); } SiteLifeProxy.prototype.__SafeAppendUrlValue = function(url, key, value) { url += url.indexOf("?") != -1 ? "&" : "?"; return url + key + "=" + value; } SiteLifeProxy.prototype.__AppendUrlValues = function (url) { time = new Date(); url += this.__GetArgument("plckNoCache", time.getTime(), false, false); url += this.__GetArgument("plckApiKey", this.apiKey, true, false); return url; } SiteLifeProxy.prototype.ReloadPage = function(params) { var sSearch = window.location.search.substring(1); var sNVPs = sSearch.split('&'); var newSearch = ""; for(var k in params) { if(k == "extend") continue; if(newSearch == "") newSearch += "?"; else newSearch += "&"; newSearch += k + '=' + params[k]; } for (var i = 0; i < sNVPs.length; i++) { var kv = sNVPs[i].split('='); if(kv[0] && kv[0].indexOf('plck') != 0 && ! params[kv[0]]) { newSearch += "&" + sNVPs[i]; } } window.location.search = newSearch; } function loadScript (url, callback) { var script = document.createElement('script'); script.type = 'text/javascript'; script.charset = 'utf-8'; if (callback) script.onload = script.onreadystatechange = function() { if (script.readyState && script.readyState != 'loaded' && script.readyState != 'complete') return; script.onreadystatechange = script.onload = null; callback(); }; script.src = url; document.getElementsByTagName('head')[0].appendChild (script); } SiteLifeProxy.prototype.__Send = function(url, scriptToUse, callbackName, args) { this.OnDebug("_Send " + url); function gLoadScript(url, callbackName) { var script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.setAttribute('charset', 'utf-8'); script.setAttribute('src', url + (callbackName ? '&EVENT_ID=' + callbackName : '')); document.getElementsByTagName('head')[0].appendChild (script); } function bind(_function, _this, _arguments) { var f = function() { _function.apply(_this, _arguments); }; f['__Bound'] = true; return f; }; var func; if ((typeof callbackName == 'string') && (func = this.__eventHandlers[callbackName]) && (typeof func == 'function') && !func['__Bound']) { this.__eventHandlers[callbackName] = bind(func, this, args); } //append our various parameters as necessary url = this.__AppendUrlValues(url); this.OnDebug("_Send (updated) " + url); // add the script node to the document if (document.createElement && ! this.__isMacIE) { gLoadScript(url, callbackName); return; } // could fall back to sync at this point, but will bust if the page is already loaded this.OnError("No support for async in this browser"); } SiteLifeProxy.prototype.Logout = function(ScriptToUse, IsRestPage) { var plckRest = IsRestPage ? true : false; this.__Send(this.__baseUrl + '/Utility/Logout?plckRedirectUrl=' + escape(window.location.href) + '&plckRest=' + plckRest, ScriptToUse); return false; } SiteLifeProxy.prototype.AddLoadEvent = function(func) { if(window.addEventListener){ window.addEventListener("load", func, false); }else{ if(window.attachEvent){ window.attachEvent("onload", func); }else{ if(document.getElementById){ var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { if (oldonload) { oldonload(); } func(); }}}}}} SiteLifeProxy.prototype.AdInsertHelper = function() { for(var src in gSiteLife.__adsToInsert) { if(src == "extend") continue; var dest = gSiteLife.__adsToInsert[src]; var parent = document.getElementById(dest); var newChild = document.getElementById(src); if( ! parent || ! newChild ) {continue; } parent.replaceChild( newChild, document.getElementById(dest + "Child")); newChild.style.display = "block"; parent.style.display = "block"; } } SiteLifeProxy.prototype.InsertAds = function(source, destination) { gSiteLife.__adsToInsert = new Object(); for(ii=0; ii< this.InsertAds.arguments.length; ii+=2) { gSiteLife.__adsToInsert[this.InsertAds.arguments[ii]] = this.InsertAds.arguments[ii+1];} this.AddLoadEvent(gSiteLife.AdInsertHelper); } SiteLifeProxy.prototype.TitleTag = function() { var titleTag = document.getElementById("plckTitleTag"); return titleTag ? titleTag.innerText || titleTag.textContent : null; } SiteLifeProxy.prototype.WriteDiv = function(id, divClass) { var cssClass = divClass ? divClass : ""; document.write('
'); return id; } SiteLifeProxy.prototype.InnerHtmlWrite = function(elementId, innerContents ) { var el = document.createElement("div"); try { if(document.location.href.indexOf("debug=true") > -1) { el.innerHTML += "
 ? 
" + innerContents + "
"; } else { el.innerHTML += innerContents; el.style.display = "inline"; } var destDiv = document.getElementById(elementId); while (destDiv.childNodes.length >= 1) { destDiv.removeChild(destDiv.childNodes[0]); } destDiv.appendChild(el); } catch (error) { alert(elementId + " Error " + error.number + ": " + error.description); } } SiteLifeProxy.prototype.SortTimeStampDescending = "TimeStampDescending"; SiteLifeProxy.prototype.SortTimeStampAscending = "TimeStampAscending"; SiteLifeProxy.prototype.SortRecommendationsDescending = "RecommendationsDescending"; SiteLifeProxy.prototype.SortRecommendationsAscending = "RecommendationsAscending"; SiteLifeProxy.prototype.SortRatingDescending = "RatingDescending"; SiteLifeProxy.prototype.SortRatingAscending = "RatingAscending"; SiteLifeProxy.prototype.KeyTypeExternalResource = "ExternalResource"; SiteLifeProxy.prototype.PersonaHeaderRequest = function(UserId) { var url = this.__baseUrl + '/Persona/PersonaHeader?plckElementId=personaHDest&plckUserId='+ UserId; this.__Send(url, "personaHeaderScript", 'persona:header', arguments); } SiteLifeProxy.prototype.PersonaHeader = function(UserId) { this.WriteDiv("personaHDest", "Persona_Main"); this.PersonaHeaderRequest(UserId); } SiteLifeProxy.prototype.Persona = function(UserId) { this.WriteDiv("personaDest", "Persona_Main"); var action = this.GetParameter("plckPersonaPage"); if(action && (typeof this[action] == 'function')) this[action](UserId); else this.PersonaHome(UserId); } SiteLifeProxy.prototype.LoadPersonaPage = function(PageName, UserId) { var params = new Object(); params['plckPersonaPage'] = PageName; params['plckUserId'] = UserId; params['newspaperUserId'] = UserId; for(ii=2; ii< this.LoadPersonaPage.arguments.length; ii+=2) { params[this.LoadPersonaPage.arguments[ii]] = this.LoadPersonaPage.arguments[ii+1];} this.ReloadPage(params); return false; } SiteLifeProxy.prototype.PersonaHome = function(UserId) { return this.PersonaSend('PersonaHome', 'personaDest', 'personaScript', UserId, null, 'persona:home'); } SiteLifeProxy.prototype.WatchItem = function(Controller,Method,WatchKey, targetDiv) { var url = this.__baseUrl + '/'+Controller+'/' + Method + '?' + 'plckWatchKey=' + WatchKey + '&plckElementId=' + targetDiv + '&plckWatchUrl=' + this.EscapeValue(window.location.href); this.__Send(url, "AddWatchScript"); return false; } SiteLifeProxy.prototype.PersonaRemoveWatchItem= function(UserId, WatchKey, Div, View) { return this.PersonaSend('PersonaRemoveWatchItem', Div, 'personaScript', UserId, 'plckWatchView=' + View + '&plckWatchKey=' + WatchKey); } SiteLifeProxy.prototype.PersonaAddFriend= function(UserId) { return this.PersonaSend('PersonaAddFriend', 'personaHDest', 'personaScript', UserId); } SiteLifeProxy.prototype.PersonaRemoveFriend = function(UserId, Friend, Div, View, Expanded) { if(!Expanded) Expanded = "false"; if (confirm("Are you sure you want to delete this user from your list of Friends?") == true) { return this.PersonaSend('PersonaRemoveFriend', Div, 'personaScript', UserId, 'plckFriendView=' + View + '&plckFriend=' + Friend + '&plckExpanded=' + Expanded); } return false; } SiteLifeProxy.prototype.PersonaRemovePendingFriend = function(UserId, PendingFriend, Div) { if (confirm("Are you sure you want to delete this user's invite?") == true) { return this.PersonaSend('PersonaRemovePendingFriend', Div, 'personaScript', UserId, 'plckPendingFriend=' + PendingFriend); } return false; } SiteLifeProxy.prototype.PersonaAddPendingFriend = function(UserId, PendingFriend, Div) { return this.PersonaSend('PersonaAddPendingFriend', Div, 'personaScript', UserId, 'plckPendingFriend=' + PendingFriend); } SiteLifeProxy.prototype.PersonaMessages = function(UserId) { var AdParams = this.GetParameter('plckCurrentPage') ? 'plckCurrentPage=' + this.GetParameter('plckCurrentPage') : ""; var scrl = this.GetParameter('plckScrollToAnchor'); if(scrl){ if(AdParams) {AdParams +='&';} AdParams += 'plckScrollToAnchor=' + scrl;} if(this.GetParameter('plckMessageSubmitted')){if(AdParams) {AdParams +='&';} AdParams += 'plckMessageSubmitted=' + this.GetParameter('plckMessageSubmitted');} return this.PersonaSend('PersonaMessages', 'personaDest', 'personaScript', UserId, AdParams, 'persona:messages'); } SiteLifeProxy.prototype.PersonaComments = function(UserId) { var AdParams = this.GetParameter('plckCurrentPage') ? 'plckCurrentPage=' + this.GetParameter('plckCurrentPage') : ""; return this.PersonaSend('PersonaComments', 'personaDest', 'personaScript', UserId, AdParams, 'persona:comments'); } SiteLifeProxy.prototype.PersonaBlog = function(UserId) { var AdParams = this.GetParameter('plckCurrentPage') ? 'plckCurrentPage=' + this.GetParameter('plckCurrentPage') : ""; if(AdParams) {AdParams +='&';} AdParams += 'plckBlogId=' + UserId; var url = this.__baseUrl + '/PersonaBlog/PersonaBlog?plckElementId=personaDest&plckUserId='+ UserId + '&' + AdParams; this.__Send(url, 'personaScript', 'persona:blog', arguments); return false; } SiteLifeProxy.prototype.PersonaProfile = function(UserId) { return this.PersonaSend('PersonaProfile', 'personaDest', 'personaScript', UserId, null, 'persona:profile'); } SiteLifeProxy.prototype.PersonaWatchListPaginate = function(UserId, pageNum) { return this.PersonaPaginate('WatchList', pageNum, UserId); } SiteLifeProxy.prototype.PersonaFriendsPaginate = function(UserId, pageNum) { return this.PersonaPaginate('Friends', pageNum, UserId); } SiteLifeProxy.prototype.PersonaPendingFriendsPaginate = function(UserId, pageNum) { var AdParam = "plckPendingFriendsPageNum=" + pageNum; return this.PersonaPaginate('Friends', 0, UserId,AdParam); } SiteLifeProxy.prototype.PersonaMessagesPreviewPaginate = function(UserId, pageNum) { return this.PersonaPaginate('MessagesPreview', pageNum, UserId); } SiteLifeProxy.prototype.PersonaMessageRemove = function(UserId, pageNum, MessageKey) { if (confirm("Are you sure you want to remove this message from the page?") == true) { return this.PersonaSend('PersonaRemoveMessage', 'personaDest', 'PersonaMessagesPageScript', UserId, 'plckCurrentPage='+ pageNum + '&plckMessageKey='+MessageKey); } return false; } SiteLifeProxy.prototype.PersonaSend = function(ApiName, DestDiv, ScriptName, UserId, AddParams, eventId){ var url = this.__baseUrl + '/Persona/' + ApiName + '?plckElementId=' + DestDiv + '&plckUserId='+ UserId; if(AddParams) url += '&' + AddParams; this.__Send(url, ScriptName, eventId, arguments); return false; } SiteLifeProxy.prototype.PersonaPaginate = function(ApiName, PageNum, UserId, AddParams){ var url = this.__baseUrl + '/Persona/Persona' + ApiName + '?plck' + ApiName + 'PageNum=' + PageNum + '&plckElementId=Persona' + ApiName + 'Dest&plckUserId='+ UserId; if(AddParams) url += '&' + AddParams; this.__Send(url, 'Persona'+ ApiName + 'Script'); return false; } SiteLifeProxy.prototype.PersonaPhotoSend = function(ApiName, DestDiv, ScriptName, UserId, AddParams, eventId){ var url = this.__baseUrl + '/PersonaPhoto/' + ApiName + '?plckElementId=' + DestDiv + '&plckUserId='+ UserId; if(AddParams) url += '&' + AddParams; this.__Send(url, ScriptName, eventId, arguments); return false; } SiteLifeProxy.prototype.PersonaMostRecent = function(UserId, PhotoID, DestDiv) { return this.PersonaPhotoSend('PersonaMostRecent', DestDiv, 'personaScript', UserId,'plckPhotoID=' + PhotoID); } SiteLifeProxy.prototype.PersonaCreateGallery = function(UserId) { return this.PersonaPhotoSend('UserGalleryCreate', 'personaDestPhoto', 'personaScript', UserId); } SiteLifeProxy.prototype.PersonaEditGallery = function(UserId,GalleryID) { return this.PersonaPhotoSend('UserGalleryEdit', 'userGalleryDest', 'personaScript', UserId,'plckGalleryID=' + GalleryID); } SiteLifeProxy.prototype.PersonaUploadToUserGallery = function(GalleryId) { var url = this.__baseUrl + '/Photo/PhotoUpload?plckElementId=userGalleryDest&plckGalleryID='+ GalleryId; this.__Send(url); return false; } SiteLifeProxy.prototype.PersonaPhotos = function(UserId) { return this.PersonaPhotoSend('PersonaPhotos', 'personaDest', 'personaScript', UserId, null, 'persona:photos'); } SiteLifeProxy.prototype.PersonaAllPhotos = function(UserId) { return this.PersonaPhotoSend('PersonaAllPhotos', 'personaDest', 'personaScript', UserId); } SiteLifeProxy.prototype.PersonaGalleryPhoto = function(UserId) { return this.PersonaPhotoSend('PersonaGalleryPhoto', 'personaDest', 'personaScript', UserId); } SiteLifeProxy.prototype.PersonaMyRecentPhotos = function(UserId,ElementId, PageNum) { return this.PersonaPhotoSend('PersonaMyRecentPhotos', ElementId, 'personaScript', UserId,'plckPageNum=' + PageNum); } SiteLifeProxy.prototype.PersonaGallery = function(UserId,GalleryId,PageNum) { if(!PageNum){ PageNum = gSiteLife.GetParameter("plckPageNum") ? gSiteLife.GetParameter("plckPageNum") : 0; } if(!GalleryId) { GalleryId = gSiteLife.GetParameter("plckGalleryID"); } return this.PersonaPhotoSend('PersonaGallery', 'personaDest', 'personaScript', UserId,'plckGalleryID='+ GalleryId + '&plckPageNum=' + PageNum); } SiteLifeProxy.prototype.UserGalleryList = function(UserId,ElementId, PageNum) { return this.PersonaPhotoSend('UserGalleryList', ElementId, 'personaScript', UserId,'plckPageNum=' + PageNum); } SiteLifeProxy.prototype.PersonaGallerySubmissions = function(UserId,ElementId, PageNum){ return this.PersonaPhotoSend('PersonaGallerySubmissions', ElementId, 'personaScript', UserId,'plckPageNum=' + PageNum); } SiteLifeProxy.prototype.PersonaGalleryPhoto = function(UserId) { var photoid = gSiteLife.GetParameter('plckPhotoID'); return this.PersonaPhotoSend('PersonaGalleryPhoto', 'personaDest','personaScript', UserId,'&plckPhotoID=' +photoid); } SiteLifeProxy.prototype.PersonaRecentGalleryPhoto = function(UserId) { var photoid = gSiteLife.GetParameter('plckPhotoID'); return this.PersonaPhotoSend('PersonaRecentGalleryPhoto', 'personaDest','personaScript', UserId,'&plckPhotoID=' +photoid); } SiteLifeProxy.prototype.LoadPersonaGalleryPage = function(UserId,GalleryID) { var params = new Object(); params['plckPersonaPage'] = 'PersonaGallery'; params['plckUserId'] = UserId; params['newspaperUserId'] = UserId; params['plckGalleryID'] = GalleryID; this.ReloadPage(params); return false; } SiteLifeProxy.prototype.LoadPersonaPhotoPage = function(UserId,PhotoID) { var params = new Object(); params['plckPersonaPage'] = 'PersonaGalleryPhoto'; params['plckUserId'] = UserId; params['newspaperUserId'] = UserId; params['plckPhotoID'] = PhotoID; this.ReloadPage(params); return false; } SiteLifeProxy.prototype.LoadPersonaRecentPhotoPage = function(UserId,PhotoID) { var params = new Object(); params['plckPersonaPage'] = 'PersonaRecentGalleryPhoto'; params['plckUserId'] = UserId; params['newspaperUserId'] = UserId; params['plckPhotoID'] = PhotoID; this.ReloadPage(params); return false; } SiteLifeProxy.prototype.SolicitPhoto = function(galleryID) { var elementId = 'plcksolicit' + galleryID; this.WriteDiv(elementId); var url = this.__baseUrl + '/Photo/SolicitPhoto?plckElementId=' + elementId + '&plckGalleryID=' +galleryID; this.__Send(url); return false; } SiteLifeProxy.prototype.PhotoUpload = function() { var elementId = 'plcksubmit'; this.WriteDiv(elementId); var galleryID = gSiteLife.GetParameter('plckGalleryID'); var url = this.__baseUrl + '/Photo/PhotoUpload?plckElementId=' + elementId + '&plckGalleryID=' +galleryID; this.__Send(url); return false; } SiteLifeProxy.prototype.PublicGallery = function() { var elementId = 'plckgallery'; this.WriteDiv(elementId); var galleryID = gSiteLife.GetParameter('plckGalleryID'); var pageNum = gSiteLife.GetParameter('plckPageNum'); var url = this.__baseUrl + '/Photo/PublicGallery?plckElementId=' + elementId + '&plckGalleryID=' +galleryID + '&plckPageNum=' +pageNum; this.__Send(url); return false; } SiteLifeProxy.prototype.GalleryPhoto = function() { var elementId = 'plckphoto'; this.WriteDiv(elementId); var photoid = gSiteLife.GetParameter('plckPhotoID'); var url = this.__baseUrl + '/Photo/GalleryPhoto?plckElementId=' + elementId + '&plckPhotoID=' +photoid; this.__Send(url); return false; } SiteLifeProxy.prototype.PublicGalleries = function() { var elementId = 'plckgalleries'; this.WriteDiv(elementId); var pageNum = gSiteLife.GetParameter('plckPageNum') ? gSiteLife.GetParameter('plckPageNum') : "0"; var url = this.__baseUrl + '/Photo/PublicGalleries?plckElementId=' + elementId + '&plckPageNum=' + pageNum; this.__Send(url); return false; } SiteLifeProxy.prototype.PhotoRecommend = function(targetid,recommendDiv,isGallery) { var url = this.__baseUrl + '/Photo/Recommend?plckElementId=' + recommendDiv + '&plckTargetid=' +targetid + '&plckIsGallery=' +isGallery ; this.__Send(url); return false; } //parentKeyType can be any gSiteLife.KeyType* value, but for including this widget on an article page the value is //typically gSiteLife.KeyTypeExternalResource SiteLifeProxy.prototype.Comments = function(parentKeyType, parentKey, pageSize, sort, showTabs, tab, parentUrl, parentTitle, refreshPage) { return this.CommentsInternal(parentKeyType, parentKey, pageSize, sort, showTabs, tab, parentUrl, parentTitle, false, false, null, refreshPage); }; SiteLifeProxy.prototype.CommentsInput = function(parentKeyType, parentKey, redirectToUrl) { return this.CommentsInternal(parentKeyType, parentKey, null, "TimeStampDescending", null, null, null, null, true, false, redirectToUrl, false); }; SiteLifeProxy.prototype.CommentsOutput = function(parentKeyType, parentKey, refreshPage, pageSize, sortOrder) { sortOrder = sortOrder || "TimeStampDescending"; return this.CommentsInternal(parentKeyType, parentKey, pageSize, sortOrder, null, null, null, null, false, true, null, refreshPage); } SiteLifeProxy.prototype.CommentsRefresh = function(parentKeyType, parentKey, pageSize, sortOrder) { if (!parentKey || parentKey == "") throw "Must pass in value for parentKey!"; return this.CommentsInternal(parentKeyType, parentKey, pageSize, sortOrder, null, null, null, null, false, false, null, true); } SiteLifeProxy.prototype.CommentsInternal = function(parentKeyType, parentKey, pageSize, sort, showTabs, tab, parentUrl, parentTitle, hideView, hideInput, redirectToUrl, refreshPage) { var divId = 'Comments_Container'; if(this.numCommentsWidgets){ divId += this.numCommentsWidgets; } else { this.numCommentsWidgets = 0; } document.write("
"); this.numCommentsWidgets++; var oldDocOnLoad = window.onload; function loadComments() { if (oldDocOnLoad != null) { oldDocOnLoad(); } gSiteLife.GetComments(parentKeyType, parentKey, parentUrl, parentTitle, 0, pageSize, sort, showTabs, tab, hideView, hideInput, redirectToUrl, refreshPage, divId); } window.onload = loadComments; return false; } SiteLifeProxy.prototype.GetComments = function(parentKeyType, parentKey, parentUrl, parentTitle, page, pageSize, sort, showTabs, tab, hideView, hideInput, redirectTo, refreshPage, divId) { parentKeyType = parentKeyType || "ExternalResource"; parentUrl = parentUrl || gSiteLife.__StripAnchorFromUrl(window.location.href); parentUrl = gSiteLife.EscapeValue(parentUrl); parentKey = parentKey || gSiteLife.__StripAnchorFromUrl(window.location.href); parentTitle = parentTitle || gSiteLife.EscapeValue(document.title); page = page || gSiteLife.GetParameter('plckCurrentPage') || 0; pageSize = pageSize || 10; sort = sort || "TimeStampAscending"; showTabs = showTabs || false; tab = tab || "MostRecent"; hideView = hideView || false; hideInput = hideInput || false; redirectTo =gSiteLife.EscapeValue(redirectTo) || ""; refreshPage = refreshPage || false; var url = this.__baseUrl + '/Comment/GetPage.rails?plckTargetKeyType='+ parentKeyType + '&plckTargetKey=' + escape(parentKey) + "&plckCurrentPage=" + page + "&plckItemsPerPage=" + pageSize + "&plckSort=" + sort + "&plckElementId=" + divId + "&plckTargetUrl=" + parentUrl + "&plckTargetTitle=" + parentTitle + "&plckHideView=" + hideView + "&plckHideInput=" + hideInput + "&plckRefreshPage=" + refreshPage + "&plckRedirectToUrl=" + redirectTo ; if (showTabs) { url = url + "&plckShowTabs=true&plckTab=" + tab; } this.__Send(url); return false; }; SiteLifeProxy.prototype.Blog = function(BlogId) { this.WriteDiv("blogDest", "Persona_Main"); var action = this.GetParameter("plckBlogPage"); if(action && action != "Blog" && (typeof this[action] == 'function')){ return this[action](BlogId); }else{ var AdParams = this.GetParameter('plckCurrentPage') ? 'plckCurrentPage=' + this.GetParameter('plckCurrentPage') : ""; return this.BlogSend('Blog', 'Blog', 'blogDest', 'blogScript', BlogId, AdParams); } } SiteLifeProxy.prototype.LoadBlogPage = function(PageName, BlogId) { var params = new Object(); params['plckBlogPage'] = PageName; params['plckBlogId'] = BlogId; for(ii=2; ii< this.LoadBlogPage.arguments.length; ii+=2) { params[this.LoadBlogPage.arguments[ii]] = this.LoadBlogPage.arguments[ii+1];} this.ReloadPage(params); return false; } SiteLifeProxy.prototype.BlogViewEdit = function(blogId) { return this.BlogSend(null, 'BlogViewEdit', null, null, blogId); } SiteLifeProxy.prototype.BlogPostCreate = function(blogId) { return this.BlogSend(null, 'BlogPostCreate', null, null, blogId, 'plckRedirectUrl=' + this.GetParameter("plckRedirectUrl")); } SiteLifeProxy.prototype.BlogPendingComments = function(blogId, currentPage) { if( !currentPage) currentPage = 0; return this.BlogSend(null, 'BlogPendingComments', null, null, blogId, 'plckCurrentPage='+currentPage); } SiteLifeProxy.prototype.BlogSettings = function(blogId) { return this.BlogSend(null, 'BlogSettings', null, null, blogId); } SiteLifeProxy.prototype.BlogEditPost = function(blogId, controller, div, script, postId, selection, daysBack) { return this.BlogSend(controller, 'BlogPostEdit', div, script, blogId, 'plckPostId=' + postId + '&plckSelection=' + selection + '&plckDaysBack=' + daysBack + '&plckRedirectUrl=' + this.EscapeValue(window.location.href)); } SiteLifeProxy.prototype.BlogRemovePost = function(blogId, controller, div, script, postId, selection, daysBack) { if (confirm("Are you sure you want to delete this item?") == true) { return this.BlogSend(controller, 'BlogRemovePost', div, script, blogId, 'plckPostId=' + postId + '&plckSelection=' + selection + '&plckDaysBack=' + daysBack ); } return false; } SiteLifeProxy.prototype.BlogViewPost = function(blogId, postId, selection, daysBack) { if(!postId ) { postId = gSiteLife.GetParameter('plckPostId'); } return this.BlogSend(null, 'BlogViewPost', null, null, blogId, 'plckPostId=' + postId + '&plckSelection=' + selection + '&plckDaysBack=' + daysBack + '&plckCommentSortOrder=' + this.GetParameter('plckCommentSortOrder')); } SiteLifeProxy.prototype.BlogViewMonth = function(blogId, monthId) { if(!monthId ) { monthId = gSiteLife.GetParameter('plckMonthId'); } var AdParams = 'plckMonthId=' + monthId; AdParams += this.GetParameter('plckCurrentPage') ? '&plckCurrentPage=' + this.GetParameter('plckCurrentPage') : ""; return this.BlogSend(null, 'BlogViewMonth', null, null, blogId, AdParams); } SiteLifeProxy.prototype.AddBlogWatchItem= function(blogId, controller, script, Url, WatchKey) { return this.BlogSend(controller, 'AddBlogWatch', 'plckBlogWatchDiv', script, blogId, 'plckWatchKey=' + WatchKey + '&plckWatchUrl=' + this.EscapeValue(Url)); } SiteLifeProxy.prototype.RemoveBlogWatchItem= function(blogId, controller, script, WatchKey) { return this.BlogSend(controller, 'RemoveBlogWatch', 'plckBlogWatchDiv', script, blogId, 'plckWatchKey=' + WatchKey); } SiteLifeProxy.prototype.BlogViewTag = function(blogId, tag) { if(!tag ) { tag = gSiteLife.GetParameter('plckTag'); } var AdParams = 'plckTag=' + tag; AdParams += this.GetParameter('plckCurrentPage') ? '&plckCurrentPage=' + this.GetParameter('plckCurrentPage') : ""; return this.BlogSend(null, 'BlogViewTag', null, null, blogId, AdParams ); } SiteLifeProxy.prototype.BlogRefreshViewEditList= function(blogId, controller, div, script, selection, daysBack) { return this.BlogSend(controller, 'BlogRefreshViewEditList', div, script, blogId, 'plckSelection=' + selection + '&plckDaysBack=' + daysBack ); } SiteLifeProxy.prototype.BlogSend = function(controller, apiName, destDiv, scriptName, blogId, addParams){ if(!controller) controller = this.GetParameter('plckController'); if(!destDiv) destDiv = this.GetParameter('plckElementId'); if(!scriptName) scriptName = this.GetParameter('plckScript'); var url = this.__baseUrl + '/' + controller + '/' + apiName + '?plckElementId=' + destDiv + '&plckBlogId=' + blogId + '&' + addParams; this.__Send(url, scriptName, 'widget:blog'); return false; } SiteLifeProxy.prototype.Recommend = function(controller, itemId, recommendDiv) { var url = this.__baseUrl + '/' + controller + '/Recommend?plckElementId=' + recommendDiv + '&plckItemId=' +itemId; this.__Send(url); return false; } SiteLifeProxy.prototype.BlogSelectPendingComments = function(formId, checked) { var form = document.getElementById(formId); for (i=0; i"); }