function getComments() {
	$.post('http://www.mindmachine.ru/comments/comment.jsp?a=0&r='+document.location,function(data){		
		$(".comments-list").empty();
		$(".comments-list").append(data);		
        });	
}	

$().ready(function() {	
	getComments();		
	$('.ajax').hide();
	$('.ajax').ajaxStart(function() {
		$(this).show();
	}).ajaxStop(function() {
		$(this).hide();
	});
	
	$('#username').focus(function() {
		if (this.value == 'Ваше имя') {$(this).val('');};
	});
	$('#username').blur(function() {
		if (this.value == '') {$(this).val('Ваше имя');}
	});
	$('#useremail').focus(function() {
		if (this.value == 'e-mail') {$(this).val('');};
	});
	$('#useremail').blur(function() {
		if (this.value == '') {$(this).val('e-mail');}
	});
	$('#submit').click(function() {
		$(".msg").empty();
		if($("#username").val()=='Ваше имя') {
			$(".msg").append('Вы не ввели имя');			
			$(".msg").show();
			$('#username').focus();
			return false;			
		}	
		if($("#useremail").val()=='e-mail') $("#useremail").val('');
		
		$("#submit").hide();
		
		var oURL = 'http://www.mindmachine.ru/comments/comment.jsp?a=1&r='+document.location+'&'+$('#post-comment-form').serialize();		
		$.post(oURL,function(data){		
			$(".msg").append(data);
			$(".msg").show();
			$("#submit").show();			
			getComments();
        	});	
        	
		return false;
	});

	
});


