// - - - - - - - - - - JavaScript Document - - - - - - - - - - - - 
//
// Plugin Name: Javascript Animated Collapsing Categories Widget for WP2.1.*
// Plugin URI: http://dragonflyeye.net/blog/2007/01/12/javascript-animated-collapsing-categories/
// Description: This Widget creates expanding and collapsing category lists based on hierarchal Category structures.
// Version: 1.4
// Author: Thomas J. Belknap
// Author URI: http://holisticnetworking.net
// Created : 01/12/07
//
//
//    Copyright 2006  Thomas J Belknap  (email : dragonfly at dragonflyeye.net)
//
//    This program is free software; you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation; either version 2 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program; if not, write to the Free Software
//    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


function collapse(elm) {
	var parent = elm.parentNode;
	var focus = parent.getElementsByTagName('ul');
	if (focus[0].style.display == 'none') {
		focus[0].style.display = '';
		elm.src= minusGIF;
	}
	
	else {
		focus[0].style.display = 'none';
		elm.src=plusGIF;
	}
}

function init() {

    // hide all sub-category lists on page load.
//    var col_cats = document.getElementById('top_level');
  //  var col_cats = document.getElementById('categories');
 /*   var sub_cats = col_cats.getElementsByTagName('ul');
    for (var x=0; x<sub_cats.length; x++) {
    	sub_cats[x].style.display='none';
    	var col_nav=sub_cats[x].parentNode.getElementsByTagName('img');
    	col_nav[0].src=plusGIF;
    } */
}

/* Finally, attach functions based on onload event */
function addEvent(elm, evType, fn, useCapture) {
    elm["on"+evType]=fn;return;
}

addEvent(window, "load", init);