//function to create xmlhttp object
function getxmlhttp(){
	//Create a boolena variable to check for a valid IE instance
	var xmlhttp = false;

	//check if we are using IE
	try
	{
		//if the js version is greated than 5
		xmlhttp = new ActiveXObject("Msxml2.XMLHTP");
	}
	catch (e)
	{
		//if not then use older active x
		try
		{
			//if we are using IE
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (E)
		{
			//Else we must be using a non IE browser
			xmlhttp = false;
		}
	}

	//if non IE, create js instance
	if(!xmlhttp && typeof XMLHttpRequest != 'undefined'){
		xmlhttp = new XMLHttpRequest();
	}
    return xmlhttp;
}

//Functin to process XMLHttpRequest
function processajax (obj, serverPage){

	xmlhttp = getxmlhttp();
	xmlhttp.open("POST", serverPage);
	xmlhttp.onreadystatechange = function(){
	  if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
	      document.getElementById(obj).innerHTML = xmlhttp.responseText;
		  }
	}
	  xmlhttp.send(null);
}

//declare variables
function displaypoem(id){
	xmlhttp = getxmlhttp();
	xmlhttp.onreadystatechange = create_description;
	xmlhttp.open("GET", "muse.php?id="+id+"",true);
	xmlhttp.send(null);
}
function create_description(){
		  if(xmlhttp.readyState == 4){
	         document.getElementById("display").innerHTML = "<p>"+xmlhttp.responseText+"</p>";
		     $("#dim").fadeIn("slow");
		  }
}
function hideAgrmt(){
   $("#dim").fadeOut("slow");
}

