﻿// JavaScript Document

function onoffObj (hid) {
	if(document.getElementById) {
		if (document.getElementById(hid).style.display == "block") {
			document.getElementById(hid).style.display = "none";
			document.getElementById(hid+'on').style.display = "block";
		} else {
			document.getElementById(hid).style.display = "block";
			document.getElementById(hid+'on').style.display = "none";
		}
	} else if(document.all) {
		if (document.all(hid).style.display == "block") {
			document.all(hid).style.display = "none";
			document.all(hid+'on').style.display = "block";
		} else {
			document.all(hid).style.display = "block";
			document.all(hid+'on').style.display = "none";
		}
	} else if(document.layers) {
		if (document.layers[hid].display == 'block') {
			document.layers[hid].display = 'none';
			document.layers[hid+'on'].display = 'block';
		} else {
			document.layers[hid].display = 'block';
			document.layers[hid+'on'].display = 'none';
		}
	}
}

function SubmitCheck(){
  var cbElm = document.adv_form.getElementsByTagName("input");
  for(var i = 0; i < cbElm.length; i++){
    if(cbElm[i].type == "checkbox" && 
       cbElm[i].name == "adv_dep_id[]" && 
       cbElm[i].checked == true){
      return true;
    }
  }
  alert('一つ以上チェックを付けてください');
  return false;
}
function detail(url){
  var cbElm = document.adv_form.getElementsByTagName("input");
  for(var i = 0; i < cbElm.length; i++){
    if(cbElm[i].type == "checkbox" && 
       cbElm[i].name == "adv_dep_id[]" && 
       cbElm[i].checked == true){
      document.adv_form.submit();
      return true;
    }
  }
  location.href = url;
}



function fnc_all_click(objAll){
	for(var i=0;i<document.adv_form.length;i++){
		if(document.adv_form[i].type=="checkbox"){
			document.adv_form[i].checked = objAll.checked;
		}
	}
}
function fnc_mbr_click(objMbr){
	if(objMbr.checked == false){
		document.adv_form.chkall01.checked = false;
		document.adv_form.chkall02.checked = false;
		return;
	}
	for(var i=0;i<document.adv_form.length;i++){
		if(document.adv_form[i].type=="checkbox"){
			if(document.adv_form[i].checked==false
			                 &&
			   document.adv_form[i].name!="chkall01"
			                 &&
			   document.adv_form[i].name!="chkall02"){
				return;
			}
		}
	}
	document.adv_form.chkall01.checked = true;
	document.adv_form.chkall02.checked = true;
}






