$(document).ready(function(){
	
	// style the code samples...
	$("pre.css").snippet("css",{style:"acid"});
	$("pre.javascript").snippet("javascript",{style:"acid"});
	$("pre.xml").snippet("xml",{style:"acid"});
	$("pre.asp").snippet("asp",{style:"acid"});
	
	$(".docs-pagenav-group").click(function(){
		//console.log("toggling")
		// toggle the items underneath
		$(this).find("ul").slideToggle("fast");
		if ( typeof localStorage != "undefined" ){
			//console.log($(this).attr("id"));
			localStorage.setItem("docsMenuSelected",$(this).attr("id"))
		}
	});
	
	if ( typeof localStorage != "undefined" && typeof localStorage.getItem("docsMenuSelected") !== null ) {
		// restore the selected one
		var selected = localStorage.getItem("docsMenuSelected");
		//console.log("restoring to...",selected)
		$("#"+selected).find("ul").show();
	}
	
	
	// make collapsable sections of content collapsable...
	$(".collapsable").prepend("<span class='control clearfix collapse'></span>");
	$(".collapsable").click(function() {
		$(this).next(".content-group").slideToggle("fast");
		$(this).find(".control").toggleClass("collapse");
		$(this).find(".control").toggleClass("expand");
	});
	
	// sticky the nav to the top...
	/*console.log("here?")
	$.waypoints.settings.scrollThrottle = 30;
	$('#docs-pagenav').waypoint(function(event, direction) {
		console.log("doing something...")
		$(this).parent().toggleClass('sticky', direction === "down");
		event.stopPropagation();
	});*/

	
	
});

