    /**
     * 操作DOM节点的静态辅助类
     * @author GuDong
     * @version $Date:2010-04-21 $
    */ 
    var NodeUtil = {
		getPreviousSibling : function (node,tagName){
			var preNode = node.previousSibling; 
			if(typeof tagName !== "undefined")
			{
				if (preNode == null)
				    return preNode;
				else if(preNode.nodeType == 1 && preNode.tagName.toUpperCase() == tagName.toUpperCase())
					return preNode;
				else  
					return this.getPreviousSibling(preNode,tagName);  
			}
			else
			{
				if (preNode == null || preNode.nodeType == 1)
				   return preNode;
				else  
					return this.getPreviousSibling(preNode);  
			}
		}, 
		getNextSibling : function (node,tagName){
			var nextNode = node.nextSibling; 
			if(typeof tagName !== "undefined")
			{
				if (nextNode == null)
				    return nextNode;
				else if(nextNode.nodeType == 1 && nextNode.tagName.toUpperCase() == tagName.toUpperCase())
					return nextNode;
				else  
				    return this.getNextSibling(nextNode,tagName);  
			}
			else
			{
				if (nextNode == null || nextNode.nodeType == 1)
				    return nextNode;
				else  
				    return this.getNextSibling(nextNode);  
			} 
		},
		createPreviousSibling : function (node,elementName){
			var preNode = document.createElement(elementName);
			node.parentNode.insertBefore(preNode,node); 
			return preNode;
		},
		createNextSibling : function (node,elementName){
			var nextNode = document.createElement(elementName);
			var nextSibling = NodeUtil.getNextSibling(node);
			if(nextSibling == null)
			{
				node.parentNode.appendChild(nextNode);
			}
			else
			{
				node.parentNode.insertBefore(nextNode,nextSibling);
			}
			return nextNode;
		},
		getLastChild : function (node){
			var children = node.childNodes; 
			var length = children.length;
			while(length > 0)
			{
				var lastChild = children[length - 1];
				if(lastChild == null || lastChild.nodeType == 1)
				{
					return lastChild;
					break;
				}
				length -= 1;
			} 
			return null;
		},
		getFirstChild : function (node){
			var children = node.childNodes; 
			var length = children.length;
			var i = 0;
			while(i < length)
			{
				var firstChild = children[i];
				if(firstChild == null || firstChild.nodeType == 1)
				{
					return firstChild;
					break;
				}
				i += 1;
			} 
			return null;
		}
	};  
