function ajaxObject()
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  return xmlHttp;
}


function ajaxRun(query, callback, func)
{
	var xmlHttp = ajaxObject();
	
	xmlHttp.onreadystatechange = function()
	{
		// We are going to write some code here	
		if (xmlHttp.readyState == 4)
		{
			// Get the data from the server's response 
			if (callback)
				callback(xmlHttp.responseText);
			if (func)
				func(true);
		}
	}	
	
	if (func)
		func(false);
		
	var prefix = index();
	
	if (query.indexOf(prefix)>-1)
		xmlHttp.open("GET", query, true);
	else
		xmlHttp.open("GET", prefix+'/App/callback/'+query, true);
	xmlHttp.send(null);			
}

function ajaxRun_post(url, query, callback, func)
{
	var xmlHttp = ajaxObject();
	
	xmlHttp.onreadystatechange = function()
	{
		// We are going to write some code here	
		if (xmlHttp.readyState == 4)
		{
			// Get the data from the server's response 
			if (callback)
				callback(xmlHttp.responseText);
			if (func)
				func(true);
		}
	}	
	
	if (func)
		func(false);
		
	var prefix = index();
	if (url.indexOf(prefix)>-1)
		xmlHttp.open("POST", url, true);
	else
		xmlHttp.open("POST", prefix+'/App/callback/'+url, true);
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	//xmlHttp.setRequestHeader("Content-length", obj.length);
	//xmlHttp.setRequestHeader("Connection", "close");
	xmlHttp.send(query);
}
