// ==UserScript==
// @name           Post Footer Toggle
// @namespace      http://digitalcreations.cc
// @description    Allows the user to toggle the footer of each post
// @include        http://*tacticalgamer.com/*
// ==/UserScript==

htmlNode = document.evaluate('/html', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue
if (htmlNode.innerHTML.indexOf('templates/wow') == -1) {
postAnchors = document.evaluate("//a[@name]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < postAnchors.snapshotLength; i++) {
	postAnchor = postAnchors.snapshotItem(i);
	if (postAnchor.name.indexOf('post') == 0) {
		postId = postAnchor.name.replace('post','')
		postTable = document.getElementById(postAnchor.name)
		if (postTable) {
			if (postTable.rows) {
				postbitRow = postTable.rows[1]
				postbitCell = postbitRow.cells[0]
				footerRow = postTable.rows[2]
				footerRow.id = 'footerRow' + postId
				footerRow.style.display = 'none'
				postbitCell.addEventListener('click',eval("function(){togglePostFooterDisplay('"+footerRow.id+"')}"),false)
			}
		}
	}
}

if (location.href.indexOf('#') != -1) {
	location.href = location.href
}
}

function togglePostFooterDisplay(id) {
	obj = document.getElementById(id)
	if (obj) {
		if (obj.style.display == 'none') {
			obj.style.display = ''
		}
	else {
		obj.style.display = 'none'
	}
}
}