//window.onload = function() {
//	document.all.firstfocus.focus();
//}

function setFocus(e)
{
//	document.all.firstfocus.focus();	//IE風
	if(document.getElementsByTagName("*").firstfocus)
	{
		document.getElementsByTagName("*").firstfocus.focus();
	}
}

//初期値をクリア
function clearTextArea(targetElement)
{
	if(targetElement.value == targetElement.defaultValue){
		targetElement.value = "";
	}
}
//文字列を追加
function addTextArea(targetElement, addstr)
{
	var objid=document.getElementById(targetElement);
	if((objid.value.indexOf(addstr, 0)) == -1)
	{
		var cursor_pos = objid.selectionStart;
		if((cursor_pos == null) || (cursor_pos == 0))
		{
			//カーソル位置取れない時は単に後ろに追加（複雑処理必要なので…）
			objid.value = objid.value + "\n" + addstr + "\n";
		}
		else
		{
			var text_length = objid.value.length;
			var before_text = objid.value.substr(0, cursor_pos);
			var after_text = objid.value.substr(cursor_pos, text_length);
			objid.value = before_text + "\n" + addstr + "\n" + after_text;
		}
	}
}
