/**
 * 住所をコピーする。
 *
 * @param   string	フォーム名
 * @param   string	コピーー元の郵便番号1のテキスト名
 * @param   string	コピーー元の郵便番号2のテキスト名
 * @param   string	コピーー元の住所(都道府県)のプルダウンメニュー名
 * @param   string	コピーー元の住所(市町村番地)のテキスト名
 * @param   string	コピーー元の住所(以降)のテキスト名
 * @param   string	コピーー先の郵便番号1のテキスト名
 * @param   string	コピーー先の郵便番号2のテキスト名
 * @param   string	コピーー先の住所(都道府県)のプルダウンメニュー名
 * @param   string	コピーー先の住所(市町村番地)のテキスト名
 * @param   string	コピーー先の住所(以降)のテキスト名
 *
 * @return  boolean
 */
function copyAddress(form, fromZip1, fromZip2, fromPref, fromAddress1, fromAddress2, toZip1, toZip2, toPref, toAddress1, toAddress2) {

	//引数のチェックをする。
	if (typeof(document.forms[form]) == 'undefined') {
		alert('フォーム名 = "form"が不正です。');
		return false;
	}
	if (typeof(document.forms[form].elements[fromZip1]) == 'undefined') {
		alert('郵便番号1From = "'+fromZip1+'"が不正です。');
		return false;
	}
	if (typeof(document.forms[form].elements[fromZip2]) == 'undefined') {
		alert('郵便番号2From = "'+fromZip2+'"が不正です。');
		return false;
	}
	if (typeof(document.forms[form].elements[fromPref]) == 'undefined') {
		alert('住所(都道府県)From = "'+fromPref+'"が不正です。');
		return false;
	}
	if (typeof(document.forms[form].elements[fromAddress1]) == 'undefined') {
		alert('住所(市町村番地)From = "'+fromAddress1+'"が不正です。');
		return false;
	}
	if (typeof(document.forms[form].elements[fromAddress2]) == 'undefined') {
		alert('住所(以降)From = "'+fromAddress2+'"が不正です。');
		return false;
	}
	if (typeof(document.forms[form]) == 'undefined') {
		alert('フォーム名 = "form"が不正です。');
		return false;
	}
	if (typeof(document.forms[form].elements[toZip1]) == 'undefined') {
		alert('郵便番号1To = "'+toZip1+'"が不正です。');
		return false;
	}
	if (typeof(document.forms[form].elements[toZip2]) == 'undefined') {
		alert('郵便番号2To = "'+toZip2+'"が不正です。');
		return false;
	}
	if (typeof(document.forms[form].elements[toPref]) == 'undefined') {
		alert('住所(都道府県)To = "'+toPref+'"が不正です。');
		return false;
	}
	if (typeof(document.forms[form].elements[toAddress1]) == 'undefined') {
		alert('住所(市町村番地)To = "'+toAddress1+'"が不正です。');
		return false;
	}
	if (typeof(document.forms[form].elements[toAddress2]) == 'undefined') {
		alert('住所(以降)To = "'+toAddress2+'"が不正です。');
		return false;
	}

	//住所をコピーする。
	document.forms[form].elements[toZip1].value = document.forms[form].elements[fromZip1].value;
	document.forms[form].elements[toZip2].value = document.forms[form].elements[fromZip2].value;
	document.forms[form].elements[toPref].value = document.forms[form].elements[fromPref].value;
	document.forms[form].elements[toAddress1].value = document.forms[form].elements[fromAddress1].value;
	document.forms[form].elements[toAddress2].value = document.forms[form].elements[fromAddress2].value;

	return true;
}

/**
 * 指定したIDのノードを表示・非表示する。
 *
 * @param   boolean	ON/OFF
 * @param   string	親ノードのID
 *
 * @return  boolean
 */
function showNode(flag, id) {

//	alert('falg='+flag+'/id='+id);

	if (id == '') return;
	if (document.getElementById(id) == null) return;

//alert('flag='+flag+'/id='+id+'/tag='+document.getElementById(id).tagName+'/display='+document.getElementById(id).style.display);

	if (flag == true) {
		var nextDisplay = null;
		switch (document.getElementById(id).tagName) {
			case 'TR':
				if (is_pc_ie) {
					//IEの場合
					nextDisplay = 'block';
				} else {
					//IE以外の場合
					nextDisplay = 'table-row';
				}
				break;
			default:
				nextDisplay = 'block';
				break;
		}
		document.getElementById(id).style.display = nextDisplay;
	} else {
		document.getElementById(id).style.display = 'none';
	}
}

var ua = navigator.userAgent.toLowerCase();
var is_pc_ie = ((ua.indexOf('msie') != -1) && (ua.indexOf('win') != -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1));


