function toggleVisible(id)
{
	var obj=$("#"+id);
	if(obj.length>0)
	{
		var aa = obj.parents(".answerable").find(".all_answers");
		if(obj.attr("clicked")!="1"||aa.length==0)
			obj.slideToggle("slow").attr("clicked","1").parents(".answerable").find(".more").slideUp(400,function(){$(this).remove();});
		else if(!obj.is(":visible"))
		{
			if(aa.is(":visible"))
				obj.slideToggle("slow");
			else
				aa.slideToggle("slow",function(){if(!aa.is(":visible"))obj.show();});
		} else
			aa.slideToggle("slow");
		return false;
	}
}
function onload()
{
	if($("html").hasClass(getBrowser())) return;
	$("html").addClass(getBrowser());
	// Handle Left Nav ROs
	$(".answerable").find(".questiontitle:first A").unbind().click(function(){
		$(this).toggleClass("minus").toggleClass("plus");
		/*$(this).parents(".answerable")
			.find(".moreanswers:first").toggle().end()
			.find(".selected .minus").filter(function(){return $(this).parent().parent().find("div").length==0}).removeClass("minus").addClass("plus");
			return false;
			*/
		}); //.each(function(i){if(i==0) $(this).removeClass("plus").addClass("minus");else $(this).removeClass("minus").addClass("plus");});
	$(".selected>A,A.selected")
		.each(function(){if($(this).parent().parent().find(".selected>div").length>0)$(this).addClass("minus").removeClass("plus")})
		.unbind().click(function(){if($(this).parent().parent().find(".selected > div").toggle().length>0){$(this).toggleClass("minus").toggleClass("plus");return false;}});
	$(".answerable:not(:first) .selected > div").show().each(function(){$(this).parents(".answerable").find(".plus").removeClass("plus").addClass("minus");});
	//$(".questiontitle A:first").addClass("minus").click(function(){debugPrint("first");$(this).toggleClass("minus").toggleClass("plus");return false;});
	//$(".refinement").find("div:last").parent().css({backgroundColor:"black"});
	// Handle Search Path
	$(".SPOthers").parents(".searchPathItem")
		.addClass("hoverable")
		.unbind().click(function(){var mySPO=$(".SPOthers",this);$(".SPOthers").filter(function(){return this!=mySPO[0]}).hide();mySPO.toggle();debugPrint("Clicked");return false;})
		.find("ul li a").click(function(){var href=$(this).attr("href");window.location=href;}).end()
		.hover(function(){if(othersTO!=null){var myspo=$(this).find(".SPOthers");$(".SPOthers").filter(function(){return this!=myspo[0];}).hide();myspo.show();clearTimeout(othersTO);othersTO=null;}$(this).addClass("hovering");},function(){$(this).removeClass("hovering");if($(".SPOthers:visible").length>0)othersTO=setTimeout(hideAllOthers, 500);});
	$(".SPOthers").each(function(){var spa=$(this).prevAll(".SPAnswer");if(spa==undefined)return;$(this).css({width:spa.parent().width()+8>$(this).width()?spa.parent().width()+8:$(this).width(),left:spa.position().left-5,top:spa.position().top+spa.height()+2});});
	//$("#celLeftNav .refinement").find(".answers:last").css({backgroundImage:"url(../images/pixel.gif)"});
	//alert($("#celLeftNav .selected .selected").parents("#celLeftNav .selected").length);
	//$("A").click(function(){debugPrint(getClassPath(this));});
	
	$("a.moreLink").click(function(){var me=this;var box=$(this).parents(".refinement").find(".moreBox");box.slideToggle("fast",function(){$(me).html(box.is(":visible")?"Less ...":"More ...");});return false;});
	$(".refinement").each(function(){
		var ans=$(this).find(".all_answers");
		var ttl=$("h2",this);
		ttl.wrapInner('<span class="less" />');
		var opts=["less","more"];
		var check_answers = function(){var oi=ans.is(":visible")?0:1;ttl.find("."+opts[1-oi]).addClass(opts[oi]).removeClass(opts[1-oi]);};
		check_answers();
		ttl.click(function(){ans.slideToggle("fast",check_answers);});
	});
}
function getBrowser()
{
	for(var b in $.browser)
		if($.browser[b]===true)
			return b;
	return "other";
}
if(window.jQuery)
{
	$.fn.extend({setStatus:function(txt){$.each(function(){$(this).hover(function(){window.status=txt;},function(){window.status=window.defaultStatus;});});return this;}});
	$(onload);
} else alert('no jquery');

