function addFavorite()
{
	if( confirm( "Would you like to add this Journal to your favorite Journal?" ) )
	{
		addFavForm.submit();
	}
}

function strLengthByte(str)
{
	var totLength = 0;
	for (var i=0;i<str.length;i++)
		totLength += strCharByte(escape(str.charAt(i)));
	return totLength;
}

function strCharByte(chStr) {
	if (chStr.substring(0, 2) == '%u')
	{
		if (chStr.substring(2,4) == '00')
			return 1;
		else
			return 2;
	}
	else if (chStr.substring(0,1) == '%')
	{
		if (parseInt(chStr.substring(1,3), 16) > 127)
			return 2;
		else
			return 1;
	}
	else
		return 1;
}

function checkValue() {

	if (commentForm.comment.value=="") {
		alert("Message is needed");
		commentForm.comment.focus();
		return false;
	}
	if (strLengthByte(commentForm.comment.value)>100) {
		alert("No more than 100 characters are allowed");
		commentForm.comment.focus();
		return false;
	}
	return true;		
}

function submitCmt()
{
	if( checkValue() )
		commentForm.submit();
}

function deleteCmt(cmtIdx)
{
	if( confirm( "Would you like to erase this?" ) )
	{
		cmtDelForm.cmtNu.value = cmtIdx
		cmtDelForm.submit();
	}
}

function blockUser( blockId )
{
	if( confirm( "Would you like to block '" + blockId + "'?" ) )
	{
		cmtBlockForm.blockId.value = blockId;
		cmtBlockForm.submit();
	}
}

function recommend( aId )
{
	if( confirm( "Would you like to recommend this album?") )
	{
		addRecommendForm.submit();
	}
}

