// -*- JavaScript -*-
// Navi starter  [1997/11/21]
//   Copyright 1997 by EPSON KOWA corporation

// Configuration
config_navi_window_features = "width=400,height=600," +
                              "resizable=yes,scrollbars=auto,menubar=no";
config_navi_first_url = "N/NAVI.HTM";

config_sorry_window_features = "width=300,height=200";
config_sorry_url = "N/NG.HTM";

// has_property: ある property を持つかどうか判定
function has_property( obj, name )
{
  var prop;
  
  for( prop in obj )
    if( prop == name )
      return true;
  
  return false;
}

// ブラウザの判定
function is_good_browser(){
  if( navigator.appName == 'Netscape' )
    return 4 <= navigator.appVersion.charAt(0);
  else if( navigator.appName == 'Microsoft Internet Explorer' )
  {
      if (navigator.appVersion.indexOf('Mac') == -1)
            return 4 <= navigator.appVersion.charAt(0);
      else
            return false;
  }
  else
    return false;
}

// Navigator 起動 button が押されたときの handler
function N(){
  if( is_good_browser() ){
    if( navigator.navi == null ){
      // Navigator window のオープン
      var tmp;

      tmp = window.open( config_navi_first_url, "navi",
                        config_navi_window_features );

      tmp._base = window._base;

//      top.focus();
//      tmp.focus();
//      parent.focus();



    }
  }else
    window.open( config_sorry_url, "ERROR", config_sorry_window_features );
}

// Browser の判定
function is_navigator_common(){
  return navigator.appName == "Netscape";
}

// 諸設定
{
  var pathname = location.pathname;
  
  // window._base の設定
  var iter = pathname.length;
  
  while( 0 <= iter ){
    if( pathname.charAt( iter ) == '/' || pathname.charAt( iter ) == '\\' )
      if( !--myname )
        break;
    --iter;
  }
  
  window._base = pathname.substring( 0, iter + 1 );
  window._myname = pathname.substring( iter + 1, pathname.length );
  
  if( is_navigator_common() ){
    // Navigator window の同期 ( for Netscape )
    if( navigator.navi != null )
      navigator.navi.sync( window._myname );
  }
}
