﻿openFlag=0;
function formAssist(startTag,endTag,str,formId){
	var target = document.getElementById(formId);
	target.focus();
	if (document.selection != null){
		var sSel = document.selection.createRange().text;
		if (sSel) {
			document.selection.createRange().text = startTag + sSel + endTag;
		}else{
			document.selection.createRange().text = startTag + str + endTag;
		}
	}else if(target.selectionStart || target.selectionStart == '0'){
		var s = target.selectionStart;
		var e = target.selectionEnd;
		var str2 = target.value.substring(s,e);
		if(str2){
			target.value = target.value.substring(0,s) + startTag + str2 + endTag + target.value.substring(e,target.value.length);
		}else{
			target.value = target.value.substring(0,s) + startTag + str + endTag + target.value.substring(e,target.value.length);
			target.focus();
		}
	}else{
		target.value += startTag + str + endTag;
	}
	return;
}
function prepareFormAssist(startTag,endTag,str,formId){
	document.getElementById('sizeSelectDiv').style.display='none';
	document.getElementById('colorSelectDiv').style.display='none';
	document.getElementById('emoziSelectDiv').style.display='none';
	openFlag=0;
	formAssist(startTag,endTag,str,formId);
}
function hideDiv(divId){
	if(openFlag==0){
		document.getElementById(divId).style.display='none';
	}
}
function closeDiv(divId){
	document.getElementById(divId).style.display='none';
	openFlag=0;
}
function openDiv(divId){
	openFlag=1;
	document.getElementById('sizeSelectDiv').style.display='none';
	document.getElementById('colorSelectDiv').style.display='none';
	document.getElementById('emoziSelectDiv').style.display='none';
	document.getElementById(divId).style.display='block';
}
function checkTextColor(selectColor){
	document.getElementById('checkTextBox').innerHTML="ここで文字の色を確認 " + selectColor;
	document.getElementById('checkTextBox').style.color=selectColor;
}

