	
	function newin(s,b,w,h,status,res) {
	var hei=(screen.availHeight-300)/2
	var wid=(screen.availWidth-500)/2
	var t
	t=window.open(s,(b)?b:"_blank","status="+(status?1:0)+",left=" +wid+",top="+hei+",menubar=0,resizable="+(res?1:0)+",titlebar="+(res?1:0)+",width=500,height=280")
	return (t)
	}
	
	function openwin(url)	{
			var vartop=(screen.availHeight-530)/2
			var varwid=(screen.availWidth-750)/2
			var thisnewwin
			thisnewwin = window.open(url,'Detailwin','top='+vartop+',left='+varwid+',height=360,width=280,resizable=no,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no')
			thisnewwin.focus()
			return false
		}
	
	function change_tab(target)
	{
		for	(a=0;a<document.all.length;a++){						
			if ((document.all[a].id.substr(0,4)=='htab')||(document.all[a].id=='search_result')){
				document.all[a].className='clsTabBlur';
			}
		}
		document.all["htab"+target].className='clsTabSelected';
	}	
	
	function _go(a)
	{
		var no = parseInt(document.all(a+"page_no").value)
		var skip=parseInt(document.all(a+"page_skip").value)
		var countold=parseInt(document.all(a+"page_count").defaultValue)	
		var count=parseInt(document.all(a+"page_count").value)
		var totalcount=parseInt(document.all(a+"totalcount").value)
		if(count<=0||count>totalcount) count=countold
		if(no<1) no=1
		var icount=totalcount/count
		if(Math.round(icount)<icount){
		   icount=Math.round(icount) + 1
		}
		else {
		   icount=Math.round(icount)
		}
		if(no>icount) no=1
		skip=(no-1)*countold
		if (isNaN(count)) {
			alert("行数要是整型")
			document.all(a+"page_count").focus()
			return
		}
		document.location = "?Skip=" + skip + "&totalcount="+ totalcount +"&Count=" + count + "&" + document.all(a+"querystring").value
	}
	
	function _last_page(a)
	{
		var skip=parseInt(document.all(a+"page_skip").value)
		var countold=parseInt(document.all(a+"page_count").defaultValue)	
		var count=parseInt(document.all(a+"page_count").value)
		var totalcount=parseInt(document.all(a+"totalcount").value)
		skip = skip-count
		if (skip<0) skip=0
		if (isNaN(count)) {
			alert("行数要是整型")
			document.all(a+"page_count").focus()
			return
		}
		document.location = "?Skip=" + skip +"&totalcount="+ totalcount +"&Count=" + count + "&" + document.all(a+"querystring").value
	}
	
	function _next_page(a)
	{
		var skip=parseInt(document.all(a+"page_skip").value)
		var countold=parseInt(document.all(a+"page_count").defaultValue)	
		var count=parseInt(document.all(a+"page_count").value)
		var totalcount=parseInt(document.all(a+"totalcount").value)
		skip = skip+countold
		if (isNaN(count)) {
			alert("行数要是整型")
			document.all(a+"page_count").focus()
			return
		}
		
		document.location = "?Skip=" + skip +"&totalcount="+ totalcount +"&Count=" + count + "&" + document.all(a+"querystring").value
	}
	
	function _show_hidden_buMenCengCi_new(obj){
		try{

				if (obj.src.indexOf("plus_b.gif")>=0){
					obj.src=obj.src.replace(/plus_b.gif/i,"plus_a.gif")
				 }else{
				 	obj.src=obj.src.replace(/plus_a.gif/i,"plus_b.gif")
				 }
				t=obj.parentElement.nextSibling.style;
				if (t.display=="none"){
					t.display="block";
				}else{
					t.display="none"
				}
		}catch(e){
		}		
	}

	function check(theform,func)
	{
		var e=theform.elements;
		for (var i=0,lngLeng = e.length;i<lngLeng;i++)
		{
			if (e[i].disabled) continue;
			if (e[i].leixing==null) continue;
			if (e[i].chulibz=='R') continue

			var strValue;
			strValue=e[i].value.replace(/^\s+|\s+$/,"");
			e[i].value=strValue;
			
			if (strValue==""){
				if (e[i].allowNull==null){
				
					if (e[i].chulibz=='M'){
					
							_goError(e[i],func,"该项目不能为空！")
							return false
					}
					
					continue
				}
							
				if (e[i].allowNull=='Y'){
				
					continue
				}
				if (e[i].chulibz=='M'){
				
							_goError(e[i],func,"该项目不能为空！")
							return false
				}	
				
				switch(e[i].leixing){
					case "NVC":
					case "VC":
					case "C":						
						continue
					default:
							_goError(e[i],func,"该项目不能为空！")
							return false
				}					
			}

			
			if (e[i].value.length>e[i].maxlength&&(e[i].tagName=='TEXTAREA')){
				alert (e[i].parentElement.previousSibling.innerText+"长度过长应该小于"+e[i].maxlength);
				e[i].focus();
				return (false);
			}		
						
			switch(e[i].leixing)
			{
				case 'NVC':
						break
				case 'VC':
						break
				case 'I':
						
						if (!isintstr(strValue)){
							_goError(e[i],func)
							return false
						}
						break
						
				case 'IP':
						{
						  var filter=/[0-5]{1,3}.[0-5]{1,3}.[0-5]{1,3}.[0-5]{1,3}/;
						  
						  if (!filter.test(strValue))
						  {
							_goError(e[i],func)
							return false
							}
						}
						break

				case 'DA':

						if (!isdatestr(strValue)){
							_goError(e[i],func)
							return false
							
						}
						
						if (!isValidSmallDate(strValue)){
							_goError(e[i],func,"日期超出了SmallDate的范围（1900-1-1到 2079-6-6）")
							return false
						}
						break

				case 'LDA':
						
						if (!isdatestr_lda(strValue)){
							_goError(e[i],func)
							return false
							
						}
						
						if (!isValidSmallDate(strValue)){
							_goError(e[i],func,"日期超出了SmallDate的范围（1900-1-1到 2079-6-6）")
							return false
						}
						break
				case 'DE':
						if (!isDecimal(e[i].value)){
							_goError(e[i],func)
							return false
						}	
						break
						
				case 'R':
						
						if (!isintstr(strValue)){
							_goError(e[i],func)
							return false
						}
						break

				case 'M':
						if (!isMoney(e[i].value)){
							_goError(e[i],func)
							return false
						}	
						break
				case 'SJ':					
					
					if (!(/^(([0-1][0-9])|([2][0-3])|[0-9]):(([0][0-9]|([1-5][0-9]|[0-9])))$/.test(strValue))){
							_goError(e[i],func)
							return false
					}
				case 'DASJ':	
					if (!isDASJ(e[i].value)){
							_goError(e[i].value,func)
							return false
					}
				case 'LLDA':
					if (!isLLDA(e[i].value)){
						_goError(e[i],func)
						return false
					}	
					break
				case 'Y':
					break
				case 'YM':
					break
			}
		}				
	return true
	}

	function _goError(e,func,s){
		if (s!=null) alert(e.parentElement.previousSibling.innerText+s)
			else	alert(e.parentElement.previousSibling.innerText+"类型错误");
		
		if (func!=null) {
			func(e)
		}
		else{			
			e.focus();			
		}
	}
	
	function _selItem(item1,item2)
	{
		var option1 = document.all(item1).options
		var option2 = document.all(item2).options
		
		var arrText = new Array();
		var arrValue = new Array();
		var j;
		j = 0;
		for(var i=option1.length-1;i>=0;i--)
		{
			if (option1(i).selected)
			{
				arrText[j]=option1(i).text;
				arrValue[j]=option1(i).value;
				option1.remove(i);
				j = j + 1;
			}
		}
		for(i=arrText.length-1;i>=0;i--)
		{
			var oOption = document.createElement("OPTION");
			option2.add(oOption);
			oOption.innerText = arrText[i];
			oOption.value = arrValue[i];		
		}
	}
	
	function _rollup(sel_item)
	{
		var option = document.all(sel_item).options
		var value
		var text
		if (document.all(sel_item).options.length == 0) return false
		if (document.all(sel_item).selectedIndex == 0) return false
		for (var i=0;i<option.length;i++)
		{
			if (option(i).selected)
			{
				value = option(i-1).value
				text  = option(i-1).innerText
				option(i-1).value = option(i).value
				option(i-1).innerText = option(i).innerText
				option(i).value = value
				option(i).innerText = text
				option(i-1).selected=true
				option(i).selected=false
			}
		}
	}
	
	function _rolldown(sel_item)
	{
		var option = document.all(sel_item).options
		var value
		var text
		if (document.all(sel_item).selectedIndex == option.length-1) return false
		for (var i=option.length-1;i>=0;i--)
		{
			if (option(i).selected)
			{
				if (i==(option.length-1)) return false
				value = option(i+1).value
				text  = option(i+1).innerText
				option(i+1).value = option(i).value
				option(i+1).innerText = option(i).innerText
				option(i).value = value
				option(i).innerText = text
				option(i+1).selected=true
				option(i).selected=false
			}
		}
	}
	
	function getToday()
	{
		var d = new Date()
		return d.getYear()+'/'+(d.getMonth()+1)+'/'+d.getDate()
	}	
	
	function getTotime()
	{
		var d = new Date()
		var s= d.getYear()+'/';
		s += formatInt((d.getMonth()+1))+'/';
		s += formatInt(d.getDate())+' ';
		s += formatInt(d.getHours())+':'
		s += formatInt(d.getMinutes())+':'
		s += formatInt(d.getSeconds())
		return s
	}
	
	function formatInt(value)
	{
		if (value<10)
		{
			return '0'+value
		}
		else
		{
			return ''+value
		}
	}
	
	function getDateFormat10(d)
	{
		if (d=="") return ''
		var arrDa
		arrDa = d.split("-")
		var s
		s = formatInt(arrDa[0])+'-'+formatInt(arrDa[1])+'-'+formatInt(arrDa[2])
		return s
	}	
	
	function checkAllItemsISNull(thisform)	{
		var e=theform.elements;
		var flag = 0;
		for (var i=0,lngLeng = e.length;i<lngLeng;i++)
		{
			if (e[i].type=="text")	{
				alert(e[i].value);
				if (e[i].value!="") 
					flag = 1;				
			}
		}
		if (flag == 0)	{
			alert("error");
			return false;
		}
		else
			return true;	
	
	}	
	
	function changeHints(subject,spanid,strlen){
		var l=strlength(subject.value)
		if (l<=strlen) {
			var templen = strlen-l
			if (document.all!=null) document.all(spanid).innerHTML="<font color=blue>还可以输入"+templen+"字符</font>"
		}
		else{
			if (document.all!=null) {
				document.all(spanid).innerHTML="<font color=red>输入的字节数超出"+strlen+"字符</font>"
			}
		}
		return true
	}	
	
	function strlength(str){
		var l=str.length;
		var n=l
		for (var i=0;i<l;i++)
		{
			if (str.charCodeAt(i)<0||str.charCodeAt(i)>255) n++
		}
		return n
	}