

function ajaxFunction(query){
	//alert(query);
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('ajaxDiv');
			ajaxDisplay.innerHTML = "<div class=\"button\" align=\"right\" style=\"height: 30px\" ><a onclick=\"closecart()\">Close [x]</a></div>"+ajaxRequest.responseText;
		}else if(ajaxRequest.readyState == 1){
			var ajaxDisplay = document.getElementById('ajaxDiv');
			ajaxDisplay.innerHTML = "<br><br><img style=\"width: 32px; height: 32px; float: left;\" alt=\"Loading...\" src=\"images/loading.gif\">";
		}
	}
	//var age = document.getElementById('age').value;
	//var queryString = "?age=" + age + "&wpm=" + wpm + "&sex=" + sex;
	ajaxRequest.open("GET", "show_item.php?name="+query, true);
	ajaxRequest.send(null); 
	var ajaxDisplay = document.getElementById('ajaxDiv');
	
	
	
var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	

	

	ajaxDisplay.style.top=yScroll+windowHeight/2-135+"px";
	ajaxDisplay.style.left=windowWidth/2-210+"px";
	ajaxDisplay.style.visibility="visible";
	ajaxDisplay.style.display="block";
	//ajaxDisplay.style.zorder=0;
	
}
function closecart(){
	var ajaxDisplay = document.getElementById('ajaxDiv');
	ajaxDisplay.style.visibility="hidden";
	ajaxDisplay.style.display="none";
}


/*
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var tempX = 0;
var tempY = 0;
function getMouseXY(e) {
if (IE) { // grab the x-y pos.s if browser is IE
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
}
else {  // grab the x-y pos.s if browser is NS
tempX = e.pageX;
tempY = e.pageY;
}  
if (tempX < 0){tempX = 0;}
if (tempY < 0){tempY = 0;}  
document.Show.MouseX.value = tempX;
document.Show.MouseY.value = tempY;
return true;
}*/







function showmenu(id, query, file){
	//alert(id);
	
	var button = document.getElementById('bmenu');
	var pic = document.getElementById(id);
	//alert(id/4);
	var row=Math.ceil(id/4)*235+70;
	var col=((id-1)%4+1)*160+290;
	//alert(row + " r  " + col + " c " + id);
	button.style.top=row+"px";
	button.style.left=col+"px";
	button.style.visibility="visible";
	button.style.display="block";
	var qc = document.getElementById('qc');
	qc.onclick = function() {ajaxFunction(query);}//onclick="hidemenu()"
	
	button.onmouseover = function() {showmenu(id, query);}
	//button.qc.onclick="ajaxFunction('"+query+"')";
	//button.style.z-index=900;
	
	
}

/*
function hidemenu(){
	//alert("hide");
	
	var button = document.getElementById('bmenu');
	//alert(button.hasfocus);
	button.style.visibility="hidden";
	button.style.display="none";
	
	var tip = document.getElementById('tip');
	tip.style.visibility="hidden";
	tip.style.display="none";
	
}*/

/*
function movetip()
{

	var tip = document.getElementById('tip');
	tip.style.top=tempY+15+"px";
	tip.style.left=tempX+15+"px";
	tip.style.visibility="visible";
	tip.style.display="block";
}*/
