passing a variable within a document.ready function into inline modal window

passing a variable within a document.ready function into inline modal window

hi

i'm using a jQuery Inline Modal Window. the code for it can be found here 


i currently have an array within a function in javascript. when i click on the appropriate link for the inline modal, the inline modal window appears. 

my function looks something like this

[CODE]

    function match_all_groups(){

    var pop_up_status;
    var match_groups = new Array();
    var match_groups_count = 0;

    $(document).ready(function(){

    for ($i = 0; $i < all_og_count_js; $i++){

    if ($i == 125)
        {
            $i = $i + 1;
        }
    if ($i == 130)
        {
            $i = $i + 1;
        }
    if ($i == 135)
        {
            $i = $i + 1;
        }

    if(($('#edit-title').val().search(all_og_groups_name_js[$i]) != -1) || ($('#edit-body').val().search(all_og_groups_name_js[$i]) != -1)){
    pop_up_status = true;
    break;
    }
    else{
    pop_up_status = false;
    }

    }

    });


    for ($i = 0; $i < all_og_count_js; $i++){

    if ($i == 125)
        {
            $i = $i + 1;
        }
    if ($i == 130)
        {
            $i = $i + 1;
        }
    if ($i == 135)
        {
            $i = $i + 1;
        }

    if(($('#edit-title').val().search(all_og_groups_name_js[$i]) != -1) || ($('#edit-body').val().search(all_og_groups_name_js[$i]) != -1)){
    match_groups[match_groups_count] = all_og_groups_name_js[$i];
    match_groups_count++;
    }

    }


    if (pop_up_status == true){
        $('a.poplight[href^=#]').click(); //please look at the above link to see how this inline modal window works
    }
    else{
        document.getElementById("node-form").submit();
    }

    }

</script>

[/CODE]

i want to receive values from match_groups and display them in my inline modal window. do u know how this can be done?