var bigbox = 'closed';
	var currentid = '';
	

	function showfaq(id)
	{
		if (bigbox == 'closed')
		{
			currentid = id;
			var x = $("#logo div").position()["left"] + 263;
			var y = 120;
			$("#bigbox").css({"left":x,"top":y});
			
			$("#bigboxbody").html("<div id='boxloading'><img src='/images/ajax/loading.gif' alt='' /></div>");
			$("#bigbox").slideDown("fast",function() {
				$.ajax({
					type: "POST",
					url: "/ajax/getfaq.php",
					data: "action=single&id="+id,
					success: function(resp)
					{
						var str = resp.split("|");
						bigbox = "open";
						$("#bigboxbody").html(str[0]);
						$("#printbox").html(str[1]);
					}
				});
			});
		}
		else 
		{
			$("#bigbox").slideUp("normal",null);
			bigbox = "closed";
		}
		
	}
	
	
	
	
	var maxitems = 0;
	function faqsearch()
	{
		$("#subtext").addClass("hidden");
		var strkey = $("#faqsearch").val();
		$("#results").stop().scrollTo( 0, 800 );
		$("#searchresults").slideUp("fast",function() {
			$("#faqsearch").fadeTo("100","0.5");
			$("#sbutton").css({"display":"none"});
			$("#sloading").html("searching...");
			$.ajax({
				type: "POST",
				url : "/ajax/getfaq.php",
				data: "action=search&key="+strkey,
				success: function(resp)
				{
					$("#sbutton").css({"display":"inline"});
					$("#sloading").html("");
					$("#faqsearch").fadeTo("300","1");
					curscroll = 0;
					var str = resp.split("|");
					maxitems = str[0];
					if (maxitems > 7) 
					{
						$("#scrollit").css({"display":"block"});
						$("#scrolldown a").removeClass("nosendit").addClass("sendit");
						$("#fcount").html(maxitems + " results found");
					}
					else 
					{
						$("#scrollit").css({"display":"none"});
						$("#fcount").html("");
					}
					
					$("#scrolltop a,#scrollup a").removeClass("sendit").addClass("nosendit");
					
					$("#results").html(str[1]);
					$("#searchresults").slideDown("normal",null);
					
				}
			});
		});
	}
	
	var curscroll = 0;
		
	function scrolldiv(direction)
	{
		
		var upclass = $("#scrollup a").attr("class");
		var downclass = $("#scrolldown a").attr("class");
		var topclass = $("#scrolltop a").attr("class");
		
		
		if (direction == 'up' && upclass == 'sendit') curscroll=curscroll-7;
		else if (direction == 'down' && downclass == 'sendit') curscroll=curscroll+7;
		else if (direction == 'top' && topclass == 'sendit') curscroll = 0;
		else return false;
		if (curscroll < 0) curscroll = 0;
		if (curscroll > maxitems) curscroll = maxitems;
		
		if (curscroll == 0) $("#scrolltop a,#scrollup a").removeClass("sendit").addClass("nosendit");
		else $("#scrolltop a,#scrollup a").removeClass("nosendit").addClass("sendit");
		
		if (maxitems - curscroll <= 7) $("#scrolldown a").removeClass("sendit").addClass("nosendit");
		else $("#scrolldown a").removeClass("nosendit").addClass("sendit");

		$("#results").stop().scrollTo( $('#results .hoverselect:eq('+curscroll+')'), 800 );
	}