var state = 'none';
function showhide(layer_ref) {
	if (state == 'block') {
		state = 'none';
	} else {
		state = 'block';
	}
	if (document.all) {
		eval( "document.all." + layer_ref + ".style.display = state");
	}
	if (document.layers) {
		document.layers[layer_ref].display = state;
	}
	if (document.getElementById && !document.all) {
		hza = document.getElementById(layer_ref);
		hza.style.display = state;
	}
}
function disableSelection(target){
if (typeof target.onselectstart!="undefined")
	target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined")
	target.style.MozUserSelect="none"
else 
	target.onmousedown=function(){return false}
target.style.cursor = "default"
}
function togglesidemenu() {
	Ajax.Popup (  );
	var menu=document.getElementById('dropdownbar');
	var togg=document.getElementById('title');
	var showing=menu.className=='show';
	if(document.all) togg.innerText=showing?'Heretech121':'Heretech121';
	else togg.textContent=showing?'Heretech121':'Heretech121';
	menu.className=showing?'hide':'show';
	togg.className=showing?'showbutton':'hidebutton';
}
var Ajax = new Object();
Ajax.popupId = "dropdownbar";
Ajax.poppedup = false;
Ajax.animate = false;
Ajax.Popup = function() {
	this.animate = true;
	if ( this.poppedup ) this.HidePopup(0);
	else this.ShowPopup(0);
	this.animate = false;
}
Ajax.ShowPopup = function(y) {
	this.element = document.getElementById(this.popupId);
	this.element.style.display = "block";
	height = this.element.clientHeight;
	for ( var i = 0; i <= 120; i++ ) {
		(function(){
			var step = i;
			setTimeout(function(){
				Ajax.element.style.top = (((step / 100) * height) - height) + "px";
			}, step * 3);
		})();
	}
	this.poppedup = true;
}
Ajax.HidePopup = function(y) {
	this.element = document.getElementById(this.popupId);
	height = this.element.clientHeight;
	for ( var i = 0; i <= 150; i++ ) {
		(function(){
			var step = i;
			setTimeout(function(){
				Ajax.element.style.top = ((((100 - step) / 100) * height) - height) + "px";
			}, step * 1);
		})();
	}
	this.poppedup = false;
}
function CheckUpdates()
{
	postTo = './check.php';
	var params = 'Updates=true';
	var http = new XMLHttpRequest();
	http.open("POST", postTo, true);
	http.setRequestHeader("Content-type", "text/html");
	http.setRequestHeader("Content-length", params.length);
	http.setRequestHeader("Connection", "close");
	http.onreadystatechange = function()
	{
		if(http.readyState == 4 && http.status == 200) {
			if ( http.responseText != '' )
			{
				if ( http.responseText == 0 ) {
					var rText = '<a id="NoUpdates" href="./updates.php" title="Updates">'+http.responseText+'</a>';
				} else {
					var rText = '<a id="Updates" href="./updates.php" title="Updates">'+http.responseText+'</a>';
				}
				document.getElementById('updates').innerHTML = rText;
			}
		}
	}
	http.send(params);
}
