// Addy all eventsy toity the newsy fadery by Ty
// Keepith the headerity in tactity
var news = new Array("","")
if (!location.href.match(/action/)) {
	var aetd = document.getElementsByTagName('td')
	for (i=0; i<aetd.length; i++) {
		if (aetd[i].innerHTML.match('Events This Month') && aetd[i].className=='catbg' && aetd[i+4].innerHTML.match('Users Online')) {
		var news = aetd[i+2].innerHTML.split(', ');
	}
}
if (navigator.appName.match('Microsoft')) {
	news[0] = news[0].split(/=1>/i)[1]
}
if (navigator.appName.match('Netscape')) {
	news[0] = news[0].split(/="1">/i)[1]
}
var tnum = fContent.length
for (t=(news.length-1);t>=0; t--){
	if (news[t]){
		fContent[tnum++] = news[t]
	}
}
}

/*****************  Reorder PMs  *****************/
/*
reorder private messages by ross
http://support.proboards.com
do not edit or redistribute without permission
*/

function greenVeg(type)
{
  var thePeas = [];
  var beans = cabbage[num].rows;
   for(p=2; p<beans.length-1; p++)
    {
     if(type == 0)
      {
       img = beans.item(p).getElementsByTagName('img').item(0).alt;
       thePeas[thePeas.length] = [img.toLowerCase(), beans.item(p)];
       beans.item(p).parentNode.removeChild(beans.item(p));
      }
     else
      {
       link = beans.item(p).getElementsByTagName('a').item(type-1).innerHTML;
       thePeas[thePeas.length] = [link.toLowerCase().replace('re: ',''), beans.item(p)];
       beans.item(p).parentNode.removeChild(beans.item(p));
       }
     p --;
    }
   thePeas.sort();
    for(v=0; v<thePeas.length; v++)
    {
     cabbage.item(num).firstChild.insertBefore(thePeas[v][1], beans[beans.length-1]);
    }
}
function refresh()
{
  location.href = location.href;
}
cabbage = document.getElementsByTagName('table');
for(i=0; i<cabbage.length; i++)
{
if(location.href.match(/ion=pm/i) && cabbage.item(i).cellPadding == '1' && cabbage.item(i).rows[0].cells[0].width == '15%' && cabbage.item(i).innerHTML.match(/ion=pmsend/))
  {
   num = i-1;
   for(n=0; n<4; n++)
   {
    mushroom = document.createElement('span'); mushroom.style.fontSize='10px';
    //mushroom.appendChild(document.createElement('br'));
    mushroom.appendChild(document.createElement('a'));
    if(n == 3){ mushroom.lastChild.setAttribute("href", "javascript:refresh()"); }
    else{ mushroom.lastChild.setAttribute("href", "javascript:greenVeg("+n+")"); }
    mushroom.lastChild.appendChild(document.createTextNode(' (Sort ) '));
    cabbage.item(num).rows[1].cells[n+1].firstChild.appendChild(mushroom);
   }
  }
}

/*****************  Rename News Fader  *****************/
if(location.href.match(/\.com\/?((v45)?index.cgi)?\??(&?action=home)?(#\w+)?$/)) {
 var td = document.getElementsByTagName('td');
  for(i=0; i<td.length; i++) {
   if(td.item(i).className == 'newstitlebg') {
    td.item(i).firstChild.firstChild.innerHTML = "What's New at The Hangout";
    break;
  }
 }
}