var docEle = function()
{
	return document.getElementById(arguments[0]) || false;
}

function openRegDiv(_id)
{
	document.body.style.overflow = 'hidden';
	var m = "mask";
	if (docEle(_id)) document.body.removeChild(docEle(_id));
	if (docEle(m)) document.body.removeChild(docEle(m));

	//mask遮罩层

	var newMask = document.createElement("div");
	newMask.id = m;
	newMask.style.position = "absolute";
	newMask.style.zIndex = "888";
	//_scrollWidth = Math.max(document.body.scrollWidth,document.documentElement.scrollWidth);
	_scrollHeight = Math.max(document.body.scrollHeight,document.documentElement.scrollHeight);
	newMask.style.width = "100%";
	newMask.style.height = _scrollHeight + "px";
	newMask.style.top = "0px";
	newMask.style.left = "0px";
	newMask.style.background = "#000";
	newMask.style.filter = "alpha(opacity=40)";
	newMask.style.opacity = "0.60";
	document.body.appendChild(newMask);

	//新弹出层

	var newDiv = document.createElement("div");
	newDiv.id = _id;
	newDiv.style.position = "absolute";
	newDiv.style.zIndex = "999";
	newDivWidth = 490;
	newDivHeight = 336;
	newDiv.style.width = newDivWidth + "px";
	newDiv.style.height = newDivHeight + "px";
	//newDiv.style.top = (document.body.scrollTop + document.body.clientHeight/2 - newDivHeight/2) + "px";
	//newDiv.style.left = (document.body.scrollLeft + document.body.clientWidth/2 - newDivWidth/2) + "px";
	newDiv.style.top = "50%";
	newDiv.style.left = "50%";
	newDiv.style.background = "";
	newDiv.style.border = "";
	newDiv.style.padding = "";
	newDiv.style.margin = "-168px -245px";
	newDiv.innerHTML = "<iframe src='/member/reg_new.php' name='ifram' width='490' marginwidth='0' height='450' marginheight='0' scrolling='No' frameborder='No' id='ifram' allowtransparency='allowtransparency' border='0'></iframe>";
	document.body.appendChild(newDiv);

	//弹出层滚动居中

	function newDivCenter()
	{
		//newDiv.style.top = (document.body.scrollTop + document.body.clientHeight/2 - newDivHeight/2) + "px";
		//newDiv.style.left = (document.body.scrollLeft + document.body.clientWidth/2 - newDivWidth/2) + "px";
		newDiv.style.top = "50%";
		newDiv.style.left = "50%";
	}
	if(document.all)
	{
		window.attachEvent("onscroll",newDivCenter);
	}
	else
	{
		window.addEventListener('scroll',newDivCenter,false);
	}

	//关闭新图层和mask遮罩层
	var newA = document.createElement("a");
	newA.href = "#";
	newA.innerHTML = "&nbsp;";
	newA.style.position = "absolute";
	newA.style.right = "24px";
	newA.style.display = "block";
	newA.style.top = "26px";
	newA.style.width = "20px";
	newA.style.height = "20px";
	newA.style.background = "url(/images/bb.gif) no-repeat center top";
	newA.onclick = function()
	{
		if(document.all)
		{
			window.detachEvent("onscroll",newDivCenter);
		}
		else
		{
			window.removeEventListener('scroll',newDivCenter,false);
		}
		document.body.removeChild(docEle(_id));
		document.body.removeChild(docEle(m));
		document.body.style.overflow = 'auto';
		return false;
	}
	newDiv.appendChild(newA);
}