
//窗口最大化
function winSizer(){
	windowWidth = window.screen.availWidth;
	windowHeight = window.screen.availHeight;
	window.moveTo(0,0);
	window.resizeTo(windowWidth,windowHeight);
}


function del_space(s)
{
	for(i=0;i<s.length;++i)
	{
	 if(s.charAt(i)!=" ")
		break;
	}

	for(j=s.length-1;j>=0;--j)
	{
	 if(s.charAt(j)!=" ")
		break;
	}

	return s.substring(i,++j);
}

function CheckText(obj,sPrompt)
{
	if(obj!=null)
	{
	var sValue = del_space(obj.value);
     if (sValue.length == 0)
     {
        alert(sPrompt);
		obj.focus();
		return false;
     }
	 else
	 	return true;
	}
	 else
	 	return true;
}

function CheckFloat(obj,sPrompt)
{
	if(obj!=null)
	{
		var sValue = del_space(obj.value);
		if(sValue=="0.0")
		{
			alert(sPrompt);
			obj.focus();
			return false;
		}
		else if (sValue.length > 0)
		 {
				sValue=sValue.replace(/\s/g,"");
				var parttern=/^\d+(\.\d+)?$/;
				if(!parttern.test(sValue))
				{
					alert(sPrompt);
					obj.focus();
					return false;
				}
				else
					return true;
		 }
		 else
			return true;
	}
	 else
	 	return true;
}

function CheckNumber(obj,sPrompt)
{
	if(obj!=null)
	{
	var sValue = del_space(obj.value);
     if (sValue.length > 0)
	 {
		if(sValue.match(/\D/)!=null)
		{
			alert(sPrompt);
			obj.focus();
			return false;
		}
		else
			return true;
	 }
	 else
	 	return true;
	}
	 else
	 	return true;
}

function VerifyInput(obj,itype)
{
	if(itype=="f")
		CheckFloat(obj,"请填写数字");
	if(itype=="n")
		CheckNumber(obj,"请填写数字");
}


//打开信息窗口
function infowin(url)
{
	var aw = window.open(url ,"newWindow","toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=740,height=550,fullscreen=1");
	if(aw!=null) aw.focus();
}
