DomHtml = {
	getElementsByClassName : function(e,className){
		if(!DomHtml.isElementNode(e)) return new Array();
		
		var a = new Array();
		var ret = new Array();
		
		for(var i=0;i<e.childNodes.length;i++){
			if(!DomHtml.isElementNode(e.childNodes[i])) continue;
			
			if(DomHtml.elementHasClass(e.childNodes[i],className)){
				a[a.length] = e.childNodes[i];
			}
			
			ret = DomHtml.getElementsByClassName(e.childNodes[i],className);
			for(var j=0;j<ret.length;j++) a[a.length] = ret[j];
		}
		
		return a;
	},
	
	elementHasClass : function(e,sClassName){
		locate = function(fromStr,searchStr,startIndex){
			var lo = fromStr.length;
			var ln = searchStr.length;
			var i = fromStr.indexOf(searchStr,startIndex);
			
			if(i == -1) return false;
			
			if(
				(i == 0 || c.charAt(i-1) == " ") && //located at the beginning of the string or preceeded by " "
				(i+ln >= lo || c.charAt(i+ln) == " ") //located at the end of the string or followed by " "
				){
					return true;
				}
			else{
				return locate(fromStr,searchStr,i+ln);
			}
		}
		
		if(DomHtml.isTextNode(e)) return false;
		
		var c = e.className;
		if(!c) return false;
		
		return locate(c,sClassName,0);
	},
	
	isTextNode: function( n ) {
        if( n.nodeType == 3 ){
            return n;
		}
		else{
			return false;
		}
    },
    
   	isElementNode: function(n){
        if( n.nodeType == 1 ){
            return n;
		}
		else{
			return false;
		}
	},
	
	getNodeViewport : function(node,breakOnParent){
		var curleft = 0, curtop = 0, curwidth = 0, curheight = 0;
		if (node.offsetParent) {
			curleft = node.offsetLeft;
			curtop = node.offsetTop;
			curwidth = node.offsetWidth;
			curheight = node.offsetHeight;
			
			if(!breakOnParent){
				while (node = node.offsetParent) {
					curleft += node.offsetLeft;
					curtop += node.offsetTop;
				}
			}
		}
		return {left:curleft,top:curtop,width:curwidth,height:curheight};
	}
}