<!--
//验证表单为空
function Check_Empty(form,name,str)
{
	if (document.all[form].all[name].value=="")
	{
		alert(str);
		document.all[form].all[name].focus();
		return true;
	}
}
//验证是否有字母，数字及下划杠组成
function Check_Fuc(form,name,alertstr)
{
	var strSource ="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
	var ch;
	var i;
	var temp;
	var flag;
	
	for (i=0;i<=(document.all[form].all[name].value.length-1);i++)
	{
		ch = document.all[form].all[name].value.charAt(i);
		temp = strSource.indexOf(ch);
		if (temp==-1) 
		{
			flag=false;
		}
	}
	
	if (strSource.indexOf(ch)==-1 || flag==false)
	{
		alert(alertstr);
		document.all[form].all[name].focus();
		return true;
	} 
}

//验证密码
function Check_Password(form,name,name2,str,str2)
{
	if(document.all[form].all[name].value=="" || document.all[form].all[name].value.length < 6 || document.all[form].all[name].value.length >16)
	{
		document.all[form].all[name].focus();
		alert(str);
		return true;
	}
    if(document.all[form].all[name].value != document.all[form].all[name2].value)
	{
		document.all[form].all[name].focus();
		document.all[form].all[name].value = '';
		document.all[form].all[name2].value = '';
		alert(str2);
		return true;
	}
}


//验证几位到几位
function Check_NtoN(form,name,s,b,str)
{
	if(document.all[form].all[name].value.length<s || document.all[form].all[name].value.length>b)
	{
		document.all[form].all[name].focus();
		alert(str);
		return true;
	}
}

//验证EMAIL
function Check_Email(form,name,str,str2)
{
	if(document.all[form].all[name].value.length!=0)
	{
		if (document.all[form].all[name].value.charAt(0)=="." ||        
		document.all[form].all[name].value.charAt(0)=="@"||       
		document.all[form].all[name].value.indexOf('@', 0) == -1 || 
		document.all[form].all[name].value.indexOf('.', 0) == -1 || 
		document.all[form].all[name].value.lastIndexOf("@")==document.all[form].all[name].value.length-1 || document.all[form].all[name].value.lastIndexOf(".")==document.all[form].all[name].value.length-1)
		{
			alert(str2);
			document.all[form].all[name].focus();
			return true;
		}
		
		
	}
	else
	{
		alert(str);
		document.all[form].all[name].focus();
		return true;
	}
}


//验证是否数字
function Check_Isnan(form,name,str)
{
	if (isNaN(document.all[form].all[name].value))
	{
		alert(str);
		document.all[form].all[name].focus();
		return true;
	}
}




//严整是否日期类型
function Check_Isdate(form,name,str)
{
	date=document.all[form].all[name].value
	execScript('inreturn=IsDate("'+date+'")','vbscript')
	if (inreturn==false)
	{  
		alert(str);
		document.all[form].all[name].focus();
		return true;
	}
}

//验证文件是否已存在
function Check_Upload(form,name,filepath,str1,str2)
{
   var file_local=document.all[form].all[name].value;
   if (file_local<=0)
   {
		alert(str1);
		return true;
   }
   var reg=/([^\\]+)$/.exec(file_local);
   var filename=RegExp.$1;
   var url=filepath+filename
   var xmlhttp = new ActiveXObject("MSXML2.XMLHTTP")
   xmlhttp.abort();
   xmlhttp.open("GET",url,false)
   xmlhttp.send()
   if (xmlhttp.readyState==4)
   {
		if (xmlhttp.status==200)
		{
			if (confirm(str2))
			{
				return false;
			}
			else
			{
				return true;
			}
		}//url存在
		//else if (xmlhttp.status==404)
		//{
		//		alert('不存在');
		//		return true;
		//}//url不存在		
		//else
		//{
		//		alert('其他');
		//		return true;
		//}//其他状态
   }
}  

//获取上传文件大小
function getFileSize (fileName) {
  if (document.layers) {
    if (navigator.javaEnabled()) {
      var file = new java.io.File(fileName);
      if (location.protocol.toLowerCase() != 'file:')
        netscape.security.PrivilegeManager.enablePrivilege(
        'UniversalFileRead'
        );
      return file.length();
    }
    else return -1;
  }
  else if (document.all) {
    window.oldOnError = window.onerror;
    window.onerror = function (err) {
      if (err.indexOf('utomation') != -1) {
        alert('file access not possible');
        return true;
      }
      else 
        return false;
    };
    var fso = new ActiveXObject('Scripting.FileSystemObject');
    var file = fso.GetFile(fileName);
    window.onerror = window.oldOnError;
    return file.Size;
  }
}


//图片略缩图调整
var flag=false; 
function Edit_Image(ImgD,widthD,heightD)
{ 
	var image=new Image(); 
	image.src=ImgD.src; 
	if(image.width>0 && image.height>0)
	{ 
		flag=true; 
		if(image.width/image.height>= widthD/heightD)
		{ 
			if(image.width>widthD)
			{ 
				ImgD.width=widthD; 
				ImgD.height=(image.height*widthD)/image.width; 
			}
			else
			{ 
				ImgD.width=image.width; 
				ImgD.height=image.height; 
			} 
			ImgD.alt=image.width+"x"+image.height; 
		} 
		else
		{ 
			if(image.height>heightD)
			{ 
				ImgD.height=heightD; 
				ImgD.width=(image.width*heightD)/image.height; 
			}
			else
			{ 
				ImgD.width=image.width; 
				ImgD.height=image.height; 
			} 
				ImgD.alt=image.width+"x"+image.height; 
			} 
	} 
} 

//图片转换
function Change_Img(name,url)
{
	document.images[name].src=url
}

//自动提交表单
function AutoSubmit(form) 
{
	document.all[form].submit();
}

function SmallWindow(str,w,h)
{
	window.open(str,'','width='+w+',height='+h+',toolbar=no, status=no, menubar=no, resizable=yes, scrollbars=yes');
}

//确认和取消
function IsOrNot(str)
{
	if(confirm(str))
	{
		return true;
	}
	else
	{
		history.go(-1);
		return false;
	}
}
//-->