$(function(){
	$('#lowlevel').change(function(){
		var low = $('#lowlevel').val();
		var high = $('#highlevel').val();
		if ( checkLevel(low) )
		{
			if (high != '')
			{
				if (high > low)
					return true;
				else
				{
					alert('等级上限要大于等级下限');
					$(this).val('');
				}
			}
			else
				return true;
		}
		else
		{
			alert('请输入1-70的数字');
			$(this).val('');
		}		
	});

	$('#highlevel').change(function(){
		var low = $('#lowlevel').val();
		var high = $('#highlevel').val();
		if ( checkLevel(high) )
		{
			if (low != '')
			{
				if (high > low)
					return true;
				else
				{
					alert('等级上限要大于等级下限');
					$(this).val('');
				}
			}
			else
				return true;
		}
		else
		{
			alert('请输入1-70的数字');
			$(this).val('');
		}
	});
});

/**
	判断是否是1-2位整数
**/
function isDigit(s) {
	var patrn=/^[0-9]{1,2}$/; 
	if (!patrn.exec(s)) 
		return false 
	return true
}

function checkLevel(val)
{
	if (val != '' && isDigit(val) && Number(val) >= 1 && Number(val) <= 70)
	{
		return true;
	}
	else
		return false;
}