/*垂直居中*/
function VCenter(id)
{
	var middleDiv = document.getElementById(id);
	var divHeight = middleDiv.offsetHeight;
	var bodyHeight = document.body.offsetHeight;
	if(bodyHeight > divHeight)
	{
		middleDiv.style.marginTop = (bodyHeight - divHeight)/2 + "px";
	}
	else
	{
		middleDiv.style.marginTop=0;
		middleDiv.style.top=0;
	}
}
/*水平居中*/
function HCenter(id)
{
	var middleDiv = document.getElementById(id);
	var divWidth = middleDiv.offsetWidth;
	var bodyWidth = document.body.offsetWidth;
	if(bodyWidth > divWidth)
	{
		middleDiv.style.marginLeft = (bodyWidth - divWidth)/2 + "px";
	}
	else
	{
		middleDiv.style.marginLeft=0;
		middleDiv.style.left=0;
	}
}
/*水平垂直居中*/
function HVCenter(id)
{
	var middleDiv = document.getElementById(id);
	var divWidth = middleDiv.offsetWidth;
	var divHeight = middleDiv.offsetHeight;
	var bodyWidth = document.body.offsetWidth;
	var bodyHeight = document.body.offsetHeight;
	// 水平
	if(bodyWidth > divWidth)
	{
		middleDiv.style.marginLeft = (bodyWidth - divWidth)/2 + "px";
	}
	else
	{
		middleDiv.style.marginLeft=0;
		middleDiv.style.left=0;
	}
	// 垂直
	if(bodyHeight > divHeight)
	{
		middleDiv.style.marginTop = (bodyHeight - divHeight)/2 + "px";
	}
	else
	{
		middleDiv.style.marginTop=0;
		middleDiv.style.top=0;
	}
}