﻿var xmlHttp;
function createXMLHttpRequest()
{
    if (window.ActiveXObject)
    {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");        
    }
    else if (window.XMLHttpRequest)
    {
        xmlHttp = new XMLHttpRequest();        
    }
}

function StartRequest(url, parameter, handler)
{
    createXMLHttpRequest();
    xmlHttp.onreadystatechange = handler;
    xmlHttp.open("GET", url + parameter, true);
    xmlHttp.send(null);   
}

function StartRequestPost(url, data, handler)
{
    createXMLHttpRequest();
    xmlHttp.onreadystatechange = handler;
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.send(data);
}


function handleStateChange(h)
{
    if(xmlHttp.readyState == 4)
    {
        if(xmlHttp.status == 200)
        {
                // TODO : process real login response
                h();
				alert(xmlHttp.responseText);				
				return;
        }
    }
}

