function checkNickname(message1,message2,message3){
// TJAV2224516 
//s=document.edit_storage.nickname.value;
  s1=document.edit_storage.nickname.value;
  s=spaceallcut(s1);
  document.edit_storage.nickname.value=s;
  if(s =="") {
     alert(message1);
     document.edit_storage.nickname.focus();
     return 1;
  }else{
    err_message=message2;
    err_message2=message3;
    if(wordcheck(s)==1){
     document.edit_storage.nickname.focus();
     return 1;
    }
  }
}

function checkProduct(message1,message2,message3){
// TJAV2224516 
//s=document.edit_storage.product.value;
  s1=document.edit_storage.product.value;
  s=spaceallcut(s1);
  document.edit_storage.product.value=s;
  if (s == ""){
     alert(message1);
     document.edit_storage.product.focus();
     return 1;
  }else{
  err_message=message2;
  err_message2=message3;
    if(wordcheck(s)==1){
     document.edit_storage.product.focus();
     return 1;
    }
  }
}

function checkSerialnum(message1,message2){
  if (document.edit_storage.serialnum.value==""){
     alert(message1);
     document.edit_storage.serialnum.focus();
     return 1;
  }else{
     charlength=document.edit_storage.serialnum.value.length; 
     for(i=0; i<charlength; i++){
       checkchar=document.edit_storage.serialnum.value.charCodeAt(i);
       if(checkchar < 48 || checkchar >57){
         alert(message2);
         document.edit_storage.serialnum.focus();
         return 1;
       }
     }
  }
}

function checkIpaddress(message1,message2){
  if (document.edit_storage.ipaddress0.value==""){
     alert(message1);
     document.edit_storage.ipaddress0.focus();
     return 1;
  }
  if (document.edit_storage.ipaddress1.value==""){
     alert(message1);
     document.edit_storage.ipaddress1.focus();
     return 1;
  }
  if (document.edit_storage.ipaddress2.value==""){
     alert(message1);
     document.edit_storage.ipaddress2.focus();
     return 1;
  }
  if (document.edit_storage.ipaddress3.value==""){
     alert(message1);
     document.edit_storage.ipaddress3.focus();
     return 1;
  }
  for(i=0;i<3;i++){
    checkchar=document.edit_storage.ipaddress0.value.charCodeAt(i);
//  if char is not a number then  .. 
    if(checkchar < 48 || checkchar >57){
      alert(message2);
      document.edit_storage.ipaddress0.focus();
      return 1;
    }
  }
  for(i=0;i<3;i++){
    checkchar=document.edit_storage.ipaddress1.value.charCodeAt(i);
//  if char is not a number then  .. 
    if(checkchar < 48 || checkchar >57){
      alert(message2);
      document.edit_storage.ipaddress1.focus();
      return 1;
    }
  }
  for(i=0;i<3;i++){
    checkchar=document.edit_storage.ipaddress2.value.charCodeAt(i);
//    if char is not a number then  .. 
    if(checkchar < 48 || checkchar >57){
      alert(message2);
      document.edit_storage.ipaddress2.focus();
      return 1;
    }
  }
  for(i=0;i<3;i++){
    checkchar=document.edit_storage.ipaddress3.value.charCodeAt(i);
//  if char is not a number then  .. 
    if(checkchar < 48 || checkchar >57){
      alert(message2);
      document.edit_storage.ipaddress3.focus();
      return 1;
    }
  }
}

function checkLocation(message1,message2,message3){
//TJAV2224516
//  s=document.edit_storage.location.value; changeTjav222
  s1=document.edit_storage.location.value;
  s=spaceallcut(s1);
  document.edit_storage.location.value=s;
  if (s==""){
     alert(message1);
     document.edit_storage.location.focus();
     return 1;
  }else{
   err_message=message2;
   err_message2=message3;
    if(wordcheck(s)==1){
     document.edit_storage.location.focus();
     return 1;
    }
  }
}
// TJAV2224516 
function spacecut(str_wrk1){
  if(str_wrk1.charAt(0)==" "){
    str_next=str_wrk1.substr(1,(str_wrk1.length-1));
//    alert(str_next);
    return str_next;
  };
  if(str_wrk1.charAt(str_wrk1.length-1)==" "){
    str_next=str_wrk1.substr(0,(str_wrk1.length-1));
//    alert(str_next);
     return str_next;
  }
  return "111111111111111111";
}

function  spaceallcut(str_wrk2){
  str=str_wrk2;
  for(i=0;i < 256 ;i++){   
    istr=spacecut(str);
    if(istr == "111111111111111111"){break;}
    str=istr;
  } 
return str;
}

function checkHostname(message1,message2,message3){
// TASL2225934 
  s1=document.edit_storage.hostname.value;
  s=spaceallcut(s1);
  document.edit_storage.hostname.value=s;
  if(s =="") {
     alert(message1);
     document.edit_storage.hostname.focus();
     return 1;
  }else{
    err_message=message2;
    err_message2=message3;
    if(wordcheck2(s)==1){
     document.edit_storage.hostname.focus();
     return 1;
    }
  }
}
