function showDetail(id){
	if(id == '') return;
	$('#summarize_' + id ).load('/blog/' + id + '/draft.html');
  $.post("blog/view.php?c=" + id + "&t="+Math.random());
}
function reply(id){
	show = document.getElementById('reply_' + id).style.display;
	if(show == ''){
    document.getElementById('reply_' + id).style.display = 'none';
	}else{
    document.getElementById('reply_' + id).style.display ='';
	}

}
function cancel(id){
	document.getElementById('account_' + id).value='';
  document.getElementById('replyTextarea_' + id).value='';
  document.getElementById('reply_' + id).style.display='none';
}
function postReply(id){
  account = document.getElementById('account_' + id).value;
  content = document.getElementById('replyTextarea_' + id).value;
	if(account ==''){
		alert('請輸入暱稱');
    document.getElementById('account_' + id).focus();
		return;
	}
	if(account.length > 15){
		alert('暱稱不可大於15字');
    document.getElementById('account_' + id).focus();
		return;
	}
  if(content ==''){
		alert('請輸入回應內容');
    document.getElementById('replyTextarea_' + id).focus();
		return;
	}
	if(content.length > 100){
	  alert('回應內容不可大於100字');
    document.getElementById('replyTextarea_' + id).focus();
		return;
	}
	$.post("blog/reply.php", { c: id, a: account , r:content },
		function(data){
     updateReplyCnt(id);
     cancel(id);
     showReply(id);
  });
}
function updateReplyCnt(id){
	if(id == '') return;
	$('#replycnt_' + id ).load('/blog/replycnt.php?t='+Math.random()+'&c='+id);
}
function showReply(id){
	if(id == '') return;
	$('#showReplyContent_' + id ).load('/blog/showReply.php?t='+Math.random()+'&c='+id);
}

function share2fb(path , title){
  window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(path) + '&t=' + title,'','width=700,height=300');
}