// 共通処理
<!--
// プルダウンの要素を追加する
// 引数：<select>タグのid, value, 表示する文字列
function addOption(selectBoxId, value, str) {
	var selectBox = document.getElementById(selectBoxId);
	var newItem = new Option(str, value);
	newItem.label = str;
	selectBox.options.add(newItem);
}

// プルダウンの要素をクリアする
// 引数：<select>タグのid
function clearOption(selectBoxId) {
	var selectBox = document.getElementById(selectBoxId);
	
	while (selectBox.childNodes.length > 0) {
		selectBox.removeChild(selectBox.childNodes[0]);
	}
}

// プルダウンの要素を選択する
function selectItem(targetPull, selectValue) {
// 引数：チェック対象のプルダウン, 選択する値
	for (var i = 0; i < targetPull.length; i++) {
		// 値が一致した場合
		if (targetPull[i].value == selectValue) {
			// プルダウンの要素を選択する
			targetPull[i].selected = true;
			break;
		}
	}
	return true;
}

// チェックボックスが1つ以上チェックされているか
function isSelectedItem(targetCheckbox) {
// 引数：チェック対象のチェックボックス
	var chkflg = false;
	for (i = 0; i < targetCheckbox.length; i++) {
		if (targetCheckbox[i].checked) {
			chkflg = true;
			break;
		}
	}
	return chkflg;
}

// 指定したクラスのエレメントを取得する
function getElementsByClass(searchClass) {
	var classElements = new Array();
	var allElements = document.getElementsByTagName("*");
	for (i = 0, j = 0; i < allElements.length; i++) {
		if (allElements[i].className == searchClass) {
			classElements[j] = allElements[i];
			j++;
		}
	}
	return classElements;
}

// ラジオボタンの要素を追加する
// 引数：<select>タグのid, value, 表示する文字列
function addOptionRadio(selectBoxId, value, str) {
	
	var selectBox = document.getElementById(selectBoxId);
	var element = document.createElement('input');
	var textnode = document.createTextNode(str);
	element.type = 'radio';
	element.name = 'artitem';
	element.value = value;
	var artitemhidden = document.getElementById("artitemhidden").value;			//戻るボタンで物件種目の値をhiddenに保持
	//hiddenの値と一致したらチェックを付ける
	if(value == artitemhidden){
		element.checked = true;
	}
	
	selectBox.appendChild(element);
	selectBox.appendChild(textnode);
}

// ラジオボタンの要素を選択する
function selectItemRadio(targetPull, selectValue) {
	
// 引数：チェック対象のプルダウン, 選択する値
	for (var i = 0; i < targetPull.length; i++) {
		// 値が一致した場合
		if (targetPull[i].value == selectValue) {
			
			// プルダウンの要素を選択する
			targetPull[i].selected = true;
			break;
		}
	}
	return true;
}


// -->
