function AjaxRequest(url, callback_function) {
 			var req = null;
 			var msxmlhttp = new Array(
				'Msxml2.XMLHTTP.5.0',
				'Msxml2.XMLHTTP.4.0',
				'Msxml2.XMLHTTP.3.0',
				'Msxml2.XMLHTTP',
				'Microsoft.XMLHTTP');
			for (var i = 0; i < msxmlhttp.length; i++) {
				try {
					req = new ActiveXObject(msxmlhttp[i]);
				} catch (e) {
					req = null;
				}
			}
 			
			if(!req && typeof XMLHttpRequest != "undefined") {
				req = new XMLHttpRequest();
      }
      if (req != null) {
        req.open("POST", url, true);
        req.onreadystatechange = function() {
          if ((req.readyState == 4) && (req.status == 200)) {
            var json = req.responseText.parseJSON();
            var callback = callback_function + '(json)';
            eval(callback);
          }
        }
        req.send(null);
        delete req;
      }
			return true;
}

function UpdateForm(objects) {
  document.forms['add_frm']['fetch_meta'].disabled = false;
  for (var i in objects) {
    if (i != "toJSONString") {
      if (document.forms['add_frm'][i]) {
        document.forms['add_frm'][i].value = objects[i];
      }
    }
  }
}

function FetchMeta() {
  var url = document.forms['add_frm']['url'].value;
  document.forms['add_frm']['fetch_meta'].disabled = true;
  AjaxRequest('ajax.php?cmd=fetch_meta&url=' + url, 'UpdateForm');
}