// JavaScript Document
var xmlHttp

function showContent(content,page) { 
	xmlHttp=GetXmlHttpObject() // Calls on the GetXmlHttpObject function to create an XMLHTTP object
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	var url= "elements/" + content + "/items.php"
	url=url+"?page="+page // Adds a parameter to the url with the content of the string
	url=url+"&amp;sid1="+Math.random() // Adds a random number to prevent the server from using a cached file
	xmlHttp.onreadystatechange=function() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById("contentDiv").innerHTML=xmlHttp.responseText
		}
	}
	xmlHttp.open("GET",url,true) // Opens the XMLHTTP object with the given url.
	xmlHttp.send(null) // Sends an HTTP request to the server
}

function showForm(content,menu) { 
	xmlHttp=GetXmlHttpObject() // Calls on the GetXmlHttpObject function to create an XMLHTTP object
	if (xmlHttp==null) {
		alert ("Browser does not support HTTP Request")
		return
	}
	var url= "elements/" + content + "/form.php"
	url=url+"?menu="+menu;
	url=url+"&amp;sid1="+Math.random() // Adds a random number to prevent the server from using a cached file
	xmlHttp.onreadystatechange=function() { 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
			document.getElementById("contentDiv").innerHTML=xmlHttp.responseText
		}
	}
	xmlHttp.open("GET",url,true) // Opens the XMLHTTP object with the given url.
	xmlHttp.send(null) // Sends an HTTP request to the server
}

function GetXmlHttpObject() {
	var xmlHttp=null;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	} catch (e) {
		//Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}