/**
* The menu which appears to the left of the screen. It stores
* items that react on the speci
* The menu which appears to the left of the screen. It stores
* items that react on the specified mouse events.
*/
var selection;
var DATABASE = "/C1256F0A0048C79A";
var CELL_LEFT_COLOR = "rgb(248,248,247)";
var CELL_LEFT_COLOR_SELECTED = "rgb(203, 57, 6)";
var CELL_LEFT_COLOR_MO = "rgb(165, 186, 213)";
var CELL_MIDDLE_COLOR = "rgb(248,248,247)";
var CELL_MIDDLE_COLOR_SELECTED = "rgb(203, 57, 6)";
var CELL_MIDDLE_COLOR_MO = "rgb(165, 186, 213)";
var TEXT_COLOR = "rgb(0,0,0)";
var TEXT_COLOR_SELECTED = "rgb(255,255,255)";
var CELL_RIGHT_COLOR = "rgb(248,248,247)"
var CELL_RIGHT_COLOR_SELECTED = "rgb(203, 57, 6)"
var CELL_RIGHT_COLOR_MO = "rgb(165, 186, 213)";
var LEFT_COLUMN_WIDTH = 10;
/**
* Creates a new MenuDown object.
* @param _width the width of the menu.
* @param _cellHeight the height of a cell.
*/
function MenuDown2( _width, _cellHeight )
{
this.items = 0; // reset the number of items in the menu
this.width = _width;
this.cellHeight = _cellHeight;
this.appItem = appendItem;
this.hghltItem = highlightItem;
this.clrItem = clearItem;
this.choseItm = chooseItem;
this.endM = endMenu;
// create the table that represents the menu
// table's header
document.writeln("
");
} // MenuDown
/**
* Appends the the given item to the menu. Append a row in the table
* and insert an entry with the given item.
* @param _itemName the name of the given item.
* @param _id the id of the item.
* @param _documentPath the path of the document which the item should
* be linked to.
*/
function appendItem(_itemName,_id,_documentPath, _smid)
{
// insert a row
document.writeln("");
// insert data in the row
document.write("");
// insert a table inside a cell that divides it into the bullet, text and
// "choice image" section
document.write("");
// cell that contains bullet
document.write("");
document.write("");
document.write(" ");
document.write("");
document.writeln(" | ");
// cell that contains text
document.write("");
document.write(_itemName);
document.writeln(" | ");
// cell that contains "choice image"
document.write("");
var arg = " ");
document.writeln(" | ");
// end item
document.write("");
document.write(" ");
document.write(" | ");
document.write("
");
} // appendItem
/**
* Highlights the given item.
* @param _id the id of the item.
*/
function highlightItem(_id)
{
// highlight the bullet
cellLeft = document.getElementById(_id+"_l");
if (cellLeft)
cellLeft.style.backgroundColor = CELL_LEFT_COLOR_SELECTED;
image = document.getElementById(_id+"_image_l");
if (image)
image.style.visibility = "hidden";
// highlight the text
cellLeft = document.getElementById(_id+"_c");
if (cellLeft){
cellLeft.style.backgroundColor = CELL_MIDDLE_COLOR_SELECTED;
cellLeft.style.color = TEXT_COLOR_SELECTED;
}
// cellLeft.style.fontWeight = "bold";
// make the "choice image" visible
if (cellLeft){
cellLeft = document.getElementById(_id+"_r");
cellLeft.style.backgroundColor = CELL_RIGHT_COLOR_SELECTED;
}
image = document.getElementById(_id+"_image_r");
if (image)
image.style.visibility = "visible";
} // highlightItem
/* highlights the item when mouse is above the item */
function highlightMOItem(_id)
{
// highlight the bullet
cellLeft = document.getElementById(_id+"_l");
if (cellLeft)
cellLeft.style.backgroundColor = CELL_LEFT_COLOR_MO;
image = document.getElementById(_id+"_image_l");
if (image)
image.style.visibility = "hidden";
// highlight the text
cellLeft = document.getElementById(_id+"_c");
if (cellLeft){
cellLeft.style.backgroundColor = CELL_MIDDLE_COLOR_MO;
cellLeft.style.color = TEXT_COLOR_SELECTED;
}
// cellLeft.style.fontWeight = "bold";
// make the "choice image" visible
cellLeft = document.getElementById(_id+"_r");
if (cellLeft)
cellLeft.style.backgroundColor = CELL_RIGHT_COLOR_MO;
image = document.getElementById(_id+"_image_r");
if (image)
image.style.visibility = "visible";
} // highlightItem
/**
* Clears the items. Selected items must be taken
* into consideration as well.
* @param _id the id of the item.
*/
function cclearItem(_id)
{
//if (selection != _id) {
clearItem(_id);
//} // if
} // cclearItem
/**
* Clears the selection of given item.
* @param _id the id of the item.
*/
function clearItem(_id)
{
// make the bullet visible
cellLeft = document.getElementById(_id+"_l");
if (cellLeft){
if (selection != _id)
{
cellLeft.style.backgroundColor = CELL_LEFT_COLOR;
image = document.getElementById(_id+"_image_l");
image.style.visibility = "visible";
}
else
cellLeft.style.backgroundColor = CELL_LEFT_COLOR_SELECTED;
// clear the text
cellLeft = document.getElementById(_id+"_c");
if (selection != _id)
{
cellLeft.style.backgroundColor = CELL_MIDDLE_COLOR;
cellLeft.style.color = TEXT_COLOR;
}
else
cellLeft.style.backgroundColor = CELL_MIDDLE_COLOR_SELECTED;
// cellLeft.style.fontWeight = "normal";
// make the "choice image" invisible
cellLeft = document.getElementById(_id+"_r");
if (selection != _id)
{
cellLeft.style.backgroundColor = CELL_RIGHT_COLOR;
image = document.getElementById(_id+"_image_r");
image.style.visibility = "hidden";
}
else
cellLeft.style.backgroundColor = CELL_RIGHT_COLOR_SELECTED;
}
} // clearItem
/**
* Selects the current item.
* @param _id the id of the current item.
*/
function chooseItem(_id)
{
// clear the selection
if ((selection != null) && (selection != _id)) {
clearItem(selection);
} // if
selection = _id;
} // chooseItem
/**
* Chooses and display the menu item.
* @param _itemName the name of the menu item.
* @param _id the id of the current item.
* @param _documentPath the path of the document.
* @param _smid the sequence number of the menu item.
*/
function displayItem(_itemName,_id,_documentPath, _smid)
{
chooseItem(_id);
// open a link of the menu item
if (_smid >= 0) {
window.location = "javascript: showText (\"" +_documentPath + "\", "+_smid+");";
} else {
window.location = _documentPath;
} // if - else
} // displayItem
/**
* Appends the necessary html code for the table end.
*/
function endMenu()
{
document.writeln("
");
} // endItem
/**
* Changes the current image to the given one.
* @param _imageID the id of the image.
* @param _imgSrc the source of the image.
*/
function changeImage(_imageID,_imgSrc)
{
document.images[_imageID].src = _imgSrc/* + '?OpenImageResource'*/;
} // changeImage