function opentemp(page, w, h) {
  sw=screen.availWidth/2-w/2;
  sh=screen.availHeight/2-h/2;
  window.open(page,'win','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width='+w+',height='+h+',top='+sh+',screenY='+sh+',left='+sw+',screenX'+sw);
}
function openwin(page, w, h) {
  sw=screen.availWidth/2-w/2;
  sh=screen.availHeight/2-h/2-150;
  window.open(page,'win','toolbar=1,location=1,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width='+w+',height='+h+',top='+sh+',screenY='+sh+',left='+sw+',screenX'+sw);
}

function log_send(num){
  if(document.form.num.value == 'nosend'){
    return(0);
  }
  document.form.num.value = num ;
  document.form.mode.value = 'enikki' ;
  document.form.method = "POST" ;
  document.form.action = "./sample.cgi" ;
  document.form.target = "_self" ;
  document.form.submit() ;
  window.top.main.focus();
}

function menu_send(args){
  if(document.form.num.value == 'nosend'){
    return(0);
  }
  document.form.mode.value = args ;
  document.form.method = "POST" ;
  document.form.action = "./sample.cgi" ;
  document.form.target = "_self" ;
  document.form.submit() ;
  window.top.main.focus();
}


function reload(i,year,month,day){
  var work = 0 ;
  switch (i) {
    case 1:
      work = document.hiduke.year.selectedIndex + 2001 ;
      work = (work * 10000) + (month * 100) + day ;
      document.hiduke.date.value = work ;
      break;
    case 2:
      work = document.hiduke.month.selectedIndex + 1 ;
      work = (year * 10000) + (work * 100) + day ;
      document.hiduke.date.value = work ;
      break;
    case 3:
      work = document.hiduke.day.selectedIndex + 1 ;
      work = (year * 10000) + (month * 100) + work ;
      document.hiduke.date.value = work ;
      break;
  }
  document.hiduke.action = "edit.cgi" ;
  document.hiduke.submit() ;
}

function comm1(){
  document.menu.comment.value = "結婚記念日に二人と旅行（富士急ハイランド）に行ったときのレポート";
}
function comm2(){
  document.menu.comment.value = "１万ＨＩＴ企画として作成しました";
}
function comm3(){
  document.menu.comment.value = "２万ＨＩＴ企画として、絵日記描きさんに１００の質問に答えてみました。";
}
function comm4(){
  document.menu.comment.value = "長崎に帰省したときのレポートです。";
}
function comm5(){
  document.menu.comment.value = "２００４年９月２５日に行いましたオフ会のレポートです。";
}
function comm6(){
  document.menu.comment.value = "２００４年１１月２０日に行いましたオフ会のレポートです。";
}


function content(args){
  if(document.form.num.value == 'nosend'){
    return(0);
  }
  document.form.method = "POST" ;
  document.form.mode.value = args ;
  document.form.action = "./index2.cgi" ;
  document.form.target = "_self" ;
  document.form.submit() ;
  window.top.main.focus();
}

function antenna(i){
//  if(i == 'nosend'){
//    return(0);
//  }
//  alert(i) ;
  document.nform.cate.value = i ;
  document.nform.method = "POST" ;
  document.nform.target = "_self" ;
  document.nform.action = "./" ;
  document.nform.submit() ;
}

function init(){
  document.mform.NAME.value = getCookie("NAME") ;
  document.mform.EMAIL.value = getCookie("EMAIL") ;
}

function mail(){
  if(document.mform.NAME.value == ""){
    alert("お名前をご記入ください。");
    return(0);
  }
  if(document.mform.MESSAGE.value == ""){
    alert("本文をご記入ください。");
    return(0);
  }
  if(document.mform.TITLE.value == ""){
    if (window.confirm("タイトルが未記入ですが、このまま送信しますか？")) {
    }else{
      return(0);
    }
  }
  setCookie("NAME",document.mform.NAME.value) ;
  setCookie("EMAIL",document.mform.EMAIL.value) ;
  document.mform.target = "_blank" ;
  document.mform.action = "mail/wwwmail.cgi" ;
  document.mform.submit() ;
}

function getCookie(key) {
  tmp1 = " " + document.cookie + ";";
  xx1 = xx2 = 0;
  len = tmp1.length;
  while (xx1 < len) {
    xx2 = tmp1.indexOf(";", xx1);
    tmp2 = tmp1.substring(xx1 + 1, xx2);
    xx3 = tmp2.indexOf("=");
    if (tmp2.substring(0, xx3) == key) {
      return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
    }
    xx1 = xx2 + 1;
  }
  return("");
}

function setCookie(key, val) {
  tmp = key + "=" + escape(val) + "; ";
  // tmp += "path=" + location.pathname + "; ";
  tmp += "expires=Fri, 31-Dec-2030 23:59:59; ";
  document.cookie = tmp;
}

function clearCookie(key) {
  document.cookie = key + "=" + "xx; expires=1-Jan-1997 00:00:00;";
}
