{var rnews={"status":null,"feeds":[],"xmlobj":[],"refreshing":0,"maxParallel":2,"refTimeout":2000,"snip":false,"hideEmpty":false,"hideMarked":false,"blockWide":false,"currWidth":0,"yelHiMap":["#ffffff","#fdffee","#fbffdd","#f9ffcc","#f7ffbb","#f5ffaa","#f3ff99","#f1ff88","#efff77"],"grnHiMap":["#ffffff","#f7fbf0","#f0f7e1","#e8f4d3","#e1f0c5","#daecb8","#d3e9ab","#cce59e","#c6e292"],"widthMap":["49%","61%","71%","79%","85%","90%","93%","95.5%","97%","98%","98.5%","98.75%","99%"],"doneFunc":null};var nullFunc=function(){};function rnewsInit(opts){rnews.status=$("status");if(def(opts.msg))rnews.doneFunc=function(){fade(rnews.status,opts.msg,2);};if(def(opts.max))rnews.maxParallel=opts.max;if(def(opts.timeout))rnews.refTimeout=opts.timeout;if(def(opts.snip))rnews.snip=opts.snip;if(def(opts.hideEmpty))rnews.hideEmpty=opts.hideEmpty;if(getElementsByClass("feed",$("content"),"div").length==0)rnews.blockWide=true;if(def(opts.async)&&opts.async){if(rnews.maxParallel<=0)rnews.maxParallel=1;refreshFeeds();if(rnews.maxParallel>1)setTimeout(refreshFeeds,rnews.refTimeout/4);}else{if(rnews.doneFunc)rnews.doneFunc();rnews.doneFunc=null;}}function initFeed(fid,req){rnews.feeds.push({"id":fid,"req":req,"resp":false});}function update(id){var feed=$("feed"+id);var dl=$$(feed,"dl")[0];var ee=$$(dl,"dd");for(var i=ee.length-1;i>=0;i--){removeAllImageSwaps(ee[i]);dl.removeChild(ee[i]);}ee=$$(dl,"dt");for(var i=ee.length-1;i>=0;i--){removeAllClicks(ee[i]);dl.removeChild(ee[i]);}ee=getElementsByClass("error",feed.parentNode,"P");for(var i=ee.length-1;i>=0;i--)ee[i].parentNode.removeChild(ee[i]);ee=getElementsByClass("warn",feed.parentNode,"P");for(var i=ee.length-1;i>=0;i--)ee[i].parentNode.removeChild(ee[i]);var e=make("dt");e.id="none"+id;setClass(e,"loading");e.innerHTML="&mdash; Loading articles...";dl.appendChild(e);e=make("dt");e.id="more"+id;setClass(e,"more");e.innerHTML="";dl.appendChild(e);fade(rnews.status,"Updating feed",2);sendRequest("ajax.php?op=update&id="+id,handleResponse);}function markFeed(id){sendRequest("ajax.php",handleResponse,"op=markfeed&id="+id);var feed=$("feed"+id);var dts=$$(feed,"dt");for(var j=0;j<dts.length;j++){var links=$$(dts[j],"a");for(var i=0;i<links.length;i++)chgClass(links[i],"new","seen");if(hasClass(dts[j],"feedlink"))collapse(dts[j].id);}highlight($$(feed,"dl")[0],rnews.grnHiMap);if(rnews.hideMarked){fade(feed.parentNode,null,0.75,function(){removeEmptyFeed(feed.parentNode);});}}function markOlder(fid,lid){sendRequest("ajax.php",handleResponse,"op=markfeed&id="+fid+"&lid="+lid);var feed=$("feed"+fid);var dts=$$(feed,"dt");var found=false;for(var j=0;j<dts.length;j++){var dtsid=dts[j].id.substr(1);if(lid==dtsid)found=true;if(found){var links=$$(dts[j],"a");for(var i=0;i<links.length;i++)chgClass(links[i],"new","seen");if(hasClass(dts[j],"feedlink")&&lid!=dtsid)collapse(dts[j].id);}}}function markVis(id){var theDT=$(id);var anc=$$(theDT,"a");for(var i=0;i<anc.length;i++){chgClass(anc[i],"(new|seen)","visited");}return true;}function markLink(id,st){sendRequest("ajax.php",handleResponse,"op=marklink&st="+st+"&id="+id);var theDT=$(id);if(st=="deleted"){collapse(id);removeAllClicks(theDT);theDT.parentNode.removeChild(theDT);}else{var anc=$$(theDT,"a");for(var i=0;i<anc.length;i++)chgClass(anc[i],"(new|seen|visited|starred)",st);}}function fontChg(id,up,me){var sib=me.parentNode.parentNode.parentNode.nextSibling;var sz=getStyle(sib,"fontSize")||getStyle(sib,"font-size");if(sz){sz=parseInt(sz.substr(0,sz.length-2));sz+=up?4:-3;if(sz<6)sz=6;sib.style.fontSize=sz+"px";}}function expand(fid,id){var theAnchor=$(id).firstChild;theAnchor.firstChild.nodeValue="* ";sendRequest("ajax.php?op=expand&fid="+fid+"&id="+id,handleResponse);}function collapse(id){var dt=$(id);var dd=dt.nextSibling;while(dd&&dd.nodeType=="3")dd=dd.nextSibling;if(dd&&dd.nodeName=="DD"){removeAllImageSwaps(dd);removeAllClicks(dd);dt.parentNode.removeChild(dd);}var theAnchor=dt.firstChild;dt=dd=null;theAnchor.onclick=function(){expand("-1",id);return false;};theAnchor.title="expand";theAnchor.firstChild.nodeValue="+ ";}function sfunc(f,c){return function(){setClass(f,c);};}function goWide(id){var e=$("feed"+id);var fp=e.parentNode.parentNode;var buts=getElementsByClass("wide",fp,"div");for(var i=buts.length-1;i>=0;i--){removeAllImageSwaps(buts[i]);buts[i].parentNode.removeChild(buts[i]);}var feeds=getElementsByClass("feed",fp,"div");for(i=0;i<feeds.length;i++){var cf=make("div");setClass(cf,"feedpair clearfix");fp.parentNode.insertBefore(cf,fp);cf.appendChild(feeds[i]);stretch(feeds[i],0,sfunc(feeds[i],"feedwide"),rnews.widthMap);}fp.parentNode.removeChild(fp);}function refreshFeeds(){if(rnews.refreshing>=rnews.maxParallel)return;var i;for(i=0;i<rnews.feeds.length;i++){var f=rnews.feeds[i];if(f.req==false){f.req=true;rnews.refreshing++;return refresh(f);}}if(rnews.refreshing==0&&rnews.doneFunc){rnews.doneFunc();rnews.doneFunc=null;}}function refresh(feed){sendRequest("ajax.php?op=refresh&id="+feed.id,handleResponse);setTimeout(function(){if(feed.resp==false){refreshFeeds();}},rnews.refTimeout);}function handleResponseExpand(parts,i){var id=parts[i++];var theDD=make("dd");theDD.innerHTML=parts[i++];var theDT=$(id);var theDD=theDT.parentNode.insertBefore(theDD,theDT.nextSibling);var theAnchor=theDT.firstChild;theAnchor.onclick=function(){collapse(id);return false;};theAnchor.title="hide";theAnchor.innerHTML="&mdash; ";prepareImageSwap(theDD,true,true);}function handleResponseMore(parts,i){var feedid=parts[i++];var theDT=$("none"+feedid);if(theDT){removeAllClicks(theDT);theDT.parentNode.removeChild(theDT);}var moreDT=$("more"+feedid);var theDL=moreDT.parentNode;theDL.removeChild(moreDT);var morelink=parts[i++];var wasNone=false;while(i<parts.length){var id=parts[i++];var link=parts[i++];var newDT=make("dt");newDT.id=id;if(rnews.snip)setClass(newDT,"feedlink ell");else{setClass(newDT,"feedlink");}newDT.innerHTML=link;theDL.appendChild(newDT);if(id.substring(0,4)=="none")wasNone=true;}if(morelink){moreDT.innerHTML=morelink;theDL.appendChild(moreDT);prepareImageSwap(moreDT,true,true);}return !wasNone;}function more(id,n){sendRequest("ajax.php?op=more&id="+id+"&n="+n,handleResponse);}function showFeedMsg(feedid,cls,html){var fc=$("feed"+feedid);var p=make("p");setClass(p,cls);p.innerHTML=html;fc.parentNode.insertBefore(p,fc);}function removeEmptyFeed(rem){var cat=rem.parentNode.parentNode;var fp=getElementsByClass("feedpair",cat,"div");if(fp.length>0){if(rnews.blockWide)removeEmptyFeedBlockWide(rem,fp);else{removeEmptyFeedBlock(rem,fp);}var cnt=$("numSkipped");if(cnt){cnt.innerHTML=parseInt(cnt.innerHTML)+1;}else{var pat=new RegExp("&amp;filter=.");var url=document.location.href.replace(pat,"")+"&amp;filter=A";var d=make("div");d.className="category";d.innerHTML="<div class=\"clearfix\"><div class=\"feedwide\"><div class=\"feedcontent clearfix\"><dl><dt class=\"seen\">&mdash; Filter: not showing <span id=\"numSkipped\">1</span> feeds, which have no new articles.  <a href=\""+url+"\">View all feeds</a>.</dt></dl></div></div></div>";cat.parentNode.appendChild(d);}}}function removeEmptyFeedBlock(rem,fp){var found=false;for(var i=0;i<fp.length;i++){if(!found){if(fp[i]===rem.parentNode){found=true;removeAllImageSwaps(rem);rem.parentNode.removeChild(rem);}}if(found){if(i<fp.length-1){var e=firstDescendant(fp[i+1]);if(e){e.parentNode.removeChild(e);if(hasClass(e,"feedwide"))chgClass(e,"feedwide","feed");fp[i].appendChild(e);}}else{var ch=getChildrenByTagName(fp[i],"div");if(ch.length==0)fp[i].parentNode.removeChild(fp[i]);}}}}function removeEmptyFeedBlockWide(rem,fp){var p=rem.parentNode;removeAllImageSwaps(p);p.removeChild(rem);p.parentNode.removeChild(p);}function handleResponseMarklink(parts,i){var linkid=parts[i++];var theDT=$(linkid);if(theDT){var e=theDT.nextSibling;while(e.nodeType=="3")e=theSibling.nextSibling;if(e.nodeName!="DD")return;var oldDiv=getElementsByClass("itemBar",e,"DIV");if(oldDiv&&oldDiv.length>0){oldDiv=oldDiv[0];oldDiv.innerHTML=parts[i++];prepareImageSwap(oldDiv,true,true);fade(rnews.status,parts[i++],1);}}}function handleResponseRefresh(parts,i){var feedid=parts[i++];var j;for(j=0;j<rnews.feeds.length;j++){var f=rnews.feeds[j];if(f.id==feedid){f.resp=true;break;}}rnews.refreshing--;refreshFeeds();var errstr=parts[i++];var warnstr=parts[i++];var infolink=parts[i++];if(errstr)showFeedMsg(feedid,"error",errstr);if(warnstr)showFeedMsg(feedid,"warn",warnstr);var info=$("info"+feedid);if(info)info.innerHTML=infolink;if(handleResponseMore(parts,i)){var f=$("feed"+feedid);highlight($$(f,"dl")[0],rnews.yelHiMap,500);}else{if(!errstr&&!warnstr&&rnews.hideEmpty){var f=$("feed"+feedid).parentNode;fade(f,null,0.75,function(){removeEmptyFeed(f);});}}}function handleResponse(req){var parts=req.responseText.split("|");if(parts.length>=1){var op=parts[0];switch(op){case "expand":handleResponseExpand(parts,1);break;case "more":handleResponseMore(parts,1);break;case "refresh":handleResponseRefresh(parts,1);break;case "marklink":handleResponseMarklink(parts,1);break;case "ack":fade(rnews.status,parts[1],1);break;}}}function sendRequest(url,callback,postData){var req=createXMLHTTPObject();if(!req)return;postData=def(postData)?postData:null;var method=(postData)?"POST":"GET";req.open(method,url,true);req.setRequestHeader("X-Requested-With","XMLHttpRequest");if(postData)req.setRequestHeader("Content-type","application/x-www-form-urlencoded");req.onreadystatechange=function(){if(req.readyState==4&&(req.status==200||req.status==304)){if(callback)callback(req);req.onreadystatechange=nullFunc;rnews.xmlobj.push(req);}return;};if(req.readyState==4)return;req.send(postData);}var XMLHttpFactories=[function(){return new XMLHttpRequest();},function(){return new ActiveXObject("MSXML2.XMLHTTP.6.0");},function(){return new ActiveXObject("MSXML2.XMLHTTP.3.0");},function(){return new ActiveXObject("MSXML2.XMLHTTP");},function(){return new ActiveXObject("Microsoft.XMLHTTP");}];function createXMLHTTPObject(){var xmlhttp=false;if(xmlhttp=rnews.xmlobj.pop())return xmlhttp;for(var i=0;i<XMLHttpFactories.length;i++){try{xmlhttp=XMLHttpFactories[i]();return xmlhttp;}catch(e){}}return null;}}
{function $(id){return typeof (id)=="string"?document.getElementById(id):id;}function $$(n,t){if(typeof (n)=="string")n=$(n);return n.getElementsByTagName(t);}function def(a){return typeof (a)!="undefined";}function make(t){return document.createElement(t);}function trim(s){return s.replace(/^\s+|\s+$/g,"");}function removeAllClicks(e){var i,ee=e.getElementsByTagName("*");for(i=0;i<ee.length;i++)ee[i].onclick=null;}function getStyle(e,s){if(e.currentStyle)return e.currentStyle[s];else{if(window.getComputedStyle)return document.defaultView.getComputedStyle(e,null).getPropertyValue(s);}}function getWidth(el){var w=0;if(document.defaultView&&window.getComputedStyle){var style=document.defaultView.getComputedStyle(el,null);if(style.getPropertyValue("display")==="inline"){w=el.offsetWidth;}else{if(style.getPropertyValue("display")!=="none"){w=parseInt(style.getPropertyValue("width"));if(!window.opera||document.getElementsByClassName){w+=parseInt(style.getPropertyValue("padding-left"));w+=parseInt(style.getPropertyValue("padding-right"));w+=parseInt(style.getPropertyValue("border-left-width"));w+=parseInt(style.getPropertyValue("border-right-width"));}}}}else{if(el.currentStyle){if(el.currentStyle["display"]!=="none")w=el.offsetWidth;}else{w=el.offsetWidth;}}return w;}function getX(e){var x=0;if(e.offsetParent){do{x+=e.offsetLeft;}while(e=e.offsetParent);;}return x;}function hasClass(e,c){var pat=new RegExp("(^|\\s)"+c+"(\\s|$)");var rc=pat.test(e.className);return rc;}function setClass(e,c){e.className=c;}function chgClass(e,cOld,cNew){var pat=new RegExp("(^|\\s)"+cOld+"(\\s|$)");e.className=e.className.replace(pat," "+cNew+" ");}function getElementsByClass(c,node,tag){var ee=[];if(node==null)node=document;var els=$$(node,tag?tag:"*");var elsLen=els.length;var pat=new RegExp("(^|\\s)"+c+"(\\s|$)");for(i=0;i<elsLen;i++)if(pat.test(els[i].className))ee.push(els[i]);return ee;}function getChildrenByTagName(node,tag){var out=[];if(node){var c=node.childNodes;tag=tag.toUpperCase();for(var i=0;i<c.length;i++)if(c[i].nodeName.toUpperCase()==tag)out.push(c[i]);}return out;}function firstDescendant(e){e=e.firstChild;while(e&&e.nodeType!=1)e=e.nextSibling;return e;}function nextSiblingNode(e){e=e.nextSibling;while(e&&e.nodeType!=1)e=e.nextSibling;return e;}function fade(e,msg,delay,cb){if(typeof msg=="string")e.innerHTML=msg;setOpacity(e,10);if(delay>0)setTimeout(function(){fadeStep(e,10,cb);},delay*1000);else{fadeStep(e,10,cb);}}function fadeStep(e,s,cb){if(s>0){setOpacity(e,s-1);setTimeout(function(){fadeStep(e,s-1,cb);},90);}else{if(cb)cb();}}function setOpacity(e,value){if(!e.currentStyle||!e.currentStyle.hasLayout)e.style.zoom=1;if(value==0){e.style.visibility="hidden";}else{e.style.visibility="visible";e.style.opacity=value/10.01;if(value==10)e.style.filter="";else{e.style.filter="alpha(opacity="+value*10+")";}}}function highlight(e,hmap,delay){var num=hmap.length-1;e.style.backgroundColor=hmap[num];var fn=function(){highlightStep(e,num-1,hmap);};if(delay!=null&&delay>0)setTimeout(fn,delay);else{fn();}}function highlightStep(e,num,hmap){e.style.backgroundColor=hmap[num];if(num>0)setTimeout(function(){highlightStep(e,num-1,hmap);},1000/hmap.length);}function stretch(e,n,fn,wmap){e.style.width=wmap[n];if(++n<wmap.length)setTimeout(function(){stretch(e,n,fn,wmap);},900/wmap.length);else{fn();}}function popHelp(url){var w=window.open(url,"helpWin","dependent=1,toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=400,height=400");if(w)w.focus();return w;}}
{function setImageSwaps(){prepareImageSwap(document.body,true,true);}function clearImageSwaps(){removeAllImageSwaps(document.body);}if(document.getElementsByTagName&&document.getElementById){if(window.addEventListener){window.addEventListener("load",setImageSwaps,false);window.addEventListener("unload",clearImageSwaps,false);}else{if(window.attachEvent){window.attachEvent("onload",setImageSwaps);window.attachEvent("onunload",clearImageSwaps);}}}function prepareImageSwap(elem,mouseOver,mouseOutRestore,mouseDown,mouseUpRestore,mouseOut,mouseUp){if(typeof (elem)=="string")elem=document.getElementById(elem);if(elem==null)return;var regg=/(.*)(_nm\.)([^\.]{3})$/;var prel=new Array(),img,imgList,imgsrc,mtchd;imgList=elem.getElementsByTagName("img");for(var i=0;img=imgList[i];i++){if(!img.rolloverSet&&img.src.match(regg)){mtchd=img.src.match(regg);img.hoverSRC=mtchd[1]+"_hv."+mtchd[3];img.outSRC=img.src;if(typeof (mouseOver)!="undefined"){img.hoverSRC=(mouseOver)?mtchd[1]+"_hv."+mtchd[3]:false;img.outSRC=(mouseOut)?mtchd[1]+"_ou."+mtchd[3]:(mouseOver&&mouseOutRestore)?img.src:false;img.mdownSRC=(mouseDown)?mtchd[1]+"_md."+mtchd[3]:false;img.mupSRC=(mouseUp)?mtchd[1]+"_mu."+mtchd[3]:(mouseOver&&mouseDown&&mouseUpRestore)?img.hoverSRC:(mouseDown&&mouseUpRestore)?img.src:false;}if(img.hoverSRC){preLoadImg(img.hoverSRC);img.onmouseover=imgHoverSwap;}if(img.outSRC){preLoadImg(img.outSRC);img.onmouseout=imgOutSwap;}if(img.mdownSRC){preLoadImg(img.mdownSRC);img.onmousedown=imgMouseDownSwap;}if(img.mupSRC){preLoadImg(img.mupSRC);img.onmouseup=imgMouseUpSwap;}img.rolloverSet=true;}}function preLoadImg(imgSrc){prel[prel.length]=new Image();prel[prel.length-1].src=imgSrc;}}function imgHoverSwap(){this.src=this.hoverSRC;}function imgOutSwap(){this.src=this.outSRC;}function imgMouseDownSwap(){this.src=this.mdownSRC;}function imgMouseUpSwap(){this.src=this.mupSRC;}function removeImageSwaps(img){img.onmouseover=img.onmouseout=img.onmousedown=img.onmouseup=null;}function removeAllImageSwaps(el){var i,imgList=el.getElementsByTagName("img");for(i=0;i<imgList.length;i++)removeImageSwaps(imgList[i]);}}
