if(window.Element&&!Element.prototype.contains)Element.prototype.contains=function(o){if(this==o)return true;while(o=o.parentNode)if(o==this)return true;return false;}
if(!window._$)window._$=function (Id){return document.getElementById(Id);}
if (!window.getAbsPos) window.getAbsPos = function (o) { var p = new Object(); p.x = o.offsetLeft; p.y = o.offsetTop; while (o = o.offsetParent) { p.x += o.offsetLeft; p.y += o.offsetTop; } return p; }
var isWiki = /^(www\.)?wikitravel168.cn|country\.(lvyou168|code-design)\.cn$/gi.test(top.location.host), isEN = /^(www\.)?travel168\.net|travel168\.code-design\.cn$/ig.test(top.location.host)
, txtAttrib = isEN ? 'en' : 't', posAttrib = isEN ? 'enp' : (isWiki ? 'wikip' : 'cnp'), mapWidth = isWiki ? 534 : 414, mapHeight = isWiki ? 298 : 260;
document.write('<style type="text/css">\
	#dvMaps{position:relative;width:'+mapWidth+'px;height:'+mapHeight+'px;overflow:hidden;font-size:12px;}\
	#dvMaps .abct{position:absolute;z-index:200;background:transparent;font-family:Arial, Helvetica, sans-serif;line-height:15px;cursor:pointer;}\
	#dvMaps .swf{position:absolute;z-index:0;left:0px;top:0px;}\
	#dvMaps .mark{position:absolute;z-index:10;width:100%;height:100%;background-color:#fff;filter:alpha(opacity=0);opacity:0;}\
	#dvMaps .mapitem .mapct,#dvMaps .mapitemfn .mapctfn{background:url(http://www.lvyou168.com.cn/img_new/itemright.gif) no-repeat right top;padding-right:15px;line-height:15px;}\
	#dvMaps .mapitem,#dvMaps .mapitemfn{height:15px;background:url(http://www.lvyou168.com.cn/img_new/itemleft.gif) no-repeat;position:absolute;left:130px;top:40px;padding-left:5px;opacity:.75;filter:alpha(opacity=75);cursor:pointer;overflow:hidden;z-index:100;}\
	#dvMaps .mapitem .mapct div{background:#fff;}\
	#dvMaps .mapitemfn{background-image:url(http://www.lvyou168.com.cn/img_new/itemleft_b.gif);}\
	#dvMaps .mapitemfn .mapctfn{background-image:url(http://www.lvyou168.com.cn/img_new/itemright_b.gif);}\
	#dvMaps .mapitemfn .mapctfn div{background:#ffff00;}\
	#dvpopMapItems{position:absolute;border:solid 1px #cddef3;background:#fff;display:none;overflow:auto;padding:0px 3px 0px 3px; z-index:1000;white-space:nowrap;}\
	#dvpopMapItems a{display:block;text-decoration:none;line-height:20px;font-size:12px;color:#033967;outline:none;hidFocus:expression(this.hideFocus=true);}\
	#dvpopMapItems a:hover{background:#f3c965;}\
	</style>');
function RenderMaps(){
  var map=_$('dvMaps'),dv,ctdv;
  for(var i=1;i<arrCT.length;i++){
    dv=document.createElement('div');
    dv.id='mapItem'+arrCT[i].v;
    ctdv=document.createElement('div');
    ctdv.className = 'abct';
    ctdv.innerHTML = arrCT[i][txtAttrib];
    dv.innerHTML = '<div class="mapct"><div style="width:' + arrCT[i][posAttrib][2] + 'px">&nbsp;</div></div>';
	dv.className='mapitem';
	dv.setAttribute('itemIndex', arrCT[i].v);
	ctdv.setAttribute('itemIndex', arrCT[i].v);
	dv.style.left = arrCT[i][posAttrib][0] + 'px';
	ctdv.style.left = arrCT[i][posAttrib][0] + 5 + 'px';
	ctdv.style.top = dv.style.top = arrCT[i][posAttrib][1] + 'px';
	ctdv.onmouseover=dv.onmouseover=function(){var ndv=this.className=='abct'?_$('mapItem'+this.getAttribute('itemIndex')):this;ndv.className='mapitemfn';ndv.firstChild.className='mapctfn';}
	ctdv.onmouseout=dv.onmouseout=function(e){var ndv=this.className=='abct'?_$('mapItem'+this.getAttribute('itemIndex')):this;e=e||window.event;var too=e.toElement||e.relatedTarget;if(!too||ndv.contains(too))return false;ndv.className='mapitem';ndv.firstChild.className='mapct';}
	ctdv.onclick=dv.onclick=function(){
	  var nk=this.getAttribute('itemIndex'),ndv=this.className=='abct'?_$('mapItem'+nk):this,p=getAbsPos(ndv),pop=_$('dvpopMapItems'),html='',arr=arrCTY['k'+nk];

	  if(pop.getAttribute('itemIndex')==nk&&pop.style.display=='block'){pop.style.display='none';return false;}
	  if(pop!=document.body.lastChild)document.body.appendChild(pop);
	  pop.setAttribute('itemIndex',nk);
	  pop.style.cssText='';
	  if(arr.length>6)pop.style.height='120px';
	  pop.style.left=p.x+'px';
	  pop.style.top = p.y + this.offsetHeight + 1 + 'px';
	  for (var i = 0; i < arr.length; i++) html += '<a href="http://country.lvyou168.cn/' + arr[i].en + '/" target="_blank">' + (isEN ? (arr[i].dp ? arr[i].dp : arr[i].en.replace(/_/g,' ')) : arr[i].t) + '</a>';
	  pop.innerHTML=html;
	  pop.style.display='block';
	  if(pop.scrollHeight>pop.offsetHeight)pop.style.width=pop.offsetWidth+15+'px';
	  if(pop.offsetWidth<ndv.offsetWidth)pop.style.width=ndv.offsetWidth+'px';
	}
	map.appendChild(dv);
	map.appendChild(ctdv);
  }
}
document.write('<div id="dvMaps"><div class="mark">&nbsp;</div>\
<div class="swf"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+mapWidth+'" height="'+mapHeight+'">\
    <param name="movie" value="http://www.lvyou168.com.cn/img_new/maps'+(window.isWiki?'wiki':'')+'.swf"/>\
	<param name="wmode" value="transparent">\
    <param name="quality" value="high" />\
    <embed src="http://www.lvyou168.com.cn/img_new/maps'+(window.isWiki?'wiki':'')+'.swf" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+mapWidth+'" height="'+mapHeight+'"></embed>\
  </object></div></div>\
  <div id="dvpopMapItems"></div>');
function mouseup(e){e=e||window.event;var o=e.srcElement||e.target;;if(o.className=='mark'||!_$('dvMaps').contains(o))_$('dvpopMapItems').style.display='none';}
if(document.attachEvent)document.attachEvent('onmouseup',mouseup);
else if (document.addEventListener) document.addEventListener('mouseup', mouseup, false);
if(top.location.href.toLowerCase().indexOf('travel168')!=-1)
for(var i=0;i<arrCT.length;i++)arrCTY['k'+arrCT[i].v].sort(function(a,b){return a.en>b.en?1:-1; });
RenderMaps();
