// Comments Drop
function cDrop(id, s)
{
	if(s == 1)
	{
		document.getElementById(id).innerHTML = '<a href="javascript: cDrop(\'arra\', 0);"><img src="/i/other/arrow_u.gif" border="0" alt="Up" title="Hide article"></a>';
		document.getElementById("cFull").style.display = 'block';
	}
	else if(s == 0)
	{
		document.getElementById(id).innerHTML = '<a href="javascript: cDrop(\'arra\', 1);"><img src="/i/other/arrow_d.gif" border="0" alt="Down" title="Show article"></a>';
		document.getElementById("cFull").style.display = 'none';
	}
}

// Contact Arrows
function cUP()
{
	nRow = (document.form1.c_message.rows - 1);
	if(nRow <= 7)
		document.form1.c_message.rows = 7;
	else
		document.form1.c_message.rows = (document.form1.c_message.rows - 1);
	sTo = setTimeout('cUP()', 100);
}
function cDOWN()
{
	document.form1.c_message.rows = (document.form1.c_message.rows + 1);
	sTo = setTimeout('cDOWN()', 100);
}

// Contact Count Characters
function cCount()
{
	hMany = (1000 - document.form1.c_message.value.length);
	if(hMany < 0)
	{
		nText = document.form1.c_message.value.substring(0,1000);
		document.form1.c_message.value = nText;
		hMany = 0;
	}
	document.form1.tf.value = hMany;
}

// Games Jump Menu
function goJump(to, what)
{
	eval(to + ".location='" + what.options[what.selectedIndex].value + "'");
}

// Bookmark
function addBook(t, u)
{
	if(window.opera)
		alert("Press CTRL+T to bookmark, this page!");
	else
		alert("Press CTRL+D to bookmark, this page!");
}
// AJAX Int. Scr.
var xmlHttp
function pumpAff(affID)
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request");
		return;
	} 
	xmlHttp.open("POST", 'http://neoboffins.com/go/' + affID + '/', true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.send(null);
}

function GetXmlHttpObject(handler)
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return objXMLHttp;
}
// RSS Feeds
function fsCSS(int)
{
	document.getElementById("fs" + int).style.color = "#990000";
	document.getElementById("fs" + int).style.backgroundImage = "url(/i/other/rss_on.gif)";
	document.getElementById("fs" + int).style.borderBottomColor = "#FFD5D5";
	fcSwithcB();
	fcSwitch(int);
}
function fsCSSB()
{
	var cssB = 0;
	while(cssB != 6)
	{
		document.getElementById("fs" + cssB).style.color = "#FFA8D3";
		document.getElementById("fs" + cssB).style.backgroundImage = "url(/i/other/rss_off.gif)";
		document.getElementById("fs" + cssB).style.borderBottomColor = "#FF0000";
		cssB++;
	}
}
function feedSwitch(int)
{
	fsCSSB();
	fsCSS(int);
}
function fcSwithcB()
{
	var fcB = 0;
	while(fcB != 6)
	{
		document.getElementById("fc" + fcB).style.display = "none";
		fcB++;
	}
}
function fcSwitch(int)
{
	document.getElementById("fc" + int).style.display = "block";
}
// Admin BB tags
function createBBtag(openerTag, closerTag, areaId)
{
	var txtArea = document.getElementById( areaId );
	if (txtArea.selectionEnd && (txtArea.selectionEnd - txtArea.selectionStart > 0))
	{
		var preString = (txtArea.value).substring(0,txtArea.selectionStart);
		var newString = openerTag + (txtArea.value).substring(txtArea.selectionStart,txtArea.selectionEnd) + closerTag;
		var postString = (txtArea.value).substring(txtArea.selectionEnd);
		txtArea.value = preString + newString + postString;
		txtArea.focus();
	}
	else 
	{
		var offset = txtArea.selectionStart;
		var preString = (txtArea.value).substring(0,offset);
		var newString = openerTag + closerTag;
		var postString = (txtArea.value).substring(offset);
		txtArea.value = preString + newString + postString;
		txtArea.selectionStart = offset + openerTag.length;
		txtArea.selectionEnd = offset + openerTag.length;
		txtArea.focus();
	}
return;
}
// Gallery Overlay
function showPic(name)
{
	document.getElementById("overlay").innerHTML = '<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"><tr><td valign="middle"><table align="center" cellpadding="10" cellspacing="0" bgcolor="#FFFFFF" onClick="document.getElementById(\'overlay\').style.display = \'none\';" style="cursor: pointer;" title="Close Overlay"><tr><td><img src="http://neoboffins.com/i/gal/' + name + '" id="overimg"></td></tr><tr><td><div align="right"><strong>Click to close Overlay</strong></div></td></tr></table></td></tr></table>';
	document.getElementById("overlay").style.display = "block";
}
// Comment Smileys
function insertEmo(text)
{
	document.getElementById("c_message").value = document.getElementById("c_message").value + " " + text;
}

// Now Playing
npDoneBefore = 0;
function updatePlaying()
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
		return false;
		
	xmlHttp.open("GET", 'http://neoboffins.com/f/playing/getNowPlaying.php', true);
	xmlHttp.onreadystatechange=function()
	{
		if(xmlHttp.readyState == 4)
		{
			if(xmlHttp.status == 404)
			{
				document.getElementById("NowPlaying").innerHTML = "<h1>ERROR:</h1> <h2>Cannot load external file</h2>";
			}
			else
			{
				document.getElementById("NowPlaying").innerHTML = xmlHttp.responseText;
			}
			if(npDoneBefore != 1)
			{
				npDoneBefore = 1;
				window.setInterval('updatePlaying()', 10000);
			}
		}
	}
	
	xmlHttp.send(null);
}
function npFullAlbum(int)
{
	if(int == 0)
	{
		document.getElementById("NowPlaying").style.height = "52px";
		document.getElementById("npAlbumArt").style.position = "absolute";
		document.getElementById("npAlbumArt").style.width = "200px";
		document.getElementById("npAlbumArt").style.height = "200px";
		document.getElementById("npAlbumArt").style.top = "-80px";
		document.getElementById("npAlbumArt").style.left = "-80px";
	}
	else
	{
		document.getElementById("npAlbumArt").style.position = "";
		document.getElementById("npAlbumArt").style.width = "40px";
		document.getElementById("npAlbumArt").style.height = "40px";
	}
}