$(document).ready(function() {
	// DEVELOPMENT JAVASCRIPT BEGINS
	// This is stuff I'm using for development
	// purposes only. It should be eliminated
	// with extreme prejudice before being sent
	// to a production server.

	// Faux log in/out
	var accNav = $("#account-nav");
	var detailUserRat = $("#ratings .user.rate");
	var postCom = $("#post-comment");
	var interact = $(".interact");
	$("#log-in").click(function(){
		accNav.removeClass("non-user");
		accNav.addClass("user");
		detailUserRat.show();
		postCom.show();
		interact.show();
		return false;
	});
	$("#log-out").click (function(){
		accNav.removeClass("user");
		accNav.addClass("non-user");
		detailUserRat.hide();
		postCom.hide();
		interact.hide();
		return false;
	});
	
	// Vote alerts
	$(".up").click(function(){
	  alert("Vote up!");
	});
	$(".down").click(function(){
	  alert("Vote down.");
	});
	// DEVELOPMENT JAVASCRIPT ENDS
	
	// Keep Yo' Pounds Outta Mah URL
  $("a[@href*=#]").click(function(){
   return false;
  });
	
	// Sort Navigation
	var sortHeads = $("#sort-nav ul li h3");
	sortHeads.hover(
	  function(){ // On Mouseover...
	    $(this).addClass("hover")
	  },
	  function(){ // On Mouseout...
	    $(this).removeClass("hover")
	  }
	);
	sortHeads.click(
	  function(){ // On Click...
	    var alreadyActive = $("#sort-nav ul li h3.active")
      $(this).addClass("active");
      $(this).next().slideDown("fast");
	    alreadyActive.removeClass("active");
	    alreadyActive.next().slideUp("fast");
	  }
	);
	
	// Sidebar Navigation
	var sidebarHeads = $("#sidebar .box h3");
	sidebarHeads.click(
	  function(){ // On Click...
	    var alreadyActive = $("#sidebar .box h3.active")
      $(this).addClass("active");
      $(this).next().slideDown("fast");
	    alreadyActive.removeClass("active");
	    alreadyActive.next().slideUp("fast");
	  }
	);
	
	// Show Ratings and Comments
	var buttons = $("a.button");
	buttons.click(
    function(){ // On Click...
      var button = this.id;
      (button.match("rate")) ? toDisplay = "rating" : toDisplay = "post-comment";
      var toDisplayID = button.split("-")[1];
      var showMe = toDisplay + "-" + toDisplayID;
      if ($("#"+showMe).is(":visible")) {
        $(this).removeClass("active");
        $("#"+showMe).slideUp("fast");
      }
      else {
        $(this).addClass("active");
        $("#"+showMe).slideDown("fast");        
      }
	  }
	)
});