[jQuery] Recursion Issues with jQuery

[jQuery] Recursion Issues with jQuery


Hello,
I am not sure if my previous post was really posted.I couldn't see it
here even after about an half an hour since I posted.
I am trying to get a feature accomplished and Recursion seems to me
like the most obvious solution. I have written some functions designed
for the same. These functions call each other and themselves at
depending on the situation. Here are they:
Search.method (
    'process_search_node',
    function (context, string, status) {
     var me=this;
     alert('preocess_search_node called!');
     var lstring = string;
     if(status != 'break') {
/***** Process Child *****/
/***** Child does not exist *****/
if(!me.process_child_for_search_node(context, string)) {
lstring += ' ( Q )';
me.process_sibling_for_search_node(context, lstring);
}
/***** Child Exists *****/
else {
lstring += ' (';
me.process_search_node(context, lstring, '');
}
}
else {
alert(lstring); /*************** I need all the calls to
stop the first time it reaches here and return the value of lstring to
the "test" variable (See below where the function
'process_search_node' is triggered) ***************/
return false;
}
}
);
Search.method (
    'process_child_for_search_node',
    function (context, string) {
     var me=this;
     alert('process_child_for_search_node called!');
     /***** If it has an immediate Child Search Panel *****/
     var immediate_child = context.children(':nth-
child(2)').children(':nth-child(1)').children(':nth-child(1)');
     if(immediate_child.hasClass('query_stage_wrapper')) {
     var lstring = string + ' (';
     me.process_search_node(immediate_child, lstring, '');
     }
     else
     return false;
    }
);
Search.method (
    'process_sibling_for_search_node',
    function (context, string) {
    var me=this;
    alert('process_sibling_for_search_node called!');
    /***** If it has a Sibling Search Panel *****/
    var sibling = context.next(':first');
    if(sibling.hasClass('query_stage_wrapper')) {
var lstring = string;
me.process_search_node(sibling, lstring, '');
}
else {
if(me.get_parent_search_panel(context)) {
var lstring = string + ' )';
me.process_sibling_for_search_node(me.get_parent_search_panel(context),
lstring);
}
else {
var lstring = string;
if(!me.process_search_node(context, lstring,
'break'));
alert('returned false');
}
}
}
);
The call the triggers the above set of functions is:
var test = me.process_search_node($('div.query_stage_wrapper:first'),
string, '');
I would be very grateful to you if you could point me out the place
where I am going wrong.
Thanks for reading my post.