(function(_){
	_.$C = function(el){
		return document.createElement(el);
	}
	_.$E = function(el){
		return document.getElementById(el);
	};
	_.getElementByClz = function(el, tg, clz){
		el = el || document;
		var rs = [];
		clz = " " + clz +" ";
		var cldr = el.getElementsByTagName(tg), len = cldr.length;
		for (var i = 0; i < len; ++ i){
			var o = cldr[i];
			if (o.nodeType == 1){
				var ecl = " " + o.className + " ";
				if (ecl.indexOf(clz) != -1){
					rs[rs.length] = o;
				}
			}
		}
		return rs;
	};
	
	_.getElmsByAttr = function(node, attname, attvalue){
		var nodes = [];
		for(var i = 0, l = node.childNodes.length; i < l; i ++){
			if(node.childNodes[i].nodeType == 1){
				if(node.childNodes[i].getAttribute(attname) == attvalue){
					nodes.push(node.childNodes[i]);
				}
				if(node.childNodes[i].childNodes.length > 0){
					nodes = nodes.concat(arguments.callee.call(null, node.childNodes[i], attname, attvalue));
				}
			}
		}
		return nodes;
	};
	
	_.insertAfter = function (newElement, targetElement) {
		var parent = targetElement.parentNode;
		if(parent.lastChild == targetElement) {
			parent.appendChild(newElement);
		} else {
			parent.insertBefore(newElement, targetElement.nextSibling);
		}
		return newElement;
	};
	
	_.$wrap = function(elm, tagName) {
		var wrapper = $C(tagName);
		insertAfter(wrapper, elm);
		wrapper.appendChild(elm);
		return wrapper;
	};

	_.$setStyle = function(el, style){
		function setStyle(el, property, val){
			if(!lib.IE) {
				if (property == "float") {
					property = "cssFloat";
				}
				if(!el) return;
				el.style[property] = val;
			} else{
				switch (property) {
					case "opacity":
						el.style.filter = "alpha(opacity=" + (val * 100) + ")";
						if (!el.currentStyle || !el.currentStyle.hasLayout) {
							el.style.zoom = 1;
						}
						break;
					case "float":
						property = "styleFloat";
					default: 
						el.style[property] = val;
				}
			}
					
		}
		
		var toStyleAttribute =  function (styleName) {
			var arr = styleName.split('-');
			var cc = arr[0];
			for (var i = 1; i < arr.length; i++) {
				cc += arr[i].charAt(0).toUpperCase() + arr[i].substring(1);
			}
			return cc;
		};
		if(typeof el == 'string'){
			el = $E(el);
		}
		
        for (var name in style) {
			styleAttr = toStyleAttribute(name);
			setStyle(el, styleAttr, style[name]);
        }

	};
})(window);

/*
var fn = function(el){
	if(el.nodeType == 1) {
			this[0] = el;
	}
	if(el.match(/^\w+/)){
		this[0] = document.getElementById(el);
	}
	if(el.match(/^(\w+)\.(\w+)$/ig)){
		var temD = this[0] || 
		this.find(this[0],RegExp.$1,RegExp.$2);
	}
	if(el.match(/^\.(\w+)$/ig)){
		var temD = this[0] || 
		this.find(this[0],"",RegExp.$1);
	}
	return this;
};

fn.prototype.css = function(name,value){
	if(!this[0]) return null;
	if(name === undefined && value === undefined){
		return this[0].className;
	}
	if(value === undefined){
		if(typeof name == "string")
			return this[0].style[name] ;
		else{
			 for (var name in style) {
				styleAttr = name.replace(/^((a-z)+)\-(a-z)/ig,$1+$2.charAt(0).toUpperCase()+$2.subString(1));
				this.setStyle(this[0],name,styleAttr);
			 }
		}
	}else{
		this.setStyle(this[0],name,value);
	}
};

fn.prototype.find = function(el, tg, clz){
	el = el || document;
	var rs = [];
	clz = " " + clz +" ";
	var cldr = el.getElementsByTagName(tg), len = cldr.length;
	for (var i = 0; i < len; ++ i){
		var o = cldr[i];
		if (o.nodeType == 1){
			var ecl = " " + o.className + " ";
			if (ecl.indexOf(clz) != -1){
				rs[rs.length] = o;
			}
		}
	}
	return rs;
};
*/
