if (window._proscripts === undefined)
	var _proscripts = new Array();
if ((pb_username) && (pb_displayname) && (pb_username != "Guest") && (!document.title.match(" - Activate Account")) && (!document.title.match(" - Search Results")) && (!_proscripts["shoutbox"]))
{
	_proscripts["shoutbox"] = true;
	if ((!location.href.match(/action=/)) || (location.href.match(/action=home/)) || (location.href.match(/board=/)))
	{
		function adWatcher()
		{
			if ((google_ad_frame = document.getElementsByName("google_ads_frame")[0]) && (sbAd = document.getElementById("shoutboxAd")))
				sbAd.appendChild(google_ad_frame);
			else
				setTimeout("adWatcher();", 1500);
		}
		function globalize()
		{
			var catText = document.getElementById("shoutboxCat"),
				cLink = document.getElementById("chatlogLink"),
				gLink = document.getElementById("globalLocal"),
				gField = document.getElementById("globalField"),
				shoutboxTBody = document.getElementById("shoutbox").getElementsByTagName("tbody")[1];
			if (gLink.innerHTML == "[Global]")
			{
				shoutboxGlobal = true;
				catText.innerHTML = "*** Rules: No Advertising, No Spamming, No Trolling ***";
				cLink.setAttribute("href", "http://proboards.gamingmedley.com/shoutbox.php?mode=chatlog&proboard=support.proboards.com");
				gField.setAttribute("value", "true");
				gLink.innerHTML = "[Local]";
				document.shoutboxForm.setAttribute("action", "http://proboards.gamingmedley.com/shoutbox.php");
			}
			else
			{
				shoutboxGlobal = false;
				catText.innerHTML = "The ShoutBox";
				cLink.setAttribute("href", shoutboxHost + "shoutbox.php?mode=chatlog&proboard=" + location.host + "&key=" + chatlogKey);
				gField.setAttribute("value", "false");
				gLink.innerHTML = "[Global]";
				document.shoutboxForm.setAttribute("action", shoutboxHost + "shoutbox.php");
			}
			while (shoutboxTBody.childNodes[4])
				shoutboxTBody.removeChild(shoutboxTBody.childNodes[2]);
			timerTime = 0;
			document.getElementById("shoutboxTimer").innerHTML = "";
		}
		function preceedingZero(num)
		{
			if (num < 10)
				return "0" + num;
			else
				return num;
		}
		function quickCreateElement(name, attr)
		{
			temp = document.createElement(name);
			if (attr != "")
			{
				attr = attr.split(" ");
				for (var qce = 0; qce < attr.length; qce++)
				{
					attr[qce] = attr[qce].split("=");
					if (attr[qce][0] == "innerHTML")
						temp.innerHTML = attr[qce][1];
					else
					{
						temp.setAttribute(attr[qce][0], attr[qce][1]);
						if (attr[qce][0] == "class")
							temp.setAttribute("className", attr[qce][1]);
					}
				}
			}
			return temp;
		}
		function readCookie(name)
		{
			var cookies = document.cookie.split(";");
			name = name + "=";
			for (var rc = 0; rc < cookies.length; rc++)
			{
				var c = cookies[rc];
				while (c.charAt(0) == " ")
					c = c.substring(1, c.length);
				if (c.indexOf(name) == 0)
					return c.substring(name.length, c.length);
			}
			return null;
		}
		function sbh(displayname, message, timestamp)
		{
			timestamp = ((timestamp === undefined) ? new Date() : new Date(timestamp * 1000));
			var displaynameTd = quickCreateElement("td", "align=left class=windowbg vAlign=middle width=1%"),
				messageTd = quickCreateElement("td", "align=left class=windowbg2"),
				postTr = document.createElement("tr"),
				shoutboxTBody = document.getElementById("shoutbox").getElementsByTagName("tbody")[1],
				stampTd = quickCreateElement("td", "align=left class=windowbg vAlign=middle width=1%"),
				hours = timestamp.getHours(), ampm = "am";
			if (hours > 11)
			{
				ampm = "pm";
				if (hours > 12)
					hours -= 12;
			}
			if (!hours)
				hours = 12;
			displaynameTd.innerHTML = displayname + ":";
			displaynameTd.style.fontWeight = "bold";
			messageTd.innerHTML = message;
			stampTd.innerHTML = preceedingZero(hours) + ":" + preceedingZero(timestamp.getMinutes()) + ":" + preceedingZero(timestamp.getSeconds()) + ampm;
			postTr.appendChild(displaynameTd);
			postTr.appendChild(messageTd);
			postTr.appendChild(stampTd);
			shoutboxTBody.insertBefore(postTr, shoutboxTBody.childNodes[((adDisplay) ? 3 : 2)]);
			if (shoutboxTBody.childNodes[shoutboxMessages + 5])
				shoutboxTBody.removeChild(shoutboxTBody.childNodes[shoutboxMessages + 3]);
		}
		function sbi()
		{
			temp = "";
			for (x = 0; x < shoutboxColors.length; x++)
				temp += '<option' + ((readCookie("shoutboxColor") == x) ? ' selected="selected"' : "") + ' value="' + x + '">' + shoutboxColors[x] + '<\/option>';
			document.getElementById("shoutboxDiv").innerHTML = '<form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="shoutboxDonate"><input name="bn" type="hidden" value="PP-DonationsBF" /><input name="business" type="hidden" value="charles.d.stover@gmail.com" /><input name="cmd" type="hidden" value="_donations" /><input name="currency_code" type="hidden" value="USD" /><input name="item_name" type="hidden" value="ProBoards ShoutBox Donation" /><input name="lc" type="hidden" value="US" /><input name="no_note" type="hidden" value="1" /><input name="no_shipping" type="hidden" value="0" /><input name="tax" type="hidden" value="0" /></form><form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="shoutboxUpgrade"><input type="hidden" name="cmd" value="_xclick" /><input type="hidden" name="business" value="charles.d.stover@gmail.com" /><input type="hidden" name="item_name" value="Premium ShoutBox (1 Year)" /><input type="hidden" name="amount" value="15.00" /><input type="hidden" name="no_shipping" value="0" /><input type="hidden" name="no_note" value="1" /><input type="hidden" name="currency_code" value="USD" /><input type="hidden" name="tax" value="0" /><input type="hidden" name="lc" value="US" /><input type="hidden" name="on0" value="ProBoards URL" /><input type="hidden" name="os0" value="' + location.host + '" /><\/form><iframe id="shoutboxIFrame" name="shoutboxIFrame" style="display : none;"><\/iframe><table align="center" border="0" cellpadding="0" cellspacing="0" class="bordercolor" id="shoutbox" width="92%"><tbody><tr><td><table border="0" cellpadding="4" cellspacing="1" width="100%"><tbody><tr><td align="center" class="titlebg" colspan="3" style="font-weight : bold;"><div style="float : left; text-align : left; width : 30%;"><a href="' + shoutboxHost + 'shoutbox.php?mode=chatlog&amp;proboard=' + location.host + '&key=' + chatlogKey + '" id="chatlogLink">[ChatLog]<\/a> <a href="javascript: globalize(); void(0);" id="globalLocal">[Global]<\/a><\/div><div style="float : right; text-align : right; width : 30%;">' + ((shoutboxPaid) ? "" : '<a href="javascript: document.shoutboxDonate.submit(true); void(0);">[Donate]<\/a> ') + ((shoutboxPaid) ? "" : '<a href="javascript: document.shoutboxUpgrade.submit(true); void(0);">[Upgrade]<\/a> ') + '<a href="http://servicesupport.proboards85.com/index.cgi?board=pbsbs">[Support]<\/a><\/div><font class="titletext" size="-1">' + document.title.split(" - ")[0] + '<\/font><\/td><\/tr><tr><td align="center" class="catbg" colspan="3" height="18"><font class="cattext" size="1" style="font-weight : bold;">' + ((!shoutboxPaid) ? '<div style="float : left; text-align : left; width : 25%;"><a href="' + shoutboxHost + 'shoutbox.php?mode=code">Get Your Own Free ShoutBox!<\/a><\/div><div style="float : right; text-align : right; width : 25%;"><a href="http://servicesupport.proboards85.com/index.cgi?action=viewprofile&user=gamechief">(C) Charles Stover<\/a><\/div>' : "") + '<span id="shoutboxCat">The ShoutBox<\/span><\/font><\/td><\/tr><tr><td align="center" class="windowbg2" colspan="3" height="18" id="shoutboxTimer" style="font-weight : bold;"><\/td><\/tr><tr><td align="center" class="catbg" colspan="3" height="18" id="shoutboxPost" style="font-weight : bold;"><form action="' + shoutboxHost + 'shoutbox.php" encoding="multipart/form-data" enctype="multipart/form-data" method="post" name="shoutboxForm" onsubmit="this.style.display = \'none\'; document.getElementById(\'shoutboxPosting\').style.display = \'block\'; sbp(pb_username, pb_displayname, this.message.value, new Date().getTime() / 1000, readCookie(\'shoutboxColor\')); setTimeout(\'document.shoutboxForm.message.value = \\\'\\\'; document.shoutboxForm.style.display = \\\'block\\\'; document.shoutboxForm.message.focus(); document.getElementById(\\\'shoutboxPosting\\\').style.display = \\\'none\\\';\', 1000);" style="margin : 0;" target="shoutboxIFrame"><select name="color" onchange="setCookie(\'shoutboxColor\', this.options[this.selectedIndex].value);" style="font-weight : normal; margin-right: 5px;"><option value="NULL">Color<\/option>' + temp + '<\/select><input maxlength="255" name="message" onblur="allowRefresh = false;" onfocus="allowRefresh = true;" style="margin-right : 5px; width : 33%;" type="text" /><input' + ((shoutboxDisabled) ? ' disabled="disabled"' : "") + ' type="submit" value="Shout!" /><input name="displayname" type="hidden" value="' + pb_displayname + '" /><input name="proboard" type="hidden" value="' + location.host + '" /><input name="username" type="hidden" value="' + pb_username + '" /><input id="globalField" name="global" type="hidden" value="false" /><\/form><div id="shoutboxPosting" style="display : none; font-weight : bold;">Posting...<\/div><\/td><\/tr><\/tbody><\/table><\/td><\/tr><\/tbody><\/table>';
			setTimeout("sbr();", 333);
		}
		function sbp(username, displayname, message, timestamp, color, website)
		{
			timestamp = ((timestamp === undefined) ? new Date() : new Date(timestamp * 1000));
			if ((username != pb_username) || ((website != undefined) && (website != location.host)))
				lastShout = Math.floor(timestamp.getTime() / 1000);
			var hours = timestamp.getHours(),
				postTr = document.createElement("tr"),
				shoutboxTBody = document.getElementById("shoutbox").getElementsByTagName("tbody")[1],
				stampTd = quickCreateElement("td", "align=left class=windowbg vAlign=middle width=1%"),
				ampm = "am", beforeTr;
			if (hours > 11)
			{
				ampm = "pm";
				if (hours > 12)
					hours -= 12;
			}
			if (!hours)
				hours = 12;
			stampTd.innerHTML = preceedingZero(hours) + ":" + preceedingZero(timestamp.getMinutes()) + ":" + preceedingZero(timestamp.getSeconds()) + ampm;
			if (username.substring(0, 1) == "_")
			{
				if (username == "_")
				{
					var adTd = quickCreateElement("td", "align=left class=windowbg colSpan=2 id=shoutboxAd"),
						google_ad_frame;
					adDisplay = true;
					adTd.innerHTML = '<script type="text/javascript"><!--' + "\n" + 'var google_ad_client = "pub-5517053702045843", google_ad_height = 15, google_ad_slot = "2420148162", google_ad_width = 468;' + "\n" + '//--><\/script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"><\/script>';
					//adWatcher();
				}
				else 
				{
					var adA = document.createElement("a"),
						adTd = quickCreateElement("td", "align=left class=windowbg2"),
						temp = quickCreateElement("td", "align=left class=windowbg vAlign=middle width=1%");
					adDisplay = true;
					temp.innerHTML = "Advertisement:";
					temp.style.fontWeight = "bold";
					postTr.appendChild(temp);
					adA.innerHTML = displayname;
					adA.setAttribute("href", shoutboxHost + "advertisement.php?code=" + username.substring(1, username.length) + "&referer=" + encodeURIComponent(document.title.split(" - ")[0]) + "&refererUrl=" + encodeURIComponent(location.host));
					adTd.appendChild(adA);
					adTd.innerHTML += " - " + message;
				}
				postTr.appendChild(adTd);
				beforeTr = shoutboxTBody.childNodes[2];
			}
			else
			{
				if (window.shoutboxCensors !== undefined)
				{
					for (x = 0; x < shoutboxCensors.length; x++)
					{
						while (message.match(shoutboxCensors[x][0]))
							message = message.replace(shoutboxCensors[x][0], shoutboxCensors[x][1]);
					}
				}
				if (message.substring(0, 4) == "/me ")
				{
					var postTd = quickCreateElement("td", "align=left class=windowbg2 colSpan=2 vAlign=middle"),
						profile = document.createElement("a"),
						profileClass = ((username == "admin") ? "sbadmin " : "") + "windowbg";
					profile.innerHTML = displayname;
					profile.setAttribute("class", profileClass);
					profile.setAttribute("className", profileClass);
					profile.setAttribute("href", ((website != undefined) ? "http://" + website + "/" : "") + "index.cgi?action=viewprofile&user=" + username);
					profile.style.fontWeight = "bold";
					postTd.style.fontStyle = "italic";
					postTd.appendChild(profile);
					postTd.innerHTML += " " + parseSmileys(message.substring(4, message.length));
					if ((color != undefined) && (color != -1))
						postTd.style.color = shoutboxColors[color];
					postTr.appendChild(postTd);
				}
				else
				{
					var messageTd = quickCreateElement("td", "align=left class=windowbg2 vAlign=middle"),
						profile = document.createElement("a"),
						userClass = ((username == "admin") ? "sbadmin " : "") + "windowbg",
						userTd = quickCreateElement("td", "align=left vAlign=middle width=1%");
					profile.innerHTML = displayname + ":";
					profile.setAttribute("href", ((website != undefined) ? "http://" + website + "/" : "") + "index.cgi?action=viewprofile&user=" + username);
					profile.style.fontWeight = "bold";
					if (website == undefined)
						website = location.host;
					if ((website == "servicesupport.proboards85.com") && (username == "gamechief"))
						userTd.appendChild(quickCreateElement("img", "alt=A src=http://2.wimg.co.uk/K82rey.gif title=Administrator"));
					if ((website == "servicesupport.proboards85.com") && (username == "admin"))
						userTd.appendChild(quickCreateElement("img", "alt=M src=http://2.wimg.co.uk/YBgdfO.gif title=Moderator"));
					userTd.appendChild(profile);
					userTd.setAttribute("class", userClass);
					userTd.setAttribute("className", userClass);
					userTd.style.whiteSpace = "nowrap";
					postTr.appendChild(userTd);
					messageTd.innerHTML = parseSmileys(message);
					if ((color != undefined) && (color != -1))
						messageTd.style.color = shoutboxColors[color];
					postTr.appendChild(messageTd);
				}
				beforeTr = shoutboxTBody.childNodes[((adDisplay) ? 3 : 2)];
			}
			postTr.appendChild(stampTd);
			shoutboxTBody.insertBefore(postTr, beforeTr);
			if (shoutboxTBody.childNodes[shoutboxMessages + 5])
				shoutboxTBody.removeChild(shoutboxTBody.childNodes[shoutboxMessages + 3]);
		}
		function sbr()
		{
			temp = document.getElementById("shoutboxTimer");
			if ((!timerTime) && ((allowRefresh) || (temp.innerHTML != "Refresh paused.")))
			{
				temp.parentNode.style.display = "";
				temp.innerHTML = "Refreshing..."
				timerTime = refreshTime;
				if (!timerTime)
					timerTime = 10;
				if (sbRefresh = document.getElementById("shoutboxRefresh"))
					header.removeChild(sbRefresh);
				sbRefresh = quickCreateElement("script", "id=shoutboxRefresh type=text/javascript");
				if (document.getElementById("shoutbox").getElementsByTagName("tbody")[1].childNodes[4])
					sbRefresh.setAttribute("src", ((shoutboxGlobal) ? "http://proboards.gamingmedley.com/" : shoutboxHost) + "shoutbox.php?mode=refresh&since=" + lastShout + "&proboard=" + location.host + "&user=" + pb_username + ((shoutboxGlobal) ? "&global=true" : ""));
				else
					sbRefresh.setAttribute("src", ((shoutboxGlobal) ? "http://proboards.gamingmedley.com/" : shoutboxHost) + "shoutbox.php?mode=shoutbox&proboard=" + location.host + ((shoutboxGlobal) ? "&global=true" : ""));
				header.appendChild(temp);
				setTimeout("sbr();", 2500);
			}
			else if (((!refreshTime) || (!shoutboxPaid)) && (!shoutboxGlobal))
			{
				temp.parentNode.style.display = "none";
				setTimeout("sbr();", 1000);
			}
			else if (allowRefresh)
			{
				temp.parentNode.style.display = "";
				temp.innerHTML = "Refreshing in " + timerTime + "...";
				timerTime--;
				setTimeout("sbr();", 1000);
			}
			else
			{
				temp.parentNode.style.display = "";
				if (timerTime > 0)
					timerTime--;
				temp.innerHTML = "Refresh paused.";
				setTimeout("sbr();", 1000);
			}
		}
		function setCookie(name, value)
		{
			if (value != null)
			{
				temp = new Date();
				temp.setTime(temp.getTime() + 31536000000);
				document.cookie = name + "=" + value + "; expires=" + temp.toGMTString() + "; path=/";
			}
		}
		function parseSmileys(text)
		{
			for (var ps = 0; ps < shoutboxSmileys.length; ps++)
				text = text.replace(shoutboxSmileys[ps][0], '<img alt="Smiley" src="' + shoutboxSmileys[ps][1] + '" />');
			return text;
		}
		var header = document.getElementsByTagName("head")[0],
			shoutboxColors = new Array("Black", "Red", "Yellow", "Pink", "Green", "Orange", "Purple", "Blue", "Beige", "Brown", "Teal", "Navy", "Maroon", "LimeGreen"),
			adDisplay = false, allowRefresh = false, shoutboxDisabled = false, shoutboxPaid = false, shoutboxTBody = false,
			chatlogKey = 'x', shoutboxHost = "http://proboards.gamingmedley.com/",
			lastShout = 0, refreshTime = 10, shoutboxGlobal = false, shoutboxMessages = 9, timerTime = 0,
			temp, x;
		if (window.shoutboxSmileys === undefined)
		{
			var shoutboxSmileys = [["::)", "rolleyes"], [":)", "smiley"], [";)", "wink"], [":D", "cheesy"], [";D", "grin"], [">:(", "angry"], [":(", "sad"], [":o", "shocked"], ["8-)", "cool"], ["???", "huh"], [":P", "tongue"], [":-[", "embarassed"], [":-X", "lipsrsealed"], [":-/", "undecided"], [":-*", "kiss"], [":'(", "cry"]];
			for (x = 0; x < shoutboxSmileys.length; x++)
				shoutboxSmileys[x][1] = "http://s4.images.proboards.com/" + shoutboxSmileys[x][1] + ".gif";
		}
		document.write('<div id="shoutboxDiv"><\/div>');
		var shoutboxInit = quickCreateElement("script", "type=text/javascript");
		shoutboxInit.setAttribute("src", shoutboxHost + "shoutbox.php?mode=init&proboard=" + location.host);
		header.appendChild(shoutboxInit);
	}
}