HelpManager = new Object();

HelpManager.__controlledHelp;
HelpManager.__currentShownHelp = null;

HelpManager.init = function(helps) {
	this.__controlledHelp = helps;
}

HelpManager.switchHelp = function(helpId) {
    if(this.__currentShownHelp == helpId) {
    	var help = document.getElementById(helpId);
		if (help.style.visibility == 'visible') {
			help.style.visibility = 'hidden';
			help.style.position = 'absolute';
			this.__currentShownHelp = null;
		}else{
			help.style.visibility = 'visible';
			help.style.position = 'relative';
			this.__currentShownHelp = helpId;
		}
	}else if (this.__currentShownHelp == null){
		var help = document.getElementById(helpId);
		help.style.visibility = 'visible';
		help.style.position = 'relative';
		this.__currentShownHelp = helpId;
	}else{
	    var i;
	    var help;
		for (i in this.__controlledHelp) {
			if (this.__controlledHelp[i] == helpId) {
				help = document.getElementById(this.__controlledHelp[i]);
				help.style.visibility = 'visible';
				help.style.position = 'relative';
				this.__currentShownHelp = helpId;
			} else {
				help = document.getElementById(this.__controlledHelp[i]);
				help.style.visibility = 'hidden';
				help.style.position = 'absolute';
			}
		}
	}
}
