/** * Gets a Salesforce Visualforce component by id. * @param {String} id * @returns {Element} The Visualforce component with id set to id. */ function getSfElementById(id) { return document.querySelector("*[id$=\"" + id +"\"]"); } /** * Hides an element on the page. * @param {Element} element */ function hide(element) { element.style.display = "none"; } /** * Shows an element on the page by setting its display style attribute to display. Testing with block for IE support * @param {Element} element * @param {String} display If null, display will be set to "initial". */ function show(element, display) { if (display == null) display = "block"; element.style.display = display; } /** * Toggles an element between shown and hidden. * @param {Element} element * @param {String} display The display argument that will be passed to show(). */ function toggleDisplay(element, display) { if (element.style.display == 'none') { show(element, display); } else { hide(element); } }