var xmlhttp = false;

 try {
  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
  try {
   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (E) {
   xmlhttp = false;
  }
 }
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
	try {
		xmlhttp = new XMLHttpRequest();
	} catch (e) {
		xmlhttp=false;
	}
}
if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}


var what_to_set = null;
function send_get_set(url, what)
{
  what_to_set = what;
  xmlhttp.open("GET", url);
  
 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
    alert(xmlhttp.responseText);
   what_to_set.value = xmlhttp.responseText;
  }
 }

  xmlhttp.send(null);
}

function send_get(url)
{
  xmlhttp.open("GET", url);

  xmlhttp.send(null);
}

function send_get_debug(url)
{
  alert(url);
  xmlhttp.open("GET", url);

 xmlhttp.onreadystatechange=function() {
  if (xmlhttp.readyState==4) {
   alert(xmlhttp.responseText)
  }
 }
  xmlhttp.send(null);
}


var olditem = null;
var oldurl = null;
function persist(newitem, url)
{
  if (olditem != null)
  {
    send_get_debug(oldurl + '&value=' + escape(olditem.value));
  }
  if (newitem.value != '')
  {
    send_get(url + '&value=' + escape(newitem.value));
  }
  oldurl = url;
  olditem = newitem;
}

