function GetHttpObject()
{ 
var req = false;
if(window.XMLHttpRequest) {
try {
	req = new XMLHttpRequest();
} catch(e) {
	req = false;
}
// branch for IE/Windows ActiveX version
} else if(window.ActiveXObject) {
try {
    req = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
    try {
        req = new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e) {
        req = false;
    }
}
}
  return req;
}
function WriteToInnerHTML(DivName, Data) {
	var div = document.getElementById(DivName);
	if(div != null) div.innerHTML = Data;
}
function WriteLoadingToInnerHTML(DivName) {
/*
	var div = document.getElementById(DivName);
	var text = '<p align=center><img src="../Images/working.gif" border=0></p>';
	if(div != null) div.innerHTML = text;
*/	
}

var  XmlHttp;

////
function sendCommand(url)
{
XmlHttp = GetHttpObject();
if( XmlHttp ) {
XmlHttp.open("Get", url, true);
XmlHttp.send("");
} }
////
function getDataToInnerHTML(DivName, url)
{
XmlHttp = GetHttpObject();
if( XmlHttp ) {
XmlHttp.onreadystatechange = function () {
  if( XmlHttp.readyState == 4 )
  {
    if( XmlHttp.status == 200 && XmlHttp.statusText == "OK" ) {
		WriteToInnerHTML(DivName, XmlHttp.responseText);
    } else {
		WriteToInnerHTML(DivName, '<br><FONT color=Red>'+XmlHttp.statusText+'</FONT><br>');
    }
	XmlHttp = null;
  } else {
	WriteLoadingToInnerHTML(DivName);
  }
}
XmlHttp.open("Get", url, true);
XmlHttp.send("");
} }
///
function RunAspxPageCommand(DivName, url) {
XmlHttp = GetHttpObject();
if( XmlHttp ) {
XmlHttp.onreadystatechange = function () {
  if( XmlHttp.readyState == 4 )
  {
    if( XmlHttp.status == 200 && XmlHttp.statusText == "OK" ) {
		this.window.close();
    } else {
		WriteToInnerHTML(DivName, '<br><FONT color=Red>'+XmlHttp.statusText+'</FONT><br>');
    }
	XmlHttp = null;
  } else {
	WriteLoadingToInnerHTML(DivName);
  }
}
XmlHttp.open("Get", url, true);
XmlHttp.send("");
}}
///
function getInfoToInnerHTML(DivName, url) {
XmlHttp = GetHttpObject();
if( XmlHttp ) {
XmlHttp.onreadystatechange = function (){
  if( XmlHttp.readyState == 4 )
  {
    if( XmlHttp.status == 200 && XmlHttp.statusText == "OK" ) {
		WriteToInnerHTML(DivName, XmlHttp.responseText);
    } else {
		WriteToInnerHTML(DivName, '<br><FONT color=Red>'+XmlHttp.statusText+'</FONT><br>');
    }
	XmlHttp = null;
  }
}
XmlHttp.open("Get", url, true);
XmlHttp.send("");
}}
///
function getInfoToInnerHTMLPOST(DivName, url) {
XmlHttp = GetHttpObject();
if( XmlHttp ) {
XmlHttp.onreadystatechange = function (){
  if( XmlHttp.readyState == 4 )
  {
    if( XmlHttp.status == 200 && XmlHttp.statusText == "OK" ) {
		WriteToInnerHTML(DivName, XmlHttp.responseText);
    } else {
		WriteToInnerHTML(DivName, '<br><FONT color=Red>'+XmlHttp.statusText+'</FONT><br>');
    }
	XmlHttp = null;
  }
}
XmlHttp.open("POST", url, true);
XmlHttp.send(document.getElementById(DivName).value);
}}
///
function sendDataToInnerHTMLPOST(DivName, url, data) {
XmlHttp = GetHttpObject();
if( XmlHttp ) {
XmlHttp.onreadystatechange = function (){
  if( XmlHttp.readyState == 4 )
  {
    if( XmlHttp.status == 200 && XmlHttp.statusText == "OK" ) {
		WriteToInnerHTML(DivName, XmlHttp.responseText);
    } else {
		WriteError(DivName, XmlHttp.statusText);
    }
	XmlHttp = null;
  } else {
	WriteLoadingToInnerHTML(DivName);
  }
}
XmlHttp.open("POST", url, true);
XmlHttp.send(data);
}}


