
  function trim(strchr) {
    var rstr;
    var tstr;
    rstr = ltrim(strchr);
    if (rstr.length == 0) return ("");
    tstr = rtrim(rstr);
    if (tstr.length == 0) return ("");
  
    return (tstr);
  }

  function ltrim(strchr) {
    var strlen;
    var onechar;
    var chkflag;
    var i;
    strlen = strchr.length;
    if (strlen == 0) return ("");
    chkflag = 0;
    for (i = 0; i <= strlen; i++) {
  
      onechar = strchr.charAt(i);
      if (onechar == " ") {
        chkflag++;
      } else {
        if (strlen <= chkflag) return ("");
        return (strchr.substring(chkflag, strlen));
      }
    }
  }

  function rtrim(strchr) {
    var strlen;
    var onechar;
    var chkflag;
    var i;
    strlen = strchr.length;
    if (strlen == 0) return ("");
  
    chkflag = 0;
  
    for (i = strlen - 1; i >= -1; i--) {
      onechar = strchr.charAt(i);
      if (onechar == " ") {
        chkflag++;
      } else {
        if (strlen <= chkflag) return ("");
        return (strchr.substring(0, strlen - chkflag));
      }
    }
  }

  function checkjoonum(it) {
    var i;
    var IDtot;
    var IDAdd;
    IDtot = 0;
    IDAdd="234567892345";
  
    for(i=0;i<12;i++) {
           IDtot = IDtot + parseInt(it.substring(i,i+1)) * parseInt(IDAdd.substring(i,i+1));
    }
  
    IDtot = 11 - (IDtot%11);
  
    if(IDtot==10) {
      IDtot=0;
    }  else if(IDtot==11) {
      IDtot=1;
    }
  
    if(parseInt(it.substring(12,13)) != IDtot) return (false);
  
    return (true);
  } 


  function WinOpen(src,winname,toolbar,menu,scroll,resize,w,h){
    openwin = window.open (src,winname,"toolbar="+toolbar+",location=no,directories=no,status=no,menubar="+menu+",scrollbars="+scroll+",resizable="+resize+",width="+w+",height="+h);
    openwin.window.focus();
  }

  function search_(theForm,theURL,fieldName){
    if ( theForm.keytext.value == "" ){
      alert(fieldName + " 検索語を入力してください!!");
      theForm.keytext.focus();
      return false;
    }else{
      theForm.action = theURL;
      theForm.submit();
      return;
    }    
  }  

  function pageMove_(theURL,theField){
    location.href= theURL + "?page=" + theField; 
  }    
  
  function write_(theURL,theField){
    location.href= theURL + "?Num=" + theField; 
  }    
  
  function list_(theURL,theField){
    location.href= theURL + "?" + theField; 
  }  
 
  function reset_(theform){
    var strdoc = eval("document."+theform);
    strdoc.reset();
    strdoc.writer.focus();
    strdoc.writer.select();
  }
    
  function delete_(theURL,theField,Msg){
    var strmsg = Msg +"内容を削除しますか？"
    if (Msg == ""){
      
      var strdoc = eval("document.form1." + theField);
      if (strdoc.value ==""){
        alert("パスワードを入力してください!!");
        strdoc.focus();
      }else{  
        document.form1.action = theURL;
        document.form1.submit();
      }  
    }else{
      if (confirm(strmsg)){
        location.href= theURL + "?" + theField; 
      }  
    }  
  }    
  
  function Msgsave_(theForm,theURL,theField,Msg){
    
    if (confirm(Msg)){
      theForm.action = theURL + "?" + theField;
      theForm.submit();
    }  
  }     

  function loadOn(theWidth,theHeight){
    var width  = screen.width;
    var height = screen.height; 
    var w      = (width - theWidth)/2;
    var h      = (height - theHeight)/2;
    self.moveTo(w,h);
  }
  
	function checkemail(email) {
	  var chkstr;
	  var onechar, compchr;
	  var chkflag;
	  var chkmail;
	  var chklen;
	  var i;
	  var j;
	  chkstr = "@._-abcdefghijklmnopqrstuvwxyz0123456789";
	
	  for (i = 0; i < email.length; i++) {
	    onechar = email.charAt(i);
	    chkflag = false;
	    for (j = 0; j < chkstr.length; j++) {
	      compchr = chkstr.charAt(j);
	      if (onechar.toLowerCase() == compchr.toLowerCase()) chkflag = true;
	    }
	    if (chkflag == false) {
	      return (false);
	    }
	  }
	  if (email.indexOf("@") >= 1 && email.indexOf(" ") == -1 && email.indexOf(".") != 0)
	  {
	    chkmail = email.indexOf("@");
	    if (email.indexOf(".", chkmail) > chkmail + 1 && email.indexOf("@", chkmail + 1) == -1)
	    {
	      chklen = email.length;
	      if (email.indexOf(".", chklen - 1) == chklen - 1)
	      {
	        return (false);
	      } else {
	        return (true);
	      }
	    } else {
	      return (false);
	    }
	  } else {
	    return (false);
	  }
	}

  function checking(){
    if(document.form1.writer.value == "")
    {
      alert("作成者の名前を入力してください!!");
      document.form1.writer.focus();
      return;
     }
    if(document.form1.title.value == "")
    {
      alert("タイトルを入力してください!!");
      document.form1.title.focus();
      return;
     }
    if(document.form1.content.value == "")
    {
      alert("内容を入力してください !!");
      document.form1.content.focus();
      return;
     }
    if(document.form1.security.value == "")
    {
      alert("内容の修正/削除の時要ります.");
      document.form1.security.focus();
      return;
     } 
   document.form1.submit();
   return true;
  }

  function sending(){
    if(document.form1.writer.value == "")
    {
      alert("作成者の名前を入力してください!!");
      document.form1.writer.focus();
      return;
     }
    if(document.form1.title.value == "")
    {
      alert("タイトルを入力してください!!");
      document.form1.title.focus();
      return;
     }
    if(document.form1.content.value == "")
    {
      alert("内容を入力してください !!");
      document.form1.content.focus();
      return;
     }
    document.form1.submit();
   return true;
  }
  

//Reset ()

  function reset_(theform){
    var strdoc = eval("document."+theform);
    strdoc.reset();
    strdoc.writer.focus();
    strdoc.writer.select();
  }  

	function dele_()
	  {
	  if(form1.security.value=="")
	    {
	      alert("  内容の修正/削除の時要ります!! ");
	      form1.security.focus();
	      return true;
	    }
  	form1.submit()    
	}

 function delok(this_num,thisvalue){
  var ismsg;
  ismsg = thisvalue + "ｿ｡ｼｭ ｻ霖ｦ ﾇﾏｽﾃｰﾚｽﾀｴﾏｱ?";
  if ( confirm(ismsg)){
    location.href = "delete.asp?Num=" + this_num;
  }
}  


function searching()
  {
  if(document.form1.search_string.value=="")
   {
   alert("  検索語を入力してください!!");
   document.form1.search_string.focus();
  return;
   }
   document.form1.submit();
   return true;
  }



function checkNumber(fm) 
{
	t = fm.value ;
	
	for(i=0;i<t.length;i++) 
	{
		if (t.charAt(i)<'0' || t.charAt(i)>'9')
		{
			alert("ｼﾀﾚｸｸ ﾀﾔｷﾂﾇﾘﾁﾖｼｼｿ.") ;
			fm.value="";
			fm.focus() ;
			return false ;
		}
	}
}
