--- a/labs/openlayers/lib/OpenLayers/BaseTypes/Element.js +++ b/labs/openlayers/lib/OpenLayers/BaseTypes/Element.js @@ -1,1 +1,252 @@ - +/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for + * full list of contributors). Published under the Clear BSD license. + * See http://svn.openlayers.org/trunk/openlayers/license.txt for the + * full text of the license. */ + +/** + * Namespace: OpenLayers.Element + */ +OpenLayers.Element = { + + /** + * APIFunction: visible + * + * Parameters: + * element - {DOMElement} + * + * Returns: + * {Boolean} Is the element visible? + */ + visible: function(element) { + return OpenLayers.Util.getElement(element).style.display != 'none'; + }, + + /** + * APIFunction: toggle + * Toggle the visibility of element(s) passed in + * + * Parameters: + * element - {DOMElement} Actually user can pass any number of elements + */ + toggle: function() { + for (var i=0, len=arguments.length; i