function ajax_request(passed_url, passed_method, passed_content_id, form_id)
{
    var real_url, real_data, ajax_options, ajax_result, replace_content = null;
    
    //this will display a loading animation where the content will load
    replace_content = $(passed_content_id)
    //replace_content.empty().addClass('ajax_loading');
    
    //we have to stop the form from submitting if form is given
    if($defined(form_id))
    {
        $(form_id).addEvent('submit', function(e)
        {
            new Event(e).stop();
        });
    }
    
    //format all data needed to send ajax request
    if(passed_url.indexOf("?") !== -1)
    {
        real_url = passed_url.split("?")[0];
        real_data = passed_url.split("?")[1];
        
        /*this will overwrite the current passed data with form data is given
        there should not be any pass variables through the url is form is given anyways*/
        if($defined(form_id))
        {
            real_data = $(form_id);
        }
        
        ajax_options = {method: passed_method,
                        update: replace_content,
                        data: real_data,
                        onComplete: function()
                        {
                            replace_content.removeClass('ajax_loading');
                        }};
    }
    else
    {
        real_url = passed_url;
        
        /*this will overwrite the current passed data with form data is given
        there should not be any pass variables through the url is form is given anyways*/
        if($defined(form_id))
        {
            real_data = $(form_id);
        }
        
        ajax_options = {method: passed_method,
                        update: replace_content,
                        data: real_data,
                        onComplete: function()
                        {
                            replace_content.removeClass('ajax-loading');
                        }};
    }
    
    ajax_result = new Ajax(real_url, ajax_options).request();
}
