var scrollNewsCt=1;
var pauseTime=15*1000;
var timer1;

function hideAllClips() {
	for (i=1; i<9; i++){
		var allClips="topNews_"+i;
		var clipNum="clipNum"+i;
		
		document.getElementById(allClips).style.display="none";
		document.getElementById(clipNum).className="topNewsClip_OFF";
		
		}
	}
	
function clip_Switch(n) {
	var curClip="topNews_"+n;
	var curClipNum="clipNum"+n;
	
	hideAllClips();
	document.getElementById(curClip).style.display="block";
	document.getElementById(curClipNum).className="topNewsClip_ON";
	
	scrollNewsCt=n; 
	}
	




function fwdScroll() {
	stopScroll();
	clip_Switch(scrollNewsCt);
	scrollNewsCt+=1;
	if (scrollNewsCt==9) {
		scrollNewsCt=1;
		}
		timer1=setTimeout("fwdScroll()",pauseTime);
	}
	
function stopScroll() {
	clearTimeout(timer1);
	}

function bwdScroll() {
	stopScroll();
	scrollNewsCt-=1;
	if (scrollNewsCt==0) {
		scrollNewsCt=8;
		}
		clip_Switch(scrollNewsCt);
		timer1=setTimeout("bwdScroll()",pauseTime);
	}





function checkform() {
	if(document.queryForm.query.value == "中华搜索"){
		window.open("http://sou.china.com/")
		return false;
	}
	else {
			document.queryForm.submit();
			return false;	
		}
}
function search_news(){
	if (document.queryForm.query.value == "中华搜索"){
		window.open("http://sou.china.com/search/news.html");
		return false;		
		}
		else {
	var search_news_lnk="http://searchi.china.com/cgi-bin/allsearch?cdtype=GB&word="+document.queryForm.query.value;
	window.open(search_news_lnk);
	return false;
}
	}
	
function search_bbs(){
	if (document.queryForm.query.value == "中华搜索"){
		window.open("http://sou.china.com/bbssearch/");
		return false;
		}
		else {
			var search_bbs_lnk="http://sou.china.com/bbssearch/search.php?word="+document.queryForm.query.value;
			window.open(search_bbs_lnk);
			return false;
			}
	}

function djs(){
	var timedate= new Date("1/28/2007"); 
	var times= "亚冬会开幕"; 
	var now = new Date(); 
	var date = timedate.getTime() - now.getTime(); 
	var time = Math.floor(date / (1000 * 60 * 60 * 24)); 
	if (time >= 0) 
	document.write( times+"还有:"+time+"天")
	}

function djs1(){
	var timedate= new Date("8/8/2008"); 
	var times= "奥运会开幕"; 
	var now = new Date(); 
	var date = timedate.getTime() - now.getTime(); 
	var time = Math.floor(date / (1000 * 60 * 60 * 24)); 
	if (time >= 0) 
	document.write( times+"还有:"+time+"天")
	}
	
	
	function show1(num,sss) {
        for (ii=1;ii<=5;ii++) 
        {
        eval("d1"+sss+ii).style.display="none";
        eval("bt1"+sss+ii).style.background = "url('images/linkbg25.gif')";
        }
        eval("d1"+sss+num).style.display="";
        eval("bt1"+sss+num).style.background = "url('images/linkbg24.gif')";
}
	function show0(num,sss) {
        for (ii=1;ii<=2;ii++) 
        {
        eval("d0"+sss+ii).style.display="none";
        eval("bt0"+sss+ii).style.background = "url('images/bg5_2.gif')";
        }
        eval("d0"+sss+num).style.display="";
        eval("bt0"+sss+num).style.background = "url('images/bg5_2_1.gif')";
}

function show3(num,sss) {
        for (ii=1;ii<=2;ii++) 
        {
        eval("d3"+sss+ii).style.display="none";
        eval("bt3"+sss+ii).style.background = "url('images/bg5_2.gif')";
        }
        eval("d3"+sss+num).style.display="";
        eval("bt3"+sss+num).style.background = "url('images/bg5_2_1.gif')";
}




	function show2(num,sss) {
        for (ii=1;ii<=6;ii++) 
        {
        eval("d2"+sss+ii).style.display="none";
        eval("bt2"+sss+ii).style.background = "url('images/linkbg25.gif')";
        }
        eval("d2"+sss+num).style.display="";
        eval("bt2"+sss+num).style.background = "url('images/linkbg24.gif')";
}

function show4(num,sss) {
        for (ii=1;ii<=5;ii++) 
        {
        eval("d4"+sss+ii).style.display="none";
        eval("bt4"+sss+ii).style.background = "url('images/crbg2.gif')";
        }
        eval("d4"+sss+num).style.display="";
        eval("bt4"+sss+num).style.background = "url('images/crbg1.gif')";
}
function show5(num,sss) {
        for (ii=1;ii<=6;ii++) 
        {
        eval("d5"+sss+ii).style.display="none";
        eval("bt5"+sss+ii).style.background = "url('images/bg5_2.gif')";
        }
        eval("d5"+sss+num).style.display="";
        eval("bt5"+sss+num).style.background = "url('images/bg5_2_1.gif')";
}

//chaocai
function show6(num,sss) {
        for (ii=1;ii<=5;ii++) 
        {
        eval("d6"+sss+ii).style.display="none";
        eval("bt6"+sss+ii).style.background = "url('images/bg5_2.gif')";
        }
        eval("d6"+sss+num).style.display="";
        eval("bt6"+sss+num).style.background = "url('images/bg5_2_1.gif')";
}
//chaohanjingdian
function show7(num,sss) {
        for (ii=1;ii<=7;ii++) 
        {
        eval("d7"+sss+ii).style.display="none";
        eval("bt7"+sss+ii).style.background = "url('/images/csssly.gif')";
        }
        eval("d7"+sss+num).style.display="";
        eval("bt7"+sss+num).style.background = "url('/images/csssly2.gif')";
}

function show8(num,sss) {
        for (ii=1;ii<=5;ii++) 
        {
        eval("d8"+sss+ii).style.display="none";
        eval("bt8"+sss+ii).style.background = "url('images/bg8_2.gif')";
        }
        eval("d8"+sss+num).style.display="";
        eval("bt8"+sss+num).style.background = "url('images/bg8_2_1.gif')";
}








/*163
var Browser = new Object();
Browser.isMozilla = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument!='undefined');
Browser.isIE = window.ActiveXObject ? true : false;
Browser.isFirefox = (navigator.userAgent.toLowerCase().indexOf("firefox")!=-1);
Browser.isOpera = (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
if (Browser.isFirefox) { // entend Event Mod for FireFox
	extendEventObject();
}
function extendEventObject() {
	Event.prototype.__defineGetter__("srcElement", function () {
		var node = this.target;
		while (node.nodeType != 1) node = node.parentNode;
		return node;
	});

	Event.prototype.__defineGetter__("fromElement", function () {
		var node;
		if (this.type == "mouseover")
			node = this.relatedTarget;
		else if (this.type == "mouseout")
			node = this.target;
		if (!node) return;
		while (node.nodeType != 1) node = node.parentNode;
		return node;
	});

	Event.prototype.__defineGetter__("toElement", function () {
		var node;
		if (this.type == "mouseout")
			node = this.relatedTarget;
		else if (this.type == "mouseover")
			node = this.target;
		if (!node) return;
		while (node.nodeType != 1) node = node.parentNode;
		return node;
	});
}
function IsChild(cNode,pNode){
	while(cNode!=null){
		cNode=cNode.parentNode;
		if(cNode==pNode) return true; 
	}
	return false;
}


var ajccache=new Object();
var waitInterval;
var tempref;
var MouseDelayTime=150;//鼠标感应延迟300毫秒
function getTBprefixName(str,sta){
	if(str.indexOf("active")!=-1 || str.indexOf("normal")!=-1) str=str.substr(6);
		else if(str.indexOf("over")!=-1) str=str.substr(4);
			else str="";
	return sta+str;
}
function startajaxtabs(){
	for(var i=0;i<arguments.length;i++)
	{
		var ulobj=document.getElementById(arguments[i]);
			ulist=ulobj.getElementsByTagName("li");			
			for(var j=0;j<ulist.length;j++)
			{
				var thelist=ulist[j];
				if(thelist.parentNode.parentNode!=ulobj) continue;//只有第一层li有效 fixed 2006.9.29
				var ulistlink=thelist.getElementsByTagName("a")[0];
				var ulistlinkurl=ulistlink.getAttribute("urn");
				var ulistlinktarget=ulistlink.getAttribute("rel");
				thelist.setActive=function(bactive){
					if(bactive){
						this.status="active";
						this.className=getTBprefixName(this.className,"active");
					}else{
						this.status="normal";
						this.className=getTBprefixName(this.className,"normal");
					}
				}
				thelist.LoadTab=function(){
					this.setActive(true);
					this.parentNode.parentNode.activetab.setActive(false);
					this.parentNode.parentNode.activetab=this;					
					var ulistlink=this.getElementsByTagName("a")[0];
					loadAJAXTab(ulistlink.getAttribute("urn"),ulistlink.getAttribute("rel"));
				}
				thelist.onmouseover=function(aEvent){
					var myEvent = window.event ? window.event : aEvent;
					var fm=myEvent.fromElement;
					if(IsChild(fm,this) || fm==this) return;//过滤子元素event
					if(this.status=="active") return;
					tempref=this;
					clearTimeout(waitInterval);
					waitInterval=window.setTimeout("tempref.LoadTab();",MouseDelayTime);
				}

				thelist.onmouseout=function(aEvent){
					var myEvent = window.event ? window.event : aEvent;
					var em=myEvent.toElement;
					if(IsChild(em,this) || em==this) return; //过滤子元素event
					if(this.status=="active") return;
					clearTimeout(waitInterval);
				}

				if(ulistlinkurl.indexOf("#default")!=-1){
					thelist.setActive(true);
					ulobj.activetab=thelist;
					ajccache[ulistlinkurl]=getElement(ulistlinktarget).innerHTML;
				}else{
					thelist.setActive(false);
				}

			}
		if(ulobj.activetab==null) ulobj.activetab=ulist[0];
	}
}

function getXmlhttp()
{
	var http_request;
	
	if(window.XMLHttpRequest) { 
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType("text/xml");
		}
	}
	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) { 
		window.alert("can't create XMLHttpRequest object.");
		return null;
	}	
	return http_request;
}

function loadAJAXTab(url,contentid){
	var ocontent=getElement(contentid);
	if(ajccache[url]==null) {
		var xhttp=getXmlhttp();		
			xhttp.onreadystatechange=function(){
				if(xhttp.readyState == 4 && (xhttp.status==200 || window.location.href.indexOf("http")==-1))
				{					
					ocontent.innerHTML=xhttp.responseText;
					ajccache[url]=ocontent.innerHTML;
				}
			}
		xhttp.open("GET",url,true);
		xhttp.send(null);
	}else{
		ocontent.innerHTML=ajccache[url];
	}
}
window.onerror=function(){return true}

//xml.js
var xhr;
function getXHR()
{
	try {
		xhr=new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {		
		try {
			xhr=new ActiveXObject("Microsoft.XMLHTTP");
		} catch (e) {			
			xhr=false;
		}
	}
	if(!xhr&&typeof XMLHttpRequest!='undefined')
	{
		xhr=new XMLHttpRequest();
	}	
	
	return xhr;
}

function openXHR(method,url,callback)
{
	getXHR();
	xhr.open(method,url);
	xhr.onreadystatechange=function()
	{
		if(xhr.readyState!=4)return;
		callback(xhr);		
	}
	xhr.send(null);
}

function loadXML(method,url,callback)
{
	getXHR();
	xhr.open(method,url);
	xhr.setRequestHeader("Content-Type","text/xml");
	xhr.setRequestHeader("Content-Type","GBK");
	xhr.onreadystatechange=function()
	{
		if(xhr.readyState!=4)return;
		callback(xhr.responseXML);
	}
	xhr.send(null);
}
//=================================================
function quote(xhr)
{	
	alert(xhr.responseText);
	document.getElementById("xml").innerText=xhr.responseText;
}


//首行登录
function loginSubmit(login){
var userName = login.elements['username'];
var password = login.elements['password'];
var loginSelect = login.elements['loginSelect'].value;
if(userName.value == ""){alert("请输入用户名");return false;}
if(password.value == ""){alert("请输入密码");password.focus();return false;}
if(loginSelect == "网易通行证"){return true;}
if(loginSelect == "163邮箱"){login.action="https://reg.163.com/logins.jsp?url=http://fm163.163.com/coremail/fcg/ntesdoor2?lightweight=1&"}
if(loginSelect == "126邮箱"){userName.name = "user";password.name = "pass";login.action="https://entry.mail.126.com/cgi/login?redirTempName=https.htm&hid=10010102&lightweight=1&"}
if(loginSelect == "VIP邮箱"){login.action="http://vip.163.com/logon.m?language=-1&style=-1&enterVip=true"}
if(loginSelect == "188财富邮"){userName.name = "user";password.name = "pass";login.action="http://reg.mail.188.com/servlet/coremail/login?"}
if(loginSelect == "Yeah邮箱"){userName.name = "user";password.name = "pass";login.action="http://entry.yeah.net/cgi/login?hid=10010102&verifycookie=1&language=0&style=0"}
if(loginSelect == "Netease邮箱"){userName.name = "user";password.name = "pass";login.action="http://web.netease.com/cgi/login?verifycookie=1&language=0"}
login.submit();
}
function enterSubmit(event){
var obj = event.srcElement?event.srcElement:event.target;
var login = obj.form;
if(event.keyCode==13){loginSubmit(login);}
}
//搜索引擎
function soComm(obj){
obj.elements["word"].value=obj.elements["q"].value;
obj.elements["keyWord"].value=obj.elements["q"].value;
obj.action=obj.elements["url"].value;
}
function soCar(id){
obj=id.form;
var url="http://nisearch.163.com/includes/Ztc.php";
obj.action=url;
obj.submit();
}
/*weather begin
function getElement(aID)
{
  return (document.getElementById) ? document.getElementById(aID): document.all[aID];
}
var weather_gx;
var w_timeID;
var w_move_step=4;//值越小越平滑，速度越慢
var w_move_speed=8; // 值越小越平滑，速度越慢
function weather_init(){
	var wobj=getElement("div_weather");
	if(isNaN(parseInt(wobj.style.left)))wobj.style.left="367px"
}
function weather_on(){
	weather_gx=85;
	if (w_timeID ==undefined) w_timeID = setTimeout(tween_weatherm_move,w_move_speed);
		else {
			clearTimeout(w_timeID);
			w_timeID = setTimeout(tween_weatherm_move,w_move_speed);
		}
}

function weather_off(){
	weather_gx=372;
	clearTimeout(w_timeID);
	w_timeID = setTimeout(tween_weatherm_move,w_move_speed);
}

function tween_weatherm_move(){
	var wobj=getElement("div_weather");
	var cx=parseInt(wobj.style.left);
		cx+=(weather_gx-cx)/w_move_step;
		cx=parseInt(cx);
		wobj.style.left=cx+"px";
	if (Math.abs(cx-weather_gx)<1){
		wobj.style.left=weather_gx+"px";
		clearTimeout(w_timeID);
		w_timeID=undefined;
	}else{
		w_timeID = setTimeout(tween_weatherm_move,w_move_speed);
	}
}
*/
//local
/*
function getWeather(xmlDom)
{

var contemt='<div class="s1"><a href="http://adclient.163.com/event.ng/Type=click&FlightID=79947&AdID=81608&TargetID=502&Values=31,43,51,60,72,82,91,100,110,312,330,332,409,594,702,733,734&Redirect=http://www.gz-yibai.com/"><img src="http://cimg2.163.com/cnews/newimg/keke.gif" alt="ad" /></a></div>';
	var doc=document.getElementById("div_weather");
	var node=xmlDom.getElementsByTagName("weather");
	var len=node.length;
	for(var i=0;i<len;i++)
	{
		var c=node[i].getAttribute("c");
		var city=node[i].getAttribute("city");
		var wd=node[i].getAttribute("wd");
		var qx=node[i].getAttribute("qx");
		var img=node[i].getAttribute("qximg");
		var imgs=img.split(",");
		
		contemt+='<div class="s2"><a href="http://weather.news.163.com/">'+c+':'+wd+' '+qx+'</a></div><div class="s3">';
		for( var j=0;j<imgs.length;j++)
		{
			contemt+='<img src=http://news.163.com/img/logo/'+imgs[j]+'>';
		}
		contemt+='</div>';
	}
	doc.innerHTML=contemt;		
}
function weather(coder)
{
	loadXML("GET","/inc/weatherxml/"+coder+".xml",getWeather);
}
var city = new Array("安徽","黑龙江","山东","北京","湖北","山西","福建","湖南","陕西","甘肃","吉林","上海","广东","江苏","四川","广西","江西","天津","贵州","辽宁","西藏","海南","内蒙古","新疆","河北","宁夏","云南","河南","青海","浙江","重庆");
var weaths = new Array('58321','50953','54823','54511','57494','53772','58847','57679','57036','52889','54161','58367','59287','58238','56294','59431','58606','54527','57816','54342','55591','52856','53463','51463','53698','53614','56778','57083','52866','58457','57516');
function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
  endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0)
       break;
  }
  return "";
}
function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue) + ";path=/;domain=.163.com;expires="+expire.toGMTString();
}
function getCityWeatherID(cityname){
        for(i=0;i<city.length;i++){
        if(city[i]==cityname){
                return weaths[i];
                }
        }
        return "54511";
}

var loc = GetCookie("theaddr");
if(!loc){
document.write("<script type='text/javascript' src='http://202.108.39.152/ipquery'><" + "/script>");
}
var wloc = GetCookie("NTES_WeatherAddr");
if(!wloc){
	wloc=getCityWeatherID(loc);
}
*/
//定制地方新闻
/*
var addr = new Array("ah","hlj","sd","bj","hubei","sx","fj","hunan","shanxi","gs","jl","sh","gd","js","sc","gx","jx","tj","guizhou","ln","xz","hainan","nmg","xj","hb","nx","yn","henan","qh","zj","cq");
function getCityPage(aCity){
	for(i=0;i<city.length;i++){
		if(city[i]==aCity){
			return "/inc/163new/" + addr[i] + "to163.html";
		}
	}
	return "/inc/163new/bjto163.html";
}
function getLNewsHomeByCityName(aCity){
	for(i=0;i<city.length;i++){
		if(city[i]==aCity){
			return "http://" + addr[i] + ".news.163.com";
		}
	}
	return "http://bj.news.163.com";
}
function setLocNews(locstr){
	var l=getElement("locbar");
	l.setAttribute("href",getLNewsHomeByCityName(locstr));
	l.setAttribute("urn",getCityPage(locstr));
	l.innerHTML=locstr+"新闻";
}
function showLocSelect()
{
	var locdiv=getElement("locListDiv");
	if(locdiv.style.display=="block"){
		locdiv.style.display="none";
		return;
	}
	locdiv.style.display="block";
	var locs=locdiv.getElementsByTagName("li");
	for(var i=0;i<locs.length;i++)
	{
		var theloc=locs[i];
			theloc.onmouseover=function(){
				this.style.backgroundColor="#A0AAC8"
			}
			theloc.onmouseout=function(){
				this.style.backgroundColor="#F2F6FB"
			}
			theloc.onclick=function(){
				var locstr=this.innerHTML;
				if (locstr.indexOf(" ")!=-1) locstr=locstr.substr(0,locstr.indexOf(" ")); //fixbug 在IE下多出一个空格
				SetCookie("NTES_LocNewsAddr",locstr,365);
				setLocNews(locstr);
				hideLocSelect();
				var l=getElement("locbar");
				loadAJAXTab(l.getAttribute("urn"),l.getAttribute("rel"));			
			}
	}
}
function hideLocSelect()
{	
	getElement("locListDiv").style.display="none";
}
document.onmousedown=function(aEvent){
	var myEvent = window.event ? window.event : aEvent;
	var lo=getElement("locListDiv");
	if(!IsChild(myEvent.srcElement,lo))hideLocSelect();
}

*/
