
function errorMsg(msg, ref)
{
  window01=window.open('','', 'scrollbars=no,width=280, height=200');
  window01.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n');
  window01.document.write('<html>\n\n<head>\n  <title>Error Message!</title>\n');
  window01.document.write('  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\n');
  window01.document.write('  <link rel="stylesheet" type="text/css" href="errorMsg.css" />\n');
  window01.document.write('  </head>\n\n<body>\n');
  window01.document.write('  <div>\n  <p><img src="./icons/error.gif" alt="Fel!" /><br />Felrapport för sidan &quot;' + ref + '&quot;.</p>\n');
  window01.document.write('  <p>Fullständing beskrivning av felet:\n');
  window01.document.write('    <textarea readonly="readonly" rows="5" cols="45">\n');
  window01.document.write(msg);
  window01.document.write('    </textarea></p>\n');
  window01.document.write('  </div>\n  <p><input type="button" value="    OK    " onclick="window.close();" /></p>\n');
  window01.document.write('</body>\n\n</html>');
}

function appendEM(emsg, msg)
{
  return emsg+"* "+msg+"\n";
}

function oldErrorMsg(msg, ref)
{
  window01=window.open('','messageWindow',   'scrollbars=no,width=280, height=250');
  window01.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n');
  window01.document.write('<html>\n\n<head>\n  <title>Error Message!</title>\n');
  window01.document.write('  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\n');
//  window01.document.write('  <link rel="stylesheet" type="text/css" href="style.css" />\n');
  window01.document.write('  <style type="text/css">\nbody{background-color: #808080;}\ndiv{font-family: courier; width: 200px; height: 100px; overflow: auto; border-color: #606060; border: solid;}\n');
  window01.document.write('  </style>\n</head>\n\n<body>\n');
  window01.document.write('  <p>Felrapport för sidan &quot;' + ref + '&quot;.</p>\n');
  window01.document.write('  <p>Fullständing beskrivning av felet:\n');
//  window01.document.write('    <textarea readonly="readonly" rows="10" cols="30">\n');
  window01.document.write('    <div>\n');
  window01.document.write(msg);
  window01.document.write('    </div>\n');
  window01.document.write('  </p>\n</body>\n\n</html>');
}


function yearParser(val)
{ 
  // Converts a year into four digits.
  // Accepts the following formats:
  // yyyy
  // yy (assuming applicant is less than 100 years old)
  // -yy (assuming applicant is less than 100 years old)
  // 
  // Other characters returns NaN
  // (C)opyright 2004, Joel Håkansson

  Today = new Date();
  yr = Today.getFullYear();
  num = parseInt(val,10);
  if (val.length==0) return "";
  if (val.length==1) return val;
  else if (isNaN(num)) return "NaN";
  else
  {
    if (num<0) num = Math.abs(num);
    if (num<100)
    {
      num = num + 2000;
      if (num > yr) num = num - 100;
      return num;
    }
    else return num;
  }
  return "";
}

function nameParser(val)
{
  val = val.toLowerCase();
  out = "";
  uppercase = true;
  for (i=0; i<val.length; i++)
  {
    tmp = val.charAt(i);
    if (uppercase) { tmp = tmp.toUpperCase(); uppercase = false; }
    out = out + tmp;
    if (tmp==' ' | tmp=='-') uppercase = true;
  }
  return out;
}

