
/**---------------------------------------------------------
 *	2008-07-31 整理
 *
 *	1.输入框选择提示组件
 *	2.输入框选择提示实例
 *	3.弹出框选择实例
 *----------------------------------------------------------*/

/*------------------------------------------------------------
 *	1.输入框选择提示组件	[Start]
 *-----------------------------------------------------------*/

// [1.1] 组件定义的一组全局变量
var _data=[];
var curInput=null;
var _compare;
var dataContianer;
var dataDiv;
var dataClassOver="autofinish_over";
var dataClassOut="autofinish";

var dataList=[];
var curTD;
var newTxt="";//当前关键字
var callback;

var _moveRight = false;//是否需要右移,当高度过大时会把输入框覆盖,移到输入框右边
var _maxWidth=350,_maxHeight=200,_minHeight=30;
var _maxLength=0;

// [1.2] 浏览器兼容
function contains(src,sub){
	do if(src == sub) return true;
	while(sub = sub.parentNode);
	return false;
}

// [1.3] 初始化组件
function initData(src,compare,data,cb){
	if(src!=curInput){
		newTxt="";
		curTD=null;
		src.onfocus=divOnFocus;
		src.onblur=divOnBlur;
		if (dataDiv!=null){
			dataDiv.innerHTML="";
			dataDiv=null;	
		}
		if(dataContianer!=null){
			dataContianer.innerHTML="";
			dataContianer=null;
		}
	}
	curInput = src;
	if(typeof data =='object')
		_data=data;
	if(typeof compare == 'object')
		_compare=compare;
	
	if(typeof cb == 'function')
		callback = cb;
}
	
// [1.4] 初始化显示区域
function initDataDiv(){
 	if(!$("divEmailAddressMain")){
		var div=document.createElement("div");
		div.id="divEmailAddressMain";
		div.style.position="absolute";
		div.style.display="";
		div.style.overflowY="hidden";
		//div.style.overflowY="scroll";
		
		document.body.appendChild(div);
	}
	dataDiv = $("divEmailAddressMain");
	dataDiv.style.left=0;
	dataDiv.style.top=0;
}

// [1.5] 取出按keyCode过滤出来的数据
function getDataList(src,keyCode){
	if (src==null)
		return null;
	
	var s=src.value;
	newTxt = s.replace(/(^\s*)|(\s*$)/g, "");
	if(keyCode==8) newTxt=s.substring(0,s.length-1);
	var arr=new Array();
	var re;
	arr=_data;//测试的
	return arr;
}

// [1.6] 显示过滤后的数据
function refreshDataDiv(src,keyCode){
	var oTb,oTr,oTd;
	dataList=getDataList(src,keyCode);
	_maxLength=0;
	if(dataList != null){
		initDataDiv();
		dataDiv.innerHTML="";
		oTb=createTable();
		dataDiv.appendChild(oTb);
		for (var i=0; i<dataList.length;i++ ){
			oTr=createRow(oTb);
			oTd=createColumn(oTr,i);
			
			var displayTxt = [];
			for(var j=0;j<_compare.length;j++){
				var porp = _compare[j];
				var temp = dataList[i][porp]+"";
				if(!temp&&temp.length>18)
					temp = temp.substring(0,18);
				temp = temp.replace(/\"/g,"");
				temp.replace(/&quot;/g,"");
				displayTxt[displayTxt.length]=dataList[i][porp];
			}
			
			if(_maxLength<displayTxt.toString().length)
				_maxLength = displayTxt.toString().length;
				
			oTd.innerHTML=displayTxt;
		}
		var e=src;
		if(!$("dvListContainer")){
			var tDiv=document.createElement("div");
			tDiv.id="dvListContainer";
			with(tDiv.style){
				position="absolute";
				zIndex="99";
				display="none";
				width=height="0px";
			}
			document.body.appendChild(tDiv);
		}
		
		dataContianer=$("dvListContainer");
		dataContianer.style.left=(getX(e) + 1) + "px";
		dataContianer.style.display="";
		if(_moveRight)
			dataContianer.style.left = (getX(e)+src.offsetWidth)+"px";
		
		dataContianer.appendChild(dataDiv);
		var height = oTb.offsetHeight+1;
		var width = _maxLength*10.5+35;
		if(width>_maxWidth) width = _maxWidth;				
		if(height>_maxHeight) height = _maxHeight;

		dataDiv.style.width=width + "px";
		dataDiv.style.height=height + "px";
		dataContianer.style.top=(getY(e)) + "px" ;
	}
}
	
// [1.7] 取当前选择的值,返回一个Object.具体写值由调用者写
function fillValue(){
	if (curTD==null||curInput==null){
		return;
	}
	if (dataList==null||dataList.length==0){
		return;
	}
	var i=parseInt(curTD.zIndex);
	setDivDisplay(false);
	curTD=null;
	callback(curInput,dataList[i]);
	if (dataDiv!=null){
		dataDiv.innerHTML="";
		dataDiv=null;	
	}
	if(dataContianer!=null){
		dataContianer.innerHTML="";
		dataContianer=null;
	}
}
	
// [1.8] 键盘向上键事件
function upKey(){
	if (curTD==null) return;
	var k=curTD.zIndex - 1;
	if (k==-1){	k+=1;}
	var oTd=$("tdACMA_"+k);
	curTD.className="";
	curTD=oTd;
	curTD.className=dataClassOver;
	setDivDisplay(true);
}

// [1.9] 键盘向下键事件
function downKey(){
	if (curTD==null) return;
	var k=curTD.zIndex + 1;
	if (k==dataList.length){k -=1;}
	var oTd=$("tdACMA_"+k);
	curTD.className="";
	curTD=oTd;
	curTD.className=dataClassOver;
	setDivDisplay(true);
}

// [1.10] 键盘ESC键事件
function escapeKey(){
	setDivDisplay(false);
}

// [1.11] 键盘Enter键事件
function enterKey(){
	fillValue();
	setDivDisplay(false);
}

// [1.12] 退格键
function backSpaceKey(src,keyCode){
	refreshDataDiv(src,keyCode);
	if (newTxt=="")
		setDivDisplay(false);
	else
		setDivDisplay(true);
}

// [1.13] 键盘按下时事件
function onKeyDown(src,e){
	var keyCode = e.keyCode;
	switch (keyCode){
		case 13:enterKey();break;
		case 27:escapeKey();break;
		case 38:upKey();break;
		case 40:downKey();break;
		break;
	}
}

// [1.14] 键盘按下后松开事件
function onKeyUp(src,keyCode){
	var sTemp=",13,27,38,40,9,116,";
	kc=","+keyCode + ",";
	if (sTemp.indexOf(kc)>-1){
		return false;
	}
	setDivDisplay(false);
	refreshDataDiv(src,keyCode);
}

// [1.15] 设置是否显示组件
function setDivDisplay(bVisit){
	if(!dataContianer) return;
	if (bVisit){
		curTD.scrollIntoView(false);
		dataContianer.style.display="";
	}
	else
		dataContianer.style.display="none";
}

// [1.16] 取组件的宽度
function getX(e){
	var l=e.offsetLeft;
	while(e=e.offsetParent){if(e.tagName == "body") break;l+=e.offsetLeft;}
	return l;
}

// [1.17] 取组件高度
function getY(e){
	var sc=0;//流动的高度
	var h=0;//容器的高度
	var t=e.offsetTop;//绝对高度
	var parent=0;//
	while(e=e.offsetParent){parent+=e.offsetTop;sc+=e.scrollTop;
		if(e.tagName == "body") break;
		h=e.offsetHeight;
		
	}
	var dh = dataDiv.offsetHeight;
	if(dh>_maxHeight) dh = _maxHeight;
	if(dh <_minHeight) dh=_minHeight;
	if(t<parent)
		t=t+parent;
	else
		t=t-parent;
	t =t-sc;
	//如果高度大于容器高度,则把top向上调整
	if(t+dh>h){
		t=h-dh;
		_moveRight = true;
	}
	else
		t+=18;
	return t;
}

// [1.18] 创建组件内容显示表格
function createTable(){
	var oTable=document.createElement("table");
	oTable.border=0;
	oTable.cellSpacing=2;
	oTable.cellPadding=2;
	oTable.className=dataClassOut;
	return oTable;
}

// [1.19] 创建组件内容显示行
function createRow(table){
	var rowNode=table.insertRow(-1);
	return rowNode;
}

// [1.20] 创建组件内容显示列
function createColumn(row,i){
	var colNode=row.insertCell(document.all?-1:0);
	colNode.id="tdACMA_"+i;
	colNode.zIndex=i;
	colNode.align="left";
	colNode.style.cursor=document.all ? "hand" : "pointer";
	colNode.onmouseover=tdOnmouseover;
	colNode.onclick=tdOnclick;
	
	if(i==0){
		colNode.className=dataClassOver;
		curTD=colNode;
	}else{
		colNode.className="";
	}
	return colNode;
}

// [1.21] 组件内容列的鼠标移入事件
function tdOnmouseover(e){
	var o;
	if (!e) {var e=window.event;}
	if (e.target){o=e.target;}
	if (e.srcElement){o=e.srcElement;}
	while(o.tagName!="TD"){o=o.parentNode;}
	o.className="";
	if (curTD!=null){curTD.className="";}
	curTD=o;
	curTD.className=dataClassOver;
}

// [1.22] 组件内容列的鼠标移出事件
function tdOnmouseout(e){
	setDivDisplay(false);
}

// [1.23] 组件blur事件
function divOnBlur(e){
	if(dataContianer==null||dataDiv==null)
		return;
	
	//firefox 
	var activeEl = (e && e.explicitOriginalTarget) || document.activeElement;
	if(contains(dataDiv,activeEl))
		fillValue();
	setDivDisplay(false);
}

// [1.24] 组件focus事件
function divOnFocus(e){
	if(dataContianer==null||dataDiv==null)
		return;
	setDivDisplay(true);
}

// [1.25] 组件内容列点击事件
function tdOnclick(e){
	setDivDisplay(false);
	fillValue();
}

// [1.26] 判断是否为空
function a_isEmpty(src){
	if(typeof _data == 'undefined'||_data==null||src!=curInput)
		_data = [];
	return (_data.length==0);
}

// [1.27] 取页面字段的值
var $;
if (!$ && document.getElementById) {
  $ = function() {
    var elements = new Array();
    for (var i = 0; i < arguments.length; i++) {
      var element = arguments[i];
      if (typeof element == 'string') {
        element = document.getElementById(element);
      }
      if (arguments.length == 1) {
        return element;
      }
      elements.push(element);
    }
    return elements;
  }
}
else if (!$ && document.all) {
  $ = function() {
    var elements = new Array();
    for (var i = 0; i < arguments.length; i++) {
      var element = arguments[i];
      if (typeof element == 'string') {
        element = document.all[element];
      }
      if (arguments.length == 1) {
        return element;
      }
      elements.push(element);
    }
    return elements;
  }
}

/*------------------------------------------------------------
 *	1.输入框选择提示组件	[End]
 *	2.输入框选择提示实例	[Start]
 *-----------------------------------------------------------*/

// [2.1] 选择对象
// 不同的选择会有不同的方式,有的显示字段多,有的是动态取数据库...
function SelectObject(){}
var oldValue=null;
var oldElement = null;
var timeout = null;
var _time=430;

// [2.2] 仓库(输入时进行查询)[src:事件所在的控件][keyCode:事件代码]
// [fillFields:需要填充的字段,是一个Array]
SelectObject.selectStorage = function(src,e,manager,callback){
	if(src.readOnly) return;
	//alert("tttt");
	var compare = ["FCode","FName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	cust.pageSize = 10;
	cust.FCode = value+"%";
	manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	});
}

// [2.3] 产品(输入时进行查询)[src:事件所在的控件][keyCode:事件代码]
// [fillFields:需要填充的字段,是一个Array]
SelectObject.selectProduct=function(src,e,manager,callback,o){
	if(src.readOnly) return;
	var compare = ["code","name"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	if(o) cust = o;
	cust.kind = -1; //屏蔽FKind条件
	cust.pageSize = 10;
	cust.code = value + "%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
		})},_time);
}
//选择供应商产品编号
SelectObject.selectProviderRelativeCode=function(src,e,manager,callback,o){
	if(src.readOnly) return;
	var compare = ["FRelativeCode","FInPrice","FNotes"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	if(o) cust = o;
	cust.pageSize = 10;
	cust.FRelativeCode = value + "%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.getProviderNameAndRelativeCode(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
		})},_time);
}

//选择供应商产品编号
SelectObject.selectEmployeeCode=function(src,e,manager,callback,o){
	if(src.readOnly) return;
	var compare = ["employeeCode","employeeName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	if(o) cust = o;
	cust.pageSize = 10;
	cust.employeeCode = value + "%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.getProviderNameAndRelativeCode(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
		})},_time);
}

// [2.4] 科目(输入时进行查询)[src:事件所在的控件][keyCode:事件代码]
// [fillFields:需要填充的字段,是一个Array]
SelectObject.selectAccount=function(src,e,manager,callback,o){
	if(src.readOnly) return;
	var compare = ["FCode","FName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	if(o) cust = o;
	cust.pageSize = 10;
	cust.FCode = value + "%";
	cust.FIsLeaf=true;
	manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	});
}

// [2.5] 员工(输入时进行查询)
// src:事件触发的input,e:事件,manager:查询数据需要的Manager,callback填充方法
SelectObject.selectEmployee = function(src,e,manager,callback,defParams){
	if(src.readOnly) return;
	var compare = ["employeeCode","employeeName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	if(keyCode==13) return;
	//取n条数据
	var cust = new Object;
	if(defParams) cust = defParams;
	cust.pageSize = 10;
	cust.employeeCode = value+"%";
	
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	})},_time);
}

// [2.6] 部门(输入时进行查询)
// src:事件触发的input,e:事件,manager:查询数据需要的Manager,callback填充方法
SelectObject.selectDepartment = function(src,e,manager,callback,defParams){
	if(src.readOnly) return;
	var compare = ["departmentCode","departmentName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	if(keyCode==13) return;
	//取n条数据
	var cust = new Object;
	if(defParams) cust = defParams;
	cust.pageSize = 10;
	cust.departmentCode = value+"%";
	
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	})},_time);
}

// [2.7] 客户(输入时进行查询)
// src:事件触发的input,e:事件,manager:查询数据需要的Manager,callback填充方法
SelectObject.selectCustomer = function(src,e,manager,callback,defParams){
	if(src.readOnly) return;
	var compare = ["code","name"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	if(keyCode==13) return;
	//取n条数据
	var cust = new Object;
	if(defParams) cust = defParams;
	cust.pageSize = 10;
	cust.code = value;
	cust.name = value;
	cust.searchCode = value;
	
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.findAC(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	})},_time);
}

// [2.8] CRM客户(输入时进行查询)
// src:事件触发的input,e:事件,manager:查询数据需要的Manager,callback填充方法
SelectObject.selectCRMCustomer = function(src,e,manager,callback,defParams){
	if(src.readOnly) return;
	var compare = ["FName","FCode"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	if(keyCode==13) return;
	//取n条数据
	var cust = new Object;
	if(defParams) cust = defParams;
	cust.pageSize = 10;
	cust.FName = value+"%";
	
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	})},_time);
}

// [2.9] CRM联系人(输入时进行查询)
// src:事件触发的input,e:事件,manager:查询数据需要的Manager,callback填充方法
SelectObject.selectCRMContact = function(src,e,manager,callback,defParams){
	if(src.readOnly) return;
	var compare = ["FName","FDuty"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	if(keyCode==13) return;
	//取n条数据
	var cust = new Object;
	if(defParams) cust = defParams;
	cust.pageSize = 10;
	cust.FName = value+"%";
	
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	})},_time);
}

// [2.10] CRM商机(输入时进行查询)
// src:事件触发的input,e:事件,manager:查询数据需要的Manager,callback填充方法
SelectObject.selectCRMOpp = function(src,e,manager,callback,defParams){
	if(src.readOnly) return;
	var compare = ["FName","FForecastAmount"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	if(keyCode==13) return;
	//取n条数据
	var cust = new Object;
	if(defParams) cust = defParams;
	cust.pageSize = 10;
	cust.FName = value+"%";
	
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	})},_time);
}

// [2.11] CRM线索(输入时进行查询)
// src:事件触发的input,e:事件,manager:查询数据需要的Manager,callback填充方法
SelectObject.selectCRMClues = function(src,e,manager,callback,defParams){
	if(src.readOnly) return;
	var compare = ["FName","FStatusName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	if(keyCode==13) return;
	//取n条数据
	var cust = new Object;
	if(defParams) cust = defParams;
	cust.pageSize = 10;
	cust.FName = value+"%";
	
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	})},_time);
}

// [2.12] 供应商(输入时进行查询)
SelectObject.selectProvider = function(src,e,manager,callback){
	if(src.readOnly) return;
	var compare = ["fcode","fcompanyName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	cust.pageSize = 10;
	cust.searchCode = value+"%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	});});
}
// [2.12-1] 采购订单(输入时进行查询)
SelectObject.selectPurchaseOrder = function(src,e,manager,callback){
 	if(src.readOnly) return;
	var compare = ["FOrderID","FCode"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	cust.pageSize = 10;
	cust.FCode = value+"%";
	cust.FStatus = -1;
	cust.FTypeID =0;
	cust.FSale =-1;
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	});});
}

// [2.13] 销售人查询(一次性数据库查询)
SelectObject.selectSaler = function(officeid,src,e,manager,callback){
	if(src.readOnly) return;
	var compare = ["userCode","userName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	//if(value==oldValue&&oldElement==src) return ;//处理中文
	//oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var user = new Object;
	user.FOfficeID = officeid;
	user.pageSize = 10;
	user.userCode = '%'+ value+'%';
	//user.userCode = value;
	manager.find(user,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	});
}

// [2.14] 机构(一次性数据库查询)
SelectObject.selectOffice = function(src,e,manager,callback){
	if(src.readOnly) return;
	var compare = ["FCode","FName"];
	selectOnce(src,e,manager,callback,compare);
}

// [2.15] 发货方式类别(一次性数据库查询)
SelectObject.selectClass = function(src,e,manager,callback){
	if(src.readOnly) return;
	var compare = ["classID","className"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	manager.find(null,function(data){
			initData(src,compare,data,callback);
			onKeyUp(src,keyCode);
	});
}

// [2.16] 选择用户(一次性数据库查询)
SelectObject.selectUser = function(src,e,manager,callback){
	if(src.readOnly) return;
	var compare = ["userCode","userName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	var cust = new Object;
	cust.pageSize = 10;
	cust.userCode = value + "%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
		})},_time);
	//selectOnce(src,e,manager,callback,compare);
}

// [2.17] 选择模块(一次性数据库查询)
SelectObject.selectRight = function(src,e,manager,callback){
	if(src.readOnly) return;
	var compare = ["showName"];
	selectOnce(src,e,manager,callback,compare);
}

// [2.18] 
function selectOnce(src,e,manager,callback,compare){
	if(src.readOnly) return;
	var keyCode = e.keyCode;
	src.onkeydown=function(){return onKeyDown(src,e);};
	if(a_isEmpty(src)){
		var officeObj = new Object;
		officeObj.pageSize=100;
		manager.find(officeObj,function(data){
			initData(src,compare,data,callback);
			onKeyUp(src,keyCode);
		});
	}else{
		initData(src);
		onKeyUp(src,e.keyCode);
	}
}
//[2.18.2]选择销售订单
SelectObject.selectSaleOrder = function(src,e,manager,callback,o){
	if(src.readOnly) return;
	var compare = ["code","customerName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object();
	cust = o ;
	cust.pageSize = 10;
	cust.code = value+"%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
			if(!data||data.length==0) return;
			initData(src,compare,data,callback);
			onKeyUp(src,keyCode);
			})},_time);
}

///////////////       AOL          ///////////////////////
// [2.19] task
SelectObject.selectTask=function(src,e,manager,callback,o){
	var compare = ["code","FDesc"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	if(o) cust = o;
	cust.pageSize = 10;
	cust.code = value + "%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.getAllList4JobAndEmployee(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
		})},_time);
}

// [2.20] job modifiec by brucema 2008-10-20
SelectObject.selectJob=function(src,e,manager,callback,o){
	var compare = ["jobNo","jobDescription"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	if(o) cust = o;
	cust.pageSize = 10;
	cust.jobNo = value + "%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
			if(!data||data.length==0) {return;}
			initData(src,compare,data,callback);
			onKeyUp(src,keyCode);
			})},_time);
}

// [2.22] 批号(输入时进行查询)[src:事件所在的控件][keyCode:事件代码]
//	[fillFields:需要填充的字段,是一个Array]
SelectObject.selectLotNo=function(src,e,manager,callback,o){
	if(src.readOnly) return;
	var compare = ["FLotNo","FCount","FProviderName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	//if(value==oldValue&&oldElement==src) return ;//处理中文
	//oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	if(o) cust = o;
	cust.pageSize = 100;
	cust.FLotNo = value + "%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.getStockDetailInfoForLotNo(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
		})},_time);
}

// [2.23] 现金流量项目(输入时进行查询)[src:事件所在的控件][keyCode:事件代码]
// [fillFields:需要填充的字段,是一个Array]
SelectObject.selectCashFlowProj=function(src,e,manager,callback,o){
	if(src.readOnly) return;
	var compare = ["FCode","FName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	if(o) cust = o;
	cust.pageSize = 10;
	cust.FCode = value + "%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	})},_time);
}

// [2.24] 资产(输入时进行查询)[src:事件所在的控件][keyCode:事件代码]
// [fillFields:需要填充的字段,是一个Array]
SelectObject.selectAsset=function(src,e,manager,callback,o){
	if(src.readOnly) return;
	var compare = ["FCode","FName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	if(o) cust = o;
	cust.FOriginID=-2;//查询全部资产，变更的和未变更的；
	cust.pageSize = 8;
	cust.FStatus=2;
	cust.FCode = value + "%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	})},_time);
}

// [2.25] 总生产任务单(输入时进行查询)[src:事件所在的控件][keyCode:事件代码]
// [fillFields:需要填充的字段,是一个Array]
SelectObject.selectProduceTask=function(src,e,manager,callback,o){
	if(src.readOnly) return;
	var compare = ["FCode","FBrief"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	if(o) cust = o;
	cust.pageSize = 10;
	cust.code = value + "%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
		})},_time);
}

// [2.26] 印章(输入时进行查询)
SelectObject.selectProductLogo = function(src,e,manager,callback){
	if(src.readOnly) return;
	var compare = ["FCode","FName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	cust.pageSize = 10;
	cust.searchCode = value+"%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	});});
}

// [2.27] 备注类别(输入时进行查询)
SelectObject.selectNotesType = function(src,e,manager,callback,o){
	if(src.readOnly) return;
	var compare = ["FName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	if(o) cust = o;
	cust.pageSize = 10;
	cust.searchCode = value+"%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	});});
}

// [2.28] 选择生产工序单(输入时进行查询)
SelectObject.selectProcedure = function(src,e,manager,callback,o){
	if(src.readOnly) return;
	var compare = ["FCode","FName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	if(o) cust = o;
	cust.pageSize = 10;
	cust.searchCode = value+"%";
	cust.FType = 518;
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	});});
}

//[2.29] 选择采购申请单(输入时进行查询)
SelectObject.selectPurApp = function(src,e,manager,callback,o){
	if(src.readOnly) return;
	var compare = ["FCode","FProviderName"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	if(o) cust = o;
	cust.pageSize = 10;
	cust.FCode = value+"%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	});});
}

//[2.28] 选择物料需求单(输入时进行查询)
SelectObject.selectMaterial = function(src,e,manager,callback,o){
	if(src.readOnly) return;
	var compare = ["FCode","produceTaskCode"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	if(value==oldValue&&oldElement==src) return ;//处理中文
	oldValue = value;oldElement=src;
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object;
	if(o) cust = o;
	cust.pageSize = 10;
	cust.searchCode = value+"%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
		if(!data||data.length==0) return ;
		initData(src,compare,data,callback);
		onKeyUp(src,keyCode);
	});});
}

//[2.29]根据发票ID选择销售订单
SelectObject.selectSaleOrderByInvoice = function(src,e,manager,callback,o){
	if(src.readOnly) return;
	var compare = ["FOrderCode","FAmount"];
	var keyCode = e.keyCode;
	var value = Trim(src.value);
	src.onkeydown=function(){return onKeyDown(src,e);};
	//取n条数据
	var cust = new Object();
	cust = o ;
	cust.pageSize = 10;
	cust.code = value+"%";
	if(timeout) clearTimeout(timeout);
	timeout = window.setTimeout(function(){manager.find(cust,function(data){
			if(!data||data.length==0) return;
			initData(src,compare,data,callback);
			onKeyUp(src,keyCode);
			})},_time);
}

/*------------------------------------------------------------
 *	2.输入框选择提示实例	[End]
 *	3.弹出框选择实例		[Start]
 *-----------------------------------------------------------*/

// [3.1] 选择产品
function ChooseProduct(src,relativePath,callback,o){
	var strEditDlgFeather = 'dialogWidth:608px;dialogHeight:552px;center:yes;status:no;help:no';
	var url = relativePath + "choiceProductList.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,o,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
		callback(src,varGet);
	}else{
		alert("Can't get data.");
	}
	return;
}

//[3.11]选择产品单位
function chooseProductUnit(src,relativePath,callback,o){
	var strEditDlgFeather = 'dialogWidth:708px;dialogHeight:552px;center:yes;status:no;help:no';
	var url = relativePath + "basic/itemsList.jsp?ftype=1320&rd="+Math.random();
	var varGet = window.showModalDialog(url,o,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {
		//不是刚刚新增且未保存的数据 
		if(varGet.FItemID !=null && varGet.FItemID != "" && varGet.FItemID != 0)	{
			callback(src,varGet);
		}
	}
	return;
}

//[3.12] 选择BOM中的替代产品
function ChooseReplacementProduct(src,relativePath,callback,o){
	var strEditDlgFeather = 'dialogWidth:708px;dialogHeight:552px;center:yes;status:no;help:no';
	var url = relativePath + "manufacture/bom/selectReplacement.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,o,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
			callback(src,varGet);
	}
	return;
}

//[3.12] 选择BOM中的替代产品
function ChooseEmployee(src,relativePath,callback,o){
	var strEditDlgFeather = 'dialogWidth:708px;dialogHeight:552px;center:yes;status:no;help:no';
	var url = relativePath + "hr/basic/employeeList.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,o,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
			callback(src,varGet);
	}
	return;
}


// [3.2] 选择产品(采购时)
function ChoosePurchaseProduct(src,relativePath,callback,o){
	var strEditDlgFeather = 'dialogWidth:788px;dialogHeight:552px;center:yes;status:no;help:no';
	var url = relativePath + "basic/productRelation.jsp?operate=choose&rd="+Math.random();
	if(_myProductPage != "") url = _myProductPage;	//使用特殊的配置的路径
	var varGet = window.showModalDialog(url,o,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
		//不是刚刚新增且未保存的数据 
		if(varGet.id !=null && varGet.id != "" && varGet.id != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.3] 选择产品(采购时并且和供应商关联)
function ChoosePurchaseProductForProvider(src,relativePath,callback,o){
	var strEditDlgFeather = 'dialogWidth:788px;dialogHeight:552px;center:yes;status:no;help:no';
	var url = relativePath + "customer/providerCurrencyProductList.jsp?rnd="+Math.random();
	if(_myProductPage != "") url = _myProductPage;	//使用特殊的配置的路径
	var varGet = window.showModalDialog(url,o,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
		//不是刚刚新增且未保存的数据 
		if(varGet.id !=null && varGet.id != "" && varGet.id != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.4] 选择产品(系统[不]设置批号)
function ChooseProductForAmortization(url,callback,o){
	var strEditDlgFeather = 'dialogWidth:788px;dialogHeight:552px;center:yes;status:no;help:no';
	url += "?rnd="+Math.random();
	var varGet = window.showModalDialog(url,o,strEditDlgFeather); 
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
			callback(varGet);
	}
	return;
}


// [3.5] 采购申请单中选择产品
function ChoosePurchaseProductInPurchaseApply(src,relativePath,callback,o){
	var strEditDlgFeather = 'dialogWidth:788px;dialogHeight:552px;center:yes;status:no;help:no';
	//通过type=inPurchaseApply这个条件来判断,是否要显示产品进价这一列
	var url = relativePath + "basic/productRelation.jsp?operate=choose&type=inPurchaseApply&rd="+Math.random();
	if(_myProductPage != "") url = _myProductPage;	//使用特殊的配置的路径
	var varGet = window.showModalDialog(url,o,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
		//不是刚刚新增且未保存的数据 
		if(varGet.id !=null && varGet.id != "" && varGet.id != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.6] 选择客户
function ChooseCustomer(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:788px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "customer/customersList.jsp?type=0&operate=choose&rd="+Math.random();
	if(_myCustomerURL != "") url = _myCustomerURL;	//使用特殊的配置的路径	
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.customerId !=null && varGet.customerId != "" && varGet.customerId != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.7] 选择CRM客户
function ChooseCRMCustomer(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:788px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "crm/customer/customerList.jsp?operate=choose&rd="+Math.random();
	
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.FCustomerID !=null && varGet.FCustomerID != "" && varGet.FCustomerID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.8] 选择CRM联系人
function ChooseCRMContact(src,relativePath,callback,defParams,custID){
	var strEditDlgFeather = 'dialogWidth:718px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "crm/customer/chooseContact.jsp?operate=choose&ID="+custID+"&rd="+Math.random();
	
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.FContactID !=null && varGet.FContactID != "" && varGet.FContactID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.9] 选择CRM商机
function ChooseCRMOpp(src,relativePath,callback,defParams,custID){
	var strEditDlgFeather = 'dialogWidth:718px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "crm/oppotunity/chooseOpp.jsp?operate=choose&ID="+custID+"&rd="+Math.random();
	
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.FOpportunityID !=null && varGet.FOpportunityID != "" && varGet.FOpportunityID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.10] 选择CRM线索
function ChooseCRMClues(src,relativePath,callback,defParams,custID){
	var strEditDlgFeather = 'dialogWidth:718px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "crm/clue/chooseClues.jsp?operate=choose&ID="+custID+"&rd="+Math.random();
	
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.FClueID !=null && varGet.FClueID != "" && varGet.FClueID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.11] 选择供应商
function ChooseProvider(src,relativePath,callback){
	var strEditDlgFeather = 'dialogWidth:808px;dialogHeight:552px;center:yes;status:no;help:no';
	var url = relativePath + "customer/providerList.jsp?type=1&operate=choose&rd="+Math.random();
	if(_myProviderURL != "") url = _myProviderURL;	//使用特殊的配置的路径	
	var varGet = window.showModalDialog(url,null,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.fproviderID !=null && varGet.fproviderID != "" && varGet.fproviderID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.12] 选择Office
function ChooseOffice(src,relativePath,callback){
	var strEditDlgFeather = 'dialogWidth:808px;dialogHeight:552px;center:yes;status:no;help:no';
	var url = relativePath + "orgstructure/office.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,null,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
		//alert(varGet.FOfficeID);	
		//不是刚刚新增且未保存的数据 
		if(varGet.FOfficeID !=null && varGet.FOfficeID != "" && varGet.FOfficeID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.13] 选择科目
function ChooseAccount(src,relativePath,callback,o){
	var strEditDlgFeather = 'dialogWidth:708px;dialogHeight:600px;center:yes;status:no;help:no';
	var url = relativePath + "finance/account/AccountList.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,o,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
		//不是刚刚新增且未保存的数据 
		if(varGet.FAccountID !=null && varGet.FAccountID != "" && varGet.FAccountID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.14] 选择资产
function ChooseAsset(src,relativePath,callback,o){
	var strEditDlgFeather = 'dialogWidth:708px;dialogHeight:600px;center:yes;status:no;help:no';
	var url = relativePath + "finance/asset/selectAssList.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,o,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
		//不是刚刚新增且未保存的数据 
		if(varGet.FAssetID !=null && varGet.FAssetID != "" && varGet.FAssetID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.15] 选择用户
function ChooseUser(src,relativePath,callback){
	var strEditDlgFeather = 'dialogWidth:808px;dialogHeight:552px;center:yes;status:no;help:no';
	var url = relativePath + "right/user.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,null,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
		//不是刚刚新增且未保存的数据 
		if(varGet.FUserID !=null && varGet.FUserID != "" && varGet.FUserID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.16] Choose Department
function ChooseDepartment(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:788px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "/orgstructure/department.jsp?operate=choose&rd="+Math.random();
	
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.IDKey !=null && varGet.IDKey != "" && varGet.IDKey != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.17] Choose Employee
function ChooseEmployee(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:788px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "/orgstructure/employees.jsp?operate=choose&rd="+Math.random();
	
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.IDKey !=null && varGet.IDKey != "" && varGet.IDKey != 0)	
			callback(src,varGet);
	}
	return;
}
// [3.17] Choose orgEmployee
function ChooseOrgEmployee(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:788px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "/orgstructure/employees.jsp?operate=choose&rd="+Math.random();
	
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.IDKey !=null && varGet.IDKey != "" && varGet.IDKey != 0)
			callback(src,varGet);
	}
	return;
}

//////////////////   AOL    //////////////
// [3.18] 显示某人在某个项目下的所有任务
function ChooseAOLTask(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:788px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "/aol/production/jobTaskAllList.jsp?operate=choose&rd="+Math.random();
	
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.FID !=null && varGet.FID != "" && varGet.FID != 0)	
			callback(src,varGet);
	}
	return;
}
//显示所有的项目的任务列表
function ChooseAOLTaskList(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:788px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "aol/production/jobTaskList.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.FID !=null && varGet.FID != "" && varGet.FID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.19]  modified by brucema 2008-10-20
function ChooseAOLJob(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:788px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "/aol/production/jobs.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	callback(src,varGet);
}


// [3.22] 选择仓库
function ChooseStorage(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:708px;dialogHeight:552px;center:yes;status:no;help:no';
	var url = relativePath + "basic/storageList.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
		//不是刚刚新增且未保存的数据 
		if(varGet.FStorageID !=null && varGet.FStorageID != "" && varGet.FStorageID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.23] 选择现金流量项目
function ChooseCashProject(src,relativePath,callback,o){
	var strEditDlgFeather = 'dialogWidth:708px;dialogHeight:600px;center:yes;status:no;help:no';
	var url = relativePath + "finance/voucher/cashProjectList.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,o,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
		//不是刚刚新增且未保存的数据 
		if(varGet.FItemID !=null && varGet.FItemID != "" && varGet.FItemID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.24] 选择联系人
function ChooseContactor(src,providerID,providerName,conType,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:708px;dialogHeight:552px;center:yes;status:no;help:no';
	var url = relativePath + "customer/contactList.jsp?opType=choose&ID=" + providerID + "&custName="+providerName+"&type=" + conType + "&rd="+Math.random();
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
		//不是刚刚新增且未保存的数据 
		if(varGet.FContactID !=null && varGet.FContactID != "" && varGet.FContactID != 0)	
			callback(src,varGet);
	}
	return;
}	

// [3.25] Choose HREmployee
function ChooseHREmployee(src,relativePath,Type,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:788px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "hr/basic/employeeHrList.jsp?operate=choose&rd="+Math.random()+"&Type="+Type;
	
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.FEmployeeID !=null && varGet.FEmployeeID != "" && varGet.FEmployeeID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.26] 选择总任务单
function ChooseProduceTask(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:718px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "manufacture/task/planList.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.FPlanID !=null && varGet.FPlanID != "" && varGet.FPlanID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.27] 选择印章
function ChooseProductLogo(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:718px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "manufacture/basic/productLogoList.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.FLogoID !=null && varGet.FLogoID != "" && varGet.FLogoID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.28] 选择备注类别
function ChooseNotesType(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:718px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "basic/notesList.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.FNotesID !=null && varGet.FNotesID != "" && varGet.FNotesID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.29] 选择客户送货地址
function ChooseCustomerAddress(src,relativePath,callback,defParams,ID,type){
	var strEditDlgFeather = 'dialogWidth:718px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "customer/customerSendAddr.jsp?ID="+ID+"&type="+type+"&opType=choose&rd="+Math.random();
	if(_myCustomerURL != "") url = _myCustomerURL;	//使用特殊的配置的路径	
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.FAddressID !=null && varGet.FAddressID != "" && varGet.FAddressID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.30] 选择测试程序
function ChooseProgram(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:718px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "basic/itemsList.jsp?ftype=518&operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {		
		//不是刚刚新增且未保存的数据 
		if(varGet.FItemID !=null && varGet.FItemID != "" && varGet.FItemID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.31] 选择采购申请单
function ChoosePurApp(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:718px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "purchase/purchaseApplyList.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
		//不是刚刚新增且未保存的数据 
		if(varGet.FApplyID !=null && varGet.FApplyID != "" && varGet.FApplyID != 0)	
			callback(src,varGet);
	}
	return;
}

// [3.31] 选择采购订单
function ChoosePurchaseOrder(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:718px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "purchase/purchaseList.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
		//不是刚刚新增且未保存的数据 
		if(varGet.FOrderID !=null && varGet.FOrderID != "" && varGet.FOrderID != 0)	
		   callback(src,varGet);
	}
	return;
}

//[3.32] 选择报表
function ChooseReport(src,relativePath,callback,o){
	var strEditDlgFeather = 'dialogWidth:708px;dialogHeight:552px;center:yes;status:no;help:no';
	var url = relativePath + "kstreport/reportList.jsp?operate=choose&rd="+Math.random();
	if(_myProductPage != "") url = _myProductPage;	//使用特殊的配置的路径
	var varGet = window.showModalDialog(url,o,strEditDlgFeather);
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
		//不是刚刚新增且未保存的数据 
		if(varGet.id !=null && varGet.id != "" && varGet.id != 0)	
			callback(src,varGet);
	}
	return;
}

//[3.33] 选择销售订单
function chooseSaleOrder(src,relativePath,callback,defParams){
	var strEditDlgFeather = 'dialogWidth:718px;dialogHeight:580px;center:yes;status:no;help:no';
	var url = relativePath + "sales/orderList.jsp?operate=choose&rd="+Math.random();
	var varGet = window.showModalDialog(url,defParams,strEditDlgFeather);
	
	if(varGet && varGet!=null && typeof(varGet) == "object" ) {	
		//不是刚刚新增且未保存的数据 
		if(varGet.FOrderID !=null && varGet.FOrderID != "" && varGet.FOrderID != 0)	
		   callback(src,varGet);
	}
	return;
}
/*------------------------------------------------------------
 *	3.弹出框选择实例		[End]
 *-----------------------------------------------------------*/
