function f_pagejump(frm, pgobj, pg){
  with(frm){
    elements[pgobj].value = pg;
    submit();
  }
  return false;
}
function limitchars(words, charn){
  wordn = words.length;
  if(wordn > charn){
    alert("現在"+wordn+"文字です。\n"+charn+"文字以内にしてください。");
    return false;
  }
  return true ;
}

function checkpost(word){
  data = word.match(/^\d{3}-\d{4}$|^\d{3}-\d{2}$|^\d{3}$/);
  data = word.match(/^\d{3}\d{4}$|^\d{3}\d{2}$|^\d{3}$/);
  if(word && !data){
    alert("郵便番号の形式が不正です。");
    return false;
  }
  return true ;
}

function chkmailad(word){
  data = word.match(/^\S+@\S+\.\S+$/);
  if(word && !data)  {
    alert("メールアドレスの形式が不正です。");
    return false;
  }
  return true ;
}

function confwind(word){
  flag = confirm(word + "します。よろしいですか？");
  return flag ;
}

function confwind2(word){
  flag = confirm(word);
  return flag ;
}
function f_jppg(np){
  document.pageform.page.value = np;
  document.pageform.submit();
}
function f_yubinfnd(objForm, strPost, strAddr){
  with(objForm){
    sValue = elements[strPost].value + ',' + elements[strAddr].value;
    var ret = showModalDialog("func/postmsch.php", sValue, "dialogHeight:600px;dialogWidth:500px;status:no;location:no;");
    if(ret != null){
      var arRet = ret.split(',');
      elements[strPost].value = arRet[0];
      elements[strAddr].value = arRet[1];
    }
  }
}
function f_yubinfnd_admin(objForm, strPost, strAddr){
  with(objForm){
    sValue = elements[strPost].value + ',' + elements[strAddr].value;
    var ret = showModalDialog("../func/postmsch.php", sValue, "dialogHeight:600px;dialogWidth:500px;status:no;location:no;");
    if(ret != null){
      var arRet = ret.split(',');
      elements[strPost].value = arRet[0];
      elements[strAddr].value = arRet[1];
    }
  }
}
function fp_upload(oForm, iSrno, iObno, iMode, sFltp, sFlsz){
  with(oForm){
    var vRet = showModalDialog('pcupload.php?fltype='+sFltp+'&xysize='+sFlsz+((elements['koukaikbn'+iSrno].value == '1')?'&kkkbn=1':''), window, 'dialogHeight:300px;dialogWidth:500px;status:no;location:no;');
    if(vRet != null){
      var arRet = vRet.split(',');
      elements['wkpiccd'+iSrno].value = arRet[0];
      elements['wkpicreg'+iSrno].value = arRet[1];
      elements['wkpicorg'+iSrno].value = arRet[2];
      elements['wkpicfsz'+iSrno].value = arRet[3];
      fp_update(oForm, iSrno, iObno, iMode);
    }
  }
}
function fp_update(oForm, iSrno, iObno, iMode){
  with(oForm){
    if(elements['wkpiccd'+iSrno].value != '' || elements['piccd'+iSrno].value != ''){
      $('#picdelbtn'+iObno).show();
      $('#picetc'+iObno).show();
    }else{
      $('#picdelbtn'+iObno).hide();
      $('#picetc'+iObno).hide();
    }
    if(elements['wkpiccd'+iSrno].value != ''){
      switch(iMode + ''){
        case '1':
          $('#piclink'+iObno).html('<a href="'+sPicPath+'/'+elements['wkpicreg'+iSrno].value+'" target="_blank"><img src="./../func/gdthumb.php?path='+sDataPath+'/pics/'+elements['wkpicreg'+iSrno].value+'&mw=80&mh=80" border="0"></a><br>');
          break;
        case '2':
          $('#piclink'+iObno).html('<a href="adm_data_download.php?wkk=1&pcd='+elements['wkpiccd'+iSrno].value+'&fsz='+elements['wkpicfsz'+iSrno].value+'">'+elements['wkpicorg'+iSrno].value+'</a><br>');
          break;
        default:
          $('#piclink'+iObno).html('<a href="'+sPicPath+'/'+elements['wkpicreg'+iSrno].value+'" target="_blank">'+elements['wkpicorg'+iSrno].value+'</a><br>');
          break;
      }
    }else{
      if(elements['piccd'+iSrno].value != ''){
        switch(iMode){
          case '1':
            $('#piclink'+iObno).html('<a href="'+sPicPath+'/'+elements['picreg'+iSrno].value+'" target="_blank"><img src="./../func/gdthumb.php?path='+sDataPath+'/pics/'+elements['picreg'+iSrno].value+'&mw=80&mh=80" border="0"></a><br>');
            break;
          case '2':
            $('#piclink'+iObno).html('<a href="adm_data_download.php?wkk=0&pcd='+elements['piccd'+iSrno].value+'&fsz='+elements['picfsz'+iSrno].value+'">'+elements['picorg'+iSrno].value+'</a><br>');
            break;
          default:
            $('#piclink'+iObno).html('<a href="'+sPicPath+'/'+elements['picreg'+iSrno].value+'" target="_blank">'+elements['picorg'+iSrno].value+'</a><br>');
            break;
        }
      }else{
        $('#piclink'+iObno).text('');
      }
    }
  }
}
function fp_delete(oForm, iSrno, iObno, iMode){
  with(oForm){
    if(elements['wkpiccd'+iSrno].value != ''){
      elements['wkpiccd'+iSrno].value = '';
      elements['wkpicreg'+iSrno].value = '';
      elements['wkpicorg'+iSrno].value = '';
      elements['wkpicfsz'+iSrno].value = '';
    }else{
      if(elements['piccd'+iSrno].value != ''){
        elements['piccd'+iSrno].value = '';
        elements['picreg'+iSrno].value = '';
        elements['picorg'+iSrno].value = '';
        elements['picfsz'+iSrno].value = '';
      }
    }
    fp_update(oForm, iSrno, iObno, iMode);
  }
}
function f_picswindow(sImage){
  showModalDialog('adm_image_dialog.php?src='+sImage, null, 'center:yes;resizable:no;scroll:no;status:no;');
  return false;
}
function f_newwindow(sFile){
  showModalDialog(sFile, null, "dialogWidth:700px;dialogHeight:"+Math.round(screen.height * 0.8)+"px;dialogTop:"+Math.round(screen.height * 0.05)+"px;dialogLeft:"+Math.round((screen.width-700)*0.5)+"px;");
  return false;
}
function f_newwindow2(sUrl){
  showModelessDialog(sUrl, null, "dialogWidth:"+screen.width+"px;dialogHeight:"+screen.height+"px;dialogTop:0px;dialogLeft:0px;resizable:yes;");
}
function f_wclose(){
  if(!window.opener.closed){
    if(opener.document.renewform){
      opener.document.renewform.submit();
    }
  }
  window.close();
}
function f_sort(sOrder){
  with(document.sortform){
    if(elements['sort'].value == sOrder){
      elements['srad'].value = (elements['srad'].value * (- 1)) + 1;
    }else{
      elements['sort'].value = sOrder;
    }
    submit();
  }
}

