
//========================		
//高亮输入框
//========================
function HighLight(strID){
	if(typeof(strID)!="object")
		return;
	else
		var obj=strID;
	if(typeof(obj)!="undefined"){
		if(obj.readOnly)return;
		var r=obj.createTextRange();
		r.move("character",0);
		r.expand("textedit");
		r.select();
	}
}

//=============================
//   全部去掉选择项
//=============================
function remove_Option(strWho){
	var obj;
	if(typeof(strWho)=="object"){
		obj = strWho;
	}else{
		obj=GetObj(strWho);
		if(typeof(obj)=="undefined")return;
	}
	if(obj.getAttribute("tagname")=="SELECT"){
		while(obj.length>0){
			obj.remove(0);
		}
	}
}

//=============================
//   在指定位置加入选择项
//=============================
function add_Option(strWho,strWhat,strID,strValue,strPos){
	var obj;
	if(typeof(strWho)=="string")
		obj=GetObj(strWho);
	else if(typeof(strWho)=="object")
		obj=strWho;
	else{
		alert("add_Option failed!");
		return false;
	}
	if(typeof(obj)=="undefined")return;
	if(obj.getAttribute("tagName")=="SELECT"){
		var newOption=document.createElement("OPTION");
		newOption.text=strWhat;
		newOption.id=strID;
		newOption.value=strValue;
		obj.add(newOption,strPos);
	}
}

//自己做的字典类，避免用activeXObject
function Dictionary(){
	this.keys = new Array();
	this.items = new Array();
	Dictionary.prototype.Add = _add;
	Dictionary.prototype.add = _add;
	Dictionary.prototype.Keys = _keys;
	Dictionary.prototype.Item = _item;
	Dictionary.prototype.Count = _count;
	function _add(key,item){
		//如果这个key已经存在怎么版？
		this.keys[this.keys.length] = key;
		this.items[this.items.length] = item;
	}
	function _keys(){
		return this.keys;
	}
	function _item(key){
		var find = false;
		for(var i=0;i<this.keys.length;i++){
			if(key==this.keys[i]){
				find = true;
				break;
			}
		}
		if(find){
			return this.items[i];
		}else{
			return null;
		}
	}
	function _count(){
		return this.keys.length;
	}
}
