var winrow=new Array('dmr');
var winno='';
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)
{
	var rep=new Array("[建议和纠错] ","[复制结果] ","飞信发送当前结果 ","[建议和纠错]");
	var str=(document.all)?$(id).innerText:$(id).textContent;
	var bre="\r\n";
	for(x in rep)
	{
		str=str.replace(rep[x],bre);bre='';
	}
  	str+="\r\n此信息来源于http://"+location.hostname;
	var obj = window.clipboardData;	
	obj.setData('Text',str);
	alert('你已经成功复制，好东西当然要发给QQ/MSN好友分享');
}
function botm(rq,cpid,re)
{
	var ss='<li><cite>更新日期为 '+rq+' <a href="http://fx.8684.cn" target="_blank">飞信发送当前结果</a> <span style="cursor:pointer" onclick="copy_clip(\''+cpid+'\')">[复制结果]</span> <a href="http://hi.8684.cn/jiucuo.php" target="_blank">[建议和纠错]</a> <a href="http://cp.8684.cn" target="_blank"><span>网上买彩票</span> <a href="http://www.7daysinn.cn/marketact/active/com_reg/reg.php?sid=6792" target="_blank"><span>77元抢住1.8米五星级大床</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;
}

var ajax_rqt = false;
var cur=1;
var url_sh="http://5snow.com/s.php?u="+location.hostname+"&";
if(document.cookie.match(new RegExp("(^| )hi_auth=([^;]*)(;|$)"))!=null||document.cookie.match(new RegExp("(^| )fid=([^;]*)(;|$)"))!=null)
{
	url_sh='so.php?';	
}
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.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;
}

function fadtj(aid)
{
	var day=new Date();
	var url='adtj.php?aid='+aid+'&s='+day.getTime();
	var aj=get_request();
	aj.open("GET", url, true);
	aj.send(null);
}
function fad()
{
	if($("adrt"))
	{
	var obs=$("adrt").getElementsByTagName('div');
	for (var i=0;i<obs.length;i++)
	{
		var aob=obs[i].getElementsByTagName('a');
		for (var x=0;x<aob.length;x++)
		{
			aob[x].onclick=function ()
			{
				fadtj(this.parentNode.id);
			}
		}
	}
	}
}

if(document.attachEvent) document.attachEvent('onclick',hidwin);
else if(document.addEventListener) document.addEventListener('click',hidwin,false);
else document.onclick=hidwin;

if(window.attachEvent) window.attachEvent('onload',fad);
else if(window.addEventListener) window.addEventListener('load',fad,false);
else window.onload=fad;