

function show_hide_subcat_div(subcat_id)
{
// Function amended to now check the correct check box
// Glen - 10/07/09
 
    var parent = document.getElementById('subcategory_content');
    if (parent)
    {

    // Generate an array of inputs
    var lst = document.getElementsByTagName('input');
   // Loop the array to find all of the check boxes with values
   // equal to the Select list selected value
    for (var cnt = 0; cnt < lst.length; cnt++){
   // if we have a match then check the first instance (top level category)
        if (lst[cnt].value == subcat_id) {
                lst[cnt].checked = true;}
    }
   // Show hide code for check box options
        var children = parent.getElementsByTagName('div');
        for (var i = 0; i < children.length; i++)
        {
            if (children[i].id == 'subcat_'+subcat_id)
                children[i].style.display="block";
            else
                 children[i].style.display="none";
        }
    }
}