/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/** Toggles between a preview and a full version of some content.
 * Arguments are the prefix used for constructing the IDs of the elements
 * to modify and the number identifying the particular element.
 *
 * When the function is executed, the elements with the IDs prefix-number-pre,
 * prefix-number-full, and prefix-number-toggle will be modified. The element
 * of *-pre and *-full which is currently visible will be made invisible and
 * the other one shown. If *-full is shown now, the *-toggle image will be
 * changed to a minus, a plus otherwise.
 */
function toggleExtended(prefix, number) {
  fullElement = document.getElementById(prefix + '-' + number + '-full');
  toggleElement = document.getElementById(prefix + '-' + number + '-toggle');
  changeTo = (fullElement.style.display != 'none') ? 'pre' : 'full';
  
  fullElement.style.display = (changeTo == 'full') ? 'block' : 'none';
  toggleElement.innerHTML = (changeTo == 'full') ? 'Less ...' : 'More ...';
}