function writeHTML(html){
  if (document.layers) { // Netscape
    document.layers.nmsg.document.open();
    document.layers.nmsg.document.write(html);
    document.layers.nmsg.document.close();
  }
  else if (document.all||document.getElementById) { // IE
    var ien6=(document.all) ? msg:document.getElementById("msg");
    ien6.innerHTML=html;
  }
}

// ** 
function  getWindowWidth() {
  var windowWidth = 0;
  if (window.innerWidth) { windowWidth = window.innerWidth; adjustment = 0; } // Netscape
  else if (document.all) { windowWidth = document.body.clientWidth; adjustment = 0; } // IE
  return windowWidth;
}

// ** Highlight a header specified by starting index and length ** //
function highliteHeader(startindex, length) {
  var retval = "";
  // ** header appears in middle of message ** //
  if ( (0 <= startindex) && (startindex < (characterwidth - length)) ) {
    retval = message.substring(0,startindex) + "<font color='#FFFFFF'><b>" + message.substring(startindex,startindex+length) + "</b></font>" + message.substring(startindex+length,characterwidth);
  }
  // ** shift out thru left border ** //
  else if ( (startindex + length) > message.length ) {
    length = (startindex + length) - message.length; startindex = 0; 
    retval = "<font color='#FFFFFF'><b>" + message.substring(startindex,length) + "</b></font>" + message.substring(length,characterwidth);
  }
  // ** shift in from right border ** //
  else if ( startindex < characterwidth ) {
    retval = message.substring(0,startindex) + "<font color='#FFFFFF'><b>" + message.substring(startindex,characterwidth) + "</b></font>";
  }
  else {
    retval = message.substring(0,characterwidth);
  }
  
  return retval;
}

// ** Highlight a header specified by starting index and length ** //
function highliteHeader_test(startindex, length) {
  var retval = "";
  // ** header appears in middle of message ** //
  if ( (0 <= startindex) && (startindex < (characterwidth - length)) ) {
    retval = message.substring(0,startindex) + "<font color='#FFFFFF'><b>" + message.substring(startindex,startindex+length) + "</b></font>" + message.substring(startindex+length,characterwidth);
  }
  // ** shift out thru left border ** //
  else if ( (startindex + length) > message.length ) {
    length = (startindex + length) - message.length; startindex = 0; 
    retval = "<font color='#FFFFFF'><b>" + message.substring(startindex,length) + "</b></font>" + message.substring(length,characterwidth);
    // ** shift in from right border ** //
    if ( startindex < characterwidth ) {
      retval = retval.substring(0,startindex) + "<font color='#FFFFFF'><b>" + retval.substring(startindex,characterwidth) + "</b></font>";
    }
  }
  // ** shift in from right border ** //
  else if ( startindex < characterwidth ) {
    retval = message.substring(0,startindex) + "<font color='#FFFFFF'><b>" + message.substring(startindex,characterwidth) + "</b></font>";
  }
  else {
    retval = message.substring(0,characterwidth);
  }
  
  return retval;
}


function imgover(imgname, img){
     imgname.src = img
}

function imgout(imgname, img){
     imgname.src = img
}

function shiftIfFilled(event, field)
{
  var keyCode = event.which ? event.which : event.keyCode;
  var shift = event.modifiers ? event.modifiers & Event.SHIFT_MASK :
    event.shiftKey;

  return field.value.length == field.maxLength && !shift &&
    keyCode != 9 && keyCode != 16;
}

function gotoURL(url)
{
  window.open(url,'main','top=10,left=10,width=450,height=400,toolbar=no,scrollbars=yes,resizable=yes,menubar=no');
}
