var oPopup_E = window.createPopup();
var tr01_01_E = "#E7E3E7"; //第一行背景颜色
var tr01_02_E = "#D6D3D6"; //第二行背景颜色
var tr01_03_E = "#FFFFFF";
var tab01_E = "#FF6600";  //边框颜色
var kongj_E;
var kongjh_E;
var style_E_1 = 'style="font-weight: bold;color: #000000;height: 25px;font-size: 9pt;"';
var style_E_2 = 'style="BACKGROUND-COLOR: #F3F6FA; color: #333333;background-repeat:repeat-x; background-position:bottom; font-size: 9pt;"';
var style_E_3 = 'style="position: relative; left: 0px; top: 0px; width: 100%;overflow:hidden; text-overflow:ellipsis;"';

//北京|PEK|B  城市|三字代码|拼音首字母
var shcs_E = new Array("北京|PEK|B","上海虹桥|SHA|S","天津|TSN|T", "香港|HKG|H", "广州|CAN|G", "西雅图|SEA|S", "吉隆坡|KUL|K", "新加坡|SIN|S");
var qtcs_E = new Array("奥克兰|AKL|A","曼谷|BKK|B","布拉格维申斯科|BQS|B","布鲁塞尔|BRU|B","布加勒斯特|BUH|B","广州|CAN|G","长春|CGQ|C","芝加哥|CHI|C","重庆|CKG|C","哥本哈根|CPH|C","长沙|CSX|C","成都|CTU|C","德里|DEL|D","迪庆香格里拉|DIG|D","大连|DLC|D","底特律|DTW|D","平壤|FNJ|P","福州|FOC|F","法兰克福|FRA|F","比什凯克|FRU|B","格尔木|GOQ|G","海口|HAK|H","河内|HAN|H","赫尔辛基|HEL|H","呼和浩特|HET|H","广岛|HIJ|H","香港|HKG|H","普吉|HKT|P","海拉尔|HLD|H","哈尔滨|HRB|H","伊尔库茨克|IKT|I","银川|INC|Y","伊斯兰堡|ISB|I","景德镇|JDZ|J","纽约|JFK|N","雅加达|JKT|J","佳木斯|JMU|J","喀什|KHG|K","高雄|KHH|G","卡拉奇|KHI|K","大阪|KIX|O","昆明|KMG|K","吉隆坡|KUL|K","科威特|KWI|K","洛杉矶|LAX|L","伦敦|LON|L","拉萨|LXA|L","马德里|MAD|M","墨尔本|MEL|M","澳门|MFM|M","米兰|MIL|M","莫斯科|MOW|M","墨尼黑|MUC|M","齐齐哈尔|NDG|Q","名古屋|NGO|N","长崎|NGS|N","南京|NKG|N","冲绳|OKA|O","新西伯利亚|OVB|N","巴黎|PAR|P","波特兰|PDX|P","北京|PEK|B","金边|PNH|P","釜山|PUS|P","上海浦东|PVG|S","仰光|RGN|Y","罗马|ROM|R","西雅图|SEA|S","汉城|SEL|S","旧金山|SFO|S","苏比克湾|SFS|S","胡志明市|SGN|H","上海虹桥|SHA|S","沈阳|SHE|S","西安|SIA|X","新加坡|SIN|S","斯德哥尔摩|STO|S","悉尼|SYD|S","深圳|SZX|S","青岛|TAO|Q","济南|TNA|J","台南|TNN|T","台北|TPE|T","天津|TSN|T","台东|TTT|T","台中|TXG|T","东京|TYO|T","乌兰巴托|ULN|U","乌鲁木齐|URC|U","维也纳|VIE|V","万象|VTE|V","符拉迪沃斯托克|VVO|V","武汉|WUH|W","西安咸阳机场|XIY|X","温哥华|YVR|V","中甸|ZHD|Z","苏黎士|ZRH|Z","阿拉木图|ALA|A","东营|DGY|D","福岛|FKS|F","富蕴|FYN|F","梨山|LHN|L","马尼拉|MNL|M","阿姆斯特丹|AMS|A","安克雷奇|ANC|A","邦达|BPX|C","长海|CNI|C","大足|DZU|D","清州|HIN|C","且末|IQM|Q","库车|KCA|K","哈巴罗夫斯克|KHV|K","新泻|KIJ|N","鹿儿岛|KOJ|K","克拉玛依|KRY|K","加德满都|KTM|K","光州|KWJ|K","德宏芒市|LUM|M","大分|OIT|O","冈山|OKJ|O","槟城|PEN|P","沙加|SHJ|S","札幌|SPK|S","叶卡捷琳堡|SVX|E","大丘|TAE|T");
var ywzm_E = new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"); 
//var ywzm_E = new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","S","T","V","W","X","Y","Z"); 
var popup_E_gd=25;  //数据显示高度 
var popup_E_i; 
var popup_E_int0=0;
var popup_E_int1=0;
var popup_E_int2=0;
var popup_E_int3=0;


function Split_E(popup_E_str,popup_E_n,popup_E_s){ //字符串,取第几个数据,分割字符
	var popup_E_split=popup_E_str.split(popup_E_s);
	return popup_E_split[popup_E_n];
}


function popup_E(abc,def){
if(typeof(abc)=='string')
	kongj_E=document.all(abc);
else
	kongj_E=abc;
if(typeof(def)=='string')
	kongjh_E=document.all(def);
else
	kongjh_E=def;

var posLib = {
    getClientLeft:function (el) {
      var r = el.getBoundingClientRect();
      return r.left - this.getBorderLeftWidth(this.getCanvasElement(el));
    },

    getClientTop:    function (el) {
      var r = el.getBoundingClientRect();
      return r.top - this.getBorderTopWidth(this.getCanvasElement(el));
    },

    getLeft:    function (el) {
      return this.getClientLeft(el) + this.getCanvasElement(el).scrollLeft;
    },

    getTop:    function (el) {
      return this.getClientTop(el) + this.getCanvasElement(el).scrollTop;
    },

    getInnerLeft:    function (el) {
      return this.getLeft(el) + this.getBorderLeftWidth(el);
    },

    getInnerTop:    function (el) {
      return this.getTop(el) + this.getBorderTopWidth(el);
    },

    getWidth:    function (el) {
      return el.offsetWidth;
    },

    getHeight:    function (el) {
      return el.offsetHeight;
    },

    getCanvasElement:    function (el) {
      var doc = el.ownerDocument || el.document;    // IE55 bug
      if (doc.compatMode == "CSS1Compat")
        return doc.documentElement;
      else
        return doc.body;
    },

    getBorderLeftWidth:    function (el) {
      return el.clientLeft;
    },

    getBorderTopWidth:    function (el) {
      return el.clientTop;
    },

    getScreenLeft:    function (el) {
      var doc = el.ownerDocument || el.document;    // IE55 bug
      var w = doc.parentWindow;
      return w.screenLeft + this.getBorderLeftWidth(this.getCanvasElement(el)) + this.getClientLeft(el);
    },

    getScreenTop:    function (el) {
      var doc = el.ownerDocument || el.document;    // IE55 bug
      var w = doc.parentWindow;
      return w.screenTop  + this.getClientTop(el);//+ this.getBorderTopWidth(this.getCanvasElement(el))
    }
  }
  
popup_E_int0=0;
popup_E_int1=0;
popup_E_int2=0;
popup_E_int3=0;
var tab;
tab = '<table width="370" border="0" cellpadding="0" cellspacing="1" bgcolor="' +tab01_E+ '">';
tab+= '<tr>';
tab+= '<td>';
tab+= '<table width="100%" border="0" cellpadding="0" cellspacing="0" style="background-color:' +tr01_02_E+ ';">';
tab+= '  <tr align="center">';
tab+= '    <td height="23"'+style_E_1+'>请选择您要的城市</td>';
tab+= '  </tr>';
tab+= '  <tr align="center">';
tab+= '    <td height="23"'+style_E_2+'>';
tab+= '      <table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" style="font-size: 9pt"><tr><td width="50">首字母：</td><td><table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-size: 10pt"><tr align="center">';
for(var ywzm_E_i=0;ywzm_E_i<26;ywzm_E_i++){
	if(!ywzm_E[ywzm_E_i])break;
	tab+= '<td id=H_"'+ywzm_E[ywzm_E_i]+'"><label id="'+ywzm_E[ywzm_E_i]+'" style="color:#0000FF; cursor:hand" title="点击查看城市首字母为 '+ywzm_E[ywzm_E_i]+' 的城市">'+ywzm_E[ywzm_E_i]+'</label></td>';
}
tab+= '        <td id="H_SH"><label id="SH" style="color:#FF0000; cursor:hand" title="点击查看主要城市">SH</label></td>';
tab+= '      </tr></table></td></tr></table>';
tab+= '    </td>';
tab+= '  </tr>';
tab+= '  <tr align="center">';
tab+= '   <td id="popup_E_Tab">';
tab+= '    <table width="100%" border="0" cellspacing="1" cellpadding="0" style="font-size: 9pt">';

for(popup_E_i=0;popup_E_i<36;popup_E_i++){
	if(popup_E_i==0 || popup_E_i % 6 ==0){
		tab+= '  <tr align="center" style="background-color:' +tr01_03_E+ ';">';
	}
	if(shcs_E[popup_E_i]){
		tab+= '    <td height="'+popup_E_gd+'" width="14.3%" ID="popup_E_td_cszm_'+popup_E_int0+'" title="'+Split_E(shcs_E[popup_E_i],0,"|")+'" style="font-size: 9pt"><NOBR '+style_E_3+' ID="popup_E_NOBR_cszm_'+Split_E(shcs_E[popup_E_i],1,"|")+'_'+popup_E_int0+'">'+Split_E(shcs_E[popup_E_i],0,"|")+'</NOBR></td>';
		popup_E_int0++;
	}else{
		tab+= '    <td height="'+popup_E_gd+'" width="14.3%">&nbsp;</td>';
	}
	popup_E_int3 = popup_E_i+1;
	if(popup_E_int3 % 6 ==0){
		tab+= '  </tr>';
	}
}

tab+= '    </table>';
tab+= '   </td>';
tab+= '  </tr>';
tab+= '</table>';
tab+= '</td>';
tab+= '</tr>';
tab+= '</table>';

var newX = posLib.getClientLeft(kongj_E) + posLib.getCanvasElement(kongj_E).clientLeft;
var newY = posLib.getClientTop(kongj_E) + kongj_E.offsetHeight + posLib.getCanvasElement(kongj_E).clientTop;
oPopup_E.document.body.innerHTML = tab;
oPopup_E.document.body.onclick = Htc_OnClick_E;
oPopup_E.document.body.onmousemove = Htc_onmousemove_E;
oPopup_E.show(newX,newY,370,209,document.body);
}

function Htc_OnClick_E(){  //鼠标点击事件
var Htc_str;
var obj=this.document.parentWindow;
var e = obj.event.srcElement;
  if (e.tagName == "LABEL")  {
	  if(e.id!=""){
		  yc_dt_E(e.id);
	  }
  }
  if (e.tagName == "NOBR")  {
	  //f_z_E(Split_E(e.id,4,"_"));
	  f_z_E(oPopup_E.document.all(e.id).innerHTML);
	  oPopup_E.hide(); 
  }
  
  if (e.tagName == "TD"){//H_
	  if(e.id!=""){
		  if(e.id.length==1)yc_dt_E(Split_E(e.id,2,"_"));
	  }
  }
}

var ll="popup_E_td_cszm_0";
function Htc_onmousemove_E(){   //鼠标移动事件
var obj=this.document.parentWindow;
var e = obj.event.srcElement;
  if (e.tagName == "TD")  {
	  if(e.id!=""){turnrowcolor_E(e.id,ll);}
  }
  if (e.tagName == "NOBR")  {
	  if(e.id!=""){turnrowcolor_E("popup_E_td_cszm_"+Split_E(e.id,5,"_"),ll);}
  }
}

function turnrowcolor_E(ss,ls){   //鼠标移动TD背景颜色
 var bc="#FFD373";
 if(oPopup_E.document.all(ls))oPopup_E.document.all(ls).style.backgroundColor="";
 if(oPopup_E.document.all(ss))oPopup_E.document.all(ss).style.backgroundColor=bc;
 if(oPopup_E.document.all(ss))oPopup_E.document.all(ss).style.cursor="hand";
 ll=ss;	
}

//var yc_dt_E_cs_E="SH";
function yc_dt_E(int){
	var yc_dt_E_cs_E="SH";
	for(var k=0;k<26;k++){
		if(!ywzm_E[k])break;
		oPopup_E.document.all(ywzm_E[k]).style.color="#0000FF";
	}
	if(int!=yc_dt_E_cs_E){
		oPopup_E.document.all(yc_dt_E_cs_E).style.color="#0000FF";
		oPopup_E.document.all(int).style.color="#FF0000";
		yc_dt_E_cs_E=int;
		popup_E_tab(int,0);
	}else{
		oPopup_E.document.all(int).style.color="#FF0000";
		popup_E_tab(int,1);
	}
}

function popup_E_tab(str,lx){ //生成数据
	var popup_E_dat_i=0;
	var popup_E_dat_n;
	var popup_E_dat_tab="";
	var popup_E_dat =new Array()
	if(lx==0){
		for(popup_E_dat_n=0;popup_E_dat_n<qtcs_E.length;popup_E_dat_n++){
			if(Split_E(qtcs_E[popup_E_dat_n],2,"|")==str){
				popup_E_dat[popup_E_dat_i++]=qtcs_E[popup_E_dat_n];
			}
		}
	}else{
		popup_E_dat=shcs_E;
	}
	popup_E_int0=0;
	
	popup_E_dat_tab+= '<table width="100%" border="0" cellspacing="1" cellpadding="0" style="font-size: 9pt">';
	for(popup_E_dat_n=0;popup_E_dat_n<36;popup_E_dat_n++){
		if(popup_E_dat_n==0 || popup_E_dat_n % 6 ==0){
			popup_E_dat_tab+= '  <tr align="center" style="background-color:' +tr01_03_E+ ';">';
		}
		if(popup_E_dat[popup_E_dat_n]){
			popup_E_dat_tab+= '    <td height="'+popup_E_gd+'" width="14.3%" ID="popup_E_td_cszm_'+popup_E_int0+'" title="'+Split_E(popup_E_dat[popup_E_dat_n],0,"|")+'" style="font-size: 9pt"><NOBR '+style_E_3+' ID="popup_E_NOBR_cszm_'+Split_E(popup_E_dat[popup_E_dat_n],1,"|")+'_'+popup_E_int0+'">'+Split_E(popup_E_dat[popup_E_dat_n],0,"|")+'</NOBR></td>';
			popup_E_int0++;
		}else{
			popup_E_dat_tab+= '    <td height="'+popup_E_gd+'" width="14.3%">&nbsp;</td>';
		}
		popup_E_int3 = popup_E_dat_n+1;
		if(popup_E_int3 % 6 ==0){
			popup_E_dat_tab+= '  </tr>';
		}
	}
	popup_E_dat_tab+= '    </table>';
	oPopup_E.document.all("popup_E_Tab").innerHTML=popup_E_dat_tab;
}

function f_z_E(temp){    //赋值给控件  
  setCodevalue_E(temp);
  kongj_E.value=temp;
}
function setCodevalue_E(temp){
	var length=qtcs_E.length;
	for(i=0;i<length;i++){
		var tempArray=qtcs_E[i].split("|");
		if(tempArray[0]==temp){ 
//			kongj_E.codevalue=tempArray[1];
//			kongjh_E.value=tempArray[1]+tempArray[0];
			kongjh_E.value=tempArray[1];
			break;
		}
	}
}
