package seisinfo;

import java.awt.*;
import java.io.*;
import java.util.*;
import java.lang.Integer;
import java.awt.event.*;
import javax.swing.*;

/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author not attributable
 * @version 1.0
 */

public class SeisInfoFrame extends JFrame {

  int xpos[]=new int[20];
  int ypos[]=new int[20];

  int scrheight;                   // screen height
  int scrwidth;                    // screen width

  String MainTitle="SEISMOLOGICAL INFORMATION SYSTEM               Department of Earth Science, University of Bergen";

  String ParPath="c:\\SEISINFO\\PAR\\";

  String usgspath1="http://neic.usgs.gov/neis/gifs/world.gif";
  String usgspath2="http://neic.usgs.gov/neis/gifs/legend_t.gif";
  String usgstitle="USGS Worldwide Seismicity";

  String wlastpath1="http://wwwneic.cr.usgs.gov/neis/bulletin/bulletin.html";
  String wlastpath2="http://wwwneic.cr.usgs.gov/neis/bulletin/";
  String wlasttitle="Last Earthquake";

  //String usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/KBS_24hr.html";
//  String usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/KONO_24hr.gif";
  String usgs24p1="-1";
  String usgs24p2="-1";
  String usgs24p3="-1";
  String usgs24p4="-1";

  String usgs24title="24-hour seismograms";

  String usgs24p1_1;
  String usgs24p1_2;
  String usgs24p1_3;
  String usgs24p1_4;
  String usgs24hd1;
  String usgs24hd2;
  String usgs24hd3;
  String usgs24hd4;

  String wnsnpath1="http://www.ifjf.uib.no/Seismologi/SisteJordskjelv/norwaygmt.gif";
  String wnsntitle="Events last 10 days NNSN";

  String recentpath1="http://www.geo.uib.no/Seismologi/SisteJordskjelv/NORWAY/gmtmap.html";
  String recentpath2="http://www.geo.uib.no/Seismologi/SisteJordskjelv/NORWAY/";
  String recenttitle="Recent event";

  String show1="c:\\SEISINFO\\SlideShow\\Earthquake\\";
  String show2="c:\\SEISINFO\\SlideShow\\Instrumentation\\";

  JPanel contentPane;

  Background     background;
  USGSFrame      usgs;
  WLastFrame     wlastframe;
  USGS24Frame    usgs24_1;
  USGS24Frame    usgs24_2;
  USGS24Frame    usgs24_3;
  USGS24Frame    usgs24_4;
  Last10Frame    last10events;
  RecentFrame    recentframe;
  SlideShowFrame slideshowframe1;
  SlideShowFrame slideshowframe2;
  SavePosFrame   saveposframe;

  public static boolean USGS=false;
  public static boolean WLAST=false;
  public static boolean LAST10=false;
  public static boolean RECENT=false;
  public static boolean SLIDE1=false;
  public static boolean SLIDE2=false;
  public static boolean USGS24_1=false;
  public static boolean USGS24_2=false;
  public static boolean USGS24_3=false;
  public static boolean USGS24_4=false;

  int usgs24_counter=0;

  JComboBox jComboBox1 = new JComboBox();
  JLabel jLabel1 = new JLabel();
  Choice choice1 = new Choice();
  Choice choice2 = new Choice();
  JLabel jLabel2 = new JLabel();
  JLabel jLabel3 = new JLabel();
  Choice choice3 = new Choice();
  Choice choice4 = new Choice();
  JLabel jLabel4 = new JLabel();
  Button button1 = new Button();         // screen background
  //Construct the frame
  public SeisInfoFrame() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
      jbInit();
    }
    catch(Exception e) {
      e.printStackTrace();
    }
    myInit();
    Parameterfile();

  }
  public void myInit()
  {
    jComboBox1.addItem("USGS World Seismicity Map");
    jComboBox1.addItem("USGS Last Earthquake");
    choice1.addItem("USGS World Seismicity Map");
    choice1.addItem("USGS Last Earthquake");

    choice2.addItem("Last Events");
    choice2.addItem("Recent Event");

    choice3.addItem("BJT,  Baijiatuan,Beijing,China");
    choice3.addItem("ENH,  Enshi,China");
    choice3.addItem("HIA,  Hailar,Neimenggu Province,China");
    choice3.addItem("KMI,  Kunming,China");
    choice3.addItem("LSA , Lhasa,China");
    choice3.addItem("MDJ,  Mudanjiang,China");
    choice3.addItem("SSE,  Shanghai,China");
    choice3.addItem("QIZ,  Qiongzhong,Guangdong Privince,China");
    choice3.addItem("WMQ,  Urumqi,China");
    choice3.addItem("XAN,  Xi'an,China");
    choice3.addItem("ADK,  Aleutian Islands,Alaska,USA");
    choice3.addItem("ANMO, Albuquerque,New Mexico,USA");
    choice3.addItem("ANTO, Ankara,Turkey");
    choice3.addItem("BBSR, Bermuda");
    choice3.addItem("BILL, Bilibino, Russia");
    choice3.addItem("CASY, Casey,Antartica");
    choice3.addItem("CCM,  Cathedral Cave,Missouri,USA");
    choice3.addItem("COLA, College Outpost,Alaska,USA");
    choice3.addItem("CTAO, Charters Towers,Australia");
    choice3.addItem("DWPF, Disney Wilderness Preserve,Florida,USA");
    choice3.addItem("COR,  Corvallis,Oregon,USA");
    choice3.addItem("GNI,  Garni,Armenia");
    choice3.addItem("GUMO, Guam,Marianas Islands");
    choice3.addItem("HKT,  Hockley,Texas,USA");
    choice3.addItem("HRV,  Harvard,Massachusetts,USA");
    choice3.addItem("INCN, Inchon,Republic of Korea");
    choice3.addItem("KBS,  Ny-Alesund,Spitzbergen,Norway");
    choice3.addItem("KIP,  Kipapa,Hawaii,USA");
    choice3.addItem("KMBO, Kilima Mbogo,Kenya");
    choice3.addItem("KONO, Kongsberg,Norway");
    choice3.addItem("LSZ,  Lusaka,Zambia");
    choice3.addItem("LVC,  Limon Verde,Chile");
    choice3.addItem("MA2,  Magadan,Russia");
    choice3.addItem("MAJO, Matsushiro,Japan");
    choice3.addItem("MBWA, Marble Bar,Western Australia");
    choice3.addItem("MIDW, Midway Island,Pacific Ocean,USA");
    choice3.addItem("MSKU, Masuku,Gabon");
    choice3.addItem("NWAO, Narrogin,Australia");
    choice3.addItem("OTAV, Otavalo,Equador");
    choice3.addItem("PAYG, Puerto Ayora,Galapagos Islands");
    choice3.addItem("PET,  Petropavlovsk,Russia");
    choice3.addItem("PMG,  Port Moresby,New Guinea");
    choice3.addItem("PMSA, Palmer Station,Antartica");
    choice3.addItem("POHA, Pohakaloa,Hawaii");
    choice3.addItem("PTCN, Pitcairn Island,South Pacific");
    choice3.addItem("PTGA, Pitinga,Brazil");
    choice3.addItem("QSPA, South Pole,Antartica");
    choice3.addItem("RAR,  Rarotonga,Cook Island");
    choice3.addItem("RCBR, Riachuelo,Brazil");
    choice3.addItem("RSSD, Black Hills,South Dakota,USA");
    choice3.addItem("SAML, Samuel,Brazil");
    choice3.addItem("SBA,  Scott Base,Antartica");
    choice3.addItem("SJG,  San Juan,Puerto Rico");
    choice3.addItem("SNZO, South Karori,New Zealand");
    choice3.addItem("SPA,  South Pole,Antartica");
    choice3.addItem("SSPA, Standing Stone,Pennsylvania,USA");
    choice3.addItem("TATO, Taipei,Taiwan");
    choice3.addItem("TIXI, Tiksi,Russia");
    choice3.addItem("TRQA, Tornquist,Argentina");
    choice3.addItem("TSUM, Tsumeb,Namibia");
    choice3.addItem("TUC,  Tucson,Arizona");
    choice3.addItem("ULN,  Ulaanbataar,Mongolia");
    choice3.addItem("WAKE, Wake Island,Pacific Ocean");
    choice3.addItem("WCI,  Wyandotte Cave,Indiana,USA");
    choice3.addItem("WVT,  Waverly,Tennesee,USA");
    choice3.addItem("YAK,  Yakutsk,Russia");
    choice3.addItem("YSS,  Yuzhno Sakhalinsk,Russia");

    choice4.addItem("Earthquake");
    choice4.addItem("Instrumentation");
  }
  //Component initialization
  private void jbInit() throws Exception
  {
    java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    scrheight=screenSize.height;  // get screen height
    scrwidth=screenSize.width;    // get screen width
    System.out.println(scrheight+"  "+scrwidth);

    background = new Background();
    background.setSize(scrwidth,scrheight);
    background.setLocation(0,0);
//    background.setVisible(true);

    contentPane = (JPanel) this.getContentPane();
    contentPane.setLayout(null);
    this.setLocation(0,0);
    this.setSize(new Dimension(798, 141));
    this.setTitle("             "+MainTitle);
    this.setVisible(true);
    jLabel1.setText("USGS Worldwide Seismicity");
    jLabel1.setBounds(new Rectangle(10, 27, 180, 15));
    choice1.setBounds(new Rectangle(9, 49, 172, 20));
    choice1.addItemListener(new SeisInfoFrame_choice1_itemAdapter(this));
    choice2.setBounds(new Rectangle(201, 47, 168, 20));
    choice2.addItemListener(new SeisInfoFrame_choice2_itemAdapter(this));
    jLabel2.setText("Norwegian National Network");
    jLabel2.setBounds(new Rectangle(202, 27, 168, 15));
    jLabel3.setText("Seiemograms");
    jLabel3.setBounds(new Rectangle(393, 29, 137, 15));
    choice3.setBounds(new Rectangle(391, 46, 175, 20));
    choice3.addItemListener(new SeisInfoFrame_choice3_itemAdapter(this));
    choice4.setBounds(new Rectangle(582, 45, 148, 20));
    choice4.addItemListener(new SeisInfoFrame_choice4_itemAdapter(this));
    jLabel4.setText("Slideshows");
    jLabel4.setBounds(new Rectangle(582, 25, 148, 15));
    button1.setLabel("Save current positions");
    button1.setBounds(new Rectangle(583, 94, 148, 23));
    button1.addActionListener(new SeisInfoFrame_button1_actionAdapter(this));
    contentPane.add(jLabel1, null);
    contentPane.add(choice1, null);
    contentPane.add(choice2, null);
    contentPane.add(jLabel2, null);
    contentPane.add(jLabel3, null);
    contentPane.add(choice3, null);
    contentPane.add(choice4, null);
    contentPane.add(jLabel4, null);
    contentPane.add(button1, null);

  }
  public void Parameterfile()
  {
    try
    {
      BufferedReader bis = new BufferedReader(new FileReader(ParPath+"COORDINATES.txt"));
      System.out.println("File: COORDINATES.txt configured");
      bis.close();
      AutoStart();
    }catch(FileNotFoundException e)
    {
      System.err.println("File Not Found Error: "+ e);
    }
    catch(IOException e)
    {
      System.err.println("I/O Exception");
      System.exit(1);
    }

  }

  public void AutoStart()
{
    int xl=0;
    int yl=0;
    int xm=0;
    int ym=0;
    int ref=0;
    String title=" ";
    String title2=" ";
    String fname=" ";
    String path1=" ";
    String inpu;
    String txt="";
    String t1=" ";
    String t2=" ";
    String t3=" ";
    String t4=" ";
    String dummy=" ";
    int length;

    fname=ParPath+"COORDINATES.txt";

    try
    {
      BufferedReader bis = new BufferedReader(new FileReader(fname));
      System.out.println("File: "+fname+" configured");

      inpu=bis.readLine();
      System.out.println(inpu);
      StringTokenizer st1=new StringTokenizer(inpu);
      while(st1.hasMoreTokens())
      {
          txt=st1.nextToken();
          int ret1=txt.compareTo("USGS");
          if(ret1==0)
          {
              t1=st1.nextToken(); // get XX
              t2=st1.nextToken(); // get YY
              break;
          }
      }
      xl=Integer.parseInt(t1.trim());
      yl=Integer.parseInt(t2.trim());
      if(xl >= 0 && yl >= 0)
      {
        USGS=true;
        usgs = new USGSFrame(usgspath1,usgspath2,usgstitle,30,10,10);
        usgs.setSize(scrwidth/2,scrheight/2);
        usgs.setLocation(xl,yl);
        usgs.setVisible(true);
        usgs.setTitle("                             "+usgstitle);
        usgs.CrtImg();
        usgs.StartUSGS();
      }
      inpu=bis.readLine();
      System.out.println(inpu);
      StringTokenizer st2=new StringTokenizer(inpu);
      while(st2.hasMoreTokens())
      {
          txt=st2.nextToken();
          int ret2=txt.compareTo("WLAST");
          if(ret2==0)
          {
              t1=st2.nextToken(); // get XX
              t2=st2.nextToken(); // get YY
              break;
          }
      }
      xl=Integer.parseInt(t1.trim());
      yl=Integer.parseInt(t2.trim());
      if(xl >= 0 && yl >= 0)
      {
        WLAST=true;
        wlastframe = new WLastFrame(wlastpath1,wlastpath2,wlasttitle,30);
        wlastframe.setSize(scrwidth/2,scrheight/2);
        wlastframe.setLocation(xl,yl);
        wlastframe.setVisible(true);
        wlastframe.setTitle("                   "+wlasttitle);
        wlastframe.CrtImg();
        wlastframe.StartWLAST();
      }
      inpu=bis.readLine();
      System.out.println(inpu);
      StringTokenizer st3=new StringTokenizer(inpu);
      while(st3.hasMoreTokens())
      {
          txt=st3.nextToken();
          int ret2=txt.compareTo("LAST10");
          if(ret2==0)
          {
              t1=st3.nextToken(); // get XX
              t2=st3.nextToken(); // get YY
              break;
          }
      }
      xl=Integer.parseInt(t1.trim());
      yl=Integer.parseInt(t2.trim());
      if(xl >= 0 && yl >= 0)
      {
        LAST10=true;
        last10events = new Last10Frame(wnsnpath1,wnsntitle,30);
        last10events.setSize(scrwidth/2,scrheight/2);
        last10events.setLocation(xl,yl);
        last10events.setVisible(true);
        last10events.setTitle("                   "+wnsntitle);
        last10events.CrtImg();
        last10events.StartWNSN10();
      }
        inpu=bis.readLine();
        System.out.println(inpu);
        StringTokenizer st4=new StringTokenizer(inpu);
        while(st4.hasMoreTokens())
        {
            txt=st4.nextToken();
            int ret2=txt.compareTo("RECENT");
            if(ret2==0)
            {
                t1=st4.nextToken(); // get XX
                t2=st4.nextToken(); // get YY
                break;
            }
        }
        xl=Integer.parseInt(t1.trim());
        yl=Integer.parseInt(t2.trim());
      if(xl >= 0 && yl >= 0)
      {
        RECENT=true;
        recentframe = new RecentFrame(recentpath1,recentpath2,recenttitle,30);
        recentframe.setSize(scrwidth/2,scrheight/2);
        recentframe.setBackground(Color.white);
        recentframe.setLocation(xl,yl);
        recentframe.setVisible(true);
        recentframe.setTitle("                        "+recenttitle);
        recentframe.CrtImg();
        recentframe.StartRECENT();

      }
      inpu=bis.readLine();
      System.out.println(inpu);
      StringTokenizer st5=new StringTokenizer(inpu);
      while(st5.hasMoreTokens())
      {
          txt=st5.nextToken();
          int ret2=txt.compareTo("SLIDE1");
          if(ret2==0)
          {
              t1=st5.nextToken(); // get XX
              t2=st5.nextToken(); // get YY
              break;
          }
      }
      xl=Integer.parseInt(t1.trim());
      yl=Integer.parseInt(t2.trim());
      if(xl >= 0 && yl >= 0)
      {
        SLIDE1=true;
        int nr=1;
        slideshowframe1 = new SlideShowFrame(nr,show1,"Earthquake");
        slideshowframe1.setSize(scrwidth/2,scrheight/2);
        slideshowframe1.setBackground(Color.black);
        slideshowframe1.setLocation(xl,yl);
        slideshowframe1.setVisible(true);
        slideshowframe1.CrtImg();
        slideshowframe1.StartShow();
      }
      inpu=bis.readLine();
      System.out.println(inpu);
      StringTokenizer st6=new StringTokenizer(inpu);
      while(st6.hasMoreTokens())
      {
          txt=st6.nextToken();
          int ret2=txt.compareTo("SLIDE2");
          if(ret2==0)
          {
              t1=st6.nextToken(); // get XX
              t2=st6.nextToken(); // get YY
              break;
          }
      }
      xl=Integer.parseInt(t1.trim());
      yl=Integer.parseInt(t2.trim());
      if(xl >= 0 && yl >= 0)
      {
        SLIDE2=true;
        int nr=2;
        slideshowframe2 = new SlideShowFrame(nr,show2,"Instrumentation");
        slideshowframe2.setSize(scrwidth/2,scrheight/2);
        slideshowframe2.setBackground(Color.black);
        slideshowframe2.setLocation(xl,yl);
        slideshowframe2.setVisible(true);
        slideshowframe2.CrtImg();
        slideshowframe2.StartShow();

      }
      inpu=bis.readLine();
      System.out.println(inpu);
      StringTokenizer st7=new StringTokenizer(inpu);
      while(st7.hasMoreTokens())
      {
          txt=st7.nextToken();
          int ret2=txt.compareTo("USGS24_1");
          if(ret2==0)
          {
              t1=st7.nextToken(); // get XX
              t2=st7.nextToken(); // get YY
              usgs24p1=st7.nextToken();
              st7.nextToken();
              usgs24hd1=st7.nextToken();
              while(st7.hasMoreTokens())
              {
                usgs24hd1 = usgs24hd1 + st7.nextToken();
              }
              break;
          }
      }
      xl=Integer.parseInt(t1.trim());
      yl=Integer.parseInt(t2.trim());
      if(xl >= 0 && yl >= 0)
      {
        USGS24_1=true;
        usgs24_1 = new USGS24Frame(1,usgs24p1,"24-hour",30);
        usgs24_1.setSize(scrwidth/2,scrheight/2);
        usgs24_1.setLocation(xl,yl);
        usgs24_1.setVisible(true);
        usgs24_1.setTitle("                 "+usgs24hd1);
        usgs24_1.CrtImg();
        usgs24_1.StartUSGS24();

      }
      inpu=bis.readLine();
      System.out.println(inpu);
      StringTokenizer st8=new StringTokenizer(inpu);
      while(st8.hasMoreTokens())
      {
          txt=st8.nextToken();
          int ret2=txt.compareTo("USGS24_2");
          if(ret2==0)
          {
              t1=st8.nextToken(); // get XX
              t2=st8.nextToken(); // get YY
              usgs24p2=st8.nextToken();
              st8.nextToken();
              usgs24hd2=st8.nextToken();
              while(st8.hasMoreTokens())
              {
                usgs24hd2 = usgs24hd2 + st8.nextToken();
              }
              break;
          }
      }
      xl=Integer.parseInt(t1.trim());
      yl=Integer.parseInt(t2.trim());
      if(xl >= 0 && yl >= 0)
      {
        USGS24_2=true;
        usgs24_2 = new USGS24Frame(2,usgs24p2,"24-hour",30);
        usgs24_2.setSize(scrwidth/2,scrheight/2);
        usgs24_2.setLocation(xl,yl);
        usgs24_2.setVisible(true);
        usgs24_2.setTitle("                 "+usgs24hd2);
        usgs24_2.CrtImg();
        usgs24_2.StartUSGS24();

      }
      inpu=bis.readLine();
      System.out.println(inpu);
      StringTokenizer st9=new StringTokenizer(inpu);
      while(st9.hasMoreTokens())
      {
          txt=st9.nextToken();
          int ret2=txt.compareTo("USGS24_3");
          if(ret2==0)
          {
              t1=st9.nextToken(); // get XX
              t2=st9.nextToken(); // get YY
              usgs24p3=st9.nextToken();
              st9.nextToken();
              usgs24hd3=st9.nextToken();
              while(st9.hasMoreTokens())
              {
                usgs24hd3 = usgs24hd3 + st9.nextToken();
              }
              break;
          }
      }
      xl=Integer.parseInt(t1.trim());
      yl=Integer.parseInt(t2.trim());
      if(xl >= 0 && yl >= 0)
      {
        USGS24_3=true;
        usgs24_3 = new USGS24Frame(3,usgs24p3,"24-hour",30);
        usgs24_3.setSize(scrwidth/2,scrheight/2);
        usgs24_3.setLocation(xl,yl);
        usgs24_3.setVisible(true);
        usgs24_3.setTitle("                 "+usgs24hd3);
        usgs24_3.CrtImg();
        usgs24_3.StartUSGS24();

      }
      inpu=bis.readLine();
      System.out.println(inpu);
      StringTokenizer st10=new StringTokenizer(inpu);
      while(st10.hasMoreTokens())
      {
          txt=st10.nextToken();
          int ret2=txt.compareTo("USGS24_4");
          if(ret2==0)
          {
              t1=st10.nextToken(); // get XX
              t2=st10.nextToken(); // get YY
              usgs24p4=st10.nextToken();
              st10.nextToken();
              usgs24hd4=st10.nextToken();
              while(st10.hasMoreTokens())
              {
                usgs24hd4 = usgs24hd4 + st10.nextToken();
              }
              break;
          }
      }
      xl=Integer.parseInt(t1.trim());
      yl=Integer.parseInt(t2.trim());
      if(xl >= 0 && yl >= 0)
      {
        USGS24_4=true;
        usgs24_4 = new USGS24Frame(4,usgs24p4,"24-hour",30);
        usgs24_4.setSize(scrwidth/2,scrheight/2);
        usgs24_4.setLocation(xl,yl);
        usgs24_4.setVisible(true);
        usgs24_4.setTitle("                 "+usgs24hd4);
        usgs24_4.CrtImg();
        usgs24_4.StartUSGS24();

      }

      bis.close();
    }catch(FileNotFoundException e)
    {
        System.err.println("File Not Found Error: "+ e);
//        System.exit(1);
    }
    catch(IOException e)
    {
        System.err.println("I/O Exception");
//        System.exit(1);
    }

}


  //Overridden so we can exit when window is closed
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      System.exit(0);
    }
  }
//---------------------------------------------------------------------
// Item selected in USGS Worldwide seismicity
//---------------------------------------------------------------------
  void choice1_itemStateChanged(ItemEvent e) {
  System.out.println("CHOICE!");
  // Add your handling code here:
  int cnt=choice1.getSelectedIndex();
  System.out.println(cnt);
  switch(cnt)
  {
    case 0:                // start USGS
    USGS=true;
    usgs = new USGSFrame(usgspath1,usgspath2,usgstitle,30,10,10);
    usgs.setSize(scrwidth/2,scrheight/2);
    usgs.setLocation(0,0);
    usgs.setVisible(true);
    usgs.setTitle("                             "+usgstitle);
    usgs.CrtImg();
    usgs.StartUSGS();
    break;
    case 1:                // start USGS Last Earthquake
    WLAST=true;
    wlastframe = new WLastFrame(wlastpath1,wlastpath2,wlasttitle,30);
    wlastframe.setSize(scrwidth/2,scrheight/2);
    wlastframe.setLocation(scrwidth/2,0);
    wlastframe.setVisible(true);
    wlastframe.setTitle("                   "+wlasttitle);
    wlastframe.CrtImg();
    wlastframe.StartWLAST();
    break;
  }
  }
//---------------------------------------------------------------------
// Item selected in Seismograms
//---------------------------------------------------------------------
  void choice3_itemStateChanged(ItemEvent e) {
    int cnt=choice3.getSelectedIndex();
    String heading=choice3.getSelectedItem();
    System.out.println(cnt);
    switch(cnt)
    {
      case 0:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/BJT_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/BJT_24hr.html";
      break;
      case 1:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/ENH_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/ENH_24hr.html";
       break;
      case 2:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/HIA_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/HIA_24hr.html";
      break;
      case 3:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/KMI_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/KMI_24hr.html";
      break;
      case 4:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/LSA_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/LSA_24hr.html";
      break;
      case 5:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/MDJ_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/MDJ_24hr.html";
      break;
      case 6:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/SSE_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/SSE_24hr.html";
      break;
      case 7:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/QIZ_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/QIZ_24hr.html";
      break;
      case 8:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/WMQ_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/WMQ_24hr.html";
      break;
      case 9:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/XAN_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/XAN_24hr.html";
      break;
      case 10:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/ADK_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/ADK_24hr.html";
      break;
      case 11:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/ANMO_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/ANMO_24hr.html";
      break;
      case 12:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/ANTO_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/ANTO_24hr.html";
      break;
      case 13:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/BBSR_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/BBSR_24hr.html";
      break;
      case 14:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/BILL_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/BILL_24hr.html";
      break;
      case 15:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/CASY_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/CASY_24hr.html";
      break;
      case 16:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/CCM_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/CCM_24hr.html";
      break;
      case 17:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/COLA_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/COLA_24hr.html";
      break;
      case 18:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/CTAO_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/CTAO_24hr.html";
      break;
      case 19:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/DWPF_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/DWPF_24hr.html";
      break;
      case 20:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/COR_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/COR_24hr.html";
      break;
      case 21:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/GNI_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/GNI_24hr.html";
      break;
      case 22:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/GUMO_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/GUMO_24hr.html";
      break;
      case 23:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/HKT_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/HKT_24hr.html";
      break;
      case 24:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/HRV_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/HRV_24hr.html";
      break;
      case 25:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/INCN_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/INCN_24hr.html";
      break;
      case 26:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/KBS_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/KBS_24hr.html";
      break;
      case 27:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/KIP_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/KIP_24hr.html";
      break;
      case 28:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/KMBO_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/KMBO_24hr.html";
      break;
      case 29:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/KONO_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/KONO_24hr.html";
      break;
      case 30:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/LSZ_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/LSZ_24hr.html";
      break;
      case 31:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/LVC_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/LVC_24hr.html";
      break;
      case 32:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/MA2_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/MA2_24hr.html";
      break;
      case 33:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/MAJO_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/MAJO_24hr.html";
      break;
      case 34:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/MBWA_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/MBWA_24hr.html";
      break;
      case 35:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/MIDW_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/MIDW_24hr.html";
      break;
      case 36:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/MSKU_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/MSKU_24hr.html";
      break;
      case 37:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/NWAO_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/NWAO_24hr.html";
      break;
      case 38:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/OTAV_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/OTAV_24hr.html";
      break;
      case 39:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/PAYG_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/PAYG_24hr.html";
      break;
      case 40:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/PET_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/PET_24hr.html";
      break;
      case 41:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/PMG_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/PMG_24hr.html";
      break;
      case 42:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/PMSA_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/PMSA_24hr.html";
      break;
      case 43:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/POHA_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/POHA_24hr.html";
      break;
      case 44:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/PTCN_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/PTCN_24hr.html";
      break;
      case 45:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/PTGA_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/PTGA_24hr.html";
      break;
      case 46:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/QSPA_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/QSPA_24hr.html";
      break;
      case 47:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/RAR_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/RAR_24hr.html";
      break;
      case 48:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/RCBR_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/RCBR_24hr.html";
      break;
      case 49:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/RSSD_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/RSSD_24hr.html";
      break;
      case 50:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/SAML_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/SAML_24hr.html";
      break;
      case 51:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/SBA_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/SBA_24hr.html";
      break;
      case 52:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/SJG_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/SJG_24hr.html";
      break;
      case 53:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/SNZO_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/SNZO_24hr.html";
      break;
      case 54:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/SPA_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/SPA_24hr.html";
      break;
      case 55:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/SSPA_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/SSPA_24hr.html";
      break;
      case 56:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/TATO_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/TATO_24hr.html";
      break;
      case 57:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/TIXI_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/TIXI_24hr.html";
      break;
      case 58:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/TRQA_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/TRQA_24hr.html";
      break;
      case 59:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/TSUM_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/TSUM_24hr.html";
      break;
      case 60:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/TUC_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/TUC_24hr.html";
      break;
      case 61:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/ULN_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/ULN_24hr.html";
      break;
      case 62:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/WAKE_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/WAKE_24hr.html";
      break;
      case 63:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/WCI_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/WCI_24hr.html";
      break;
      case 64:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/WVT_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/WVT_24hr.html";
      break;
      case 65:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/YAK_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/YAK_24hr.html";
      break;
      case 66:
      usgs24p1="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/YSS_24hr.gif";
      usgs24p2="http://aslwww.cr.usgs.gov/Seismic_Data/telemetry_data/YSS_24hr.html";
      break;

    }
    usgs24_counter++;
    switch(usgs24_counter)
    {
      case 1:
      USGS24_1=true;
      usgs24p1_1=usgs24p1;
      usgs24hd1=heading;
      usgs24_1 = new USGS24Frame(1,usgs24p1,"24-hour",30);
      usgs24_1.setSize(scrwidth/2,scrheight/2);
      usgs24_1.setLocation(0,scrheight/2);
      usgs24_1.setVisible(true);
      usgs24_1.setTitle("                 "+heading);
      usgs24_1.CrtImg();
      usgs24_1.StartUSGS24();
      break;
      case 2:
      USGS24_2=true;
      usgs24p1_2=usgs24p1;
      usgs24hd2=heading;
      usgs24_2 = new USGS24Frame(2,usgs24p1,"24-hour",30);
      usgs24_2.setSize(scrwidth/2,scrheight/2);
      usgs24_2.setLocation(0,scrheight/2);
      usgs24_2.setVisible(true);
      usgs24_2.setTitle("                 "+heading);
      usgs24_2.CrtImg();
      usgs24_2.StartUSGS24();
      break;
      case 3:
      USGS24_3=true;
      usgs24p1_3=usgs24p1;
      usgs24hd3=heading;
      usgs24_3 = new USGS24Frame(3,usgs24p1,"24-hour",30);
      usgs24_3.setSize(scrwidth/2,scrheight/2);
      usgs24_3.setLocation(0,scrheight/2);
      usgs24_3.setVisible(true);
      usgs24_3.setTitle("                 "+heading);
      usgs24_3.CrtImg();
      usgs24_3.StartUSGS24();
      break;
      case 4:
      USGS24_4=true;
      usgs24p1_4=usgs24p1;
      usgs24hd1=heading;
      usgs24_4 = new USGS24Frame(4,usgs24p1,"24-hour",30);
      usgs24_4.setSize(scrwidth/2,scrheight/2);
      usgs24_4.setLocation(0,scrheight/2);
      usgs24_4.setVisible(true);
      usgs24_4.setTitle("                 "+heading);
      usgs24_4.CrtImg();
      usgs24_4.StartUSGS24();
      break;

    }

  }
//---------------------------------------------------------------------
// Item selected in Norwegian National Network
//---------------------------------------------------------------------
  void choice2_itemStateChanged(ItemEvent e) {
    int cnt=choice2.getSelectedIndex();
    System.out.println(cnt);
    switch(cnt)
    {
      case 0:
      LAST10=true;
      last10events = new Last10Frame(wnsnpath1,wnsntitle,30);
      last10events.setSize(scrwidth/2,scrheight/2);
      last10events.setLocation(0,0);
      last10events.setVisible(true);
      last10events.setTitle("                   "+wnsntitle);
      last10events.CrtImg();
      last10events.StartWNSN10();
      break;
      case 1:
      RECENT=true;
      recentframe = new RecentFrame(recentpath1,recentpath2,recenttitle,30);
      recentframe.setSize(scrwidth/2,scrheight/2);
      recentframe.setBackground(Color.white);
      recentframe.setLocation(0,0);
      recentframe.setVisible(true);
      recentframe.setTitle("                        "+recenttitle);
      recentframe.CrtImg();
      recentframe.StartRECENT();
      break;
    }

  }
//---------------------------------------------------------------------
// Item selected in Slideshows
//---------------------------------------------------------------------
  void choice4_itemStateChanged(ItemEvent e) {
    int ret;
    int nr=0;
String showtitle=choice4.getSelectedItem();
System.out.println(showtitle);
ret=showtitle.compareTo("Earthquake");
if(ret==0)
{
      SLIDE1=true;
      nr=1;
      slideshowframe1 = new SlideShowFrame(nr,show1,showtitle);
      slideshowframe1.setSize(scrwidth/2,scrheight/2);
      slideshowframe1.setBackground(Color.black);
      slideshowframe1.setLocation(0,0);
      slideshowframe1.setVisible(true);
      slideshowframe1.CrtImg();
      slideshowframe1.StartShow();
    }
ret=showtitle.compareTo("Instrumentation");
if(ret==0)
{
      SLIDE2=true;
      nr=2;
      slideshowframe2 = new SlideShowFrame(nr,show2,showtitle);
      slideshowframe2.setSize(scrwidth/2,scrheight/2);
      slideshowframe2.setBackground(Color.black);
      slideshowframe2.setLocation(0,0);
      slideshowframe2.setVisible(true);
      slideshowframe2.CrtImg();
      slideshowframe2.StartShow();
    }

  }
//---------------------------------------------------------------------
// Save positions
//---------------------------------------------------------------------

  void button1_actionPerformed(ActionEvent e) {
//    saveposframe = new SavePosFrame();
    String xy_usgs24_1="-1";
    String xy_usgs24_2="-1";
    String xy_usgs24_3="-1";
    String xy_usgs24_4="-1";
    if(USGS == true)
    {
      xpos[0]=usgs.LocX();
      ypos[0]=usgs.LocY();
    }else{
      xpos[0]=-1;
      ypos[0]=-1;
    }
    if(WLAST == true)
    {
      xpos[1]=wlastframe.LocX();
      ypos[1]=wlastframe.LocY();
    }else{
      xpos[1]=-1;
      ypos[1]=-1;
    }
    if(LAST10 == true)
    {
      xpos[2]=last10events.LocX();
      ypos[2]=last10events.LocY();
    }else{
      xpos[2]=-1;
      ypos[2]=-1;
    }
    if(RECENT == true)
    {
      xpos[3]=recentframe.LocX();
      ypos[3]=recentframe.LocY();
    }else{
      xpos[3]=-1;
      ypos[3]=-1;
    }
    if(SLIDE1 == true)
    {
      xpos[4]=slideshowframe1.LocX();
      ypos[4]=slideshowframe1.LocY();
    }else{
      xpos[4]=-1;
      ypos[4]=-1;
    }
    if(SLIDE2 == true)
    {
      xpos[5]=slideshowframe2.LocX();
      ypos[5]=slideshowframe2.LocY();
    }else{
      xpos[5]=-1;
      ypos[5]=-1;
    }







    String xy_usgs  ="USGS "  +Integer.toString(xpos[0])+" "+Integer.toString(ypos[0]);
    String xy_wlast ="WLAST " +Integer.toString(xpos[1])+" "+Integer.toString(ypos[1]);
    String xy_last10="LAST10 "+Integer.toString(xpos[2])+" "+Integer.toString(ypos[2]);
    String xy_recent="RECENT "+Integer.toString(xpos[3])+" "+Integer.toString(ypos[3]);
    String xy_slide1="SLIDE1 "+Integer.toString(xpos[4])+" "+Integer.toString(ypos[4]);
    String xy_slide2="SLIDE2 "+Integer.toString(xpos[5])+" "+Integer.toString(ypos[5]);





    for(int i=0;i<7;i++)
    {
      System.out.println(i+" "+xpos[i]+","+ypos[i]);
    }
    String FileName=" ";
    FileName=ParPath+"COORDINATES.txt";


    try
    {
      PrintWriter pos = new PrintWriter(new BufferedWriter(new FileWriter(FileName)));
      pos.write(xy_usgs);
      pos.println();
      pos.write(xy_wlast);
      pos.println();
      pos.write(xy_last10);
      pos.println();
      pos.write(xy_recent);
      pos.println();
      pos.write(xy_slide1);
      pos.println();
      pos.write(xy_slide2);
      pos.println();

      if(USGS24_1 == true)
      {
        xpos[6]=usgs24_1.LocX();
        ypos[6]=usgs24_1.LocY();
        xy_usgs24_1="USGS24_1 "+Integer.toString(xpos[6])+" "+Integer.toString(ypos[6])+" "+usgs24p1_1+" "+usgs24p1+" "+usgs24hd1;
      }else{
        xpos[6]=-1;
        ypos[6]=-1;
        xy_usgs24_1="USGS24_1 -1 -1 -1 -1 -1";
      }


      pos.write(xy_usgs24_1);
      pos.println();

      if(USGS24_2 == true)
      {
        xpos[7]=usgs24_2.LocX();
        ypos[7]=usgs24_2.LocY();
        xy_usgs24_2="USGS24_2 "+Integer.toString(xpos[7])+" "+Integer.toString(ypos[7])+" "+usgs24p1_2+" "+usgs24p2+" "+usgs24hd2;
      }else{
        xpos[7]=-1;
        ypos[7]=-1;
        xy_usgs24_2="USGS24_2 -1 -1 -1 -1 -1";
      }


      pos.write(xy_usgs24_2);
      pos.println();

      if(USGS24_3 == true)
      {

        xpos[8]=usgs24_3.LocX();
        ypos[8]=usgs24_3.LocY();
        xy_usgs24_3="USGS24_3 "+Integer.toString(xpos[8])+" "+Integer.toString(ypos[8])+" "+usgs24p1_3+" "+usgs24p3+" "+usgs24hd3;
      }else{
        xpos[8]=-1;
        ypos[8]=-1;
        xy_usgs24_3="USGS24_3 -1 -1 -1 -1 -1";
      }


      pos.write(xy_usgs24_3);
      pos.println();

      if(USGS24_4 == true)
      {
        xpos[9]=usgs24_4.LocX();
        ypos[9]=usgs24_4.LocY();
        xy_usgs24_4="USGS24_4 "+Integer.toString(xpos[9])+" "+Integer.toString(ypos[9])+" "+usgs24p1_4+" "+usgs24p4+" "+usgs24hd4;
      }else{
        xpos[9]=-1;
        ypos[9]=-1;
        xy_usgs24_4="USGS24_4 -1 -1 -1 -1 -1";
      }


      pos.write(xy_usgs24_4);
      pos.println();

      pos.close();
    }catch(IOException f)
    {
      System.err.println("I/O Exception");
      System.exit(1);
    }
     usgs24_counter=0;
  }


}




class SeisInfoFrame_choice1_itemAdapter implements java.awt.event.ItemListener {
  SeisInfoFrame adaptee;

  SeisInfoFrame_choice1_itemAdapter(SeisInfoFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void itemStateChanged(ItemEvent e) {
    adaptee.choice1_itemStateChanged(e);
  }
}

class SeisInfoFrame_choice3_itemAdapter implements java.awt.event.ItemListener {
  SeisInfoFrame adaptee;

  SeisInfoFrame_choice3_itemAdapter(SeisInfoFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void itemStateChanged(ItemEvent e) {
    adaptee.choice3_itemStateChanged(e);
  }
}

class SeisInfoFrame_choice2_itemAdapter implements java.awt.event.ItemListener {
  SeisInfoFrame adaptee;

  SeisInfoFrame_choice2_itemAdapter(SeisInfoFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void itemStateChanged(ItemEvent e) {
    adaptee.choice2_itemStateChanged(e);
  }
}

class SeisInfoFrame_choice4_itemAdapter implements java.awt.event.ItemListener {
  SeisInfoFrame adaptee;

  SeisInfoFrame_choice4_itemAdapter(SeisInfoFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void itemStateChanged(ItemEvent e) {
    adaptee.choice4_itemStateChanged(e);
  }
}

class SeisInfoFrame_button1_actionAdapter implements java.awt.event.ActionListener {
  SeisInfoFrame adaptee;

  SeisInfoFrame_button1_actionAdapter(SeisInfoFrame adaptee) {
    this.adaptee = adaptee;
  }
  public void actionPerformed(ActionEvent e) {
    adaptee.button1_actionPerformed(e);
  }
}
