/**
*是否为空
*/
function isBlank(value)
{
	var w_space = String.fromCharCode(32);
	if(value.length < 1)
	{
		return true;
	}
	var v_length = value.length;
	var strTemp = "";
	var iTemp = 0;
	while(iTemp < v_length)
	{
		if(value.charAt(iTemp) != w_space)
		{
			return false;
		}
		iTemp = iTemp + 1;
	} //End While
	return true;
} //End Function

//验空的函数
function check_blank(id)
{
	ele = document.getElementById(id);
	len = bytes(ele.value);
	if(len==0)
	{
		return false;
	}
	else
	{
		return true;
	}
}
//验字节数多于
function check_bytem(id, smax)
{
	ele=document.getElementById(id);
	len=bytes(ele.value);
	if(len > smax)
	{
		return false;
	}
	else
	{
		return true;
	}
}
//验证字节数少于
function check_bytes(id, smin)
{
	ele=document.getElementById(id);
	len=bytes(ele.value);
	if(len < smin)
	{
		return false;
	}
	else
	{
		return true;
	}
}
//验证字节数多于和少于
function check_byte_all(id,smin,smax)
{
	ele=document.getElementById(id);
	len=bytes(ele.value);
	if((len < smin)||(len > smax))
	{
		return false;
	}
	else
	{
		return true;
	}
}
/**
 *检查是否为正整数
 */
function is_unsigned_numeric(str_number)
{
	var new_par = /^\d+$/;
	if (new_par.test(str_number))
	{
		return true;
	}
	else
	{
		return false;
	}	
}
//获取字节数目针对中英文和数字
function bytes(str)
{
	if(typeof(str)!='string')
	{
		str = str.value;
	}
	var len = 0;
	for(var i = 0; i < str.length; i++)
	{
		if(str.charCodeAt(i) > 127)
		{
			len++;
		}
		len++;
	}
	return len;
}
//去除左右空格
function trimlr(id)
{
	var str=document.getElementById(id).value;
	for(i=0;str.charAt(i)==" "|| str.charAt(i)=="　";i++)
	{
	}
	str=str.substring(i,str.length);
	for(i=str.length-1;str.charAt(i)==" "|| str.charAt(i)=="　";i--)
	{
	}
	str=str.substring(0,i+1);
	return str;
}
function deal_play()
{
	top.document.getElementById("play").controls.stop();
	top.document.getElementById("mod_bgmusic").innerHTML = "";
}
function later_reload()
{
	window.setTimeout(function(){
		top.window.history.go(0);
	}, 10);
}
function go_login(forward)
{
	var url_array = location.hostname.split("dm72");
	top.location.href= "http://user.dm72" + url_array[1] + "/user/user_login.php?com_url=" + forward;
}
/**
*隐藏div
*/
function hidden(name)
{
	$(name).style.display = "none";
	ScreenLocker.unlock();
}
/**
*设置div位置
*/
function set_middle(div_name)
{
	msgDiv = $(div_name);
	var dm72_top = arguments[1] ? arguments[1] : 0;
	msgDiv.style.position = 'absolute';
	msgDiv.style.left = (document.body.clientWidth - msgDiv.offsetWidth) / 2 + document.body.scrollLeft;
	msgDiv.style.top =  document.body.scrollTop + dm72_top;
}

function show_user_info(elment, user_id)
{
(new Query('/sys/json/dm72_user_info.php?user_id=' + user_id, 'dm72_user_result', {scroll:false}));
var l = 0;
var obj = elment;
while(obj = obj.offsetParent)
{
	l += obj.offsetLeft;
}
if(l < 300)
{
	var offset_x = 0;
}
else
{
	var offset_x = -200;
}
new Plane('dm72_user_info', elment, {offsetX:offset_x, offsetY: 0});
}

