

function CreateXMLHttpRequest()
{
    var xhr; 
	
    try {  xhr = new ActiveXObject('Msxml2.XMLHTTP');   }
    catch (e) 
    {
        try {   xhr = new ActiveXObject('Microsoft.XMLHTTP');    }
        catch (e2) 
        {
          try {  xhr = new XMLHttpRequest();     }
          catch (e3) {  xhr = false;   }
        }
     }

     return xhr;
}

function ajaxPost(url, param, callback)
{
	var i;
	var data;

	xmlHttp = CreateXMLHttpRequest();

	xmlHttp.open('POST', url, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");      

	xmlHttp.onreadystatechange = function() {
	    if (xmlHttp.readyState == 4) {
               if (xmlHttp.status == 200)
               {
                  // elm.value = xmlHttp.responseText;
//		  callback(xmlHttp.responseXML);
		  callback(xmlHttp.responseText);
               }
               else
               {
//                  alert(url);//elm.value = 'Error Code';
               }
            }
        }

	data = "";

	for(i = 0; i < param.length; ++i)
	{
		if (data.length > 0)
			data += "&";

		data += param[i][0] + "=" + param[i][1];
	}

	alert (data);
	xmlHttp.send(data);
}

function ajaxGet(url, callback)
{
	xmlHttp = CreateXMLHttpRequest();

	xmlHttp.open('GET', url, true);

	xmlHttp.onreadystatechange = function() {
	    if (xmlHttp.readyState == 4) {
               if (xmlHttp.status == 200)
               {
                  // elm.value = xmlHttp.responseText;
		  callback(xmlHttp.responseXML);
               }
               else
               {
                  alert(url);//elm.value = 'Error Code';
               }
            }
        }

	xmlHttp.send(null);
}


function ajaxGetText(url, callback)
{
	xmlHttp = CreateXMLHttpRequest();

	xmlHttp.open('GET', url, true);

	xmlHttp.onreadystatechange = function() {
	    if (xmlHttp.readyState == 4) {
               if (xmlHttp.status == 200)
               {
                  // elm.value = xmlHttp.responseText;
		  callback(xmlHttp.responseText);
               }
               else
               {
                  alert(url);//elm.value = 'Error Code';
               }
            }
        }

	xmlHttp.send(null);
}

function GetNews(url, callback)
{
	ajaxGet(url, callback);
}

