function DomUtil(){
	var t = this;
	var p = DomUtil.prototype;
	if(!p.initialized){
		p.hexValues = '0123456789ABCDEF';
		t.hexValues = p.hexValues;
		
		p.getNodeAttribute = function(node, name) {
			var result = '';
			var attributes = node.attributes;
			for (var i=0;i<attributes.length;i++) {
				var attribute = attributes.item(i);
				var n = attribute.nodeName;
				if (n == name) {
					result = attribute.nodeValue;
					break;
				}
			}
			return result;
		}
		p.getNumericAttribute = function(node, name){
		
			var result = 0;
			var value = getNodeAttribute(node, name);
			if(value && value!=''){
				value++;
				value--;
				result = value;
			}
		
			return result;
		}
		p.getParentNode = function(node, tagName){
		
			var result = node;
			if(tagName && tagName!=''){
				while(result && result.tagName.toUpperCase()!=tagName.toUpperCase()){
					result = result.parentNode;
				}
			}
			else{
				result = result.parentNode;
			}
		
			return result;
		}
		p.isKeyPress = function(k){
			var result = false;
			if(
				k==46
				|| k==8
				|| k==32
				|| (k>=48 && k<=57)
				|| (k>=64 && k<=90)
				|| (k>=106 && k<=111)
				|| (k>=186 && k<=222)
			){
				result = true;
			}
		
			return result;
		}
		p.getElement = function(target){
		
			var result = target;
			if(document.getElementById(target)){
				result = document.getElementById(target);
			}
		
			return result;
		}
		p.clearArea = function(area){
		
			var a = getElement(area);
			if(a){
				if(a.childNodes){
					while(a.childNodes.length>0){
						a.removeChild(a.childNodes[0]);
					}
				}
			}
		}
		p.setNodeAttribute = function(node, name, value){
		
			var attributes = node.attributes;
			var found = false;
			for(var i=0;i<attributes.length;i++){
				var attribute = attributes[i];
				if(attribute.nodeName==name){
					attribute.nodeValue = value;
					found = true;
					break;
				}
			}
			if(found==false){
				var attribute = document.createAttribute(name);
				attribute.value = value;
				node.setAttributeNode(attribute);
			}
		}
		
		p.urlEncode = function(value){
		
			var result = '';
			if(value && value.length>0){
				for(var i=0;i<value.length;i++){
					var c = value.charAt(i);
					if((c>='A' && c<='Z')||(c>='a' && c<='z')||(c>='0'&&c<='9')){
						result += c;
					}
					else{
						result += '%' + this.hexOf(value.charCodeAt(i));
					}
				}
			}
		
			return result;
		}
		
		p.hexOf = function(value){
		
			var q = value/16;
			var r = value % 16;
			result = this.hexValues.charAt(q) + this.hexValues.charAt(r);
		
			return result;
		}
		p.initialized = true;
	}
}







