function f_GetX(e){
	var l=e.offsetLeft;
	while(e=e.offsetParent){
		l+=e.offsetLeft;
	}
	return l;
}
function f_GetY(e){
	var t=e.offsetTop;
	while(e=e.offsetParent){
		t+=e.offsetTop;
	}
	return t;
}

Array.prototype.del=function(n) {  
  if(n<0)  
    return this;
  else
    return this.slice(0,n).concat(this.slice(n+1,this.length));
}
Array.prototype.remove = function(j){
    for ( var i=j+1; j < this.length ; j++ ,i++){
		var o=this[i];
		this[j]=o;
    }
    this.length=this.length-1;
}
Date.prototype.format = function(format) {
	var o = {
		"M+" : this.getMonth()+1, //month
		"d+" : this.getDate(),    //day
		"h+" : this.getHours(),   //hour
		"H+" : this.getHours(),   //hour
		"m+" : this.getMinutes(), //minute
		"s+" : this.getSeconds(), //second
		"q+" : Math.floor((this.getMonth()+3)/3),  //quarter
		"S" : this.getMilliseconds() //millisecond
	}
	if(/(y+)/.test(format))
		format=format.replace(RegExp.$1,(this.getFullYear()+"").substr(4 - RegExp.$1.length));
	for(var k in o)
		if(new RegExp("("+ k +")").test(format))
			format = format.replace(RegExp.$1,
				RegExp.$1.length==1 ? o[k] :
					("00"+ o[k]).substr((""+ o[k]).length));
	return format;
}
String.prototype.trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); } 

function showInMiddle(obj){
	var left = (document.body.clientWidth-obj.width())/2;
	var top = 200 + document.body.scrollTop;
	obj.css({top:top, left:left, position : "absolute"});
	return obj;
}
//鼠标冒泡事件处理
function isMouseLeaveOrEnter(e, handler) {
    if (e.type != 'mouseout' && e.type != 'mouseover') return false;   
    var reltg = e.relatedTarget ? e.relatedTarget : e.type == 'mouseout' ? e.toElement : e.fromElement;   
    while (reltg && reltg != handler)   
        reltg = reltg.parentNode;   
    return (reltg != handler);   
}  
/****************************注册登录*****************************/
function login() {
	var uri = top.location.href;
	uri = uri.replace(/&/g,"%26");
	top.location.href = "/member/login.shtml?uri=" + uri + "&time=" + new Date().getTime();
}

function reg() {
	if (1==1)
		login();
	else {
		var uri = top.location.href;
		uri = uri.replace(/&/g,"%26");
		top.location.href = "/member/reg.shtml?doafter=" + uri + "&time=" + new Date().getTime();		
	}
}
function logout() {
	jQuery.post("/member/logout.shtml", {}, function(data) {
		location.reload();
	});
}
