var AjaxObj;
if(window.XMLHttpRequest) {
  AjaxObj = new XMLHttpRequest();
}
else if(window.ActiveXObject) {
  AjaxObj = new ActiveXObject( "Microsoft.XMLHTTP" );
}

function UpdateContent () {
  if(AjaxObj.readyState == 4){
    document.getElementById(AjaxObj.HTMLID).innerHTML = AjaxObj.responseText;
    var RExpStr = /<script>(.+?)<\/script>/; RExpStr.exec(AjaxObj.responseText);
    if (RegExp.$1.length > 5) {
      eval (RegExp.$1);
    }
  }
}

function Update (HTMLID, URL) {
  document.getElementById(HTMLID).innerHTML = "<img src='/icons/AjaxLoader.gif' hspace=10 vspace=10>";
  AjaxObj.HTMLID = HTMLID;
  AjaxObj.open('get', URL);
  AjaxObj.onreadystatechange = UpdateContent;
  AjaxObj.send(null);
}

function OpenAjax (Left, Top, Width, Height, URL) {
  Obj = document.getElementById('ajaxb');
  with (Obj) {
    style.left=Left;
    style.top=Top;
    style.width=Width;
    style.height=Height;
  }
  document.getElementById('ajaxa').style.display='block';
  document.getElementById('ajaxb').innerHTML = '';
  Update (document.getElementById('ajaxb').id, URL);
  document.getElementById('ajaxb').style.display='block';
}

function CloseAjax () {
  document.getElementById('ajaxa').style.display='none';
  document.getElementById('ajaxb').style.display='none';
}
