// 一括資料請求関連
	var theName  = "KSLUMPREQ";
	var intheName  = theName + "=";
	var theDay   = 365;
	var maxAdd   = 20;

	function addScode(scode,scname){
		if(checkExistsScode(scode)){
			alert('『 ' + scname + ' 』\nは既に一括資料請求リストに追加済みです。');
//			if(confirm('『 ' + scname + ' 』\nは既に一括資料請求リストに追加済みです。\n\n一括資料請求リストを表示しますか？')){
//				location.href = '/daigaku/lumpreq/';
//			}else`
			return false;
//			}
		}
		theData   = readScode();
		scodesCount = theData.split(",").length;
		if(scodesCount >= maxAdd){
			alert('一括資料請求リストに追加できる学校は最大'+ maxAdd +'件までです。\n\n現在、'+scodesCount+'件の登録が有ります。');
			return false;
		}else{
			if(theData == ''){
				theValue = scode;
			}else{
				theValue = theData + ',' + scode;
			}
			setDay = new Date();
			setDay.setTime(setDay.getTime()+(theDay*1000*60*60*24));
			expDay = setDay.toGMTString();
			document.cookie = theName + "=" + escape(theValue) + ";expires=" + expDay + ";domain=.gakkou.net;path=/";
			alert('『 ' + scname + ' 』\nを一括資料請求リストに追加しました。\n\n現在、' + theValue.split(",").length + '件の登録が有ります。');

//			lumppage = "/daigaku/lumpreq/?" + Math.floor(Math.random()*1000);
//			lmp = window.open(lumppage,"lumpreq");
//			lmp.focus();
		}

	}


	function submitlumpreqs(){
		if(confirm('送付先などをご入力いただくお申込画面に移動します。\nお申込が完了すると、このリストはクリアされます。\n\nよろしいですか？')){
//			listvalue = readScode();
//			setDay = new Date();
//			setDay.setTime(setDay.getTime()+(theDay*1000*60*60*24));
//			expDay = setDay.toGMTString();
//			document.cookie = "KSLUMPREQLISTS=" + escape(listvalue) + ";expires=" + expDay + ";domain=.gakkou.net;path=/";
//			delData();
//			lumppage = "/daigaku/lumpreq/?" + Math.floor(Math.random()*1000);
//			location.href = lumppage;
			tgt = "https://secure.gakkou.net/guidebook/lumpreq/"
			location.href = tgt;
//			window.opener.location.href = tgt;
//			window.close();
		}else{
			return false;
		}

	}

	function readScode(){
		theData   = "";
		theCookie = document.cookie+";";
		start = theCookie.indexOf(intheName);
		if (start != -1)
		{
			end = theCookie.indexOf(";",start);
			theData = unescape(theCookie.substring(start+intheName.length,end));
		}
		return theData;
	}

	function checkExistsScode(scode){
		newscodes = new Array();
		scodes  = readScode().split(",");
		for (i = 0; i < scodes.length; i++) {
			if(scodes[i] == scode) return true;;
		}
		return false;
	}

	function delScode(scode,scname){
		if(confirm('『 ' + scname + ' 』\nを一括資料請求リストから削除しますか？')){


			newscodes = new Array();
			scodes  = readScode().split(",");
			for (i = 0; i < scodes.length; i++) {
				if(scodes[i] != scode) newscodes.push(scodes[i]);
			}
			theValue = newscodes.join(",");
			setDay = new Date();
			setDay.setTime(setDay.getTime()+(theDay*1000*60*60*24));
			expDay = setDay.toGMTString();
			document.cookie = theName + "=" + escape(theValue) + ";expires=" + expDay + ";domain=.gakkou.net;path=/";

			lumppage = "/daigaku/lumpreq/?" + Math.floor(Math.random()*1000);
			location.href = lumppage;

//			lumppage = "/daigaku/?" + Math.floor(Math.random()*1000);
//			location.reload();
		}

	}


	function delData(){
		theValue = "";
		setDay = new Date();
		setDay.setTime(setDay.getTime()+(theDay*1000*60*60*24));
		expDay = setDay.toGMTString();
		document.cookie = theName + "=" + escape(theValue) + ";expires=" + expDay + ";domain=.gakkou.net;path=/";
	}


	function showCookie(){
		incoki = 'クッキーの内容:\n\n' + document.cookie.replace(/; /g,'\n');
		alert(incoki);
	}

	function CookieCheck(){
		if (!navigator.cookieEnabled){
			alert("クッキーへの書き込みができません");
			return false;
		}
	}


	function viewinfo(tgt){
		location.href = tgt;
//		window.opener.focus();
//		window.close();
	}



function zipdicopen(tgt){
	if(document.order.zip1.value.length != 3 || document.order.zip2.value.length != 4){
		alert("郵便番号は、半角数字3桁+4桁で入力してください");
		return false;
	}
	theURL = '/guidebook/zipdic/?zip1=' + document.order.zip1.value + '&zip2=' + document.order.zip2.value + '&tgt=' + tgt;
	winName = 'zipdicwin';
	features = 'scrollbars=yes,resizable=no,width=450,height=200';
	window.open(theURL,winName,features);
}

function atend(zip1,zip2,pref_code,address,target){
	window.opener.document.order.zip1.value = zip1;
	window.opener.document.order.zip2.value = zip2;
	window.opener.document.order.address.value = address;
	window.opener.document.order.pref.value = pref_code;
	window.opener.focus();
	window.close();
}

