$(document).ready(function(){

$('#dialog').dialog({
autoOpen: false,
width: 600,

    buttons: {

"Cancel": function() {
$(this).dialog("close");
},

    "Ok": function() { 

	var time=new Date();
	var date=time.getDate();
	var year=time.getYear();
	
	if (year < 2000) year = year + 1900;
	
	$("#current_comment").append(
	'<div class="thiscomment"><small>' + date + ' / ' + time.getMonth() + ' / ' + year + 
	'</small><br><strong>' + $("#guest").val() + '</strong><br>' + $("#gcomment").val() + '</div>' )
	$.post ("/blog/addcomment", { 'res[]':[$("#guest").val(),$("#gcomment").val(),$("#postid").val()]});
	$(this).dialog("close"); 
	$("#current_comment > div").each(function(i) { if(i % 2 == 0) $(this).addClass("color"); });
	}
	
}
});

$('#comment_link').click(function(){ $('#dialog').dialog('open'); return false; });


$(function() { $("#PostTabs").tabs(); });
$(function() { $(".BlogPostTabs").tabs(); });
});
