function ISelect(instance, id_options, id_text, id_value, id_selectedIndex, id_filter, id_tips, city, Ctrl, styleclassname)
{
	var id_options = id_options!=null? id_options.toString() : "ISelect_Options";
	var obj_options = null;
	var id_text = id_text!=null? id_text.toString() : "ISelectText";
	var obj_text = null;
	var id_value = id_value!=null? id_value.toString() : "ISelectValue";
	var obj_value = null;
	var id_selectedIndex = id_selectedIndex!=null? id_selectedIndex.toString() : "ISelectedIndex";
	var obj_selectedIndex = null;
	var id_filter = id_filter!=null? id_filter.toString() : "ISelectFilter";
	var obj_filter = null;
	var id_tips = id_tips!=null? id_tips.toString() : "ISelectTips";
	var obj_tips = null;
	var arr_options = 'object' == typeof(city) ? city : [];
	var length = 0;
	this.push = function(object){
		arr_options.push(object)
	}
	var bIndex = null;
	var selectedIndex = null;
	var __start;
	this.SetupData = function(start){
		var __st = new Date().getTime();
	 	obj_options.innerHTML = '';
		length = arr_options.length;
		var j = 0;
		var vlen = start.length;
		for(key in city){
		 if (key.substr(0,vlen)==start.toLowerCase()) {
			var text, value;
			text = city[key];
			value= city[key];
			var option = document.createElement('DIV');
			option.innerText = text ;
			option.value = value ;
			option.index = j++;
			option.className = 'ISItem';
			option.onclick = function(){
				window[instance].select(this.index);
			}
			option.onmousemove = function(){
				window[instance].highLight(this.index);
			}
			obj_options.appendChild(option);
		  }
		  if(j>100)	break;
		}
		length = j;
	}
	this.select = function(i, bSelect) {
		if(isNaN(i)) return;
		if(null == bIndex)	bIndex = i;
		selectedIndex = i;
		obj_text.value = obj_options.childNodes[i].innerText;
		obj_value.value = obj_options.childNodes[i].value;
		obj_selectedIndex.value = selectedIndex;
		if(bSelect)
			obj_text.select();
	}
	this.highLight = function(i){
			if(null != bIndex)
				obj_options.childNodes[bIndex].className = 'ISItem';
			bIndex = i;
			obj_options.childNodes[bIndex].className = 'IShighlight';
			if(obj_options.childNodes[bIndex].offsetTop + obj_options.childNodes[bIndex].offsetHeight - obj_options.scrollTop > obj_options.clientHeight)
				obj_options.scrollTop = obj_options.childNodes[bIndex].offsetTop + obj_options.childNodes[bIndex].offsetHeight - obj_options.clientHeight;
			if(obj_options.childNodes[bIndex].offsetTop - obj_options.scrollTop < 0)
				obj_options.scrollTop = obj_options.childNodes[bIndex].offsetTop;
		return bIndex;
	}
	this.showOptions = function(){
		try{
			if('none' == obj_options.style.display){
				if (instance == 'is1')
				{
				}
				obj_options.style.display = '';
				obj_tips.style.display = '';
				obj_text.focus();
				if(null != selectedIndex){
					window[instance].highLight(selectedIndex);
					obj_options.scrollTop = obj_options.childNodes[selectedIndex].offsetTop;
				}
				return true
			}
		}catch(e){	return false; }
	}
	this.hideOptions = function(){
		try{
			if('' == obj_options.style.display){
				if (instance == 'is1')
				{
				}
				obj_options.style.display = 'none';
				obj_tips.style.display = 'none';
				obj_text.select();
				return true;
			}
		}catch(e){	return false; }
	}
	this.toString = function()
	{
		var htmlcode = '';
		htmlcode += '<div style="border:0px;position:absolute;" align="left">\r\
						<div align="left" id="' + id_options + '" style="text-align: left; z-index:-1;display:none; border:1px solid #000000; background-color:#FFFFFF; font-size:14px; width:300px; height:142px; overflow:auto;overflow-x:hidden; position:absolute; top:26px;">\r\
						</div>\r\
						<div align="left" id="' + id_tips + '" style="cursor:hand; text-align: right; z-index:-1;display:none;width:300px;top:168px;overflow:auto;overflow-x:hidden; position:absolute;"><a onclick="' + instance + '.hideOptions();">关闭</a></div>\r\
					</div>\r\
					<input onfocus="'+Ctrl+'" name="' + id_text + '" type="text"  class="' + styleclassname +'"><input name="' + id_selectedIndex + '" id="' + id_selectedIndex + '" type="hidden"><input name="' + id_filter + '" id="' + id_filter + '" type="hidden"><input name="' + id_value + '" id="' + id_value + '" type="hidden" >\
					';
		return htmlcode;
	}
	this.Init = function(){
		obj_options = document.getElementById(id_options);
		obj_text = document.getElementById(id_text);
		obj_value = document.getElementById(id_value);
		obj_tips = document.getElementById(id_tips);
		obj_selectedIndex = document.getElementById(id_selectedIndex);
		obj_filter = document.getElementById(id_filter);
		obj_options.onscroll = function(){obj_text.focus();}
		obj_text.onkeydown = function(){
			if(38 == event.keyCode || 40 == event.keyCode) //38 up 40 down
				if(null  == bIndex)
					selectedIndex = -1;
				else
					selectedIndex = bIndex;
			
			switch(event.keyCode){
				case 13 ://enter
					if(null != selectedIndex)
						window[instance].select(selectedIndex);
					if(window[instance].hideOptions())
						return false;
					break;
				case 38 ://up
					if(selectedIndex-1 >= 0)
						selectedIndex --;
					else
						selectedIndex = 0;
					window[instance].highLight(selectedIndex);
					window[instance].select(selectedIndex);
					return false;
					break;
				case 40 ://down
					if((selectedIndex+1) < length)
						selectedIndex ++;
					window[instance].highLight(selectedIndex);
					window[instance].select(selectedIndex);
					return false;
					break;
				default:
					break;
			}
		}
		obj_text.onkeypress = function(){
			if (event.keyCode != 13)
				window[instance].showOptions();
		}
		obj_text.onkeyup = function(){
			if(38 != event.keyCode && 40 != event.keyCode && 13 != event.keyCode)
				if(this.value != __start){
					__start = this.value;
					obj_filter.value = __start;
					if('' == obj_options.style.display){
						if(null != this._sto)	clearTimeout(this._sto);
						this._sto = setTimeout(function(){window[instance].SetupData(__start)}, 30);
					}
					bIndex = selectedIndex = null;
				}
		}
		obj_text.onmousewheel = function(){
			if(null  == bIndex)
				selectedIndex = -1;
			else
				selectedIndex = bIndex;
			if(event.wheelDelta >= 120){
				if(selectedIndex-1 >= 0)
					selectedIndex --;
				else
					selectedIndex = 0;
				window[instance].highLight(selectedIndex);
				window[instance].select(selectedIndex);
			}else if(event.wheelDelta <= -120){
				if((selectedIndex+1) < length)
					selectedIndex ++;
				window[instance].highLight(selectedIndex);
				window[instance].select(selectedIndex);
			}
		}
		setTimeout(function(){
			obj_filter.value = __start = window[instance].filter;
			window[instance].SetupData(__start);

			if(null != window[instance].selectedIndex){
				window[instance].select(window[instance].selectedIndex, false);
			}},  'is2' == instance ? 2000 : 500);
		if(null != this.text){
			obj_text .value = this.text;
		}
	}
	this.TimeOut = function(interval){
		var _local = new Date().getTime();
		if(_local - this.tempT < interval)
			return true;
		this.tempT = _local;
	}
	this.Equals = function(start) {
	}
}
function hidde(){
is1.hideOptions();
is2.hideOptions();
is3.hideOptions();
is4.hideOptions();
}
