function check_status (obj)
{
	if ($(obj).next().is(":hidden")) {
		return "hidden";
	} else {
		return "shown";
	}
}
function set_on (obj)
{
	var item = $(obj).find("a");
	var image = "/gfx/site/gui/drop-icon-down-on-black.png";
	$(item).css({'cursor' : 'pointer'});
	$(item).css({"background-image" : "url('"+image+"')","background-repeat" : "no-repeat"});
}
function set_off (obj)
{
	var item = $(obj).find("a");
	var image = "/gfx/site/gui/drop-icon-down-off-black.png";
	$(item).css({"background-image" : "url('"+image+"')","background-repeat" : "no-repeat"});
}
$(document).ready ( function () {
	/* Software */
	$('.software-folder-header').each ( function () {
		$(this).hover(
			function() {
				myparent = this;
				status = check_status(myparent);
				//alert("status:"+status);
				if (status == 'hidden') {
					set_on(myparent);
				}
			},
			function() {
				myparent = this;
				status = check_status(myparent);
				if (status == 'hidden') {
					set_off(myparent);
				}
			}
		);
		$(this).click ( function () {
			myparent = this;
			if ($(this).next().is(":hidden")) {
				$(this).next().slideDown("slow",set_on(myparent));
			} else {
				$(this).next().slideUp("slow",set_off(myparent));
			}
		});
	});
	$('.software-toggle-notes').each ( function () {
		$(this).click ( function () {
			target = $(this).attr("rel");
			target = "#"+target;
			if ($(target).is(":hidden")) {
				$(target).slideDown("slow");
			} else {
				$(target).slideUp("slow");
			}
		});
	});
});
