function goAjax( location, method, isSilent ) 
{
    location = "r.sh?content=" + location + getRandomQueryString() + sessionString;
    var http_request = false;

    if (window.XMLHttpRequest) { // Mozilla, Safari, ...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
        }
    } else if (window.ActiveXObject) { // IE
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) {
            try {
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
        }
    }

    if (!http_request) {
        if ( !isSilent )
            alert('Giving up :( Cannot create an XMLHTTP instance');
        return false;
    }
    http_request.onreadystatechange = function() { execAjaxMethod( http_request, method, isSilent ); };
    http_request.open('GET', location, true);
    http_request.send(null);
    
    //http_request = null;
}

function execAjaxMethod( http_request, method, isSilent ) 
{
    try {
        if (http_request.readyState == 4) {
            if (http_request.status == 200) 
            {
                var aMeth = new ajaxMethod( method, http_request, isSilent );
                aMeth.execMethod();
                aMeth = null;
            } 
            else if ( !isSilent )
                alert('There was a problem with the AJAX request.');
        }
    }
    catch( e ) {
        if ( !isSilent )
            alert('AJAX Exception: ' + e.description);
    }
}

function ajaxMethod( method, http_request, isSilent )
{
    this.method         = method;
    this.isSilent       = isSilent;
    this.http_request   = http_request;
    this.xmldoc         = http_request.responseXML
    this.execMethod     = function ()
    {
        try {
            var err = this.getNodeValue( 'error' );
            
            if ( err != null )
                alert( err );
            else            
                this.method();
        }
        catch( e ) {
            if ( !this.isSilent )
                alert('Unable to execute ajaxMethod: ' + e.description);
        }
    }
    
    this.getNodeValue = function ( Value )
    {
        try {
            var nodes = this.xmldoc.getElementsByTagName( Value );
            
            if ( nodes.length == 0 )
                return null;
            else
            {
                if ( nodes.item(0).firstChild == null )
                    return "";
                else
                    return nodes.item(0).firstChild.data;
            }
        }
        catch( e ) {
            if ( !this.isSilent )
                alert('Unable to get node value for \'' + Value + '\': ' + e.description);
        }
    }
}