// サブウィンドウのポップアップ処理 ----------------
function popup ( locationid, nameid, widthid, heightid, leftid, topid, conditionid ) {
	var attribute01 = 'no';// scrollbars + resizable
	var attribute02 = 'no';// menubar + status
	var attribute03 = 'no';// toolbar

	if ( conditionid == 1 ) { attribute01 = 'yes'; }
	else if ( conditionid == 2 ) { attribute01 = 'yes'; attribute02 = 'yes'; }
	else if ( conditionid == 3 ) { attribute01 = 'yes'; attribute03 = 'yes'; }	

	if ( attribute01 == 'yes' ) {// スクロールバーによるウィンドウの有効幅の調整
		// Win IE 、及び Win NN 4.x 以前
		if ( archos == 'Win' && archwb == 'M' || archos == 'Win' && archdt == 'c' ) { widthid += 16; }
		// Mac IE
		else if ( archos == 'Mac' && archwb == 'M' ) { widthid -= 1; }
		// Mac NN 4.x 以前
		else if ( archos == 'Mac' && archdt == 'c' ) { widthid += 15; }
		// NN 7.x
		else if ( archdt == 'a' && archwb == 'N' && document.body.clientHeight ) { widthid += 15; }
		// NN 6.x
		else if ( archdt == 'a' && archwb == 'N' && !document.body.clientHeight ) { widthid += 14; }
	}

	var attributeid = 'width=' + widthid + ',height=' + heightid + ',left=' + leftid + ',top=' + topid + ',menubar=' + attribute02 + ',toolbar=' + attribute03 + ',location=no,directories=no,status=' + attribute02 + ',scrollbars=' + attribute01 + ',resizable=' + attribute01;
	var winop = window.open( locationid, nameid, attributeid );
	winop.focus();
}



//-------------- ↓↓06/1/16　自動カーソル移動に必要そうなスクリプト部分---------------------
//
// 自動カーソル移動処理 ----------------
function getnavi(style){
        ua = new Array();
        ua[0] = '';
        ua[1] = navigator.appName;
        ua[2] = navigator.appVersion;
        ua[3] = navigator.appVersion.charAt(0);
        if (ua[2].indexOf("MSIE") > -1){
                ua[0] = 'IE';
        }
        else if ((ua[3].indexOf("5") > -1) && (ua[1].indexOf("Netscape") > -1)){
                ua[0] = 'NN6';
        }
        else if ((ua[3].indexOf("4") > -1) && (ua[1].indexOf("Netscape") > -1)){
                ua[0] = 'NN4';
        }
        else {
                ua[0] = 'other';
        }
        if (style == 'simple'){
                return ua[0];
        }
        else {
                return ua;
        }
}

//自動カーソル
function keyck(iname){
	ua = getnavi('simple');
//alert(ua+":"+iname.name);
	if(ua == 'IE'){
		if((event.keyCode>47&&event.keyCode<58)||(event.keyCode>95&&event.keyCode<106)){
			if (iname.value.length == 3) document.form1.elements.secondzip.focus(); 
		}
	}
}

function keyck02(iname){
	ua = getnavi('simple');
//alert(ua+":"+iname.name);
	if(ua == 'IE'){
		if((event.keyCode>47&&event.keyCode<58)||(event.keyCode>95&&event.keyCode<106)){
			if (iname.value.length == 3) document.form1.elements.secondzip02.focus(); 
		}
	}
}

// --- カット ---
//function keyck03(iname, id){
//	ua = getnavi('simple');
//alert(ua+":"+iname.name);
//	if(ua == 'IE'){
//		if((event.keyCode>47&&event.keyCode<58)||(event.keyCode>95&&event.keyCode<106)){
//			if (iname.value.length >= 4) document.form1.elements[id+1].focus(); 
//		}
//	}
//}
// --- ここまで ---

function keyck03(iname, id){
	ua = getnavi('simple');
//	alert(ua+":"+iname.name+" id:"+id);
	if(ua == 'IE'){
		if((event.keyCode>47&&event.keyCode<58)||(event.keyCode>95&&event.keyCode<106)){
			if (iname.value.length >= 4){
				// elementsの要素が、コンテンツ制作とプログラム側と相違があります。
				document.preApplyPForm.elements[id+1].focus();
//				document.preApplyPForm.elements[id].focus();
			}
		}
	}
}



//-------------- ↑↑06/1/16　ここまで---------------------

// Pマーク対応----------------------
function checkPersonalInformationAgreement(){
	var i,j;
	for(i = 0; i < document.forms.length; i++){
		for(j = 0; j < document.forms[i].elements.length; j++){
			if(document.forms[i].elements[j].name=="personalInformationAgreement"){
				if(document.forms[i].elements[j].checked){
					return true;
				}else{
					alert("個人情報の取扱いについて同意いただけない方は\nお申し込みいただけません");
					return false;
				}
			}
		}
	}
}
