// JavaScript Document
function checknull(obj)
{
	if (obj.value=="")
	{
		return 1
	}
}
function checklength(str,lengths)
{
		if (eval("document.all."+str).value.length<lengths)
	{
		return 0
	}
}
function CheckNUM(NUM)
{
	var i,j,strTemp;
	strTemp="0123456789";
	if ( NUM.length== 0)
		return 0
	for (i=0;i<NUM.length;i++)
	{
		j=strTemp.indexOf(NUM.charAt(i));	
		if (j==-1)
		{
		//说明有字符不是数字
			return 0;
		}
	}
	//说明是数字
	return 1;
	
}
//函数名：chkemail
//功能介绍：检查是否为Email Address
//参数说明：要检查的字符串
//返回值：0：不是  1：是
function chkemail(obj)
{	
	a=obj.value
	var i=a.length;
	var temp = a.indexOf('@');
	var tempd = a.indexOf('.');
	if (temp > 1) {
		if ((i-temp) > 3){
			
				if ((i-tempd)>0){
					return 1;
				}
			
		}
	}
	alert('邮箱格式有误!')
	obj.focus()
	return 0;
}
//函数名：chksafe
//功能介绍：检查是否含有"'",'\\',"/"
//参数说明：要检查的字符串
//返回值：0：是  1：不是
function chksafe(obj)
{	
	//alert("刚才你的输入发现有非法字符!")
	//return 1;
	a=obj.value
	fibdn = new Array ("'" ,"\\", "、", ",", ";", "/");
	i=fibdn.length;
	j=a.length;
	for (ii=0;ii<i;ii++)
	{	
	for (jj=0;jj<j;jj++)
		{	temp1=a.charAt(jj);
			temp2=fibdn[ii];
			if (temp1==temp2)
			{
			alert("刚才你的输入发现有非法字符!")
			obj.value=""
			obj.focus()
			return 0; 
			}
		}
	}
	//alert("刚才你的输入发现有非法字符!")
	return 1;
}
//函数名：fucPWDchk
//功能介绍：检查是否含有非数字或字母
//参数说明：要检查的字符串
//返回值：0：含有 1：全部为数字或字母
function fucPWDchk(str)
{
  var strSource ="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  var ch;
  var i;
  var temp;
  
  for (i=0;i<=(str.length-1);i++)
  {
  
    ch = str.charAt(i);
    temp = strSource.indexOf(ch);
    if (temp==-1) 
    {
	return 0;
    }
  }
  if (strSource.indexOf(ch)==-1)
  {
	return 0;
  }
  else
  {
    return 1;
  } 
}
//函数名：fucCheckNUM
//功能介绍：检查是否为数字
//参数说明：要检查的数字
//返回值：1为是数字，0为不是数字
function fucCheckNUM(NUM)
{
	var i,j,strTemp;
	strTemp="0123456789";
	if ( NUM.length== 0)
		return 0
	for (i=0;i<NUM.length;i++)
	{
		j=strTemp.indexOf(NUM.charAt(i));	
		if (j==-1)
		{
		//说明有字符不是数字
			return 0;
		}
	}
	//说明是数字
	return 1;
}
//函数名：chkspc
//功能介绍：检查是否含有空格
//参数说明：要检查的字符串
//返回值：0：是  1：不是
function chkspc(a)
{
	var i=a.length;
	var j = 0;
	var k = 0;
	while (k<i)
	{
		if (a.charAt(k) != " ")
			j = j+1;
		k = k+1;
	}
	if (j==0)
	{
		return 0;
	}
	
	if (i!=j)
	{ return 2; }
	else
	{
		return 1;
	}
}
//函数名：fucCheckTEL
//功能介绍：检查是否为电话号码
//参数说明：要检查的字符串
//返回值：1为是合法，0为不合法
function fucCheckTEL(TEL)
{
	var i,j,strTemp;
	strTemp="0123456789-()# ";
	for (i=0;i<TEL.length;i++)
	{
		j=strTemp.indexOf(TEL.charAt(i));	
		if (j==-1)
		{
		//说明有字符不合法
			return 0;
		}
	}
	//说明合法
	return 1;
}
//
// 设置显示文字大小
//
function ContentSize(size)
{
	var obj=document.all.BodyLabel;
	obj.style.fontSize=size+"px";
	obj.style.lineHeight = (size + 11) + "px";
}
function opennew(newurl,windowName,width,height)
{
var theLeft,theTop
theLeft=(screen.width-width)/2-2
theTop=(screen.height-height)/2
//window.Open(newurl,windowName,'width='+width+',height='+height+',scrollbars=1,left='+theLeft+',top='+theTop+'').focus();
window.Open(newurl,windowName,'width='+width+',height='+height+',scrollbars=1,status=0,toolbar=0,resizable=0,left='+theLeft+',top='+theTop+'').focus();
//return true;
}
function opennewfull(newurl,windowName)
{
window.Open(newurl,windowName,'width='+screen.width+',height='+(screen.height-55)+',scrollbars=1,toolbar=0,resizable=0,left=0,top=0').focus();
}

function openModal(newUrl,windowName,width,height,controlName){
controlName.value=showModalDialog(newUrl,windowName,"dialogWidth:"+width+";dialogHeight:"+height+";center:1")
}


