var req;
var divname="showdiv";
function Initialize(){
	try{
		req=new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try{
			req=new ActiveXObject("Microsoft.XMLHTTP");
		}catch(oc){
			req=null;
		}
	}

	if(!req&&typeof XMLHttpRequest!="undefined"){
		req=new XMLHttpRequest();
	}
}

function SendQuery(url, name){
	Initialize();
	//alert(url);
	if(name) divname=name;
	if(req!=null){
		req.onreadystatechange = Process;
		req.open("GET", url, true);
        req.send(null);
	}
}
//2008-11-14
function ExecuteQuery(url){
	Initialize();
	if(req!=null){
		req.onreadystatechange = ProcessExecute;
		req.open("GET", url, true);
        req.send(null);
	}
}

function Process(){
	if(req.readyState == 4){
    // only if "OK"
		if (req.status == 200){
			if(req.responseText=="")
				HideDiv(divname);
			else{
				ShowDiv(divname);
				document.getElementById(divname).innerHTML =req.responseText;
			}
		}else {
			document.getElementById(divname).innerHTML="There was a problem retrieving data:<br>"+req.statusText;
		}
	}
}
//2008-11-14
function ProcessExecute(){
	if(req.readyState == 4){
		if (req.status == 200){
			if(req.responseText==""){
			}else{
				eval(req.responseText);
			}
		}else {
			alert("There was a problem retrieving data:<br>"+req.statusText);
		}
	}
}

function ShowDiv(divid) 
{
   if (document.layers) document.layers[divid].visibility="show";
   else document.getElementById(divid).style.visibility="visible";
}

function HideDiv(divid) 
{
   if (document.layers) document.layers[divid].visibility="hide";
   else document.getElementById(divid).style.visibility="hidden";
}
