function setFilter(a){var b=document.getElementById(a);
if(b.className.indexOf("filter-selected")>=0){b.className=replace(b.className,"filter-selected","")
}else{b.className+=" filter-selected"
}}function showHide(a){var b=document.getElementById(a);
if(b!=null){if(b.style.display=="block"||b.style.display==""){b.style.display="none"
}else{b.style.display="block"
}}}function showHideSearchResults(){_showHideSearchResults("search-results")
}function showHideActorSearchResults(){_showHideSearchResults("actor-results")
}function _showHideSearchResults(a){var c=document.getElementById(a);
var b=document.getElementById("showHideResults");
if(c!=null){if(c.style.display=="block"||c.style.display==""){$("search-visualisation-container").blindUp({duration:0.5});
Effect.BlindUp(a,{duration:0.5});
b.innerHTML="Show"
}else{c.style.display="block";
$("search-visualisation-container").style.display="block";
b.innerHTML="Hide"
}}}function clearResults(b){var a=document.getElementById(b);
if(a!=null){while(a.firstChild){a.removeChild(a.firstChild)
}}}function clearArticleSearchResults(){clearResults("search-results");
clearResults("search-visualisation");
$("search-visualisation-container").style.display="none"
}function toggleActors(){_toggleSection("search-actors")
}function toggleCategories(){_toggleSection("search-categories")
}function toggleTags(){_toggleSection("search-tags")
}function toggleLocales(){_toggleSection("search-locales")
}function toggleJurisdictions(){_toggleSection("search-jurisdictions")
}function toggleGroups(){_toggleSection("search-groups")
}function _toggleSection(a){if($(a).style.display=="none"){$(a).style.display="block"
}else{Effect.BlindUp(a,{duration:0.5})
}}function resetArticleSearchFields(b){var a=document.getElementById("articlesCount");
if(a!=null){a.innerHTML="???"
}clearResults(b);
clearResults("search-visualisation")
}function searchFor(h,d,a){var c="";
var b="";
var m="";
var e="";
resetArticleSearchFields(d);
var g=document.getElementsByTagName("DIV");
for(var f=0;
f<g.length;
f++){var k=g.item(f);
if(k.className.indexOf("filter-selected")>=0){if(k.id.indexOf("tag.")==0){if(c.length==0){c=c+k.id.substring(4)
}else{c=c+";"+k.id.substring(4)
}}else{if(k.id.indexOf("cat.")==0){if(b.length==0){b=b+k.id.substring(4)
}else{b=b+";"+k.id.substring(4)
}}else{if(k.id.indexOf("actor.")==0){if(m.length==0){m=m+k.id.substring(6)
}else{m=m+";"+k.id.substring(6)
}}else{if(k.id.indexOf("group.")==0){if(e.length==0){e=e+k.id.substring(6)
}else{e=e+";"+k.id.substring(6)
}}}}}}}var j=document.getElementById("content").value;
var l=h+"REST/articles/?q="+j+"&cats= "+b+"&tags= "+c+"&actors= "+m+"&groups= "+e+"&maxMatches="+$F("maxMatches")+"&sort= &mode= &startDate= &endDate=999999999999999";
$("JSON_Icon").innerHTML='<a href="'+l+'"><img style="border:0; margin-left: 5px; margin-right: 5px" src="http://drupal.org/files/issues/JSON.png" /></a>';
_searchForArticles(h,d,$F("maxMatches"),a,j,c,b,m,e,null,null)
}function _searchForArticles(j,f,i,d,g,n,m,h,c,b,l){var a=false;
if(window.XMLHttpRequest){a=new XMLHttpRequest();
if(a.overrideMimeType){a.overrideMimeType("text/xml")
}}else{if(window.ActiveXObject){try{a=new ActiveXObject("Msxml2.XMLHTTP")
}catch(k){try{a=new ActiveXObject("Microsoft.XMLHTTP")
}catch(k){}}}}if(!a){document.getElementById(f).innerHTML="Error"
}a.onreadystatechange=function(){_handleArticlesResponse(j,f,l,a)
};
a.open("GET",j+"search?currActor="+d+"&q="+g+"&tags="+n+"&cats="+m+"&actors="+h+"&groups="+c+"&maxMatches="+i+(b!=null?("&startDate="+b):"")+(l!=null?("&endDate="+l):""),true);
a.send(".")
}function getArticleLinkTarget(){return""
}function getActorLinkTarget(){return""
}function getGroupLinkTarget(){return""
}function getResourceLinkTarget(){return""
}function _handleLink(a,b,c){window.open("article.jsp?id="+a+"&type="+b+"&q="+replaceApos(c),getArticleLinkTarget(),"")
}function _handleArticlesResponse(e,G,j,r){if(r.readyState==4){var t=document.getElementById(G);
var n="";
if(r.status==0||r.status==200){var b=r.responseXML.getElementsByTagName("response").item(0);
if(b==null){document.getElementById("articlesCount").innerHTML="0";
alert("There was an error with your query - please try again.");
return
}var F=b.getElementsByTagName("query");
if(F!=null){n=F[0].firstChild.data;
document.getElementById("query-ran").innerHTML=n;
document.getElementById("query-ran").style.display="none"
}var k=document.getElementById("search-visualisation");
var D=b.getElementsByTagName("stats");
var v=D[0];
if($("timings")!=null){$("timings").innerHTML="in "+v.getAttribute("queryTime")+" msecs ("+v.getAttribute("totalTime")+" msecs total)"
}var p=b.getElementsByTagName("article");
if(p!=null&&p.length>0){document.getElementById("articlesCount").innerHTML=p.length;
var a=-1;
var l=(j!=null)?j:new Date().getTime();
for(var A=0;
A<p.length;
A++){var h=parseInt(p[A].getAttribute("date"));
if(a==-1||h<a){a=h
}}_addMonthGridlines(k,a,l);
var x=new Array();
for(A=0;
A<p.length;
A++){var q=p[A];
var f=parseInt(q.getAttribute("date"));
var m=f%86400==0;
var g=new Date(f);
var s=100*(f-a)/(l-a);
var d=parseFloat(q.getAttribute("score"));
var z=d/100;
var u=q.getElementsByTagName("title")[0].firstChild.data;
var C=parseInt(s*2);
var o=m?new Date(f).toDateString():g.toLocaleString();
_addMatchElem(t,n,q.getAttribute("id"),u,q.getElementsByTagName("frag")[0].firstChild,o,d,z);
var B=document.createElement("IMG");
B.setAttribute("src","img/people.gif");
B.setAttribute("title",u+" @ "+o);
B.setAttribute("style","left:"+s+"%; position:absolute; cursor:pointer; opacity:"+z);
B.setAttribute("onclick","_handleLink("+q.getAttribute("id")+",'"+q.getAttribute("type")+"','"+n+"')");
k.insertBefore(B,null);
if(x[C]==null){x[C]=new Array()
}x[C].push(B)
}for(var w=0;
w<x.length;
w++){if(x[w]==null){continue
}var y=100/(x[w].length+1);
var E=y;
for(var c=0;
c<x[w].length;
c++){x[w][c].style.top=E+"%";
E+=y
}}if($("search-results")!=null){$("search-results").style.display="block"
}$("search-visualisation-container").style.display="block"
}else{document.getElementById("articlesCount").innerHTML="0";
$("search-visualisation-container").style.display="none"
}}else{alert("There was an error, please contact us.")
}}if($("loading")!=null){$("loading").toggle()
}}function getPercentageScoreElem(a){return getPercentageScoreElem2(a,a/100)
}function getPercentageScoreElem2(b,a){return getPercentageScoreElem2WithStyle(b,a,"padding: 0 5px 0 5px; margin-right: 10px")
}function getPercentageScoreElem2WithStyle(c,a,d){var b="background-color: rgb("+parseInt(255-(a*68))+","+parseInt(255-(a*238))+","+parseInt(255-(a*255))+")";
return Builder.node("span",{style:b+"; "+d},c+"%")
}function _addMatchElem(g,b,l,f,e,m,j,i,d){if(g!=null){var a=(b!=null&&b!="")?("&q="+replaceApos(b)):"";
var h=Builder.node("a",{title:e,href:"article.jsp?id="+l+a,target:getArticleLinkTarget()});
h.innerHTML=e;
var c=Builder.node("p",{className:f},[getPercentageScoreElem2(i,d),h," @ "+j]);
g.insertBefore(c,null);
if(m!=null&&m.data!=null&&m.data!=""){var k=Builder.node("p",{className:"search-frag"});
k.innerHTML=m.data;
g.insertBefore(k,null)
}}}function _addMonthGridlines(i,h,j){var b=new Date(h);
var g=(j-h)/100;
var e=-1;
var a=b.getMonth();
var f=b.getFullYear();
while(e<j){var d=new Date(f,++a,1);
e=d.getTime();
if(e<j){var c=(e-h)/g;
var k=document.createElement("IMG");
if(d.getMonth()==0){k.setAttribute("src","img/grid-year.gif")
}else{k.setAttribute("src","img/grid.gif")
}k.setAttribute("class","grid");
k.setAttribute("style","left:"+c+"%");
i.insertBefore(k,null)
}}}function searchForActors(b,a){document.getElementById("articlesCount").innerHTML="???";
clearResults(a);
_searchForActors(b,a,document.getElementById("content").value)
}function _searchForActors(b,a,c){new Ajax.Request(b+"actorSearch",{parameters:{q:c},onSuccess:function(h){var d=h.responseText.evalJSON();
$("articlesCount").innerHTML=d.length;
$("articlesCountLabel").innerHTML=(d.length==1)?"match":"matches";
for(var e=0;
e<d.length;
e++){var g;
if(d[e].groupDisplayName!=null){g=document.createElement("A");
g.setAttribute("href",b+"group.jsp?id="+d[e].groupId);
g.setAttribute("target",getGroupLinkTarget());
g.appendChild(document.createTextNode(d[e].groupDisplayName))
}else{if(d[e].un!=null){g=document.createElement("A");
g.setAttribute("href",b+"actor.jsp?id="+d[e].un);
g.setAttribute("target",getActorLinkTarget());
g.appendChild(document.createTextNode(d[e].fn+" "+d[e].sn))
}else{continue
}}var f=document.createElement("P");
f.setAttribute("class","search-result");
f.appendChild(g);
$(a).insertBefore(f,null)
}}})
}function updateTimeline(d){var b=$("timeline-date").value;
var a=b.indexOf("_");
resetArticleSearchFields("search-results");
var c=$("hidden-currentActor").innerHTML;
_searchForArticles(d,"search-results",-1,c,"","","","","",b.substring(0,a),b.substring(a+1));
new Ajax.Request(d+"search?currActor="+c+"&startDate="+b.substring(0,a)+"&endDate="+b.substring(a+1)+"&sort=byDate&mode=timeline&maxMatches=-1",{onSuccess:function(e){handleTimelineXML(e.responseXML)
}})
}function handleTimelineXML(c){var d=c.getElementsByTagName("response").item(0);
if(d==null){return -1
}var l=d.getElementsByTagName("article");
if(l!=null&&l.length>0){var k=[];
var e={};
var g=parseInt(l[0].getAttribute("date"));
for(var j=0;
j<l.length;
j++){var m=l[j];
var b=parseInt(l[j].getAttribute("date"));
var f=new Date(b);
var h=m.getElementsByTagName("title")[0].firstChild.data;
var a=parseInt((b-g)/86400000);
k.push({id:m.getAttribute("id"),author:replace(h,"&apos;","'"),date:f,page:a});
e[a]={title:formatDate(f),date:f}
}run(k,e);
return l.length
}return -1
}function activateUser(c,a,b){new Ajax.Request(c+"activateActor?un="+a+"&return="+c+"actor.jsp?id="+a,{onSuccess:function(d){$(b).toggle()
}})
}function clearCredentials(c,a,b){new Ajax.Request(c+"clearCredentials?un="+a,{onSuccess:function(d){$(b).toggle()
}})
}function flagArticle(e,d,b,a,c){new Ajax.Request(e+"flag?articleId="+b+"&actorId="+a+"&comment="+c+"&type="+d,{onSuccess:function(j){var g=j.responseXML.getElementsByTagName("response").item(0);
var h=g.getElementsByTagName("flag");
if(h!=null&&h.length>0){var f=h[0].getAttribute("code");
if(f==0){var i=h[0].getAttribute("count");
if(d=="FLAG"){$("flagStatus-"+d).innerHTML="<strong>("+i+")</strong>"
}else{if(d=="FAVE"){$("flagStatus-"+d).innerHTML="<strong>("+i+")</strong>"
}}}else{if(f==-2){alert("Sorry, Actors can't flag their own articles.")
}else{if(f!=-1){alert("Oops, status is "+f)
}}}}}})
}function _createPoblishButton(a,c,d){var b=(d!=null)?d:"";
return Builder.node("a",{href:"#",className:"poblishButton",style:b,onclick:c},[Builder.node("span",{className:"poblishButtonText"},a)])
}var FacebookStylePopup=Class.create({initialize:function(e,d,a){var c=document.viewport.getScrollOffsets().top+125;
var f="-webkit-border-bottom-left-radius: 8px 8px; -webkit-border-bottom-right-radius: 8px 8px; -webkit-border-top-left-radius: 8px 8px; -webkit-border-top-right-radius: 8px  8px;";
this.m_OutermostElem=document.createElement("DIV");
this.m_OutermostElem.setAttribute("style","z-index: 1000; display: none; position: absolute; height: 0; left: 0; top: 0; width: 100%; font-weight: normal;");
var g=document.createElement("DIV");
g.setAttribute("class","userInfoPopup");
g.setAttribute("style","position: relative; margin: auto; height: 0; width: "+a+"px; top: "+c+"px");
var b=document.createElement("DIV");
b.setAttribute("style","-moz-border-radius: 8px; border: 10px solid rgba(82,82,82,0.7); -moz-background-clip: border; -moz-background-inline-policy: continuous; -moz-background-origin: padding; "+f);
this.m_ContentElem=document.createElement("DIV");
this.m_ContentElem.setAttribute("style","background-color: white;");
this.m_ContentElem.appendChild(d.getElem());
b.appendChild(this.m_ContentElem);
g.appendChild(b);
this.m_OutermostElem.appendChild(g);
e.parentNode.insertBefore(this.m_OutermostElem,e.nextSibling)
},appendChild:function(a){this.m_ContentElem.appendChild(a)
},show:function(){this.m_OutermostElem.appear({duration:0.5})
}});
var FacebookStylePopupHeader=Class.create({initialize:function(a,b){this.m_Elem=document.createElement("P");
this.m_Elem.setAttribute("style","width: auto; background-color: rgb(219,189,88); border-bottom: 1px solid black; margin: 0; padding: 6px 0 6px 7px");
this.m_Elem.setAttribute("id",b);
this.m_Elem.innerHTML=a
},getElem:function(){return this.m_Elem
},setContent:function(a){this.m_Elem.innerHTML=a
}});
var g_CurrentUsername="";
var g_FBStyleHeaderId="safssdfsdf";
var g_TheForm;
var g_DefaultNumActivityItemsForPopup=8;
function handleUsernameClick(c){var e='<strong>Actor:&nbsp;</strong><a href="http://www.poblish.org/actor.jsp?id=';
var b=new FacebookStylePopupHeader(e+c.innerHTML+'" target="'+getActorLinkTarget()+'"></a>',g_FBStyleHeaderId);
var a=getAppURL()+"userInfo";
var f={username:c.innerHTML,loggedInActorId:getActorId()};
var d=function(l){var g=l.responseText.evalJSON();
var k=g.displayName.strip();
k=(k=="")?"???":k;
b.setContent(e+c.innerHTML+'" target="'+getActorLinkTarget()+'">'+k+"</a>");
if(g.following!=null){populateUserInfoForm(g_TheForm,g,"followActor('Actor',"+getAppURL()+","+getActorId()+","+g.actorId+")")
}if(g.adminGroups!=null&&g.adminGroups.length>0){var j=Builder.node("FORM",{id:"adminGroupsForm",style:"padding: 0 0 5px 10px;"},[Builder.node("input",{type:"hidden",name:"loggedInActorId",value:getActorId()}),Builder.node("input",{type:"hidden",name:"targetActorId",value:g.actorId}),Builder.node("input",{type:"hidden",name:"code",id:"adminGroupsFormCode",value:""}),Builder.node("input",{type:"hidden",id:"currActorUN",value:c.innerHTML}),Builder.node("label","Your Groups..."),Builder.node("select",{id:"adminGroupsSelect",onchange:"updateAdminGroupsLayoutToMatchSelectedGroup()",name:"groupId",style:"margin: 0 8px 0 8px"}),Builder.node("input",{type:"button",value:"",id:"joinLeaveButton",onclick:"addActorToGroup()"})]);
g_TheForm.parentNode.insertBefore(j,g_TheForm);
for(var h=0;
h<g.adminGroups.length;
h++){$("adminGroupsForm").appendChild(Builder.node("input",{type:"hidden",id:"joinLeaveType."+h,value:g.adminGroups[h].type}));
$("adminGroupsSelect").appendChild(Builder.node("option",{value:g.adminGroups[h].groupId},[g.adminGroups[h].groupDisplayName]))
}updateAdminGroupsLayoutToMatchSelectedGroup()
}populateChannel(getAppURL(),"actorChannelsBox","props=actor:"+_adjustLookupNameForChannel(c.innerHTML)+":ALL;",g_DefaultNumActivityItemsForPopup)
};
showUserInfoHidePopup(c,c.innerHTML,b,a,f,d,true)
}function handleGroupClick(c,f){var e='<strong>Group:&nbsp;</strong><a href="http://www.poblish.org/group.jsp?id=';
var b=new FacebookStylePopupHeader(e+f+'" target="'+getGroupLinkTarget()+'">???</a>',g_FBStyleHeaderId);
var a=getAppURL()+"groupInfo";
var g={groupId:f,loggedInActorId:getActorId()};
var d=function(j){var h=j.responseText.evalJSON();
b.setContent(e+f+'" target="'+getGroupLinkTarget()+'">'+h.displayName+"</a>");
if(h.following!=null){populateUserInfoForm(g_TheForm,h,"followActor('Group',"+getAppURL()+","+getActorId()+","+f+")")
}var i=Builder.node("FORM",{style:"padding: 0 0 5px 10px;"},[Builder.node("label","Group Options: "),]);
g_TheForm.parentNode.insertBefore(i,g_TheForm);
createGroupMembershipButton(getAppURL(),h.membership_status,getActorId(),f,i);
populateChannel(getAppURL(),"actorChannelsBox","props=group:"+_adjustLookupNameForChannel(h.nickName)+":ALL;",g_DefaultNumActivityItemsForPopup)
};
showUserInfoHidePopup(c,"",b,a,g,d,true)
}function handleBlogClick(d,b){var f='<strong>Blog:&nbsp;</strong><a href="http://www.poblish.org/blog.jsp?type=Blog&id=';
var c=new FacebookStylePopupHeader(f+b+'" target="'+getResourceLinkTarget()+'">???</a>',g_FBStyleHeaderId);
var a=getAppURL()+"resourceInfo";
var g={resourceId:b,resourceType:"Blog",loggedInActorId:getActorId()};
var e=function(i){var h=i.responseText.evalJSON();
c.setContent(f+b+'" target="'+getResourceLinkTarget()+'">'+h.displayName+"</a>");
if(h.following!=null){populateUserInfoForm(g_TheForm,h,"followActor('Blog',"+getAppURL()+","+getActorId()+","+b+")")
}populateChannel(getAppURL(),"actorChannelsBox","props=blog:"+_adjustLookupNameForChannel(h.displayName)+":ALL;",g_DefaultNumActivityItemsForPopup)
};
showUserInfoHidePopup(d,"",c,a,g,e,true)
}function handleFeedClick(d,b){var f='<strong>Feed:&nbsp;</strong><a href="http://www.poblish.org/blog.jsp?type=Feed&id=';
var c=new FacebookStylePopupHeader(f+b+'" target="'+getResourceLinkTarget()+'">???</a>',g_FBStyleHeaderId);
var a=getAppURL()+"resourceInfo";
var g={resourceId:b,resourceType:"Feed",loggedInActorId:getActorId()};
var e=function(i){var h=i.responseText.evalJSON();
c.setContent(f+b+'" target="'+getResourceLinkTarget()+'">'+h.displayName+"</a>");
if(h.following!=null){populateUserInfoForm(g_TheForm,h,"followActor('Feed',"+getAppURL()+","+getActorId()+","+b+")")
}populateChannel(getAppURL(),"actorChannelsBox","props=feed:"+_adjustLookupNameForChannel(h.displayName)+":ALL;",g_DefaultNumActivityItemsForPopup)
};
showUserInfoHidePopup(d,"",c,a,g,e,true)
}function handleWikiClick(e,b){var g="<strong>Wiki:&nbsp;</strong>";
var d=new FacebookStylePopupHeader(g+"???",g_FBStyleHeaderId);
var c="com.hiatus.poblish2.wiki.entity.WikiResource";
var a=getAppURL()+"resourceInfo";
var h={resourceId:b,resourceType:c,loggedInActorId:getActorId()};
var f=function(j){var i=j.responseText.evalJSON();
d.setContent(g+'<a href="'+i.wikiURL+'" target="newResWindow">'+i.displayName+"</a>");
if(i.following!=null){populateUserInfoForm(g_TheForm,i,"followActor('"+c+"',"+getAppURL()+","+getActorId()+","+b+")")
}populateChannel(getAppURL(),"actorChannelsBox","props=wiki:"+_adjustLookupNameForChannel(i.displayName)+":ALL;",g_DefaultNumActivityItemsForPopup)
};
showUserInfoHidePopup(e,"",d,a,h,f,true)
}function handleCategoryClick(b,d){var c="<strong>Category:&nbsp;</strong>";
var a=new FacebookStylePopupHeader(c+d,g_FBStyleHeaderId);
populateChannel(getAppURL(),"actorChannelsBox","props=global:ARTICLE(+"+d+");",g_DefaultNumActivityItemsForPopup);
showUserInfoHidePopup(b,"",a,null,null,null,true)
}function closeUserInfoPopup(){$$("DIV.userInfoPopup").each(function(a){a.parentNode.removeChild(a)
})
}function showUserInfoHidePopup(h,j,a,g,c,i,d){var b=false;
$$("DIV.userInfoPopup").each(function(k){if(d){if(g_CurrentUsername==j){b=true
}else{k.parentNode.removeChild(k)
}}else{b=true
}});
if(b){return
}g_CurrentUsername=j;
var f=Builder.node("FORM",{style:"padding: 0 0 7px 10px; text-align: right"},[_createPoblishButton("Close","closeUserInfoPopup()","margin-right: 7px")]);
g_TheForm=f;
new Ajax.Request(g,{method:"POST",parameters:c,onSuccess:i});
var e=new FacebookStylePopup(h,a,600);
e.appendChild(Builder.node("p",{style:"font-weight: bold; padding: 6px 0 0 7px; margin: 0"},"Recent Activity..."));
e.appendChild(Builder.node("div",{id:"actorChannelsBox",className:"channelsBox",style:"margin: 5px; line-height:1.5"}));
e.appendChild(f);
e.show()
}function populateUserInfoForm(d,a,c){var b=Builder.node("FORM",{style:"padding: 0 0 5px 10px;"},[Builder.node("label","Follow Options: "),Builder.node("input",{type:"checkbox",id:"userPopupFollowCheckbox",onclick:c}),Builder.node("label",{"for":"userPopupFollowCheckbox",style:"font-weight: normal"},"Following"),Builder.node("input",{type:"checkbox",id:"userPopupDigestCheckbox",onclick:c}),Builder.node("label",{"for":"userPopupDigestCheckbox",style:"font-weight: normal"},"Include in Daily Digest"),]);
d.parentNode.insertBefore(b,d);
if(a.following==true){$("userPopupFollowCheckbox").setAttribute("checked","checked")
}if(a.includeInDailyDigest==null){$("userPopupDigestCheckbox").setAttribute("disabled","disabled")
}if(a.includeInDailyDigest!=null&&a.includeInDailyDigest==true){$("userPopupDigestCheckbox").setAttribute("checked","checked")
}}function followActor(f,c,e,b){var a=$("userPopupFollowCheckbox").checked;
if(a){$("userPopupDigestCheckbox").removeAttribute("disabled")
}else{$("userPopupDigestCheckbox").setAttribute("disabled","disabled")
}var d=a?($("userPopupDigestCheckbox").checked?"1":"0"):"";
new Ajax.Request(c+"follow",{method:"POST",parameters:{targetId:b,targetType:f,loggedInActorId:e,follow:a,includeInDailyDigest:d},onSuccess:function(h){var g=h.responseText.evalJSON()
}})
}function getAppURL(){return $("hidden-application-URL").innerHTML
}function getActorId(){return $("hidden-currentActorId").innerHTML
}function _adjustLookupNameForChannel(a){return replace(a,":","&colon;")
}function personLocationPopulateChannel(f,b,e,c){var a=$("hidden-displayType").innerHTML;
var d=null;
if(a=="last_hour"){d=new Date().getTime()-(MSECS_IN_SECOND*SECS_IN_MIN*MINS_IN_HR)
}else{if(a=="last_day"){d=new Date().getTime()-(MSECS_IN_SECOND*SECS_IN_MIN*MINS_IN_HR*HRS_IN_DAY)
}else{if(a=="last_week"){d=new Date().getTime()-(MSECS_IN_SECOND*SECS_IN_MIN*MINS_IN_HR*HRS_IN_DAY*7)
}}}populateChannel(getAppURL(),"recentRefs","props="+b+";"+e+";",999,d,f)
}function populateChannel(k,d,e,f,a,c){if(e=="props="){var g=document.getElementById(d);
if(g!=null){while(g.firstChild){g.removeChild(g.firstChild)
}_populateChannelShowNoEntries(g)
}return
}var b=$(d);
var j="50%";
var i=Builder.node("div",{id:"channelProgress",className:"loadProgress",style:"top: "+j+";"});
if(b!=null){b.appendChild(i)
}var h=(a!=null&&a!="")?("&startDateMS="+parseInt(a)+"&endDateMS=-1&sort=BY_DATE_REVERSE"):"";
new Ajax.Request(k+"REST/feed/?"+e+"&maxEntries="+f+h,{method:"GET",onSuccess:function(z){b.childElements().each(function(E){if(E.id!="channelProgress"){E.parentNode.removeChild(E)
}});
var v=z.responseText.evalJSON();
if(v.length==0){_populateChannelShowNoEntries(b);
return
}var D=new Date().getTime();
for(var w=0;
w<v.length;
w++){var s=v[w];
if(s==null){continue
}var o=parseInt(s.timeMsecs);
if(o>D){continue
}var p=getFormattedTimeDiffForTime(o,D);
var x=Builder.node("div",{className:"channelsContainer"});
var l=Builder.node("div",{className:"author",onclick:"handleUsernameClick(this)",title:"Click for more information about this Actor"},[(s.username.length>0)?s.username:"???"]);
var t;
if(s.activityType=="FeedArticle"||s.activityType=="Article"||s.activityType=="WikiArticle"){if(c!=null&&c!=""&&s.sentiment!=null){try{var r=s.sentiment.evalJSON(false);
for(var u=0;
u<r.length;
u++){if(r[u].name==c){var y="0";
var m="NEUTRAL";
var q="Neutral or mixed references";
if(r[u].mean_s=="POSITIVE"){m="POSITIVE";
if(r[u].min_s=="NEGATIVE"||r[u].max_s=="NEGATIVE"){y="P";
q="Largely positive references"
}else{y="PP";
q="Wholly positive references"
}}else{if(r[u].mean_s=="NEGATIVE"){m="NEGATIVE";
if(r[u].min_s=="POSITIVE"||r[u].max_s=="POSITIVE"){y="N";
q="Largely negative references"
}else{y="NN";
q="Wholly negative references"
}}}x.appendChild(Builder.node("div",{className:"title",style:"font-weight:bold",title:q},[getSentimentSpanForType(y,m)]))
}}}catch(A){}}t=Builder.node("div",{className:"title"});
t.innerHTML='<a target="'+getArticleLinkTarget()+'" title="'+_getHoverTitle(s.title)+'" href="http://www.poblish.org/article.jsp?id='+s.activityId+'">'+_getDisplayTitle(s.title)+"</a>, by";
x.appendChild(t);
var n=(s.articleNumPtlAuthors>1||s.articleFromGroupRes=="true");
if(s.blogId!=null&&(n||s.username=="")){x.appendChild(_createBlogBoxElem(s.blogId,s.articleResName))
}else{if(s.feedId!=null&&(n||s.username=="")){x.appendChild(_createFeedBoxElem(s.feedId,s.articleResName))
}else{x.appendChild(l)
}}}else{if(s.activityType=="FavouriteFlag"){x.appendChild(l);
t=Builder.node("div",{className:"title"});
t.innerHTML='marked <a target="'+getArticleLinkTarget()+'" title="'+_getHoverTitle(s.title)+'" href="http://www.poblish.org/article.jsp?id='+s.activityId+'">'+_getDisplayTitle(s.title)+"</a> as a <strong>favourite</strong>,";
x.appendChild(t)
}else{if(s.activityType=="SimpleFlag"){x.appendChild(l);
t=Builder.node("div",{className:"title"});
t.innerHTML='<strong>flagged-up</strong> <a target="'+getArticleLinkTarget()+'" title="'+_getHoverTitle(s.title)+'" href="http://www.poblish.org/article.jsp?id='+s.activityId+'">'+_getDisplayTitle(s.title)+"</a>,";
x.appendChild(t)
}else{if(s.activityType=="ArticleVersion"){x.appendChild(l);
t=Builder.node("div",{className:"title"});
t.innerHTML='<strong>contributed to</strong> <a target="'+getArticleLinkTarget()+'" title="'+_getHoverTitle(s.title)+'" href="http://www.poblish.org/article.jsp?id='+s.articleId+"&versionId="+s.activityId+'">'+_getDisplayTitle(s.title)+"</a>,";
x.appendChild(t)
}else{if(s.activityType=="ArticleRating"){x.appendChild(l);
var B=(s.articleVersionId>0)?("&versionId="+s.articleVersionId):"";
t=Builder.node("div",{className:"title"});
t.innerHTML='<strong>rated</strong> <a target="'+getArticleLinkTarget()+'" title="'+_getHoverTitle(s.title)+'" href="http://www.poblish.org/article.jsp?id='+s.articleId+B+'">'+_getDisplayTitle(s.title)+"</a> as <strong>"+s.score+"</strong>/10,";
x.appendChild(t)
}else{if(s.activityType=="FollowRelationship"){x.appendChild(l);
x.appendChild(Builder.node("div",{className:"title"},"started following"));
if(s.targetBlogDisplayName!=null&&s.targetBlogDisplayName!=""){x.appendChild(_createBlogBoxElem(s.targetBlogId,s.targetBlogDisplayName))
}else{if(s.targetFeedDisplayName!=null&&s.targetFeedDisplayName!=""){x.appendChild(_createFeedBoxElem(s.targetFeedId,s.targetFeedDisplayName))
}else{if(s.targetGroupDisplayName!=null&&s.targetGroupDisplayName!=""){x.appendChild(_createGroupBoxElem(s.targetGroupId,s.targetGroupDisplayName))
}else{x.appendChild(_createActorBoxElem(s.targetActorUsername))
}}}}else{if(s.activityType=="GroupEvent"){x.appendChild(l);
t=Builder.node("div",{className:"title"},"created the Group");
x.appendChild(t);
x.appendChild(_createGroupBoxElem(s.groupId,s.groupDisplayName))
}else{if(s.activityType=="AssertionFlag"){x.appendChild(l);
x.appendChild(Builder.node("div",{className:"title"},["flagged an ",Builder.node("strong",["assertion"]),","]))
}}}}}}}}x.appendChild(Builder.node("div",{className:"date"},p));
addFlagFaveIndicatorsToContainer(x,s);
if(s.cats!=null&&s.cats.length>0){x.appendChild(Builder.node("div",{className:"article-cat-first"},s.cats[0]));
for(var C=1;
C<s.cats.length;
C++){x.appendChild(Builder.node("div",{className:"article-cat-sub"},s.cats[C]))
}}b.appendChild(x)
}},onComplete:function(){if(b!=null){b.removeChild(i)
}}})
}function _createActorBoxElem(a,c,d){var b=(d!=null)?d:Builder.node("div",{className:(c!=null)?c:"author"});
b.setAttribute("style","font-weight: normal");
b.setAttribute("onclick","handleUsernameClick(this)");
b.setAttribute("title","Click for more information about this Actor");
b.appendChild(_createAdjustedTitleNode(a));
return b
}function _createBlogBoxElem(a,e,b,d){var c=(d!=null)?d:Builder.node("div",{className:(b!=null)?b:"author"});
c.setAttribute("style","font-weight: bold");
c.setAttribute("onclick","handleBlogClick(this,"+a+")");
c.setAttribute("title","Click for more information about this Blog");
c.appendChild(_createAdjustedTitleNode(e));
return c
}function _createFeedBoxElem(b,d,a,c){var e=(c!=null)?c:Builder.node("div",{className:(a!=null)?a:"author"});
e.setAttribute("style","font-weight: bold");
e.setAttribute("onclick","handleFeedClick(this,"+b+")");
e.setAttribute("title","Click for more information about this Feed");
e.appendChild(_createAdjustedTitleNode(d));
return e
}function _createWikiBoxElem(c,b,a){return Builder.node("div",{className:(a!=null)?a:"author",style:"font-weight: bold; font-style: italic",title:"Click for more information about this Wiki",onclick:"handleWikiClick(this,"+c+")"},[_createAdjustedTitleNode(b)])
}function _createGroupBoxElem(c,d,b){var a=document.createElement("DIV");
a.setAttribute("class",(b!=null)?b:"author");
a.setAttribute("style","font-weight: bold");
a.setAttribute("onclick","handleGroupClick(this,"+c+")");
a.setAttribute("title","Click for more information about this Group");
a.appendChild(_createAdjustedTitleNode(d));
return a
}function _populateChannelShowNoEntries(b){var c=document.createElement("DIV");
c.setAttribute("class","channelsContainer");
var a=document.createElement("DIV");
a.setAttribute("class","title");
a.innerHTML="<em>No entries at present</em>";
c.appendChild(a);
b.appendChild(c)
}function _createAdjustedTitleNode(a){return document.createTextNode(_adjustChannelTitle(a))
}function _adjustChannelTitle(c,b){var a=(b!=null)?b:60;
if(c.length>a){return c.substring(0,a)+"..."
}return c
}function _getHoverTitle(a){return(a!=null&&a.length>0)?replace(a,'"',"'"):""
}function _getDisplayTitle(a){return(a!=null&&a.length>0)?_adjustChannelTitle(a):"???"
}function addFlagFaveIndicatorsToContainer(a,b){if(b.numFaves!=null&&b.numFaves>0){addFaveIndicatorToContainer(a,b.numFaves)
}if(b.numFlags!=null&&b.numFlags>0){addFlagIndicatorToContainer(a,b.numFlags)
}}function addFaveIndicatorToContainer(a,c,b,d){a.appendChild(Builder.node("div",{className:(b!=null)?b:"channelFlagContainer"},[Builder.node("img",{src:"http://www.poblish.org/img/tango/fave-mini.png",title:"Times marked as a favourite",style:"margin: 0"})]));
a.appendChild(Builder.node("div",{className:(d!=null)?d:"channelFlagNumber"},"("+c+")"))
}function addFlagIndicatorToContainer(a,c,b,d){a.appendChild(Builder.node("div",{className:(b!=null)?b:"channelFlagContainer"},[Builder.node("img",{src:"http://www.poblish.org/img/tango/flag-mini.png",title:"Times flagged-up for others to read",style:"margin: 0"})]));
a.appendChild(Builder.node("div",{className:(d!=null)?d:"channelFlagNumber"},"("+c+")"))
}function makeShadowBox(b,c,a){document.writeln('<input class="shadow-on" onfocus="toggleShadowBox(this)" onblur="toggleShadowBox(this,\''+a+'\')" type="text" name="'+c+'" id="'+b+'" value="'+a+'" />')
}function toggleShadowBox(b,a){if(b.hasClassName("shadow-on")){b.removeClassName("shadow-on");
b.addClassName("shadow-off");
b.value=""
}else{if(b.value==""){b.removeClassName("shadow-off");
b.addClassName("shadow-on");
b.value=a
}}}function globalSearch(c,d){if(d==""){return
}var e=$("globalSearchTabber");
var b="50%";
var a=Builder.node("div",{id:"channelProgress",className:"loadProgress",style:"top: "+b+";"});
if(e!=null){e.appendChild(a)
}new Ajax.Request(c+"globalSearch",{parameters:{q:d,wantFrags:"false"},onSuccess:function(l){var s=l.responseText.evalJSON();
var o=0,f=0,h=0,r=0,v=0;
var g=new Date().getTime();
for(var n=0;
n<s.length;
n++){if(s[n].type=="Article"||s[n].type=="FeedArticle"||s[n].type=="WikiArticle"){var m=s[n];
var u=parseFloat(m.score);
var q=u/100;
var p=getFormattedTimeDiffForTime(parseInt(m.date),g);
o++;
var k=Builder.node("div",{className:"title"});
k.innerHTML='<a target="'+getArticleLinkTarget()+'" title="'+_getHoverTitle(m.title)+'" href="http://www.poblish.org/article.jsp?id='+m.articleId+'">'+_getDisplayTitle(m.title)+"</a>, by";
var j=Builder.node("div",{className:"channelsContainer"},[getPercentageScoreElem2WithStyle(u,q,"float: left; padding: 0 6px 0; margin: 2px 5px 0 2px"),k]);
if(m.targetType=="Blog"){j.appendChild(_createBlogBoxElem(m.targetId,m.targetName))
}else{if(m.targetType=="Feed"){j.appendChild(_createFeedBoxElem(m.targetId,m.targetName))
}else{if(m.targetType=="Wiki"){j.appendChild(_createWikiBoxElem(m.targetId,m.targetName))
}else{j.appendChild(_createActorBoxElem(m.targetName))
}}}j.appendChild(Builder.node("div",{className:"date"},p));
addFlagFaveIndicatorsToContainer(j,m);
if(m.cats!=null&&m.cats.length>0){j.appendChild(Builder.node("div",{className:"article-cat-first"},m.cats[0]));
for(var t=1;
t<m.cats.length;
t++){j.appendChild(Builder.node("div",{className:"article-cat-sub"},m.cats[t]))
}}$("article-search-results").insertBefore(j,null)
}else{if(s[n].groupDisplayName!=null){f++;
$("group-search-results").insertBefore(_createGroupBoxElem(s[n].groupId,s[n].groupDisplayName,"filterLink"),null)
}else{if(s[n].un!=null){h++;
$("actor-search-results").insertBefore(_createActorBoxElem(s[n].un,"filterLink"),null)
}else{if(s[n].blogId!=null){r++;
$("blog-search-results").insertBefore(_createBlogBoxElem(s[n].blogId,s[n].blogDisplayName,"filterLink"),null)
}else{if(s[n].feedId!=null){v++;
$("feed-search-results").insertBefore(_createFeedBoxElem(s[n].feedId,s[n].feedDisplayName,"filterLink"),null)
}}}}}}if(o==0){addEmptyEntry($("article-search-results"))
}if(h==0){addEmptyEntry($("actor-search-results"))
}if(f==0){addEmptyEntry($("group-search-results"))
}if(r==0){addEmptyEntry($("blog-search-results"))
}if(v==0){addEmptyEntry($("feed-search-results"))
}$$("UL.tabbernav li:nth-child(1) a")[0].innerHTML="Articles ("+o+")";
$$("UL.tabbernav li:nth-child(2) a")[0].innerHTML="Actors ("+h+")";
$$("UL.tabbernav li:nth-child(3) a")[0].innerHTML="Groups ("+f+")";
$$("UL.tabbernav li:nth-child(4) a")[0].innerHTML="Blogs ("+r+")";
$$("UL.tabbernav li:nth-child(5) a")[0].innerHTML="Feeds ("+v+")"
},onComplete:function(){if(e!=null){e.removeChild(a)
}}})
}function addEmptyEntry(b){var a=Builder.node("p",{className:"globalEmptyEntry"});
a.innerHTML="<em>No items of this type were found.</em>";
b.insertBefore(a,null)
}function savePrefs(a){new Ajax.Request(a+"savePrefs",{parameters:$("userPreferencesForm").serialize(true),onSuccess:function(c){var b=c.responseText.evalJSON();
if(b.error!=null){alert("Sorry, an error occurred. "+b.error+".")
}}})
}function addNewResource(b,a){new Ajax.Request(b+"editActor",{parameters:$(a).serialize(true),onSuccess:function(d){var c=d.responseText.evalJSON();
if(c.error!=null){alert("Sorry, an error occurred. Please contact us to let us know.");
return
}_refreshAfterResourceChange()
}})
}function removeResource(b,a){new Ajax.Request(b+"editActor",{parameters:$(a).serialize(true),onSuccess:function(d){var c=d.responseText.evalJSON();
if(c.error!=null){alert("Sorry, an error occurred. Please contact us to let us know.");
return
}_refreshAfterResourceChange()
}})
}function _refreshAfterResourceChange(){var a=replace(window.top.location.href,"#","");
window.top.location.href=(a.indexOf("&tab=")>=0)?a:(a+"&tab=blogs")
}function changeResourceGroupStatus(c,a,e,b,d){new Ajax.Request(c+"resGroupStatusChange",{parameters:{loggedInActorId:a,resourceType:e,resourceId:b,isGroup:d},onSuccess:function(g){var f=g.responseText.evalJSON();
if(f.error!=null){alert("Sorry, an error occurred. Please contact us to let us know.");
return
}}})
}var GroupMembershipButton=Class.create({initialize:function(d,b,e,c,a){this.m_URLRoot=d;
this.m_ActorId=b;
this.m_GroupId=e;
this.m_Id=c;
this.m_Style=a;
this.m_Label="";
this.m_OnClickHandler="";
this.m_Disabled=false
},adjustGroupMembershipButton:function(a){if(a=="joined"){this.m_Label="Leave Group";
this.m_Code="leave"
}else{if(a=="may_join"){this.m_Label="Join Group";
this.m_Code="join"
}else{if(a=="may_apply"){this.m_Label="Apply to Join Group";
this.m_Code="apply"
}else{if(a=="applied"){this.m_Label="Join Request Sent";
this.m_Disabled=true
}}}}},setDisabled:function(){this.m_Disabled=true
},setLabel:function(a){this.m_Label=a
},setOnClickHandler:function(a){this.m_OnClickHandler=a
},updateExistingButton:function(){if(this.m_Code!=null){this.m_OnClickHandler="changeGroupMembership("+this.m_URLRoot+",'"+this.m_Code+"',"+this.m_ActorId+","+this.m_GroupId+")"
}var a=this.m_Label;
$(this.m_Id).setAttribute("onclick",this.m_OnClickHandler);
$(this.m_Id).childElements().each(function(b){if($w(b.className).indexOf("poblishButtonText")>=0){b.innerHTML=a
}})
},toNode:function(){if(this.m_Code!=null){this.m_OnClickHandler="changeGroupMembership("+this.m_URLRoot+",'"+this.m_Code+"',"+this.m_ActorId+","+this.m_GroupId+")"
}var a=this.m_Disabled?"poblishButtonDisabled":"poblishButton";
return Builder.node("a",{id:this.m_Id,href:"#",className:a,style:this.m_Style,onclick:this.m_OnClickHandler},[Builder.node("span",{className:"poblishButtonText"},this.m_Label)])
}});
function changeGroupMembership(b,d,a,c){new Ajax.Request(b+"changeGroupMembership",{parameters:{code:d,loggedInActorId:a,groupId:c},onSuccess:function(g){var e=g.responseText.evalJSON();
if(e.error!=null){alert("Sorry, an error occurred. Please contact us to let us know.");
return
}var f=new GroupMembershipButton(b,a,c,"groupPopupMbrshipButton");
f.adjustGroupMembershipButton(e.membership_status);
f.updateExistingButton()
}})
}function createGroupMembershipButton(e,d,b,f,c){var a=new GroupMembershipButton(e,b,f,"groupPopupMbrshipButton","margin-left: 6px");
if(d==null||d=="forbidden"){a.setDisabled();
a.setLabel("Log in to Join Group")
}else{a.adjustGroupMembershipButton(d)
}c.appendChild(a.toNode())
}function replace(a,g,e){var c=a.length,f=g.length;
if((c==0)||(f==0)){return a
}var b=a.indexOf(g);
if((!b)&&(g!=a.substring(0,f))){return a
}if(b==-1){return a
}var d=a.substring(0,b)+e;
if(b+f<c){d+=replace(a.substring(b+f,c),g,e)
}return d
}function replaceApos(a){return replace(a,"'","\\'")
}String.prototype.stripHTMLEntities=function(){return this.gsub("&nbsp;"," ").gsub("&apos;","'").gsub("&lsquo;","'").gsub("&rsquo;","'").gsub("&ldquo;",'"').gsub("&rdquo;",'"').gsub("&ndash;","-")
};
var caution=false;
function setCookie(c,b,a){setCookieFull(c,b,a,"/",null,null)
}function setCookieFull(e,c,a,h,d,g){var f=new Date();
f.setDate(f.getDate()+a);
var b=e+"="+escape(c)+((f)?"; expires="+f.toGMTString():"")+((h)?"; path="+h:"")+((d)?"; domain="+d:"")+((g)?"; secure":"");
if(!caution||(e+"="+escape(c)).length<=4000){document.cookie=b
}else{if(confirm("Cookie exceeds 4KB and will be cut!")){document.cookie=b
}}}function getCookie(b){if(document.cookie.length>0){var c=document.cookie.indexOf(b+"=");
if(c!=-1){c=c+b.length+1;
var a=document.cookie.indexOf(";",c);
if(a==-1){a=document.cookie.length
}return unescape(document.cookie.substring(c,a))
}}return""
}var MSECS_IN_SECOND=1000;
var MINS_IN_HR=60;
var HRS_IN_DAY=24;
var SECS_IN_MIN=60;
var APPROX_MSECS_IN_YEAR=31536000000;
function getFormattedTime(a){return getFormattedTimeDiffForTime(a,new Date().getTime())
}function getFormattedTimeDiffForTime(c,b){if((b-c)>=APPROX_MSECS_IN_YEAR){var a=c%86400==0;
return a?new Date(c).toDateString():new Date(c).toLocaleString()
}return getFormattedTimeDiff(b-c,true,true)+" ago"
}function getFormattedTimeDiff(a){return getFormattedTimeDiff(a,true,true)
}function getFormattedTimeDiff(a,d,i){var f="";
if(a>=MSECS_IN_SECOND){var h=a/MSECS_IN_SECOND;
if(h>=60){var g=Math.floor(h/SECS_IN_MIN);
h-=(g*SECS_IN_MIN);
if(g>=60){d=false;
var b=Math.floor(g/MINS_IN_HR);
g=g%MINS_IN_HR;
if(b>=HRS_IN_DAY){var e=Math.floor(b/HRS_IN_DAY);
if(e==1){f+="1 day"
}else{f+=e;
f+=" days"
}b=b%HRS_IN_DAY
}if(b>=1&&f.length>0){f+=(", ")
}if(b==1){f+="1 hour"
}else{if(b>1){f+=b;
f+=" hrs"
}}}if(g>=1&&f.length>0){f+=", "
}if(g==1){f+="1 minute"
}else{if(g>1){f+=g;
f+=" mins"
}}}var c=parseInt(h);
if(d&&c>0){if(f.length>0){f+=", "
}f+=c;
f+=(c>1)?" secs":" sec"
}}else{if(i){f+=(a);
f+=(" msecs")
}}return f
}function showFeedsGallery(){var c=new FacebookStylePopup($("feedsGalleryContainer"),new FacebookStylePopupHeader('<h1 style="font-size: 2em; margin: 7px 0 7px 0">Feeds Gallery</h3>',""),700);
var b="feedsGalleryChannelBox";
var d=Builder.node("FORM",{style:"padding: 8px 10px 5px 10px; text-align: left"},[Builder.node("LABEL",{},["Pick a Channel:  "]),Builder.node("SELECT",{id:"feedsGalleryChannelSelect",onchange:'populateChannel( getAppURL(),"'+b+'", this.options[this.selectedIndex].value, 15)'},[Builder.node("OPTION",{value:"props=global:ARTICLE;",id:"feedsGalleryChannelFirstOption"},["Articles: most recent"]),Builder.node("OPTION",{value:"props=global:ARTICLE(+economics);"},["Economics Articles: most recent"]),Builder.node("OPTION",{value:"props=global:ARTICLE(+politics);"},["Politics Articles: most recent"]),Builder.node("OPTION",{value:"props=global:ARTICLE(-politics,-economics);"},["Other Articles: most recent"]),Builder.node("OPTION",{value:"props=actor:aregan:ARTICLE;"},["Andrew Regan's Articles: most recent"]),Builder.node("OPTION",{value:"props=actor:aregan:ARTICLE(+economics);"},["Andrew Regan's Economics Articles: most recent"]),Builder.node("OPTION",{value:"props=global:FAVE;"},["Favourites: most recent"]),Builder.node("OPTION",{value:"props=global:FLAG;"},["Flags: most recent"]),Builder.node("OPTION",{value:"props=global:FOLLOW;"},["Follows: most recent"]),Builder.node("OPTION",{value:"props=global:VERSION;"},["New Versions: most recent"]),Builder.node("OPTION",{value:"props=global:RATING;"},["Ratings: most recent"]),Builder.node("OPTION",{value:"props=content:gordon+brown:ARTICLE;"},["Gordon Brown's feed"]),Builder.node("OPTION",{value:"props=content:tony+blair:ARTICLE;"},["Tony Blair's feed"]),Builder.node("OPTION",{value:"props=content:david+cameron:ARTICLE;"},["David Cameron's feed"]),Builder.node("OPTION",{value:"props=content:obama:ARTICLE;"},["Everything about Obama"]),Builder.node("OPTION",{value:"props=group:labourPartyUK:ARTICLE,FLAG,FAVE,RATING,VERSION;"},["Political Parties: Labour"]),Builder.node("OPTION",{value:"props=group:conservativesUK:ARTICLE,FLAG,FAVE,RATING,VERSION;"},["Political Parties: Conservatives"]),Builder.node("OPTION",{value:"props=group:libDemsUK:ARTICLE,FLAG,FAVE,RATING,VERSION;"},["Political Parties: Liberal Democrats"]),])]);
c.appendChild(d);
var e=document.createElement("DIV");
e.setAttribute("class","channelsBox");
e.setAttribute("id",b);
e.setAttribute("style","margin: 5px; line-height:1.5;");
c.appendChild(e);
populateChannel(getAppURL(),b,"props=global:ARTICLE;",15);
var a=Builder.node("FORM",{style:"padding: 8px 0 7px 10px; text-align: right"},[_createPoblishButton("Done","closeUserInfoPopup()","margin-right: 7px")]);
c.appendChild(a);
c.show();
$("feedsGalleryChannelFirstOption").selected=true
}var ChannelTab=Class.create({initialize:function(d,a,c,b){this.m_Idx=d;
this.m_PropsId=a;
this.m_PropsVal=c;
this.m_ChannelId=b
}});
function updateChannelWithId(b){var a=g_ChannelItems.find(function(c){return(c.m_ChannelId==b)
});
if(a!=null){populateChannel(getAppURL(),b,"props="+a.m_PropsVal,20)
}}function update1ChannelItem(c){var a=g_ChannelItems.find(function(d){return(d.m_Idx==c)
});
if(a!=null){var b=$(a.m_PropsId);
if(b==null){alert("Could not find: "+a.m_PropsId);
return null
}if(b.innerHTML==""){b.innerHTML=a.m_PropsVal;
updateChannelWithId(a.m_ChannelId)
}}return a
}function outputGoogleReaderButtonForId(b){var a=g_ChannelItems.find(function(c){return(c.m_ChannelId==b)
});
if(a!=null){document.write('&nbsp;&nbsp;<a href="http://fusion.google.com/add?source=atgs&feedurl=http%3A//www.poblish.org/REST/feed/%3Fprops%3D'+encodeURIComponent(a.m_PropsVal+"&maxEntries="+50+"&mediaType=application%2Frss%2Bxml&sort=BY_DATE_REVERSE")+'"><img src="http://gmodules.com/ig/images/plus_google.gif" border="0" alt="Add to Google"></a>')
}}var CustomFeedTypesPopup=Class.create({initialize:function(a){this.m_SelectNameId=a;
this.m_Actor=Builder.node("option",{value:"Actor"},["Actor"]);
this.m_Group=Builder.node("option",{value:"Group"},["Group"]);
this.m_Feed=Builder.node("option",{value:"Feed"},["Feed"]);
this.m_Blog=Builder.node("option",{value:"Blog"},["Blog"]);
this.m_Content=Builder.node("option",{value:"Content"},["Content"])
},getSelect:function(){return Builder.node("select",{id:this.m_SelectNameId,name:this.m_SelectNameId,onchange:"changeCustomFeedItemType(this)"},[this.m_Actor,this.m_Group,this.m_Blog,this.m_Feed,this.m_Content])
},setSelectedType:function(a){if(a=="Actor"){$(this.m_Actor).selected=true
}else{if(a=="Group"){$(this.m_Group).selected=true
}else{if(a=="Feed"){$(this.m_Feed).selected=true
}else{if(a=="Blog"){$(this.m_Blog).selected=true
}else{if(a=="Content"){$(this.m_Content).selected=true
}}}}}}});
function showCustomFeedEditor(h){var a=Builder.node("input",{type:"text",id:"customFeedName",name:"customFeedName",value:""});
var i=Builder.node("input",{type:"text",id:"customFeedDesc",name:"customFeedDesc",value:""});
var g=Builder.node("hr");
var d=new FacebookStylePopup($("customFeedEditorContainer"),new FacebookStylePopupHeader('<h1 style="font-size: 2em; margin: 7px 0 7px 0">Custom Feed</h3>',""),700);
var c=Builder.node("FORM",{id:"addCustomFeed_Form",style:"padding: 8px 10px 5px 10px; text-align: left"},[Builder.node("input",{type:"hidden",name:"existingCustomFeedId",value:h}),Builder.node("input",{type:"hidden",name:"loggedInActorId",value:$("hidden-currentActorId").innerHTML}),Builder.node("label",{style:"padding: 0 10px 0 0"},["Custom Feed Name:"]),a,Builder.node("label",{style:"padding: 0 10px 0 15px"},["Description:"]),i,Builder.node("hr"),g,]);
d.appendChild(c);
if(h==null||h<0){var f=new CustomFeedTypesPopup("typeSelect");
var b=g.parentNode;
b.insertBefore(f.getSelect(),g);
b.insertBefore(Builder.node("label",{},["Value:  "]),g);
b.insertBefore(Builder.node("input",{type:"text",name:"channelItemValue",value:""}),g)
}var e=Builder.node("FORM",{style:"padding: 0 10px 5px 10px; text-align: right"},[Builder.node("input",{type:"button",style:"margin-right: 5px",value:"Cancel",onclick:"closeUserInfoPopup()"}),Builder.node("input",{type:"button",value:"Save >>",onclick:"addCustomFeed()"})]);
d.appendChild(e);
d.show();
if(h!=null&&h>=0){new Ajax.Request(getAppURL()+"customFeedInfo",{method:"GET",parameters:{existingCustomFeedId:h},onSuccess:function(l){var q=l.responseText.evalJSON();
if(q.error!=null){alert("Sorry, an error occurred. "+q.error+".")
}else{a.value=(q.result.name!=null)?q.result.name:"";
i.value=(q.result.desc!=null)?q.result.desc:"";
var o=Builder.node("div",{id:"cfOverallContainer"});
for(var n=0;
n<q.result.reps.length;
n++){var r=q.result.reps[n];
var k=(r.repId!=null)?r.repId:-1;
var m=new CustomFeedTypesPopup("typeSelect."+n);
var p=Builder.node("div",{id:"cfContainer."+n,className:"cfContainer",style:"padding: 3px;"},[Builder.node("input",{type:"button",style:"margin: 1px 5px 1px 2px",value:"x",onclick:"removeCustomFeedEntry("+n+")"}),m.getSelect(),Builder.node("input",{id:"autocomplete."+n,style:"margin: 1px 5px 1px 10px",type:"text",name:"channelItemValue."+n,value:r.value}),Builder.node("div",{id:"autocomplete_choices."+n,className:"autocomplete",style:"width: 400px"}),Builder.node("input",{type:"hidden",id:"channelItemId."+n,name:"channelItemId."+n,value:k})]);
m.setSelectedType(adjustCustomFeedItem(r.repClass));
o.appendChild(p)
}g.parentNode.insertBefore(o,g);
for(n=0;
n<q.result.reps.length;
n++){var j=adjustCustomFeedItem(q.result.reps[n].repClass);
if(j=="Content"){$("autocomplete_choices."+n).hide();
continue
}new Ajax.Autocompleter("autocomplete."+n,"autocomplete_choices."+n,"/poblish2/autoComplete",{parameters:"types="+j,minChars:3,callback:prepareRequest,afterUpdateElement:handleSelection})
}adjustCustomFeedEntryStyles()
}}})
}}function prepareRequest(a,b){return"q="+encodeURIComponent(a.value)
}function handleSelection(a,b){var d=_CustomFeedGetIndexFromElem(a);
var c=_CustomFeedGetIndexFromElem(b);
$("channelItemId."+d).value=c
}function removeCustomFeedEntry(a){$("cfContainer."+a).remove();
adjustCustomFeedEntryStyles()
}function adjustCustomFeedEntryStyles(){$$("div#cfOverallContainer > div:nth-child(even)").each(function(a){a.style.backgroundColor="white"
});
$$("div#cfOverallContainer > div:nth-child(odd)").each(function(a){a.style.backgroundColor="#EDF3FE"
})
}function changeCustomFeedItemType(b){var c=_CustomFeedGetIndexFromElem(b);
var a=$("autocomplete."+c);
a.value="";
a.focus();
$("channelItemId."+c).value="-1";
new Ajax.Autocompleter("autocomplete."+c,"autocomplete_choices."+c,"/poblish2/autoComplete",{parameters:"types="+b.value,minChars:3,callback:prepareRequest,afterUpdateElement:handleSelection})
}function _CustomFeedGetIndexFromElem(a){return a.id.substring(a.id.indexOf(".")+1)
}function adjustCustomFeedItem(a){if(a.indexOf("Actor")>=0){return"Actor"
}else{if(a.indexOf("Group")>=0){return"Group"
}else{if(a.indexOf("Feed")>=0){return"Feed"
}else{if(a.indexOf("Blog")>=0){return"Blog"
}else{if(a.indexOf("Content")>=0){return"Content"
}}}}}return""
}function addCustomFeed(){new Ajax.Request(getAppURL()+"customFeedHandler",{parameters:$("addCustomFeed_Form").serialize(true),onSuccess:function(b){var a=b.responseText.evalJSON();
if(a.error!=null){alert("Sorry, an error occurred. "+a.error+".")
}closeUserInfoPopup()
},onFailure:function(a){closeUserInfoPopup()
}})
}function addActorToGroup(){new Ajax.Request(getAppURL()+"changeGroupMembership",{parameters:$("adminGroupsForm").serialize(true),onSuccess:function(c){var a=c.responseText.evalJSON();
if(a.error!=null){alert("Sorry, an error occurred. "+a.error+".");
return
}var b=(a.membership_status=="joined")?"joined":"left";
alert("Actor successfully "+b+" Group")
}})
}function updateAdminGroupsLayoutToMatchSelectedGroup(){var a=$("adminGroupsSelect").selectedIndex;
var b=$("joinLeaveType."+a).value;
var c=$("currActorUN").value;
$("adminGroupsFormCode").value=b;
$("joinLeaveButton").value=(b=="join")?("Add "+c+" to Group"):("Remove "+c+" from Group")
}function reindexResource(a,b){new Ajax.Request(getAppURL()+"reindexResource",{parameters:{resId:a,resType:b},onSuccess:function(d){var c=d.responseText.evalJSON();
if(c.error!=null){alert("Sorry, an error occurred. "+c.error+".");
return
}}})
}function setResourceTwitterAccount(a,b,c){_setTwitterAccount({loggedInActorId:$("hidden-currentActorId").innerHTML,twitterAccount:a,resId:b,resType:c})
}function setActorTwitterAccount(a,b){_setTwitterAccount({loggedInActorId:$("hidden-currentActorId").innerHTML,twitterAccount:a,targetActorId:b})
}function _setTwitterAccount(a){new Ajax.Request(getAppURL()+"setTwitterAccount",{parameters:a,onSuccess:function(c){var b=c.responseText.evalJSON();
if(b.error!=null){alert("Sorry, an error occurred. "+b.error+".");
return
}}})
}function displayAboutIndicator(){if($("welcomeMsg")!=null&&$("trigger")!=null){$("trigger").show();
$("trigger").observe("click",function(){$("welcomeMsg").addClassName("aboutPanel");
if($(this).hasClassName("active")){$("welcomeMsg").hide({direction:"top-left"})
}else{$("welcomeMsg").appear({duration:0.3})
}$(this).toggleClassName("active");
return false
})
}}function updateFacebookUserBox(){if($("userPic")!=null){$("userPic").innerHTML="<fb:profile-pic uid=loggedinuser size=thumb facebook-logo=true></fb:profile-pic>&nbsp;"
}FB.XFBML.Host.parseDomTree();
FB.Facebook.apiClient.users_hasAppPermission("offline_access",function(a){var b=(a!=0);
FB.Facebook.apiClient.users_hasAppPermission("publish_stream",function(c){var d=(c!=0);
if(!b||!d){FB.Connect.showPermissionDialog("publish_stream,offline_access",function(e){})
}})
})
}function initFacebookConnect(){try{FB_RequireFeatures(["XFBML","Connect"]);
FB.init("ff87790fac1c3227349daa0e790155e1","xd_receiver.htm",{reloadIfSessionStateChanged:true,ifUserConnected:updateFacebookUserBox})
}catch(a){}}function googleReaderShare(){window.GR________bookmarklet_domain="http://www.google.com";
if(document.body&&!document.xmlVersion){var a=document.createElement("script");
a.src="http://www.google.com/reader/ui/link-bookmarklet.js";
document.body.appendChild(a)
}}function handleHomePageSearch(b,a){_handleHomePageSearch(b,a,false)
}function handleHomePageIFLSearch(b,a){_handleHomePageSearch(b,a,true)
}function _handleHomePageSearch(f,c,b){var e=f.value.strip();
if(e==""){alert("No query entered");
return
}var d=$("homeSearchResults");
var a=Builder.node("div",{id:"channelProgress",className:"loadProgress",style:"top: 50%"});
if(d!=null){d.appendChild(a)
}clearResults("article-search-results");
clearResults("group-search-results");
clearResults("actor-search-results");
clearResults("blog-search-results");
clearResults("feed-search-results");
new Ajax.Request(getAppURL()+"globalSearch",{parameters:{q:e,wantFrags:"true",feelingLucky:b?"true":"",type:c},onSuccess:function(l){var t=l.responseText.evalJSON();
var n=0,h=0,k=0,s=0,v=0;
if(t.length==0){alert("Sorry, no matches found.")
}else{var r=false;
for(var m=0;
m<t.length;
m++){if(t[m].type=="Article"||t[m].type=="FeedArticle"||t[m].type=="WikiArticle"){if(b){window.top.location.href="article.jsp?id="+t[m].id;
return
}else{if(!r){$("homeSearchResults").tabber.tabShow(0);
d.appear({duration:0.5});
r=false
}var g=parseInt(t[m].date);
var q=g%86400==0;
var j=new Date(g);
var u=parseFloat(t[m].score);
var p=u/100;
var o=q?new Date(g).toDateString():j.toLocaleString();
n++;
_addMatchElem($("article-search-results"),"",t[m].id,"homeSearchResult",t[m].title,t[m].frag,o,u,p)
}}else{if(t[m].groupDisplayName!=null){if(!r){$("homeSearchResults").tabber.tabShow(0);
d.appear({duration:0.5});
r=false
}h++;
$("group-search-results").insertBefore(_createGroupBoxElem(t[m].groupId,t[m].groupDisplayName,"filterLink"),null)
}else{if(t[m].un!=null){if(b&&c=="people"){window.top.location.href="actor.jsp?id="+t[m].un;
return
}if(!r){$("homeSearchResults").tabber.tabShow(0);
d.appear({duration:0.5});
r=false
}k++;
$("actor-search-results").insertBefore(_createActorBoxElem(t[m].un,"filterLink"),null)
}else{if(t[m].blogId!=null){if(!r){$("homeSearchResults").tabber.tabShow(0);
d.appear({duration:0.5});
r=false
}s++;
$("blog-search-results").insertBefore(_createBlogBoxElem(t[m].blogId,t[m].blogDisplayName,"filterLink"),null)
}else{if(t[m].feedId!=null){if(!r){$("homeSearchResults").tabber.tabShow(0);
d.appear({duration:0.5});
r=false
}v++;
$("feed-search-results").insertBefore(_createFeedBoxElem(t[m].feedId,t[m].feedDisplayName,"filterLink"),null)
}else{if(t[m].type=="Topic"){if(b){if(c=="people"){if(m<t.length-1&&t[m+1].un!=null){continue
}window.top.location.href="person.jsp?name="+t[m].name;
return
}else{if(c=="locations"){window.top.location.href="location.jsp?name="+t[m].name;
return
}}}if(!r){$("homeSearchResults").tabber.tabShow(0);
d.appear({duration:0.5});
r=false
}}}}}}}}}if(n==0){addEmptyEntry($("article-search-results"))
}if(k==0){addEmptyEntry($("actor-search-results"))
}if(h==0){addEmptyEntry($("group-search-results"))
}if(s==0){addEmptyEntry($("blog-search-results"))
}if(v==0){addEmptyEntry($("feed-search-results"))
}$$("#homeSearchResults li:nth-child(1) a")[0].innerHTML="Articles ("+n+")";
$$("#homeSearchResults li:nth-child(2) a")[0].innerHTML="Actors ("+k+")";
$$("#homeSearchResults li:nth-child(3) a")[0].innerHTML="Groups ("+h+")";
$$("#homeSearchResults li:nth-child(4) a")[0].innerHTML="Blogs ("+s+")";
$$("#homeSearchResults li:nth-child(5) a")[0].innerHTML="Feeds ("+v+")"
},onComplete:function(){if(d!=null){d.removeChild(a)
}}})
}function getSentimentSpanForType(b,a){if(b=="PP"){return Builder.node("span",{style:"color: blue"},a)
}else{if(b=="P"){return Builder.node("span",{style:"color: rgb(0,127,255)"},a)
}else{if(b=="NN"){return Builder.node("span",{style:"color: red"},a)
}else{if(b=="N"){return Builder.node("span",{style:"color: rgb(255,127,127)"},a)
}else{return Builder.node("span",{style:"color: #666"},a)
}}}}}function initAllData(a){var d=(a!=null&&a!="")?("?requested="+a):"";
var b=opensocial.newDataRequest();
b.add(b.newFetchPersonRequest("OWNER"),"owner_data");
b.send(onData);
if(!window.timesloaded){window.timesloaded=1
}else{window.timesloaded++
}if(window.timesloaded>1){window.top.location.href="authenticate.jsp"+d
}else{try{FB.init("ff87790fac1c3227349daa0e790155e1","xd_receiver.htm",{reloadIfSessionStateChanged:true,ifUserConnected:"fb_authenticate.jsp"+d})
}catch(c){}}}function onData(a){if(!a.get("owner_data").hadError()){}};