// JavaScript Document
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/////////////////////////お問合わせフォームチェック/////////////////////////
function check(){ 
var mess = "入力内容のご確認をお願いします。";
// check開始
flg = 0;
rflg = 0;
okcolor = "#FFFFFF";
ngcolor = "#FFA275";

// 「個人情報の取り扱い」の入力をチェック 
if(document.form1.checkbox.checked){
flg = 0;
} else {
flg = 1;
}
// 「会社名」の入力をチェック 
str = document.form1.company;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
}

// 「氏名」の入力をチェック 
str = document.form1.name;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 

// 「メール」の半角入力をチェック
str = document.form1.email;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else {
if(!str.value.match(/^[A-Za-z0-9]+[\w-]+@[\w\.-]+\.\w{2,}$/)){ 
str.style.backgroundColor = ngcolor;
flg = 1;
} else {
str.style.backgroundColor = okcolor;
}
}

// 「電話番号」の入力をチェック 
str = document.form1.tel;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else {
// 「電話番号」の桁数・半角・ハイフンをチェック 
str = document.form1.tel;
if (document.form1.tel.value.length > 13) {
str.style.backgroundColor = ngcolor;
flg = 1;
} else {
    err = 0;
hyphen = 0;
for (i=0;i<str.value.length;i++){

code = str.value.charCodeAt(i);
if ((48<=code && code <=57) || (45==code)){
if (45==code) {
hyphen++;
if (hyphen>2) {
str.style.backgroundColor = ngcolor;
flg = 1;
}
}
} else {
  err++;
}
}
if (err!=0) {
str.style.backgroundColor = ngcolor;
flg = 1;
  } else {
str.style.backgroundColor = okcolor;
}
}
}


// 「こちらからのご連絡方法」の入力をチェック 
str = document.form1.radiobutton;
if(str.value == ""){flg = 1;} 

// 「関係するお問い合せ」の入力をチェック 
str = document.form1.checkbox1;
if(str.checked == ""){rflg += 1;} 
str = document.form1.checkbox2;
if(str.checked == ""){rflg += 1;} 
str = document.form1.checkbox3;
if(str.checked == ""){rflg += 1;} 
str = document.form1.checkbox4;
if(str.checked == ""){rflg += 1;} 

if(rflg == 4){flg = 1;} 


// check終了
if (flg == 1) {
window.alert(mess); // 警告ダイアログ表示 
return false; // 送信中止 
}

// 送信実行
return true;
} 

/////////////////////////中途採用への応募フォームチェック/////////////////////////
function check2(){ 
var mess = "入力内容のご確認をお願いします。";
// check開始
flg = 0;
rflg = 0;
okcolor = "#FFFFFF";
ngcolor = "#FFA275";

// 「氏名」の入力をチェック 
str = document.form2.pic_name_s;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 
str = document.form2.pic_name_n;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 
// 「氏名カナ」の入力をチェック 
str = document.form2.pic_kana_s;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 
str = document.form2.pic_kana_n;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
}

// 「生年月日」の入力をチェック 
str = document.form2.birth_yy;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 
str = document.form2.birth_mm;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 
str = document.form2.birth_dd;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 
// 「年齢」の入力をチェック 
str = document.form2.birth_old;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 

// 「メール」の半角入力をチェック
str = document.form2.email;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else {
if(!str.value.match(/^[A-Za-z0-9]+[\w-]+@[\w\.-]+\.\w{2,}$/)){ 
str.style.backgroundColor = ngcolor;
flg = 1;
} else {
str.style.backgroundColor = okcolor;
}
}



// check終了
if (flg == 1) {
window.alert(mess); // 警告ダイアログ表示 
return false; // 送信中止 
}

// 送信実行
return true;
} 


/////////////////////////メールマガジン登録フォームチェック/////////////////////////
function check3(){ 
var mess = "入力内容のご確認をお願いします。";
// check開始
flg = 0;
rflg = 0;
okcolor = "#FFFFFF";
ngcolor = "#FFA275";

// 「会社名」の入力をチェック 
str = document.form3.company;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 
// 「氏名」の入力をチェック 
str = document.form3.pic_name1;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 
str = document.form3.pic_name2;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 
// 「氏名カナ」の入力をチェック 
str = document.form3.pic_name_kana1;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 
str = document.form3.pic_name_kana2;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
}

// 「役職名」の入力をチェック 
str = document.form3.ofc_name;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 

// 「部署名」の入力をチェック 
str = document.form3.pt_name;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 

// 「郵便番号」の入力をチェック 
str = document.form3.pc_num1;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 
str = document.form3.pc_num2;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 

// 「住所」の入力をチェック 
str = document.form3.state;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 
str = document.form3.addr2;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 
str = document.form3.addr3;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else { 
str.style.backgroundColor = okcolor;
} 

// 「メール」の半角入力をチェック
str = document.form3.email;
if(str.value == ""){
str.style.backgroundColor = ngcolor;
flg = 1;
} else {
if(!str.value.match(/^[A-Za-z0-9]+[\w-]+@[\w\.-]+\.\w{2,}$/)){ 
str.style.backgroundColor = ngcolor;
flg = 1;
} else {
str.style.backgroundColor = okcolor;
}
}



// check終了
if (flg == 1) {
window.alert(mess); // 警告ダイアログ表示 
return false; // 送信中止 
}

// 送信実行
return true;
} 
