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_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_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 MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function Open_Win(){
	wo=window.open('','new_Win','width=320,height=480,scrolling=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
	wo.focus();
}


// ???f?B?X?^??
function jumpMedista() {
document.forms["frm_medista"].submit();
}
// ?p?X?|?[?g??
function jumpPassport() {
document.forms["frm_passport"].submit();
}

function openWin(url, name, formname, prefectureform, addrform1, addrform2) {

    if (url == null || url == undefined) {
        return false;
    }
    
    url = url + "?formname="+formname+"&prefectureform="+prefectureform+"&addrform1="+addrform1+"&addrform2="+addrform2;

    if (name == null || name == undefined) {
        name = "newwin";
    }
    

    var styleArray = new Array("width", "height", "dependent", "menubar", "resizable", "scrollbars", "status", "toolbar");
    var winArgs = new Array("400", "300", "yes", "no", "no", "no", "no", "no");
    
    var style = "";
    var index = 6;
    
    for (index=6; index<arguments.length; index++) {
        if (index != 6) {
            style = style + ",";
        }
        style = style + styleArray[index-6] + "=" + arguments[index];
    }
    
    for (i=index; i<(styleArray.length+6); i++) {
        if (i != 6) {
            style = style + ",";
        }
        style = style + styleArray[i-6] + "=" + winArgs[i-6];
    }

    openWindow = window.open(url, name, style);
    openWindow.focus();
}

//?????{?^??
function changeAction(formName, action) {
  document.forms[formName].action=action;
  document.forms[formName].submit();
}

//function backAction(formName, action) {
function backAction(formName, action, actionBack) {
//  document.forms[formName].$!{cbn.globals.ACTION_TYPE_NAME}.value = "$!cbn.globals.ACTION_BACK";
  document.forms[formName].actionType.value = actionBack;
  changeAction(formName, action);
}

/**
 * ?????F???????{?????o?^
 * ?@?\?F?]?E???????????J???????????A?X?J?E?g?E?????????????X?y???Adisabled?????X
 * @param noChange ?????????X??????????: true
 */
function changeCbnetType(formName, noChange) {
  cbnetType = document.forms[formName].elements['cbnetTypeEnum'];
  disabled = false;
  checkedValue = 1;
  if (isNotEmpty(cbnetType)) {
    for (i=0; i<cbnetType.length; i++) {
      if (cbnetType[i].checked) {
        disabled = (cbnetType[i].value == 2);
        checkedValue = cbnetType[i].value;
      }
    }
  }
  if (!noChange || disabled) {
    changeChecked(formName, 'scoutEnum', null, false);
    changeChecked(formName, 'scoutEnum', checkedValue, true);
    changeChecked(formName, 'introEnum', null, false);
    changeChecked(formName, 'introEnum', checkedValue, true);
  }
  changeDisabled(formName, 'scoutEnum', null, disabled);
  changeDisabled(formName, 'introEnum', null, disabled);
}

/**
 * ?????F???????{?????o?^
 * ?@?\?F?E???????I?????A???w?????I?????????????ADHTML?????????w???T?C?g?????????N???\??????
 * @param selected ?E???????Z???N?g?I?u?W?F?N?g
 */
function selectJobDetail(selected) {
  if (document.all) {
//    document.all("yakugakusei").style.display = "none";
    if (selected.value == "51") {
      if (document.all("yakugakusei").style.display == "none") {
        document.all("yakugakusei").style.display = "block";
      }
    }
  }
  else if (document.getElementById) {
    var yakugakuObj = document.getElementById("yakugakusei");
    if(yakugakuObj == undefined) return;
    
    yakugakuObj.style.display = "none";
    
    if (selected.value == "51") {
      if (yakugakuObj.style.display == "none") {
        yakugakuObj.style.display = "block";
      }
    }
  }
}

function changeAttribute(attribute, formName, elementName, value, change) {
  var array = document.forms[formName].elements[elementName];
  if (isNotEmpty(array)) {
    for (i=0; i<array.length; i++) {
      if (isEmpty(value) || array[i].value == value) {
        eval("array[" + i + "]." + attribute + " = " + change);
//        confirm(
//        "name=" + array[i].name
//        + ",value=" + array[i].value
//        + ",checked=" + array[i].checked
//        + ",readonly=" + array[i].readonly
//        + ",disabled=" + array[i].disabled);
      }
    }
  }
}

/*
// ?`?F?b?N???t????
*/
function changeChecked(formName, elementName, value, checked) {
  changeAttribute('checked', formName, elementName, value, checked);
}

function changeReadonly(formName, elementName, value, readonly) {
  changeAttribute('readonly', formName, elementName, value, readonly);
}

function changeDisabled(formName, elementName, value, disabled) {
  changeAttribute('disabled', formName, elementName, value, disabled);
}

function isEmpty(value) {
  return (value == null || value == undefined || value.length == 0);
}

function isNotEmpty(value) {
  return !isEmpty(value);
}

function goAction(formName) {
  document.forms[formName].submit();
}

function setPrefecture(){
	var targetObject = arguments[0];
	var checkFlg = targetObject[parseInt(arguments[1])].checked;

	for(var i = parseInt(arguments[1]); i <= parseInt(arguments[2]); i++){
		if(checkFlg){
			targetObject[i].checked=false;
		} else {
			targetObject[i].checked=true;
		}
	 }
}


function mobile(url){
window.open(url, "mobileInfo", "width=650,scrollbars=yes");
}

function newyearInfo(url){
window.open(url, "newyearInfo", "width=570,height=650,scrollbars=no");
}


function getRadioValue(formname, inputname){

    var ctrls = document.forms[formname].elements;

    if(ctrls[name] == undefined) return "";

    if(ctrls[name].length == undefined){
        //radio1‚Â
        if(ctrls[name].checked) return ctrls[name].value;
    }else{
        for(var i = 0; i < ctrls[name].length; i++){
            if(ctrls[name][i].checked) return ctrls[name][i].value;
        }
    }    
    
    return "";
}

function selectedValue(selectObj){
    if(selectObj == undefined) return '';
    return selectObj.options[selectObj.selectedIndex].value
    
}

function checkedCount(checkboxes){

    if(checkboxes == undefined) return 0;

    var count = 0;
    
    if(checkboxes.length == undefined){
        if(checkboxes.checked) count = 1;
    }else{
        for(var i = 0; i < checkboxes.length; i++){
            if(checkboxes[i].checked) count++;
        }
    }

    return count;

}

function checkBoxAllChange(checkbox, checkboxes, doOnclick){

    if(checkbox == undefined || checkboxes == undefined) return 0;

    var checkvalue = false;

    if(checkbox.checked) checkvalue = true;

    if(checkboxes.length == undefined){
        checkboxes.checked = checkvalue;
        if(doOnclick == undefined || !doOnclick) checkboxes.onclick();

    }else{
                
        for(var i = 0; i < checkboxes.length; i++){
            checkboxes[i].checked = checkvalue;
            if(doOnclick == undefined || !doOnclick) checkboxes[i].onclick();
        }
    }
    return count;

}


function Open_Win()
{wo=window.open('','newyear','width=520,height=574,scrolling=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
wo.focus();
}