// Copyright 23 Oct 1999, Cavalry Outpost Publications.

// This multifunction program:
//      1.0 Positions and loads a remote "PopUp Window" which displays
//          a specific Weapon System selected from a listing of the
//          "OutDoor" Exhibit of the 1st Cavalry Division Museum. 
// *********************************************************************
// **********     Program Name = Exhibits.js Ver 03.11.30     **********
// *********************************************************************

// 1.0 DEFINE SCREEN and EXHIBIT WINDOW PARAMETERS

// 1.1 Define Screen Coordinates
var ScrollbarWidth = 22;
var exhibitWinframeWidth = 6;
var xMax = screen.availWidth;

// 1.2 Define Screen and remoteWinParameters
var exhibitWin = "";
var exhibitWinWidth = 475, exhibitWinHeight = 425;
var xOffset = ((xMax - ScrollbarWidth) - (exhibitWinWidth + 2*exhibitWinframeWidth))/2;
var exhibitWinParameters = 'resizable=1,width='+exhibitWinWidth+',height='+exhibitWinHeight+',screenX='+xOffset+',left='+xOffset+',screenY=0,top=0';

// 1.3 Identify "name" and "value" selection
    function select_item(name, value) {
        this.name = name;
        this.value = value;
    }

// 1.4 Define get_selection function
    function get_selection(select_object) {
        contents = new select_item();
        for(var i=0;i<select_object.options.length; i++)
            if(select_object.options[i].selected == true) {
                contents.name = select_object.options[i].text;
                contents.value = select_object.options[i].value;
            }
        return contents;
    }

// 2.0  OPEN REMOTE EXHIBIT WINDOW AND WRITE HTML SYNTAX
function openExhibitWin(formfield) {
        selection = get_selection(formfield.exhibitItem);
        
        exhibitWin = window.open('','Historical_Vehicle_Exhibit', exhibitWinParameters);
        exhibitWin.document.open();
        exhibitWin.document.write('<HTML>');
        exhibitWin.document.write('<HEAD><TITLE>Historical Vehicle Exhibit</TITLE></HEAD>');
        exhibitWin.document.write('<BODY BACKGROUND="1st_bkgd.gif" BGCOLOR="AFFFFF" TEXT="000000" onBlur="self.focus()">');
        exhibitWin.document.write('<P><CENTER><STRONG>' + selection.name);
        exhibitWin.document.write('<TABLE BORDER="5"><TR><TD>');
        exhibitWin.document.write('<IMG SRC="exhibits/' + selection.value + '.jpg" WIDTH="300" HEIGHT="200" HSPACE="3" VSPACE="3">');
        exhibitWin.document.write('</TD></TR></TABLE><BR CLEAR="ALL"></P>');

        exhibitWin.document.write('<P><IMG SRC="point_r.gif" WIDTH="60" HEIGHT="30" ALIGN="TOP">');
        exhibitWin.document.write('<A HREF="exhibits/' + selection.value + '.html"> Historical Background Data </A>');
        exhibitWin.document.write('<IMG SRC="point_l.gif" WIDTH="60" HEIGHT="30" ALIGN="TOP">');
        
        exhibitWin.document.write('<FORM><FONT COLOR="FF0000">');
        exhibitWin.document.write('Close window prior <INPUT TYPE="button" VALUE="Close" onClick="window.close()"> to next selection.');
        exhibitWin.document.write('</FONT></FORM>');
        exhibitWin.document.write('</STRONG></CENTER></BODY></HTML>');
        exhibitWin.document.close();
}

// 3.0 LOAD EXHIBIT WINDOW (enable this function to auto load with host page)
// openExhibitWin();

// 4.0 CLOSE EXHIBIT WINDOW
function closeExhibitWin() {
        var sLocType
        if (exhibitWin) {
                if (!exhibitWin.closed) {
                        sLocType = typeof exhibitWin.location;
                        if (sLocType == 'object') {
                                exhibitWin.close();
                        }
                }
        }

}

