/*
* This set of Javascript code handles drawing all of the buttons in the system.
* To change the look and feel of buttons, provide different definitions for
* the functions in this file.
*/
/* Stack to store the buttons set by storeButton(). */
var _buttonStore = new Array();
/* Stack index for the buttons set by storeButton(). */
var _buttonStoreIndex = 0;
/* Holder for the state of buttons, as set by setActiveButton(). */
var _buttonState = new Object();
/* The default location of icons for buttons. */
var _buttonImageFolder = "skin/images/buttons";
/* The default location of icons for small buttons. */
var _smallButtonImageFolder = "skin/images/buttons/small";
/* Variable to hold the current location of icons for buttons. */
var _iconFolder = _buttonImageFolder;
/*
* Called to change the location of icons for icon buttons. This is called before
* a set of calls to drawIconButton().
*/
function setIconFolder(fldr) {
_iconFolder = fldr;
}
/*
* Set a button in the specified state (state=true means active; state=false means inactive).
*/
function setActiveButton(id, state) {
_buttonState[id] = state;
var im = document.images[id];
if (im) {
im.src = _iconFolder + "/" + id + (state ? ".gif" : "off.gif");
}
}
/*
* Determines whether the indicated button is active.
*/
function isActiveButton(id) {
var flag = _buttonState[id];
return flag == null || flag;
}
/*
* Draw a button using a graphic icon. A button is inactive if it has been set
* inactive using setActiveButton(), or if it is drawn with an empty action.
*/
function drawIconButton(id, label, action) {
if (action) {
document.write("");
document.write("");
document.write("");
} else {
document.write("
");
}
}
/*
* Draw a single button. Note, the label argument is not used in this implementation
* of the look and feel.
*/
function drawButton(id, label, action) {
setIconFolder(_buttonImageFolder);
drawIconButton(id, label, action);
}
/*
* Draw a single small button.
*/
function drawSmallButton(id, label, action) {
setIconFolder(_smallButtonImageFolder);
drawIconButton(id, label, action);
}
/*
* This function is called back to whenever there is a mouseover on a
* button drawn by drawButton(). It is never called directly in code
* written into modules files; it is only called by generated code
* from drawButton().
*/
function _mouseOverButton(id, fldr) {
if (! isActiveButton(id)) {
return;
} else if (document.getElementById && document.getElementById(id + "_comment")) {
document.getElementById(id + "_comment").style.visibility = "visible";
}
document.images[id].src = fldr + "/" + id + "on.gif";
}
/*
* This function is called back to whenever there is a mouseout on a
* button drawn by drawButton(). It is never called directly in code
* written into modules files; it is only called by generated code
* from drawButton().
*/
function _mouseOutButton(id, fldr) {
if (! isActiveButton(id)) {
return;
} else if (document.getElementById && document.getElementById(id + "_comment")) {
document.getElementById(id + "_comment").style.visibility = "hidden";
}
document.images[id].src = fldr + "/" + id + ".gif";
}
/*
* Draw the popup for a button with the given id. The popup will appear at the
* location in the page where this function is called. In the standard implementation
* this is called from within the template frames in modules/skin.
*/
function drawButtonPopup(idtext, comment, offset) {
var id = idtext + "_comment";
document.writeln("