
//字符串函数，去掉左右的空格
	String.prototype.Trim  = function(){return this.replace(/^\s+|\s+$/g,"");}
	String.prototype.Ltrim = function(){return this.replace(/^\s+/g, "");}
	String.prototype.Rtrim = function(){return this.replace(/\s+$/g, "");}

//显示当前日期
function date(){
	var enabled = 0; today = new Date();
	var day;var date;
	if(today.getDay() == 0 ) day="<font color=red>星期日</font>";
	if(today.getDay() ==1) day="星期一";
	if(today.getDay() ==2) day="星期二";
	if(today.getDay() ==3) day="星期三";
	if(today.getDay() ==4) day="星期四";
	if(today.getDay() ==5) day="星期五";
	if(today.getDay() ==6) day="<font color=red>星期六</font>";
	date="<font color=black> "+(today.getYear())+"年"+(today.getMonth()+1)+"月"+(today.getDate())+"日 "+"</font><br>";
	document.write(date);
	date="<font color=black>"+day+"</font>";
	document.write(date);
}

function check_this(o){
	var value;
	value = o.value;
	alert(value);

	return false;
}
//检查输入的是否为数字
function b_isnumber(obj){
    var s=""+obj.value;
    if(s==""){ alert("没有输入数据");obj.focus();return false;}
    if((s.charAt(0)<"0" || s.charAt(0)>"9") && s.charAt(0)!="." && s.charAt(0)!="-") { alert("有非法字符，只能输入数字和字符'.'");obj.select();obj.focus();return false;}
	for(i=1;i<s.length;i++){ if((s.charAt(i)<"0" || s.charAt(i)>"9") && s.charAt(i)!=".") { alert("有非法字符，只能输入数字和字符'.'");obj.select();obj.focus();return false;}}
    return true;
   }

//检查输入的是否为日期格式
 function b_isdate(obj){
    var s=obj.value;
    var i1,i2;
    i1=s.indexOf("-");
    if(i1!=-1){ i2=s.indexOf("-",i1+1);}
    if(s.length<8 || s.length>10 || i1==-1 || i2==-1){ alert("格式输入错误，请按此格式：2001-10-1");obj.select();obj.focus();return false;}
    for(i=0;i<s.length;i++){ if((s.charAt(i)<"0" || s.charAt(i)>"9") && s.charAt(i)!="-") { alert("有非法字符，请按此格式：2001-10-1");obj.select();obj.focus();return false;}}
    if(parseInt(s.substring(0,i1))>2020 || parseInt(s.substring(0,i1))<1920){ alert("年份输入错误，范围应在：1920－2020");obj.select();obj.focus();return false;}
    if(s.substring(i1+1,i1+2)=="0"){
	if(parseInt(s.substring(i1+2,i2))>12 || parseInt(s.substring(i1+2,i2))<1){ alert("月份输入错误，范围应在：1－12");obj.select();obj.focus();return false;}
    }
    else{
	if(parseInt(s.substring(i1+1,i2))>12 || parseInt(s.substring(i1+1,i2))<1){ alert("月份输入错误，范围应在：1－12");obj.select();obj.focus();return false;}
    }   
    if(s.substring(i2+1,i2+2)=="0"){
	if(parseInt(s.substring(i2+2,s.length))>31 || parseInt(s.substring(i2+2,s.length))<1){ alert("日期输入错误，范围应在：1－31");obj.select();obj.focus();return false;}
    }
    else{
	if(parseInt(s.substring(i2+1,s.length))>31 || parseInt(s.substring(i2+1,s.length))<1){ alert("日期输入错误，范围应在：1－31");obj.select();obj.focus();return false;}
    }
    return true;
  }

 function b_isdateorspace(obj){
    var s=obj.value;
    var i1,i2;
    if(s==""){ return true;}
    i1=s.indexOf("-");
    if(i1!=-1){ i2=s.indexOf("-",i1+1);}
    if(s.length<8 || s.length>10 || i1==-1 || i2==-1){ alert("格式输入错误，请按此格式：2001-10-1");obj.select();obj.focus();return false;}
    for(i=0;i<s.length;i++){ if((s.charAt(i)<"0" || s.charAt(i)>"9") && s.charAt(i)!="-") { alert("有非法字符，只能输入数字和字符'-'");obj.select();obj.focus();return false;}}
    if(parseInt(s.substring(0,i1))>2050 || parseInt(s.substring(0,i1))<1920){ alert("年份输入错误，范围应在：1920－2050");obj.select();obj.focus();return false;}
    if(s.substring(i1+1,i1+2)=="0"){
	if(parseInt(s.substring(i1+2,i2))>12 || parseInt(s.substring(i1+2,i2))<1){ alert("月份输入错误，范围应在：1－12");obj.select();obj.focus();return false;}
    }
    else{
	if(parseInt(s.substring(i1+1,i2))>12 || parseInt(s.substring(i1+1,i2))<1){ alert("月份输入错误，范围应在：1－12");obj.select();obj.focus();return false;}
    }   
    if(s.substring(i2+1,i2+2)=="0"){
	if(parseInt(s.substring(i2+2,s.length))>31 || parseInt(s.substring(i2+2,s.length))<1){ alert("日期输入错误，范围应在：1－31");obj.select();obj.focus();return false;}
    }
    else{
	if(parseInt(s.substring(i2+1,s.length))>31 || parseInt(s.substring(i2+1,s.length))<1){ alert("日期输入错误，范围应在：1－31");obj.select();obj.focus();return false;}
    }
    return true;
  }
//检查值是否为空
function b_isspace(obj){
	if(obj.value==""){alert("值不能为空");return false;}
	return true;
}
//检查是否为时间类型
function b_istime(obj){
    var s=obj.value;
    var i,i1;
    i1=s.indexOf(":");
    if(s.length!=5 || i1==-1){ alert("格式输入错误，请按此格式：08:06");obj.select();obj.focus();return false;}
    for(i=0;i<2;i++){ if(s.charAt(i)<"0" || s.charAt(i)>"9") { alert("有非法字符，只能输入数字和字符:");obj.select();obj.focus();return false;}}
    for(i=3;i<5;i++){ if(s.charAt(i)<"0" || s.charAt(i)>"9") { alert("有非法字符，只能输入数字和字符:");obj.select();obj.focus();return false;}} 
   return true;
  }
//打印页面
function f_prin_fra(frame){
	var obj=eval("document.all."+frame);  
	var ie_ver = navigator.appVersion.match(/MSIE \d\.\d/);
	if (ie_ver=="MSIE 5.0") {
	    obj.focus();
	    window.print(); 
	}
	else if (ie_ver=="MSIE 5.5" || ie_ver=="MSIE 6.0"){
	    obj.contentWindow.focus();
	    obj.contentWindow.print();
	}else alert("对不起，您的浏览器应至少是IE5.0以上版本！请升级您的浏览器。否则，您将不能够打印该文档。");

}
//检查用户名及密码
function check_user(Object){
	//var name;
	var pass;
	//name=Object.user.value;
	pass=Object.pass.value;
	/*if(name == "请输入用户名..."){
		name="";
		}
	if(pass == "password"){
		pass="";
		}
	if(name == ""){
		alert('用户名不能为空！');
		Object.user.focus();
		return false;}
	else*/
	if(pass == ""){
		alert('密码不能为空！');
		Object.pass.focus();
		return false;}
	else{
		return true;
		}
	}

//检查密码及校对密码
function check_chang_pass(Object){
	var re_pass;
	var pass;
	re_pass=Object.re_cPass.value;
	pass=Object.cPass.value;
	if(pass == ""){
		alert('密码不能为空！');
		Object.cPass.focus();
		return false;}
	else if(re_pass == ""){
		alert('校核密码不能为空！');
		Object.re_cPass.focus();
		return false;}
	else if( pass != repass ){
		alert('您二次输入的密码不相同！');
		Object.cPass.focus();
		return false;
	}
	else{	return true;}
}

//保存部门名称及编号时检查其值是否为空
function check_department(){
	var bh;
	var name;
	bh=add_frm.new_bh.value;
	name=add_frm.new_bm.value;
	if(bh == ""){
		alert('部门编号不能为空！');
		add_frm.new_bh.focus();
		return false;}
	else if(name == ""){
			alert('部门名称不能为空！');
			add_frm.new_bm.focus();
			return false;}
		else{
			return true;
			}
	}

function mouseovertd(o){
	o.style.cursor="hand";
	o.style.background="#ff9900";
}
function mouseouttd(o){
	o.style.cursor="hand";
	o.style.background="#94c2dc";
}

//工资打印（按下打印后，提示将打印机的纸张设为横放）
//与银行对帐表不提示横向设置
function gz_print(){
	var gz_print;
//	gz_print = window.top.mainFrame.gz_print_sele.value;
//	if(gz_print != 'ying_han'){
		alert("请将打印纸设置为横放！\n\n方法：将'布局'选项卡中的'方向'设为'横向'。");
//	}
//	window.top.mainFrame.print();
	window.print();
	return false;
}

//打印网页
function print_html(){
	var gz_print;
//	gz_print = window.top.mainFrame.gz_print_sele.value;
//	if(gz_print != 'ying_han'){
		alert("请将打印纸调整好！");
//	}
	window.top.print();
	return false;
}

//浮在固定位置的层(工具条)
float_init	= 1;
function DHTML_Init(Object) { 
	if (navigator.userAgent.match(/Mozilla\/5\../) && float_init) { 
 		SetObjectOffsetTop(Object, undefined);
 	}
}
function All (ID) { 
	if (document.all)	{  return document.all[ID];   } 
	else if (document.documentElement){return document.getElementById (ID); } 
		else if (document.layers)	{ return document.layers[ID]; }
}
function GetWindowOffsetTop() {
	if (window.innerHeight)	{ return window.pageYOffset; }
	else if (document.body)	{ return document.body.scrollTop; }
} 
function GetWindowHeight() { 
	if (window.innerHeight)	{ return window.innerHeight; } 
  else if (document.body)	{ return document.body.clientHeight; }
} 
function GetObjectHeight(Object) {
	DHTML_Init(Object);
 	if (document.all || document.documentElement)	{
		Clip = Object.style.clip; 
    if (! Clip) { return Object.offsetHeight; }
    else{ return GetClipElement (Clip, 'Bottom'); }
		} 
  else if (document.layers)	{ return Object.clip.height; }
} 
function GetClipElement (Clip, Element) {
	Clip = Clip.substr(Clip.indexOf('(') + 1); 
  Clip = Clip.substr(0, Clip.length - 1);
	Clippers = Clip.split (" "); 
  for (i = 0; i < Clippers.length; i++) { 
		if (Clippers[i] != 'auto') 
			{ Clippers[i] = Clippers[i].replace (/D/g, ""); }
	} 
  ClipTop = Number(Clippers[0]); 
  ClipRight = Number(Clippers[1]); 
  ClipBottom = Number(Clippers[2]);
  ClipLeft = Number(Clippers[3]); 
  if (Element == 'Top')		{ return ClipTop; } 
  else if (Element == 'Right')	{ return ClipRight; } 
		else if (Element == 'Bottom')	{ return ClipBottom; } 
			else if (Element == 'Left')	{ return ClipLeft; } 
				else{ return undefined; }
} 
function GetObjectOffsetTop(Object) { 
	DHTML_Init(Object); 
  if (Object.offsetTop)	{ return Object.offsetTop; } 
  else if (document.layers)	{ return Object.top; }
} 
function SetObjectOffsetTop(Object, Offset) { 
	if (Object.style)	{ Object.style.top = Offset; } 
  else if (Object.top)	{ Object.top = Offset; }
} 
	CenterMenu = 1;	 
  MenuBorder = 100; 
  TimeCheck  = 250;	 
  TimeUpdate = 5; 
  DivUpdate  = 5;	 
  Minimum    = 50;	 
  AddHeight  = -4; 
function ScrollMenu() { 
	Menu = All('persistMenu'); 
  WinTop	= GetWindowOffsetTop(); 
  WinHeight	= GetWindowHeight() + AddHeight;
  MenuTop	= GetObjectOffsetTop(Menu); 
  MenuHeight = GetObjectHeight (Menu); 
  MenuNew	= (CenterMenu) ? Math.round (WinTop + (WinHeight - MenuHeight) / 1) : WinTop + MenuBorder;
  if (MenuNew < Minimum) { MenuNew = Minimum; }
  if (MenuTop != MenuNew) { 
		if ( (MenuTop + MenuHeight) < WinTop || MenuTop > (WinTop + WinHeight) ) { 
			SetObjectOffsetTop (Menu, (MenuTop < MenuNew) ? (WinTop - MenuHeight) : (WinTop + WinHeight)); 
    }
		else { 
			Add = (MenuTop < MenuNew) ? 1 : -1; 
			SetObjectOffsetTop (Menu, MenuTop + Math.round((MenuNew - MenuTop) / DivUpdate) + Add); 
    } 
  } 
  window.setTimeout('ScrollMenu()', (GetObjectOffsetTop(Menu) == MenuNew) ? TimeCheck : TimeUpdate); 
}
//浮在固定位置的层(工具条)--结束

//科学计算器 Script 开始
<!--
var endNumber=true
var mem=0
var carry=10
var hexnum="0123456789abcdef"
var angle="d"
var stack=""
var level="0"
var layer=0


//数字键

function inputkey(key)
{
	var index=key.charCodeAt(0);
	if ((carry==2 && (index==48 || index==49))
	 || (carry==8 && index>=48 && index<=55)
	 || (carry==10 && (index>=48 && index<=57 || index==46))
	 || (carry==16 && ((index>=48 && index<=57) || (index>=97 && index<=102))))
	if(endNumber)
	{
		endNumber=false
		document.calc.display.value = key
	}
	else if(document.calc.display.value == null || document.calc.display.value == "0")
		document.calc.display.value = key
	else
		document.calc.display.value += key
}

function changeSign()
{
    if (document.calc.display.value!="0")
    	if(document.calc.display.value.substr(0,1) == "-")
        	document.calc.display.value = document.calc.display.value.substr(1)
    	else
        	document.calc.display.value = "-" + document.calc.display.value
}

//函数键

function inputfunction(fun,shiftfun)
{
	endNumber=true
	if (document.calc.shiftf.checked)
		document.calc.display.value=decto(funcalc(shiftfun,(todec(document.calc.display.value,carry))),carry)
	else
		document.calc.display.value=decto(funcalc(fun,(todec(document.calc.display.value,carry))),carry)
	document.calc.shiftf.checked=false
	document.calc.hypf.checked=false	
	inputshift()
}

function inputtrig(trig,arctrig,hyp,archyp)
{
	if (document.calc.hypf.checked)
		inputfunction(hyp,archyp)
	else
		inputfunction(trig,arctrig)
}


//运算符

function operation(join,newlevel)
{
	endNumber=true
	var temp=stack.substr(stack.lastIndexOf("(")+1)+document.calc.display.value
	while (newlevel!=0 && (newlevel<=(level.charAt(level.length-1))))
	{
		temp=parse(temp)
		level=level.slice(0,-1)
	}
	if (temp.match(/^(.*\d[\+\-\*\/\%\^\&\|x])?([+-]?[0-9a-f\.]+)$/))
		document.calc.display.value=RegExp.$2
	stack=stack.substr(0,stack.lastIndexOf("(")+1)+temp+join
	document.calc.operator.value=" "+join+" "
	level=level+newlevel
	
}

//括号

function addbracket()
{
	endNumber=true
	document.calc.display.value=0
	stack=stack+"("
	document.calc.operator.value="   "
	level=level+0
	
	layer+=1
	document.calc.bracket.value="(="+layer
}

function disbracket()
{
	endNumber=true
	var temp=stack.substr(stack.lastIndexOf("(")+1)+document.calc.display.value
	while ((level.charAt(level.length-1))>0)
	{
		temp=parse(temp)
		level=level.slice(0,-1)
	}
	
	document.calc.display.value=temp
	stack=stack.substr(0,stack.lastIndexOf("("))
	document.calc.operator.value="   "
	level=level.slice(0,-1)

	layer-=1
	if (layer>0)
		document.calc.bracket.value="(="+layer
	else
		document.calc.bracket.value=""
}

//等号

function result()
{
	endNumber=true
	while (layer>0)
		disbracket()
	var temp=stack+document.calc.display.value
	while ((level.charAt(level.length-1))>0)
	{
		temp=parse(temp)
		level=level.slice(0,-1)
	}

	document.calc.display.value=temp
	document.calc.bracket.value=""
	document.calc.operator.value=""
	stack=""
	level="0"
}


//修改键

function backspace()
{
	if (!endNumber)
	{
		if(document.calc.display.value.length>1)
			document.calc.display.value=document.calc.display.value.substring(0,document.calc.display.value.length - 1)
		else
			document.calc.display.value=0
	}
}

function clearall()
{
	document.calc.display.value=0
	endNumber=true
	stack=""
	level="0"
	layer=""
	document.calc.operator.value=""
	document.calc.bracket.value=""
}


//转换键

function inputChangCarry(newcarry)
{
	endNumber=true
	document.calc.display.value=(decto(todec(document.calc.display.value,carry),newcarry))
	carry=newcarry

	document.calc.sin.disabled=(carry!=10)
	document.calc.cos.disabled=(carry!=10)
	document.calc.tan.disabled=(carry!=10)
	document.calc.bt.disabled=(carry!=10)
	document.calc.pi.disabled=(carry!=10)
	document.calc.e.disabled=(carry!=10)
	document.calc.kp.disabled=(carry!=10)
				
	document.calc.k2.disabled=(carry<=2)
	document.calc.k3.disabled=(carry<=2)
	document.calc.k4.disabled=(carry<=2)
	document.calc.k5.disabled=(carry<=2)
	document.calc.k6.disabled=(carry<=2)
	document.calc.k7.disabled=(carry<=2)
	document.calc.k8.disabled=(carry<=8)
	document.calc.k9.disabled=(carry<=8)
	document.calc.ka.disabled=(carry<=10)
	document.calc.kb.disabled=(carry<=10)
	document.calc.kc.disabled=(carry<=10)
	document.calc.kd.disabled=(carry<=10)
	document.calc.ke.disabled=(carry<=10)
	document.calc.kf.disabled=(carry<=10)

	
	
}

function inputChangAngle(angletype)
{
	endNumber=true
	angle=angletype
	if (angle=="d")
		document.calc.display.value=radiansToDegress(document.calc.display.value)
	else
		document.calc.display.value=degressToRadians(document.calc.display.value)
	endNumber=true
}

function inputshift()
{
	if (document.calc.shiftf.checked)
	{
		document.calc.bt.value="deg "
		document.calc.ln.value="exp "
		document.calc.log.value="expd"
		
		if (document.calc.hypf.checked)
		{
			document.calc.sin.value="ahs "
			document.calc.cos.value="ahc "
			document.calc.tan.value="aht "
		}
		else
		{
			document.calc.sin.value="asin"
			document.calc.cos.value="acos"
			document.calc.tan.value="atan"
		}
		
		document.calc.sqr.value="x^.5"
		document.calc.cube.value="x^.3"
		
		document.calc.floor.value="小数"
	}
	else
	{
		document.calc.bt.value="d.ms"
		document.calc.ln.value=" ln "
		document.calc.log.value="log "

		if (document.calc.hypf.checked)
		{
			document.calc.sin.value="hsin"
			document.calc.cos.value="hcos"
			document.calc.tan.value="htan"
		}
		else
		{
			document.calc.sin.value="sin "
			document.calc.cos.value="cos "
			document.calc.tan.value="tan "
		}
		
		document.calc.sqr.value="x^2 "
		document.calc.cube.value="x^3 "
		
		document.calc.floor.value="取整"
	}

}
//存储器部分

function clearmemory()
{
	mem=0
	document.calc.memory.value="   "
}

function getmemory()
{
	endNumber=true
	document.calc.display.value=decto(mem,carry)
}

function putmemory()
{
	endNumber=true
	if (document.calc.display.value!=0)
	{
		mem=todec(document.calc.display.value,carry)
		document.calc.memory.value=" M "
	}
	else
		document.calc.memory.value="   "
}

function addmemory()
{
	endNumber=true
	mem=parseFloat(mem)+parseFloat(todec(document.calc.display.value,carry))
	if (mem==0)
		document.calc.memory.value="   "
	else
		document.calc.memory.value=" M "
}

function multimemory()
{
	endNumber=true
	mem=parseFloat(mem)*parseFloat(todec(document.calc.display.value,carry))
	if (mem==0)
		document.calc.memory.value="   "
	else
		document.calc.memory.value=" M "
}

//十进制转换

function todec(num,oldcarry)
{
	if (oldcarry==10 || num==0) return(num)
	var neg=(num.charAt(0)=="-")
	if (neg) num=num.substr(1)
	var newnum=0
	for (var index=1;index<=num.length;index++)
		newnum=newnum*oldcarry+hexnum.indexOf(num.charAt(index-1))
	if (neg)
		newnum=-newnum
	return(newnum)
}

function decto(num,newcarry)
{
	var neg=(num<0)
	if (newcarry==10 || num==0) return(num)
	num=""+Math.abs(num)
	var newnum=""
	while (num!=0)
	{
		newnum=hexnum.charAt(num%newcarry)+newnum
		num=Math.floor(num/newcarry)
	}
	if (neg)
		newnum="-"+newnum
	return(newnum)
}

//表达式解析

function parse(string)
{
	if (string.match(/^(.*\d[\+\-\*\/\%\^\&\|x\<])?([+-]?[0-9a-f\.]+)([\+\-\*\/\%\^\&\|x\<])([+-]?[0-9a-f\.]+)$/))
		return(RegExp.$1+cypher(RegExp.$2,RegExp.$3,RegExp.$4))
	else
		return(string)
}

//数学运算和位运算

function cypher(left,join,right)
{
	left=todec(left,carry)
	right=todec(right,carry)
	if (join=="+")
		return(decto(parseFloat(left)+parseFloat(right),carry))
	if (join=="-")
		return(decto(left-right,carry))
	if (join=="*")
		return(decto(left*right,carry))
	if (join=="/" && right!=0)
		return(decto(left/right,carry))
	if (join=="%")
		return(decto(left%right,carry))
	if (join=="&")
		return(decto(left&right,carry))
	if (join=="|")
		return(decto(left|right,carry))
	if (join=="^")
		return(decto(Math.pow(left,right),carry))
	if (join=="x")
		return(decto(left^right,carry))
	if (join=="<")
		return(decto(left<<right,carry))
	alert("除数不能为零")
	return(left)
}

//函数计算

function funcalc(fun,num)
{
	with(Math)
	{
		if (fun=="pi")
			return(PI)
		if (fun=="e")
			return(E)

		if (fun=="abs")
			return(abs(num))
		if (fun=="ceil")
			return(ceil(num))
		if (fun=="round")
			return(round(num))

		if (fun=="floor")
			return(floor(num))
		if (fun=="deci")
			return(num-floor(num))


		if (fun=="ln" && num>0)
			return(log(num))
		if (fun=="exp")
			return(exp(num))
		if (fun=="log" && num>0)
			return(log(num)*LOG10E)
		if (fun=="expdec")
			return(pow(10,num))

		
		if (fun=="cube")
			return(num*num*num)
		if (fun=="cubt")
			return(pow(num,1/3))
		if (fun=="sqr")
			return(num*num)
		if (fun=="sqrt" && num>=0)
			return(sqrt(num))

		if (fun=="!")
			return(factorial(num))

		if (fun=="recip" && num!=0)
			return(1/num)
		
		if (fun=="dms")
			return(dms(num))
		if (fun=="deg")
			return(deg(num))

		if (fun=="~")
			return(~num)
	
		if (angle=="d")
		{
			if (fun=="sin")
				return(sin(degressToRadians(num)))
			if (fun=="cos")
				return(cos(degressToRadians(num)))
			if (fun=="tan")
				return(tan(degressToRadians(num)))

			if (fun=="arcsin" && abs(num)<=1)
				return(radiansToDegress(asin(num)))
			if (fun=="arccos" && abs(num)<=1)
				return(radiansToDegress(acos(num)))
			if (fun=="arctan")
				return(radiansToDegress(atan(num)))
		}
		else
		{
			if (fun=="sin")
				return(sin(num))
			if (fun=="cos")
				return(cos(num))
			if (fun=="tan")
				return(tan(num))

			if (fun=="arcsin" && abs(num)<=1)
				return(asin(num))
			if (fun=="arccos" && abs(num)<=1)
				return(acos(num))
			if (fun=="arctan")
				return(atan(num))
		}
	
		if (fun=="hypsin")
			return((exp(num)-exp(0-num))*0.5)
		if (fun=="hypcos")
			return((exp(num)+exp(-num))*0.5)
		if (fun=="hyptan")
			return((exp(num)-exp(-num))/(exp(num)+exp(-num)))

		if (fun=="ahypsin" | fun=="hypcos" | fun=="hyptan")
		{
			alert("对不起,公式还没有查到!")
			return(num)
		}
		
		alert("超出函数定义范围")
		return(num)
	}
}

function factorial(n)
{
	n=Math.abs(parseInt(n))
	var fac=1
	for (;n>0;n-=1)
		fac*=n
	return(fac)
}

function dms(n)
{
	var neg=(n<0)
	with(Math)
	{	
		n=abs(n)
		var d=floor(n)
		var m=floor(60*(n-d))
		var s=(n-d)*60-m
	}
	var dms=d+m/100+s*0.006
	if (neg) 
		dms=-dms
	return(dms)
}

function deg(n)
{
	var neg=(n<0)
	with(Math)
	{
		n=abs(n)
		var d=floor(n)
		var m=floor((n-d)*100)
		var s=(n-d)*100-m
	}
	var deg=d+m/60+s/36
	if (neg) 
		deg=-deg
	return(deg)
}

function degressToRadians(degress)
{
	return(degress*Math.PI/180)
}

function radiansToDegress(radians)
{
	return(radians*180/Math.PI)
}

//界面

//-->
//科学计算器 -- 结束

//备注字段的编辑与显示
function memo_show(right_level,atype_name){
//	childwin=window.open('/sys/memo_edit.asp?right_level='+right_level+'&memo_name='+atype_name,'test','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=2,scrollbars=no,resizable=yes,center:yes');
	childwin=new_openwin('/sys/memo_edit.asp?right_level='+right_level+'&memo_name='+atype_name,550,200);
//	window.showModelessDialog('/sys/memo_edit.asp?right_level='+right_level+'&memo_name='+atype_name,window,"dialogheight=200px;dialogwidth=550px;status:no;help:no")
}
//备注字段的显示
function memo_show2(memo_note){
//	childwin=window.open('/sys/memo_show.asp?memo_note='+memo_note,'test','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=2,scrollbars=no,resizable=yes,center:yes');
	childwin=new_openwin('/sys/memo_show.asp?memo_note='+memo_note,550,200)
}
//字段信息设置
function field_set(db_name,table_name,field_name,right_level){
//	field_set_win=window.open('/sys/field_set.asp?db_name='+db_name+'&table_name='+table_name+'&field_name='+field_name+'&right_level='+right_level,'test','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=2,scrollbars=no,resizable=yes,center:yes');
	field_set_win=new_openwin('/sys/field_set.asp?db_name='+db_name+'&table_name='+table_name+'&field_name='+field_name+'&right_level='+right_level,400,350)
}
//关闭窗口
function close_window(){
	self.close();
}
//radio组件事件
function radio_mouseup(obj){
		if(!obj.checked){obj.checked=true;} else {obj.checked=false;}
		return false;	
	}
function radio_mouseover(){
		window.status="单击选择，连击取消选择！";
		return false;
	}
function radio_mouseout(){
		window.status="";
		return false;
	}
//事件结束
//新开窗口，置于屏幕中央
function new_openwin(sUrl,iWidth,iHeight)
{
  l = (screen.width - iWidth)/2-10;
  t = (screen.height- iHeight)/2-16;
  window.open(sUrl,"","resizable=1,width="+iWidth+",height="+iHeight+",left="+l+",top="+t);
}
//新开窗口，置于屏幕中央
function new_openwin2(sUrl,iWidth,iHeight)
{
  l = (screen.width - iWidth)/2-10;
  t = (screen.height- iHeight)/2-16;
  window.open(sUrl,"","scrollbars=2,resizable=1,width="+iWidth+",height="+iHeight+",left="+l+",top="+t);
}
//新开窗口，置于屏幕中央
function name_openwin(sUrl,sWinname,iWidth,iHeight)
{
  l = (screen.width - iWidth)/2-10;
  t = (screen.height- iHeight)/2-16;
  window.open(sUrl,sWinname,"scrollbars=0,resizable=0,width="+iWidth+",height="+iHeight+",left="+l+",top="+t);
}
//表格第一栏浮动显示
function f_scroll()
{
 if(document.all.jerker.length>=0)
 {
   jerker[0].style.top=document.body.scrollTop;
   jerker[0].className='SrcollTitle';
  }
}
//检查表单对象中是否存在不合法字符
function f_chk_form(obj){
	for(i=0;i<form1.elements.length;i++)
			if(form1.elements[i].type=="text"){
				if((form1.elements[i].value).indexOf(";")>=0){
					alert("不允许输入';'进行查询!");
					return false;
				}
			}
	return true;	
}