function connect()
{
   var http;
	if(window.XMLHttpRequest)
	{
		http = new XMLHttpRequest();
	}
	else if(window.ActiveXObject)
	{
		http = new ActiveXObject("Microsoft.XMLHTTP");
	}
   return http;
	//if(!http) return false;
}

function getData(url,callback_function,loadingImgTarget,return_xml)
{
	if(loadingImgTarget) addLoadingImg(loadingImgTarget);
	var http=connect();
	http.open("GET", url, true);
	http.onreadystatechange = function()
	{
		if (http.readyState == 4)
		{
			if (http.status == 200)
			{
				if(return_xml)
				{
					eval(callback_function + '(http.responseXML)');
				}
				else
				{
					eval(callback_function + '(http.responseText)');
				}
				http=null;
				delete http;
			}
			else
				alert(http.status + ' There was a problem with the request. Please try again later');
		}
	}
	http.send(null);
	if(loadingImgTarget) removeLoadingImg(loadingImgTarget);
}


function setBlogComment(url,params,callback_function,return_xml)
{
	var http=connect();
	http.open("POST", url, true);
	http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");  
      	http.setRequestHeader("Content-length", params.length);
	http.send(params);

	http.onreadystatechange = function()
	{
		if (http.readyState == 4)
		{
			if (http.status == 200)
			{
				if(return_xml)
				{
					eval(callback_function + '(http.responseXML)');
				}
				else
				{
					eval(callback_function + '(http.responseText)');
				}
				http=null;
				delete http;
			}
			else
				alert(http.status + ' There was a problem with the request. Please try again later');
		}
	}
}


function doSearchUser()
{
	var param="q="+encodeURI($("searchuserdialog").value);
	window.location="http://localhost:8080/herd/member/searchuser.php?"+param;
}
