
function showhide(id)
{
  if(document.getElementById)
  {
    obj = document.getElementById(id);
    if (obj.style.display == "none")
    {
      obj.style.display = "";
    }
    else
    {
      obj.style.display = "none";
    }
  }
}

function selectall(form,obj)
{
  form.elements[obj].select();
}

function showhidecheck(form,nam,id)
{
  if(document.getElementById)
  {
    obj = document.getElementById(id);
    if (form.elements[nam].checked == true)
    {
      obj.style.display = "";
    }
    else
    {
      obj.style.display = "none";
    }
  }
}

function hide(id)
{
  if(document.getElementById)
  {
    obj = document.getElementById(id);
    if (obj.style.display != "none")
    {
      obj.style.display = "none";
    }
  }
}

function show(id)
{
  if(document.getElementById)
  {
    obj = document.getElementById(id);
    if (obj.style.display != "")
    {
      obj.style.display = "";
    }
  }
}

function popOpen(url, name, att)
{
  var load = window.open(url, name, att);
  load.focus();
}

function kanopen(url, name)
{
  popOpen(url, name, 'scrollbars=yes,menubar=no,width=470,height=500,resizable=yes,toolbar=no,location=no,status=no');
}

function wordopen(url, name)
{
  popOpen(url, name, 'scrollbars=yes,menubar=no,width=340,height=400,resizable=yes,toolbar=no,location=no,status=no');
}

function reviewopen()
{
  popOpen("", "applet", 'scrollbars=no,menubar=no,width=640,height=350,resizable=no,toolbar=no,location=no,status=no');
}

function updateField(val)
{
  opener.document.seek.kanji.value = val;
  self.close();
}

function kansearch(fld,event)
{
  with (fld.form)
  {
    text_field = fld;
    var props = 'scrollbars=no,menubar=no,width=300,height=335,resizable=no,toolbar=no,location=no,status=no';
    var l = window.open('kansearch.php', 'Kanji_Search', props);
    l.location.href = 'kansearch.php';
    if (l.opener == null) l.opener = self;
    l.focus();
  }
}

function validate(form, min, max)
{
  with (form)
  {
    var data = parseInt(value);
    if (isNaN(data)) {data='';}
    if (data==''||data==null||data==0)
    {value='';}
    else if (data<min)
      {value=min;}
    else if (value>max)
      {value=max;}
    else
      {value=data;}
  }
}

function confirmSubmit(message)
{
  return (confirm(message));
}

function dataentry(message, def)
{
  var ent = prompt(message, def);
  if (ent == '' || ent == false || ent == null)
    return false;
  else
    document.form.newname.value = ent;
}
