/*
 * This file is part of bibro.
 *
 * Bibro is free software; 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 2 of the License, or
 * (at your option) any later version.
 *
 * Bibro 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 Bibro; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/**
 * JS-code for hide/show element by ID
 * @author Andrey "A.I." Sitnik <andrey@sitnik.ru>
 * @package bibro
 * @version 0.1dev
 */

/**
 * Hide element if it is showing, or show it if it hide
 * @param string id ID of wanted element
 * @param string display Value of CSS-property "display ("block", "inline", etc)
 * @return bool Is was work be well
 */
function showHideById(id, display) {
	if ('none' == document.getElementById(id).style.display) {
		return showById(id, display);
	} else {
		return hideById(id, display)
	}
}

/**
 * Hide element by ID
 * @param string id ID of wanted element
 * @return bool Is was work be well
 */
function hideById(id) {
   document.getElementById(id).style.display = "none";
   return true;
}

/**
 * Show element by ID
 * @param string id ID of wanted element
 * @param string display Value of CSS-property "display ("block", "inline", etc)
 * @return bool Is was work be well
 */
function showById(id, display) {
   document.getElementById(id).style.display = display;
   return true;
}

