function $cookie(){
	if(arguments.length==1){
		return $.cookie(arguments[0]);
	}else{
		//设置cookie 有效期7天
		$.cookie(arguments[0],arguments[1], {path: '/'}); 
	}	
}

//去除字符串空白
String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
	return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
	return this.replace(/\s+$/,"");
}

/*取得控件绝对位置*/
function  getAbsPoint(e){
	var   x   =   e.offsetLeft,   y   =   e.offsetTop;
	while(e=e.offsetParent)
	{
		x   +=   e.offsetLeft;
		y   +=   e.offsetTop;
	}
	return {x:x,y:y};
}

//获取滚动条信息
function getScroll()  {
	var t, l, w, h;
	if (document.documentElement && document.documentElement.scrollTop) {
		t = document.documentElement.scrollTop;
		l = document.documentElement.scrollLeft;
		w = document.documentElement.scrollWidth;
		h = document.documentElement.scrollHeight;
	} else if (document.body) {
		t = document.body.scrollTop;
		l = document.body.scrollLeft;
		w = document.body.scrollWidth;
		h = document.body.scrollHeight;
	}
	return { t: t, l: l, w: w, h: h };
}

/**通过name来获取属性**/
function _b(tag, name) {
	var elem = document.getElementsByTagName(tag);
	var arr = new Array();
	for(i = 0, iarr = 0; i < elem.length; i++) {
		att = elem[i].getAttribute("name");
		if(att == name) {
			arr.push(elem[i]);
		}
	}
	return arr;
}

/**设置透明度**/
function Opacity(element,value){
	// by Go_Rush(阿舜) from http://ashun.cnblogs.com/
	var ret;
	if (value===undefined){   //读取
		if (!/msie/i.test(navigator.userAgent))
		if (ret=element.style.opacity) return parseFloat(ret);
		try{return element.filters.item('alpha').opacity/100}catch(x){return 1.0}
	}else{                   //设置
		value=Math.min(Math.max(value,0.00001),0.999999)    //这句修复一些非ie浏览器opacity不能设置为1的bug
		if (/msie/i.test(navigator.userAgent)) return element.style.filter="alpha(opacity="+value*100+")"
		return element.style.opacity=value
	}
}

function getQueryString(_url){
	_url = _url.replace(/#.*$/g, "");
	var _q = _url.substr(_url.indexOf("?")+1);
	var _tem1 = _q.split("&");
	var _return = [];
	$(_tem1).each(function(index,val){
		_t = val.split("=");
		_return[_t[0]]=_t[1];
	});
	return _return;
}

function getElementsByName_iefix(tag, name) {
	var elem = document.getElementsByTagName(tag);
	var arr = new Array();
	for(i = 0, iarr = 0; i < elem.length; i++) {
		att = elem[i].getAttribute("name");
		if(att == name) {
			arr[iarr] = elem[i];
			iarr++;
		}
	}
	return arr;
}