/*
$Id: func.js,v 1.10 2008/11/06 16:53:56 max Exp $
vim: set ts=2 sw=2 sts=2 et:
*/

//if ($.browser.msie) {
//  $.event.add(
//	  window,
//  	'load',
//	  function() {
//      $('ul.fancycat-icons-level-0 li').hover(fcIconsLIOver, fcIconsLIOut);
//  	}
//  );
//}

function fcIconsLIExpand() {
	
	this.className += " show_menu";

	$root_link=$(this).next();
	if ($(this).parent().parent().parent().hasClass("fancycat-explorer-level-0")) {
		$root_link.css("color","#00A5E7");
	}
	$sub_menu=$(this).parent().next();
    $sub_menu.show();
}

function fcIconsLICollapse() {
	
	this.className = this.className.replace(/ show_menu/, "");

	$root_link=$(this).next();
	if ($(this).parent().parent().parent().hasClass("fancycat-explorer-level-0")) {
		$root_link.css("color","");
	}

	$sub_menu=$(this).parent().next();
    $sub_menu.hide();
}

$.event.add(
  window,
'load',
	function() {
		$('ul.fancycat-explorer-level-0 li').each(function(){
				if (!$(this).hasClass("expanded")) {
					if ($("#"+this.id+" > ul").length > 0) {
						$("#"+this.id+" > ul").hide();
						$("#"+this.id+" > a span.im").toggle(fcIconsLIExpand, fcIconsLICollapse);
					}
				} else {
					if ($("#"+this.id+" > ul").length > 0) {
						$("#"+this.id+" > a span.im").addClass("show_menu");
						$("#"+this.id+" > a span.im").toggle(fcIconsLICollapse, fcIconsLIExpand);
					}
				}
			}
		);
	}
);

