/*
    Written by Kei Yuen, Chan


    Tested on windows xp
        IE 6.x
        Netscape 8.x
        Firefox 1.x
        Opera 8.x

*/


// called when a topic is clicked
function OnTopicClick( id ) {
    var content = document.getElementById("topic_content_" + id);
    var img = document.getElementById("topic_img_" + id);

    if ( content.style.display == "none" ) {
        content.style.display = "";
        img.src = "./images/minus.png";
    } else {
        content.style.display = "none";
        img.src = "./images/plus.png";
    }

}

// called when a category is clicked
function OnCategoryClick( cat_id, topic_id ) {

    var content = document.getElementById("category_content_" + cat_id + "_" + topic_id );
    var img = document.getElementById("category_img_" + cat_id + "_" + topic_id );

    if ( content.style.display == "none" ) {
        content.style.display = "";
        img.src = "./images/minus.png";
    } else {
        content.style.display = "none";
        img.src = "./images/plus.png";
    }

}


// to expand a topic
function expandTopic( id ) {
    OnTopicClick( id );
}


// to expand a category
function expandCategory( cat_id, topic_id ) {
    OnCategoryClick( cat_id, topic_id );
}

// hide a topic
//
// rarely used
//
function hideTopic( id ) {
    var content = document.getElementById("topic_" + id);

	if (content) content.style.display = "none";
}

// show a topic
//
// rarely used
//
function showTopic( id ) {
    var content = document.getElementById("topic_" + id);
	if (content) {

		content.style.display = "";
	}
}
