function getOs()   
{   
   var OsObject = "";   
   if(navigator.userAgent.indexOf("MSIE")>0) {   
        return "MSIE";       //IE浏览器
   }
   if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){   
        return "Firefox";     //Firefox浏览器
   }
   if(isSafari=navigator.userAgent.indexOf("Safari")>0) {   
        return "Safari";      //Safan浏览器
   }
   if(isCamino=navigator.userAgent.indexOf("Camino")>0){   
        return "Camino";   //Camino浏览器
   }
   if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){   
        return "Gecko";    //Gecko浏览器
   }   
} 


var xmlHttp;
			
			
		function gethtml()
		{
		
			if (window.ActiveXObject){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			else if (window.XMLHttpRequest){
			xmlHttp=new XMLHttpRequest();
			}
			
			var btype=getOs()
			
			var now = new Date(); 
			var num=now.getYear()+now.getMonth()+now.getDay()+now.getHours()+now.getMinutes()+now.getTime()

			
			xmlHttp.onreadystatechange=(btype!="Firefox")?(xmlHandle):(xmlHandle());
			var url="/new/getyphtmlcontent.aspx?&s="+num+"&ypid="+document.getElementById("hiypid").value;
			xmlHttp.open("GET",url,false);
			xmlHttp.send(null);
			xmlHttp.onreadystatechange=(btype!="Firefox")?(xmlHandle):(xmlHandle());
			
			clearTimeout(settimeload);
			
		}
		
		function xmlHandle()
		{
			if(xmlHttp.readyState==4)
			{
				if(xmlHttp.status==200)
				{
					var mes= xmlHttp.responseText;
					if(mes!="")
					{
						var strmes=new Array();
						strmes=mes.split('|')
						
						document.getElementById("spandjs").innerHTML=strmes[0].toString().replace("(@л@)","|");
						document.getElementById("ypplnum").innerHTML=strmes[1].toString().replace("(@л@)","|");
					
						document.getElementById("divypxgzx").innerHTML=strmes[2].toString().replace("(@л@)","|");
						
						
					}
				}
			}
			else
			{
				document.getElementById("spandjs").innerHTML="<img src='/images/loading_s.gif'>"
			}
			
		}
		var settimeload;
		function yang()
		{
			checkiflogin();
			
			settimeload=setTimeout("gethtml()",5000)
			readcookie();
			var dlurl="/new/yphtmldl.aspx?&lb=2";
			gethtmldl(dlurl)
			re=xmlHandledl();
			if(re!="")
			{
				document.getElementById("txttwcf").value=re
			}
		}
		
		function checkiflogin()
		{
			
				var salldiv=document.getElementsByTagName("div");
				
				for(var i=0;i<salldiv.length;i++)
				{
					/*
					if(salldiv[i].getAttribute('loginshow')=="1")
					{
						if(salldiv[i].innerHTML==""||salldiv[i].innerHTML=="-")
						{
							if(document.getElementById("left_ypxx_"+salldiv[i].getAttribute('parentid'))!=null)
							{
							document.getElementById("left_ypxx_"+salldiv[i].getAttribute('parentid')).style.display="none";
							}
						}
						else
						{
						salldiv[i].innerHTML="<font style='color:#cccccc'>登陆后显示[<a href='/new/index.aspx'>点击登陆</a>]</font>";
						}
					}
					*/
					if(salldiv[i].getAttribute('name')=="ypxxxx")
					{
						if(salldiv[i].innerHTML==""||salldiv[i].innerHTML=="-")
						{
							if(document.getElementById("left_ypxx_"+salldiv[i].getAttribute('parentid'))!=null)
							{
							document.getElementById("left_ypxx_"+salldiv[i].getAttribute('parentid')).style.display="none";
							}
						}
						
					}
					
				}
			
		}
		
		
		function goselecrzh()
		{
			window.location.href="/new/first_bzsearch.aspx?ckjg=&ypmc="+escape(document.getElementById("ypmc").value)+"&&ypfl="+escape(document.getElementById("ypfl").value)+"&&cd="+escape(document.getElementById("cd").value)+"&jx=&yblb="+escape(document.getElementById("yblb").value)+"&otclb=";
		}
		
		function SubmitKeyClick(button) 
		{    
		if (event.keyCode == 13) 
		{        
		event.keyCode=9;
		event.returnValue = false;
		document.all[button].click(); 
		}
		}
		
		
		
		function readcookie()
		{
			var flag="0"; 
			var aCookie=document.cookie.split("; ");
			for (var i=0;i<aCookie.length; i++)
			{
　				var aCrumb=aCookie[i].split("=");
　				if (aCrumb[0]=="ypjtymzjllyp")
　				{
　					if(aCrumb[1]!=""&&aCrumb[1]!=null)
　					{
　						var str="";
　						var newstr="";
　						var cra=new Array();
　						cra=aCrumb[1].split('|');
　						
　						
　						var num=cra.length;
　						if(num>10)
　						{
　							num=10;
　						}
　						
　						
　						//取得所有值
　						
　						for(var m=0;m<num;m++)
　						{
　							if(cra[m].toString()!="")
　							{
　								var surl=new Array();
　								surl=cra[m].toString().replace('=','‖¨').split('*');
　								str=str+"<div class=right_yplb_ck><div class=right_smalimg><img src=/images/small_7.gif></div><div class=right_zyllypmc><a href="+surl[0].toString()+">"+unescape(surl[1].toString())+"</a></div></div>";
　							}
　						}
　						
　						var nowurlname=window.location+"*"+escape(document.getElementById("hiypname").value);
　						newstr=nowurlname+"|";
　						var addflag=0;
　						for(var m=0;m<cra.length;m++)
　						{
　							if(addflag<10)
　							{
　								if(cra[m].toString()!=""&&cra[m].toString()!=nowurlname.replace('=','‖¨'))
　								{
　									newstr=newstr+cra[m].toString()+"|";
　								}
　								addflag++
　							}
　							else
　							{
　								break
　							}
　							
　						}
　						//document.getElementById("divzjll").innerHTML=str;
　						
　						addzjllcookie(newstr);
　						flag="1";
　						
　					}
　					
　				}
　				/*
　				if(aCrumb[0]=="hyiflogin")
　				{
　					if(aCrumb[1]!=""&&aCrumb[1]!=null)
　					{
　						iflogin="1";
　					}
　				}
　				*/
　			}
　			if(flag=="0")
　			{
　				var newstr=window.location+"*"+escape(document.getElementById("hiypname").value)+"|";
　				addzjllcookie(newstr)
　			}
　			
		}
		
		//创建cookie
		function addzjllcookie(urlvalue)
		{
			var exp=new Date(); 
			exp.setTime(exp.getTime()+30*24*3600*100);
			document.cookie="ypjtymzjllyp="+urlvalue.replace('=','‖¨')+";expires="+exp.toGMTString()+" ; domain=yongyao.net;path=/";
		}
		
		
		function divzycfj(n)
		{
			for(var i=0;i<3;i++)
			{
				document.getElementById("divzy"+i).className="tital_zyc";	
			}
			document.getElementById("divzy"+n).className="divdhzyc";
			
			for(var i=0;i<3;i++)
			{
				document.getElementById("divshownr"+i).className="zysearch2";	
			}
			document.getElementById("divshownr"+n).className="zysearch1";
			
		}
		
		function showmorexx()
		{
			if(document.getElementById("divmorexx").style.display=="none")
			{
				document.getElementById("divmorexx").style.display="block"
			}
			else
			{
				document.getElementById("divmorexx").style.display="none"
			}
		}
		
		function changesize(sizenum)
		{
			var salldiv=document.getElementsByTagName("div");
			
			for(var i=0;i<salldiv.length;i++)
			{
				if(salldiv[i].getAttribute('name')=="ypxxxx")
				{
					salldiv[i].style.fontSize=sizenum+"px"
				}
			}
		}
		
function changehd(objnum)
{
	for(var i=1;i<5;i++)
	{
		document.getElementById("divhd"+i).className="right_hd2";
	}
	document.getElementById("divhd"+objnum).className="right_hd1";
	
	for(var i=1;i<5;i++)
	{
		document.getElementById("right_hdnr_"+i).style.display="none";
	}
	document.getElementById("right_hdnr_"+objnum).style.display="";
	
}

function selectgjc(gjc)
{ 
	if(gjc=="输入查询内容，点击右边按钮进入分类检索")
	{
		gjc='';
	}
	window.open("/new/selectnews.aspx?nr="+escape(gjc));
}
	function selectypgjc(gjc)
	{ 
		if(gjc=="输入查询内容，点击右边按钮进入分类检索")
	{
	gjc='';
	}
	window.open("/new/search1.aspx?parm="+escape(gjc));
	}
	function selectbzgjc(gjc)
	{ 
	if(gjc=="输入查询内容，点击右边按钮进入分类检索")
	{
	gjc='';
	}
	window.open("/new/bz_search1.aspx?parm="+escape(gjc));
}

function showmoreypjbxx(divnum)
{
	if(document.getElementById("divypxxbf"+divnum).style.display=="none")
	{
		document.getElementById("divypxxbf"+divnum).style.display="";
		document.getElementById("divmorexx"+divnum).style.display="none";
	}
	else
	{
		document.getElementById("divypxxbf"+divnum).style.display="none";
		document.getElementById("divmorexx"+divnum).style.display="";
	}
}
	
	
function doHtmlAlert()
{
	var hA =document.getElementById("HtmlAlert");						
	var divHAContainer = document.getElementById("divHtmlAlertContainer");						

	hA.style.width = window.screen.availWidth-20;
	
	var s_height=document.body.scrollHeight;
	
	if(s_height<window.screen.availHeight)
	{
		s_height=window.screen.availHeight;
	}
	hA.style.height=s_height+"px"
	
	hA.style.display = 'block';
	divHAContainer.style.display = 'block';
	
	divHAContainer.style.top=(document.documentElement.scrollTop+(document.documentElement.clientHeight-divHAContainer.offsetHeight)/2)+"px";
	divHAContainer.style.left=(document.documentElement.scrollLeft+(document.documentElement.clientWidth-divHAContainer.offsetWidth)/2)+"px";
	
	var objsel=document.getElementsByTagName("select");
	for(var i=0;i<objsel.length;i++)
	{
		objsel[i].style.display="none";
	}
}
function closejd()
{
	var hA = document.getElementById("HtmlAlert");
	hA.style.display = 'none';
	var divHAContainer = document.getElementById("divHtmlAlertContainer");	
	divHAContainer.style.display = 'none';
	
		var objsel=document.getElementsByTagName("select");
		for(var i=0;i<objsel.length;i++)
		{
			objsel[i].style.display="";
		}
	
}
function checkifdiaplay()
{
	if(document.getElementById("HtmlAlert").style.display=="")
	{
		doHtmlAlert();
	}	
}
window.onscroll=checkifdiaplay;
window.onresize=checkifdiaplay;
window.onerror=killErrors;

function killErrors() {return true} 


function changgeimgbg(objimg,imgname)
{
	objimg.src='/images/'+imgname
}

var sellb="1";
function changetophd(num)
{
	if(num=="2")
	{
		//window.location.href="/new/kstw_jt.aspx?lb=3#tdwytw";
	}
	for(var i=1;i<6;i++)
	{
		document.getElementById("tophd"+i).className="right_hdcx";
	}
	sellb=num;
	document.getElementById("tophd"+num).className="right_hdcx1";
}

function gosearchtop()
{
	switch(sellb)
	{
		case "1":
			window.location.href="/new/first_search1.aspx?ypmc="+escape(document.getElementById("txttopcx").value)+"&myfl=2";
			break;
		case "2":
			window.location.href="/new/kstw_jt.aspx?lb=3#tdwytw";
			break;
		case "3":
			//window.location.href="";
			break;
		case "4":
			window.location.href="http://yd.yongyao.net/yaofang/yfcx.aspx?shen=&shi=&xian=&ydmc="+escape(document.getElementById("txttopcx").value)+"&xgdd=";
			break;
		case "5":
			window.location.href="http://ys.yongyao.net/pages/yyzs.aspx?&xm="+escape(document.getElementById("txttopcx").value);
			break;
	}
}

function showlogin()
{
	var hA =document.getElementById("HtmlAlertlogin");	
	if(hA!=null)
	{					
	var divHAContainer = document.getElementById("divHtmlAlertContainerlogin");						

	hA.style.width = window.screen.availWidth-20;
	
	var s_height=document.body.scrollHeight;
	
	if(s_height<window.screen.availHeight)
	{
		s_height=window.screen.availHeight;
	}
	hA.style.height=s_height+"px"
	
	hA.style.display = 'block';
	divHAContainer.style.display = 'block';
	
	divHAContainer.style.top=(document.documentElement.scrollTop+(document.documentElement.clientHeight-divHAContainer.offsetHeight)/2)+"px";
	divHAContainer.style.left=(document.documentElement.scrollLeft+(document.documentElement.clientWidth-divHAContainer.offsetWidth)/2)+"px";
	
	var objsel=document.getElementsByTagName("select");
	for(var i=0;i<objsel.length;i++)
	{
		objsel[i].style.display="none";
	}
	}
}
function closejdlogin()
{
	var hA = document.getElementById("HtmlAlertlogin");
	if(hA!=null)
	{
	hA.style.display = 'none';
	var divHAContainer = document.getElementById("divHtmlAlertContainerlogin");	
	divHAContainer.style.display = 'none';
	
		var objsel=document.getElementsByTagName("select");
		for(var i=0;i<objsel.length;i++)
		{
			objsel[i].style.display="";
		}
	}
}


function checkloginpassword()
{
	var yhm=document.getElementById("txtdlyhm").value.replace(/\s/g,'');
	var yhmm=document.getElementById("txtdlmm").value.replace(/\s/g,'');
	
	if(yhm=="")
	{
		alert("请输入用户名！");
		return;
	}
	if(yhmm=="")
	{
		alert("请输入用户密码！");
		return;
	}
	
	var dlurl="/new/yphtmldl.aspx?&lb=1&username="+escape(yhm)+"&password="+escape(yhmm);
	gethtmldl(dlurl)
	
	var re=xmlHandledl();
	if(re.replace(/\s/g,'')!="")
	{
		alert(re)
	}
	else
	{
		//var hynamedl=(ypzs.hethyname()).value;
		//
		////document.getElementById("txtcf").value=hynamedl;
		//document.getElementById("divdlkzc").style.display="none";
		dlurl="/new/yphtmldl.aspx?&lb=2";
		gethtmldl(dlurl)
		re=xmlHandledl();
		
		document.getElementById("txttwcf").value=re
		closejdlogin();
		addlogincookie(yhm,yhmm)
	}
}

//创建cookie
function addlogincookie(yhmvalue,yhmmvalue)
{
	var exp=new Date(); 
	exp.setTime(exp.getTime()+30*24*3600*100);
	document.cookie="hyiflogin="+escape(yhmvalue)+"!@#$%"+escape(yhmmvalue)+";expires="+exp.toGMTString()+" ; domain=yongyao.net;path=/";
}

var xmlHttpdl;
function gethtmldl(surl)
		{
		
			if (window.ActiveXObject){
			xmlHttpdl=new ActiveXObject("Microsoft.XMLHTTP");
			}
			else if (window.XMLHttpRequest){
			xmlHttpdl=new XMLHttpRequest();
			}
			
			var btype=getOs()
			
			var now = new Date(); 
			var num=now.getYear()+now.getMonth()+now.getDay()+now.getHours()+now.getMinutes()+now.getTime()

			
			xmlHttpdl.onreadystatechange=(btype!="Firefox")?(xmlHandle):(xmlHandle());
			var url=surl+"&st="+num;
			
			xmlHttpdl.open("GET",url,false);
			xmlHttpdl.send(null);
			xmlHttpdl.onreadystatechange=(btype!="Firefox")?(xmlHandle):(xmlHandle());
			
			
		}
		
		function xmlHandledl()
		{
			if(xmlHttpdl.readyState==4)
			{
				if(xmlHttpdl.status==200)
				{
					return xmlHttpdl.responseText;
				}
			}
			return "登录时出现错误！";
		}
		function checkiflogintw()
		{
			var dlurl="/new/yphtmldl.aspx?&lb=2";
			gethtmldl(dlurl)
			re=xmlHandledl();
			if(re=="")
			{
				alert("请先登录！");
				showlogin();
			}
		}
		function uploadzx()
		{
			if(document.getElementById("txttwcf").value=="")
			{
				alert("请输入称呼！");
				document.getElementById("txttwcf").focus()
				return;
			}
			if(document.getElementById("txttwbt").value=="")
			{
				alert("请输入标题！");
				document.getElementById("txttwbt").focus()
				return;
			}
			if(document.getElementById("txttwnr").value=="")
			{
				alert("请输入内容！");
				document.getElementById("txttwnr").focus()
				return;
			}
			
			var dlurl="/new/yphtmldl.aspx?&lb=3&title="+escape(document.getElementById("txttwbt").value)+"&content="+escape(document.getElementById("txttwnr").value);
			gethtmldl(dlurl)
			
			var re=xmlHandledl();
			if(re=="")
			{
				alert("提交成功！");
				window.location.href="/new/kstw.aspx?lb=3"
			}
			else
			{
				alert(re);
			}
		}
		
		function getggifshow()
		{
			if(document.getElementById("left_yyaqjs_1")!=null)
			{
				var objgg=document.getElementById("left_yyaqjs_ri");
				var objggnr=document.getElementById("left_yyaqjs_1");
				if(objggnr.style.display=="none")
				{
					objggnr.style.display="";
					objgg.className="left_yyaqjs_ri"
				}
				else
				{
					objggnr.style.display="none";
					objgg.className="left_yyaqjs_ri1"
				}
			}
		}