var path = "./";
var selected;
var lastChoice;
var lastSubChoice;
var subSelected;

function Highlight( mainName, subName ){
  if (mainName != null ) {
    document.images[ mainName ].src = path + "images/" + mainName + "_hl.gif";
    lastChoice = mainName;
  }

  if (subName != null ) {
    document.images[ subName ].src = path + "images/" + subName + "_hl.gif";
    lastSubChoice = subName;
  }
}

function HighlightMain( myName ) {
  Unhighlight( lastChoice );
  Unhighlight( lastSubChoice );
  Highlight( myName, subSelected );
}

function HighlightSub( subName ){
  Unhighlight( lastSubChoice );
  Unhighlight( lastChoice );
  Highlight( selected, subName );
}

function Unhighlight( myName ){
  if( myName != null ) {
    document.images[ myName ].src = path + "images/" + myName + ".gif";
  }
}

function Initialize( myPath, myName, subName ){
  selected = myName;
  subSelected = subName;
  lastChoice = null;
  lastSubChoice = null;
  path = myPath;
  Highlight( myName, subName );
}

function ExitMainMenu( ){
  HighlightMain( selected );
}

function ExitSubMenu( ){
  HighlightSub( subSelected );
}

function winOpen(myURL) {
  var popupWin = window.open( "", "InfoWindow", 
               "toolbar=0,menubar=1,scrollbars=1,status=1,resizable=1");
  popupWin.focus();
  popupWin.location = myURL;
}


function OpenPanoramic(myURL) {
  var popupWin = window.open( "", "PanoramicWindow", 
               "width=1024,height=410,toolbar=0,menubar=1,scrollbars=1,status=1,resizable=1");
  popupWin.focus();
  popupWin.location = myURL;
}
