if (!khanh) var khanh = {};
if (!khanh.dom) {
	khanh.dom = {
		insertAdjacentElement: function(elm, where, parsedNode) {
			if (isIE) elm.insertAdjacentElement(where, parsedNode);
			else {
				switch (where){
					case 'beforeBegin':
						elm.parentNode.insertBefore(parsedNode, elm);
						break;
					case 'afterBegin':
						elm.insertBefore(parsedNode, elm.firstChild);
						break;
					case 'beforeEnd':
						elm.appendChild(parsedNode);
						break;
					case 'afterEnd':
						if (elm.nextSibling) elm.parentNode.insertBefore(parsedNode, elm.nextSibling);
						else elm.parentNode.appendChild(parsedNode);
						break;
				}
			}
		},
		
		insertAdjacentHTML: function(elm, where, htmlStr) {
			if (isIE) elm.insertAdjacentHTML(where, htmlStr);
			else {
				var r = elm.ownerDocument.createRange();
				r.setStartBefore(elm);
				var parsedHTML = r.createContextualFragment(htmlStr);
				this.insertAdjacentElement(elm, where, parsedHTML);
			}
		},
		
		
		insertAdjacentText: function(elm, where, txtStr) {
			if (isIE) elm.insertAdjacentText(where, txtStr);
			else {
				var parsedText = document.createTextNode(txtStr);
				this.insertAdjacentElement(elm, where, parsedText);
			}
		}
	};
}
