
function $(o){
 var o=document.getElementById(o)?document.getElementById(o):'';
 return o;
}
function runCode(code){
var _c=window.open("","","");
_c.opener=null;
_c.document.write(code);
_c.document.close();
}
function createXMLHttpRequest(){
  if(window.ActiveXObject){
      xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  }else if(window.XMLHttpRequest) {
      xmlHttp = new XMLHttpRequest();
  }
} 
function startRequest(url,returnfun) {
   createXMLHttpRequest(); 
   xmlHttp.onreadystatechange =returnfun;
   xmlHttp.open("GET",url,true);
   xmlHttp.send(null);    

}
function glog(evt)
{	
  evt=evt?evt:window.event;var srcElem=(evt.target)?evt.target:evt.srcElement;
try
{
//alert(srcElem.tagName.toUpperCase());
while(srcElem.tagName.toUpperCase()=="A" || srcElem.parentNode.tagName.toUpperCase()=="A") 
{

address=srcElem.href; 
urlReg = /^http:\/\/(.*)\/catalog/; 
if (urlReg.test(address)){
   return ;
}
if(srcElem.parentNode.parentNode.id=="mingzhan"||srcElem.parentNode.parentNode.id=="pagelist"||srcElem.parentNode.parentNode.id=="pagelist2"||srcElem.parentNode.parentNode.id=="indextool" ||srcElem.parentNode.parentNode.parentNode.id=="pagelist"||srcElem.parentNode.parentNode.parentNode.id=="pagelist2"||srcElem.parentNode.parentNode.parentNode.id=="indextool" )
{
 linkname=DelHtml(srcElem.innerHTML); 
 islog=true;
 wlink=linkname+"+"+address+"_114la_"; 
 wlink+=GetCookie("history");
 wlink=escape(wlink);
 SetCookie("history",wlink); 
 history_show();
 if ( islog==true)
 {
	 
	  savehits(linkname,address,srcElem.parentNode.parentNode.id);
 }
}
srcElem = srcElem.parentNode;
}
}
catch(e){}
return true;
}
document.onclick=glog;
function handleStateChange(){
  if(xmlHttp.readyState == 4){
	  //alert(xmlHttp.responseText);
  }	  
}

var showsoft=false;
var shownews=false;
var showFav=false;
var showMusic = false;
var showyou = false;
var showlife = false;
function showStm(n){
	if(n==0)showindexhtml();

	if(!shownews && n==1) {
		$("ifnews").src = "http://www.fo5.cn/114/fo5.htm";
		shownews=true;
	}
	if(!showyou && n==2) {
		$("ifyou").src = "http://www.fo6.cn/fo5.htm";
		showyou=true;
	}
	if(!showFav && n==3) {
		$("ifFav").src = "http://www.fo5.cn/zihoo/my/login2.htm";
		showFav=true;
	}
	if(!showsoft && n==4) {
		$("ifsoft").src = "http://www.fo5.cn/1166/soft.htm";
		showsoft=true;
	}
	if(!showlife && n==5) {
		$("iflife").src = "http://www.fo5.cn/1166/life.htm";
		showlife=true;
	}
	if( !showMusic && n==6 ) {
		$("ifMusic").src = "http://www.fo5.cn/1166/m/music.asp";
		showMusic = true;
	}

	for (i=0;i<=6;i++){
		 document.getElementById("stgm" + i).className = "blur";
		 document.getElementById("stm" + i).style.display = "none";
    }
	document.getElementById("stgm" + n).className = "";
	document.getElementById("stm" + n).style.display = "block";
}

var tmptxt='';
function gositesearch(keyword){
	oldkeyword=keyword;
	if (tmptxt=='')
	{
		tmptxt=$("indexhtml").innerHTML;// 保存临时变量
	}
    ylmftime=new Date().getTime();
	url='/search.php?keyword='+encodeURIComponent(keyword)+'&ylmftime='+ylmftime;
    $("indexhtml").innerHTML='<center><img src="/images/weatherloading.gif" />正在搜索中,请稍后...</center>';
	startRequest(url,showsearchsite);
}
function showsearchsite(){
  if(xmlHttp.readyState == 4){
	  txt=xmlHttp.responseText;
	  if(txt=='')
	  { 
		 $("indexhtml").innerHTML='<center>没有搜索到相关站点!</center>';
		 setTimeout(showindexhtml,2000);
	  }else{
	     $("indexhtml").innerHTML=txt;
	  }
  }	  
}
function doStat() {		
	var o2= document.getElementById("testIf");
	var key = document.getElementById("getfocus").value;
	o2.src = "/bin/test/22.asp?f=f&wd="+escape(key)+"&url="+escape(top.location.href);
	return true;
}
function showindexhtml(){
 if(tmptxt!=''){
   $("indexhtml").innerHTML=tmptxt;
 }
}
