carbidecpp22devenv/configuration/org.eclipse.osgi/bundles/225/1/.cp/javascript/common.js
changeset 5 684bf18fdedf
equal deleted inserted replaced
4:4764c8c88759 5:684bf18fdedf
       
     1 /*******************************************************************************
       
     2  * Copyright (c) 2006 IBM Corporation and others.
       
     3  * All rights reserved. This program and the accompanying materials 
       
     4  * are made available under the terms of the Eclipse Public License v1.0
       
     5  * which accompanies this distribution, and is available at
       
     6  * http://www.eclipse.org/legal/epl-v10.html
       
     7  * 
       
     8  * Contributors:
       
     9  *     IBM Corporation - initial API and implementation
       
    10  *******************************************************************************/
       
    11 
       
    12 /*
       
    13  * The following function toggles between block and none display
       
    14  * for the element with a given id. It also toggles between
       
    15  * open and closed images for the folding section.
       
    16  * Returns false to stop the browser from following the link.
       
    17  */
       
    18 function toggleSection(id, closedId, openId) {
       
    19 	if (document.getElementById) {
       
    20    		var element = document.getElementById(id);
       
    21    		var openImage = document.getElementById(openId);
       
    22    		var closedImage = document.getElementById(closedId);
       
    23    		if (element.style.display=="block") {
       
    24    			// hide the client block
       
    25 	   		element.style.display="none";
       
    26 	   		// switch toggle images
       
    27    			if (openImage)
       
    28    				openImage.style.display="none";
       
    29 			if (closedImage)
       
    30 				closedImage.style.display="inline";
       
    31 	   	}
       
    32 	   	else {
       
    33 	   		// turn it on and show
       
    34 	   		element.style.display="block";
       
    35 	   		// switch toggle images
       
    36    			if (openImage)
       
    37    				openImage.style.display="inline";
       
    38    			if (closedImage)
       
    39    				closedImage.style.display="none";
       
    40 	   	}
       
    41    	}
       
    42    	return false;
       
    43 }