﻿// Java Documen
document.write('<style type="text/css">');
document.write('#getplatform {position:absolute;background-color:#CBDEE7;visibility:hidden;color:#0099FF;border:1px #ccc solid;border-color:#0099FF;list-style:none;cursor:pointer;}');
document.write('#getplatform iframe{display:none;/*sorry for IE5*/display/**/:block;/*sorry for IE5*/position:absolute;/*must have*/top:0;/*must have*/left:0;/*must have*/z-index:-1;/*must have*/filter:mask();/*must have*/width: 100%;/*must have for any big value*/height: 100%;/*must have for any big value*/}');
document.write('.hint{border-bottom:1px dashed #C1C1C1;background: #FFFFFF ;color: #656565;font-size: 12px;padding-left:6px;}');
document.write('.mover {padding-left:6px;line-height:120%;cursor: pointer;font-size: 12px;color: #0099FF;border-top-width: 1px;border-bottom-width: 1px;border-top-style: solid;border-bottom-style: solid;border-top-color: #1E5075;border-bottom-color: #1E5075;background-color: #B1D0E0;}');
document.write('.mout { background: #FFFFFF ; line-height:120%;border-top:1px solid #FFFFFF; border-bottom:1px solid #FFFFFF ;padding-left:6px;font-size: 12px;color: #0099FF;}');
document.write('.selected{line-height:120%;font-size: 12px;padding-left:6px;background-color: #0099FF;border-top-width: 1px;border-bottom-width: 1px;border-top-style: solid;border-bottom-style: solid;border-top-color: #DFEEFF;border-bottom-color: #DFEEFF;color: #FFFFFF !important;}');
document.write('.tdleft{font-size: 12px;padding-left:6px;}');
document.write('.tdright{padding-right:4px;}');
document.write('</style>');

//酒店根据城市查找三字码 
function getThreeWordByCitysFlight(cityName) 
{ 
        var threeWord = ""; 
        for(var i = 0,len = citysFlight.length;i<len;i++) 
        { 
                if(cityName == citysFlight[i][1]) 
                { 
                        threeWord = citysFlight[i][0]; 
                        break; 
                } 
        } 
        return threeWord; 
} 

//初始化常用城市
var commoncitys,citys;

var commoncitysHotel = new Array();

var citysHotel = new Array();

var commoncitysFlight = new Array();
commoncitysFlight[0]=new Array('SZX','深圳','Shenzhen','SZ');
commoncitysFlight[1]=new Array('PEK','北京','Beijing','BJ');
commoncitysFlight[2]=new Array('SHA','上海虹桥','SHANGHAIHONGQIAO','SHHQ');
commoncitysFlight[3]=new Array('CAN','广州','Guangzhou','GZ');
commoncitysFlight[4]=new Array('CTU','成都','Chengdu','CD');
commoncitysFlight[5]=new Array('HGH','杭州','Hangzhou','HZ');
commoncitysFlight[6]=new Array('CSX','长沙','Changsha','CS');
commoncitysFlight[7]=new Array('CKG','重庆','Chongqing','CQ');
commoncitysFlight[8]=new Array('KMG','昆明','Kunming','KM');
commoncitysFlight[9]=new Array('XIY','西安','Xian','XA');
commoncitysFlight[10]=new Array('WUH','武汉','Wuhan','WH');
commoncitysFlight[11]=new Array('NKG','南京','Nanjing','NJ');
commoncitysFlight[12]=new Array('TAO','青岛','Qingdao','QD');
commoncitysFlight[13]=new Array('SYX','三亚','Sanya','SY');
commoncitysFlight[14]=new Array('XMN','厦门','Xiamen','XM');


//初始化各个城市
var citysFlight=new Array();
// A

citysFlight[0]=new Array('AAT','阿勒泰','ALTAY','ALT'); 
citysFlight[1]=new Array('ACX','兴义','XINGYI','XY'); 
citysFlight[2]=new Array('AEB','百色','BAISE','BS'); 
citysFlight[3]=new Array('AKA','安康','ANKANG','AK'); 
citysFlight[4]=new Array('AKU','阿克苏','AKESU','AKS'); 
citysFlight[5]=new Array('AOG','鞍山','ANSHAN','AS'); 
citysFlight[6]=new Array('AQG','安庆','ANQING','AQ'); 
citysFlight[7]=new Array('AVA','安顺','ANSHUN','AS'); 
citysFlight[8]=new Array('AYN','安阳','ANYANG','AY'); 
citysFlight[9]=new Array('BAV','包头','BAOTOU','BT'); 
citysFlight[10]=new Array('BFU','蚌埠','BENGBU','BB'); 
citysFlight[11]=new Array('BHY','北海','BEIHAI','BH'); 
citysFlight[12]=new Array('BSD','保山','BAOSHAN','BS'); 
citysFlight[13]=new Array('CAN','广州','GUANGZHOU','GZ'); 
citysFlight[14]=new Array('CCC','潮州','CHAOZHOU','CZ'); 
citysFlight[15]=new Array('CGD','常德','CHANGDE','CD'); 
citysFlight[16]=new Array('CGO','郑州','ZHENGZHOU','ZZ'); 
citysFlight[17]=new Array('CGQ','长春','CHANGCHUN','CC'); 
citysFlight[18]=new Array('CHG','朝阳','CHAOYANG','CY'); 
citysFlight[19]=new Array('CHW','酒泉','JIUQUAN','JQ'); 
citysFlight[20]=new Array('CIF','赤峰','CHIFENG','CF'); 
citysFlight[21]=new Array('CIH','长治','CHANGZHI','CZ'); 
citysFlight[22]=new Array('CKG','重庆','CHONGQING','CQ'); 
citysFlight[23]=new Array('CNI','长海','CHANGHAI','CH'); 
citysFlight[24]=new Array('CSX','长沙','CHANGSHA','CS'); 
citysFlight[25]=new Array('CTU','成都','CHENGDU','CD'); 
citysFlight[26]=new Array('CYI','嘉义','CHIAYI','JY'); 
citysFlight[27]=new Array('CZX','常州','CHANGZHOU','CZ'); 
citysFlight[28]=new Array('DAT','大同','DATONG','DT'); 
citysFlight[29]=new Array('DAX','达县','DAXIAN','DX'); 
citysFlight[30]=new Array('DDG','丹东','DANDONG','DD'); 
citysFlight[31]=new Array('DIG','香格里拉','XIANGGELILA','XGLL'); 
citysFlight[32]=new Array('DLC','大连','DALIAN','DL'); 
citysFlight[33]=new Array('DLU','大理','DALI','DL'); 
citysFlight[34]=new Array('DNH','敦煌','DUNHUANG','DH'); 
citysFlight[35]=new Array('DOY','东营','DONGYING','DY'); 
citysFlight[36]=new Array('DSN','鄂尔多斯','EERDUOSI','EEDS'); 
citysFlight[37]=new Array('DYG','张家界','ZHANGJIAJIE','ZJJ'); 
citysFlight[38]=new Array('DZU','大足','DAZU','DZ'); 
citysFlight[39]=new Array('ENH','恩施','ENSHI','ES'); 
citysFlight[40]=new Array('ENY','延安','YANAN','YA'); 
citysFlight[41]=new Array('FOC','福州','FUZHOU','FZ'); 
citysFlight[42]=new Array('FOG','阜阳','FUYANG','FY'); 
citysFlight[43]=new Array('FUG','阜阳','FUYANG','FY'); 
citysFlight[44]=new Array('FUO','佛山','FOSHAN','FS'); 
citysFlight[45]=new Array('FYN','富蕴','FUYUN','FY'); 
citysFlight[46]=new Array('GHN','广汉','GUANGHAN','GH'); 
citysFlight[47]=new Array('GOQ','格尔木','GEERMU','GEM'); 
citysFlight[48]=new Array('GYS','广元','GUANGYUAN','GY'); 
citysFlight[49]=new Array('HAK','海口','HAIKOU','HK'); 
citysFlight[50]=new Array('HDG','邯郸','HANDAN','HD'); 
citysFlight[51]=new Array('HEK','黑河','HEIHE','HH'); 
citysFlight[52]=new Array('HET','呼和浩特','HOHHOT','HHHT'); 
citysFlight[53]=new Array('HFE','合肥','HEFEI','HF'); 
citysFlight[54]=new Array('HGH','杭州','HANGZHOU','HZ'); 
citysFlight[55]=new Array('HIN','清州','CHINJU','QZ'); 
citysFlight[56]=new Array('HJJ','芷江','ZHIJIANG','ZJ'); 
citysFlight[57]=new Array('HKG','香港','HONGKONG','XG'); 
citysFlight[58]=new Array('HLD','海拉尔','HAILAR','HLE'); 
citysFlight[59]=new Array('HLH','乌兰浩特','ULANHOT','WLHT'); 
citysFlight[60]=new Array('HMI','哈密','HAMI','HM'); 
citysFlight[61]=new Array('HNY','衡阳','HENGYANG','HY'); 
citysFlight[62]=new Array('HRB','哈尔滨','HAERBIN','HEB'); 
citysFlight[63]=new Array('HSN','舟山','ZHOUSHAN','ZS'); 
citysFlight[64]=new Array('HTN','和田','HETIAN','HT'); 
citysFlight[65]=new Array('HUZ','徽州','HUIZHOU','HZ'); 
citysFlight[66]=new Array('HYN','台州黄岩','TAIZHOUHUANGYAN','TZHY'); 
citysFlight[67]=new Array('HZG','汉中','HANZHONG','HZ'); 
citysFlight[68]=new Array('HZH','黎平','LIPING','LP'); 
citysFlight[69]=new Array('INC','银川','YINCHUAN','YC'); 
citysFlight[70]=new Array('IQM','且末','QIEMO','QM'); 
citysFlight[71]=new Array('IQN','庆阳','QINGYANG','QY'); 
citysFlight[72]=new Array('JDZ','景德镇','JINGDEZHEN','JDZ'); 
citysFlight[73]=new Array('JGN','嘉峪关','JIAYUGUAN','JYG'); 
citysFlight[74]=new Array('JGS','井冈山','jinggangshan','JGS'); 
citysFlight[75]=new Array('JHG','西双版纳','XISHUANGBANNA','XSBN'); 
citysFlight[76]=new Array('JIL','吉林','JILIN','JL'); 
citysFlight[77]=new Array('JIU','九江','JIUJIANG','JJ'); 
citysFlight[78]=new Array('JJN','泉州晋江','JINJIANG','QZJJ'); 
citysFlight[79]=new Array('JMU','佳木斯','JIAMUSI','JMS'); 
citysFlight[80]=new Array('JNG','济宁','JINING','JN'); 
citysFlight[81]=new Array('JNZ','锦州','JINZHOU','JZ'); 
citysFlight[82]=new Array('JUZ','衢州','QUZHOU','HZ'); 
citysFlight[83]=new Array('JZH','九寨沟','JIUZHAIGOU','JZG'); 
citysFlight[84]=new Array('KCA','库车','KUQA','KC'); 
citysFlight[85]=new Array('KHG','喀什','KASHI','KS'); 
citysFlight[86]=new Array('KHH','高雄','KAOHSIUNG','GX'); 
citysFlight[87]=new Array('KHN','南昌','NANCHANG','NC'); 
citysFlight[88]=new Array('KMG','昆明','KUNMING','KM'); 
citysFlight[89]=new Array('KNC','吉安','JIAN','JA'); 
citysFlight[90]=new Array('KOW','赣州','GANZHOU','GZ'); 
citysFlight[91]=new Array('KRL','库尔勒','KORLA','KEL'); 
citysFlight[92]=new Array('KRY','克拉玛依','KELAMAYI','KLMY'); 
citysFlight[93]=new Array('KWE','贵阳','GUIYANG','GY'); 
citysFlight[94]=new Array('KWJ','光州','KWANGJU','GZ'); 
citysFlight[95]=new Array('KWL','桂林','GUILIN','GL'); 
citysFlight[96]=new Array('LHN','梨山','LISHAN','LS'); 
citysFlight[97]=new Array('LHW','兰州','LANZHOU','LZ'); 
citysFlight[98]=new Array('LIA','梁平','LIANGPING','LP'); 
citysFlight[99]=new Array('LJG','丽江','LIJIANG','LJ'); 
citysFlight[100]=new Array('LLF','永州','YONGZHOU','YZ'); 
citysFlight[101]=new Array('LNJ','临沧','LINCANG','LC'); 
citysFlight[102]=new Array('LUM','芒市','MANGSHI','MS'); 
citysFlight[103]=new Array('LUZ','庐山','LUSHAN','LS'); 
citysFlight[104]=new Array('LXA','拉萨','LHASA','LS'); 
citysFlight[105]=new Array('LXI','林西','LINXI','LX'); 
citysFlight[106]=new Array('LYA','洛阳','LUOYANG','LY'); 
citysFlight[107]=new Array('LYG','连云港','LIANYUNGANG','LYG'); 
citysFlight[108]=new Array('LYI','临沂','LINYI','LY'); 
citysFlight[109]=new Array('LZH','柳州','LIUZHOU','LZ'); 
citysFlight[110]=new Array('LZO','泸州','LUZHOU','LZ'); 
citysFlight[111]=new Array('LZY','林芝','LINZHI','LZ'); 
citysFlight[112]=new Array('MDG','牡丹江','MUDANJIANG','MDJ'); 
citysFlight[113]=new Array('MFM','澳门','MACAU','AM'); 
citysFlight[114]=new Array('MIG','绵阳','MIANYANG','MY'); 
citysFlight[115]=new Array('MXZ','梅县','MEIXIAN','MX'); 
citysFlight[116]=new Array('NAO','南充','NANCHONG','NC'); 
citysFlight[117]=new Array('NAY','南苑','NANYUAN','NY'); 
citysFlight[118]=new Array('NDG','齐齐哈尔','QIQIHAR','QQHE'); 
citysFlight[119]=new Array('NGB','宁波','NINGBO','NB'); 
citysFlight[120]=new Array('NKG','南京','NANJING','NJ'); 
citysFlight[121]=new Array('NLT','那拉提','NANATI','NLT'); 
citysFlight[122]=new Array('NNG','南宁','NANNING','NN'); 
citysFlight[123]=new Array('NNY','南阳','NANYANG','NY'); 
citysFlight[124]=new Array('NTG','南通','NANTONG','NT'); 
citysFlight[125]=new Array('NZH','满洲里','manzhouli','MZL'); 
citysFlight[126]=new Array('OHE','漠河','MOHE','MH'); 
citysFlight[127]=new Array('OHE','漠河','MOHE','MH'); 
citysFlight[128]=new Array('PEK','北京','BEIJING','BJ'); 
citysFlight[129]=new Array('SHA','上海虹桥','SHANGHAIHONGQIAO','SHHQ'); 
citysFlight[130]=new Array('PZI','攀枝花','PANZHIHUA','PZH'); 
citysFlight[131]=new Array('PVG','上海浦东','SHANGHAIPUDONG','SHPD');  
citysFlight[132]=new Array('SHE','沈阳','SHENYANG','SY'); 
citysFlight[133]=new Array('SHP','秦皇岛','QINGHUANGDAO','QHD'); 
citysFlight[134]=new Array('SHS','沙市','SHASHI','SS'); 
//citysFlight[135]=new Array('SIA','西安','xian','xa'); 
citysFlight[135]=new Array('YUS','玉树','YUSHU','YS'); 
citysFlight[136]=new Array('SJW','石家庄','SHIJIAZHUANG','SJZ');  
citysFlight[137]=new Array('SWA','汕头','SHANTOU','ST'); 
citysFlight[138]=new Array('SYM','思茅','SIMAO','SM'); 
citysFlight[139]=new Array('SYX','三亚','SANYA','SY'); 
citysFlight[140]=new Array('SZV','苏州','SUZHOU','SZ'); 
citysFlight[141]=new Array('SZX','深圳','SHENZHEN','SZ'); 
citysFlight[142]=new Array('TAO','青岛','QINGDAO','QD'); 
citysFlight[143]=new Array('TCG','塔城','TACHENG','TC'); 
citysFlight[144]=new Array('TCZ','腾冲','TENGCHONG','TC'); 
citysFlight[145]=new Array('TEN','铜仁','TONGREN','TR'); 
citysFlight[146]=new Array('TGO','通辽','TONGLIAO','TL'); 
citysFlight[147]=new Array('TNA','济南','JINAN','JN'); 
citysFlight[148]=new Array('TNH','通化','TONGHUA','TH'); 
citysFlight[149]=new Array('TNN','台南','TAINAN','TN'); 
citysFlight[150]=new Array('THQ','天水','TIANSHUI','TS'); 
citysFlight[151]=new Array('TOY','富山','TOYAMA','FS'); 
citysFlight[152]=new Array('TPE','台北','TAIPEI','TB'); 
citysFlight[153]=new Array('TSN','天津','TIANJIN','TJ'); 
citysFlight[154]=new Array('TXG','台中','TAICHUNG','TZ'); 
citysFlight[155]=new Array('TXN','黄山','HUANGSHANG','HS'); 
citysFlight[156]=new Array('TYN','太原','TAIYUAN','TY'); 
citysFlight[157]=new Array('URC','乌鲁木齐','URUMQI','WLMQ'); 
citysFlight[158]=new Array('UYN','榆林','YULIN','YL'); 
citysFlight[159]=new Array('VTE','万象','VIENTIANE','WX'); 
citysFlight[160]=new Array('WEF','潍坊','WEIFANG','WF'); 
citysFlight[161]=new Array('WEH','威海','WEIHAI','WH'); 
citysFlight[162]=new Array('WHU','芜湖','WUHU','WH'); 
citysFlight[163]=new Array('WNH','文山','WENSHAN','WS'); 
citysFlight[164]=new Array('WNZ','温州','WENZHOU','WZ'); 
citysFlight[165]=new Array('WUA','乌海','WUHAI','WH'); 
citysFlight[166]=new Array('WUH','武汉','WUHAN','WH'); 
citysFlight[167]=new Array('WUS','武夷山','WUYISHAN','WYS'); 
citysFlight[168]=new Array('WUX','无锡','WUXI','WX'); 
citysFlight[169]=new Array('WUZ','梧州','WUZHOU','WZ'); 
citysFlight[170]=new Array('WXN','万州','WANXIAN','WZ'); 
citysFlight[171]=new Array('WXN','万县','WANXIAN','WX'); 
citysFlight[172]=new Array('XEN','兴城','XINGCHENG','XC'); 
citysFlight[173]=new Array('XFN','襄樊','XIANGFAN','XF'); 
citysFlight[174]=new Array('XIC','西昌','XICHANG','XC'); 
citysFlight[175]=new Array('XIL','锡林浩特','XILINHOT','XLHT'); 
citysFlight[176]=new Array('XIN','兴宁','XINGNING','XN'); 
citysFlight[177]=new Array('XIY','西安','XIAN','XA'); 
citysFlight[178]=new Array('XMN','厦门','XIAMEN','XM'); 
citysFlight[179]=new Array('XNN','西宁','XINING','XN'); 
citysFlight[180]=new Array('XNT','邢台','XINGTAI','XT'); 
citysFlight[181]=new Array('XUZ','徐州','XUZHOU','XZ'); 
citysFlight[182]=new Array('YBP','宜宾','YIBIN','YB'); 
citysFlight[183]=new Array('YCU','运城','YUNCHENG','YC'); 
citysFlight[184]=new Array('YIH','宜昌','YICHANG','YC'); 
citysFlight[185]=new Array('YIN','伊宁','YINING','YN'); 
citysFlight[186]=new Array('YIW','义乌','YIWU','YW'); 
citysFlight[187]=new Array('YLN','铱兰','YILAN','YL'); 
citysFlight[188]=new Array('YNJ','延吉','YANJI','YJ'); 
citysFlight[189]=new Array('YNT','烟台','YANTAI','YT'); 
citysFlight[190]=new Array('YNZ','盐城','YANCHENG','YC'); 
citysFlight[191]=new Array('YON','永州','YONGZHOU','YZ'); 
citysFlight[192]=new Array('YUC','运城','YUNCHENG','YC'); 
citysFlight[193]=new Array('ZAT','昭通','ZHAOTONG','ZT'); 
citysFlight[194]=new Array('ZHA','湛江','ZHANJIANG','ZJ'); 
citysFlight[195]=new Array('ZUH','珠海','ZHUHAI','ZH'); 
citysFlight[196]=new Array('KGT','康定','KANGDING','KD'); 
citysFlight[197]=new Array('DQA','大庆','DAQING','DQ'); 


commoncitys = commoncitysFlight;
citys = citysFlight;


//根据三字码查找城市
function getCityByThreeWord(threeWord)
{
	var cityCn = "";
	for(var i = 0,len = citys.length;i<len;i++)
	{
		if(threeWord == citys[i][0])
		{
			cityCn = citys[i][1];
			break;
		}
	}
	return cityCn;
}

//根据三字码查找城市
function getCodeByCity(threeWord,id)
{
	var cityCn = "";
	for(var i = 0,len = citys.length;i<len;i++)
	{
		if(threeWord == citys[i][0])
		{
			cityCn = citys[i][1];
			break;
		}
	}
	document.getElementById(id).value=cityCn;
	document.getElementById(id).style.color="#000000";
	//return cityCn;
}





//根据城市查找三字码
function getThreeWordByCity(cityName)
{
	var threeWord = "";
	for(var i = 0,len = citys.length;i<len;i++)
	{
		if(cityName == citys[i][1])
		{
			threeWord = citys[i][0];
			break;
		}
	}
	return threeWord;
}
var parentbject;
var city_suggest = function(){
	this.Remoreurl = ''; // 远程URL地址
	this.object = '';
	this.id2 = '';
	this.taskid = 0;
	this.delaySec = 200; // 默认延迟多少毫秒出现提示框
	this.lastkeys_val= 0;
	var lastkeys_val= 0;
	this.lastinputstr = '';	
	/**
	* 初始化类库
	*/
	this.init_zhaobussuggest=  function(){
		var objBody = document.body;
		var objiFrame = document.createElement("iframe");
		var objplatform = document.createElement("div");
                 
		objiFrame.setAttribute('id','getiframe');
		objiFrame.style.zindex='100';		
		objiFrame.style.position = 'absolute';
		objiFrame.style.width = '210px';
		objplatform.setAttribute('id','getplatform');
		objplatform.setAttribute('align','left');
		objplatform.style.zindex='10000';
		objBody.appendChild(objiFrame);
		objBody.appendChild(objplatform);
		
		var win=objBody || window
                
		if(!document.all) {
			objBody.addEventListener("click",this.hidden_suggest,false);
			
		}else{
			win.document.attachEvent("onclick",this.hidden_suggest);
			
		}
	}

	/***************************************************fill_div()*********************************************/
	//函数功能：动态填充div的内容，该div显示所有的提示内容
	//函数参数：allplat 一个字符串数组，包含了所有可能的提示内容
	this.fill_div = function(allplat){
		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>';
			   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>';
				}
			}
		}
		msgplat +='<iframe></iframe>'
		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;
			if(aTag==null)
			{
			break;
			}
		
			toppos += aTag.offsetTop;
			leftpos	+= aTag.offsetLeft;
		}while(aTag!=document.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';
		//document.getElementById("getiframe").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";
		//alert(document.getElementById("L_DateLayer").style.display);
		 if(document.getElementById("L_DateLayer").style.display=="block"){
			 document.getElementById("L_DateLayer").style.display="none";
			 }
	}
	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.id).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();
	}

 
function getEvent()
{
 if(document.all)    return window.event;//如果是ie
 func=getEvent.caller;
        while(func!=null){
            var arg0=func.arguments[0];
            if(arg0){if((arg0.constructor==Event || arg0.constructor ==MouseEvent) || (typeof(arg0)=="object" && arg0.preventDefault && arg0.stopPropagation)){return arg0;}            }
            func=func.caller;
        }
       return null;
}

    /***************************************************display*********************************************/
	//函数功能：入口函数，将提示层div显示出来
	//输入参数：object 当前输入所在的对象，如文本框
	//输入参数：e IE事件对象
	this.display = function (object,id2,e){	
		this.object = document.getElementById(object);
		this.id2 = document.getElementById(id2);
		if(!document.getElementById("getplatform")) this.init_zhaobussuggest();
		e = e || window.event;
		//var e=getEvent();
		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(this.object.id);
			    return;break;
			case 40: //向下方向键
			  
				if(this.is_showsuggest()){ this.keys_handledown(this.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);
		
		//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(';'));
		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<commoncitys.length;i++){
				str+=commoncitys[i][2]+","+commoncitys[i][1]+","+commoncitys[i][0]+";";
			}
			return str;
        }
		else{
		   platkeys=platkeys.toUpperCase();
			for(i=0;i<citys.length;i++){
			    if(this.getLeftStr(citys[i][0],platkeys.length).toUpperCase()==platkeys||
				   (citys[i][1].toUpperCase().indexOf(platkeys)!=-1)||
				   this.getLeftStr(citys[i][2],platkeys.length).toUpperCase()==platkeys||
				   this.getLeftStr(citys[i][3],platkeys.length).toUpperCase()==platkeys)
					str+=citys[i][2]+","+citys[i][1]+","+citys[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){  
	var objvalue=document.getElementById(obj);
	var hid=document.getElementById('hid');
    if(type==1){   
        if(objvalue.value==""){
			objvalue.style.color="#C1C1C1";
			objvalue.value="中文/拼音";
		}
		 //2010-7-29修改 添加 else
		else   
		{				   
	        if(objvalue.value !="中文/拼音"&&suggest!=null)
	        {	          
	            var tmpCode=getThreeWordByCity(objvalue.value);
	           suggest.object=objvalue;
	           if(obj=="ctl00_cphMiddle_city1")
	           {
	             suggest.id2=document.getElementById("ctl00_cphMiddle_scity");
                 if(tmpCode==undefined||tmpCode=="")    
                 {
                        objvalue.select();
                        objvalue.focus();
                          if(document.getElementById("ctl00_cphMiddle_lab_City1")!=undefined)
                        document.getElementById("ctl00_cphMiddle_lab_City1").innerHTML="出发城市不存在";  
                        if(hid!=undefined)                     
                        hid.value="false";   
                        return ;
                 }else  
                 {
                     var a1=document.getElementById("ctl00_cphMiddle_lab_City1");
                     if(a1!=undefined)
                        a1.innerHTML="";
                 }
	           }else if(obj=="ctl00_cphMiddle_city2")
	           {
	              suggest.id2=document.getElementById("ctl00_cphMiddle_ecity");
	              if(tmpCode==undefined||tmpCode=="")    
                  {
                        objvalue.select();
                        objvalue.focus();
                        if(document.getElementById("ctl00_cphMiddle_lab_City2")!=undefined)
                        document.getElementById("ctl00_cphMiddle_lab_City2").innerHTML="目的城市不存在";                     
                        if(hid!=undefined)    
                         hid.value="false";   
                        return ;
                  }
                  else  
                  {
                      var a2=document.getElementById("ctl00_cphMiddle_lab_City2");
                      if(a2!=undefined)                  
                        a2.innerHTML="";
                  }
	           }
	            if(hid!=undefined)    		           
	           hid.value="true";      	           
	           suggest.add_input_text(objvalue.value,tmpCode);     	          	           
	        }	        
		}
    }else{
        if(objvalue.value=="中文/拼音"||objvalue.value==""){
			objvalue.style.color="#000000";
           objvalue.value="";
		}
    }
//    document.getElementById("ctl00_cphMiddle_btnweatherselect").click();
}


 
 var suggest = new city_suggest();
 function search(){
	if(!checkform()){
	   return;
	}
	InlandForm.submit();

}

function change_iframe(idname,urlcity){
	idname.location.href=urlcity;
}
//改变搜索框文字
function changetext(thisid){
	if(thisid == "search1"){
		commoncitys = commoncitysHotel;
		citys = citysHotel;
		document.getElementById("hCity").value = "中文/拼音";
	}else if(thisid == "search2"){
		commoncitys = commoncitysFlight;
		citys = citysFlight;
		document.getElementById("bCity").value = "中文/拼音";
	}

	for(i=1; i<=3; i++)
	{
		var tdid="search"+i;
		document.getElementById(tdid).className="searchitem_b";
	}
	
	document.getElementById(thisid).className="searchitem_r";
}
// 搜索框更换
function closeothers(thisid) {
  if (thisid.style.display=="") { 
	hotel.style.display="none";
	plane.style.display="none";
	pkg.style.display="none";
	
    thisid.style.display="";
  }
  else{
  thisid.style.display="";
  }
}