function inputCheckVer2(){
	idNameArray=idNames.split("/");
	maxInputValueArray=maxInputValue.split("/");
	nullCheckArray=nullCheck.split("/");
	countIdNameArray=idNameArray.length;
	for (j=0; j<countIdNameArray;j++){
		countInputValue=0;
		inputValue=0;
		inputValue=document.getElementById(idNameArray[j]).value;
		for (i=0; i<inputValue.length; i++){
			n = escape(inputValue.charAt(i));
			if (n.length < 4){
				countInputValue++;
			}else{
				countInputValue+=2;
			}
		}
		if(nullCheckArray[j]==1){
			if(maxInputValueArray[j]>countInputValue>0){
				document.getElementById(idNameArray[j] + "Judge").style.color="green";
				document.getElementById(idNameArray[j] + "Judge").innerHTML="OK";
			}
			if(countInputValue==0){
				document.getElementById(idNameArray[j] + "Judge").style.color="red";
				document.getElementById(idNameArray[j] + "Judge").innerHTML="入力して下さい";
			}
		}else{
			if(maxInputValueArray[j]>=countInputValue){
				document.getElementById(idNameArray[j] + "Judge").style.color="green";
				document.getElementById(idNameArray[j] + "Judge").innerHTML="OK";
			}
		}
		if(countInputValue>maxInputValueArray[j]){
			document.getElementById(idNameArray[j] + "Judge").style.color="red";
			document.getElementById(idNameArray[j] + "Judge").innerHTML="文字数多すぎ！";
		}
	}
}
function inputTrigger(inputId,maxInput,doNullCheck,preloadImages){
	preloadImagesArray=preloadImages.split("/");
	countPreloadImagesArray=preloadImagesArray.length;
	var imgObj = new Array(countPreloadImagesArray);
	for (i=0; i<countPreloadImagesArray;i++){
		imgObj[i]=new Image();
		imgObj[i].src = "/images/" + preloadImagesArray[i];
	}
	idNames=inputId;
	maxInputValue=maxInput;
	nullCheck=doNullCheck;
	if (!document.all){
		window.document.captureEvents(Event.KEYDOWN);
	}
	if(inputId != ""){
		window.document.onkeydown = inputCheckVer2;
		window.document.onclick = inputCheckVer2;
	}
}
var submitFlag1=0;
function indicatorDivBlock1(){
	document.getElementById('indicator1').style.display='block';
	if(submitFlag1==0){
		submitFlag1=1;
		document.Form1.submit();
	}
}
var submitFlag2=0;
function indicatorDivBlock2(){
	document.getElementById('indicator2').style.display='block';
	if(submitFlag2==0){
		submitFlag2=1;
		document.Form2.submit();
	}
}
function countBlogAccess(userId){
	var output = "<img src='/ajax/counter.cgi?userId=" + userId + "' />";
	document.write(output);
}

function commentWinDisp(oj){
	var res  =  oj.responseText;
	document.getElementById("comments").innerHTML=res;
}
function dispComments(blogId, commentPageNum){
	document.getElementById("comments").innerHTML="<div style='text-align:center;padding: 5px 0 0 0 '><img src='/images/indicator.gif' /><br />now loading</div>";
	document.getElementById("comments").style.display='block';
	document.getElementById("trackback").style.display='none';
	d=[];
	d['userId']= blogId;
	d['pageNo']= commentPageNum;
	sendRequest(
		commentWinDisp,
		d,
		'GET',
		'/comment/display.cgi',
		true,
		true
	)
}
function commentDel(blogId,commentPageNum){
	commentPassword=document.getElementById("commentPasswordValue").value;
	delNum=document.getElementById("del").value;
	if(delNum){
		document.getElementById("comments").innerHTML="<div style='text-align:center;padding: 5px 0 0 0 '><img src='/images/indicator.gif' /><br />now loading</div>";
		d=[];
		d['commentPassword']= commentPassword;
		d['del']=delNum;
		d['userId']=blogId;
		d['pageNo']=commentPageNum;
		sendRequest(
			commentWinDisp,
			d,
			'GET',
			'/comment/display.cgi',
			true,
			true
		)
	}
}
function commentInput(blogId){
	commentInputName=document.getElementById("commentInputNameValue").value;
	commentInputMessage=document.getElementById("message").value;
	commentInputPass=document.getElementById("commentInputPassValue").value;
	document.getElementById("comments").innerHTML="<div style='text-align:center;padding: 5px 0 0 0 '><img src='/images/indicator.gif' /><br />now loading</div>";
	d=[];
	d['userId']= blogId;
	d['commentInputName']=commentInputName;
	d['message']=commentInputMessage;
	d['commentInputPass']=commentInputPass;
	sendRequest(
		commentWinDisp,
		d,
		'GET',
		'/comment/input.cgi',
		true,
		true
	)
}

function trackbackWinDisp(oj){
	var res  =  oj.responseText;
	document.getElementById("trackback").innerHTML=res;
}

function dispTrackback(blogId, trackbackPageNum){
	document.getElementById("trackback").innerHTML="<div style='text-align:center;padding: 5px 0 0 0 '><img src='/images/indicator.gif' /><br />now loading</div>";
	document.getElementById("trackback").style.display='block';
	document.getElementById("comments").style.display='none';
	d=[];
	d['userId']= blogId;
	d['pageNo']= trackbackPageNum;
	sendRequest(
		trackbackWinDisp,
		d,
		'GET',
		'/trackback/display.cgi',
		true,
		true
	)
}


function trackbackDel(blogId,trackbackPageNum){
	trackbackPassword=document.getElementById("trackbackPasswordValue").value;
	delNum=document.getElementById("trackbackDel").value;
	if(delNum){
		document.getElementById("trackback").innerHTML="<div style='text-align:center;padding: 5px 0 0 0 '><img src='/images/indicator.gif' /><br />now loading</div>";
		d=[];
		d['trackbackPassword']= trackbackPassword;
		d['del']=delNum;
		d['userId']=blogId;
		d['pageNo']=trackbackPageNum;
		sendRequest(
			trackbackWinDisp,
			d,
			'GET',
			'/trackback/display.cgi',
			true,
			true
		)
	}
}

function closeDiv(divID){
	document.getElementById(divID).style.display='none';
	openFlag="";
}
function openDiv(divID){
	document.getElementById(divID).style.display='block';
	openFlag=divID;
}

function displayDiv(divID){
	document.getElementById(divID).style.display='block';
	clearTimeout(hintTimer);
}
function hideDivCommand(divID){
	document.getElementById(divID).style.display='none';
}
function hideDiv(divID){
	if(openFlag!=divID){
		hintTimer = setTimeout("hideDivCommand("+"'"+divID+"'"+")", 500);
	}
}

function checkTextColor(selectColor){
	document.getElementById('checkTextBox').innerHTML="ここで文字の色を確認 " + selectColor;
	document.getElementById('checkTextBox').style.color=selectColor;
}


function openDivForMessage(divID){
	openFlag = "";
	document.getElementById('largeSelectDiv').style.display='none';
	document.getElementById('colourSelectDiv').style.display='none';
	document.getElementById('foodIconDiv').style.display='none';
	document.getElementById('stationeryIconDiv').style.display='none';
	document.getElementById('electricIconDiv').style.display='none';
	document.getElementById('workIconDiv').style.display='none';
	document.getElementById('infoIconDiv').style.display='none';
	document.getElementById('otherIconDiv').style.display='none';

	document.getElementById(divID).style.display='block';
	clearTimeout(hintTimer);
	openFlag=divID;
}

function selectInputText(inputId){
	document.getElementById(inputId).focus();
	document.getElementById(inputId).select();
}
function inputTag(startTag,endTag,str){
	var target = document.Form1.message;
	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 inputTag2(startTag,endTag,str){
	document.getElementById('largeSelectDiv').style.display='none';
	document.getElementById('colourSelectDiv').style.display='none';
	document.getElementById('foodIconDiv').style.display='none';
	document.getElementById('stationeryIconDiv').style.display='none';
	document.getElementById('electricIconDiv').style.display='none';
	document.getElementById('workIconDiv').style.display='none';
	document.getElementById('infoIconDiv').style.display='none';
	document.getElementById('otherIconDiv').style.display='none';
	openFlag="";

	var target = document.Form1.message;
	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;
}
