function sendCom( obj ){
	var inputs = obj.parentNode.getElementsByTagName( 'input' );
	var aht = inputs[0];
	var com = inputs[1];
	if( com.value == '' ){
		return false;
	}
	var frm = document.ajf;
	frm.diaryNo.value = obj.parentNode.getAttribute('no');
	frm.comment.value = com.value;
	frm.author.value = aht.value;
	frm.visibility.value = 1;
	frm.method = "POST"
	frm.target = "aji";
	frm.action = './diary' + 'Comme' + 'ntSave.p' + 'hp';
	frm.submit();

	com.value = '';
	aht.value = '';
}

function showCom( obj, event ){
	var comList = obj.getAttribute("comList");
	var flg = obj.getAttribute( 'stat' );
	if( flg == null || flg == undefined ){
		flg = 'false';
	}
	obj.setAttribute( 'stat', ((flg == 'false') ? 'true' : 'false') );
	viewCommentArea( event, obj );
	if( comList ){
		setCom( comList, obj );
	} else {
		ajax( "./getComment.php", "no=" + obj.getAttribute('no'), function( rs ){
			comList = rs.responseText;
			obj.setAttribute( "comList", comList );
			setCom( comList, obj );
		});
	}
}

function viewCommentArea( event, obj ){
	var no = obj.getAttribute( 'no' );
	
	var com = document.getElementById( 'com_' + no );
	
	//alert( obj.getAttribute('no') + 'F' + obj.getAttribute('stat') );

	com.style.visibility = (obj.getAttribute( 'stat' ) == 'true' ? 'visible' : 'hidden');
	com.style.display = (obj.getAttribute( 'stat' ) == 'true' ? 'block' : 'none');
}
function closeCommentArea(){
	var obj = document.getElementById( 'comment' );
	obj.onmouseover();
	obj.style.top = -10000;
	obj.style.left = -10000;
	obj.style.visibility = "hidden";
	document.getElementById( 'commentBody' ).innerHTML = "";
}

function setCom( value, obj ){
	var no = obj.getAttribute( 'no' );
	var com = document.getElementById( 'com_' + no );
	com.innerHTML = value;
}
