$(function() {
	$('#commentform').submit(function(){
	     var commentStr = $("#commentform textarea").val();
		 var uriStr = $("#commentform").attr("action");
		 
	     $.post("http://www.fairandbare.com/submit/add_comment",  
		   {comment:commentStr, comment_uri:uriStr},
		   function(data) {
		   	 if (data.status == "success") {
			 	$('input#comment_reply').attr('disabled', 'disabled');

			 	$('p.comment_error').remove();
				$('form#commentform textarea').val("");
								
			    var comment_html = '<li id="newcomment" class="comment" style="display: none;">' +
					'<div class="comment_meta">' + $("#subcomment div.comment_meta").html() + "</div>" +
				    '<div class="comment_container">'+
					'<span class="comment_normal">' + $("#subcomment div.comment_meta a:last").html() + " said just now" + '</span>' +
			        '<div class="comment_body"><p>' + commentStr +
			        '</p></div></div><div class="clear"></div></li>';
					
				$('#subcomment').before(comment_html);
				
				$('li.comment:last div.comment_meta em').remove();
				$('li.comment:last div.comment_meta a:last').remove();
				
				$('li.comment:last').fadeIn('slow');
			 	$('input#comment_reply').attr('disabled', '');
			 }
			 else {
			    $('form#commentform textarea').after('<p class="comment_error">' +
			        data.error + '</p>');
			}
		   } , "json");  
		   
	 	 return false; 
	});
});

$(document).ready(function(){

$("a#banner_reveal").click(function () {
      $("div.banner").toggle();
});

});

$(function() {		
  $("#vote_values.notvoted li").click(function(){
	
	  	$('#vote_values li.selected').removeClass('selected');
		$(this).addClass('selected');
		
  		var selectedVal = $(this).text();
	  	$("#vote_value").attr('value', selectedVal);
	});
});

$("div#message").fadeTo("slow",0.33);

$(function () {
    var tabContainers = $('div.profile_tabs > div');
    
    $('div.profile_tabs ul.tab_nav a').click(function () {
        tabContainers.hide().filter(this.hash).show();
        
        $('div.profile_tabs ul.tab_nav a').removeClass('selected');
        $(this).addClass('selected');
        
        return false;
    }).filter(':first').click();
});