YAHOO.namespace('YAHOO.lib.util');
// Constructor
YAHOO.lib.util.Element = function() {}
// Assign button
YAHOO.lib.util.Element.assignOnClick = function(el, object, handler) {
	var element = null;
	if (typeof el == 'string') element = YAHOO.util.Dom.get(el); else element = el;
	if (element) YAHOO.util.Event.addListener(element, 'click', handler, object, true);
}
// Gets height
YAHOO.lib.util.Element.getHeight = function(el) {return parseInt(YAHOO.util.Dom.getStyle(el, 'height'));}
// Sets height
YAHOO.lib.util.Element.setHeight = function(el, height) {YAHOO.util.Dom.setStyle(el, 'height', String(height) + 'px');}
// Show
YAHOO.lib.util.Element.show = function(el) {YAHOO.util.Dom.setStyle(el, 'display', 'block');}
// Hide
YAHOO.lib.util.Element.hide = function(el) {YAHOO.util.Dom.setStyle(el, 'display', 'none');}
// Get child by class name
YAHOO.lib.util.Element.getChildByClassName = function(el, className) {
	var element = null;
	var result = null; 
	if (typeof el == 'string') element = YAHOO.util.Dom.get(el); else element = el;
	if (element && (element.childNodes.length > 0)) {
		var node = null;
		for (var i = 0; i < element.childNodes.length; i++) {
			var node = element.childNodes[i];
			if (node.nodeType == 1) {
				if (YAHOO.util.Dom.hasClass(node, className)) {result = node;break;}
			}
		}
	}
	return result;
}
// Get element by class name
YAHOO.lib.util.Element.getElementByClassName = function(el, className, tag, apply) {
	 var elements = YAHOO.lib.util.Element.getElementsByClassName(el, className, tag, apply);
	 if (elements && (elements instanceof Array) && (elements.length > 0)) return elements[0];
	 else return null;
}
// Get elements by class name
YAHOO.lib.util.Element.getElementsByClassName = function(el, className, tag, apply) {
	return YAHOO.util.Dom.getElementsByClassName(className, tag, el, apply);
}
// Get elements by attribute
YAHOO.lib.util.Element.getElementsByAttribute = function(el, attribute, tag) {
	var method = function(element) {
		if (element) {
			var attr = element.getAttribute(attribute.key);
			if (attr == attribute.value) return true;
			else return false;
		} else return false;
	}
	return YAHOO.util.Dom.getElementsBy(method, tag, el);
}
