var query= new Array();
	var current_target;

    function makeRequest(url,target,runfunc) {
    	   if (http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
    	
    	
        var http_request = false;

        if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
                // See note below about this line
            }
        } else if (window.ActiveXObject) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

        if (!http_request) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        http_request.onreadystatechange = function() { 
        	if (runfunc){ update_content(target,http_request,runfunc); }else update_content(target,http_request);
        	
        };
        http_request.open('GET', url, true);
        http_request.send(null);

    }

    function  update_content(target,http_request,runfunc) {

        if (http_request.readyState == 4) {
            if (http_request.status == 200) {
                
                document.getElementById(target).innerHTML = http_request.responseText ;
            if (runfunc) {
            	eval (runfunc);
            }
            
            } else {
                 document.getElementById(target).innerHTML ='There was a problem with the request.';
            }
        }else {
        //	if( document.getElementById('loading')){
        
        //	} else {
        	
			document.getElementById(target).innerHTML = "<img id='loading' src='/images/loading.gif'>Searching, please wait...";
        	//}
        	
        }

    }
    
    
       function get_gloss(target,update,blah){
if (document.getElementById(target)) document.body.removeChild(document.getElementById(target));

load_port = document.createElement("div");
load_port.id=target;
load_port.style.position = 'absolute';
postitionvar = findPosition(document.getElementById('theResult'));
load_port.style.top = postitionvar[1];
load_port.style.left = postitionvar[0];
load_port.style.width = document.getElementById('theResult').style.width;
load_port.style.backgroundColor = 'white';
load_port.style.border = '1px solid';
document.body.appendChild(load_port);
    if (update > 0){
  // makeRequest('/gloss/hello.html?elo=' + blah + '&tar='+ target,target);
   makeRequest('/inc/blah.php?elo=' + blah + '&tar='+ target+'&rand='+Math.random(),target);
    //update_content(pageno,'/gloss/apfrica_?elo=add_result');
    }
    
load_port.style.backgroundColor = '#ffffff';
//load_port.style.border = '1px solid';
    
    return;
    }	
    	
    function show_all(target,showmore,tar){
    	document.getElementById(tar).style.overflow = "auto";
 document.getElementById(tar).style.height = (document.getElementById('theResult').offsetHeight - 200)  +'px';
 
    	    	while (document.getElementById(target)){
    		
    		document.getElementById(target).style.display = "block";
    		document.getElementById(target).id = "restc";
    		
    	}
    	if(document.getElementById(showmore)) {
    		document.getElementById(showmore).href ='#';
    		document.getElementById(showmore).innerHTML = '[<a  href="#" onclick="javascript:clean(\''+tar+'\');">Close</a>]';
    		
    	};   	
    	
    }
function clean(vaar){
if(document.getElementById(vaar)) {
	document.body.removeChild(document.getElementById(vaar));
}else {alert('Sorry, an Error Occured, please refresh the Page and try again..');}
	return false;
}

function findPosition( oLink ) {
  if( oLink.offsetParent ) {
    for( var posX = 0, posY = 0; oLink.offsetParent; oLink = oLink.offsetParent ) {
      posX += oLink.offsetLeft;
      posY += oLink.offsetTop;
    }
    return [ posX, posY ];
  } else {
    return [ oLink.x, oLink.y ];
  }
}