// JavaScript Document

 $(document).ready(function() {
		// for menu items that can't be clicked
		$(".noclick").click(function() {
			return false;
		});
		// plus/minus expansion
		$("a[class^='catslide'], img[class^='catslide']").click(function() {
			var $this = $(this);
			ExpandCat($this);
			return false;
		});
		// show tree for current category
		$('.currentcat').each(function(i) {
			$(this).show(); 
			$(this).parents().show(); 
			$(this).parents().parents().show(); 
			$(this).find('*').show();
		 });
		/*
		// hide trees for hidden categories
		$('.hiddencat').each(function(i) {
			//$(this).hide(); 
		 });
		// then show all non-hidden including trees
		$("li").not(".hiddencat").each(function(i) {
			$(this).show(); 
			$(this).parents().show(); 
			$(this).parents().parents().show(); 
			$(this).parents().parents().parents().show(); 
		 });
		*/
});
 
function ExpandCat($this) 
{
	var x = $this.attr('class').split(' ').slice(0)[0]; 
	$("ul."+x+"child").toggle();
	if($("img."+x+"img").attr("src") == "/images/plus.gif") {
		$("img."+x+"img").attr("src", "/images/minus.gif");
	} else {
		$("img."+x+"img").attr("src", "/images/plus.gif");
	}
}
 
// disable enter causing submit
jQuery(document).ready(function($) {
   textboxes = $("input:text");

   if ($.browser.mozilla) {
      $(textboxes).keypress(checkForEnter);
   } else {
      $(textboxes).keydown(checkForEnter);
   }

   function checkForEnter(event) {
      if (event.keyCode == 13) {
         currentTextboxNumber = textboxes.index(this);

         if (textboxes[currentTextboxNumber + 1] != null) {
           nextTextbox = textboxes[currentTextboxNumber + 1];
           nextTextbox.select();
      }

         event.preventDefault();
         return false;
      }
   }
});
