
//初始化常用城市
var gncommoncitys=new Array();
//@SH|上海|SHA@BJ|北京|PEK@WH|武汉|WUH@SZ|深圳|SZX@gz|广州|CAN@CQ|重庆|CKG@QD|青岛|TAO@XM|厦门|XMN@HZ|杭州|HGH@CD|成都|CTU@XA|西安|XIY@CS|长沙|CSX@NJ|南京|NKG
gncommoncitys[0]=new Array('SHA','上海','Shanghai','SH');
gncommoncitys[1]=new Array('PEK','北京','Beijing','BJ');

gncommoncitys[2]=new Array('CAN','广州','Guangzhou','GZ');

gncommoncitys[3]=new Array('SZX','深圳','Shenzhen','SZ');

gncommoncitys[4]=new Array('HGH','杭州','Hangzhou','HZ');

gncommoncitys[5]=new Array('CSX','长沙','Changsha','CS');

gncommoncitys[6]=new Array('CTU','成都','Chengdu','CD');

gncommoncitys[7]=new Array('NKG','南京','Nanjing','NJ');

gncommoncitys[8]=new Array('TAO','青岛','Qingdao','QD');

gncommoncitys[9]=new Array('SYX','三亚','Sanya','SY');

gncommoncitys[10]=new Array('XMN','厦门','Xiamen','XM');

gncommoncitys[11]=new Array('XIY','西安','Xian','XA');

//初始化各个城市
var gncitys=new Array();

gncitys[0] = new Array('DIG','迪庆香格里拉','DI QING XIANG GE LI LA','CN');

gncitys[1] = new Array('JUZ','衢州','JUZHOU, ZHEJIANG PROVINCE','CN');

gncitys[2] = new Array('AAT','阿尔泰','ALTAY','CN');

gncitys[3] = new Array('AKU','阿克苏','AKSU','CN');

gncitys[4] = new Array('AKA','安康','ANKANG','CN');

gncitys[5] = new Array('AQG','安庆','ANQING','CN');

gncitys[6] = new Array('AVA','安顺','AN SHUN','CN');

gncitys[7] = new Array('AYN','安阳','ANYANG','CN');

gncitys[8] = new Array('AOG','鞍山','ANSHAN','CN');

gncitys[9] = new Array('BPX','邦达','BANGDA','CN');

gncitys[10] = new Array('BAV','包头','BAOTOU','CN');

gncitys[11] = new Array('BSD','宝山','BAOSHAN','CN');

gncitys[12] = new Array('BHY','北海','BEIHAI','CN');

gncitys[13] = new Array('PEK','北京','BEIJING','CN');

gncitys[14] = new Array('BFU','本布','BENGBU','CN');

gncitys[15] = new Array('CGQ','长春','CHANGCHUN','CN');

gncitys[16] = new Array('CSX','长沙','CHANGSHA','CN');

gncitys[17] = new Array('CIH','长治','CHANGZHI','CN');

gncitys[18] = new Array('CGD','常德','CHANGDE','CN');

gncitys[19] = new Array('CZX','常州','CHANGZHOU','CN');

gncitys[20] = new Array('CHG','朝阳','CHAOYANG','CN');

gncitys[21] = new Array('CTU','成都','CHENGDU','CN');

gncitys[22] = new Array('CIF','赤峰','CHIFENG','CN');

gncitys[23] = new Array('DAX','达县','DAXIAN','CN');

gncitys[24] = new Array('DLU','大理市','DALI CITY','CN');

gncitys[25] = new Array('DLC','大连','DALIAN','CN');

gncitys[26] = new Array('DAT','大同','DATONG','CN');

gncitys[27] = new Array('DYG','大庸','DAYONG','CN');

gncitys[28] = new Array('DZU','大足','DAZU','CN');

gncitys[29] = new Array('DDG','丹东','DANDONG','CN');

gncitys[30] = new Array('LUM','德宏芒市','DE HONG MANG SHI','CN');

gncitys[31] = new Array('DSN','东胜','DONGSHENG','CN');

gncitys[32] = new Array('DGM','东莞','DONGGUAN','CN');

gncitys[33] = new Array('DOY','东营','DONGYING','CN');

gncitys[34] = new Array('DNH','敦煌','DUNHUANG','CN');

gncitys[35] = new Array('ENH','恩施','ENSHI','CN');

gncitys[36] = new Array('ZAX','番禺','PAN YU','CN');

gncitys[37] = new Array('FUO','佛山','FUOSHAN','CN');

gncitys[38] = new Array('ZCP','佛山','FOSHAN','CN');

gncitys[39] = new Array('FOC','福州','FUZHOU','CN');

gncitys[40] = new Array('FUG','阜阳','FUYANG','CN');

gncitys[41] = new Array('FYN','富蕴','FUYUN','CN');

gncitys[42] = new Array('KOW','赣州','GANZHOU','CN');

gncitys[43] = new Array('GOQ','戈尔马德','GOLMUD','CN');

gncitys[44] = new Array('GHN','广汉','GUANGHAN','CN');

gncitys[45] = new Array('LHK','广华','GUANGHUA','CN');

gncitys[46] = new Array('GYS','广元','GUANG YUAN','CN');

gncitys[47] = new Array('CAN','广州','GUANGZHOU','CN');

gncitys[48] = new Array('KWE','贵阳','GUIYANG','CN');

gncitys[49] = new Array('KWL','桂林','GUILIN','CN');

gncitys[50] = new Array('HRB','哈尔滨','HARBIN','CN');

gncitys[51] = new Array('HMI','哈米','HAMI','CN');

gncitys[52] = new Array('HAK','海口','HAIKOU','CN');

gncitys[53] = new Array('HLD','海拉尔','HAILAR','CN');

gncitys[54] = new Array('HZG','汉中','HANZHONG','CN');

gncitys[55] = new Array('HGH','杭州','HANGZHOU','CN');

gncitys[56] = new Array('HFE','合肥','HEFEI','CN');

gncitys[57] = new Array('HEK','黑河','HEIHE','CN');

gncitys[58] = new Array('HNY','衡阳','HENGYANG','CN');

gncitys[59] = new Array('HET','呼和浩特','HOHHOT','CN');

gncitys[60] = new Array('HHA','黄花','HUANGHUA','CN');

gncitys[61] = new Array('HYN','黄岩','HUANGYAN','CN');

gncitys[62] = new Array('HUZ','惠州','HUIZHOU','CN');

gncitys[63] = new Array('HTN','霍坦','HOTAN','CN');

gncitys[64] = new Array('KNC','吉安','JI AN','CN');

gncitys[65] = new Array('JIL','吉林','JILIN','CN');

gncitys[66] = new Array('TNA','济南','JINAN','CN');

gncitys[67] = new Array('JNG','济宁','JINING','CN');

gncitys[68] = new Array('JMU','佳木斯','JIAMUSI','CN');

gncitys[69] = new Array('JGN','嘉峪关','JIAYUGUAN','CN');

gncitys[70] = new Array('ZBD','江门','JIANG MEN','CN');

gncitys[71] = new Array('JNZ','锦州','JINZHOU','CN');

gncitys[72] = new Array('JDZ','景德镇','JINGDEZHEN','CN');

gncitys[73] = new Array('JIU','九江','JIUJIANG','CN');

gncitys[74] = new Array('CHW','酒泉','JIUQUAN','CN');

gncitys[75] = new Array('KHG','喀什','KASHI','CN');

gncitys[76] = new Array('KRY','卡拉马伊','KARAMAY','CN');

gncitys[77] = new Array('KRL','科尔拉','KORLA','CN');

gncitys[78] = new Array('KCA','库车','KUQA','CN');

gncitys[79] = new Array('KMG','昆明','KUNMING','CN');

gncitys[80] = new Array('LXA','拉萨','LHASA','CN');

gncitys[81] = new Array('LHW','兰州','LANZHOU','CN');

gncitys[82] = new Array('LJG','丽江','LIJIANG','CN');

gncitys[83] = new Array('LYG','连云港','LIANYUNGANG','CN');

gncitys[84] = new Array('LIA','梁平','LIANGPING','CN');

gncitys[85] = new Array('LXI','林西','LINXI','CN');

gncitys[86] = new Array('LNJ','临沧','LINCANG','CN');

gncitys[87] = new Array('LYI','临沂','LINYI','CN');

gncitys[88] = new Array('LZH','柳州','LIUZHOU','CN');

gncitys[89] = new Array('LCX','龙岩','LONGYAN','CN');

gncitys[90] = new Array('LUZ','庐山','LUSHAN','CN');

gncitys[91] = new Array('LZO','泸州','LUZHOU','CN');

gncitys[92] = new Array('LYA','洛阳','LUOYANG','CN');

gncitys[93] = new Array('NZH','满洲里','MANZHOULI','CN');

gncitys[94] = new Array('MXZ','梅县','MEI XIAN','CN');

gncitys[95] = new Array('MIG','绵阳','MIAN YANG','CN');

gncitys[96] = new Array('MDG','牡丹江','MUDANJIANG','CN');

gncitys[97] = new Array('KHN','南昌','NANCHANG','CN');

gncitys[98] = new Array('NAO','南充','NANCHONG','CN');

gncitys[99] = new Array('ZEF','南海','NANHAI','CN');

gncitys[100] = new Array('NKG','南京','NANKING','CN');

gncitys[101] = new Array('NNG','南宁机场','NANNING','CN');

gncitys[102] = new Array('NTG','南通','NANTONG','CN');

gncitys[103] = new Array('NNY','南阳','NANYANG','CN');

gncitys[104] = new Array('NGB','宁波','NINGBO','CN');

gncitys[105] = new Array('PZI','攀枝花','PAN ZHI HUA','CN');

gncitys[106] = new Array('NDG','齐齐哈尔','QIQIHAR','CN');

gncitys[107] = new Array('IQM','且末','QIEMO','CN');

gncitys[108] = new Array('SHP','秦皇岛','QINHUANGDAO','CN');

gncitys[109] = new Array('TAO','青岛','QINGDAO','CN');

gncitys[110] = new Array('IQN','庆阳','QINGYANG','CN');

gncitys[111] = new Array('JJN','泉州','QUANZHOU','CN');

gncitys[112] = new Array('RUG','如皋','RUGAO','CN');

gncitys[113] = new Array('SYX','三亚','SANYA','CN');

gncitys[114] = new Array('SHS','沙市','SHASHI','CN');

gncitys[115] = new Array('SHF','山海关','SHANHAIGUAN','CN');

gncitys[116] = new Array('SWA','汕头','SHANTOU','CN');

gncitys[117] = new Array('SZO','剡州','SHANZHOU','CN');

gncitys[118] = new Array('SXJ','鄯善机场','SHANSHAN','CN');

gncitys[119] = new Array('CNI','上海','CHANGHAI','CN');

gncitys[120] = new Array('SHA','上海','SHANGHAI','CN');

gncitys[121] = new Array('HSC','韶关','SHAOGUAN','CN');

gncitys[122] = new Array('ZCU','蛇口','SHE KOU','CN');

gncitys[123] = new Array('SZX','深圳','SHENZHEN','CN');

gncitys[124] = new Array('SHE','沈阳','SHENYANG','CN');

gncitys[125] = new Array('SJW','石家庄','SHIJIAZHUANG','CN');

gncitys[126] = new Array('ZAS','顺德','SHUNDE','CN');

gncitys[127] = new Array('SYM','思茅','SIMAO','CN');

gncitys[128] = new Array('JZH','松潘','SONG PAN','CN');

gncitys[129] = new Array('SZV','苏州','SUZHOU','CN');

gncitys[130] = new Array('TCG','塔城','TACHENG','CN');

gncitys[131] = new Array('TYN','太原','TAIYUAN','CN');

gncitys[132] = new Array('ZCA','泰山','TAI SHAN','CN');

gncitys[133] = new Array('TSN','天津','TIANJIN','CN');

gncitys[134] = new Array('TNH','通化','TONGHUA','CN');

gncitys[135] = new Array('TGO','通辽','TONGLIAO','CN');

gncitys[136] = new Array('TEN','铜仁','TONGREN','CN');

gncitys[137] = new Array('TXN','屯溪','TUNXI','CN');

gncitys[138] = new Array('WXN','万县','WANXIAN','CN');

gncitys[139] = new Array('WEH','威海','WEIHAI','CN');

gncitys[140] = new Array('WEF','潍坊','WEIFANG','CN');

gncitys[141] = new Array('WNZ','温州','WENZHOU','CN');

gncitys[142] = new Array('WUA','乌海','WU HAI','CN');

gncitys[143] = new Array('HLH','乌兰浩特','ULANHOT','CN');

gncitys[144] = new Array('URC','乌鲁木齐','URUMQI','CN');

gncitys[145] = new Array('WUX','无锡','WUXI','CN');

gncitys[146] = new Array('WHU','芜湖','WUHU','CN');

gncitys[147] = new Array('WUZ','梧州','WUZHOU','CN');

gncitys[148] = new Array('WUH','武汉','WUHAN','CN');

gncitys[149] = new Array('WUS','武夷山','WUYISHAN','CN');

gncitys[150] = new Array('SIA','西安','XI AN','CN');

gncitys[151] = new Array('XIC','西昌','XICHANG','CN');

gncitys[152] = new Array('XNN','西宁','XINING','CN');

gncitys[153] = new Array('JHG','西双版纳','XI SHUANG BAN NA','CN');

gncitys[154] = new Array('XIL','锡林浩特','XILINHOT','CN');

gncitys[155] = new Array('XMN','厦门','XIAMEN','CN');

gncitys[156] = new Array('XFN','襄樊','XIANGFAN','CN');

gncitys[157] = new Array('ZBZ','信汇','XIN HUI','CN');

gncitys[158] = new Array('XEN','兴城','XINGCHENG','CN');

gncitys[159] = new Array('XIN','兴宁','XINGNING','CN');

gncitys[160] = new Array('XNT','邢台','XINGTAI','CN');

gncitys[161] = new Array('XUZ','徐州','XUZHOU','CN');

gncitys[162] = new Array('YNT','烟台','YANTAI','CN');

gncitys[163] = new Array('ENY','延安','YANAN','CN');

gncitys[164] = new Array('YNJ','延吉','YANJI','CN');

gncitys[165] = new Array('YNZ','盐城','YANCHENG','CN');

gncitys[166] = new Array('YIN','伊宁','YINING','CN');

gncitys[167] = new Array('YBP','宜宾','YIBIN','CN');

gncitys[168] = new Array('YIH','宜昌','YICHANG','CN');

gncitys[169] = new Array('YLN','宜兰','YILAN','CN');

gncitys[170] = new Array('YIW','义乌','YIWU','CN');

gncitys[171] = new Array('INC','银川','YINCHUAN','CN');

gncitys[172] = new Array('UYN','榆林','YULIN','CN');

gncitys[173] = new Array('YUA','元谋','YUANMOU','CN');

gncitys[174] = new Array('YCU','运城','YUN CHENG','CN');

gncitys[175] = new Array('ZHA','湛江','ZHANJIANG','CN');

gncitys[176] = new Array('ZAT','昭通','ZHAOTONG','CN');

gncitys[177] = new Array('CGO','郑州','ZHENGZHOU','CN');

gncitys[178] = new Array('ZGN','中山','ZHONGSHAN','CN');

gncitys[179] = new Array('CKG','重庆','CHONGQING','CN');

gncitys[180] = new Array('HSN','舟山','ZHOUSHAN','CN');

gncitys[181] = new Array('ZUH','珠海','ZHUHAI','CN');

gncitys[182] = new Array('ZYI','遵义','ZUNYI','CN');

gncitys[183] = new Array('HKG','香港','Hong Kong','XG');

gncitys[184] = new Array('MFM','澳门','Macau','AM');


 function trim(str){  //删除左右两端的空格
       return str.replace(/(^\s*)|(\s*$)/g, "");
   } 


var parentbject;
window.gncity_suggest = function(){
	this.Remoreurl = ''; // 远程URL地址
	this.object = '';
	this.id2 = '';
	this.taskid = 0;
	this.delaySec = 100; // 默认延迟多少毫秒出现提示框
	this.lastkeys_val = 0;
	this.lastinputstr = '';
	/**
	* 初始化类库
	*/
	this.init_zhaobussuggest=  function(){
		var objBody = document.getElementsByTagName("body").item(0);
		var objiFrame = document.createElement("iframe");
		var objplatform = document.createElement("div");
		objiFrame.setAttribute('id','getiframe');
		objiFrame.style.position = 'absolute';
		objiFrame.style.height = '80px';
	//	objiFrame.style.display = 'none';
		objplatform.setAttribute('id','getplatform');
		objplatform.setAttribute('align','left');
		objBody.appendChild(objiFrame);
		objiFrame.document.body.appendChild(objplatform);
		if(!document.all) {
			window.document.addEventListener("click",this.hidden_suggest,false);
		}else{
			window.document.attachEvent("onclick",this.hidden_suggest);
		}
		
	}
	/***************************************************fill_div()*********************************************/
	//函数功能：动态填充div的内容，该div显示所有的提示内容
	//函数参数：allplat 一个字符串数组，包含了所有可能的提示内容
	this.fill_div = function(allplat,pagenum){
		var msgplat = '';
		var all = '';
		var spell = '';
		var chinese = '';
		var platkeys = this.object.value;
        platkeys=this.ltrim(platkeys);
		if(!platkeys){
			msgplat += '<table class="hint" width="210"><tr align="left"><td class="tdleft" height="10" align="left">输入中文/拼音或&uarr;&darr;选择</td></tr></table><table width="210" class="mout" height="2"><tr><td></td></tr></table>';
			for(i=0;i<allplat.length;i++){
			    all=allplat[i].split(",");
				spell=all[0];
				chinese=all[1];
				szm=all[2];
				msgplat += '<table class="mout" width="210"><tr onclick="parentbject.add_input_text(\'' + chinese + '\',\'' + szm + '\')"><td class="tdleft" height="10" align="left">'+ spell +
				       '</td><td class="tdright" align="right">' + chinese + '</td><td style="display:none">' + szm + '</td></tr></table>';
			}
        }
		else {
			if(allplat.length < 1 || !allplat[0]){
				msgplat += '<table class="hint" width="210"><tr align="left"><td class="tdleft" height="10" align="left">对不起，找不到：'+platkeys+'</td></tr></table><table width="210" class="mout" height="2"><tr><td></td></tr></table>';

			}
			else{
			   msgplat += '<table class="hint" width="210"><tr align="left"><td class="tdleft" height="10" align="left">'+platkeys+'，按拼音排序</td></tr></table><table width="210" class="mout" height="2"><tr><td></td></tr></table>';
			   var pageCount = 12;
			   var pageIndex = pageCount * (pagenum - 1);
			   var count = 1;
			   for(i=pageIndex;i<allplat.length;i++){
					all=allplat[i].split(",");
					spell=all[0];
					chinese=all[1];
					szm=all[2];
					msgplat += '<table class="mout" width="210"><tr onclick="parentbject.add_input_text(\'' + chinese + '\',\'' + szm + '\')"><td class="tdleft" height="10" align="left">'+ spell +
				       '</td><td class="tdright" align="right">' + chinese + '</td><td style="display:none">' + szm + '</td></tr></table>';
				   
				    if(count++ == pageCount)  break;
				}
				
				if (allplat.length > pageCount) {
				    msgplat += '<table width="210" class="hint" height="2"><tr><td></td></tr></table><table class="hint" width="210"><tr align="left"><td class="tdleft" height="10" align="center">';
				    var spanPre = '';
				    var spanNex = '';
				    if (pagenum > 1) {
				    	spanPre = '<SPAN><a href="javascript:gnsuggest.localtextFY(' + (pagenum - 1) + ');gnsuggest.show_suggest()">上一页</a></SPAN>&nbsp;&nbsp;&nbsp;';
				    }
				    if ((allplat.length - pageIndex) > pageCount) {
				    	spanNex = '&nbsp;&nbsp;&nbsp;<SPAN><a href="javascript:gnsuggest.localtextFY(' + (pagenum + 1) + ');gnsuggest.show_suggest()">下一页</a></SPAN>';
				    }
				    msgplat += spanPre + spanNex;
				    msgplat +='</td></tr></table>';
				}
				
			}
		}
		document.getElementById("getplatform").innerHTML =  msgplat;

		var nodes = document.getElementById("getplatform").childNodes;
		nodes[0].className = "hint";
		if(allplat.length >= 1 && allplat[0]){
			nodes[2].className = "selected";
		}
		this.lastkeys_val = 0;
		for(var i=2;i<nodes.length;i++){
			nodes[i].onmouseover = function(){
				this.className = "mover";
			}

			nodes[i].onmouseout = function(){
				if(parentbject.lastkeys_val==(parentIndexOf(this)-2)){this.className = "selected";}
				else{this.className = "mout";}
			}
		}
		document.getElementById("getiframe").style.width = document.getElementById("getplatform").clientWidth+2;
        document.getElementById("getiframe").style.height = document.getElementById("getplatform").clientHeight+2;
	}

	/***************************************************fix_div_coordinate*********************************************/
	//函数功能：控制提示div的位置，使之刚好出现在文本输入框的下面
	this.fix_div_coordinate = function(){
		var leftpos=0;
		var toppos=0;
		aTag = this.object;
		do {
			aTag = aTag.offsetParent;
			leftpos	+= aTag.offsetLeft;
			toppos += aTag.offsetTop;
		}while(aTag.tagName!="BODY");
		document.getElementById("getiframe").style.width = this.object.offsetWidth + 'px';
		if(document.layers){
			document.getElementById("getiframe").style.left = this.object.offsetLeft	+ leftpos + "px";
			document.getElementById("getiframe").style.top = this.object.offsetTop +	toppos + this.object.offsetHeight + 2 + "px";
		}else{
			document.getElementById("getiframe").style.left =this.object.offsetLeft	+ leftpos  +"px";
			document.getElementById("getiframe").style.top = this.object.offsetTop +	toppos + this.object.offsetHeight + 'px';
		}
		document.getElementById("getplatform").style.width = this.object.offsetWidth + 'px';
		if(document.layers){
			document.getElementById("getplatform").style.left = this.object.offsetLeft	+ leftpos + "px";
			document.getElementById("getplatform").style.top = this.object.offsetTop +	toppos + this.object.offsetHeight + 2 + "px";
		}else{
			document.getElementById("getplatform").style.left =this.object.offsetLeft	+ leftpos  +"px";
			document.getElementById("getplatform").style.top = this.object.offsetTop +	toppos + this.object.offsetHeight + 'px';
		}
	}

    /***************************************************hidden_suggest*********************************************/
	//函数功能：隐藏提示框
	this.hidden_suggest = function (){
		this.lastkeys_val = 0;
		document.getElementById("getiframe").style.visibility = "hidden";
		document.getElementById("getplatform").style.visibility = "hidden";
	}

	/***************************************************show_suggest*********************************************/
	//函数功能：显示提示框
	this.show_suggest = function (){
		document.getElementById("getiframe").style.visibility = "visible";
		document.getElementById("getplatform").style.visibility = "visible";
	}

	this.is_showsuggest= function (){
		if(document.getElementById("getplatform").style.visibility == "visible") return true;else return false;
	}

	this.sleep = function(n){
		var start=new Date().getTime(); //for opera only
		while(true) if(new Date().getTime()-start>n) break;
	}

	this.ltrim = function (strtext){
		return strtext.replace(/[\$&\|\^*%#@! ]+/, '');
	}

    /***************************************************add_input_text*********************************************/
	//函数功能：当用户选中时填充相应的城市名字

	this.add_input_text = function (keys,szm){
		keys=this.ltrim(keys)
		this.object.value = keys;
		var id=this.object.id;
		document.getElementById(this.id2).value = szm;
		document.getElementById(id).style.color="#000000";
		document.getElementById(id).value=keys;
     }

	/***************************************************keys_handleup*********************************************/
	//函数功能：用于处理当用户用向上的方向键选择内容时的事件
	this.keys_handleup = function (){
		if(this.lastkeys_val > 0) this.lastkeys_val--;
		var nodes = document.getElementById("getplatform").childNodes;
		if(this.lastkeys_val < 0) this.lastkeys_val = nodes.length-1;
		var b = 0;
		for(var i=2;i<nodes.length;i++){
			if(b == this.lastkeys_val){
				nodes[i].className = "selected";
				this.add_input_text(nodes[i].childNodes[0].childNodes[0].childNodes[1].innerHTML,nodes[i].childNodes[0].childNodes[0].childNodes[2].innerHTML);
			}else{
				nodes[i].className = "mout";
			}
			b++;
		}
	}

	/***************************************************keys_handledown*********************************************/
	//函数功能：用于处理当用户用向下的方向键选择内容时的事件
	this.keys_handledown = function (){
		this.lastkeys_val++;
		var nodes = document.getElementById("getplatform").childNodes;
		if(this.lastkeys_val >= nodes.length-2) {
			this.lastkeys_val--;
			return;
		}
		var b = 0;
		for(var i=2;i<nodes.length;i++){
			if(b == this.lastkeys_val){
				nodes[i].className = "selected";
				this.add_input_text(nodes[i].childNodes[0].childNodes[0].childNodes[1].innerHTML,nodes[i].childNodes[0].childNodes[0].childNodes[2].innerHTML);
			}else{
				nodes[i].className = "mout";
			}
			b++;
		}
	}

	this.ajaxac_getkeycode = function (e)
	{
		var code;
		if (!e) var e = window.event;
		if (e.keyCode) code = e.keyCode;
		else if (e.which) code = e.which;
		return code;
	}

	/***************************************************keys_enter*********************************************/
	//函数功能：用于处理当用户回车键选择内容时的事件
	this.keys_enter = function (){
		var nodes = document.getElementById("getplatform").childNodes;
		for(var i=2;i<nodes.length;i++){
			if(nodes[i].className == "selected"){
				this.add_input_text(nodes[i].childNodes[0].childNodes[0].childNodes[1].innerHTML,nodes[i].childNodes[0].childNodes[0].childNodes[2].innerHTML);
			}
		}
		this.hidden_suggest();
	}

    /***************************************************display*********************************************/
	//函数功能：入口函数，将提示层div显示出来
	//输入参数：object 当前输入所在的对象，如文本框
	//输入参数：e IE事件对象
	this.display = function (object,id2,e){
		this.id2 = id2;
		if(!document.getElementById("getplatform")) this.init_zhaobussuggest();
		if (!e) e = window.event;
		e.stopPropagation;
		e.cancelBubble = true;
		if (e.target) targ = e.target;  else if (e.srcElement) targ = e.srcElement;
		if (targ.nodeType == 3)  targ = targ.parentNode;

		var inputkeys = this.ajaxac_getkeycode(e);
		switch(inputkeys){
			case 38: //向上方向键
				this.keys_handleup(object.id);
			    return;break;
			case 40: //向下方向键
				if(this.is_showsuggest()) this.keys_handledown(object.id); else this.show_suggest();
			    return;break;
			case 39: //向右方向键
				return;break;
			case 37: //向左方向键
				return;break;
			case 13: //对应回车键
			    this.keys_enter();
			    return;break;
			case 18: //对应Alt键
				this.hidden_suggest();
			    return;break;
			case 27: //对应Esc键
				this.hidden_suggest();
			    return;break;
		}

		//object.value = this.ltrim(object.value);
		this.object = object;
		//if(object.value == this.lastinputstr) return;else this.lastinputstr = object.value;
		if(window.opera) this.sleep(100);//延迟0.1秒
		parentbject = this;
		if(this.taskid) window.clearTimeout(this.taskid);
        this.taskid=setTimeout("parentbject.localtext();" , this.delaySec)
		//this.taskid = setTimeout("parentbject.remoteurltext();" , this.delaySec);

	}

	//函数功能：从本地js数组中获取要填充到提示层div中的文本内容
	this.localtext = function(){
		var id=this.object.id;
        var suggestions="";
        suggestions=this.getSuggestionByName();
		suggestions=suggestions.substring(0,suggestions.length-1);

		parentbject.show_suggest();
		parentbject.fill_div(suggestions.split(';'),1);
		parentbject.fix_div_coordinate();
	}
	
	//分页而用
	this.localtextFY = function(pageNum){
		var id=this.object.id;
        var suggestions="";
        suggestions=this.getSuggestionByName();
		suggestions=suggestions.substring(0,suggestions.length-1);

		parentbject.show_suggest();
		parentbject.fill_div(suggestions.split(';'),pageNum);
		parentbject.fix_div_coordinate();
	}

	/***************************************************getSuggestionByName*********************************************/
	//函数功能：从本地js数组中获取要填充到提示层div中的城市名字
	this.getSuggestionByName = function(){
		platkeys = this.object.value;
		var str="";
        platkeys=this.ltrim(platkeys);
		if(!platkeys){
			for(i=0;i<gncommoncitys.length;i++){
				str+=gncommoncitys[i][2]+","+gncommoncitys[i][1]+","+gncommoncitys[i][0]+";";
			}
			return str;
        }
		else{
		   platkeys=platkeys.toUpperCase();
			for(i=0;i<gncitys.length;i++){
			    if(this.getLeftStr(gncitys[i][0],platkeys.length).toUpperCase()==platkeys||
				   (gncitys[i][1].toUpperCase().indexOf(platkeys)!=-1)||
				   this.getLeftStr(gncitys[i][2],platkeys.length).toUpperCase()==platkeys||
				   this.getLeftStr(gncitys[i][3],platkeys.length).toUpperCase()==platkeys)
					str+=gncitys[i][2]+","+gncitys[i][1]+","+gncitys[i][0]+";";
			}
			return str;
		}
	}

	/***************************************************getLeftStr************* *************************************/
    //函数功能：得到左边的字符串
    this.getLeftStr = function(str,len){

        if(isNaN(len)||len==null){
            len = str.length;
        }
        else{
            if(parseInt(len)<0||parseInt(len)>str.length){
                len = str.length;
             }
        }
        return str.substr(0,len);
    }

	/***************************************************parentIndexOf************* *************************************/
    //函数功能：得到子结点在父结点的位置
	function parentIndexOf(node){
	  for (var i=0; i<node.parentNode.childNodes.length; i++){
			if(node==node.parentNode.childNodes[i]){return i;}
	  }
   }


}

function showSearch(obj,type){
    if(type){
        if(obj.value==""){
			obj.style.color="#C1C1C1";
			obj.value="中文/拼音";
		}
    }else{
        if(obj.value=="中文/拼音"){
			obj.style.color="#000000";
            obj.value="";
		}
    }
}