$(document).ready(function(){
			$("input.comment-submit").click(function (){
				if ($(this).prev('textarea').attr('value') != '') {
					
                    //$.post($(this).parent('form').attr("action"), $(this).parent('form').children('input, textarea').serialize(), function(data){ $(".comments-list").prepend(data); $(".comments-list div.comment:first a.reply").hide(); })
                    var r = $.ajax({
                        dataType : 'html',
                        type : 'POST',
                        url : $(this).parent('form').attr("action"),
                        datatype : 'html',
                        data : $(this).parent('form').children('input, textarea').serialize(),
                        async: false
                    }).responseText;
                
                    $(this).parent('form').next('div.comments-list').prepend(r);
					$(this).prev('textarea').attr('value', '');
				}
				return false;	
			})	
		});
		
		$(document).ready(function(){
			$('textarea.comment').focus(function(){
				if ($(this).attr('value', 'Type your comment here ...')) {
					$(this).attr('value', '');
				}
			});
		});
		
        $(document).ready(function(){
            $("div#wall form.comment-form").hide();
            $("div#wall form.comment-form").before('<a href="#" class="show-form">Comment</a>');
            $('a.show-form').toggle(function(){
                $(this).next('form.comment-form').show();
            }, function (){
                $(this).next('form.comment-form').hide();
            })
        });
		
		$(document).ready(function(event){
			submitComment();
			setReplyComment();
		});
		
		function submitComment(){
				$("input.in_comment_submit").click(function (){
                	var i = $.ajax({
                        dataType : 'html',
                        type : 'POST',
                        url : $(this).parent('form').attr("action"),
                        datatype : 'html',
                        data : $(this).parent('form').children('input, textarea').serialize(),
                        async: false
                }).responseText;
                $(this).parent('form').next('.in_comments_list').prepend(i);
                $(this).parent('form').children('a.reply').hide();
                $(this).prev('textarea').attr('value', '');
                $('form.in_comment_form').hide();
                $('a.reply').html('Reply');
                return false;
			});
		}
		
		function setReplyComment(){
			$("a.reply").toggle(function(){
				$('a.reply').html('Reply'); 
				$(this).html('Don\'t reply');
				$('form.in_comment_form').hide();
				$(this).parent('p').next('form.in_comment_form').show();	
			
			}, function(){
				$(this).html('Reply');
				$(this).parent('p').next('form.in_comment_form').hide();	
			});
		}
