﻿var charttype =  0 ; // 0:bar 1:hbar 2:line 3:pie
var fcstimer = null ;
var haspopupmenu__ = false ;
var searchv_3 = [] ;
var windowid = 0 ; // 这个参数很有用，如果本URL是被窗口调用的，则此变量将存放的是该窗口的ID，为一个整数
String.prototype.timeStart = function()
{
   var ti1 = this.trim();
   var tili = ti1.indexOf(" ");
   if (tili > 0) return ti1.substr(0, tili) + " 00:00:00" ;
   else return ti1 + " 00:00:00";
};
String.prototype.timeEnd = function()
{
   var ti1 = this.trim();
   var tili = ti1.indexOf(" ");
   if (tili > 0) return ti1.substr(0, tili) + " 23:59:59" ;
   else return ti1 + " 23:59:59";
};
String.prototype.toStr = function()
{
   return tostr(this);
};
String.prototype.myleft = function(i,addspan1)
{
	addspan1 || (addspan1 = false);
	if (this.length>i) 
	{
		if (addspan1)return "<span title=\""+this.replaceAll("\"","'")+"\">"+this.substr(0,i)+"..</span>" ; 
		else return this.substr(0,i)+".." ; 
	} else return this ;
};
String.prototype.toHex = function()
{
   return tohex(this);
};
String.prototype.trim   =   function()
{
	 return $.trim(this) ;
};
String.prototype.check  =   function()
{
   var tv1 = this;
   if (tv1.indexOf("输入") == 0) tv1 = "";
   return tv1;
};
function get39code(dom1$1,code1,title1,height1)
{
	var ht1 = isnull(height1,"48") ;
	_pobj2._get39code(self.window,dom1$1,code1,title1,ht1) ;
};

function doctitle(title1,decoration1)
{
	return _pobj2._doctitle(title1,decoration1) ;
};
function inserthtml(val1) 
{
  var sel = document.selection.createRange();
  sel.text=val1;
	return  false;
};
//

function _remove_xls_useless_tag($obj11)
{
	_pobj2.__remove_xls_useless_tag(self.window,$obj11) ;
};

function html2xls(txt1)
{
	_html2xls(txt1,true) ;
};
var _saveasxlstext = "";
var _saveasxlswinname = null;
var _saveasxlstimer = null ;
function _html2xls(txt1,removetag1)
{
	var txt2 = "" ;
	if (removetag1)
	{
	  txt2 = "<span id=prnxls_lxp001>"+txt1+"</span>" ;
	  var $obj123 = $(txt2) ;
	  if (removetag1) _remove_xls_useless_tag($obj123) ;
	  txt2 = $obj123.html() ;
	} else txt2 = txt1 ;
	txt2 = txt2.replaceAll("BORDER-LEFT-COLOR:","BORDER-LEFT:0.5pt solid ") ;
	txt2 = txt2.replaceAll("BORDER-RIGHT-COLOR:","BORDER-RIGHT:0.5pt solid ") ;
	txt2 = txt2.replaceAll("BORDER-TOP-COLOR:","BORDER-TOP:0.5pt solid ") ;
	txt2 = txt2.replaceAll("BORDER-BOTTOM-COLOR:","BORDER-BOTTOM:0.5pt solid ") ;
	_saveasxlswinname = null ;
	_saveasxlswinname = window.open('/sys/html2xls.aspx', '_blank','top=2000,width=20,height=20,left=3000');
  _saveasxlstext = txt2 ;
  _saveasxlstimer = window.setTimeout("_saveasxls()",300) ;
};

function _saveasxls()
{
	try { window.clearTimeout(_saveasxlstimer);} catch(E) {} finally {} ;
	try
	{
		if (_saveasxlswinname==null) 
		{
			_saveasxlstimer = window.setTimeout("_saveasxls()",300) ;
		} else
		{	
			var aa1 = _saveasxlswinname.document.getElementById("myxlsbody").innerHTML ;
			_saveasxlswinname.document.writeln("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" >"+
				"<html><HEAD><META http-equiv=\"Content-Type\" content=\"application/vnd.ms-excel; charset='utf-8'\">"+
				"</HEAD><body>"+aa1+_saveasxlstext+"</body><html>");
		  _saveasxlswinname.document.execCommand('saveas',true,'请输入文件名(需要带后缀)');
		  _saveasxlswinname.close();
		  _saveasxlstext = "" ;
		  _saveasxlswinname = null ;
		} ;
	} catch(E) 
	{
		try { window.clearTimeout(_saveasxlstimer);} catch(E) {} finally {} ;
		window.setTimeout("_saveasxls()",300) ;
	} finally {} ;
};
function table2clipboard(tbid1)
{
	loading(true,"处理数据，需要较长时间...") ;
	var obj11 = $("#"+tbid1+"_wrap_me_") ;
	if (obj11.length<=0) $("#"+tbid1).wrap("<span id="+tbid1+"_wrap_me_></span>") ;
	obj11 = $("#"+tbid1+"_wrap_me_") ;
	var s1 = obj11.html() ;
	$(":hidden,tbody[name=details]",obj11).remove() ;
	var s2 = obj11.html() ;
	obj11.html(s1) ;
	clipboardData.setData("Text",s2);
	loading(false) ;
} ;
function table2xls(tbid1)
{
	loading(true,"处理数据，需要较长时间...") ;
	var obj11 = $("#"+tbid1+"_wrap_me_") ;
	if (obj11.length<=0) $("#"+tbid1).wrap("<span id="+tbid1+"_wrap_me_></span>") ;
	obj11 = $("#"+tbid1+"_wrap_me_") ;
	var s1 = obj11.html() ;
	$(":hidden,tbody[name=details]",obj11).remove() ;
	var newtb1 = obj11.find("#"+tbid1) ;
	newtb1.attr("border","1px") ;
	newtb1.css("border-top","0.5pt").css("border-top-width","0.5pt")  
				.css("border-bottom","0.5pt").css("border-bottom-width","0.5pt")  
				.css("border-left","0.5pt").css("border-left-width","0.5pt")  
				.css("border-right","0.5pt").css("border-right-width","0.5pt")  ;
	$("tr:first td",newtb1).css("border-top","0.5pt").css("border-top-width","0.5pt") ;
	$("tr:last td",newtb1).css("border-bottom","0.5pt").css("border-bottom-width","0.5pt") ;
	$("tr td:first",newtb1).css("border-left","0.5pt").css("border-left-width","0.5pt") ;
	$("tr td:last",newtb1).css("border-right","0.5pt").css("border-right-width","0.5pt") ;
	$("tr td",newtb1).css({"border-top":"0.5pt #000","border-top-width":"0.5pt","border-top-color":"#000", 
				"border-bottom":"0.5pt #000","border-bottom-width":"0.5pt","border-bottom-color":"#000",
				"border-left":"0.5pt #000","border-left-width":"0.5pt","border-left-color":"#000",
				"border-right":"0.5pt #000","border-right-width":"0.5pt","border-right-color":"#000"});
	$("tr td",newtb1).find(".borderleft0,.bordertop0").css({"border-top":"0 #000","border-top-width":"0",
			"border-left":"0 #000","border-left-width":"0","border-left-color":"#000"});
	var s2 = obj11.html() ;
	obj11.html(s1) ;
	html2xls(s2) ;
	loading(false) ;
};
function table2xls_full(tbid1) 
{
	var tablefmtkey1 = $("#"+tbid1).attr("tablefmtkey") ;
	var tbindex1 = _pobj2._table_format.indexOf2(tablefmtkey1,0,12) ;
	if (tbindex1<0) return ;
	var tburl1 = _pobj2._table_format[tbindex1+10] ;
	var tbfldfunc1 = _pobj2._table_format[tbindex1+11] ;
	var addline1 = false ;
	if (window.confirm("需要从服务器下载所有的数据，将占用较长时间，请耐心等待。\n\n"+
			"在执行过程中，如果被询问“是否停止运行此脚本”，请选择[否(N)]，否则无法生成数据。\n\n"+
			"请确认是否需要系统自动调整表格线，如果允许自动调整表格线，将需要更长的时间。\n\n"+
			"如果需要自动调整表格线,请点击[确认]，否则点击[取消]。")) addline1 = true ;
	loading(true,"处理数据，需要较长时间...") ;
	_pobj2._mytable(self.window, _myident, tburl1, tbfldfunc1, tbid1, 200000, 
	function(resdata1)
	{
		var s1 = $($("#"+tbid1+" tbody")[0]).html() ; 
		s1 = "<span id=lx_xls_tb_><table class=tableline>"+s1+"<tbody>"+resdata1+"</tbody></table></span>" ;
		if (addline1)
		{
			var newtb1 = $(s1) ;
			$("table:first",newtb1).attr("border","1px") ;
			$("table:first",newtb1).css("border-top","0.5pt").css("border-top-width","0.5pt")  
						.css("border-bottom","0.5pt").css("border-bottom-width","0.5pt")  
						.css("border-left","0.5pt").css("border-left-width","0.5pt")  
						.css("border-right","0.5pt").css("border-right-width","0.5pt")  ;
			$("tr:first td",newtb1).css("border-top","0.5pt").css("border-top-width","0.5pt") ;
			$("tr:last td",newtb1).css("border-bottom","0.5pt").css("border-bottom-width","0.5pt") ;
			$("tr td:first",newtb1).css("border-left","0.5pt").css("border-left-width","0.5pt") ;
			$("tr td:last",newtb1).css("border-right","0.5pt").css("border-right-width","0.5pt") ;
			$("tr td",newtb1).css({"border-top":"0.5pt #000","border-top-width":"0.5pt","border-top-color":"#000", 
					"border-bottom":"0.5pt #000","border-bottom-width":"0.5pt","border-bottom-color":"#000",
					"border-left":"0.5pt #000","border-left-width":"0.5pt","border-left-color":"#000",
					"border-right":"0.5pt #000","border-right-width":"0.5pt","border-right-color":"#000"});
			s1 = newtb1.html() ;
		} ;
	  _html2xls(s1,false) ;
	  loading(false) ;
	},'','1','');
};
function createbiz_cst(arrords1,arrattchs1,arrord3s1,arrord2s1,callf1)
{
	createbiz("","","","","",arrords1,arrattchs1,arrord3s1,arrord2s1,callf1) ;
};
function createbiz(ccctid1,cccode1,cccomp1,ccname1,cctxt1,ords1,attchs1,ord3s1,ord2s1,callf1)
{
	var s1 = "" , s2="" , s3="";
	var j = 0 ;
	if ((ccctid1!="") && (ccctid1!="0")) s1 = "ctid1:ccctid1" ;

	if ((cccode1!="")) 
	{
		if (s1!="") s1 += "," ;	s1 += "cccode:cccode1" ;
	} ;
	if ((cccomp1!="")) 
	{
		if (s1!="") s1 += "," ;	s1 += "cccomp:cccomp1" ;
	} ;
	if ((ccname1!="")) 
	{
		if (s1!="") s1 += "," ;	s1 += "ccname:ccname1" ;
	} ;
	var csttxt1 = "" ;
	if (cctxt1!=null)
	for (var i=0 ; i<cctxt1.length ; i++)
	{
		s2 = cctxt1[i] ;
		j = s2.indexOf("=") ;
		if (j>0)
		{
			s3 = s2.substr(0,j).trim() ;
			s2 = s2.substr(j+1).trim() ;
			if (csttxt1!="") csttxt1 += ";;;;;" ;
			csttxt1 += s3+"|"+s2  ;
		} ;
	} ;
	
	if (ords1!=null)
	for (var i=0 ; i<ords1.length ; i++)
	{
		s2 = ords1[i] ;
		j = s2.indexOf("=") ;
		if (j>0)
		{
			s3 = s2.substr(0,j).trim() ;
			s2 = s2.substr(j+1).trim() ;
			//s2 = s2.replaceAll("'","") ;
			//s2 = s2.replaceAll("\"","") ;
			eval("_v_"+s3+"='"+s2+"'") ;
			if (s1!="") s1 += "," ;
			s1 += s3+":_v_"+s3 ;
		} ;
	} ;
	var atts1 = "" ;
	if (attchs1!=null)
	for (var i=0;i<attchs1.length;i++)
	{
		s2 = attchs1[i] ;
		j = s2.indexOf("=") ;
		if (j>0)
		{
			s3 = s2.substr(0,j).trim() ;
			s2 = s2.substr(j+1).trim() ;
			if (atts1!="") atts1 += ";" ;
			atts1 += s3+"|"+s2 ;
		} ;
	};
	var ord3s2 = "" ;
	if (ord3s1!=null)
	for (var i=0;i<ord3s1.length;i++)
	{
		s2 = ord3s1[i] ;
		if (s2=="new") 
		{
			if (ord3s2!="") ord3s2 += ";;;;;" ;
			ord3s2 += s2 ;
		} else 
		{
			j = s2.indexOf("=") ;
			if (j>0)
			{
				s3 = s2.substr(0,j).trim() ;
				s2 = s2.substr(j+1).trim() ;
				if (ord3s2!="") ord3s2 += ";;;;;" ;
				ord3s2 += s3+"|"+s2 ;
			} ;
		} ;	
	};
	
	var ord2s2 = "" ;
	if (ord2s1!=null)
	for (var i=0;i<ord2s1.length;i++)
	{
		s2 = ord2s1[i] ;
		j = s2.indexOf("=") ;
		if ((j>0))
		{
			s3 = s2.substr(0,j).trim() ;
			s2 = s2.substr(j+1).trim() ;
			//s2 = s2.replaceAll("'","") ;
			//s2 = s2.replaceAll("\"","") ;
			if (ord2s2!="") ord2s2 += ";;;;;" ;
			ord2s2 += s3+"|"+s2 ;
		} else
		if (s2=="new") 
		{
			if (ord2s2!="") ord2s2 += ";;;;;" ;
			ord2s2 +=  s2 ;
		} ;
	};
	if (ord2s2!="")
	{
	  if (s1!="") s1 += "," ;
	  s1 += "ord2s:ord2s2" ;
	} ;
	if (csttxt1!="")
	{
	  if (s1!="") s1 += "," ;
	  s1 += "cctxt:csttxt1" ;
	} ;
	if (atts1!="")
	{
	  if (s1!="") s1 += "," ;
	  s1 += "attachs:atts1" ;
	} ;
	if (ord3s2!="")
	{
	  if (s1!="") s1 += "," ;
	  s1 += "ord3s:ord3s2" ;
	} ;
	var params1 = null ;
	s1 = "{"+s1+"}";
	eval("params1="+s1) ;
	$.post("/sys/aspx/createflwfull.aspx",params1,function(data1)
         {
         	  if (callf1) callf1(data1) ;
         }
         ) ;
};
function createbiz2(ordid1,arrord2s1,callf1)
{
	var hasord2ordid = false ;
	var j = 0 ;
	var s1 = "",s2 = "" , s3 ="" ;
	var ord2s2 = "" ;
	if (arrord2s1!=null)
	{
		j = -1 ;
		for (var i=0;i<arrord2s1.length;i++)
		{
			if (arrord2s1[i].indexOf("ord2_ordid=")==0) 
			{
				hasord2ordid = true ;
				break ;
			} ;
		} ;
		
		for (var i=0;i<arrord2s1.length;i++)
		{
			s2 = arrord2s1[i] ;
			if (s2=="new") 
			{
				if (ord2s2!="") ord2s2 += ";;;;;" ;
				if (!hasord2ordid) ord2s2 += "ord2_ordid="+ordid1+";;;;;" ;
				ord2s2 += s2 ;
			} else 
			{
				j = s2.indexOf("=") ;
				if (j>0)
				{
					s3 = s2.substr(0,j).trim() ;
					s2 = s2.substr(j+1).trim() ;
					//s2 = s2.replaceAll("'","") ;
					//s2 = s2.replaceAll("\"","") ;
					if (ord2s2!="") ord2s2 += ";;;;;" ;
					ord2s2 += s3+"|"+s2 ;
				} ;
			} ;	
		};
	} ;	
	s1 = "{ordid:ordid1,ord2s:ord2s2}" ;
	var params1 = null ;
	eval("params1="+s1) ;
	$.post("/sys/aspx/createflwfull.aspx",params1,function(data1)
         {
         	  if (callf1) callf1(data1) ;
         }
         ) ;
};
function createcst(ccctid1,cccode1,cccomp1,ccname1,arrcctxt1,callf1)
{
	var s1 = "" , s2="" , s3="";
	var j = 0 ;
	if ((ccctid1!="") && (ccctid1!="0")) s1 = "ctid1:ccctid1" ;
	if ((cccode1!="")) 
	{
		if (s1!="") s1 += "," ;	s1 = "cccode:cccode1" ;
	} ;
	if ((cccomp1!="")) 
	{
		if (s1!="") s1 += "," ;	s1 = "cccomp:cccomp1" ;
	} ;
	if ((ccname1!="")) 
	{
		if (s1!="") s1 += "," ;	s1 = "ccname:ccname1" ;
	} ;
	var csttxt1 = "" ;
	if (arrcctxt1!=null)
	for (var i=0 ; i<arrcctxt1.length ; i++)
	{
		s2 = arrcctxt1[i] ;
		j = s2.indexOf("=") ;
		if (j>0)
		{
			s3 = s2.substr(0,j).trim() ;
			s2 = s2.substr(j+1).trim() ;
			//s2 = s2.replaceAll("'","") ;
			//s2 = s2.replaceAll("\"","") ;
			if (csttxt1!="") csttxt1 += ";;;;;" ;
			csttxt1 += s3+"|"+s2  ;
		} ;
	} ;
	
	if (s1!="") s1 += "," ;
	s1 += "cctxt=csttxt1" ;
	
	var params1 = null ;
	s1 = "{"+s1+"}";
	eval("params1="+s1) ;
	$.post("/sys/aspx/createflwfull.aspx",params1,function(data1)
         {
         	  if (callf1) callf1(data1) ;
         }
         ) ;
};
function tonextinput(obj1)
{
	_pobj2._tonextinput(self.window,obj1) ;
};
function cvtfilesize(size1)
{
	return _pobj2._cvtfilesize(size1) ;
};
function inccode(olds) 
{
	return _pobj2._inccode(olds) ;
};
function doonchange(objname1) 
{
	var obj1 = $("#"+objname1) ;
	if (obj1.tagName=="SPAN") dosponchange(obj1) ;
	else doedonchange(obj1) ;
};
function doedonchange($obj1)
{
	$obj1.change() ;
};
function dosponchange($obj1)
{
	var objn1 = $obj1[0].id ;
	var strsp1 = $obj1.attr("onchange") ;
	strsp1 = isnull(strsp1,"") ;
	if (strsp1!="")
	{
		strsp1 = strsp1.replaceAll("this","$('#"+objn1+"')[0]") ;
		try {eval(strsp1);} catch (E) { } finally { } ;
	} ;
};
function xlsrpt(sqlname1,formname1,pagesize1,tablebrcnd1,title1)
{
	var title2 = isnull(title1,"查看XLS数据") ;
	popwin("80%","88%","/sys/prtbyxls.aspx?nocache=1&sqlname="+sqlname1+
	 "&prtform="+tohex(formname1)+"&pagesize2="+pagesize1+"&pagesize=10000&pageindex=1&qry=0"+
	 "&tablebreak="+tohex(tablebrcnd1),title2) ;
}
function $get(objname1,defa1)
{
	return _pobj2._$get(self.window,objname1,defa1) ;
}
function $set(objname1,val1)
{
	$value("#"+objname1, val1) ;
} ;
function $settdvalue(trobj1,tdobj1,val1) // tdobj 是一个dom 或 一个$selector
{
	_pobj2._$settdvalue(self.window,trobj1,tdobj1,val1) ;
};
function $getint(objname1)
{
	return _pobj2.$getint(self.window,objname1) ;
};
function $getstr(objname1)
{
	return _pobj2._$getstr(self.window,objname1) ;
};
function $getmoney(obj1name1)
{
	return _pobj2.$getmoney(self.window,obj1name1) ;
};
function $getfloat(obj1name1,dotnum1)
{
	return _pobj2._$getfloat(self.window,obj1name1,dotnum1) ;
};
function getgeoxy(geox1,geoy1,callback1)
{
	//title1, _lfun, rfun, _cfun, _fun1, _fun2)
	dialog2("80%","90%","/map/popmap.htm?nocache=0&Lon="+geox1+"&Lat="+geoy1+"&key=","地理位置定位",null,callback1)  ;
}
function dispgeo(geox1,geoy1)
{
	dialog2("80%","90%","/map/popclmapShow.htm?nocache=0&Lon="+geox1+"&Lat="+geoy1+"&key=","显示地理位置")  ;
}
function help(url1,title1)
{
	var title2 = isnull(title1,"在线帮助") ;
	popwin(">600","V600",url1,title2) ;
}
function printsheet(mdname1,sqlname,params1,noprompt)
{
	var noprompt1 = "" ;
	 noprompt1 = isnull( noprompt , "") ;
	 if (noprompt1=="0") noprompt1 = "&noprompt=0" ; else noprompt1 = "" ;
   self.window.open("/sys/prtsht.aspx?module="+tohex(mdname1)+
   "&sqlname="+sqlname+"&"+params1+noprompt1,"",
   "left=-100px,top=-100px,width=20px,height=20px,menubar=no,scrollbars=yes,resizable=yes,location=no,toolbar=no,fullscreen=no,,status =no,titlebar=no,toolbar=yes") ;
};
function printit(noprompt)
{
	 var noprompt1 = "" ;
	 noprompt1 = isnull( noprompt , "") ;
	 if (noprompt1=="0") noprompt1 = "&noprompt=0" ; else noprompt1 = "" ;
   self.window.open("/sys/printhtml.aspx?abspath="+_pobj2.abspath+noprompt1+"&mywinid="+queryParams("mywinid"),"",
   "left=100px,top=100px,width=800px,height=618px,menubar=no,scrollbars=yes,resizable=yes,location=no,toolbar=no,fullscreen=no,,status =no,titlebar=no,toolbar=yes") ;
};

function splitrmb(fldname1, mn1)
{
   _pobj2._splitmoney(self.window, fldname1, mn1);
};
function rmb(currencyDigits)
{
	return _pobj2._convertCurrency(currencyDigits) ;
};
function nousercode(s13)
{
	var i = s13.indexOf("]") ;
	if ((i<0) || (i==(s13.length-1))) return s13 ;
	else return s13.substr(i+1) ;
};
var StringBuilder = function()
{
   this._buffer = [];
   this._arg1 = (arguments.length > 0) ? String(arguments[0]) : "";
   this._arg2 = (arguments.length > 1) ? String(arguments[1]) : "";
};
StringBuilder.prototype.append = function(str)
{
   this._buffer[this._buffer.length] = String(str);
};
StringBuilder.prototype.toString = function()
{
   return (this._arg2 ? this._arg1 : "") + this._buffer.join(this._arg2 + this._arg1) + this._arg2;
};
StringBuilder.prototype.clear = function()
{
   this._buffer = [];
};
StringBuilder.prototype.add = StringBuilder.prototype.append;
String.prototype.replaceAll2 = function(ov, nv)
{
	var s1 = this ;
	var i= s1.indexOf(ov) ;
	while (i>=0) 
	{
		s1 = s1.replace(ov,nv) ;
		i= s1.indexOf(ov) ;
	} ;
	return s1 ;
}
String.prototype.replaceAll = function(ov, nv)
{
   var reg = new RegExp(ov, "gi");
   return this.replace(reg, nv);
};
function nohtmltag(src001)
{
	return _pobj2._nohtmltag(src001) ;
};
function loading(working11,prompt1)
{
   _pobj2._loading(working11,prompt1);
}
;
function datetitle(date11)
{
	return _pobj2._datetitle(date11) ;
};
function todate(date11)
{
	return _pobj2._todate(date11) ;
}
function today_date(date1) 
{
	return _pobj2._today_date(date1) ;
};
function fmtdate(date1,fmt1) 
{
	return _pobj2._fmtdate(date1,fmt1) ;
};
function fmtfloat(flt1, fmt12)
{
   return _pobj2._fmtfloat(flt1, fmt12);
};
function fmtfloatno0(flt1, fmt12)
{
   var rtsv1 = _pobj2._fmtfloat(flt1, fmt12);
   if (parseFloat(rtsv1) == 0) return "&nbsp;" ;
   else return rtsv1;
};
function fmtmoney(flt1)
{
   var res12 = _pobj2._fmtfloat(flt1, "#,##");
   return  "<font color='#a8a8a8'>￥</font>"+res12 ; 
};
function fmtmoneyno0(flt1)
{
   var rtsv1 = _pobj2._fmtfloat(flt1, "#,##");
   if (parseFloat(rtsv1) == 0) return "&nbsp;" ;
   else return "<font color='#a8a8a8'>￥</font>"+rtsv1;
};
function ident()
{
   var myDate = new Date();
   return myDate.getTime();
};
//这个功能与数据引入不一样
function isbusiness(obj,crmid1,setfordid1) // setfordid1 = true , 表示将取得的值写到 ord_fordid 中去
{
	return _pobj2._isbusiness(self.window,obj,crmid1,setfordid1);
};
function iscustomer(obj,tag1,ctg1)
{
	return _pobj2._iscustomer(self.window,obj,tag1,ctg1);
};
function isemployee(obj)
{
	return _pobj2._isemployee(self.window,obj);
};
function isfeectg(obj,ctg1,ctg2)
{
	return _pobj2._isfeectg(self.window,obj,ctg1,ctg2);
};

function isequ(obj,tag1,ctg1)
{
	return _pobj2._isequ(self.window,obj,tag1,ctg1);
};
function isprd(obj,tag1,ctg1)
{
	return _pobj2._isprd(self.window,obj,tag1,ctg1);
};
function addsourceitems(obj1,itemtxtvals1)
{
	if (typeof(obj1)=="object") 
	  _pobj2._addsourceitems(obj1,itemtxtvals1) ;
	else  _pobj2._addsourceitems(self.window,$("#"+obj1)[0],itemtxtvals1) ;
};
function addsourceitem(obj1,itemtxt1,itemval1)
{
	if (typeof(obj1)=="object") 
	  _pobj2._addsourceitem(self.window,obj1,itemtxt1,itemval1) ;
	else  _pobj2._addsourceitem(self.window,$("#"+obj1)[0],itemtxt1,itemval1) ;
} ;
function isexclusivity(obj) 
{
	return _pobj2._isexclusivity(obj) ;
};
function isdatetime(obj)
{
	return _pobj2._isdatetime(obj) ;
} ;
function isdate(obj)
{
	return _pobj2._isdate(obj);
}
function istime(obj)
{
	return _pobj2._istime(obj);
}
function isint(obj)
{
   return _pobj2._isint(obj);
};
function isintg0(obj)
{
   return _pobj2._isintg0(obj);
};
function isintl0(obj)
{
   return _pobj2._isintl0(obj);
};
function isintne0(obj)
{
   return _pobj2._isintne0(obj);
};
function isfloat(obj)
{
   return _pobj2._isfloat(obj);
};
function isfloatg0(obj)
{
   return _pobj2._isfloatg0(obj);
};
function isfloatl0(obj)
{
   return _pobj2._isfloatl0(obj);
};
function isfloatg0(obj)
{
   return _pobj2._isfloatne0(obj);
};
function isemail(obj)
{
   return _pobj2._isemail(obj);
};

function ismobile(obj)  // obj 可以是 DOM对象 或 字符串
{
   return _pobj2._ismobile(obj);
};
function isphoneno(obj)
{
   return _pobj2._isphoneno(obj);
};
function ismobileorphoneno(obj)
{
	return isphoneno(obj) ;
};
function isempty(obj)
{
   return _pobj2._isempty(obj);
};
function isnotempty(obj)
{
   return _pobj2._isnotempty(obj);
};
function lengthx(obj, lenx01)
{
   return _pobj2._lengthx(obj, lenx01);
};
function myparseInt(oi1_, def1_)
{
   return _pobj2._myparseInt(oi1_, def1_);
};
function myparseFloat(oi1_, def1_)
{
   return _pobj2._myparseFloat(oi1_, def1_);
};
function nomenu()
{
	if (document.oncontextmenu == _rightmouse_Click) 
	{
		haspopupmenu__ = true ;
  } else
  {		
  	 haspopupmenu__ = false ;
     document.oncontextmenu = _nomenu_Click;
  } ;  
};
function _nomenu_Click()
{
   var srcobj = window.event.srcElement ? window.event.srcElement : window.event.target;
   var selstr1 = document.selection.createRange().text ;
   selstr1 = isnull(selstr1, "") ;
   srcobj1 = srcobj.type ;
   srcobj1 = isnull(srcobj1, "") ;
   if ((selstr1 == "") && (srcobj1 != "text") && (srcobj1 != "textarea"))
   {
      window.event.returnValue = false;
   }
   ;
};

function $value2($obj1, val1,editable2) //editable2 = 0 means editable
{
	_pobj2._$value(self.window,$obj1, val1,editable2);
};
function $value(ids1, val1,editable2)
{
	var $objs1=$(ids1) ;
	if ($objs1.length<=0) 
	{
		var s1 = ids1 ;
		var i1 = s1.indexOf(",") ;
		if (i1>0) s1 = s1.substr(0,i1) ;
		s1 = s1.substr(1) ;
		s1 = "input[name="+s1+"]" ;
		$objs1 = $(s1) ;
	} ;
	_pobj2._$value(self.window,$objs1, val1,editable2) ;
};
function menu_overit(obj1)
{
	//var cndstr = $(obj1).attr("cndstr") ;
	//$(cndstr).removeClass("menu_overit") ;
	$(obj1).addClass("menu_overit") ;
};
function menu_outit(obj1)
{
	//var cndstr = $(obj1).attr("cndstr") ;
	//$(cndstr).removeClass("menu_overit") ;
	$(obj1).removeClass("menu_overit") ;
};
function menu_clickit(obj1)
{
	var cndstr = $(obj1).attr("cndstr") ;
	//$(cndstr).removeClass("menu_overit").removeClass("menu_clickit").addClass("menu_outit") ;
	$(cndstr).removeClass("menu_overit menu_clickit menu_outit") ;
	$(obj1).removeClass("menu_outit").addClass("menu_clickit") ;
};
function menu_clickitgray(obj1)
{
	var cndstr = $(obj1).attr("cndstr") ;
	//$(cndstr).removeClass("menu_overit").removeClass("menu_clickitgray").addClass("menu_outit") ;
	$(cndstr).removeClass("menu_overit menu_clickitgray menu_outit") ;
	$(obj1).removeClass("menu_outit").addClass("menu_clickitgray") ;
};
function menu_click($cnd1,cursor1,click1func)
{
	var cursor11 = isnull(cursor1,"hand") ;
	$($cnd1).mouseover(function(){menu_overit(this)}).mouseout(function(){menu_outit(this)})
    .click(function(){menu_clickit(this);if(click1func) click1func(this);}).css("cursor",cursor11).attr("cndstr",$cnd1) ;
};
function menu_clickgray($cnd1,cursor1,click1func)
{
	var cursor11 = isnull(cursor1,"hand") ;
	$($cnd1).mouseover(function(){menu_overit(this)}).mouseout(function(){menu_outit(this)})
    .click(function(){menu_clickitgray(this);if(click1func) click1func(this);}).css("cursor",cursor11).attr("cndstr",$cnd1) ;
};

function link_click($cnd1,cursor1,click1func)
{
	var cursor11 = isnull(cursor1,"hand") ;
	$($cnd1).mouseover(function(){menu_overit(this)}).mouseout(function(){menu_outit(this)}).css("cursor",cursor11).attr("cndstr",$cnd1) ; ;
};
function vscrollstart(objname1, height1, speed1, pause1)
{
   var objstr1 =
   "sp_" + objname1 + "=" + speed1 + ";" +
   "pu_" + objname1 + "=" + pause1 + ";" +
   "mh_" + objname1 + "=" + height1 + ";" +
   "oi_" + objname1 + " = 0;" +
   "mpscr3_" + objname1 + ".innerHTML=mpscr2_" + objname1 + ".innerHTML;" +
   "mpsscr6_" + objname1 + "=window.setTimeout(\"mpsscr0_"+objname1+"()\",sp_" + objname1 + ");" +
   "mpscr1_" + objname1 + ".onmouseover=function() {try { window.clearTimeout(mpsscr6_" + objname1 + ");} catch (e) {} finally {} ;};" +
   "mpscr1_" + objname1 + ".onmouseout=function() {mpsscr6_" + objname1 + "=window.setTimeout(\"mpsscr0_"+objname1+"()\",sp_" + objname1 + ");};" ;
   eval(objstr1) ;
};
function hscrollstart(objname1, width1, speed1, pause1)
{
   var objstr1 =
   "sp_" + objname1 + "=" + speed1 + ";" +
   "pu_" + objname1 + "=" + pause1 + ";" +
   "mh_" + objname1 + "=" + width1 + ";" +
   "oi_" + objname1 + " = 0;" +
   "mpscr3_" + objname1 + ".innerHTML=mpscr2_" + objname1 + ".innerHTML;" +
   "mpsscr6_" + objname1 + "=window.setTimeout(\"mpsscr0_"+objname1+"()\",sp_" + objname1 + ");" +
   "mpscr1_" + objname1 + ".onmouseover=function() {try { window.clearTimeout(mpsscr6_" + objname1 + ");} catch (e) {} finally {} ;};" +
   "mpscr1_" + objname1 + ".onmouseout=function() {mpsscr6_" + objname1 + "=window.setTimeout(\"mpsscr0_"+objname1+"()\",sp_" + objname1 + ");};" ;
   eval(objstr1) ;
};
function hscroll(objname1, width1, speed1, pause1,step1)
{
	 var step2 = isnull(step1,"10") ;
	 eval(" try { window.clearTimeout(mpsscr6_" + objname1 + ");} catch (e) {} finally {} ;") ;
   _pobj2._hscroll(self.window, objname1, width1, step2);
   hscrollstart(objname1, width1, speed1, pause1);
};
function vscroll(objname1, height1, speed1, pause1,step1)
{
	var step2 = isnull(step1,"10") ;
	 eval(" try { window.clearTimeout(mpsscr6_" + objname1 + ");} catch (e) {} finally {} ;") ;
   _pobj2._vscroll(self.window, objname1, height1,step2);
   vscrollstart(objname1, height1, speed1, pause1);
};

function createbiz(crmid1)
{
	goto("/"+_pobj2.abspath+"/biz.aspx?crmid="+crmid1+
		"&srctype=0&mergetype=&ordertype=&sourcecrmids="+
		"&srcordid=0&onlyone=1&tags=&ordid=0&copyy=&notitlebar=0&iddd="+ident()) ;
}
function pngimg(imgfile1,width1,height1)
{
	if (_pobj2.ie7)
	  return "<img src=\""+imgfile1+"\" width="+width1+"px height="+height1+"px border=0 align=absmiddle>" ;
	else 
	  return "<div style='filter:progid:DXImageTransform.Microsoft.AlphaImageLoader("+
		"src=\""+imgfile1+"\", sizingMethod=scale) "+ 	
		";width:"+width1+"px;height:"+height1+"px'></div>" ;
}
// 以下是ebs_public的函数申明
function toback()
{
	var oldsrc = tostr(_backsrc) ;//isnull(queryParams("oldsrc"),"") ;
	if (oldsrc!="") parent.goto(oldsrc) ;
};
function tobackandrefresh()
{
	var oldsrc = tostr(_backsrc) ;//isnull(queryParams("oldsrc"),"") ;
	if (oldsrc!="") 
	{
		var i = oldsrc.indexOf("idtfcawl=") ;
		if (i<0) 
		{
			if (oldsrc.indexOf("?")>0) 
			{
				i = oldsrc.indexOf("cache=") ;
				if (i<0) oldsrc += "&cache=0&idtfcawl=1" ;
				else oldsrc += "&idtfcawl=1" ;
			} else oldsrc += "?cache=0&idtfcawl=1" ;
		} else 
		{
			var str1 = oldsrc.substr(i) ;
			oldsrc = oldsrc.substr(0,i) ;
			i = str1.indexOf("&") ;
			var str2 = "" ;
			if (i>0) 
			{
				str2 = str1.substr(i) ;
				str1 = str1.substr(0,i) ;
			} ;
			i = str1.indexOf("=") ;
			str1 = str1.substr(i+1) ;
			var ii1 = parseInt(str1)+1 ;
			oldsrc += "idtfcawl="+ii1+str2 ;
		} ;
		parent.goto(oldsrc) ;
	} ;	
}
function tostr(str)
{
   return _pobj2._tostr(str);
};
function tohex(str)
{
   return _pobj2._tohex(str);
};
function QueryParams(pname1,psrc1)
{
	 var psrc2 = psrc1 ;
	 psrc2 = isnull(psrc2,"") ;
	 if (psrc2=="") psrc2 = document.location.href ; 
	 else 
	 	{
	 		if (psrc2.indexOf("?")<0) 	psrc2 = "?"+psrc2 ;
	 	} ;	
   return _pobj2._QueryParams(pname1, psrc2);
};
function queryParams(pname1,psrc1)
{
   return QueryParams(pname1,psrc1);
};
function existsParam(pname1,psrc1)
{
	 var psrc2 = psrc1 ;
	 psrc2 = isnull(psrc2,"") ;
	 if (psrc2=="") psrc2 = document.location.href ; 
	 else 
	 	{
	 		if (psrc2.indexOf("?")<0) 	psrc2 = "?"+psrc2 ;
	 	} ;
   return _pobj2._existsParam(pname1,psrc2);
};
function isnull(strs1, def1)
{
   return _pobj2._isnull(strs1, def1);
};

function assigndate(obj1, date111)
{
   _pobj2._assigndate(self.window, obj1, date111);
};
function dateadd(date111, num1)
{
   return _pobj2._dateadd(date111, num1);
};
function today()
{
   return _pobj2._today();
};
function monday()
{
   return _pobj2._monday();
};
function monthstart()
{
   return _pobj2._monthstart();
};
function monthend()
{
   return _pobj2._monthend();
};
function yearstart()
{
   return _pobj2._yearstart();
};
function yearend()
{
   return _pobj2._yearend();
};
function lastyearstart()
{
   return _pobj2._lastyearstart();
};
function lastyearend()
{
   return _pobj2._lastyearend();
};
function lastmonthstart(td1)
{
   return _pobj2._lastmonthstart(td1);
};
function lastmonthend(td1)
{
   return _pobj2._lastmonthend(td1);
};
function nextmonthstart(td1)
{
	return _pobj2._nextmonthstart(td1) ;
};
function nextmonthend(td1)
{
	return _pobj2._nextmonthend(td1) ;
};

function monthxstart(yy1,monthindex1)
{
	var now = new Date();
	var yy2 = isnull(yy1,now.getYear()) ;
	var newd = new Date(yy2,monthindex1-1,1) ;
	return newd ;
} ;
function monthxend(yy1,monthindex1)
{
	var now = new Date();
	var yy2 = isnull(yy1,now.getYear()) ;
	var newd = null ;
	if (monthindex1==12) 
	  newd = new Date(yy2+1,0,1) ;
	else  newd = new Date(yy2,monthindex1,1) ; 
	return dateadd(newd,-1) ;
} ;

function dialogreturn(r1, r2, r3, r4, r5, r6, r7, r8, r9, r10,r11,r12,r13,r14,r15)
{
   _pobj2._dialogreturn(r1, r2, r3, r4, r5, r6, r7, r8, r9, r10,r11,r12,r13,r14,r15,document.location.href);
   //window.close();
};
function dialogreturnnoclose(r1, r2, r3, r4, r5, r6, r7, r8, r9, r10,r11,r12,r13,r14,r15)
{
   _pobj2._dialogreturnnoclose(r1, r2, r3, r4, r5, r6, r7, r8, r9, r10,r11,r12,r13,r14,r15, document.location.href);
   //window.close();
};
function domywinfunc1(fv1, fv2, fv3, fv4, fv5, fv6, fv7, fv8, fv9, fv10,r11,r12,r13,r14,r15)
{
   return _pobj2._domywinfunc1(fv1, fv2, fv3, fv4, fv5, fv6, fv7, fv8, fv9, fv10,r11,r12,r13,r14,r15, document.location.href);
};
function domywinfunc2(fv1, fv2, fv3, fv4, fv5, fv6, fv7, fv8, fv9, fv10,r11,r12,r13,r14,r15)
{
   return _pobj2._domywinfunc2(fv1, fv2, fv3, fv4, fv5, fv6, fv7, fv8, fv9, fv10,r11,r12,r13,r14,r15, document.location.href);
};
function myclosewin()
{
   _pobj2._myclosewin(document.location.href);
   //window.close();
};
function wintitle(val)
{
   _pobj2.__wintitle(val, document.location.href);
};
function winfocus()
{
   _pobj2.__winfocus(document.location.href);
};
function showmywin(url1) // 参数说明：url 是完整的URL，也可以是一个整数windowid
{
	if ((url1 == null) || (url1 == undefined)) return _pobj2._showmywin(document.location.href);
	else return _pobj2._showmywin(url1);
};
function hidemywin(url1) // 参数说明：url 是完整的URL，也可以是一个整数windowid
{
	if ((url1 == null) || (url1 == undefined)) return _pobj2._hidemywin(document.location.href);
	else return _pobj2._hidemywin(url1);
};
function minmywin(url1) // 参数说明：url 是完整的URL，也可以是一个整数windowid
{
	if ((url1 == null) || (url1 == undefined)) return _pobj2._minmywin(document.location.href);
	else return _pobj2._minmywin(url1);
};
function winvisible(url1)  
{
	if ((url1 == null) || (url1 == undefined)) return _pobj2._winvisible(document.location.href);
	else return _pobj2._winvisible(url1);
};
function winwidth()
{
   return _pobj2._winwidth(document.location.href);
};
function winheight()
{
   return _pobj2._winheight(document.location.href);
};
function winhandle(url1)
{
   if ((url1 == null) || (url1 == undefined)) return _pobj2._winhandle(document.location.href);
   else  return _pobj2._winhandle(url1);
};
// winhande().executesubwin_function()
function resizewin()
{
   _pobj2._resizewin(document.location.href);
};
function autoframeheight(frmid)
{
   _pobj2._autoframeheight(self.window, frmid);
};
function refresh1aspx(aspxname1,para1,val1)
{
	var para12 = tohex(para1) ;
	para12 = para12.replace("~h`","") ;
	_pobj2._refreshaspx(aspxname1+para12+"='"+val1+"'") ;
};
function refreshaspx(prgvars)
{
	// like this : business='1';flowlists='2' עӢ£ºˇؖ·�²»ˇֻ˽
	// : flow~h`dksasd20132='1';
	_pobj2._refreshaspx(prgvars);
};
function autorefreshpage()
{
   _pobj2._autorefreshpage(self.window);
};

function replacesearchkey(val1) 
{
	return _pobj2._replacesearchkey(self.window,val1) ;
};
function parsesearchkey(str1)
{
	return _pobj2._parsesearchkey(self.window,str1) ;
};
function pop_2(x,y,width1,height1,url1,scroll)
{
    var w1="" ; 
    var h1="" ;
    if (width1!=0) 
	{
		if (width1.indexOf("%")>=0) 
		{	
			s2 = width1.replace("%","");
			w1 = (screen.width * s2 / 100) ;
		}  else w1 = width1 ;
	} else w1 = (screen.width * 80 / 100) ;
	if (height1!=0) 
	{
		if (height1.indexOf("%")>=0) 
		{	
			s2 = height1.replace("%","");
			h1 = (screen.height * s2 / 100) ;
		}  else h1 = height1 ;
	} else h1 = (screen.height * 70 / 100) ;
	if ((parseInt(x)+parseInt(y))==0)
	{
		x = (screen.width - w1) / 2 ;
		y = (screen.height - h1) / 2 ;
		if (x<0) x = 0 ;
		if (y<0) y = 0 ;
	} ;	
	// 找一个最适合的位置
	if ((parseInt(x)+parseInt(w1))> screen.width) 
	{
	  if (x>w1) x = x-w1 ;
	  else x = 0 ;
	} ;
	if ((parseInt(y)+parseInt(h1))> screen.height) 
	{
	  if (y>h1) y = y-h1 ;
	  else y = 0 ;
	} ;
	
	s1 = "dialogLeft:"+x+"px;dialogTop:"+y+"px;dialogWidth:"+w1+"px;dialogHeight:"+h1+"px;" ;
	
	url111 = url1 ;
	if (url111.indexOf("?")>0) url111 = url111 + "&tid1="+ident() ;
	else url111 = url111 + "?tid1="+ident() ;
	var ret1 = "__" ;
	try
	  {
	  	ret1 = window.showModalDialog((url111),"",s1+"fullscreen : no ;location :  no ;menubar : no;resizable :  yes ; scroll : "+scroll+" ;status :  yes ;titlebar :  no;toolbar : no") ;
	  } catch (e) {} finally {} ;
	return ret1 ;
};
function pop2(width1,height1,url1)
{
  return pop_2("0","0",width1,height1,url1,"yes");
};
function pop3(width1,height1,url1)
{
  return pop_2("0","0",width1,height1,url1,"no");
};

function toolwin(_w_w, _w_h, url1, title1, _lfun, _cfun, _fun1, _fun2)
{
	 var simple1 = isnull(title1,"") ; if (simple1=="") simple1 = "2" ; else simple1 = "" ;
	 _pobj2._toolwin(_w_w, _w_h, url1, tostr(title1), _lfun, _cfun, _fun1, _fun2,simple1);
};
function popwin(_w_w, _w_h, url1, title1, _lfun, _cfun, _fun1, _fun2)
{
	 var simple1 = isnull(title1,"") ; if (simple1=="") simple1 = "2" ; else simple1 = "" ;
   _pobj2._popwin(_w_w, _w_h, url1, tostr(title1), _lfun, _cfun, _fun1, _fun2,simple1);
};
function popwin2(_w_w, _w_h, url1, title1, _lfun, _cfun, _fun1, _fun2)
{
	 var simple1 = isnull(title1,"") ; if (simple1=="") simple1 = "2" ; else simple1 = "" ;
   _pobj2._popwin2(_w_w, _w_h, url1, tostr(title1), _lfun, _cfun, _fun1, _fun2,simple1);
};
function dialog(_w_w, _w_h, url1, title1, _lfun, rfun, _cfun, _fun1, _fun2)
{
	 var simple1 = isnull(title1,"") ; if (simple1=="") simple1 = "2" ; else simple1 = "" ;
   _pobj2._dialog(_w_w, _w_h, url1, tostr(title1), _lfun, rfun, _cfun, _fun1, _fun2,simple1);
};
function dialog2(_w_w, _w_h, url1, title1, _lfun, rfun, _cfun, _fun1, _fun2)
{
	 var simple1 = isnull(title1,"") ; if (simple1=="") simple1 = "2" ; else simple1 = "" ;
   _pobj2._dialog2(_w_w, _w_h, url1, tostr(title1), _lfun, rfun, _cfun, _fun1, _fun2,simple1);
};

function toolwinflat(_w_w, _w_h, url1, title1, _lfun, _cfun, _fun1, _fun2)
{
   _pobj2._toolwin(_w_w, _w_h, url1, tostr(title1), _lfun, _cfun, _fun1, _fun2,"2");
};
function popwinflat(_w_w, _w_h, url1, title1, _lfun, _cfun, _fun1, _fun2)
{
   _pobj2._popwin(_w_w, _w_h, url1, tostr(title1), _lfun, _cfun, _fun1, _fun2,"2");
};
function popwin2flat(_w_w, _w_h, url1, title1, _lfun, _cfun, _fun1, _fun2)
{
   _pobj2._popwin2(_w_w, _w_h, url1, tostr(title1), _lfun, _cfun, _fun1, _fun2,"2");
};
function dialogflat(_w_w, _w_h, url1, title1, _lfun, rfun, _cfun, _fun1, _fun2)
{
   _pobj2._dialog(_w_w, _w_h, url1, tostr(title1), _lfun, rfun, _cfun, _fun1, _fun2,"2");
};
function dialog2flat(_w_w, _w_h, url1, title1, _lfun, rfun, _cfun, _fun1, _fun2)
{
   _pobj2._dialog2(_w_w, _w_h, url1, tostr(title1), _lfun, rfun, _cfun, _fun1, _fun2,"2");
};

function winbackcolor(color1)
{
   _pobj2.__winbackcolor(color1, document.location.href);
};

function percentbar(percent1,width1)
{
	return _pobj2._percentbar(percent1,width1) ;
};
function inputstr(title1,prompt1,defa1,call1,width1,desc1,valid1)
{
	var width2 = isnull(width1,"380") ;
	var desc2 = isnull(desc1,"") ;
	var valid2 = isnull(valid1,"") ;
	if (valid2!="") valid2 = "&valid="+tohex(valid2) ;
	if (desc2!="") desc2 = "&desc="+tohex(desc2) ;
	dialog2("=="+width2,"==180","/sys/inputstr.aspx?nocache=1&defa="+tohex(defa1)+
			"&prompt="+tohex(prompt1)+"&width="+width2+valid2+desc2,tostr(title1),null,call1,
			function()
			{
				document.body.focus() ;
			}) ;
};
function inputtext(title1,prompt1,defa1,call1,width1,desc1)
{
	var width2 = isnull(width1,"580") ;
	var desc2 = isnull(desc1,"") ;
	if (desc2!="") desc2 = "&desc="+tohex(desc2) ;
	_pobj2._input_text_default_value = defa1 ;
	dialog2("=="+width2,"==220","/sys/inputtext.aspx?nocache=1&"+
			"&prompt="+tohex(prompt1)+"&width="+width2+desc2,tostr(title1),null,call1,
			function()
			{
				document.body.focus() ;
			}) ;
};
function debug(str1)
{
	alert(str1) ;
	clipboardData.setData("Text",str1);
};
function runandreturn(url1,param1)
{
   return _pobj2._runandreturn(self.window,url1,param1);
};
function runandreturnxml(url1,param1)
{
   return _pobj2._runandreturnxml(self.window,url1,param1);
};
function getxmltb(sqlnameandparam1, pagesize)
{
	return _pobj2._getxmltb(self.window,sqlnameandparam1, pagesize) ;
};
function getxml(sqlname1,params1)
{
	return _pobj2._getxml(self.window,sqlname1,params1) ;
};
function modrecs(varname1,dsname11,fldval1,cnd1)
{
	_pobj2._modrecs(self.window,varname1,dsname11,fldval1,cnd1);
};
function insrecs(varname1,dsname11,$dataset1)
{
	_pobj2._insrecs(self.window,varname1,dsname11,$dataset1);
};
function mergerecs(varname1,dsname11,$dataset1)
{
	_pobj2._mergerecs(self.window,varname1,dsname11,$dataset1);
};
function delrecs(varname1,dsname11,cnd1)
{
	_pobj2._delrecs(self.window,varname1,dsname11,cnd1);
};
function run(url1, _call1,param1)
{
   _pobj2._run(self.window, url1, _call1,param1);
};
function runsqlandreturn(sqlname1, params1)
{
   return _pobj2._runsqlandreturn(self.window,sqlname1, params1);
};
function runsql(sqlname1, params1, call1cb,call1cberror)
{
   _pobj2._runsql(sqlname1, params1, call1cb,call1cberror);
};
function runsql4text(sqlname1, params1, call1cb)
{
   _pobj2._runsql4text(self.window,sqlname1, params1, call1cb);
};
function cachexml(sqlname1,params1,data1)
{
	_pobj2._cachexml(self.window,sqlname1,params1,data1)
};
function parseRow(row11)
{
	_pobj2._parseRow(self.window,row11) ;
} ;
//call1cb(iseof,data1,dsname1)
function runwebservice4xml(sqlname1, params1, call1cb)
{
   _pobj2._runwebservice4xml(self.window, sqlname1, params1, call1cb);
};
//call1cb(res1)
function runwebservice4text(sqlname1, params1, call1cb)
{
   _pobj2._runwebservice4text(self.window, sqlname1, params1, call1cb);
};
function runsql4xml(sqlname1, params1, call1cb)
{
   _pobj2._runsql4xml(self.window, sqlname1, params1, call1cb);
};
function dataset_foreach(dataset1,call1cb)
{
	_pobj2._dataseteach(self.window,dataset1,call1cb) ;
	// callcb(iseof,data22)
};
function xml_foreach(data1,call1cb)
{
	_pobj2._xmleach(self.window,data1,call1cb) ;
	// call1cb(iseof,data22,dsname1)
};
function datarow_foreach($dataset1,cnd1,rowfunc1)
{
	_pobj2._datarow_foreach(self.window,$dataset1,cnd1,rowfunc1);
};
function datarow_search($dataset1,cnd1)
{
  return _pobj2._datarow_search(self.window,$dataset1,cnd1) ;
}  ;
function dyniframesize(iframename)
{
   return _pobj2._dyniframesize(self.window, iframename) ;
};
function dynwinsize()
{
   _pobj2._dynwinsize(self.window);
};
function urlindex(url1)
{
   return _pobj2._urlindex(url1);
};
function get1doc(docid1)
{
	var objs1 = $("*[content=0]") ;
	if (objs1.length<=0) return  false ;
	get1doc2(docid1,objs1[0]) ;
};
function get1doc2id(docid1,objid1)
{
	get1doc2(docid1,$("#"+objid1)[0]) ;
};
function get1doc2(docid1,dcomobj1)
{
	var oldhtmlvalue1 = isnull($(dcomobj1).attr("mysrc"),"") ;
	if (oldhtmlvalue1=="")
	{
	  oldhtmlvalue1 = isnull($(dcomobj1).attr("oldhtmlvalue"),"") ;
	  if (oldhtmlvalue1=="") $(dcomobj1).attr("oldhtmlvalue",$(dcomobj1).html()) ;
	} ;  
	if (("aaa"+docid1).indexOf(".")>0) 
	{
		$.get(docid1,
	   function(data11){
	   	$(dcomobj1).html(data11);
	   	try {needautoframeheight();} catch (e) {} finally { };
	   }) ;
	} else 
	{
		runsql4xml("g_1doc_context","docid="+docid1+"&publiccache=0",
		function(iseof,data1,dsname1)
		{
			if (!iseof) 
			{
				$(dcomobj1).html($f[_docd_text]) ;
				try {needautoframeheight();} catch (e) {} finally { };
			} ;
		}) ;
	} ;
};
function get1prd(typ1,prdid1,objid1)
{
};
function goto2(page1,url1) 
{
	_pobj2._gotoandcache(page1, "mainframe", url1);
};
function goto(url1)
{
   _pobj2._gotoandcache(self.window, "mainframe", url1);
};
function gotoframe(frmname1, url1)
{
   _pobj2._gotoframeandcache(self.window, frmname1, url1);
};
function arearefresh($objs,url1,fldv,assignf,aftld)
{
	_pobj2._arearefresh(self.window,$objs,url1,fldv,assignf,aftld);
};
function showgroup(tbname, tbfldfunc)
{
	_pobj2._showgroup(_myident,tbname, tbfldfunc); 
};
function mytablecacheremove(sqlnameandparam1)
{
	_pobj2._mytablecacheremove(self.window,sqlnameandparam1);
};
// 当pagesize=100000 时，将返回生成的内容，并且程序是不会去修改表格的内容
function mytablevaluebyds($data1, tbfldfunc, tbname, aftldfc,tbsndkey1)
{
	var str1 = _pobj2._mytablebyds(self.window,_myident,$data1, tbfldfunc, tbname, 100000,filter1,append2,tbsndkey1) ;
	if (aftldfc) 
	{
		aftldfc(str1) ; 
		showgroup(tbname,tbfldfunc) ;
		try { pobj3.needautoframeheight() ;} catch (e) { } finally { } ;
	};	
};
//取与上级有关的数据
function getfathervalue($selectorstr)
{
	_pobj2._get_fathervalue(self.window,$selectorstr) ;
};

function gentablepopmenu(obj1,tbname1)
{
	var pgcount1 = myparseInt($("#"+tbname1+"_pagecount").html(),0) ;
	var itemsarr1 = [] ;
	itemsarr1.push("本页另存为...") ;
	itemsarr1.push("table2xls(\""+tbname1+"\")") ;
	if (pgcount1>1)
	{
		itemsarr1.push("所有页另存为...") ;
		itemsarr1.push("table2xls_full(\""+tbname1+"\")") ;
	} ;	
	itemsarr1.push("拷贝至剪切板") ;
	itemsarr1.push("table2clipboard(\""+tbname1+"\")") ;
	_genpopup(obj1,itemsarr1) ;
} ;
function mytablebyds($data1, tbfldfunc, tbname, pagesize,filter1,append2,tbsndkey1)
{
	return _pobj2._mytablebyds(self.window,_myident,$data1, tbfldfunc, tbname, pagesize,filter1,append2,tbsndkey1);
};
// 这个函数的主要作用是只按表格格式生成内容，由aftldfc来完成处理
// aftlffc(resdata) ;
function mytablevalue(tburl, tbfldfunc, tbname,aftldfc,tbsubkey1)  // append2 = 0 meas insert
{
	_pobj2._mytable(self.window, _myident, tburl, tbfldfunc, tbname, 100000, aftldfc,'','1',tbsubkey1);
};

function mytablerow(url1,fldv1,tbname1,$rowselectorstr1,aftlffc1,tbsubkey1) 
{
	mytablevalue(url1, fldv1, tbname1,
	function(resdata1)
	{
		var srctrobjs = $($rowselectorstr1) ;
		var trobjs = $($rowselectorstr1,$("<table id="+tbname1+" class=justforslt><tbody name=details_auto>"+resdata1+"</tbody></table>")) ;
		if (srctrobjs.length==trobjs.length) 
		{
			for (var i=0 ; i<trobjs.length ; i++) 
			  $(srctrobjs[i]).html($(trobjs[i]).html()) ;
		} ;
		if (aftlffc1) aftlffc1(resdata1) ;
	},tbsubkey1) ;
};

function replacefieldvalue(orgvalue1,tbfldfunc)
{
  return _pobj2._replacefieldvalue(self.window,orgvalue1,tbfldfunc) ;
} ;  
//$obj1 : 最好是JQUERY对象，但也可以是字符串，如果是字条串，则只能是某一个对象的ID名
function mydatalist(sqlnameandparam1,tbfldfunc,$obj1,afterloadfc,sqlparam1)
{
   var $obj12 = null ;	
   var sqlpara3 = isnull(sqlparam1,"") ;
	 if (typeof($obj1)=="string") $obj12 = $("#"+$obj1); else $obj12 = $obj1 ;
	 _pobj2._mydatalist(self.window,sqlnameandparam1, tbfldfunc,$obj12,afterloadfc,sqlpara3) ;
};
// 删除tableformat 
function removetableformat(tbname, tbsndkey2)
{
	_pobj2._removetableformat(self.window,tbname, tbsndkey2)
} ;
// aftldfc()
function mytable(tburl, tbfldfunc, tbname, pagesize, aftldfc,filter1,append2,tbsubkey1)
{
	 //append2:0 means true 
   _pobj2._mytable(self.window, _myident, tburl, tbfldfunc, tbname, pagesize, aftldfc,filter1,append2,tbsubkey1);
};

function data_foreach(varname1,func1)
{
	_pobj2._data_foreach(self.window,varname1,func1);
};
function preparedata(varname1,dsname1)
{
	_pobj2._preparedata(self.window,varname1,dsname1);
};
function runsql4arr(varname1,sqlname1,params1,call1cb)
{
	_pobj2._runsql4data(self.window,varname1,sqlname1,params1,call1cb);
};
function mergeattach(attachstr1,canedit1,type1,fileid1)
{
	var str1 = attachstr1 ;
	var str2 ="" ;
	if (canedit1) 
	{
		if (str1=="") 
		  str2 = "添加附件" ; else str2 = "添加附件" ;  	
		if (str1!="") str1 += "<br>" ;
		str1 = "<span id=attach_list>"+str1+"</span>" ;
		str2 = "<span id=attach_container></span><span id=sp_attach class=hidewhenprint><a href=javascript:g0() onclick=uploads('"+type1+"','"+fileid1+"')>"+str2+"</a></span>" ;
		str1 += str2 ;
	} else
	{
		if (str1=="") str1 = "没有附件" ;
	} ;
	return str1 ;
};
function getdnfilename($ff)
{
	return _pobj2._getdnfilename(self.window,$ff) ;
}
function removeattach(daid1,filename1)
{
	if (confirm("是否删除附件："+tostr(filename1)+"?")==false) return false ;
	$("#da_"+daid1).remove() ;
	runsql("attach_del1attach","daid="+daid1) ;
}
function getattach($ds1,canedit1,type1,fileid1)
{
	return mergeattach(_pobj2._getattach(self.window,$ds1,canedit1),canedit1,type1,fileid1) ;
};
function uploads(type1,fileid2,title1,call1)
{
	uploads__(type1,fileid2,0,0,title1,call1) ;
};
function uploads2(type1,fileid2,fileid22,title1,call1)
{
	uploads__(type1,fileid2,fileid22,0,title1,call1) ;
};
function uploadswebdisk(call1)
{
	uploads__("",0,0,1,null,call1) ;
};
function uploads__(type1,fileid2,fileid22,flag1,title1,call1)
{
	var wintitle = isnull(title1,"文件上传") ;
	var fileid1 = fileid2 ;
	if (fileid1=="0") fileid1 = "-"+_pobj2.useruid ;
	var fileid12 = isnull(fileid22,"0") ;
	toolwin("680","348","/sys/uploads.aspx?doctype="+type1+"&docid="+fileid1+"&docid2="+fileid12+
	"&flag="+flag1,wintitle,function(winid1)
	{
		_pobj2.attach_sys_container = $("#attach_container") ;
		_pobj2.$("#xMsg2"+winid1+"_bt_min,#xMsg2"+winid1+"_bt_max,#xMsg2"+winid1+"_bt_refresh").hide();
		_pobj2.$("#xMsg2"+winid1+"_bt_close").removeClass("win_close").addClass("win_closenone").attr("onclick","").unbind() ;
	},null,call1) ;
};

// serverfilename1 如果只是文件名，则会在 /attach/cmpid/中添加此文件
// 如果是这样 /aaaa/file.txt 则：/aaaa/cmpid/file.txt 
function upload(title1,serverfilename1,cb1)
{
	var wintitle = title1 ;
	if (wintitle=="") wintitle = "上传数据" ;
	dialog2("490", "188", "/sys/attachfck.aspx?nocache=1&type=img&fileid=0&exts_in=.gif.bmp.jpg.jpeg.swf.tif.png.xls.&size=500000&keepfilename="+
	tohex(serverfilename1)+"&UploadID=" + ident(), 
    wintitle, null, cb1) ;
}
function chat() 
{
	toolwin("==663","==476","/sys/chat.aspx","在线交谈") ;
}
function sltimg(_call1) 
{
	dialog("+728", "+668", "/sys/sltimg.aspx", "选 择 图 形", null, _call1);
}
function sltprdin(_call1,bid1,tag1,cstbarn1,title1,pcid1)
{
	 // 参数说明：
	 // bid1 barn id 
	 // tag1 prdtype integer 
	 // cstbarn1 support cst-barn or not , 0:Yes  1: no 
	 var bid2 = isnull(bid1,"0") ;
	 var tag2 = isnull(tag1,"1") ;
	 var cstbarn2 = isnull(cstbarn1 , "0") ;
	 var title2 = isnull(title1,"请选择") ;
	 if (cstbarn2!="0") cstbarn2 = "&cstbarn="+cstbarn1 ; else cstbarn2 = "" ;
   dialog2(">=728", "V=568", "/sys/sltprdin.aspx?bid="+bid2+"&tag="+tag2+cstbarn2+"&pcid="+pcid1, title2, null, _call1);
};
function sltprdout(_call1,bid1,tag1,cstbarn1,title1,pcid1)
{
	 var bid2 = isnull(bid1,"0") ;
	 var tag2 = isnull(tag1,"1") ;
	 var cstbarn2 = isnull(cstbarn1 , "0") ;
	 var title2 = isnull(title1,"请选择") ;
	 if (cstbarn2!="0") cstbarn2 = "&cstbarn="+cstbarn1 ; else cstbarn2 = "" ;
   dialog2(">=728", "V=568", "/sys/sltprdout.aspx?bid="+bid2+"&tag="+tag2+cstbarn2+"&pcid="+pcid1, title2, null, _call1);
};
function sltprd(_call1,bid1,tag1,cstbarn1,title1,pcid1)
{
	 var bid2 = isnull(bid1,"0") ;
	 var tag2 = isnull(tag1,"1") ;
	 var cstbarn2 = isnull(cstbarn1 , "0") ;
	 var title2 = isnull(title1,"请选择") ;
	 if (cstbarn2!="0") cstbarn2 = "&cstbarn="+cstbarn1 ; else cstbarn2 = "" ;
   dialog2(">=728", "V=568", "/sys/sltprd.aspx?tag="+tag2+cstbarn2+"&pcid="+pcid1, title2, null, _call1);
};
function sltprdlow(_call1,bid1,tag1,title1,pcid1)
{
	 var bid2 = isnull(bid1,"0") ;
	 var tag2 = isnull(tag1,"1") ;
	 var title2 = isnull(title1,"请选择") ;
	 dialog2(">=728", "V=568", "/sys/sltprdlow.aspx?tag="+tag2+"&pcid="+pcid1, title2, null, _call1);
};
function sltprdinmt(_call1,bid1)
{
	 var bid2 = isnull(bid1,"0") ;
   dialog2(">=728", "V=568", "/sys/sltprdin.aspx?mt=0&bid="+bid2, "选 择 物 料", null, _call1);
};

function sltprdoutmt(_call1,bid1)
{
	var bid2 = isnull(bid1,"0") ;
   dialog2(">=728", "V=568", "/sys/sltprdout.aspx?mt=0&bid="+bid2, "选 择 物 料", null, _call1);
};

function sltprdmt(_call1)
{
   dialog2(">=728", "V=568", "/sys/sltprd.aspx?mt=0", "选 择 物 料", null, _call1);
};

function sltequ(_call1,tag1,title1)
{
	 // call(equid,equtitle,equcode)
	 var cctag2 = isnull(tag1,"1");
	 var title2 = isnull(title1,"选 择 设 备") ;
	 dialog2(">=728", "V=568", "/sys/sltequ.aspx?one=1&tag="+cctag2, title2, null, _call1);
};
function sltequ2arr(_call1,key1,tag1,title1,_clscall1)
{
	 // call(equid,equtitle,equcode,equfilds[],equfldvalues[]) 
	 var key33 = isnull(key1,"") ;
	 var cctag2 = isnull(tag1,"1");
	 var title2 = isnull(title1,"选 择 设 备") ;
	 dialog2(">=728", "V=568", "/sys/sltequ.aspx?one=1&tag="+cctag2+"&haskey=0", title2, 
   	 function(winid1)
		  {
		  	winhandle(winid1).loaddefaultkey(key33);
		  }, _call1,_clscall1);
};

function sltother(pcid1,_call1)
{
   dialog2(">=528", "V=568", "/sys/sltother.aspx?pcid="+pcid1, "请 选 择", null, _call1);
};
function slt1prd(_call1,tag1,cstbarn1,title1)
{
	 //call(prdtype,prdid,prdname,prdcode)
	 var tag2 = isnull(tag1,"1") ;
	 var cstbarn2 = isnull(cstbarn1 , "0") ;
	 var title2 = isnull(title1,"请选择") ;
	 if (cstbarn2!="0") cstbarn2 = "&cstbarn="+cstbarn1 ; else cstbarn2 = "" ;
   dialog2(">=728", "V=568", "/sys/sltprd.aspx?one=1&tag="+tag2+cstbarn2, title2, null, _call1);
};
function slt1prd2arr(_call1,key1,tag1,cstbarn1,title1,_clscall1)
{  
	 //call(prdtype,prdid,prdname,prdcode,prdflds[],prdfldvalues[])
   var key33 = isnull(key1,"") ;
	 var tag2 = isnull(tag1,"1") ;
	 var cstbarn2 = isnull(cstbarn1 , "0") ;
	 var title2 = isnull(title1,"请选择") ;
	 if (cstbarn2!="0") cstbarn2 = "&cstbarn="+cstbarn1 ; else cstbarn2 = "" ;

	 dialog2(">=728", "V=568", "/sys/sltprd.aspx?one=1&arr=0&tag="+tag2+cstbarn2+"&haskey=0", title2, 
   	 function(winid1)
		  {
		  	winhandle(winid1).loaddefaultkey(key33); //_pobj2.document.frames("xMsg2" + winid1+"_frame")
		  }, _call1,_clscall1);
};
function slt1prp2arr(mpid1,_call1)
{  
	 //call(mpid1,mpdid1,mpdtitle1,mpdcode1,prdflds[],prdfldvalues[])
   dialog2(">=728", "V=568", "/sys/sltprp.aspx?one=1&arr=0&mpid="+mpid1, "请 选 择", null, _call1);
};
function cstnamebytag(tag1)
{
	var s1 = "客户" ;
	if (tag1!="0") 
	{
		eval("s1=_pobj2._s_cctag_"+tag1) ;
	} ;	
	return s1 ;
}	
function slt1doc(_call1)
{
   dialog2(">=528", "V=568", "/sys/slt1doc.aspx", "选 择 文 档 资 料", null, _call1);
};
function sltedemp(sql1,title1,call1cb)
{
	dialog("==388", "==418", "/sys/sltedusers.aspx?nocache=1&sql="+tohex(sql1), title1, null, call1cb);
}
function sltedcst(sql1,title1,call1cb,tag1)
{
	var tag2 = isnull(tag1,"0") ;
	dialog("==388", "==418", "/sys/sltedusers.aspx?tag="+tag2+"&nocache=1&sql="+tohex(sql1), title1, null, call1cb);
}
function sltbarn(title1,_call1)
{
	var title2 = isnull(title1,"选择库房") ;
	dialog("==388", "==218", "/sys/sltbarn.aspx", title2, null, _call1);
}
function sltnemp(_call1,key1)
{
	 var key2 = isnull(key1,"") ;
	 dialog2(">=618", "V=528", "/sys/sltnemp.aspx?haskey=0", "选择员工", 
   	function(winid1)
		  {
		  	winhandle(winid1).loaddefaultkey(key2);
		  }, _call1);
};
function sltncst(_call1,key1,cctag1,title1)
{
	 // call(sltednum,ids1,nms1)
	 var key33 = tohex(isnull(key1,"")) ;
	 var cctag2 = isnull(cctag1,"0");
	 var title2 = isnull(title1,"选择客户") ;
	 dialog2(">=618", "V=528", "/sys/sltncst.aspx?tag="+cctag2+"&haskey=0", title2, 
   	 function(winid1)
		  {
		  	winhandle(winid1).loaddefaultkey(key33);
		  }, _call1);  
};
function slt1emp(_call1,key1)
{
	 var key2 = isnull(key1,"") ;
	 dialog2("618", "468", "/sys/slt1emp.aspx?haskey=0", "选择员工", 
   	 function(winid1)
		  {
		  	winhandle(winid1).loaddefaultkey(key2);
		  }, _call1);  
   //call(cuid,cuuserid,cuusercode,cucallname,cudepart,cumobile,cuemail,cucontact,cutitle,cuqq)
};
function slt1icon(_call1)
{
     dialog2("358", "458", "/sys/slt1icon.aspx", "选择图例", null, _call1);
   //call(iconid1)
};
function slt1emp2arr(_call1,key1,_clscall1)
{
	 var key2 = isnull(key1,"") ;
	 dialog2("618", "468", "/sys/slt1emp.aspx?arr=0&haskey=0", "选择员工", 
   	function(winid1)
		  {
		  	winhandle(winid1).loaddefaultkey(key2);
		  }, _call1,_clscall1);
   //call(cuid,cuuserid,cuusercode,cucallname,cuflds[],cufldvalue[])
};
function slt1cst(_call1,key1,cctag1,title1)
{
	 var key33 = tohex(isnull(key1,"")) ;
	 var cctag2 = isnull(cctag1,"1");
	 var title2 = isnull(title1,"选择客户") ;
	 dialog("==618", "==508", "/sys/slt1cst.aspx?tag="+cctag2+"&haskey=0", title2, 
     function(winid1)
		  {
		  	winhandle(winid1).loaddefaultkey(key33);
		  }, _call1);  
   //callback(ccid1,ccuserid1,cccode1,ccname1,ccbrief1,ccmobile1,ccemail1,cccontact,ccaddr,ccpost,ccother,ccbirth,ext01,ext02,ext03)
};
function slt1cst2arr(_call1,key1,cctag1,title1,_clscall1)
{
	 var key33 = tohex(isnull(key1,"")) ;
	 var cctag2 = isnull(cctag1,"1");
	 var title2 = isnull(title1,"选择客户") ;
	 dialog("==618", "==508", "/sys/slt1cst.aspx?arr=0&tag="+cctag2+"&haskey=0", title2, 
   	 function(winid1)
		  {
		  	winhandle(winid1).loaddefaultkey(key33);
		  }, _call1,_clscall1);
	
   //callback(ccid1,ccuserid1,cccode1,ccname1,ccbrief1,ccflds[],ccfldvalue[])
};
function slt1biz2arr(_call1,key1,crmid1,title1,_clscall1)
{
	 var key33 = tohex(isnull(key1,"")) ;
	 var title2 = isnull(title1,"请选择") ;
	 dialog("==618", "==508", "/sys/slt1biz.aspx?arr=0&crmid="+crmid1+"&haskey=0", title2, 
   	 function(winid1)
		  {
		  	winhandle(winid1).loaddefaultkey(key33);
		  }, _call1,_clscall1);
   //callback(ordid1,ordcrmid1,ordcode1,ordtitle1,ordtype1,ccflds1[],ccfldvs1[])
};
function slt1feetype(_call1,ctg11,ctg22,_clsf1)
{ 
	// _call1(slti1,ids1,ftitles1,fcodes1,fctgs12,flags1)
	var ctg1 = isnull(ctg11,null) ;
	var ctg2 = isnull(ctg22,null) ;
	dialog("580","580","/fee/sltfeetype.aspx?single=1&ctg1="+tohex(ctg1)+"&ctg2="+tohex(ctg2),
	"选择费用类别",null,_call1,_clsf1) ;
};
function sltnfeetype(_call1,ctg11,ctg22,_clsf1)
{ 
	// _call1(slti1,ids1,ftitles1,fcodes1,fctgs12,flags1)
	var ctg1 = isnull(ctg11,null) ;
	var ctg2 = isnull(ctg22,null) ;
	dialog("580","580","/fee/sltfeetype.aspx?idw1=1&ctg1="+tohex(ctg1)+"&ctg2="+tohex(ctg2),
	"选择费用类别",null,_call1,_clsf1) ;
};
function clearselect(sltname1)
{
   _pobj2._clearselect(self.window.document, sltname1);
};
function add1selectoption(sltname1, cap1, val1)
{
   return _pobj2._add1selectoption(self.window.document, sltname1, cap1, val1);
};
// 先cap 后val
function assignselect(sltname1, url11, defa111, callback11)
{
   _pobj2._assignselect(self.window, sltname1, url11, defa111, callback11);
};

//三个与数组有关的功能
function array2set(arr1)
{
	return _pobj2._array2set(arr1) ;
}
function array2str(arr1) 
{
	return arr1.join(",") ;
}
function array2strx(arr1,lenx) 
{
	var str1 = arr1.join(",") ;
	if (str1.length>lenx) str1 = str1.substr(0,lenx)+"..." ;
	return str1 ;
}

// flag1 : 0:new 1:doc 2:prd id: 0 / docid /prdid
function ebsword(flag1,id1,ctgid1,mdname1,callb) 
{
	//callb("save/saveas/delete/exit") ;
	//_w_w, _w_h, url1, title1, _lfun, _cfun, _fun1, _fun2
	// flag1 : 0自己的文档，2 商品　1:文档 8:邮件审核　5：工作单邮件模板 7:job中的邮件
	var ct1 = isnull(ctgid1,"0") ;
	var md1 = isnull(mdname1,"") ;
  popwin2("+90%","+90%", "/doc/ebseditor.aspx","EBS在线文档编辑器",
  function(winid1)
  {
  	winhandle(winid1).loadeditdata(flag1,id1,ct1,md1); //_pobj2.document.frames("xMsg2" + winid1+"_frame")
  },null,callb) ;
}  
// 系统初始化函数
function getFckeditorContent(fckeditor)
{
   var  oEditor = FCKeditorAPI.GetInstance(fckeditor) ;
   
   var str1 = oEditor.GetXHTML(true) ; 
   
	  var str2 = "" ;
	  var str3 = "" ;
	  var i = 0 ;
	  i = str1.indexOf("jquery") ;
	  while (i>=0) 
	  {
	  	str2 += str1.substr(0,i) ;
	  	str1 = str1.substr(i) ;
	  	i = str1.indexOf("=") ;
	  	if (i>0) 
	  	{
	  		str3 = str1.substr(0,i) ;
	  		if ((str3.indexOf(" ")<0) && (str3.indexOf("<")<0) && (str3.indexOf(">")<0) && 
	  		   (str3.indexOf("&")<0) && (str3.indexOf("'")<0) && (str3.indexOf('"')<0)) 
	  		{
	  			str1 = str1.substr(i+1) ;
	  			str3 = str1.substr(0,1) ;
	  			str1 = str1.substr(1) ;
	  			i = str1.indexOf(str3) ;
	  			str1 = str1.substr(i+1) ;
	  		} else 
	  		{
	  			str2 += str1.substr(0,6) ;
	  		  str1 = str1.substr(6) ;
	  		} ;   
	  	} else 
	  	{
	  		str2 += str1.substr(0,6) ;
	  		str1 = str1.substr(6) ;
	  	} ;
	  	i = str1.indexOf("jquery") ;
	  } ;
	  str2 += str1 ;
	  str2 = str2.replaceAll('readonly=""','') ;
	  str2 = str2.replaceAll("readonly=''","") ;
 
   return str2 ;
}
;

function setFckeditorContent(fckeditor, value1)
{
	 var res1 = false ;
   try
   {
      if ((window.frames[fckeditor + "___Frame"]) && (window.frames[fckeditor + "___Frame"].window.frames[0]))
      {
         window.frames[fckeditor + "___Frame"].window.frames[0].document.body.innerHTML =  value1  ;
         res1 = true ;
      } ;
   } catch (E) {} finally {} ;
   return res1 ;
}
;
function g0()
{
  return  ;
}
function getframeurl(pobj12)
{
	var url1 = pobj12.$("#mainframe")[0].src ;
	return tohex(url1) ;
}
// 几个重要的与button有关的函数
function buttoncaption(idname1,caption1)
{
	$("#tbbttb_"+idname1+"_22").html(caption1) ;
}
function buttonvisible(idname1)
{
	$("#tbbt_"+idname1).show() ;
}
function buttonhidden(idname1)
{
	$("#tbbt_"+idname1).hide() ;
}
function buttonenabled(idname1)
{
	$("#tbbt_"+idname1).removeAttr("disabled") ;
	$("#tbbttb_"+idname1+"_22").removeClass("fontfaint") ;
}
function buttondisabled(idname1)
{
	$("#tbbt_"+idname1).attr("disabled","disabled") ;
	$("#tbbttb_"+idname1+"_22").addClass("fontfaint") ;
}
function convertbutton(qrybtobj)
{
	_pobj2._convertbutton(self.window,qrybtobj) ;
};
function fatherclick(obj1)
{
   var obj3 = obj1.previousSibling ;
   $(obj3).click() ;
};

function overtbbutton(id1)
{
	var namecvt = ["11","lt","12","mt","13","rt","21","lm","22","mm","23","rm","31","lb","32","mb","33","rb"] ;
	for (var i=0 ; i<namecvt.length ; i+=2) 
  document.getElementById("tbbttb_" + id1 + "_"+namecvt[i]).className = "tb_button_"+namecvt[i+1]+"_over";
};
function outtbbutton(id1)
{
	var namecvt = ["11","lt","12","mt","13","rt","21","lm","22","mm","23","rm","31","lb","32","mb","33","rb"] ;
	for (var i=0 ; i<namecvt.length ; i+=2) 
  document.getElementById("tbbttb_" + id1 + "_"+namecvt[i]).className = "tb_button_"+namecvt[i+1];
};
function overtbbutton2(id1)
{
   overtbbutton(id1) ;
};
function outtbbutton2(id1)
{
	var namecvt = ["11","lt","12","mt","13","rt","21","lm","22","mm","23","rm","31","lb","32","mb","33","rb"] ;
	for (var i=0 ; i<namecvt.length ; i+=2) 
  document.getElementById("tbbttb_" + id1 + "_"+namecvt[i]).className = "tb_button_"+namecvt[i+1]+"2";
};
////////////////

function rootparent()
{
   if (self.window.parent.parent.parent.parent.parent)  return self.window.parent.parent.parent.parent.parent ;
   else
   if (self.window.parent.parent.parent.parent)  return self.window.parent.parent.parent.parent ;
   else
   if (self.window.parent.parent.parent)  return self.window.parent.parent.parent ;
   else
   if (self.window.parent.parent)  return self.window.parent.parent ;
   else
   if (self.window.parent)  return self.window.parent ;
   else 	return self.window ;
};
function iscrmxsystem()
{
   return (_pobj2._loadingtitle != undefined) ;
};
var v15 = "#F9FbFe";
var v16 = document.getElementById && ! document.all;
var v17 = '';
var v18;
var v19 = /INPUT|TEXTAREA/;
var needautoclick = false ;

function editmousemove(obj1,evt)
{
	evt = evt || window.event;
  if ( ! (evt)) return  false ;
  if(evt.button == 1) return  false ;
  var edx = 0 ;
  if (evt.pageX) edx =  evt.pageX;
  else if (evt.offsetX)
  edx = evt.offsetX;
  
  if (edx>=($(obj1).width()-12)) 
  {
  	needautoclick = true ; 
  	$(obj1).css("cursor","hand") ;
  } else 
  {
  	needautoclick=false ;
  	$(obj1).css("cursor","") ;
  } ;
};
function editmouseout(obj1)
{
	needautoclick=false ;
  $(obj1).css("cursor","") ;
};
function editmousemovel(obj1,evt)
{
	evt = evt || window.event;
  if ( ! (evt)) return  false ;
  if(evt.button == 1) return  false ;
  var edx = 0 ;
  if (evt.pageX) edx =  evt.pageX;
  else if (evt.offsetX)
  edx = evt.offsetX;
  
  if (edx12) 
  {
  	needautoclick = true ; 
  	$(obj1).css("cursor","hand") ;
  } else 
  {
  	needautoclick=false ;
  	$(obj1).css("cursor","") ;
  } ;
};
function f20(v2)
{
   if (v2.style && v19.test(v2.tagName))
   {
      if (v16 && v18.nodeType == 3)v18 = v18.parentNode.parentNode;
      return true;
   }
   else return false;
}
function f2(v3)
{
	try 
	{
	  v18 = v16 ? v3.target : event.srcElement;
	  f22() ;
	} catch (e) {} finally {} ;  
}
function f22()
{
   //v18 = v16 ? v3.target : event.srcElement;
   //alert(v18.tagName+v18.id) ;
   if (v17 != '')
   {
      if (f20(v17))
      {
         v17.style.backgroundColor = '';
         if (v17.type == "text")
         {
            v17v = v17.value.trim() ;
            if (v17v == "")
            {
               v17v = v17.title.trim() ;
               v17i = v17v.indexOf("输入") ;
               if (v17i == 0)
               {
                  v17i = v17v.indexOf(",") ;
                  if (v17i > 0)
                  {
                     v17v = v17v.substr(0, v17i) ;
                     v17.value = v17v ;
                  }
                  ;
               }
               ;
            }
            ;
         }
         ;
         if ((v17.type == "text") || (v17.type == "password") || (v17.tagName.toLowerCase() == "textarea"))
         if (specialstring.indexOf("[0]") < 0) $(v17).removeClass("sourcepick sourcedbl sourceedit sourcedbll sourceeditl").unbind("mousemove").unbind("mouseout") ;//.addClass("edbox") ;
         else $(v17).removeClass("sourcedbl sourceedit sourcedbll sourcepick sourceeditl").unbind("mousemove").unbind("mouseout") ;
      }
      ;
      v17 = v18;
      if (f20(v18))
      {
         v18.style.backgroundColor = v15;
         dis1 = isnull($(v18).attr("disabled"), "") ;
         try
         {
            dis1 = dis1.toLowerCase() ;
         }
         catch (e)
         {
         }
         finally
         {
         }
         ;
         if ((dis1 != "disabled") && (dis1 != "true") && (dis1 != true)) canedit = true ;
         else canedit = false ;
         if (canedit)
         {
            if (v18.type == "text")
            {
               v17v = v18.value.trim() ;
               v17i = v17v.indexOf("输入") ;
               if (v17i == 0) v18.value = "" ;
            }
            ;
            if ((v18.type == "text") || (v18.type == "password") || (v18.tagName.toLowerCase() == "textarea"))
            {
               issrc = tostr(isnull($(v18).attr("source"), "")) ;
               ispick = isnull($(v18).attr("pick"), "") ;
               isright = isnull($(v18).css("text-align"), "").toLowerCase() ;
               if (isright == "right") isright = "l" ;
               else isright = "" ;
               if ((issrc != '') || (ispick!="")) 
               {
               	if (ispick!="")
               	  $(v18).removeClass("sourceedit sourceeditl").addClass("sourcepick")
	                .bind("mousemove",function(){editmousemove(this,event)})
	                .bind("mouseout",function(){editmouseout(this)});
	              else
	              {  
	               	if (isright=='')
		               	$(v18).removeClass("sourceedit sourceeditl").addClass("sourcedbl" + isright)
		                .bind("mousemove",function(){editmousemove(this,event)})
		                .bind("mouseout",function(){editmouseout(this)});
		              else 
		              	$(v18).removeClass("sourceedit sourceeditl").addClass("sourcedbl" + isright)
		                .bind("mousemove",function(){editmousemovel(this,event)})
		                .bind("mouseout",function(){editmouseout(this)});  
		           } ;     
              //alert("bin") ;
              } 
               else  $(v18).removeClass("sourcepick sourcedbl sourcedbll").addClass("sourceedit" + isright).unbind("mousemove").unbind("mouseout") ;
            }
            ;
         }
         ;
      }
      ;
   }
   else
   {
      if (f20(v18))
      {
         v18.style.backgroundColor = v15;
         dis1 = isnull($(v18).attr("disabled"), "") ;
         try
         {
            dis1 = dis1.toLowerCase() ;
         }
         catch (e)
         {
         }
         finally
         {
         }
         ;
         if ((dis1 != "disabled") && (dis1 != "true") && (dis1 != true)) canedit = true ;
         else canedit = false ;
         if (canedit)
         {
            if (v18.type == "text")
            {
               v17v = v18.value.trim() ;
               v17i = v17v.indexOf("输入") ;
               if (v17i == 0) v18.value = "" ;
            }
            ;
            if ((v18.type == "text") || (v18.type == "password") || (v18.tagName.toLowerCase() == "textarea"))
            {
               issrc = tostr(isnull($(v18).attr("source"), "")) ;
               ispick = isnull($(v18).attr("pick"), "") ;
               isright = isnull($(v18).css("text-align"), "").toLowerCase() ;
               if (isright == "right") isright = "l" ;
               else isright = "" ;
               if ((issrc != '') || (ispick!=""))
               {
               	if (ispick!="") 
               	{
               		$(v18).removeClass("sourceedit sourceeditl").addClass("sourcepick")
		                .bind("mousemove",function(){editmousemove(this,event)})
		                .bind("mouseout",function(){editmouseout(this)});
               	} else
               	{
	               	if (isright=='') 
		               	$(v18).removeClass("sourceedit sourceeditl").addClass("sourcedbl" + isright)
		                .bind("mousemove",function(){editmousemove(this,event)})
		                .bind("mouseout",function(){editmouseout(this)});
		              else   
		              	$(v18).removeClass("sourceedit sourceeditl").addClass("sourcedbl" + isright)
		                .bind("mousemove",function(){editmousemovel(this,event)})
		                .bind("mouseout",function(){editmouseout(this)});
		           } ;     
               //alert("bind") ;
              }
               else  $(v18).removeClass("sourcedbl sourcepick sourcedbll").addClass("sourceedit" + isright).unbind("mousemove").unbind("mouseout") ;
            }
            ;
         }
         ;
      }
      ;
      v17 = v18;
   };
}
;
// 系统
function dockeyup(evt)
{
  try {_pobj2._holdctrl = false;} catch (e) {} finally { };
}

function  nosystemkey(evt)
{
	evt = evt || window.event;
  if ( ! (evt)) return  false ;
  var key1 = evt.keyCode ;
  if (key1==8)
  {
  	if ((document.activeElement.tagName != "INPUT") && (document.activeElement.tagName != "TEXTAREA"))
  	{
  		if (document.activeElement.contentEditable!="true")  
  		{
	  	  evt.cancelBubble = true ;
		    evt.returnValue=false; 
		    return false ;
		  } ;
		} ;
  } else 
  if (key1==27) 
  {
  	toback() ;
  	myclosewin() ;
  } ;
} ;
function  k13to9(evt)
{
   evt = evt || window.event;
   if ( ! (evt)) return  false ;
   var ob1 = evt.srcElement || evt.target;
   
   try {_pobj2._holdctrl = false;} catch (e) {} finally { };
   
   if (evt.ctrlKey) 
   {
   	 try {_pobj2._holdctrl = false;} catch (e) {} finally { }; // 取消这个功能了
   };
   if(evt.keyCode == 13 && ob1.type != 'button' && ob1.type != 'submit' && ob1.tagName != 'DIV' && ob1.tagName != 'TEXTAREA' && ob1.type != 'reset' && ob1.type != 'textarea' && ob1.type != '' && ob1.type != 'a' ) 
   {
   	evt.keyCode = 9;} ;
   if (evt.keyCode == 113) // f2
   {
      try
      {
         //_pobj2.fastclick() ;
      }
      catch (e)
      {
      }
      finally
      {
      }
      ;
   }
   ;
};
function stopsubmit()
{
	if (_formsubmitflag==0) _formsubmitflag=1 ;
};
var _formsubmitflag = 0 ;
// _formsubmitflag = 1 表示要终止submit 
function validall()
{
	 if (_formsubmitflag==1)
	 {
	 	 _formsubmitflag = 0 ;
	 	 return false ;
	 }  ; 
   var valid0010 = true;
   $("input[type='text'],td[edit=0][onvalid]").each(function()
   {
      if (valid0010)
      {
      	 if (isnull($(this).attr("pick"),"")=="") 
      	   valid0010 = validme(this) ;
      	 //alert(this.tagName+" , "+this.id+" = "+valid0010) ;
      }
      ;
   }
   ) ;
   return valid0010;
}
;
function validme(obj1)
{
	  var valid001 = true;
	  var validfunc = "";
	  var src1 = tostr(isnull($(obj1).attr("source"), "")) ;
	  //src1可以是一个函数 
	  if ((src1.substr(src1.length-1,1)==")") && (src1.substr(0,1)!='$'))  // 是函
			{
				try
			  {
			     eval("src1="+src1) ;
			  }  catch (e) {} finally {};
			}  ;
	  var ispick = isnull($(obj1).attr("pick"), "") ;
	  validfunc = isnull($(obj1).attr("needvalue"), "") ;
		if (validfunc!="") 
		{
		 validfunc = $(obj1).val().trim() ;
		 if (validfunc=="") 
		 {
		 	  		try
		       {
		          obj1.focus() ;
		       }
		       catch (e)
		       {
		       }
		       finally
		       {
		       }
		       ;
		       try
		       {
		          obj1.style.backgroundColor = v15;
		
		       }
		       catch (e)
		       {
		       }
		       finally
		       {
		       }
		       ;
		       if (ispick=="") showfloattooltip(obj1) ;
		       valid001 = false; 
		 };
		} ;
		if (valid001) 
		{
			
			validfunc = isnull($(obj1).attr("onvalid"), "") ;
			if (validfunc != "")
			{
			 validfunc = "valid001=" + validfunc.replace("(this","(obj1") ;
			 
			 try
			 {
			    eval(validfunc)
			 }
			 catch (e)
			 {
			 }
			 finally
			 {
			 }
			 ;
		} ;
		 
		 if ( ! valid001)
		 {
		 	  try
		       {
		          obj1.focus() ;
		       }
		       catch (e)
		       {
		       }
		       finally
		       {
		       }
		       ;
		       try
		       {
		          obj1.style.backgroundColor = v15;
		
		       }
		       catch (e)
		       {
		       }
		       finally
		       {
		       }
		       ;
		    if (ispick=="") showfloattooltip(obj1) ;
		 }
		}
		;
    return valid001;
}
;

function bindchangeme(obj1)
{
	var onvalid1 = isnull($(obj1).attr("onvalid"),"") ;
	if (onvalid1!="") 
	{
		onvalid1 = onvalid1.replace("(this","(obj1") ;
		eval(onvalid1) ;
	} ;
	
	var changeme = isnull($(obj1).attr("onchange"),"") ;
	if (changeme!="") 
	{
		try { changeme = changeme.replaceAll("this","obj1") ;} catch (e) {} finally { };
		try { eval(changeme) ;} catch (e) {} finally { };
	} ;
	
	var calcedids = [] ;
	
	var str1 = isnull($(obj1).attr("calcobj"),"") ;
  var i = 0 ;
	var s1 = "" ;
	while (str1!="") 
	{
		i = str1.indexOf(",") ;
		if (i<0) 
		{
			s1 = str1 ;
			str1 = "" ;
		} else 
		{
			s1 = str1.substr(0,i) ;
			str1 = str1.substr(i+1) ;
		} ;
		if (s1!="") 
		{
			calcedids.push(s1) ;
			if ($("#"+s1)[0].tagName=="TABLE") 
			{
				$("#"+s1+" tbody[name=details_auto] tr").each(
				function()
				{
					formulatr($(this)) ;
				}) ;
				showgroup(s1) ;
			} else 
			{
				formula1obj(s1) ;
			} ;
		} ;
	} ;
	
	str1 = obj1.className ;
	 
  i = 0 ;
	s1 = "" ;
	while (str1!="") 
	{
		i = str1.indexOf(" ") ;
		if (i<0) 
		{
			s1 = str1 ;
			str1 = "" ;
		} else 
		{
			s1 = str1.substr(0,i) ;
			str1 = str1.substr(i+1) ;
		} ;
		if (s1!="") 
		{
			if (s1=="formula_changed") formulaall() ; else 
			if (s1.substr(0,1)=="#") 
			{
				s1 = s1.substr(1) ;
				if (calcedids.indexOf(s1)<0)
				{
					calcedids.push(s1) ;
					$("#"+s1+" tbody[name=details_auto] tr").each(
					function()
					{
						formulatr($(this)) ;
					}) ;
					showgroup(s1) ;
				} ;	
			} ;
		} ;
	} ;
};

function correctpng()
{
	var arVersion = navigator.appVersion.split("MSIE");
	var version = parseFloat(arVersion[1]);
	
	if ((version >= 5.0) && (version < 7) && (document.body.filters)) 
	{
	   for(var i=0; i<document.images.length; i++)
	   {
        if ($(img).hasClass("crrtpnt") == false ) 
        {
		      var img = document.images[i] ;
		      var imgName = img.src.toUpperCase();
		      if ((imgName.substring(imgName.length-3, imgName.length) == "PNG") || 
		          (imgName.indexOf("LJLLOGO.GIF")>=0))
		      {
		         var imgID = (img.id) ? "id='" + img.id + "' " : "";
		         var imgClass = (img.className) ? "class='" + img.className + "' " : "";
		         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' ";
		         var imgStyle = "display:inline-block;" + img.style.cssText ;
		         if (img.align == "left") imgStyle = "float:left;" + imgStyle;
		         if (img.align == "right") imgStyle = "float:right;" + imgStyle;
		         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
		         var strNewHTML = "<span " + imgID + imgClass + imgTitle
		         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
		         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		         + "(src=\'" + img.src + "\', sizingMethod='image');\"></span>" ;
		         img.outerHTML = strNewHTML;
		         i = i-1;
		         $(img).addClass("crrtpnt") ; 
		      };
		      
		    } ; 
	   };
	};
};
function initialall()
{
	refreshident = document.location.href.toLowerCase() ;
		var si = refreshident.indexOf(".asp") ;
		if (si<0) si = refreshident.indexOf(".htm") ;
		if (si<=0) refreshident = "home" ;
		else refreshident = refreshident.substr(0,si) ;
		si = refreshident.lastIndexOf("/") ;
		if (si>=0) refreshident = refreshident.substr(si+1) ;
		si = refreshident.lastIndexOf("\\") ;
		if (si>=0) refreshident = refreshident.substr(si+1) ;
   pagefilename = refreshident ;
   
   try
		{
			refreshident += refreshmethod().replaceAll("~h`","").replaceAll(",","").replaceAll("'","").replaceAll("\"","") ;
		} catch (e) {} finally { };
		refreshident = "newmsg_"+refreshident ;
		try
		{
			eval(refreshident+"=''")  ;
		} catch (e) {} finally { };
			
	$("#sysmps").attr("href","/" + _pobj2.abspath + "/mps.css");
	$("#myicon").attr("href","/icons/"+_pobj2.cmpid+".css");
	if (screen.width<=1024) 
	  $("#sysmpspx").attr("href","/" + _pobj2.abspath + "/mps1024.css");
	else   $("#sysmpspx").attr("href","/" + _pobj2.abspath + "/mps1280.css");
   $(document).mousemove(autorefreshpage).click(function()
   {
   	  hidefloatmenu(0) ;
   	  //hidefloattooltip(0) ;
      //winfocus() ;
   }
   ).keydown(function()
   {
   	  nosystemkey(event) ;
      k13to9(event);
      autorefreshpage() ;
   }
   ).keyup(function()
   {
   	 dockeyup(event) ;
   });
   $("form").click(function()
   {
      f2(event);
   }
   ).keyup(function()
   {
      f2(event)
   }
   );
   $("input[type='text']:not(.eddotted):not(.edline):not(.ednone),textarea").addClass("edbox");
   $("input[type='password']:not(.eddotted):not(.edline):not(.ednone)").addClass("edbox");
   $("input[type='text']").change(function(){bindchangeme(this)}).each(function()
      {
         tv1 = this.title;
         tvi = tv1.indexOf("输入") ;
         if (tvi == 0)
         {
            tvi = tv1.indexOf(",") ;
            if (tvi > 0) this.value = tv1.substr(0, tvi) ;
         }
         ;

      }) ;
   if (jQuery.iAuto)
   {
      $("input[type='text'],textarea")
      .Autocomplete(
      {
         autofill : false,
         multiple : true ,
         helperClass : 'autocompleter',
         selectClass : 'selectAutocompleter'
      }
      );
   }
   ;
   $(":button,:submit").each(function()
   {
      convertbutton($(this));
   }
   ) ;
   //if ( ! existsParam("mywinid")) $(document.body).css("overflow-y", "hidden").css("overflow-x", "auto") ;
   
   try
      {
         needautoframeheight() ;
      }
      catch (e)
      {
      }
      finally
      {
      }
      ;
  documentloaded = true ;    
  var str1 = "" ;
  var tdobjs = $("table tbody tr.tabletitle>td") ;
  var i011 = tdobjs.length ;
  for (var i01 = 0 ; i01 < i011 ; i01++)
  {
  	if (i01==0) $(tdobjs[i01]).css("border-right","1px none #f8f8f8") ; else 
  	if (i01==(i011-1)) 	$(tdobjs[i01]).css("border-left","1px solid #ABB9C8") ; else
  	$(tdobjs[i01]).css("border-right","1px none #f8f8f8").css("border-left","1px solid #ABB9C8") ; 
  	$(tdobjs[i01]).addClass("tdb tdt fontnormal") ;
  	//if (str1.indexOf("<")<0) $(tdobjs[i01]).html("<span class=shadow1>"+str1+"<span class=shadow2>"+str1+"</span></span>") ;
  } ;
  //try {if (autorunwhilecacheloaded) nomenu();} catch (e) {} finally { };
  //if (existsParam("mywinid")) nomenu();
  //nomenu(); 系统发布时请使用此句   
  objectSwap(); 
  correctpng();
  var mywinid11 = queryParams("mywinid") ;
  mywinid11 = mywinid11.replace("_w","") ;
  mywinid11 = mywinid11.replace("w2_","") ;
  windowid = myparseInt(mywinid11,0) ;
  if (windowid!=0)
  {
  	var simple12 = isnull(_pobj2.$("#xMsg2"+windowid+"_main").attr("simple"),"") ;
  	if (simple12=="2") 
  	{
  		//$(document.body).css("background-color","#f9f9f9").attr("bgcolor","red") ; ;
  	} ;
  }  ;
  try { 
  	var firstedit1 = $("input:text:visible:enabled:first") ;
  	if (firstedit1.length>0) firstedit1[0].focus() ;
  	} catch (e) {} finally { };
  document.oncontextmenu = _rightmouse_Click  ;		
  if (!checkapppower())
  {
   	 try
   	 {
   	 	 $(document.body).html("<br><br><div style=\"padding-left:20px;font-size:16px;\">权限限制，无法显示内容</div>") ;
   	 }  catch (e) {} finally { };
   	 window.onerror = ResumeErrorebs; 
  } ;
 
  window.setTimeout("try { needautoframeheight();}  catch (e) {} finally { };",10) ;
  window.setTimeout("try { document.body.focus();}  catch (e) {} finally { };",100) ;
   
  initialpageroles() ;
}
;
function initialpageroles()
{
	// 以下这段程序是用来判断该页面中哪些功能是可以访问的，哪些功能是不可以访问的
  // 为了减少系统的访问设置，需要权限识别的页面中，在body 中需要加一个属性，即 checkpower 
  //alert(pagefilename) ;
  if (isnull($(document.body).attr("checkpower"),"")!="")
  {
  	var i=_pobj2._page_roles.indexOf2(pagefilename,0,2) ;
  	if (i>=0) 
  	{
  		setpageroles(i) ;
  		return ;
  	} ;
  	var tmps = new Array() ;
  	//debug("http://hanwei/sys/aspx/execsql.aspx?sqlname=g_page_roles&pagefilename="+pagefilename+"&xml=0") ;
  	runsql4xml("g_page_roles","pagefilename="+pagefilename,
  	function(iseof,data1,dsname1)
  	{
  		if (!iseof)
  		{
  			if (dsname1=="ds1") 
  			{
  				tmps.push($f[_mn_tag]) ;
  				tmps.push($f[_mn_id]) ;
  			} else 
  			if (dsname1=="ds11") 
  			{
  				i = tmps.indexOf2($f[_mnu_mnid],1,2) ;
  			  if (i>0) tmps[i] = 0 ;
  			} ;
  		} else
  		if (!dsname1)
  		{
  			if (tmps.length>1)
  			{
	  			_pobj2._page_roles.push(pagefilename) ;
	  			i = _pobj2._page_roles.length - 1 ;
	  			_pobj2._page_roles.push(tmps) ;
	  			setpageroles(i) ;
	  		} ;
  		} ;
  	}) ;
  } ;
};
function setpageroles(fileindex1)
{
	var roles1 = _pobj2._page_roles[fileindex1+1] ;
	
	for (var i=0 ; i<roles1.length ; i+=2) 
	{
	  if (roles1[i+1]==0) $("#"+roles1[i]).show() ; else $("#"+roles1[i]).hide() ;
	} ;
	try 
	{
		needautoframeheight() ;
	} catch(E) {} finally {} ;
} ;
function ResumeErrorebs() { 
	return true; 
} ;
function checkapppowerbycode(apcode1)
{
	return _pobj2._checkapppowerbycode(self.window,apcode1) ;
} ;
function checkapppower()
{
	return _pobj2._checkapppower(self.window) ;
} ;
function _rightmouse_Click()
{
	 hidefloattooltip(0) ;
   var srcobj = window.event.srcElement ? window.event.srcElement : window.event.target;
   var selstr1 = document.selection.createRange().text ;
   var str25 = $(srcobj).attr("popmenu") ;
   var srcobj2 = null ;
   str25 = isnull(str25,"") ;
   selstr1 = isnull(selstr1, "") ;
   srcobj1 = srcobj.type ;
   srcobj1 = isnull(srcobj1, "") ;
   if (str25!="") srcobj2 = $(srcobj) ; else 
   {
   	 srcobj2 = $(srcobj).parents("*[popmenu]:first") ;
   	 if (srcobj2.length>0) 
   	 {
   	   str25 = srcobj2.attr("popmenu") ;
   	   str25 = isnull(str25,"") ;
   	   srcobj = srcobj2[0] ;
   	 } ;
   } ;
   if ((selstr1 == "") && (srcobj1 != "text") && (srcobj1 != "textarea"))
   {
   	  if (str25>"") 
   	  {
   	  	str25 = str25.replace("()","(0)") ;
   	  	str25 = str25.replace("(","(srcobj,") ;
   	  	try {eval(str25)} catch (e) {} finally { };
   	  	window.event.returnValue = false;
   	  } else 
   	  {
   	  	hidefloatmenu(0) ;  hidefloattooltip(0) ;
   	  	if (haspopupmenu__) window.event.returnValue = false;
   	  } ;
   	  
   } else 
   {
   	hidefloatmenu(0) ;  hidefloattooltip(0) ;
   	if (haspopupmenu__) window.event.returnValue = false;
   }
   ;
};

function submenuover(objtd1)
{
	$(objtd1).addClass("menu_navy") ;
}
function submenuout(objtd1)
{
	$(objtd1).removeClass("menu_navy") ;
}

function _genpopup(obj1,menuitemsarr1,x1,y1)
{
	var txt1 = "";
	var i = 0 ;
	var submnid = 0 ;
	for (var j = 0 ; j<menuitemsarr1.length ; j+=2)
	{
		i ++ ;
		txt1 += "<tr><td nowrap style='padding-left:8px;padding-top:2px;padding-bottom:2px;padding-right:8px;font-size:14px;'  onclick="+
		"'hidefloatmenu(0);"+menuitemsarr1[j+1]+"' onmouseover='submenuover(this)' onmouseout='submenuout(this)'>"+menuitemsarr1[j]+"</td></tr>" ;
	} ;
	if (i>0) 
	{
		showfloatmenu(obj1,"<table id=popmenu_001 width='100%' cellSpacing=0 cellPadding=0 border=0>"+txt1+"</table>",x1,y1) ;
		menu_clickgray("#popmenu_001 tr td","default") ;
	} else hidefloatmenu(0) ;
}
// edittable 

function post1row(trdomobj1,url1)
{
	_pobj2._checkpost1row(self.window,trdomobj1,url1) ;
};
function post1row_return(trdomobj1,url1)
{
	_pobj2._checkpost1row_return(self.window,trdomobj1,url1) ;
};
function checkbrowsemode()
{
   _pobj2._checkpost(self.window, document.location.href);
};
function deletearow()
{
   _pobj2._deletearow(self.window);
};
function appendarow()
{
   return _pobj2._appendarow(self.window) ;
};
function focustable(tbobj1)
{
   _pobj2._focustable(self.window, tbobj1);
  try {window.event.cancelBubble = true ;}  catch (e) {} finally { };
  try {window.event.returnValue=false;	}  catch (e) {} finally { };
};
function removelastfocus()
{
   _pobj2._removelastfocus(self.window);
};
function focuscellxy(tdobj)
{
	try
	{
		if (_edit_table!=$(tdobj).parent().parent().parent()[0].id) 
		{
	    focustable($(tdobj).parent().parent().parent()[0]) ;
      _pobj2._focuscellxy(self.window, tdobj);
    } else 
    {
    	_pobj2._focuscellxy(self.window, tdobj);
    } ;	  
  }  catch (e) {} finally { };
  // try {$(tdobj).parent().click();}  catch (e) {} finally { };	
  //try {$(tdobj).parent().parent().click();}  catch (e) {} finally { };	
  //try {window.event.cancelBubble = true ;}  catch (e) {} finally { };
  //try {window.event.returnValue=false;	}  catch (e) {} finally { };
   //editacell(tdobj) ;
};
function focuseditcell(editit1)
{
	var edit11 = isnull(editit1,"1") ;
   _pobj2._focuseditcell(self.window,edit11);
};
function editonblur(edobj)
{
	$(edobj).attr("rawvalue",tohex($(edobj).val())) ;
	var src1 = isnull($(edobj).attr("pick"),"") ;
	if ((edobj.id!="my_cell_edit") || (src1==""))
	  if (!validme(edobj)) return false ;
	var olvs = tostr($(edobj).attr("oldvalue")) ;
	var nwvs = $(edobj).val() ;
	if (olvs==nwvs) return  false ;
	editedacell(edobj) ;
};
function editedacell(edobj)
{
   _pobj2._editedacell(self.window, edobj);
};
function tryfocustable()
{
   _pobj2._tryfocustable(self.window);
};
function restorevalue()
{
   _pobj2._restorevalue(self.window);
};
function myunedittable(tbname)
{
   $("#" + tbname).unbind("click").unbind("keydown").unbind("keypress");
   $("#" + tbname + ">tbody[name=details_auto]>tr>td").unbind("click") ;
   _edit_table = "" ;
   _edit_table_manul_calc_group = null ;
};

function myedittable(tbname, ochg1, bedit1, aedit1, bpost1)
{
	 // 去掉以前所有的与编辑有关的东西
	 var obj12 = $("#my_cell_edit") ;//.remove() ;
	 if (obj12.length>0) editedacell(obj12[0]) ;
	 $("td.editacell:not(.tdb),td.editingacell:not(.tdb)").removeClass("editacell").removeClass("editingacell").css("border-bottom","none") ;
	 $("td.editacell.tdb,td.editingacell.tdb").removeClass("editacell").removeClass("editingacell").css("border-bottom","1px solid #BBC8C8");
   eval("" + tbname + "_beforeedit__=null;") ;
   eval("" + tbname + "_afteredit__=null;") ;
   eval("" + tbname + "_beforepost__=null;") ;
   eval("" + tbname + "_onchange__=null;") ;

   if (bedit1) eval("" + tbname + "_beforeedit__=" + bedit1) ;
   if (aedit1) eval("" + tbname + "_afteredit__=" + aedit1) ;
   if (bpost1) eval("" + tbname + "_beforepost__=" + bpost1) ;

   if (ochg1) {
   	eval("" + tbname + "_onchange__=" + ochg1) ;
   } ;	

   
   $("#" + tbname).unbind("click").unbind("keydown").click(function()
   {
      focustable(document.getElementById(tbname));
   }
   ).keydown(function()
   {
      tablekeydown(event);
   }
   ).keypress(function()
   {
   	 tablekeypress(event);
   }) ; 
   $("#" + tbname + ">tbody>tr>td").click(function()
   {
      focuscellxy(this);
   }
   ) ;
   
};
function editacell(tdobj)
{
   if (_pobj2._editacell(self.window, tdobj))
   {
   	  //v18 = $("#my_cell_edit")[0] ;
      $("#my_cell_edit").Autocomplete(
      {
         autofill : false,
         helperClass : 'autocompleter',
         selectClass : 'selectAutocompleter'
      }
      ).focus();
      var obj111 = $("#my_cell_edit")[0] ;
      var issrc = tostr(isnull($(obj111).attr("source"), "")) ;
      var ispick = isnull($(obj111).attr("pick"), "") ;
      var isright = isnull($(obj111).css("text-align"), "").toLowerCase() ;
      if (isright == "right") isright = "l" ;
      else isright = "" ;
      if ((issrc != '') || (ispick!=""))
      {
      	if (ispick!="") 
      	{
      		$(obj111).removeClass("sourceedit sourceeditl").addClass("sourcepick")
		         .bind("mousemove",function(){editmousemove(this,event)})
		         .bind("mouseout",function(){editmouseout(this)});
      	} else 
      	{	
	       	if (isright=='')
		      	$(obj111).removeClass("sourceedit sourceeditl").addClass("sourcedbl" + isright)
		         .bind("mousemove",function(){editmousemove(this,event)})
		         .bind("mouseout",function(){editmouseout(this)});
		      else 
		         $(obj111).removeClass("sourceedit sourceeditl").addClass("sourcedbl" + isright)
		         .bind("mousemove",function(){editmousemovel(this,event)})
		         .bind("mouseout",function(){editmouseout(this)}); 
		    } ;     
	    } ;     
      return true ;
   }
   else  return false ;
};
function doctrl_c()  // 
{
	var tdhtml = isnull($(_edit_td).html(),"&nbsp;") ;
	var tdvalue = tostr($(_edit_td).attr("value")) ;
	if (tdvalue==null) tdvalue = "{null}" ;
	clipboardData.setData("Text","innerHTML="+tdhtml+"&innerValue="+tdvalue);
}
function doctrl_x()  // 
{
	var tdhtml = isnull($(_edit_td).html(),"&nbsp;") ;
	var tdvalue = tostr($(_edit_td).attr("value")) ;
	
	if (tdvalue==null) 
	{
		if ((tdhtml!="&nbsp;") && (tdhtml!="&#160;")) tdvalue = tdhtml ;
		else tdvalue = "" ;
	} ;	
	clipboardData.setData("Text","innerHTML="+tdhtml+"&innerValue="+tdvalue);
	$(_edit_td).attr("value","").attr("oldvalue","00000") ;
	$(_edit_td).html("&nbsp;").addClass("tbupdatedtr").attr("ident",ident()) ;
	var fmt=isnull($(_edit_td).attr("fmt"),"") ;
	if (fmt!="") 
	eval("if ("+_edit_table+"_onchange__) "+_edit_table+"_onchange__(\""+$(_edit_td).attr("name")+"\",\"&nbsp;\",null,_edit_td,$(_edit_td).parent()[0])") ;
}
function doctrl_v()  // especial for EXCEL
{
	var str1 = clipboardData.getData("Text");
	var cols = [] ;
	var i = 0 ;
	var str01 = "" ;
	var str02 = "" ;
	i = str1.indexOf("innerHTML=") ;
	if (i==0) 
	{
		str01 = str1.substr(10) ;
		i = str01.indexOf("&innerValue=") ;
		if (i>0)
		{
			str02 = str01.substr(0,i) ;
			str01 = str01.substr(i+12) ;
			if (str01!="{null}") 
				  $(_edit_td).attr("value",(str01)) ; 
			else
			{
				str01 = str02 ;
				if ((str01=="&nbsp;") || (str01=="&#160;")) str01 = "" ;
				$(_edit_td).attr("value",(str01)) ;
			} ;
			
			$(_edit_td).html(str02).addClass("tbupdatedtr").attr("oldvalue","00000").attr("ident",ident()) ;
			eval("if ("+_edit_table+"_onchange__) "+_edit_table+"_onchange__(\""+$(_edit_td).attr("name")+"\",str01,null,_edit_td,$(_edit_td).parent()[0])") ;
		  return  false ;
		} ;  
	} ;
	str01 = "" ;
	str02 = "" ;
	var maxcoli = 0 ;
	var trobj1 = $(_edit_td).parent() ;
	var tdobjs = $("td",trobj1) ;
	var tdindex1 = -1 ;
	var tdobj = null ;
	for (i=0;i<tdobjs.length;i++) 
	if (tdobjs[i]==_edit_td) { tdindex1 = i ; break ;} ;
	if (tdindex1==-1) return  false ;
	while (true) 
	{
		cols = [] ;
		i = str1.indexOf("\r\n") ;
		if (i<0) i = str1.indexOf("\n\r") ;
		if (i<0) i = str1.indexOf("\n") ;
		if (i<0) i = str1.indexOf("\r") ;
		
		if (i>=0) 
		{
			str01 = str1.substr(0,i).trim() ;
			str1 = str1.substr(i+1) ;
		} else 
		{
			str01 = str1.trim() ;
			str1 = "" ;
		} ;
		if (true) 
		{
			if (str01=="") 
			{
				cols.push("") ;
			} else 
			while (str01!="") 
			{
				i=str01.indexOf("\t") ;
				if (i>=0) 
				{
					str02 = str01.substr(0,i).trim() ;
					str01 = str01.substr(i+1) ;
				} else 
				{
					str02 = str01.trim() ;
					str01 = "" ;
				} ;
				cols.push(str02) ;
				if (str01=="") break ;
			} ;
			// 
			if (maxcoli<cols.length) maxcoli = cols.length ;
			if (maxcoli==cols.length)
			{
				tdobjs = $("td",trobj1) ;
				for (i=tdindex1;i<tdobjs.length;i++) 
				if ((i-tdindex1)<cols.length) 
				{
					tdobj	= tdobjs[i] ;
					if (isnull($(tdobj).attr("edit"),"1")=="0") 
					{
						$(tdobj).html(isnull(cols[i-tdindex1],"&nbsp;")).attr("value",(cols[i-tdindex1])).addClass("tbupdatedtr").attr("ident",ident()) ;
						eval("if ("+_edit_table+"_onchange__) "+_edit_table+"_onchange__(\""+$(tdobj).attr("name")+"\",cols[i-tdindex1],null,tdobj,$(tdobj).parent()[0])") ;
					} ;
				} ;
			} ;	
			trobj1 = $(trobj1[0].nextSibling) ;
			if (trobj1.length<=0) break ;
		}  ;
		if (str1 == "") break ;
	} ;
}
function val(fld1)
{
	var fldn1 = fld1 ;
	var st01 = 0 ;
	if (fldn1.indexOf("f.")==0) { fldn1 = fldn1.substr(2);st01 = 1 ;} ;
	if (fldn1.indexOf("r.")==0) { fldn1 = fldn1.substr(2);st01 = 2 ;} ;
	if (fldn1.indexOf("g.")==0) { fldn1 = "*[name="+fldn1.substr(2)+"]";st01 = 3 ;} ;
	if (fldn1.indexOf("$")==0)  { 
		fldn1 = fldn1.substr(2,fldn1.length-3) ;
		if (fldn1.substr(0,1)=="'") fldn1 = fldn1.substr(1,fldn1.length-2) ;
		if (fldn1.substr(0,1)=='"') fldn1 = fldn1.substr(1,fldn1.length-2) ;
		st01 = 4 ;
	} ;
	var obj01 = null ;
	if (st01==4) // 直接是jquery
	{
		obj01 = $(fldn1) ;
	} else 
	if (st01==0) 
	{
		obj01 = $("[name="+fldn1+"]",_pobj2.currenttr) ;
	} else 
	if (st01==1) 
	{
		obj01 = $("[name="+fldn1+"]",_pobj2.fatherclicktr) ;
	} else
	if (st01==3)
	{
		obj01 = $(fldn1) ;
	} else 
	{
		obj01 = $("#"+fldn1) ;
	} ;
	
	if ((obj01!=null) && (obj01.length>0))
	{
		var v001 = "" ;
		if ((obj01[0].tagName=="INPUT") || (obj01[0].tagName=="SELECT") || (obj01[0].tagName=="TEXTAREA"))
		{
			if (obj01[0].type.toLowerCase()=="radio") 
			{
				v001 = 0 ;
				obj01.each(function()
				{
					if (this.checked) v001 = $(this).val() ;
				}) ;
			} else v001 = $(obj01[0]).val() ;
			return v001 ;
		}	
		else 
			{
				v001 = isnull(obj01.attr("value"),"_)_)-") ;
				if (v001=="_)_)-") v001 = isnull(obj01.html(),"") ;
				if (v001=="_)_)-") v001 = "" ;
				if (v001=="") v001 = "0" ;
				if (v001.indexOf("&")>=0) v001 = "0" ;
				if (v001.indexOf("<")>=0) v001 = "0" ;
				v001 = tostr(v001) ;
				var v002 = myparseFloat(v001,0) ;
				return v002 ;
			} ;
	} else return 1 ;
}
function toval(v122)
{
	var av0121 = 0 ;
	try {eval("av0121="+v122)} catch (e) { av0121 = v122 ;} finally { } ;
	return av0121 ;
}
function cndres(c122)
{
	var av0121 = false ;
	try {eval("av0121="+c122)} catch (e) { av0121 = false ;} finally { } ;
	return av0121 ;
}
function cas(cnd1,v1,cnd2,v2,cnd3,v3,cnd4,v4,cnd5,v5,cnd6,v6,cnd7,v7,cnd8,v8,cnd9,v9,else1,v0)
{
 
	if ((cnd1) && (cnd1!="else")) if (cndres(cnd1)) return toval(v1) ;
	if ((cnd1) && (cnd1=="else")) return toval(v1) ;
	if ((cnd2) && (cnd2!="else")) if (cndres(cnd2)) return toval(v2) ;
	if ((cnd2) && (cnd2=="else")) return toval(v2) ;
	if ((cnd3) && (cnd3!="else")) if (cndres(cnd3)) return toval(v3) ;
	if ((cnd3) && (cnd3=="else")) return toval(v3) ;
	if ((cnd4) && (cnd4!="else")) if (cndres(cnd4)) return toval(v4) ;
	if ((cnd4) && (cnd4=="else")) return toval(v4) ;
	if ((cnd5) && (cnd5!="else")) if (cndres(cnd5)) return toval(v5) ;
	if ((cnd5) && (cnd5=="else")) return toval(v5) ;
	if ((cnd6) && (cnd6!="else")) if (cndres(cnd6)) return toval(v6) ;
	if ((cnd6) && (cnd6=="else")) return toval(v6) ;
	if ((cnd7) && (cnd7!="else")) if (cndres(cnd7)) return toval(v7) ;
	if ((cnd7) && (cnd7=="else")) return toval(v7) ;
	if ((cnd8) && (cnd8!="else")) if (cndres(cnd8)) return toval(v8) ;
	if ((cnd8) && (cnd8=="else")) return toval(v8) ;
	if ((cnd9) && (cnd9!="else")) if (cndres(cnd9)) return toval(v9) ;
	if ((cnd9) && (cnd9=="else")) return toval(v9) ;
}
function chk(fld1,v1,n1,v2,n2,v3,n3,v4,n4,v5,n5,v6,n6,v7,n7,v8,n8,v9,n9,else1,n0)
{
	var v001 = val(fld1) ;
	var v002 = 1 ;
	if ((v1) && (v1=="else")) v002 = toval(n1) ;
	if ((v2) && (v2=="else")) v002 = toval(n2) ;
	if ((v3) && (v3=="else")) v002 = toval(n3) ;
	if ((v4) && (v4=="else")) v002 = toval(n4) ;
	if ((v5) && (v5=="else")) v002 = toval(n5) ;
	if ((v6) && (v6=="else")) v002 = toval(n6) ;
	if ((v7) && (v7=="else")) v002 = toval(n7) ;
	if ((v8) && (v8=="else")) v002 = toval(n8) ;
	if ((v9) && (v9=="else")) v002 = toval(n9) ;
	if ((else1) && (else1=="else")) v002 = toval(n0) ;
	
	if ((v1) && (toval(v1)==v001)) v002 = toval(n1) ;
	if ((v2) && (toval(v2)==v001)) v002 = toval(n2) ;
	if ((v3) && (toval(v3)==v001)) v002 = toval(n3) ;
	if ((v4) && (toval(v4)==v001)) v002 = toval(n4) ;
	if ((v5) && (toval(v5)==v001)) v002 = toval(n5) ;
	if ((v6) && (toval(v6)==v001)) v002 = toval(n6) ;
	if ((v7) && (toval(v7)==v001)) v002 = toval(n7) ;
	if ((v8) && (toval(v8)==v001)) v002 = toval(n8) ;
	if ((v9) && (toval(v9)==v001)) v002 = toval(n9) ;
	if ((else1) && (else1==v001)) v002 = toval(n0) ; 
	
	return v002 ;
}
function ls(fld1,v1,n1,elsen2)
{
	var v001 = val(fld1) ;
	var v002 = toval(elsen2) ;
	if (v001<toval(v1)) v002 = toval(n1) ;
	return v002 ;
}
function nls(fld1,v1,n1,elsen2)
{
	var v001 = val(fld1) ;
	var v002 = toval(elsen2) ;
	if (v001>=toval(v1)) v002 = toval(n1) ;
	return v002 ;
}
function gt(fld1,v1,n1,elsen2)
{
	var v001 = val(fld1) ;
	var v002 = toval(elsen2) ;
	if (v001>toval(v1)) v002 = toval(n1) ;
	return v002 ;
}
function ngt(fld1,v1,n1,elsen2)
{
	var v001 = val(fld1) ;
	var v002 = toval(elsen2) ;
	if (v001<=toval(v1)) v002 = toval(n1) ;
	return v002 ;
}
function eq(fld1,v1,n1,elsen2)
{
	var v001 = val(fld1) ;
	var v002 = toval(elsen2) ;
	if (v001==toval(v1)) v002 = toval(n1) ;
	return v002 ;
}
function neq(fld1,v1,n1,elsen2)
{
	var v001 = val(fld1) ;
	var v002 = toval(elsen2) ;
	if (v001!=toval(v1)) v002 = toval(n1) ;
	return v002 ;
}
function formulobj(obj1,editable1)
{
	_pobj2._formulobj(self.window,obj1,editable1) ;
}
function formulatr(trjq1)
{
	_pobj2.currenttr = trjq1 ;
	_pobj2._formulatr(self.window,trjq1)
}

function tablekeydown(evt)
{
   if (_edit_table == "") return  false ;
   if (!(_edit_td)) return  false ;
   //if ( ! document.getElementById(_edit_table)) return  false ;
   var pressedKey = evt.keyCode ;
   if (evt.ctrlKey) 
   {
   	if (pressedKey==88) //x
   	{
   		if (( document.activeElement.id != "my_cell_edit") && (_edit_td!=null))
   		{
   		  doctrl_x() ;
   		  evt.cancelBubble = true ;
		    evt.returnValue=false;
		    return  false ;
   		} ;
   	} else 
   	if (pressedKey==67) //c
   	{
   		if (( document.activeElement.id != "my_cell_edit") && (_edit_td!=null))
   		{
   		  doctrl_c() ;
   		  evt.cancelBubble = true ;
		    evt.returnValue=false; 
		    return  false ;
   		} ;
   	} else 	
   	if (pressedKey==86) 
   	{
   		if (( document.activeElement.id != "my_cell_edit") && (_edit_td!=null))
   		{
   		  doctrl_v() ;
   		  evt.cancelBubble = true ;
		    evt.returnValue=false; 
		    return  false ;
   		} ;  
   	} ;
   } ;
   if ( document.activeElement.id == "my_cell_edit")
   {
      if (pressedKey == 27)
      {
         try {evt.keyCode = 0 ;} catch (e) {} finally { };
         restorevalue();
         tryfocustable();
         try { window.clearTimeout(fcstimer);} catch (e) {} finally { };
         fcstimer = window.setTimeout("tryfocustable();", 20) ;
      }
      else
      if ((pressedKey != 13) && (pressedKey != 9)) return  false ;
   }
   ;
   
   if (pressedKey == 40) // down
   {
   	removelastfocus(self.window);
      _edit_direction = 1 ;
      _edit_rowi ++ ;
      if (_edit_rowi > _edit_maxrow)
      {
        
            _edit_coli ++ ;
            _edit_rowi = _edit_row0 ;
            if (_edit_coli > _edit_maxcol)
            {
               _edit_coli = _edit_col0 ;
            }
            ;
       			
      }
      ;
       evt.cancelBubble = true ;
      evt.returnValue=false; 
      try {evt.keyCode = 0 ;} catch (e) {} finally { };
   }
   else
   if (pressedKey == 38) /// up
   {
   	removelastfocus(self.window);
      _edit_direction = 1 ;
      _edit_rowi -- ;
      if (_edit_rowi < _edit_row0)
      {
         _edit_rowi = _edit_maxrow ;
         _edit_coli -- ;
         if (_edit_coli < _edit_col0) _edit_coli = _edit_maxcol ;
      };
      try {evt.keyCode = 0 ;} catch (e) {} finally { };
       evt.cancelBubble = true ;
       evt.returnValue=false; 
   }
   else
   if (pressedKey == 37) // left
   {
   	removelastfocus(self.window);
      _edit_direction = 0 ;
      _edit_coli -- ;
      if (_edit_coli < _edit_col0)
      {
         _edit_coli = _edit_maxcol ;
         _edit_rowi -- ;
         if (_edit_rowi < _edit_row0) _edit_rowi = _edit_maxrow ;
      } ;
      try {evt.keyCode = 0 ;} catch (e) {} finally { };
       evt.cancelBubble = true ;
       evt.returnValue=false; 
   }
   else
   if ((pressedKey == 39) || (pressedKey == 9)) // right
   {
   	removelastfocus(self.window);
      _edit_coli ++ ;
      if (_edit_coli > _edit_maxcol)
      {
         _edit_coli = _edit_col0 ;
         _edit_rowi ++ ;
         if (_edit_rowi > _edit_maxrow) _edit_rowi = _edit_row0 ;
      }
      ;
      if (pressedKey == 9)
      {
        try {evt.keyCode = 0 ;} catch (e) {} finally { };
         window.focus() ;
         document.body.focus() ;
         tryfocustable();
         try { window.clearTimeout(fcstimer);} catch (e) {} finally { };
         fcstimer = window.setTimeout("tryfocustable();", 20) ;
      }
      else _edit_direction = 0 ;
      	 evt.cancelBubble = true ;
       evt.returnValue=false; 
   }
   else
   if (pressedKey == 33) // pgup
   {
   	removelastfocus(self.window);
      _edit_rowi = _edit_row0 ;
      evt.cancelBubble = true ;
       evt.returnValue=false; 
   }
   else
   if (pressedKey == 34) // pgdn
   {
   	removelastfocus(self.window);
      _edit_rowi = _edit_maxrow ;
       evt.cancelBubble = true ;
       evt.returnValue=false; 
   }
   else
   if (pressedKey == 35) // end
   {
   	removelastfocus(self.window);
      _edit_coli = _edit_maxcol ;
      evt.cancelBubble = true ;
       evt.returnValue=false;  
   }
   else
   if (pressedKey == 36) // home
   {
   	removelastfocus(self.window);
      _edit_coli = _edit_col0 ;
       evt.cancelBubble = true ;
       evt.returnValue=false; 
   }
   else
   if (pressedKey == 13) // home
   {
   	  try {evt.keyCode = 0 ;} catch (e) {} finally { };
   	  evt.cancelBubble = true ;
      evt.returnValue=false; 
   	  var dir111 = 1 ;
   	  if (evt.ctrlKey) dir111 = -1 ;
   	  if ( document.activeElement.id == "my_cell_edit") 
   	  {
   	  	removelastfocus(self.window);
   	  	if (dir111==1)
   	  	{
	        if (_edit_direction == 0)
		      {
		         _edit_coli ++ ;
		         if (_edit_coli > _edit_maxcol)
		         {
		            _edit_coli = _edit_col0 ;
		            _edit_rowi ++ ;
		            if (_edit_rowi > _edit_maxrow) _edit_rowi = _edit_row0 ;
		         }
		         ;
		      }
		      else
		      {
		         _edit_rowi ++ ;
		         if (_edit_rowi > _edit_maxrow)
		         {
		            _edit_rowi = _edit_row0 ;
		            _edit_coli ++ ;
		            if (_edit_coli > _edit_maxcol)  _edit_coli = _edit_col0 ;
		         }
		         ;
		      }
		      ;
		     } else 
		     {
		     	if (_edit_direction == 0)
		      {
		         _edit_coli -- ;
		         if (_edit_coli < _edit_col0)
		         {
		            _edit_coli = _edit_maxcol ;
		            _edit_rowi -- ;
		            if (_edit_rowi < _edit_row0) _edit_rowi = _edit_maxrow ;
		         }
		         ;
		      }
		      else
		      {
		      	_edit_rowi -- ;
			      if (_edit_rowi < _edit_row0)
			      {
			         _edit_rowi = _edit_maxrow ;
			         _edit_coli -- ;
			         if (_edit_coli < _edit_col0) _edit_coli = _edit_maxcol ;
			      };
		      }
		      ;
		     }  ; 
   	  } ;
   	  tryfocustable();
   	  toeditmode();selectall($('#my_cell_edit')[0]);$('#my_cell_edit')[0].focus();
   	  try { window.clearTimeout(fcstimer);} catch (e) {} finally { };
	    fcstimer = window.setTimeout("tryfocustable();toeditmode();$('#my_cell_edit')[0].focus();selectall($('#my_cell_edit')[0]);", 20) ;
	    //fcstimer = window.setTimeout("tryfocustable();toeditmode();$('#my_cell_edit')[0].focus();selectall($('#my_cell_edit')[0]);", 1000) ;
   }
   else
   if (pressedKey == 45) // ins
   {

         if (toeditmode())
         {
            try {evt.keyCode = 0 ;} catch (e) {} finally { };
            $("#my_cell_edit")[0].focus() ;
         }
         ;
    
   }
   else
   if (pressedKey == 46) // del
   {

				var tdvalue = tostr($(_edit_td).attr("value")) ;
				if (tdvalue==null) tdvalue = "{null}" ;
				if (tdvalue != "{null}") $(_edit_td).attr("value","") ;
				$(_edit_td).html("&nbsp;").addClass("tbupdatedtr").attr("oldvalue","00000").attr("ident",ident()) ;
				eval("if ("+_edit_table+"_onchange__) "+_edit_table+"_onchange__(\""+$(_edit_td).attr("name")+"\",tdvalue,null,_edit_td,$(_edit_td).parent()[0])") ;
        
         if (toeditmode())
         {
            try {evt.keyCode = 0 ;} catch (e) {} finally { };
            $("#my_cell_edit").val("")[0].focus() ;
         }
         ;
     
   } 
   ;
   focuseditcell();
};
function selectedtext(obj)
{
	var js = "fdsfrewrewrew" ;
	try { js = document.selection.createRange().text ; } catch (e) {} finally { };
	return js.trim() ;
}
function selectall(obj)
{
	try {obj.focus(); } catch (e) {} finally { };
	try
	{
	  obj.select();
	  js=obj.createTextRange();
	  js.execCommand("SelectAll");
	} catch(E){} finally {} ;  
};

function moveend(obj) 
{ 
	try {obj.focus(); } catch (e) {} finally { };
	try
	{
	  o=obj.createTextRange(); 
	  o.moveStart('character',$(obj).val().length); 
	  o.collapse(true); 
	  o.select(); 
	} catch(E){} finally {} ;  
} 

function tablekeypress(evt)
{
 
   if (_edit_table == "") return  false ;
   //if ( ! document.getElementById(_edit_table)) return ;
   if ($("#my_cell_edit").length>0) return  false ;
   var pressedKey =  evt.keyCode ;
      if ((toeditmode()) && (((pressedKey>=30) && (pressedKey<=126))))
      {
      		evt.cancelBubble = true ;
          evt.returnValue=false; 
          if (pressedKey!=32)
          {
      	    $("#my_cell_edit").val(String.fromCharCode(pressedKey)).focus() ;
      	    
      	  } else 
      	  {
      	  	$("#my_cell_edit").val("").focus() ;
      	  } ;  
      	  moveend($("#my_cell_edit")[0]) ;
     	} 
      ;
   
   focuseditcell();
};
function toeditmode()
{
   if ( ! _edit_input )
   {
      if (editacell(_edit_td))
      {
      	 v18 = _edit_input ;
         $(_edit_input).Autocomplete(
         {
            autofill : false,
            multiple : true ,
            helperClass : 'autocompleter',
            selectClass : 'selectAutocompleter'
         }
         ).focus();
         try {f22() ;} catch(E){} finally {} ;
         return true;
      }
      else return false ;
   }
   else return false ;
};


// edittable 


function togglegroup(trobj1)
{
   return _pobj2._togglegroup(self.window, trobj1);
};
// trobj1 : dom or idname
function togglegroup_son(tdobj1)
{
   return _pobj2._togglegroup_son(self.window, tdobj1);
};
function togglegroup_son_son(obj1)
{
   return _pobj2._togglegroup_son_son(self.window, obj1);
};
function groupeachtr(trobj1, funcb1)
{
   _pobj2._groupeachtr(self.window, trobj1, funcb1);
};
function groupeachtr_son(obj1, funcb1)
{
   _pobj2._groupeachtr_son(self.window, obj1, funcb1);
};
function groupeachtr_son_son(obj1, funcb1)
{
   _pobj2._groupeachtr_son_son(self.window, obj1, funcb1);
};

function disp1cst(ccid1)
{
	popwin("+768","+95%","/cst/custinfo.aspx?tag=0&ccid="+ccid1+"&cache=0&tabid=1","浏览客户资料") ;
}
function disp1cstbykey(key1,val1)
{
	popwin("+768","+95%","/cst/custinfo.aspx?ccid=0&tag=0&nocache=0&fld="+key1+"&val="+tohex(val1)+"&tabid=1","浏览客户资料") ;
}
function disp1doc(docid1)
{
	popwin("+768","+95%","/doc/doc.aspx?docid="+docid1+"&web=0","阅读文档") ;
}
function disp1dc(dcid1)
{
	popwin("<658","+95%","/doc/doclists.aspx?dcid="+dcid1+"&web=0","文档分类搜索") ;
}
function goto1cst(ccid1)
{
	goto("/cst/custinfo.aspx?tag=0&ccid="+ccid+"&cache=0&tabid=1") ;
}
function goto1doc(docid1)
{
	goto("/doc/doc.aspx?docid="+docid1+"&web=0") ;
}
function goto1dc(dcid1)
{
	goto("/doc/doclists.aspx?dcid="+dcid1+"&web=0") ;
}
function disp1prd(prdtype1,docid1)
{
	popwin("+768","+95%","/prd/prd"+prdtype1+".aspx?prdid="+docid1+"&web=0","阅读资料") ;
}
function disp1pc(prdtype1,dcid1)
{
	popwin("<658","+95%","/prd/prdlists"+prdtype1+".aspx?pcid="+dcid1+"&web=0","分类搜索") ;
}
function goto1prd(prdtype1,docid1)
{
	goto("/prd/prd"+prdtype1+".aspx?prdid="+docid1+"&web=0") ;
}
function goto1pc(prdtype1,dcid1)
{
	goto("/prd/prdlists"+prdtype1+".aspx?pcid="+dcid1+"&web=0") ;
}
// 变量
var workings1 = "" ;
var workings2 = "";
var aspxname = + "__" + ident() ;
var _pobj2 = rootparent();
var _myident = "" ;
var _recno = 0 ;
var _recindex = 0 ; // fldv中可以使用，当前记录号
var _reccount = 0 ; // fldv中可以使用，当前DataSet记录总数
var $flds = [] ;
// table 中有
var $v = [] ;
// table 中有
var $o = [] ;
// table 中有
var $f = [];
// 非table
var $v1 = [] ;
// table 中有 第一条记录
var $v2 = [] ;
var $s = [] , $sflds = []; // 主要用于 datarow_foreach 中的row结果
var documentloaded = false ;
// table 中有 最后一条记录
var specialstring = "" ;
var _tooltip_father = null ;
var _submenu_father = null ;
var _edit_table	 = "" ;
var _edit_table_manul_calc_group = "" ;
var _edit_td = null ; // 表示当前正在编辑的TD
var _edit_input = null ;
var _edit_col0 = 1 ;
var _edit_row0 = 1 ;
var _edit_coli = 1 ;
var _edit_rowi = 1 ;
var _edit_maxcol = 3 ;
var _edit_maxrow = 3 ;
var _edit_pageindex = 0 ;
var _edit_currpage = null ;
var _edit_direction = 0 ;
var dataseturllogs = [] ;
var refreshident = "" ;
var pagefilename = "home" ;
var rootstr_forformula = [] ;
var rootobj_forformula = [] ;
var holdctrltm = null ;
////////

// 0 = h 1 = v
if (iscrmxsystem())
{
   // _myident = QueryParams("mywinid") ;
   if (_myident == "") _myident = ident() ;
   _myident = "_" + _myident ;
   var tvs1 = "_pobj2." + _myident + " = self.window " ;
   eval(tvs1) ;

   //if ((_pobj2.cmpid != 1) && (_pobj2.cmpid != 51) && (existsParam("mywinid"))) nomenu() ;
}
;
var ts1 = document.location.href ; 
var _backsrc = "" ;

var i010 = ts1.indexOf("idtfcawl") ;
if (i010>0) ts1 = ts1.substr(0,i010) ;
i010 = ts1.lastIndexOf("/") ;
if (i010>=0) ts1 = ts1.substr(i010+1) ;
i010 = _pobj2._backurls.indexOf("___"+ts1) ;
if (i010>=0) 
_backsrc = _pobj2._backurls[i010+1] ;

/// 自动完成 autocode

function defaultkeypress(evt, format1)
{
   if (format1 == "int") onlyint(evt) ; else
   if (format1 == "float") onlyfloat(evt) ;
};
function onlyint(evt)
{
   var pressedKey = evt.keyCode ;
   var wordfmt = ",45,57,56,55,54,53,52,51,50,49,48," ;
   if (wordfmt.indexOf("," + pressedKey + ",") < 0) evt.keyCode = 0;
};
function onlyfloat(evt)
{
   var pressedKey = evt.keyCode ;
   var wordfmt = ",45,57,56,55,54,53,52,51,50,49,48,46," ;
   if (wordfmt.indexOf("," + pressedKey + ",") < 0) evt.keyCode = 0;
};

function autoht()
{
	try {needautoframeheight() ; } catch (e) {} finally { };
	try {myautoframeheight() ; } catch (e) {} finally { };
}
function hidefloattooltip(time1)
{
	if ((time1==null) || (time1==undefined))
	  window.setTimeout("_hidefloattooltip()",200) ;
	else window.setTimeout("_hidefloattooltip()",time1) ;  
}

function _hidefloattooltip()
{
	$("#_lxpfloattip_").fadeOut("slow") ;
	window.setTimeout("autoht()",1000) ;
}
function showfloattooltip(obj1)
{
	_showfloattooltip(obj1,"") ;
};
function floatinfo(obj1,text1)
{
	_showfloattooltip(obj1,text1) ;
};
function _showfloattooltip(obj1,text1)
{
	validstr = isnull(text1,"") ;
	if (validstr=="") validstr = isnull($(obj1).attr("invalid"),"") ;
  if (validstr=="") 
  {
  	validstr = isnull($(obj1).attr("needvalue"),"") ;
  	if (validstr!="") validstr = "必须输入数据!" ;
  } ;
  
  if (validstr=="") 
  {
  	validstr = "数据录入不正确" ;
  } ;
  try {_tooltip_father = $(obj1).parent()[0] ;} catch (e) {} finally { };
  var position = jQuery.iUtil.getPosition(obj1);
	var size = jQuery.iUtil.getSize(obj1);
	var objleft1 = position.x ;
	var objtop1 = (position.y + size.hb - 5) ;
	floatttloadobj = document.getElementById("_lxpfloattip_") ;
	if (!floatttloadobj) 
	{
		$(document.body).append(
	  "<div id=_lxpfloattip_ " 
	  + " onclick='hidefloattooltip()' "
    + " style='"
    + "z-index:800000000;cursor:hand;"
    + "position:absolute;"
    + "left:"+(objleft1)+"px;"
    + "top:"+(objtop1)+"px;"
    + "'>"
    + "<table cellSpacing=0 cellPadding=0 border=0>"
    + "<tr><td class=tip_lefttop></td>" 
    + "<td class=tip_top></td>" 
    + "<td class=tip_righttop></td></tr>" 
    + "<tr><td class=tip_left></td>" 
    + "<td id=_lxpfloattip_value bgcolor='#ffffda' style='color:navy;font-size:14px'>"
    + validstr
    + "</td>"
    + "<td class=tip_right></td></tr>" 
    + "<tr><td class=tip_leftbottom></td>" 
    + "<td class=tip_bottom></td>" 
    + "<td class=tip_rightbottom></td></tr>" 
    + "</table>"
    + "</div>"
	  ) ;
	  autoht() ;
	} else 
	{
		document.getElementById("_lxpfloattip_value").innerHTML = validstr ;
		floatttloadobj.style.left = objleft1 ;
		floatttloadobj.style.top = objtop1 ;
		floatttloadobj.style.display = "block" ;
		autoht() ;
  } ;
  //document.getElementById("_lxpfloattip_").scrollIntoView() ;
  $(obj1).click(function(){hidefloattooltip()}).keydown(function(){hidefloattooltip()}) ;
}

function showfloatmenu(obj1,text1,x1,y1)
{
	_showfloatmenu(obj1,text1,x1,y1) ;
};

function hidefloatmenu(time1)
{
	if ((time1==null) || (time1==undefined))
	  window.setTimeout("_hidefloatmenu()",200) ;
	else if (time1<=0) _hidefloatmenu() ;
	else window.setTimeout("_hidefloatmenu()",time1) ;  
		
}

function _hidefloatmenu()
{
	var obj102 = $("#_lxpsubmenu_") ; //.hide() ;//slideUp("fast") ;
	if (obj102.length>0) 
	{
		obj102.hide() ;
	} ;  
}

function _showfloatmenu(obj1,text1,x1,y1)
{
	if (_pobj2.sys_no_popupmenu) 
	{
		_pobj2.sys_no_popupmenu = false ;
		return false ;
  } ;
	validstr = isnull(text1,"") ;
	if (validstr.length<=6) return ;

  try {_submenu_father = $(obj1).parent()[0] ;} catch (e) {} finally { };
  
  var objleft1 = 0 ;
	var objtop1 = 0 ;
	
	var x11 = myparseInt(x1,0) ;
	var y11 = myparseInt(y1,0) ;
	
	var fobj1 = document.body ;
	if ((obj1) && (x11>0) && (y11>0))
	{
		objleft1 = x1 ;
		objtop1 = y1 ;
		fobj1 = obj1 ;
	} else
	{
	  if (obj1)
	  {
	    var position = jQuery.iUtil.getPosition(obj1);
		  var size = jQuery.iUtil.getSize(obj1);
		  objleft1 = position.x+3 ;
		  objtop1 = (position.y + size.hb - 6) ;
		} else 
		{
			objleft1 = x1 ;
		  objtop1 = y1 ;
		} ;  
	} ;	
	submenuttloadobj = document.getElementById("_lxpsubmenu_") ;
	if (!submenuttloadobj) 
	{
		$(fobj1).append(
	  "<div id=_lxpsubmenu_ " 
	  + " onclick='hidefloatmenu()' "
    + " style='"
    + "z-index:800000000;"
    + "position:absolute;"
    + "left:"+(objleft1)+"px;"
    + "top:"+(objtop1)+"px;"
    + "'>"
    + "<table cellSpacing=0 cellPadding=0 border=0>"
    + "<tr><td class=mnu_lefttop style='WIDTH:13PX;'></td>" 
    + "<td class=mnu_top></td>" 
    + "<td class=mnu_righttop></td></tr>" 
    + "<tr><td class=mnu_left style='WIDTH:13PX;'><IMG SRC=/IMAGES/SPACER.GIF WIDTH=13></td>" 
    + "<td id=_lxpsubmenu_value class=mnu_middle style='color:navy;font-size:14px;'>"
    + validstr
    + "</td>"
    + "<td class=mnu_right></td></tr>" 
    + "<tr><td class=mnu_leftbottom></td>" 
    + "<td class=mnu_bottom></td>" 
    + "<td class=mnu_rightbottom></td></tr>" 
    + "</table>"
    + "</div>"
	  ) ;
	  autoht() ;
	} else 
	{
		document.getElementById("_lxpsubmenu_value").innerHTML = validstr ;
		submenuttloadobj.style.left = objleft1 ;
		submenuttloadobj.style.top = objtop1 ;
		submenuttloadobj.style.display = "block" ;
		autoht() ;
  } ;
  $(obj1).click(function(){hidefloatmenu()}).keydown(function(){hidefloatmenu()}) ;
}

jQuery.iAuto = {
	format : "" ,
	validfunc : "" ,
	multi : false ,
	helper : null,
	pick : false ,
	content : null,
	iframe: null,
	timer : null,
	lastValue: null,
	currentValue: null,
	subject: null,
	selectedItem : null,
	items: null,
	noautofixed : false ,
	reccount : 50 ,
	fixedsrc : "" ,
	
	empty : function()
	{
		jQuery.iAuto.content.empty();
		if (jQuery.iAuto.iframe) {
			jQuery.iAuto.iframe.hide();
		}
	},

	clear : function()
	{
		$(jQuery.iAuto.subject).removeClass("dropdown") ;
		jQuery.iAuto.items = null;
		jQuery.iAuto.selectedItem = null;
		try {jQuery.iAuto.lastValue = jQuery.iAuto.subject.value;} catch (e) {} finally {} ;
		if(jQuery.iAuto.helper.css('display') == 'block') {
			jQuery.iAuto.helper.hide();
			jQuery.iAuto.iframe.hide();
			if (jQuery.iAuto.subject.autoCFG.onHide)
				jQuery.iAuto.subject.autoCFG.onHide.apply(jQuery.iAuto.subject, [jQuery.iAuto.helper, jQuery.iAuto.iframe]);
		} else {
			jQuery.iAuto.empty();
		}
		window.clearTimeout(jQuery.iAuto.timer);
	},

getFieldValues : function(field)
	{
		var fieldData = {
			value: field.value,
			pre: '',
			post: '',
			item: '',
			yes: ''
		};
		
		if(field.autoCFG.multiple) {
			currvalue1 = field.value ;
			msp1 = field.autoCFG.multipleSeparator ;
			if (msp1=="") msp1 = "," ;
			mspi1 = currvalue1.lastIndexOf(msp1) ;
			if (mspi1<0) 
			{
				cleft1 = "" ;
				cright1 = "" ;
				citm1 = currvalue1.trim() ;
		  } else
			{
				cleft1 = currvalue1.substr(0,mspi1+1);
				cright1 = "" ;
				citm1 = currvalue1.substr(mspi1+1).trim() ;
			};
			
			fieldData.pre = cleft1 ;
			fieldData.post = cright1 ;
			fieldData.item = citm1 ;
			//alert("c="+selectionStart+",pre="+cleft1+" , item="+citm1+",post="+cright1+",sp=|"+msp1+"|") ;
		} else {
			fieldData.item = fieldData.value;
		}
		return fieldData;
	},
	update : function ()
	{
		var subject = jQuery.iAuto.subject;
	
		var subjectValue = jQuery.iAuto.getFieldValues(subject);
		//var selectionStart = jQuery.iAuto.getSelectionStart(subject);

		if ((subject) && (subjectValue.item.length >= subject.autoCFG.minchars)) {

			jQuery.iAuto.lastValue = subjectValue.item;
			jQuery.iAuto.currentValue = subjectValue.item;
      //alert(subjectValue.item) ;
      
      mysoure = tostr(isnull(jQuery(subject).attr("source"),"")) ;
      
      var troj1 = jQuery(subject).parents("tr:first") ;
      var prdid11 = 0 ;
      if (troj1.length>0) 
      {
      	var tdoj1 = jQuery("td[prdid]",troj1) ;
      	if (tdoj1.length>0) prdid11 = tdoj1.attr("prdid") ;
      } ;
      try {mysoure = mysoure.replace("{prdid}",prdid) ;} catch (e) {} finally { };
      try {mysoure = mysoure.replace("<prdid>",prdid) ;} catch (e) {} finally { };
      
      try {mysoure = mysoure.replace("{ccid}",ccid) ;} catch (e) {} finally { };
		  mysoure = mysoure.replace("{ccid}","0") ;
		  try {mysoure = mysoure.replace("<ccid>",ccid) ;} catch (e) {} finally { };
		  mysoure = mysoure.replace("<ccid>","0") ;
		  
		  mysoure = mysoure.trim() ;

 
			if ((mysoure.substr(mysoure.length-1,1)==")") && (mysoure.substr(0,1)!='$'))  // 是函
			{
				try
			  {
			     eval("mysoure="+mysoure) ;
			  }  catch (e) {} finally {};
			}  ;
			
			if (mysoure.substr(0,1)=='$') 
			{

				mysoure = mysoure.substr(2,mysoure.length-3) ;
				if (mysoure.substr(0,1)=="'") mysoure = mysoure.substr(1,mysoure.length-2) ;
				if (mysoure.substr(0,1)=='"') mysoure = mysoure.substr(1,mysoure.length-2) ;
				var $obj01 = $(mysoure) ;
				if ($obj01.length>0) 
				{
					var vals12 = [] ;
					$obj01.each(
					function()
					{
					  vals12.push($get(this)) ;
					}) ;
					if (vals12.length==1) mysoure = vals12[0]+"|" ;
					else mysoure = vals12.join("|") ;
				} else mysoure = "" ;
			} ;
			
			ispick = isnull(jQuery(subject).attr("pick"), "") ;
			if (ispick!="") 
			{
				mysoure = "" ;
				jQuery.iAuto.pick =true ;
			} else
			{
				jQuery.iAuto.pick = false ;
			} ;	
      
		  
		  var i = 0 ;
			var paramobj1 = mysoure ;
			
			while (paramobj1!="") 
			{
				i = paramobj1.indexOf("<") ;
				if (i>=0) 
				{
					paramobj1 = paramobj1.substr(i+1) ;
					i = paramobj1.indexOf(">") ;
					if (i>=0) 
					{
						mysoure = mysoure.replace("<"+paramobj1.substr(0,i)+">",tohex($get(paramobj1.substr(0,i)))) ;
						paramobj1 = paramobj1.substr(i+1) ;
					} else paramobj1 = "" ;
				} else paramobj1 = "" ;
			} ;
		  
		  jQuery.iAuto.fixedsrc = mysoure ;
		  jQuery.iAuto.noautofixed = false ;
		  
			if ((mysoure==undefined) || (mysoure==null) || (mysoure=="")) 
			  mysoure = subject.autoCFG.source ;
			
			if ((mysoure==undefined) || (mysoure==null) || (mysoure==""))   mysoure="" ;
			
			if (mysoure=="") return  false ;
			
			if (mysoure.indexOf("|")>0) // source="fkjds|fldsfd|fklsfkds|fkldskfd|fdsklfd" ;
			{
				var toWrite = '';
				toWrite += "<table cellSpacing=0 cellPadding=3  border=0>" ;
				var ci1 = 0 ;
				var nri = -1 ;
				var ss11 = "" ;
				var ss22 = "" ;
				var valueToAdd = "" ;
				while (mysoure!="") 
				{
					ci1 = mysoure.indexOf("|") ;
					if (ci1>=0) 
					{
						ss11 = mysoure.substr(0,ci1) ;
						mysoure = mysoure.substr(ci1+1) ;
					} else 
					{
						ss11 = mysoure ;
						mysoure = "" ;
					} ;
					ss11 = ss11.trim() ;
					if (ss11!="") 
					{
						ci1 = ss11.indexOf("=") ;
						if (ci1>0) 
						{
							ss22 = ss11.substr(ci1+1) ;
							ss11 = ss11.substr(0,ci1) ;
						} else
						{
							ss22 = ss11 ;
						} ;
						nri ++ ;
						if (nri==0) valueToAdd = ss22 ;
						toWrite += "<tr dir="+nri+" rel='"+ss22+"'><td nowrap style='border-left:1px solid #eeeeee'>"+ss11+"</td></tr>" ;
					} ;
				} ;
				toWrite += "</table>" ;
				if (subject.autoCFG.autofill) 
				{
					jQuery.iAuto.selection(
							subject, 
							subjectValue.item.length != valueToAdd.length ? (subjectValue.pre.length + subjectValue.item.length) : valueToAdd.length,
							subjectValue.item.length != valueToAdd.length ? (subjectValue.pre.length + valueToAdd.length) : valueToAdd.length
					);
				} ;
				jQuery.iAuto.writeItems(subject, toWrite , "",false);
				return false ;
			} ;
			if ((mysoure.indexOf("&key=")>=0) && (mysoure.indexOf("|")<0))
			  mysoure = mysoure.replace('&key=' , '&key='+tohex(subjectValue.item)) ;
			
			var cacheident = mysoure ;
			
	 		if (mysoure.toLowerCase().indexOf(".asp")<0) 
			{
	  		mysoure = "/sys/aspx/execsql.aspx?sqlname="+mysoure ;
	  		mysoure = mysoure +"&xml=1&id03_="+ident() ;  
   		} else 
   		{
     		if (mysoure.indexOf('?') > 0) mysoure = mysoure + '&xml=1&noidd=' + ident() ;
     		else mysoure = mysoure + '?xml=1&noidd=' + ident() ;
   		} ; 
   		
   		reccount1 = jQuery(subject).attr('dropdowncount') ;
   		if ((reccount1==undefined) || (reccount1==null) || (reccount1=="")) reccount1 = "50" ;
   		jQuery.iAuto.reccount = reccount1 ;
   		reccount1 = (parseInt(reccount1)+1) ;
   		mysoure = mysoure + '&reccount=' + reccount1 ;
   		reccount1 = (parseInt(reccount1)-1) ;
   		
   		var cachei1 = _pobj2.dropdowncache.indexOf(cacheident) ;
      if (cachei1>=0) 
      {
      	jQuery.iAuto.writeItems(subject, _pobj2.dropdowncache[cachei1+1] , cacheident ,true);
		    return  false ;
      } ;
   		
   	//	debug(mysoure) ;
   		
			$.ajax(
				{
					type: 'GET',
					dataType : 'xml' , 
					success: function(xml)
					{
						subject.autoCFG.lastSuggestion = jQuery('ds1',xml);
						size = subject.autoCFG.lastSuggestion.size();
						if (size > 0) {
							var toWrite = '';
							var childi = 0 ;
							toWrite += "<table cellSpacing=0 cellPadding=3  border=0>" ;
							subject.autoCFG.lastSuggestion.each(
							  function(nr)
							  {
							  	if (nr>=reccount1)
							  	{
							  		if (nr==reccount1)
							  		  toWrite += "<tr dir="+nr+" rel=''><td nowrap>&nbsp;</td><td nowrap colspan=100 class=fontfaint>更多项已省略...</td></tr>"  ;
							  	} else 
							  	{
							  	  childi = 0 ;
							  	  toWrite += "<tr dir="+nr+"" ;
							  	  $(this).children().each(function()
							  	  {
							  		  childi ++ ;
							  		  text001 = isnull(this.text,"") ;
							  		  if (childi>1) 
							  	  	{
							  			  toWrite += "<td nowrap name=\""+this.nodeName+"\" value=\""+tohex(text001)+"\" style=\"border-left:1px solid #eeeeee\">"+isnull(text001,"&nbsp;")+"</td>"  ;
							  		  }	else toWrite += " rel=\""+tohex(text001)+"\"><td name=\""+this.nodeName+"\" value=\""+tohex(text001)+"\" nowrap>"+(nr+1)+"</td>" ;
							  	  }) ;
							  	  toWrite += "</tr>" ;
							  	} ;  
							  }
							);
							toWrite += "</table>" ;
							
							if (subject.autoCFG.autofill) {
								
								var valueToAdd = $(subject.autoCFG.lastSuggestion.eq(0)).children().eq(1).text();
								//subject.value = subjectValue.pre + valueToAdd + subject.autoCFG.multipleSeparator + subjectValue.post;
								jQuery.iAuto.selection(
									subject, 
									subjectValue.item.length != valueToAdd.length ? (subjectValue.pre.length + subjectValue.item.length) : valueToAdd.length,
									subjectValue.item.length != valueToAdd.length ? (subjectValue.pre.length + valueToAdd.length) : valueToAdd.length
								);
							}
							
							if (size > 0) {
								jQuery.iAuto.writeItems(subject, toWrite , cacheident,false);
							} else {
								jQuery.iAuto.clear();
							}
						} else {
							jQuery.iAuto.clear();
						}
					},
					url : mysoure 
				}
			);
		} 
	},
	
	writeItems : function(subject, toWrite, cachekeyname ,cacheed)
	{
		jQuery.iAuto.content.html(toWrite);
		jQuery.iAuto.items = jQuery('tr', jQuery.iAuto.content.get(0));
		jQuery.iAuto.items
			.mouseover(jQuery.iAuto.hoverItem)
		  .bind('click', jQuery.iAuto.clickItem);
		var position = jQuery.iUtil.getPosition(subject);
		var size = jQuery.iUtil.getSize(subject);
		jQuery.iAuto.helper
			.css('top', position.y + size.hb + 'px')
			.css('left', position.x +  'px')
			.css('overflow-x','hidden')
			.css('overflow-y','auto')
			.addClass(subject.autoCFG.helperClass);
		if (jQuery.iAuto.iframe) {
			jQuery.iAuto.iframe
				.css('display', 'none')
				.css('top', position.y + size.hb + 'px')
				.css('left', position.x +  'px')
				.css('width', jQuery.iAuto.helper.css('width'))
				.css('height', jQuery.iAuto.helper.css('height'));
		}
		jQuery.iAuto.selectedItem = 0;
		if (jQuery.iAuto.items.length>0) 
		  jQuery.iAuto.items.get(0).className = subject.autoCFG.selectClass;
		
		if (jQuery.iAuto.helper.css('display') == 'none') {

				var borders = jQuery.iUtil.getPadding(subject, true);
				var paddings = jQuery.iUtil.getBorder(subject, true);
				helpwidth = subject.offsetWidth - (jQuery.boxModel ? (borders.l + borders.r + paddings.l + paddings.r) : 0 ) ;
				if (helpwidth<subject.offsetWidth) helpwidth = subject.offsetWidth ;
				else helpwidth = subject.offsetWidth + 26;
				//jQuery.iAuto.helper.css('width', helpwidth + 'px');
				
			if (jQuery.iAuto.items.length>10) jQuery.iAuto.helper.css("height","200px") ;
			else jQuery.iAuto.helper.css("height","") ;
			jQuery.iAuto.helper.show();
			autoht() ;
			if (jQuery.iAuto.subject.autoCFG.onShow)
				jQuery.iAuto.subject.autoCFG.onShow.apply(jQuery.iAuto.subject, [jQuery.iAuto.helper, jQuery.iAuto.iframe]);
			
			if ((!cacheed) && (cachekeyname!="")) 
			{	
				var cachei0 = _pobj2.dropdowncache.indexOf(cachekeyname) ;
				if (cachei0<0) 
				{
					_pobj2.dropdowncache.push(cachekeyname) ;
					_pobj2.dropdowncache.push(jQuery.iAuto.helper.html()) ;
				} else
				{
					_pobj2.dropdowncache[cachei0+1] = jQuery.iAuto.helper.html() ;
				} ;
			};
		}	;
		$(subject).addClass("dropdown") ;
	},
	
	selection : function(field, start, end)
	{
		//return ;
		try
		{
		if (field.createTextRange) {
			var selRange = field.createTextRange();
			selRange.collapse(true);
			selRange.moveStart("character", start);
			selRange.moveEnd("character", - end + start);
			selRange.select();
		} else if (field.setSelectionRange) {
			field.setSelectionRange(start, end);
		} else {
			if (field.selectionStart) {
				field.selectionStart = start;
				field.selectionEnd = end;
			}
		}
		field.focus();
	} catch (e) {} finally { };
	},
	
	getSelectionStart : function(field)
	{
		if (field.selectionStart)
			return field.selectionStart;
		else if(field.createTextRange) {
			var selRange = document.selection.createRange();
			var selRange2 = selRange.duplicate();
			aint = 0 - selRange2.moveStart('character', -100000);
			if (aint>11) aint = aint - 11 ;
			return aint;
		}
	},
	
	dblclickauto:function(e)
	{
		 
		if (!jQuery.iAuto.items) 
		{
			var mysoure1 = tostr(isnull(jQuery(jQuery.iAuto.subject).attr("source"),"")) ;
			
			var troj1 = jQuery(jQuery.iAuto.subject).parents("tr:first") ;
      var prdid11 = 0 ;
      if (troj1.length>0) 
      {
      	var tdoj1 = jQuery("td[prdid]",troj1) ;
      	if (tdoj1.length>0) prdid11 = tdoj1.attr("prdid") ;
      } ;
      try {mysoure1 = mysoure1.replace("{prdid}",prdid) ;} catch (e) {} finally { };
      try {mysoure1 = mysoure1.replace("<prdid>",prdid) ;} catch (e) {} finally { };
      
			try {mysoure1 = mysoure1.replaceAll("{ccid}",ccid) ;} catch (e) {} finally { };
		  mysoure1 = mysoure1.replaceAll("{ccid}","0") ;
		  try {mysoure1 = mysoure1.replaceAll("<ccid>",ccid) ;} catch (e) {} finally { };
		  mysoure1 = mysoure1.replaceAll("<ccid>","0") ;
		  
		  mysoure1 = mysoure1.trim() ;
		  
		  if ((mysoure1.substr(mysoure1.length-1,1)==")") && (mysoure1.substr(0,1)!='$'))  // 是函
			{
				try
			  {
			     eval("mysoure1="+mysoure1) ;
			  }  catch (e) {} finally {};
			}  ;
			

			var ispick = isnull(jQuery(jQuery.iAuto.subject).attr("pick"), "") ;  
			if (ispick!="") 
			{
			  var onvalid1 = isnull($(jQuery.iAuto.subject).attr("onvalid"),"").trim() ;
			  if (onvalid1!="") 
			  {
			  	try { _pobj2._autocompletedblclick = true ;}  catch (e) {} finally {};
			  	try
			  	{
			  		onvalid1 = onvalid1.replace("(this","(jQuery.iAuto.subject") ;
			  		eval(onvalid1) ;
			  	} catch(E){
			  	} finally {} ;
			  	try { _pobj2._autocompletedblclick = false ;}  catch (e) {} finally {};
			  } ;
			  return false ;
			} else 
			{
				jQuery.iAuto.timer = window.setTimeout(jQuery.iAuto.update,10) ;	
			  return false ;
		  } ;  
		} ;
		
	},
	clickauto:function(e)
	{
		jQuery.iAuto.noautofixed = false ;
		if (needautoclick) 
		{
			jQuery.iAuto.dblclickauto(e) ;
		} ;
	},
	assignfields:function($trobj1)
	{
		var subject = jQuery.iAuto.subject;
		if (!(subject)) return  false ;
		if ((!$trobj1) || ($trobj1.length<=0)) return  false ;
		var tdv1 = [] ;
		var i12 = 0 ; 
		$("td[name]",$trobj1).each(
		function()
		{
			tdv1.push($(this).attr("name")) ;
			tdv1.push(tostr($(this).attr("value"))) ;
		}) ;
		if (subject.id=="my_cell_edit") // istdcell
		{
			var tdobj12 = null ;
			var trobj12 = $("#ord2id_"+$(subject).attr("ord2id")) ;
		  if (trobj12.length<=0) trobj12 = $(subject).parents("tr:first") ;
		  if (trobj12.length>0)
			for (i12 = 0 ; i12 < tdv1.length ; i12 +=2)
		  {
			  tdobj12 = $("td[comefrom="+tdv1[i12]+"],td[name="+tdv1[i12]+"]",trobj12) ;
			  if (tdobj12.length>0) 
			    tdobj12.html(isnull(tdv1[i12+1],"&nbsp;"))
			    .attr("value",tohex(isnull(tdv1[i12+1],""))).addClass("tbupdatedtr").attr("ident",ident()) ;
			} ;
		} else 
		{
			for (i12 = 0 ; i12 < tdv1.length ; i12 +=2)
			{
				$value2($("#"+tdv1[i12]+",*[comefrom="+tdv1[i12]+"]"), tdv1[i12+1],"0");
			} ;  
		} ;
	},
	changeauto : function(e)
	{
		var subject = jQuery.iAuto.subject;
		if (!(subject)) return  false ;
		if (!(subject.value)) return  false ;
		
		detailssrc = tostr(isnull($(subject).attr("detailssource"),"").trim()) ;
		autosrc = tostr(isnull($(subject).attr("source"),"").trim()) ;
		
		var troj1 = jQuery(subject).parents("tr:first") ;
    var prdid11 = 0 ;
    if (troj1.length>0) 
    {
    	var tdoj1 = jQuery("td[prdid]",troj1) ;
    	if (tdoj1.length>0) prdid11 = tdoj1.attr("prdid") ;
    } ;
    try {autosrc = autosrc.replace("{prdid}",prdid) ;} catch (e) {} finally { };
    try {autosrc = autosrc.replace("<prdid>",prdid) ;} catch (e) {} finally { };
      
		try {autosrc = autosrc.replaceAll("{ccid}",ccid) ;} catch (e) {} finally { };
		autosrc = autosrc.replaceAll("{ccid}","0") ;
		try {autosrc = autosrc.replaceAll("<ccid>",ccid) ;} catch (e) {} finally { };
		autosrc = autosrc.replaceAll("<ccid>","0") ;
		
		autosrc = autosrc.trim() ;
			
		if ((autosrc.substr(autosrc.length-1,1)==")") && (autosrc.substr(0,1)!='$'))  // 是函
		{
				try
			  {
			     eval("autosrc="+autosrc) ;
			  }  catch (e) {} finally {};
		}  ;
			
		ispick = isnull($(subject).attr("pick"), "") ;
		if (ispick!="") 
		{
			autosrc = "" ;
			if (subject.id=="my_cell_edit") return  ;
		} ;
		
		
		var i = 0 ;
		var paramobj1 = autosrc ;
		
		while (paramobj1!="") 
		{
			i = paramobj1.indexOf("<") ;
			if (i>=0) 
			{
				paramobj1 = paramobj1.substr(i+1) ;
				i = paramobj1.indexOf(">") ;
				if (i>=0) 
				{
					autosrc = autosrc.replace("<"+paramobj1.substr(0,i)+">",tohex($get(paramobj1.substr(0,i)))) ;
					paramobj1 = paramobj1.substr(i+1) ;
				} else paramobj1 = "" ;
			} else paramobj1 = "" ;
		} ;
	   
		detailsid = isnull($(subject).attr("details"),"").trim() ;
		onvalid = isnull($(subject).attr("onvalid"),"").trim() ;
		invalid = isnull($(subject).attr("invalid"),"").trim() ;
		subvalue = subject.value.trim() ; 
		
		if (autosrc.indexOf("&key=")>=0) 
		  autosrc = autosrc.replace("&key=","&key="+tohex(subvalue)) ;
		  
		cachekeyname = autosrc ;
		
		$(subject).attr("validresult","0");
		if (detailsid!="")
		{
			
			if (detailssrc=="") detailssrc = autosrc ;
			if (detailssrc!="") 
			{
				if (subvalue=="") $("#"+detailsid+" *[name]").html("&nbsp;") ; else 
				{
					url111 = detailssrc ;
	        if (url111.toLowerCase().indexOf(".asp")<0) 
	        {
	          url111 = "/sys/aspx/execsql.aspx?reccount=2&sqlname="+url111+"&xml=1" ;
	          url111 = url111 +"&id03_="+ident() ;  
          } else 
          {	
            if (url111.indexOf('?') > 0) url111 = url111 + '&reccount=2&xml=1&noidd=' + ident() ;
            else url111 = url111 + '?xml=1&reccount=2&noidd=' + ident() ;
          } ;
   		    
   		    $("#"+detailsid+" *[name]").html("&nbsp;") ;
   		    
   		    if (cachekeyname!="")
   		    {
   		    	_cachev1_ = null ;
   		    	var cachei0 = _pobj2.dropdowncache.indexOf(cachekeyname+"_dataset") ;
   		    	if (cachei0>=0) _cachev1_ = _pobj2.dropdowncache[cachei0+1] ;
   			    
   			    if ((_cachev1_) && ($("NewDataSet ds1",_cachev1_).length==1)) 
   			    {
   			    	jQuery.iAuto.noautofixed = true ;
          	  $("NewDataSet ds1",_cachev1_).children().each(function()
          	  {
          		  fldvalue1 = isnull($(this).text(),"&nbsp;") ;
          		  $("#"+detailsid+" *[name="+this.nodeName+"]").html(fldvalue1) ;
          	  });
          	  return  false ;
          	} ;  
   		    };  
   		
          $.get(url111,function(xmldata)
          {
          	if ($("NewDataSet ds1",xmldata).length==1) 
          	{
          		jQuery.iAuto.noautofixed = true ;
            	$("NewDataSet ds1",xmldata).children().each(function()
          	  {
          		  fldvalue1 = isnull($(this).text(),"&nbsp;") ;
          		  $("#"+detailsid+" *[name="+this.nodeName+"]").html(fldvalue1) ;
          	  });
          	  if (cachekeyname!="") 
          	  {
          	  	var cachei0 = _pobj2.dropdowncache.indexOf(cachekeyname+"_dataset") ;
   		    	    if (cachei0<0) 
   		    	    {
   		    	    	_pobj2.dropdowncache.push(cachekeyname+"_dataset") ;
   		    	    	_pobj2.dropdowncache.push(xmldata) ;
	   		    	  } else 
	   		    	  {
	   		    	  	_pobj2.dropdowncache[cachei0+1] = xmldata  ;
	   		    	  } ;
          	  } ;	
          	} ;  
          }) ;
				}
			};
		} ;
		var mayfixed = true ;
		
		if (onvalid!="") 
		{
			valid001 = true;
			validfunc = "valid001="+onvalid ;
			if (!this) 
			{
	   	  try {eval(validfunc)}  catch (e)  { } finally {} ;
	   	  if (!valid001)
	   	  {
	   	  	 $(subject).attr("validresult","1") ;
	   	  	 if (invalid!="") 
	   	  	 {
	   	  		 	 try { subject.focus() ;}  catch (e)  { } finally {} ;
	   	  		 	 try { subject.style.backgroundColor = v15; }  catch (e)  { } finally {} ;
	   	  		 	 showfloattooltip(subject) ;
	   	  	 } ;
	   	  	 mayfixed = false ;
			  }  ;
			} ; 
		}  ;
		//alert(mayfixed+" = "+jQuery.iAuto.noautofixed+" = "+jQuery.iAuto.fixedsrc) ;
		if ((mayfixed) && (jQuery.iAuto.noautofixed==false) && (jQuery.iAuto.fixedsrc.length>10) && 
		 ($(subject).val().trim()!="") && 
		 (jQuery.iAuto.fixedsrc.indexOf("ccid=0")<0)) 
		{
			//debug("http://localhist/sys/aspx/execsql.aspx?sqlname="+
			// jQuery.iAuto.fixedsrc.replace("_autofixed","_autofixed_ins")+
			// "&extvalue="+tohex($(subject).val().trim())+"&reccount="+jQuery.iAuto.reccount) ;
			runsql(jQuery.iAuto.fixedsrc.replace("_autofixed","_autofixed_ins"),
			"extvalue="+tohex($(subject).val().trim())+"&reccount="+jQuery.iAuto.reccount) ;
		} ;
	},
	autocomplete : function(e)
	{
	
		var pressedKey = e.charCode || e.keyCode || -1;

		if (!jQuery.iAuto.items) 
		{
				if ((pressedKey==45) || (pressedKey==34) || (pressedKey==40)) 
				{
					if ((pressedKey==40))
					{
						var a1 = ""+jQuery.iAuto.subject.value ; a1 = a1.trim() ;
						
						if ((tohex(a1)=="~h`a000") || (a1=="") || (a1==selectedtext(jQuery.iAuto.subject)))
						{
							jQuery.iAuto.dblclickauto(e) ;
							//jQuery.iAuto.timer = window.setTimeout(jQuery.iAuto.update,10) ;	
					    return false ;
					  } ;
					} else 
					{
						jQuery.iAuto.dblclickauto(e) ;
					  //jQuery.iAuto.timer = window.setTimeout(jQuery.iAuto.update,10) ;	
					  return false ;
					} ;  
				} ;	
		} ;
		
		var subject = jQuery.iAuto.getFieldValues(this);
	  
	  jQuery.iAuto.noautofixed = false ;
	  
		if (/13|27|35|36|38|40|9|8|37|39|45|46|33|34/.test(pressedKey) && jQuery.iAuto.items) {
			if (window.event) {
				window.event.cancelBubble = true;
				window.event.returnValue = false;
			} else {
				e.preventDefault();
				e.stopPropagation();
			}
			if (jQuery.iAuto.selectedItem != null) 
				jQuery.iAuto.items.get(jQuery.iAuto.selectedItem||0).className = '';
			else
				jQuery.iAuto.selectedItem = -1;
			if ((pressedKey==8) || (pressedKey==37) || (pressedKey==39) || (pressedKey==46)) pressedKey = 27 ;	
		
			switch(pressedKey) {
				//enter
				case 9:
				case 13:
					if (jQuery.iAuto.selectedItem == -1)
						jQuery.iAuto.selectedItem = 0;
					var selectedItem = jQuery.iAuto.items.get(jQuery.iAuto.selectedItem||0);
					var valueToAdd = tostr(selectedItem.getAttribute('rel'));
					var trobj1 = $(selectedItem)  ;
					
					$(this).attr("modified","0") ;
					this.value = subject.pre + valueToAdd ;//+ this.autoCFG.multipleSeparator + subject.post;
					
					jQuery.iAuto.lastValue = subject.item;
					jQuery.iAuto.selection(
						this, 
						subject.pre.length + valueToAdd.length + this.autoCFG.multipleSeparator.length, 
						subject.pre.length + valueToAdd.length + this.autoCFG.multipleSeparator.length
					);
					jQuery.iAuto.assignfields(trobj1) ;
					
					jQuery.iAuto.clear();
					//if (this.scrollIntoView)
					//	this.scrollIntoView(false);
					jQuery.iAuto.noautofixed = true ;
					jQuery.iAuto.changeauto(this) ;	
					
					$(jQuery.iAuto.subject).change() ;
					return pressedKey != 13;
					break;
				//escape
				case 27:
				  $(this).attr("modified","0") ;
					this.value = subject.pre + jQuery.iAuto.lastValue ;//+ this.autoCFG.multipleSeparator + subject.post;
					this.autoCFG.lastSuggestion = null;
					jQuery.iAuto.clear();
					jQuery.iAuto.noautofixed = true ;
					//if (this.scrollIntoView)
					//	this.scrollIntoView(false);
					
					return false;
					break;
				case 33: // page up
					jQuery.iAuto.selectedItem = jQuery.iAuto.selectedItem - 10;
					if (jQuery.iAuto.selectedItem<=0) jQuery.iAuto.selectedItem = 0 ;
					
					break;
				//page down
				case 34:
					jQuery.iAuto.selectedItem = jQuery.iAuto.selectedItem + 10;
					if (jQuery.iAuto.selectedItem>=jQuery.iAuto.items.size()) 
					jQuery.iAuto.selectedItem = jQuery.iAuto.items.size() - 1;
					
					break;
				//up	
				//end
				case 35:
					jQuery.iAuto.selectedItem = jQuery.iAuto.items.size() - 1;
					
					break;
				//home
				case 36:
					jQuery.iAuto.selectedItem = 0;
					
					break;
				//up
				case 38:
					jQuery.iAuto.selectedItem --;
					if (jQuery.iAuto.selectedItem < 0)
						jQuery.iAuto.selectedItem = jQuery.iAuto.items.size() - 1;
						
					break;
				case 40:
					jQuery.iAuto.selectedItem ++;
					if (jQuery.iAuto.selectedItem == jQuery.iAuto.items.size())
						jQuery.iAuto.selectedItem = 0;
						
					break;
			}
			jQuery.iAuto.items.get(jQuery.iAuto.selectedItem||0).className = this.autoCFG.selectClass;
			if (jQuery.iAuto.items.get(jQuery.iAuto.selectedItem||0).scrollIntoView)
				jQuery.iAuto.items.get(jQuery.iAuto.selectedItem||0).scrollIntoView(false);
			if(this.autoCFG.autofill) {
				var valToAdd = tostr(jQuery.iAuto.items.get(jQuery.iAuto.selectedItem||0).getAttribute('rel'));
				//this.value = subject.pre + valToAdd + this.autoCFG.multipleSeparator + subject.post;
				if(jQuery.iAuto.lastValue.length != valToAdd.length)
					jQuery.iAuto.selection(
						this, 
						subject.pre.length + jQuery.iAuto.lastValue.length, 
						subject.pre.length + valToAdd.length
					);
			}
			return false;
		}
		return true;
	},

	
	hoverItem : function(e)
	{
		if (jQuery.iAuto.items) {
			if (jQuery.iAuto.selectedItem != null) 
				jQuery.iAuto.items.get(jQuery.iAuto.selectedItem||0).className = '';
			jQuery.iAuto.items.get(jQuery.iAuto.selectedItem||0).className = '';
			jQuery.iAuto.selectedItem = parseInt(this.getAttribute('dir'))||0;
			jQuery.iAuto.items.get(jQuery.iAuto.selectedItem||0).className = jQuery.iAuto.subject.autoCFG.selectClass;
		}
	},
  clearonblurtimer:function(event)
  {
  	window.clearTimeout(jQuery.iAuto.timer) ;
  },
  restoreonblurtimer:function(event)
  {
  	jQuery.iAuto.timer = window.setTimeout(jQuery.iAuto.clear, 500);
  },
	clickItem : function(event)
	{	
		window.clearTimeout(jQuery.iAuto.timer);
		
		event = event || jQuery.event.fix( window.event );
		event.preventDefault();
		event.stopPropagation();
		var subject = jQuery.iAuto.getFieldValues(jQuery.iAuto.subject);
		var valueToAdd = tostr(this.getAttribute('rel'));
		$(jQuery.iAuto.subject).attr("modified","0") ;
		jQuery.iAuto.noautofixed = true ;
		if (jQuery.iAuto.multi) 
		{
			var str1 = jQuery.iAuto.subject.value ;
			var str1s = str1.split(",") ;
			var i012 = str1s.indexOf(valueToAdd) ;// str2.indexOf(","+valueToAdd+",") ;
			if (i012<0) 
			{
				str1s.push(valueToAdd) ;
			} else 
			{
				str1s.splice(i012,1) ;
			} ;
			for (i012=str1s.length-1;i012>=0;i012--) 
			if (str1s[i012]=="") str1s.splice(i012,1) ;
			jQuery.iAuto.subject.value = str1s.join(",");
			return false ;
		} ;
		jQuery.iAuto.subject.value = subject.pre + valueToAdd ;//+ jQuery.iAuto.subject.autoCFG.multipleSeparator + subject.post;
		
		jQuery.iAuto.assignfields($(this)) ;
    
		jQuery.iAuto.lastValue = tostr(this.getAttribute('rel'));
		jQuery.iAuto.selection(
			jQuery.iAuto.subject,jQuery.iAuto.subject.value.length,jQuery.iAuto.subject.value.length) ;
		jQuery.iAuto.clear();
			
		jQuery.iAuto.changeauto(jQuery.iAuto.subject) ;
		try
         {
            jQuery.iAuto.subject.focus() ;
         }
         catch (e)
         {
         }
         finally
         {
         }
         ;
    jQuery.iAuto.noautofixed = true ;     
		$(jQuery.iAuto.subject).change() ;	
			//if (jQuery.iAuto.subject.scrollIntoView)
			//			jQuery.iAuto.subject.scrollIntoView(false);
						
		return false;
	},
  
	protect : function(e)
	{
		defaultkeypress(e,jQuery.iAuto.format) ;
		pressedKey = e.charCode || e.keyCode || -1;
		if (/13|27|35|36|38|40/.test(pressedKey) && jQuery.iAuto.items) {
		  if (window.event) {
				  window.event.cancelBubble = true;
				  window.event.returnValue = false;
		  } else {
				  e.preventDefault();
				  e.stopPropagation();
		  }
			return false;
		}
	},

	build : function(options)
	{
		
		if (!jQuery.iAuto.helper) {
			if (jQuery.browser.msie) {
				jQuery('body', document).append('<iframe style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" id="autocompleteIframe" src="javascript:false;" frameborder="0" scrolling="no" ></iframe>');
				jQuery.iAuto.iframe = jQuery('#autocompleteIframe');
			}
			jQuery('body', document).append('<div id="autocompleteHelper" style="position: absolute; top: 0; left: 0; z-index: 99900019; display: none;overflow-y:auto;padding-right:20px;"><span>&nbsp;</span></div>');
			jQuery.iAuto.helper = jQuery('#autocompleteHelper');
			jQuery.iAuto.helper.mouseover(jQuery.iAuto.clearonblurtimer).mouseout(jQuery.iAuto.restoreonblurtimer)
			.mousemove(jQuery.iAuto.clearonblurtimer).scroll(jQuery.iAuto.clearonblurtimer) ;
			jQuery.iAuto.content = jQuery('span', jQuery.iAuto.helper);
		}
    //alert(jQuery('#autocompleteHelper')) ;
		return this.each(
			function()
			{
				if (!this) return  false ;
				if (this==undefined) return  false ;
				if (!(this.tagName)) return  false ;
				if (this.tagName != 'INPUT' && this.getAttribute('type') != 'text' && this.tagName!='TEXTAREA')
					return  false;
				this.autoCFG = {};
				this.autoCFG.source = options.source;
				this.autoCFG.minchars = Math.abs(parseInt(options.minchars)||0);
				this.autoCFG.helperClass = options.helperClass ? options.helperClass : '';
				this.autoCFG.selectClass = options.selectClass ? options.selectClass : '';
				this.autoCFG.onSelect = options.onSelect && options.onSelect.constructor == Function ? options.onSelect : null;
				this.autoCFG.onShow = options.onShow && options.onShow.constructor == Function ? options.onShow : null;
				this.autoCFG.onHide = options.onHide && options.onHide.constructor == Function ? options.onHide : null;
				this.autoCFG.onHighlight = options.onHighlight && options.onHighlight.constructor == Function ? options.onHighlight : null;
				this.autoCFG.inputWidth = options.inputWidth||false;
				this.autoCFG.multiple = options.multiple||false;
				this.autoCFG.multipleSeparator = this.autoCFG.multiple ? (options.multipleSeparator||','):'';
				this.autoCFG.autofill = true ;//options.autofill ? true : false;
				this.autoCFG.delay = 1000;
				this.autoCFG.lastSuggestion = null;
				this.autoCFG.inCache = false;
				jQuery(this)
					.attr('autocomplete', 'off')
					.focus(
						function()
						{
							jQuery.iAuto.subject = this;
							jQuery.iAuto.lastValue = this.value;
							jQuery.iAuto.format = isnull($(this).attr("format"),"") ;
							jQuery.iAuto.multi = isnull($(this).attr("multi"),"1")=="0" ;
						}
					)
					.keypress(jQuery.iAuto.protect)
					.keydown(jQuery.iAuto.autocomplete)
					.click(jQuery.iAuto.clickauto)
					.dblclick(jQuery.iAuto.dblclickauto)
					.change(jQuery.iAuto.changeauto)
					.blur(
						function()
						{
							jQuery.iAuto.timer = window.setTimeout(jQuery.iAuto.clear, 200);
						}
					);
			}
		);
	}
};

jQuery.iUtil = {
	getPosition : function(e)
	{
		var x = 0;
		var y = 0;
		var es = e.style;
		var restoreStyles = false;
		if (jQuery(e).css('display') == 'none') {
			var oldVisibility = es.visibility;
			var oldPosition = es.position;
			restoreStyles = true;
			es.visibility = 'hidden';
			es.display = 'block';
			es.position = 'absolute';
		}
		var el = e;
		while (el){
			x += el.offsetLeft + (el.currentStyle && !jQuery.browser.opera ?parseInt(el.currentStyle.borderLeftWidth)||0:0);
			y += el.offsetTop + (el.currentStyle && !jQuery.browser.opera ?parseInt(el.currentStyle.borderTopWidth)||0:0);
			el = el.offsetParent;
		}
		el = e;
		while (el && el.tagName  && el.tagName.toLowerCase() != 'body')
		{
			x -= el.scrollLeft||0;
			y -= el.scrollTop||0;
			el = el.parentNode;
		}
		if (restoreStyles == true) {
			es.display = 'none';
			es.position = oldPosition;
			es.visibility = oldVisibility;
		}
		return {x:x, y:y};
	},
	getPositionLite : function(el)
	{
		var x = 0, y = 0;
		while(el) {
			x += el.offsetLeft || 0;
			y += el.offsetTop || 0;
			el = el.offsetParent;
		}
		return {x:x, y:y};
	},
	getSize : function(e)
	{
		var w = jQuery.css(e,'width');
		var h = jQuery.css(e,'height');
		var wb = 0;
		var hb = 0;
		var es = e.style;
		if (jQuery(e).css('display') != 'none') {
			wb = e.offsetWidth;
			hb = e.offsetHeight;
		} else {
			var oldVisibility = es.visibility;
			var oldPosition = es.position;
			es.visibility = 'hidden';
			es.display = 'block';
			es.position = 'absolute';
			wb = e.offsetWidth;
			hb = e.offsetHeight;
			es.display = 'none';
			es.position = oldPosition;
			es.visibility = oldVisibility;
		}
		return {w:w, h:h, wb:wb, hb:hb};
	},
	getSizeLite : function(el)
	{
		return {
			wb:el.offsetWidth||0,
			hb:el.offsetHeight||0
		};
	},
	getClient : function(e)
	{
		var h, w, de;
		if (e) {
			w = e.clientWidth;
			h = e.clientHeight;
		} else {
			de = document.documentElement;
			w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
			h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
		}
		return {w:w,h:h};
	},
	getScroll : function (e)
	{
		var t=0, l=0, w=0, h=0, iw=0, ih=0;
		if (e && e.nodeName.toLowerCase() != 'body') {
			t = e.scrollTop;
			l = e.scrollLeft;
			w = e.scrollWidth;
			h = e.scrollHeight;
			iw = 0;
			ih = 0;
		} else  {
			if (document.documentElement) {
				t = document.documentElement.scrollTop;
				l = document.documentElement.scrollLeft;
				w = document.documentElement.scrollWidth;
				h = document.documentElement.scrollHeight;
			} else if (document.body) {
				t = document.body.scrollTop;
				l = document.body.scrollLeft;
				w = document.body.scrollWidth;
				h = document.body.scrollHeight;
			}
			iw = self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0;
			ih = self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0;
		}
		return { t: t, l: l, w: w, h: h, iw: iw, ih: ih };
	},
	getMargins : function(e, toInteger)
	{
		var el = jQuery(e);
		var t = el.css('marginTop') || '';
		var r = el.css('marginRight') || '';
		var b = el.css('marginBottom') || '';
		var l = el.css('marginLeft') || '';
		if (toInteger)
			return {
				t: parseInt(t)||0,
				r: parseInt(r)||0,
				b: parseInt(b)||0,
				l: parseInt(l)
			};
		else
			return {t: t, r: r,	b: b, l: l};
	},
	getPadding : function(e, toInteger)
	{
		var el = jQuery(e);
		var t = el.css('paddingTop') || '';
		var r = el.css('paddingRight') || '';
		var b = el.css('paddingBottom') || '';
		var l = el.css('paddingLeft') || '';
		if (toInteger)
			return {
				t: parseInt(t)||0,
				r: parseInt(r)||0,
				b: parseInt(b)||0,
				l: parseInt(l)
			};
		else
			return {t: t, r: r,	b: b, l: l};
	},
	getBorder : function(e, toInteger)
	{
		var el = jQuery(e);
		var t = el.css('borderTopWidth') || '';
		var r = el.css('borderRightWidth') || '';
		var b = el.css('borderBottomWidth') || '';
		var l = el.css('borderLeftWidth') || '';
		if (toInteger)
			return {
				t: parseInt(t)||0,
				r: parseInt(r)||0,
				b: parseInt(b)||0,
				l: parseInt(l)||0
			};
		else
			return {t: t, r: r,	b: b, l: l};
	},
	getPointer : function(event)
	{
		var x = event.pageX || (event.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft)) || 0;
		var y = event.pageY || (event.clientY + (document.documentElement.scrollTop || document.body.scrollTop)) || 0;
		return {x:x, y:y};
	},
	traverseDOM : function(nodeEl, func)
	{
		func(nodeEl);
		nodeEl = nodeEl.firstChild;
		while(nodeEl){
			jQuery.iUtil.traverseDOM(nodeEl, func);
			nodeEl = nodeEl.nextSibling;
		}
	},
	purgeEvents : function(nodeEl)
	{
		jQuery.iUtil.traverseDOM(
			nodeEl,
			function(el)
			{
				for(var attr in el){
					if(typeof el[attr] === 'function') {
						el[attr] = null;
					}
				}
			}
		);
	},
	centerEl : function(el, axis)
	{
		var clientScroll = jQuery.iUtil.getScroll();
		var windowSize = jQuery.iUtil.getSize(el);
		if (!axis || axis == 'vertically')
			jQuery(el).css(
				{
					top: clientScroll.t + ((Math.max(clientScroll.h,clientScroll.ih) - clientScroll.t - windowSize.hb)/2) + 'px'
				}
			);
		if (!axis || axis == 'horizontally')
			jQuery(el).css(
				{
					left:	clientScroll.l + ((Math.max(clientScroll.w,clientScroll.iw) - clientScroll.l - windowSize.wb)/2) + 'px'
				}
			);
	},
	fixPNG : function (el, emptyGIF) {
		var images = jQuery('img[@src*="png"]', el||document), png;
		images.each( function() {
			png = this.src;				
			this.src = emptyGIF;
			this.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + png + "')";
		});
	}
};

// Helper function to support older browsers!
if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i ){ //判断Array的原型是否已作indexOf方法的扩展
  i || (i = 0); //初始化起步查询的下标，比较奇特的写法。
  var length = this.length;
  if (i < 0) i = length + i; // 如i为负数，则从数组末端开始。
  for (; i < length; i++)
    if (this[i] === item) return i;  // 使用全等于(===)判断符
  return -1;
};

if (!Array.prototype.indexOf2) Array.prototype.indexOf2 = function(item, i ,j){ //判断Array的原型是否已作indexOf方法的扩展
  i || (i = 0); //初始化起步查询的下标，比较奇特的写法。
  j || (j = 1); //初始化起步查询的下标，比较奇特的写法。
  var length = this.length;
  if (i < 0) i = length + i; // 如i为负数，则从数组末端开始。
  for (; i < length; i+=j)
    if (this[i] === item) return i;  // 使用全等于(===)判断符
  return -1;
};
 
jQuery.fn.Autocomplete = jQuery.iAuto.build;

// 自动完成　，autocode 
var old_cell_pos = 0 ;
function getcelleditpos()
{
  var o=document.getElementById("my_cell_edit")
  var s = document.selection.createRange();
  var   r   =o.createTextRange();  
  s.setEndPoint("StartToStart",r) ;
  return s.text.length ;
};
function cellkeydown()
{
	old_cell_pos = getcelleditpos() ;
} ;
function cellkeyup()
{
	var newlen1 = getcelleditpos() ;
	var keyv = self.window.event.keyCode ;
	if ((keyv==40) || (keyv==38) || (keyv==35)  || (keyv==36))
	{
		myedit1 = $("#my_cell_edit") ;
		if ((myedit1.length>0))
   	  {
   	  	if (myedit1.hasClass("dropdown")) return false ;
   	  	if (((keyv==40)) && ((myedit1.hasClass("sourcedbl")) || (myedit1.hasClass("sourcedbll")))) 
   	  	{
   	  		var a1 = ""+myedit1.val() ; a1 = a1.trim() ;
   	  		if ((a1=="") || (a1==selectedtext(myedit1[0]))) return false ;
   	  	} ;
   	  } ;	 
	} ;
	if ((newlen1==old_cell_pos) && ((keyv==37) || (keyv==39) || (keyv==40) || (keyv==38) || (keyv==36) || (keyv==35)))
	{
  	var edit1 = document.getElementById("my_cell_edit") ;
		var tdobj1 = $(edit1).parent()[0] ;
		window.setTimeout("finishedit("+keyv+")",10) ;
  } ;
} ;
function finishedit(keyv)
{
	var edit1 = document.getElementById("my_cell_edit") ;
	if (edit1==null) return  false ;
	$(edit1).attr("rawvalue",tohex($(edit1).val())) ;
	tdobj1 = $(edit1).parent()[0] ;
	editedacell(edit1) ;
	removelastfocus(self.window);
	tryfocustable();
	tablekeydowncell(keyv,tdobj1) ;
}
function tablekeydowncell(keyv,tdobj1)
{
   var myedit1 = null ;
   var pressedKey = keyv ;
   if (pressedKey == 40) // down
   {
   	  myedit1 = $("#my_cell_edit") ;
   	  if ((myedit1.length>0))
   	  {
   	  	if (myedit1.hasClass("dropdown")) return false ;
   	  	if ((myedit1.hasClass("sourcedbl")) || (myedit1.hasClass("sourcedbll"))) 
   	  	{
   	  		var a1 = ""+myedit1.val() ; a1 = a1.trim() ;
   	  		if ((a1=="") || (a1==selectedtext(myedit1[0]))) return false ;
   	  	} ;	
   	  } ;
      _edit_direction = 1 ;
      _edit_rowi ++ ;
      if (_edit_rowi > _edit_maxrow)
      {
            _edit_coli ++ ;
            _edit_rowi = _edit_row0 ;
            if (_edit_coli > _edit_maxcol)
            {
               _edit_coli = _edit_col0 ;
            };
      }
      ;
   }
   else
   if (pressedKey == 38) /// up
   {
   	  myedit1 = $("#my_cell_edit") ;if ((myedit1.length>0) && (myedit1.hasClass("dropdown"))) return false ;
      _edit_direction = 1 ;
      _edit_rowi -- ;
      if (_edit_rowi < _edit_row0)
      {
         _edit_rowi = _edit_maxrow ;
         _edit_coli -- ;
         if (_edit_coli < _edit_col0) _edit_coli = _edit_maxcol ;
      };
   }
   else
   if (pressedKey == 37) // left
   {
      _edit_direction = 0 ;
      _edit_coli -- ;
      if (_edit_coli < _edit_col0)
      {
         _edit_coli = _edit_maxcol ;
         _edit_rowi -- ;
         if (_edit_rowi < _edit_row0) _edit_rowi = _edit_maxrow ;
      } ;
   }
   else
   if ((pressedKey == 39)) // right
   {
      _edit_coli ++ ;
      if (_edit_coli > _edit_maxcol)
      {
         _edit_coli = _edit_col0 ;
         _edit_rowi ++ ;
         if (_edit_rowi > _edit_maxrow) _edit_rowi = _edit_row0 ;
      }
      ;
   }
   else
   if (pressedKey == 35) // end
   {
   	  myedit1 = $("#my_cell_edit") ;if ((myedit1.length>0) && (myedit1.hasClass("dropdown"))) return false ;
      _edit_coli = _edit_maxcol ;
   }
   else
   if (pressedKey == 36) // home
   {
   	  myedit1 = $("#my_cell_edit") ;if ((myedit1.length>0) && (myedit1.hasClass("dropdown"))) return false ;
      _edit_coli = _edit_col0 ;
   }
   ;
  focuseditcell();
};
function geticoncss(iconname1,defaultcss)
{
	var i = 0 ; 
	i = _pobj2._icons.indexOf(iconname1) ;
	if (i>=0) return isnull(_pobj2._icons[i-1],defaultcss) 
	else return defaultcss ;
} ;

function geticon(iconname1)
{
	var i = 0 ; 
	i = _pobj2._icons.indexOf(iconname1) ;
	if (i>=0) return "<span class="+_pobj2._icons[i-1]+" title=\""+iconname1+"\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>" ; 
	else return iconname1 ;
} ;

// 工作痕迹
function worklog(action1,actiontype1,reason1)
{
	runsql("ins_wrklog","action="+tohex(action1)+"&type="+tohex(actiontype1)+"&reason="+tohex(reason1)) ;
};
/*swf*/
var ie = (document.defaultCharset && document.getElementById && !window.home);
var opera9 = false;
if (ie){
	var ver=navigator.appVersion.split("MSIE")
	ver=parseFloat(ver[1])
	ie = (ver >=6)
}else if (navigator.userAgent.indexOf("Opera")!=-1) {
	var versionindex=navigator.userAgent.indexOf("Opera")+6
	if (parseInt(navigator.userAgent.charAt(versionindex))>=9)
	opera9 = true;
}
var oswap = (ie || opera9)

if (oswap){
	document.write ("<style id='hideObject'> object{display:none;} </style>");
}


objectSwap = function(){
	if (!document.getElementsByTagName){
		return  false;
	}
	var stripQueue = [];
	var objects = document.getElementsByTagName('object');
	for (var i=0; i<objects.length; i++){			
		var o = objects[i];	
		var h = o.outerHTML;
		if (o.id.toLowerCase()=='webbrowser1') continue ;
		var params = "";
		var hasFlash = true;
		for (var j = 0; j<o.childNodes.length; j++) {
			var p = o.childNodes[j];
			if (p.tagName == "PARAM"){
				if (p.name == "flashVersion"){
					hasFlash = detectFlash(p.value);
					if (!hasFlash){
						o.id = (o.id == "") ? ("stripFlash"+i) : o.id;
						stripQueue.push(o.id);
						break;
					}
				} 
				params += p.outerHTML;		       
			}
		}	
		if (!hasFlash){
			continue;
		}		
		if (!oswap){
			continue;
		} 
		if (o.className.toLowerCase().indexOf ("noswap") != -1){
			continue;
		}		
		var tag = h.split(">")[0] + ">";			
		var newObject = tag + params + o.innerHTML + " </OBJECT>";	
		o.outerHTML = newObject;
	}
	if (stripQueue.length) {
		stripFlash(stripQueue)
	}
	if (oswap){
		document.getElementById("hideObject").disabled = true;
	}
}

detectFlash = function(version){
	if(navigator.plugins && navigator.plugins.length){
		var plugin = navigator.plugins["Shockwave Flash"];
		if (plugin == undefined){
			return false;
		}
		var ver = navigator.plugins["Shockwave Flash"].description.split(" ")[2];
		return (Number(ver) >= Number(version))
	} else if (ie && typeof (ActiveXObject) == "function"){
		try{
			var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + version);
			return true;
		}
		catch(e){
			return false;
		}
	}
	return true;
}

stripFlash = function (stripQueue){
	if (!document.createElement){
		return  false;
	}
	for (var i=0; i<stripQueue.length; i++){
		var o = document.getElementById(stripQueue[i]);
		var newHTML = o.innerHTML;	
		newHTML = newHTML.replace(/<!--\s/g, "");
		newHTML = newHTML.replace(/\s-->/g, "");
		newHTML = newHTML.replace(/<embed/gi, "<span");		
		var d = document.createElement("div");
		d.innerHTML = newHTML;
		d.className = o.className;
		d.id = o.id;
	
		o.parentNode.replaceChild(d, o);
	}
} ;

jQuery.cookie = function(name, value, options) 
{ 
	if (typeof value != 'undefined')  // name and value given, set cookie 
	{
		options = options || {}; 
		if (value === null) 
		{ 
			value = ''; 
			options.expires = -1; 
		} ;
		var expires = ''; 
		if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) 
		{ 
			var date; 
			if (typeof options.expires == 'number') 
			{ 
				date = new Date(); 
				date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); 
			} else 
			{ 
				date = options.expires; 
			} ;
			expires = '; expires=' + date.toUTCString(); 
		} ;
		var path = options.path ? '; path=' + (options.path) : '/'; 
		
		var domain = options.domain ? '; domain=' + (options.domain) : ''; 
		var secure = options.secure ? '; secure' : ''; 
		document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); 
	} else 
	{ 
		var cookieValue = null; 
		if (document.cookie && document.cookie != '') 
		{ 
			var cookies = document.cookie.split(';'); 
			for (var i = 0; i < cookies.length; i++) 
			{ 
				var cookie = jQuery.trim(cookies[i]); 
				if (cookie.substring(0, name.length + 1) == (name + '=')) 
				{ 
					cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); 
					break; 
				} ;
			} ;
		} ;
		return cookieValue; 
	} ;	
} ;