var winrow=new Array('dmr');
var winno='',next_url='';
function $(id)
{
	return document.getElementById(id);
}
function get_request()
{
	var http_request = false;
	if(window.XMLHttpRequest)
	{
		http_request = new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		try 
		{
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try
			{
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e){}
		}
	}
	if (!http_request)
	{
		alert("不能创建XMLHttpRequest对象实例.");
		return false;
	}
	return http_request;
}

function line_map(lname)
{
	return (htmap)?'<a href="http://'+htmap+'.8684.cn/?k=pp&q='+lname+'" target="_blank">[电子地图]</a>':'';
}

function line_link(code,word,cls)
{
	return '<a href="http://'+location.hostname+'/x_'+code+'" '+((cls)?'class="'+cls+'"':'')+'>'+word+'</a>';
}
function station_link(code,word,cls)
{
	return '<a href="http://'+location.hostname+'/z_'+code+'" '+((cls)?'class="'+cls+'"':'')+'>'+word+'</a>';
}
function copy_clip(id,bk)
{
	var str=(document.all)?$(id).innerText:$(id).textContent;
	str=str.replace(/免费发送到手机.*$/,'');
  	str+="\r\n此信息来源于http://"+location.hostname;
	if(bk) return str;
	var obj = window.clipboardData;	
	obj.setData('Text',str);
	alert('你已经成功复制，好东西当然要发给QQ/MSN好友分享');
}
function ffx(id)
{
	sendMsg('open',copy_clip(id,1));
}
function botm(rq,cpid,re,e,i,m)
{
	var ss='<li><cite>更新日期为 '+rq+' </span> '+(m?'最后编辑:'+(i?'<a href="/u_'+i+'" target="_blank">'+m+'</a>':m)+' <a href="/ls_'+e+'" target="_blank">历史版本</a>':'')+' <a href="'+(e?'/jiucuo.html?e='+e+'&cid='+cid:'http://hi.8684.cn/jiucuo.php')+'" target="_blank" style="color:#C60A00">[线路纠错]</a> <span style="cursor:pointer" onclick="copy_clip(\''+cpid+'\')">[复制结果]</span> <a href="http://www.869d.com/" target="_blank"><span>2-7折酒店预定</span></a> <a href="http://www.36room.com/" target="_blank"><span>精装公寓 一天起租</span></a></cite></li>';
	if(re) return ss;
	document.write(ss); 
}
function ob_hid(id,flag)
{
	if($(id)) $(id).style.display=(flag)?'none':'block';
}
function getpos(ob)
{
	var add=(document.layers) ? 2 : 0;
	var obtp=ob;
	var top=0;
	var left=0;
	do 
	{
		obtp=obtp.offsetParent;
		left+=obtp.offsetLeft;
		top+=obtp.offsetTop;
	}
	while(obtp.tagName!="BODY" && obtp.tagName!="HTML");	
	var temp=new Array();	
	temp[0]=ob.offsetLeft+left;		
	temp[1]=ob.offsetTop+top+ob.offsetHeight+add;
	return temp;
}
function rdckie(name)
{
	var re='',mycc=document.cookie;
	var ex=new RegExp(name+"=([^;]*)");
	if(ex.test(mycc))
	{re=unescape(RegExp.$1);}
	return re;
}

var ajax_rqt = false;
var cur=1;
url_sh='so.php?';

function ffid()
{
	if(rdckie('fid')) return;
	var ckdt=new Date();
	ckdt.setTime(ckdt.getTime()+36000000);
	document.cookie="fid=8684;path=/;expires="+ckdt.toGMTString();
}

var txt1='';
var txt2='';
var fir=true;
var gmp=false;

function addOption(objSelectNow,txt,val)
{
	var objOption = document.createElement("OPTION");
	objOption.text= txt;
	objOption.value=val;
	objSelectNow.options.add(objOption);
}
function addOptionGroup(selectId,optGroupString)
{
	var optGroup = optGroupString.split(",");
	var objSelectNow=$(selectId);
	objSelectNow.length = 1;
	for (i=1; i<optGroup.length; i++)
	{
		addOption(objSelectNow, optGroup[i], i);
	}
}
function record(x,ob2) 
{
	if(ob2.options[ob2.selectedIndex].value!='0')
	{
		var val=ob2.options[ob2.selectedIndex].text;
		if(x==1) txt1=val;
		else txt2=val;
	}
}
function addstat(n)
{
	addOptionGroup(n,ty_stat);
}
function addline()
{
	addOptionGroup('p1',ty_line);
}
function ishow(head,num,th,cl1,cl2)
{
	for(var i=1;i<=num;i++)
	{
		$(head+i).style.display='none';
		$(head+'_'+i).className=cl2;
	}
	$(head+th).style.display='block';
	$(head+'_'+th).className=cl1;
}

function cts(ob)
{
	var id='cydiv';
	if(!$(id))
	{
		var bd=document.getElementsByTagName('body').item(0);
		var itm=document.createElement('iframe');
		itm.setAttribute('id',id);
		itm.className=id;
		itm.onclick=stp;
		winrow[winrow.length]=id;
		var row=getpos(ob);
		bd.appendChild(itm);
		itm.style.left=row[0]-itm.offsetWidth+55+'px';
		itm.style.top=row[1]+'px';
	}
	winno='';
	if($(id).style.display!='block')
	{
		$(id).src='cities.htm';
		winno=id;
	}
}
function fshow(id,ob)
{	
	var temp=getpos(ob);
	$(id).style.left=temp[0]+'px';		
	$(id).style.top=temp[1]+2+'px';
	//$(id).onclick=stp;
	winno=($(id).style.display!='block')?id:'';
}
function hidwin()
{
	for(x in winrow)
	ob_hid(winrow[x],1);
	if(winno)ob_hid(winno);
	winno='';
}
function stp(e)
{
	e=(e)?e:window.event;
	e.cancelBubble=true;
}

function fjl(id,ob)
{
	$(id).style.color="#000";
	$(id).value=ob.options[ob.selectedIndex].text;
}

if(document.attachEvent) document.attachEvent('onclick',hidwin);
else if(document.addEventListener) document.addEventListener('click',hidwin,false);
else document.onclick=hidwin;

function nextok()
{
	//toseh();return;
	var bz=document.documentElement,preu=document.referrer;
	if(!document.all || rdckie('fid') || rdckie('hi_auth'))
	{toseh();return;}
	if(!$('ndiv'))
	{
		var bd=document.getElementsByTagName("body").item(0);
		var obnew=document.createElement('div');
		obnew.setAttribute('id','ndiv');
		obnew.className='test';	
		bd.appendChild(obnew);
		var ht1=bz.scrollHeight,ht2=bz.clientHeight;
		obnew.style.height=((ht1>ht2)?ht1:ht2)+"px";
		if(!$('mdiv'))
		{
			var obnew=document.createElement('iframe');
			obnew.setAttribute('id','mdiv');
			obnew.className='test1';	
			bd.appendChild(obnew);
		}
	}
	$('mdiv').src='http://site.8684.cn/mid.htm?'+city;
	$('mdiv').style.top=bz.scrollTop+(bz.clientHeight-$('mdiv').offsetHeight)/2+'px';
	$('mdiv').style.left=((bz.clientWidth-$('mdiv').offsetWidth)/2+15)+'px';
}
function toseh()
{ffid();location.href=next_url;}
/*document.write('<script type="text/javascript" src="http://nanjing.8684.cn/bustj.php?t='+Math.random()+'"></script>');*/