function show_cat_box(box_id,this_counter,forum_dir) {

    box_div     = document.getElementById("cat_box_"+box_id);
    img_div     = document.getElementById('arrow_cat_box_'+box_id);

    this_counter++;

    var this_box_id = box_id;
    

    if (this_counter > 2 && this_counter <= 9) {
        img_div.src = forum_dir+"/images/arrow"+(this_counter-2)+".gif";
    }
    
    
    var this_color = 'ffffff';

    if (this_counter >= 9 && this_counter <= 15) {
        
        if (this_counter == 9) {
            this_color = 'eeeeee';
        } else if (this_counter == 10) {
            this_color = 'dddddd';
        } else if (this_counter == 11) {
            this_color = 'cccccc';
        } else if (this_counter == 12) {
            this_color = 'bbbbbb';
        } else if (this_counter == 13) {
            this_color = 'aaaaaa';
        } else if (this_counter == 14) {
            this_color = '999999';
        } else if (this_counter == 15) {
            this_color = '888888';
        }

        box_div.innerHTML = "<br><p class='f_14' style='color: #"+this_color+"; margin-left: 2px'>loading...</p>";
        
    }

    if (box_div.style.display == "none") {
        box_div.style.display = "block";
    } else if (this_counter == 2) {
        box_div.innerHTML = "";
        img_div.src = forum_dir+"/images/arrow1.gif";
        box_div.style.display = "none";
        this_counter = 200;
    }
    
    box_div.style.height = (Math.round(this_counter*4.2)+9)+"px";
    
    if (this_counter <= 26) {
        setTimeout("show_cat_box('"+this_box_id+"',"+this_counter+",'"+forum_dir+"')",16);
    }
    
    if (this_counter == 26) {
        show_cat_box_contents(box_id,forum_dir);
    }

}







function show_cat_box_contents(cat_id,forum_dir) {
    
    try {
        xmlhttp = window.XMLHttpRequest?new XMLHttpRequest(): new ActiveXObject("Microsoft.XMLHTTP");
    }
    
    catch (e) {
        alert('Your browser does not support features that are required for editing forums. Please use a different browser such as Firefox or Safari.');
    }
    
    xmlhttp.onreadystatechange = function triggered() {
        if ((xmlhttp.readyState == 4) && (xmlhttp.status == 200)) {
            var box_div     = document.getElementById("cat_box_"+cat_id);
            box_div.style.height    = null;
            box_div.innerHTML       = xmlhttp.responseText;
        }
    }

    xmlhttp.open("GET", forum_dir+"/includes/category_handler.php?cat_id="+cat_id);
    //xmlhttp.open("GET", "/dude/includes/category_handler.php?cat_id="+cat_id);
    xmlhttp.send(null);

}




function switch_reply_id(reply_value) {

    reply_div       = document.getElementById('forum_comment_reply_box');
    reply_field     = document.getElementById('reply_id');

    if (reply_value) {
        reply_div.style.display = "block";
    } else {
        reply_div.style.display = "none";
    }
    
    reply_field.value = reply_value;
    
}



function comment_edit_view(div_id) {

    var display_div     = document.getElementById('comment_display_'+div_id);
    var edit_div        = document.getElementById('comment_edit_'+div_id);
    
    if (display_div.style.display == "block") {
        display_div.style.display = "none";
        edit_div.style.display = "block";
    } else {
        display_div.style.display = "block";
        edit_div.style.display = "none";
    }

}

