/**
 * Enhancement Modification to Mahara
 * by Georgia Leadership Institute for School Improvement (GLISI)
 * http://www.galeaders.org
 *
 * @package    GLISI Overlay
 * @subpackage menu javascript
 * @author     Merrill Consulting Group, LLC - Ray Merrill
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 2007-2008 Board of Regents of the University System of Georgia Foundation
 *
 * This program and the GLISI Overlay enhancement(s) is free software: if you have obtained your
 * copy of the program legally from GLISI (or other authorized, licensed source), then you can 
 * redistribute it and/or modify it under the terms of the GNU General Public License as published
 * by the Free Software Foundation, either version 3 of the License, or (at your option) any later
 * version.
 * 
 * You can obtain a copy of Mahara platform from the wonderful team at Catalyst.
 * Mahara: Electronic portfolio, weblog, resume builder and social networking
 * Copyright (C) 2006-2008 Catalyst IT Ltd (http://www.catalyst.net.nz)
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

var glisiMenu = new function() {
	this.moduleId = "glisiMenu.leaderTracker";
	this.version = "0.8.1";
	this.versionDate = "28 November 2008";
	this.codeStatus = "under development (alpha)";
	this.lastAuthor = "Ray Merrill";
	this.copyright = "Copyright 2008, Board of Regents of the University System of Georgia:  Georgia Leadership Institute for School Improvement.";
	this.license = "http://www.gnu.org/copyleft/gpl.html GNU GPL";
}

glisiMenu.showMenu = function(o) {
	// passed either the string name of the DOM id of the menu
	// -or-
	// the DOM element that has the attribute specifying the menu to show - typically the button clicked
    if (typeof(o)=="string") {o = document.getElementById(o);}
    if ((o==null) || (!o.getAttribute('glisimenuid'))) {return false;}
	var menuToShow = document.getElementById(o.getAttribute('glisimenuid'));
	// size and position the menu based on item clicked and then show it
	var desiredPosition = kruse.get(o);
	var desiredWidth = kruse.get(o).width;
	menuToShow.style.width = desiredWidth + "px";
	kruse.set(menuToShow, desiredPosition);
	menuToShow.style.visibility = "visible";
	
	return true;
}

glisiMenu.hideMenu = function(o) {
	// passed either the string name of the DOM id of the menu
	// -or-
	// the DOM element that has the attribute specifying the menu to show - typically the button clicked
    if (typeof(o)=="string") {o = document.getElementById(o);}
    if ((o==null) || (!o.getAttribute('glisimenuid'))) {return false;}
	var menuToShow = document.getElementById(o.getAttribute('glisimenuid'));
	menuToShow.style.visibility = "hidden";
	
	return true;
}

glisiMenu.dimScreen = function() {
	// function is specific to a model that employs the Dimmer DIV and a css with corresponding styles
	var ElementToDim = document.getElementById('Dimmer');
	ElementToDim.className = 'DimmedScreen';
}

glisiMenu.unDimScreen = function() {
	// function is specific to a model that employs the Dimmer DIV and a css with the corresponding styles
	document.getElementById('Dimmer').className = 'NotDimmed';
}
	
