var currFunction = "";
var CC_xmlhttp   = null;

function getXmlHTTP()
{
    var oXmlHttp = null;

/*@cc_on @*/
/*@if (@_jscript_version >= 5)
    try
    {
        oXmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
        try
        {
            oXmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (E)
        {
            oXmlHttp = null;
        }
    }
@end @*/

    if (!oXmlHttp && typeof(XMLHttpRequest) != 'undefined')
    {
            try 
            {
                    oXmlHttp = new XMLHttpRequest();
            } 
            catch (e) 
            {
                    oXmlHttp = false;
            }
    }

    if (!oXmlHttp && window.createRequest)
    {
            try 
            {
                    oXmlHttp = window.createRequest();
            } 
            catch (e) 
            {
                    oXmlHttp = false;
            }
    }

    return oXmlHttp;
}
  
function startAjax(sUrl)
{
        CC_xmlhttp = getXmlHTTP();

        CC_xmlhttp.open("GET", sUrl);
        CC_xmlhttp.onreadystatechange = responseHandler;
        CC_xmlhttp.send("");
}

function responseHandler()
{
                if (CC_xmlhttp.readyState == 4)
                {
                        if (CC_xmlhttp.status == 200)
                        {
                                switch(currFunction)
                                {
                                        case "getMealPlanDescrHandler":
                                        {
                                                getMealPlanDescrHandler(CC_xmlhttp.responseText);
                                                break;
										}                                                
                                        case "getRemoteSearchDataHandler":
                                        {
												remoteSearchDataHandler(CC_xmlhttp.responseText);
                                                break;
                                        }
                                }
                        }
                        else
                        {
                                alert(CC_xmlhttp.statusText);
                        }
                }
};