  function openWindow1(url)
  {
    TWN = window.open(url, 'newWin', "toolbar=no,directories=no,menubar=no,width=630,height=470,location=no,scrollbars=yes,resizable=yes,status=yes")
  }

  function openWindow2(url, width, height)
  {
    var para = "toolbar=no,directories=no,menubar=no,width=" + width + ",height=" + height + ",location=no,scrollbars=yes,resizable=yes,status=yes";
    TWN = window.open(url, 'newWin', para);
    TWN.focus();
  }

  function openWindow3(url, width, height, winName)
  {
    var para = "toolbar=no,directories=no,menubar=no,width=" + width + ",height=" + height + ",location=no,scrollbars=yes,resizable=yes,status=yes";
    TWN = window.open(url, 'winName', para);
    TWN.focus();
  }

  function openWindow4(url, width, height)
  {
    window.resizeTo(width, height);
    document.location = url;
    window.focus();
  }

  function doWindow(url, width, height)
  {
    var para = "toolbar=no,directories=no,menubar=no,width=" + width + ",height=" + height + ",location=no,scrollbars=yes,resizable=yes,status=yes";
    TWN = window.open(url, 'newWin', para);
    TWN.focus();
  }

  function openWindowAndSubmitForm(url, width, height, formName)
  {
    openWindow2(url, width, height);
  }

  function open_window(url)
  {
    // --- init
    var argv = open_window.arguments;
    var argc = argv.length;
    var i = 0;

    var attrib_type = Array
      (
        'dependant', 'directories', 'hotkeys', 'innerHeight', 'innerWidth',
        'location', 'menubar', 'outerHeight', 'personalbar', 'resizable',
        'screenX', 'screenY', 'scrollbars', 'status', 'toolbar'
      );
    attrib_type.in_array = function(val) { var len = this.length; for (var i = 0; i < len; i++)  if (this[i] == val)  return true;  return false; }

    var attrib = Array();
    attrib['dependant'  ] = 'no';
    attrib['directories'] = 'no';
    attrib['hotkeys'    ] = 'yes';
    attrib['innerHeight'] = '630';
    attrib['innerWidth' ] = '470';
    attrib['location'   ] = 'no';
    attrib['menubar'    ] = 'no';
    attrib['personalbar'] = 'no';
    attrib['resizable'  ] = 'yes';
    attrib['screenX'    ] = null;
    attrib['screenY'    ] = null;
    attrib['scrollbars' ] = 'yes';
    attrib['status'     ] = 'yes';
    attrib['toolbar'    ] = 'no';

    // --- get params
    if (argc > 1)  for (i = 1; i < argc; i++)
    {
      var equ_pos = argv[i].indexOf("=");
      if (equ_pos > -1)
      {
        var key = argv[i].substr(0, equ_pos);
        var val = argv[i].substr(equ_pos+1);
        if (attrib_type.in_array(key))  attrib[key] = val;
      }
    }

    // --- centre window if coords not set
    if (attrib['screenX'] == null)  attrib['screenX'] = (screen.width  ? (screen.width  - attrib['innerWidth' ]) / 2 : 0);
    if (attrib['screenY'] == null)  attrib['screenY'] = (screen.height ? (screen.height - attrib['innerHeight']) / 2 : 0);

    // --- create param string
    var attrib_type_len = attrib_type.length;
    var param = "";
    for (i = 0; i < attrib_type_len; i++)
      if (attrib[attrib_type[i]] != null)
        param += (i > 0 ? "," : "") + attrib_type[i] + '=' + attrib[attrib_type[i]];

    // --- now do it...
    var win = window.open(url, 'newWin', param);
    win.focus();
  }

  browser_name = navigator.appName;
  browser_version = parseFloat(navigator.appVersion); 

  if (browser_name == "Netscape" && browser_version >= 3.0) { roll = 'true'; }
  else if (browser_name == "Microsoft Internet Explorer" && browser_version >= 3.0) { roll = 'true'; }
  else { roll = 'false'; }

  function msover1(img, ref) { if (roll == 'true') { document.images[img].src = ref; } }
  function msout1(img, ref)  { if (roll == 'true') { document.images[img].src = ref; } }

  function msover2(img1, ref1, img2, ref2) 
  { 
    if (roll == 'true')
    { 
      document.images[img1].src = ref1; document.images[img2].src = ref2; 
    } 
  }

  function msout2(img1, ref1, img2, ref2) 
  { 
    if (roll == 'true')
    { 
      document.images[img1].src = ref1; 
      document.images[img2].src = ref2; 
    }  
  }

  function get_date(form, prefix)
  {
    var dd = form.elements[prefix+"_DAY"].selectedIndex + 1;
    if (form.elements[prefix+"_MONTH"])
    {
      var mm_idx = form.elements[prefix+"_MONTH"].selectedIndex;
      var mm     = form.elements[prefix+"_MONTH"].options[mm_idx].value;
      var yy_idx = form.elements[prefix+"_YEAR" ].selectedIndex;
      var yy     = form.elements[prefix+"_YEAR" ].options[yy_idx].value;
    }
    else
    {
      var my_idx = form.elements[prefix+"_MONTHYEAR"].selectedIndex;
      var my_val = form.elements[prefix+"_MONTHYEAR"].options[my_idx].value;
      var my_pos = my_val.indexOf("_");
      var mm = my_val.substr(0, my_pos);
      var yy = my_val.substr(my_pos+1);
    }
    return new Date(yy, mm-1, dd);
  }

  function set_date(form, prefix)
  {
    var i = 0;
    var dd = form.INDATE_DAY_PREV.value;
    var mm = form.INDATE_MONTH_PREV.value;
    var yy = form.INDATE_YEAR_PREV.value;

    var dd_ele = form.elements[prefix+"_DAY"];
    var dd_cnt = dd_ele.length;
    for (i = 0; i < dd_cnt; i++)
      if (dd_ele.options[i].value == dd)
        { dd_ele.selectedIndex = i;  break; }

    if (form.elements[prefix+"_MONTH"])
    {
      var mm_ele = form.elements[prefix+"_MONTH"];
      var mm_cnt = mm_ele.length;
      for (i = 0; i < mm_cnt; i++)
        if (mm_ele.options[i].value == mm)
          { mm_ele.selectedIndex = i;  break; }

      var yy_ele = form.elements[prefix+"_YEAR"];
      var yy_cnt = yy_ele.length;
      for (i = 0; i < yy_cnt; i++)
        if (yy_ele.options[i].value == yy)
          { yy_ele.selectedIndex = i;  break; }
    }
    else
    {
      var my_ele = form.elements[prefix+"_MONTHYEAR"];
      var my_cnt = my_ele.length;
      for (i = 0; i < my_cnt; i++)
        if (my_ele.options[i].value == mm+"_"+yy)
          { my_ele.selectedIndex = i;  break; }
    }
  }

  function date_check(form_name) 
  { 
    var form = document.forms[form_name];

    var today_secs   = new Date();
    var indate_secs  = get_date(form, "INDATE" );
    var outdate_secs = get_date(form, "OUTDATE");

    if (indate_secs.getTime() < today_secs.getTime())
    {
      alert('The check-in date, must be a date in the future');
      set_date(form, "INDATE");
      return false;
    }

    if (outdate_secs.getTime() < today_secs.getTime())
    {
      alert('The check-out date, must be a date in the future');
      set_date(form, "OUTDATE");
      return false;
    }

    if (outdate_secs.getTime() < indate_secs.getTime())
    {
      alert('The check-out date, must be a date after the check-in date');
      set_date(form, "INDATE" );
      set_date(form, "OUTDATE");
      return false;
    }
    return true;
  }

function showhide(var1, var2)
{
  document.getElementById(var1).style.visibility = 'visible';
  document.getElementById(var2).style.visibility = 'hidden';
}

var button_count = 0;
function draw_button(htmloff, htmlon, width, height)
{
  ++button_count;
  id = button_count;

  out = '<span ONMOUSEOVER="showhide(\'b'+id+'on\', \'b'+id+'off\')" ONMOUSEOUT="showhide(\'b'+id+'off\', \'b'+id+'on\')">';
  out += '<span ID="b'+id+'off" STYLE="position:relative; width:'+width+'px; height:'+height+'px; cursor:hand;">';

  out += '<span ID="b'+id+'off" STYLE="position:absolute;">';
  out += htmloff+"</span>";

  out += '<span ID="b'+id+'on" STYLE="position:absolute; visibility:hidden;">';
  out += htmlon+'</span>';

  out += '</span>';
  out += '</span>';
  document.write(out);
}

var win = null;
function NewWindow(mypage,myname,w,h,scroll,status,resizable){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable='+resizable+',status='+status
win = window.open(mypage,myname,settings)
}