﻿//入力チェック
function checkContact(){
	var flag=0;

for(i=0;i<document.forms[0].utype.length;i++){
if(document.forms[0].utype[i].checked){flag=1;break;}
}
if(flag==0){alert('法人・個人をご選択ください');return false;}

if(document.forms[0].utype[0].checked){
if(!document.forms[0].company.value){
alert('貴社名をご入力ください');return false;}

if(!document.forms[0].company_kana.value){
alert('貴社フリガナ（全角カナ）をご入力ください');return false;}
}

if(!document.forms[0].name.value){
alert('お名前をご入力ください');return false;}

if(!document.forms[0].kana.value){
alert('フリナガ（全角カナ）をご入力ください');return false;}

if(!document.forms[0].address2.value){
alert('ご住所をご入力ください');return false;}

if(!document.forms[0].tel.value){
alert('お電話番号をご入力ください');return false;}

if(!document.forms[0].mail.value){
alert('メールアドレスをご入力下さい');return false;}
if(!document.forms[0].mail.value.match(/.+@.+\..+/)){
alert('メールアドレスの形式をご確認下さい');return false;}	

if(!document.forms[0].msg.value){
alert('お問い合わせ内容をご入力ください');return false;}


if(confirm('こちらの内容で送信してもよろしいですか？')){ return true; }
else{ return false; }

}

function checkRecruit(){
	var flag=0;

if(!document.forms[0].name.value){
alert('氏名（全角記入）をご入力ください');return false;}

if(!document.forms[0].kana.value){
alert('フリナガ（全角カナ）をご入力ください');return false;}

if(!document.forms[0].address2.value){
alert('住所をご入力ください');return false;}

if(!document.forms[0].tel.value){
alert('電話番号（半角数字）をご入力ください');return false;}

if(!document.forms[0].mail.value){
alert('メールアドレスをご入力下さい');return false;}
if(!document.forms[0].mail.value.match(/.+@.+\..+/)){
alert('メールアドレスの形式をご確認下さい');return false;}	

if(document.forms[0].mail.value != document.forms[0].mail2.value){
alert('確認用メールアドレスが一致しません');return false;}

if(!document.forms[0].school.value){
alert('学校名をご入力ください');return false;}

if(!document.forms[0].year1.value){
alert('入学 年をご入力ください');return false;}

if(!document.forms[0].month1.value){
alert('入学 月をご入力ください');return false;}

if(!document.forms[0].year2.value){
alert('卒業見込み 年をご入力ください');return false;}

if(!document.forms[0].month2.value){
alert('卒業見込み 月をご入力ください');return false;}

if(confirm('こちらの内容で送信してもよろしいですか？')){ return true; }
else{ return false; }

}

function checkRecruitCarrier(){
	var flag=0;

if(!document.forms[0].name.value){
alert('氏名（全角記入）をご入力ください');return false;}

if(!document.forms[0].kana.value){
alert('フリナガ（全角カナ）をご入力ください');return false;}

if(!document.forms[0].address2.value){
alert('住所をご入力ください');return false;}

if(!document.forms[0].tel.value){
alert('電話番号（半角数字）をご入力ください');return false;}

if(!document.forms[0].mail.value){
alert('メールアドレスをご入力下さい');return false;}
if(!document.forms[0].mail.value.match(/.+@.+\..+/)){
alert('メールアドレスの形式をご確認下さい');return false;}	

if(document.forms[0].mail.value != document.forms[0].mail2.value){
alert('確認用メールアドレスが一致しません');return false;}

if(!document.forms[0].history.value){
alert('職歴をご入力ください');return false;}

if(document.forms[0].kiboubi1.options[document.forms[0].kiboubi1.selectedIndex].value == ""){	flag = 1;}
	if(flag){alert('試験希望日時をご選択ください');return false;}

if(confirm('こちらの内容で送信してもよろしいですか？')){ return true; }
else{ return false; }

}

function TestDay(){
var nDate = new Date();         // 現在の日時のDateオブジェクト
var nYear = nDate.getFullYear();    // 現在の年
var nMonth = nDate.getMonth()+1;    // 現在の月
var nDay = nDate.getDate();    // 現在の日
var week = new Array("日", "月", "火", "水", "木", "金", "土");
var dayOfWeek;
var i;

	for(i=6;i<37;i++){
		nDate = computeDate(nYear,nMonth,nDay,i);
		dayOfWeek = week[nDate.getDay()];
		document.write("<option value=\"" + nDate.getFullYear()  + "年" + (nDate.getMonth() + 1) + "月" + nDate.getDate() + "日 （" + dayOfWeek + "）" + "\">" + nDate.getFullYear()  + "年" + (nDate.getMonth() + 1) + "月" + nDate.getDate() + "日 （" + dayOfWeek + "）</option><br />\r\n");
	}
	
}
function computeDate(year, month, day, addDays) {
    var dt = new Date(year, month - 1, day);
    var baseSec = dt.getTime();
    var addSec = addDays * 86400000;//日数 * 1日のミリ秒数
    var targetSec = baseSec + addSec;
    dt.setTime(targetSec);
    return dt;
}