/**
* JSLib, main javascript code
*
* @name JSLib
* @verision ---
* @package ---
* @author Rashaud Teague <rashaud.teague@gmail.com>
* @since 03/11/2009
* @license GNU GPL
*/

function getxmlhttp() {
	var xmlhttp = false;
	
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
		}
	}
	
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	
	return xmlhttp;
}

function reorder(page, direction) {
	var xmlhttp = getxmlhttp();
	
	var obj = document.getElementById("reorder");
	
	xmlhttp.open("GET", "reorder.php?page="+page+"&direction="+direction);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			obj.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
}

var showtbl = false;
var tbl_cached = "";
function show_hide() {
	var tblc = document.getElementById("tbllist");
	
	if (showtbl == true) {
		if (tbl_cached != "") {
			tblc.innerHTML = tbl_cached;
		}
		tbl_cached = "";
		document.getElementById("showhide").innerHTML = "Hide";
		showtbl = false;
	} else if (showtbl == false) {
		tbl_cached = tblc.innerHTML;
		tblc.innerHTML = "";
		document.getElementById("showhide").innerHTML = "Show";
		showtbl = true;
	}
}
