function goto(url)
 {
  window.location.href = root+""+url;
 }

function str_replace(search, replace, subject) {
 
    var f = search, r = replace, s = subject;
    var ra = r instanceof Array, sa = s instanceof Array, f = [].concat(f), r = [].concat(r), i = (s = [].concat(s)).length;
 
    while (j = 0, i--) {
        if (s[i]) {
            while (s[i] = (s[i]+'').split(f[j]).join(ra ? r[j] || "" : r[0]), ++j in f){};
        }
    };
 
    return sa ? s : s[0];
}

function create_http_object()
    {
        var ActiveXTypes = [
            "Microsoft.XMLHTTP",
            "MSXML2.XMLHTTP.5.0",
            "MSXML2.XMLHTTP.4.0",
            "MSXML2.XMLHTTP.3.0",
            "MSXML2.XMLHTTP"
        ];

        for( var i = 0; i < ActiveXTypes.length; i++ )
        {
            try
            {
                return new ActiveXObject( ActiveXTypes[i] );
            }
            catch( e )
            { }
        }

        try
        {
            return new XMLHttpRequest();
        }
        catch( e )
        { }

        return false;
    }
    
    
// Request maken
function make_request(url, callback_function, http_method, post_values, return_xml)
    {
        var http = create_http_object();
        

        if(!http)
        {
            alert('Je browser ondersteunt deze feature niet.');
            return false;
        }

        http.onreadystatechange = function()
        {
            if(http.readyState == 4)
            {
            
                if(http.status == 200)
                {
                    if(callback_function)
                    {
                        if(return_xml)
                        {
                            eval(callback_function + '(http.responseXML)');
                        }
                        else
                        {
                            eval(callback_function + '(http.responseText)');
                        }
                    }
                }
                else
                {
                    //alert('Error! (' + http.status + ')');
                }
            }
        }

        if(!post_values)
        {
            post_values = null;
        }
        if(!http_method)
        {
            http_method = "GET";
        }

        http.open(http_method, url, true);

        if(http_method == "POST")
        {
            http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        }
        
        
        
        
        http.send(post_values);
    }


