function WindowOpen(owURL, owWidth, owHeight) {
aWindow = window.open(owURL, "thewindow", "width=" + owWidth + ",height=" + owHeight + ",scrollbars=yes,resize=yes,alwaysRaised=yes");
}

function MenuButton_GetDir(FileName) {
    return (stButtonDir + "/" + FileName);
}

function MenuButton_Link()
{
    St = "<a href=\"" + this.htmlFile + "\"  "
        + "OnMouseOver=\"Button['" + this.ButtonName + "\'].On()\" "
        + "OnMouseOut=\"Button['" + this.ButtonName + "\'].Off()\" "
        + "OnClick=\"Button['" + this.ButtonName + "\'].Pressed()\" "
	+ ">"
	+ "<img name=\"" + this.ButtonName + "\"  "
	+ " border=\"0\" height=\"" + this.Height + "\" " + " width=\"" + this.Width + "\" "
	+ " src=\"" + MenuButton_GetDir(this.ButtonName + "-off.gif") + "\""
	+ "></a>";

    document.write(St);

}

function MenuButton_On ()
{
        document[this.ButtonName].src = this.imgOn.src;
}

function MenuButton_Off ()
{
     document[this.ButtonName].src = this.imgOff.src;
}

function MenuButton_Pressed()
{
     document[this.ButtonName].src = this.imgOff.src;
}

function MenuButton_Released()
{
     document[this.ButtonName].src = this.imgOff.src;
}

function MenuButton_Unavailable()
{
     document[this.ButtonName].src = this.imgOff.src;
}


function MenuButton(mbButtonName, mbHeight, mbWidth, mbhtmlFile) {
    this.Width = mbWidth;
    this.Height =  mbHeight;
    this.ButtonName = mbButtonName;
    this.imgOn = new Image(mbHeight, mbWidth);
    this.imgOn.src = MenuButton_GetDir(mbButtonName + "-on.gif");
    this.imgOff = new Image(mbHeight, mbWidth);
    this.imgOff.src = MenuButton_GetDir(mbButtonName + "-off.gif");
    this.imgPressed = new Image(mbHeight, mbWidth);
    this.imgPressed.scr = MenuButton_GetDir(mbButtonName + "-pre.gif");
    this.imgReleased = new Image(mbHeight, mbWidth);
    this.imgReleased.scr = MenuButton_GetDir(mbButtonName + "-rel.gif");
    this.imgUnavailable = new Image(mbHeight, mbWidth);
    this.imgUnavailable.scr = MenuButton_GetDir (mbButtonName + "-un.gif");

    this.htmlFile = mbhtmlFile;
    
    this.WriteLink = MenuButton_Link;

    this.On = MenuButton_On;
    this.Off = MenuButton_Off;
    this.Pressed = MenuButton_Pressed;
    this.Released = MenuButton_Released;
    this.Unavailable = MenuButton_Unavailable;
}

function MenuObject_SetRotImage(riName, riHeight, riWidth, riImagePath)
{
	this.imgRotName = riName;
	this.imgRotDef = new Image(riHeight, riWidth);
	this.imgRotDef.src = riImagePath;
}

function MenuObject_SetButton(mbButtonName, mbHeight, mbWidth, mbhtmlFile)
{
    this.Button[mbButtonName] = new MenuButton(mbButtonName, mbHeight, mbWidth, mbhtmlFile);
}

function MenuObject(mX, mY, mNumButtons, mHomeURL, mButtonDir)
{
	this.X = mX;
	this.Y = mY;
	this.NumButtons = mNumButtons;
	this.HomeURL = mHomeURL;
	this.Button = Array(mNumButtons);
        this.ButtonDir = mButtonDir;
	stButtonDir = mButtonDir;
	this.SetButton = MenuObject_SetButton;
	this.SetRotImage = MenuObject_SetRotImage;
}
