

function createRequestObject() {
    var tmpXmlHttpObject;
    
    //depending on what the browser supports, use the right way to create the XMLHttpRequest object
    if (window.XMLHttpRequest) { 
		// Mozilla, Safari would use this method ...
		tmpXmlHttpObject = new XMLHttpRequest();
	
    }else if (window.ActiveXObject) { 
		// IE would use this method ...
		try{
			tmpXmlHttpObject = new ActiveXObject("MSXML2.XMLHTTP");	
		}catch(e){
			try{
				tmpXmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");	
			}catch(e){}
		}  
	}else{

		alert("Your browser doesn't support AJAX");
		return null;
	}    
    return tmpXmlHttpObject;
}


function makeGetGlossary(e,aUrl) {

	//call the above function to create the XMLHttpRequest object
	var http = createRequestObject();

	// capture the mouse position
	var posx = 0;
	var posy = 0;
	if (!e) var e = window.event;
	if (e.pageX || e.pageY){
		posx = e.pageX;
		posy = e.pageY;
	}else if (e.clientX || e.clientY){
	    posx = e.clientX + document.body.scrollLeft;
	    posy = e.clientY + document.body.scrollTop;
	}
	
	// Fecth the divs
	var dDev1 = document.getElementById('glo_sc');
    var dDev2 = document.getElementById('sub_glo');

	// Set visible
	dDev1.style.visibility='visible';
	dDev2.style.visibility='visible';

	// Make sure  it is visble
	posx -= dDev1.clientWidth;
	if (posx < 5)
		posx = 5;
	if (posy < 5)
		posy = 5;
    if (posx < 5)
        posx = 5;aUrl
    document.getElementById('glo_sc').style.left = posx + 'px';
    document.getElementById('glo_sc').style.top = posy + 'px';

    // Fetch the content	
	http.open('get', aUrl);
			
    // Set temporary content
    dDev2.innerHTML = "<div id='load_sc'></div>";
    
	//assign a handler for the response
	http.onreadystatechange = function(){processGlo(http, dDev1, dDev2);}
	
    //actually send the request to the server
    http.send(null);
}

function processGlo(http, dDev1, dDev2) {

	// Check if the response has been received from the server
	if(http.readyState == 4){

		//read the response and set content
		var response = http.responseText;
		dDev2.innerHTML = response;
    }
}

function hideGlossary(e) {
	document.getElementById('glo_sc').style.visibility='hidden';
	document.getElementById('sub_glo').style.visibility='hidden';
}

