var browserver="311006"; // Browser Check
/*


=========================
IFX Tags --- SuperButtons!!
=========================


*/




// BlinkIt function for not NN browsers
function BlinkIt()
{
	if (!document.all)
	{
		return;
	}
	else
	{
		for(i=0;i<document.all.tags('blink').length;i++)
		{
			s=document.all.tags('blink')[i];
			s.style.visibility=(s.style.visibility=='visible')?'hidden':'visible';
		}
	}
}

//Spoiler function
var openCloseVar;
function openClose(openCloseVar)
{
	var openCloseMain=openCloseVar.getElementsByTagName('DIV');
	for(i=0;i<openCloseMain.length;i++)
	{
		if(openCloseMain[i].className=="spoilermain")
		{
			if(openCloseMain[i].style.display == "")
			{
				openCloseMain[i].style.display = "none";
			}
			else if(openCloseMain[i].style.display != "none")
			{
				openCloseMain[i].style.display = "none";
			}
			else
			{
				openCloseMain[i].style.display = "block";
			}
		}
	}
}


//Get username section
var username, TD = document.getElementsByTagName('td');
for (place = 0; place < TD.length; place++)
{
	if (TD[place].innerHTML.match('Log In'))
	{
		username = "Guest";
	}
	else if (TD[place].innerHTML.match('Logged in as:'))
	{
		username = TD[place].getElementsByTagName('a')[0].innerHTML;
	}
}

// Open Tags
var Tags = new Array();
Tags[0] = new Array();
Tags[0][0] = new Array(
					   /\[blink\]/gi,
					   /\[spoiler\]/gi,
					   /\[glow]/gi,
					   /\[bgcolor=(\w*)\]/gi,
					   /\[marquee\]/gi,
					   /\[strike\]/gi,
					   /\[you\]/gi,
					   /\[sup\]/gi,
					   /\[sub\]/gi,
					   /\[hr\]/gi,
					   /\[align=(\w*)\]/gi,
					   /\[ahide\]/gi,
					   /\[hide\]/gi
					   );

// Close Tags
Tags[0][1] = new Array(
					   /\[\/blink\]/gi,
					   /\[\/spoiler\]/gi,
					   /\[\/glow\]/gi,
					   /\[\/bgcolor\]/gi,
					   /\[\/marquee\]/gi,
					   /\[\/strike\]/gi,
					   /\[\/to\]/gi,
					   /\[\/sup\]/gi,
					   /\[\/sub\]/gi,
					   /\[\/to\]/gi,
					   /\[\/align\]/gi,
					   /\[\/ahide\]/gi,
					   /\[\/hide\]/gi
					   );

var oMDirection;
Tags[1] = new Array();
	Tags[1][0] = new Array(
						   '<blink>',
						   '<div><div class="spoilertop" style="font-weight: bold;" onclick="openClose(this.parentNode)"><u>&gt;&gt; Click to show Spoiler - click again to hide... &lt;&lt;</u></div><div class="spoilermain" style="display:none;">',
						   '<span style="">',
						   '<span style="background-color: $1">',
						   '<div class="dmarquee"><div><div>',
						   '<s>',
						   username,
						   '<sup>',
						   '<sub>',
						   '<hr>',
						   '<p style="text-align: $1 ;">',
						   '<span class="postdetails"><b>Hidden Text</b><font class="arep2c" style="color:#FF0000;"> - (reply to see)</font></span><hr /><span class="ahide" style="display:none;">',
						   '<span class="postdetails"><b>Hidden Text</b><font class="rep2c" style="color:#FF0000;"> - (reply to see)</font></span><hr /><span class="hide" style="display:none;">'
						   );

	Tags[1][1] = new Array(
						   '</blink>',
						   '</div></div>',
						   '</span>',
						   '</span>',
						   '</div></div></div>',
						   '</s>',
						   '',
						   '</sup>',
						   '</sub>',
						   '',
						   '</p>',
						   '</span>',
						   '</span>'
						   );

var oMarquees = [], oMrunning,
	oMInterv =        20,     //interval between increments
	oMStep =          1,      //number of pixels to move between increments
	oStopMAfter =     0,     //how many seconds should marquees run (0 for no limit)
	oResetMWhenStop = false,  //set to true to allow linewrapping when stopping
        oMDirection =     'left'

/***     Do not edit anything after here     ***/

function doMStop() {
	clearInterval(oMrunning);
	for( var i = 0; i < oMarquees.length; i++ ) {
		oDiv = oMarquees[i];
		oDiv.mchild.style[oMDirection] = '0px';
		if( oResetMWhenStop ) {
			oDiv.mchild.style.cssText = oDiv.mchild.style.cssText.replace(/;white-space:nowrap;/g,'');
			oDiv.mchild.style.whiteSpace = '';
			oDiv.style.height = '';
			oDiv.style.overflow = '';
			oDiv.style.position = '';
			oDiv.mchild.style.position = '';
			oDiv.mchild.style.top = '';
		}
	}
	oMarquees = [];
}
function doDMarquee()
{
	if( oMarquees.length || !document.getElementsByTagName )
	{
		return;
	}
	var oDivs = document.getElementsByTagName('div');
	for( var i = 0, oDiv; i < oDivs.length; i++ )
	{
		oDiv = oDivs[i];
		if( oDiv.className && oDiv.className.match(/\bdmarquee\b/) )
		{
			if( !( oDiv = oDiv.getElementsByTagName('div')[0] ) )
			{
				continue;
			}
			if( !( oDiv.mchild = oDiv.getElementsByTagName('div')[0] ) )
			{
				continue;
			}
			oDiv.mchild.style.cssText += ';white-space:nowrap;';
			oDiv.mchild.style.whiteSpace = 'nowrap';
			oDiv.style.height = oDiv.offsetHeight + 'px';
			oDiv.style.overflow = 'hidden';
			oDiv.style.position = 'relative';
			oDiv.mchild.style.position = 'absolute';
			oDiv.mchild.style.top = '0px';
			oDiv.mchild.style[oMDirection] = oDiv.offsetWidth + 'px';
			oMarquees[oMarquees.length] = oDiv;
			i += 2;
		}
	}
	oMrunning = setInterval('aniMarquee()',oMInterv);
	if( oStopMAfter )
	{
		setTimeout('doMStop()',oStopMAfter*1000);
	}
}
function aniMarquee()
{
	var oDiv, oPos;
	for( var i = 0; i < oMarquees.length; i++ )
	{
		oDiv = oMarquees[i].mchild;
		oPos = parseInt(oDiv.style[oMDirection]);
		if( oPos <= -1 * oDiv.offsetWidth )
		{
			oDiv.style[oMDirection] = oMarquees[i].offsetWidth + 'px';
		}
		else
		{
			oDiv.style[oMDirection] = ( oPos - oMStep ) + 'px';
		}
	}
}
if( window.addEventListener )
{
	window.addEventListener('load',doDMarquee,false);
}
else if( document.addEventListener )
{
	document.addEventListener('load',doDMarquee,false);
}
else if( window.attachEvent )
{
	window.attachEvent('onload',doDMarquee);
}


//Converting the Tags to HTML
tds = document.getElementsByTagName('td');

for (i = 0; i < tds.length; i++)
{
	if (tds[i].className == "post1" || tds[i].className == "post2")
	{
		for (a = 0; a < Tags[0][0].length; a++)
		{
		tds[i].innerHTML = tds[i].innerHTML.replace(Tags[0][0][a], Tags[1][0][a]);
	tds[i].innerHTML = tds[i].innerHTML.replace(Tags[0][1][a], Tags[1][1][a]);
		}
	}
}

// Set blink for browsers that don't support it
if(document.getElementsByTagName('blink'))
{
setInterval('BlinkIt()',200);
}

//Hide function
if(username=="Guest")
{
	//Good is Sin
}
else
{
	function findTop()
	{
		var loca=document.getElementsByTagName('a');
		for (u=0; u < loca.length; u++)
		{
			if(loca[u].href.match("view=old"))
			{
				var olddom=loca[u].href.substring(loca[u].href.lastIndexOf('showtopic=')+10,loca[u].href.lastIndexOf('view')-1);
				var newdom=loca[u].href.substring(0,loca[u].href.lastIndexOf('/'))+'/index.php?act=Stats&CODE=who&t='+olddom;
				if(loca[u].parentNode.className=="activeuserstrip")
				{
					loca[u].parentNode.innerHTML+="<iframe name='whosposted' src='"+newdom+"'  style='display:none;' onload='HideIt()'></iframe>";
				}
			}
		}
	}

	var HdIt = "Good is Sin";
	function HideIt()
	{
		var aPoster = window.frames["whosposted"].document.getElementsByTagName('a');
		for (s=0; s < aPoster.length; s++)
		{
			if((aPoster[s].href.match("showuser"))&&aPoster[s].parentNode.className=="row1")
			{
				var usernoms = aPoster[s].innerHTML;
				if(usernoms==username)
				{
					HdIt = "Off";
				}
			}
		}
		var NHdIt = HdIt
		HShowIt(NHdIt);
	}

	function HShowIt(NHdIt)
	{
		if(NHdIt=="Off")
		{
			var hide = document.getElementsByTagName('span');
			for(q = 0; q < hide.length; q++)
			{
				if(hide[q].className=="hide")
				{
					hide[q].style.display = "block"
					var chgtextcol = document.getElementsByTagName("font");
					for(j=0; j<chgtextcol.length; j++)
					{
						if(chgtextcol[j].className=="rep2c")
						{
							chgtextcol[j].style.color="#009900";
							chgtextcol[j].innerHTML=" - (Message Revealed)";
						}
					}
				}
			}
		}
	}

	//Start hide
	var startHide = document.getElementsByTagName('span');
	for(q = 0; q < startHide.length; q++)
	{
		if(startHide[q].className=="hide")
		{
			findTop();
		}
	}
}


//AHide function
if(username=="Guest")
{
	//Good is Sin
}
else
{
	function findATop()
	{
		//Get Topic ID
		var loca=document.getElementsByTagName('a');
		for (u=0; u < loca.length; u++)
		{
			if(loca[u].href.match("view=old"))
			{
				var olddom=loca[u].href.substring(loca[u].href.lastIndexOf('showtopic=')+10,loca[u].href.lastIndexOf('view')-1);
				var newdom=loca[u].href.substring(0,loca[u].href.lastIndexOf('/'))+'/index.php?act=Print&client=printer&t='+olddom;

				// Open Print Page in a Hidden iFrame
				if(loca[u].parentNode.className=="activeuserstrip")
				{
					loca[u].parentNode.innerHTML+="<iframe name='printposted' src='"+newdom+"'  style='display:none;' onload='frameAHideIt()'></iframe>";
				}
			}
		}
	}

	function frameAHideIt()
	{
		//Get Post Date
		var ahide = document.getElementsByTagName('span');
		for(q = 0; q < ahide.length; q++)
		{
			if(ahide[q].className=="ahide")
			{
				var aPostTime = ahide[q].parentNode.parentNode.parentNode.parentNode.getElementsByTagName("a");
				for(b = 0; b<aPostTime.length; b++)
				{
					if(aPostTime[b].innerHTML.match('Posted') && aPostTime[b].href.match('#'))
					{
						var spanPostTime = aPostTime[b].parentNode.parentNode.innerHTML;
						var postTime = spanPostTime.substring(spanPostTime.lastIndexOf('</')+4);
						AHideIt(postTime);
					}
				}
			}
		}
	}

	var AHdIt = "Good is Sin";
	function AHideIt(postTime)
	{

		//Find Dates in the Print Page
		var tdPoster = window.frames["printposted"].document.getElementsByTagName('td');
		for (s=0; s < tdPoster.length; s++)
		{
			if(tdPoster[s].innerHTML.match(postTime))
			{
				//Find Usernames
				var authnom = tdPoster[s].innerHTML.substring(tdPoster[s].innerHTML.lastIndexOf('by:')+4, tdPoster[s].innerHTML.indexOf('</'));

				while(tdPoster[s+2])
				{
					s=s+2;
					var ausernoms = tdPoster[s].innerHTML.substring(tdPoster[s].innerHTML.lastIndexOf('by:')+4,tdPoster[s].innerHTML.indexOf('</'));
				}

				//Match Usernames
				if(ausernoms==username || authnom==username)
				{
					AHdIt = "Off";
				}
			}
		}

		var ANHdIt = AHdIt;
		AHShowIt(ANHdIt);
	}

	function AHShowIt(ANHdIt)
	{
		if(ANHdIt=="Off")
		{
			var ahide = document.getElementsByTagName('span');
			for(q = 0; q < ahide.length; q++)
			{
				if(ahide[q].className=="ahide")
				{
					ahide[q].style.display = "block";
					var achgtextcol = document.getElementsByTagName("font");
					for(j=0; j<achgtextcol.length; j++)
					{
						if(achgtextcol[j].className=="arep2c")
						{
							achgtextcol[j].style.color="#009900";
							achgtextcol[j].innerHTML=" - (Message Revealed)";
						}
					}
				}
			}
		}
	}

	//Start ahide
	var startAHide = document.getElementsByTagName('span');
	for(q = 0; q < startAHide.length; q++)
	{
		if(startAHide[q].className=="ahide")
		{
			findATop();
		}
	}
}//End Else

