var docids = "";
var channelid = "0001";
function showDiv(obj,num,len)
{
 for(var id = 1;id<=len;id++)
 {
  var ss=obj+id;
  var snav =obj+"nav"+id;
  if(id==num){
	try{document.getElementById(ss).style.display="block"}catch(e){};
	try{document.getElementById(snav).className="active"}catch(e){};
  }else{
	try{document.getElementById(ss).style.display="none"}catch(e){};
	try{document.getElementById(snav).className=""}catch(e){};
  }
 }  
}
function showFocus(num)
{
 for(var id = 1;id<=4;id++)
 {
  var fpid="focusPic"+id;
  var fcid="focusContent"+id;
  var fnid="focusnav"+id;
  if(id==num){
  	try{document.getElementById(fpid).style.display="block"}catch(e){};
	try{document.getElementById(fcid).style.display="block"}catch(e){};
	try{document.getElementById(fnid).className="active"}catch(e){};
  }else{
	try{document.getElementById(fpid).style.display="none"}catch(e){};
	try{document.getElementById(fcid).style.display="none"}catch(e){};
	try{document.getElementById(fnid).className=""}catch(e){};
  }
 }  
}
var hidid;
function calendar(divid,obj)
{	
	clearTimeout(hidid);
	obj.onmouseout=function(){
		hidid=setTimeout("hideDiv1()",300);
	}
	document.getElementById(divid).style.display="block";
	document.getElementById(divid).onmouseover=function(){
		clearTimeout(hidid);
	}
	document.getElementById(divid).onmouseout=function(aEvent){
		var myEvent = window.event ? window.event : aEvent;
		var srcElement=window.event ? myEvent.srcElement : myEvent.target;
		if(srcElement==document.getElementById("calendarContainer")){
			hidid=setTimeout("hideDiv1()",300);
		}
	}
}
function floatDiv1(divid,obj)
{	
	clearTimeout(hidid);
	obj.onmouseout=function(){
		hidid=setTimeout("hideDiv2()",300);
	}
	document.getElementById(divid).style.display="block";
	document.getElementById(divid).onmouseover=function(){
		clearTimeout(hidid);
	}
	document.getElementById(divid).onmouseout=function(aEvent){
		var myEvent = window.event ? window.event : aEvent;
		var srcElement=window.event ? myEvent.srcElement : myEvent.target;
		if(srcElement==document.getElementById("morekeyword1")){
			hidid=setTimeout("hideDiv2()",300);
		}
	}
}
function floatDiv2(divid,obj)
{	
	clearTimeout(hidid);
	obj.onmouseout=function(){
		hidid=setTimeout("hideDiv3()",300);
	}
	document.getElementById(divid).style.display="block";
	document.getElementById(divid).onmouseover=function(){
		clearTimeout(hidid);
	}
	document.getElementById(divid).onmouseout=function(aEvent){
		var myEvent = window.event ? window.event : aEvent;
		var srcElement=window.event ? myEvent.srcElement : myEvent.target;
		if(srcElement==document.getElementById("morekeyword2")){
			hidid=setTimeout("hideDiv3()",300);
		}
	}
}
function floatDiv20(divid,obj)
{	
	clearTimeout(hidid);
	obj.onmouseout=function(){
		hidid=setTimeout("hideDiv20()",300);
	}
	document.getElementById(divid).style.display="block";
	document.getElementById(divid).onmouseover=function(){
		clearTimeout(hidid);
	}
	document.getElementById(divid).onmouseout=function(aEvent){
		var myEvent = window.event ? window.event : aEvent;
		var srcElement=window.event ? myEvent.srcElement : myEvent.target;
		if(srcElement==document.getElementById("morekeyword20")){
			hidid=setTimeout("hideDiv20()",300);
		}
	}
}
function floatDiv30(divid,obj)
{	
	clearTimeout(hidid);
	obj.onmouseout=function(){
		hidid=setTimeout("hideDiv30()",300);
	}
	document.getElementById(divid).style.display="block";
	document.getElementById(divid).onmouseover=function(){
		clearTimeout(hidid);
	}
	document.getElementById(divid).onmouseout=function(aEvent){
		var myEvent = window.event ? window.event : aEvent;
		var srcElement=window.event ? myEvent.srcElement : myEvent.target;
		if(srcElement==document.getElementById("morekeyword30")){
			hidid=setTimeout("hideDiv30()",300);
		}
	}
}
function hideDiv1()
{
	try{document.getElementById("dcalendar").style.display="none"}catch(e){};
}
function hideDiv2()
{
	try{document.getElementById("hotkeyword1").style.display="none"}catch(e){};
}
function hideDiv3()
{
	try{document.getElementById("hotkeyword2").style.display="none"}catch(e){};
}
function hideDiv20()
{
	try{document.getElementById("hotkeyword20").style.display="none"}catch(e){};
}
function hideDiv30()
{
	try{document.getElementById("hotkeyword30").style.display="none"}catch(e){};
}
function IsChild(cNode,pNode){
	if(cNode==pNode) return false;
	while(cNode!=null){
		cNode=cNode.parentNode;
		if(cNode==pNode) return true; 
	}
	return false;
}
document.onmousedown=function(aEvent){
	var myEvent = window.event ? window.event : aEvent;
	var srcElement=window.event ? myEvent.srcElement : myEvent.target;
	if(!IsChild(srcElement,document.getElementById("newscalendar"))) hideDiv1();
	if(!IsChild(srcElement,document.getElementById("morekeyword1"))) hideDiv2();
	if(!IsChild(srcElement,document.getElementById("morekeyword2"))) hideDiv3();
	if(!IsChild(srcElement,document.getElementById("morekeyword20"))) hideDiv20();
	if(!IsChild(srcElement,document.getElementById("morekeyword30"))) hideDiv30();
}
var months = new Array("01", "02", "03","04", "05", "06", "07", "08", "09","10", "11", "12");
var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31,30, 31, 30, 31);
var days = new Array("日","一", "二", "三","四", "五", "六");
function getDays(month, year) {
if (1 == month)
return ((0 == year % 4) && (0 != (year % 100))) ||
(0 == year % 400) ? 29 : 28;
else
return daysInMonth[month];
}
function getToday() {
this.now = new Date();
this.year = this.now.getFullYear();
this.month = this.now.getMonth();
this.day = this.now.getDate();
this.hours=this.now.getHours();
}
today = new getToday();
function newCalendar() {
today = new getToday();
var parseYear = parseInt(document.getElementById("year")[document.getElementById("year").selectedIndex].text);
var newCal = new Date(parseYear,document.getElementById("month").selectedIndex, 1);
var day = -1;
var startDay = newCal.getDay();
var daily = 0;
if ((today.year == newCal.getFullYear()) &&(today.month == newCal.getMonth()))
day = today.day;
var tableCal = document.getElementById("dayList");
var intDaysInMonth =getDays(newCal.getMonth(), newCal.getFullYear());
for (var intWeek = 0; intWeek < tableCal.rows.length;intWeek++)
for (var intDay = 0;intDay < tableCal.rows[intWeek].cells.length;intDay++)
{
var cell = tableCal.rows[intWeek].cells[intDay];
if ((intDay == startDay) && (0 == daily))
daily = 1;
if(day==daily)
cell.className = "active";
else if(intDay == 0 || intDay == 6)
cell.className = "c1";
else  
cell.className ="c2";
if ((daily > 0) && (daily <= intDaysInMonth))
{ 
setInnerText(cell,daily);
daily++;
}
else
setInnerText(cell,"");
}}
function setInnerText(elm,text){
	if(navigator.appName.indexOf("Explorer") > -1){
    elm.innerText = text;
	} else{
     elm.textContent = text;
	}
}
function getInnerText(elm){
	if(navigator.appName.indexOf("Explorer") > -1){
     return elm.innerText;
	} else{
     return elm.textContent;
	}
}
function fSetYearMon(iYear,iMon){
	document.getElementById("month").options[iMon-1].selected=true;
	for(var i=0;i<document.getElementById("year").length;i++){
		if(document.getElementById("year").options[i].value==iYear){
			document.getElementById("year").options[i].selected=true;
		}
	}
	newCalendar();
}
function NextMonth(){
	var iMon=document.getElementById("month").value;
	var iYear=document.getElementById("year").value;
	if(++iMon>12){iMon=1;iYear++;}
	fSetYearMon(iYear,iMon);
}
function PrevMonth(){
	var iMon=document.getElementById("month").value;
	var iYear=document.getElementById("year").value;
	if(--iMon<1){iMon=12;iYear--;}
	fSetYearMon(iYear,iMon);
}
function getDate(evt) {
	evt=evt?evt:(window.event?window.event:null);
var srcElement = evt.srcElement ? evt.srcElement : evt.target;
var srcInnerText=getInnerText(srcElement);
var noday=new Date(document.getElementById("year").value,document.getElementById("month").value-1,srcInnerText,12,0,0);
var starday=new Date(2005,01,1);
var now_day=new Date(today.year,today.month,today.day,today.hours,0,0);
if ((noday>=starday) && (now_day>=noday)){
if (srcElement.tagName =="TD" )
	if (srcInnerText != "")
	{
		var sToday=srcInnerText;
		if (parseInt(sToday)<10) {
			sToday="0"+sToday;
		}
	var sDate ="http://post2.news.163.com/wgethtml/http+!!news.163.com!/"+document.getElementById("year").value + "-" + months[document.getElementById("month").value-1] + "/"+sToday + "/12.html";
	window.open(sDate);
	}
}else{
	alert("暂时没有内容！请选择其他日期！")
}
}
/*增加的JS*/
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/* ADD BY AMY 2009-1-7*/
function ScrollImgLeft(){
var speed=20
var scroll_begin = document.getElementById("scroll_begin");
var scroll_end = document.getElementById("scroll_end");
var scroll_div = document.getElementById("scroll_div");
scroll_end.innerHTML=scroll_begin.innerHTML
function Marquee(){
    if(scroll_end.offsetWidth-scroll_div.scrollLeft<=0)
      scroll_div.scrollLeft-=scroll_begin.offsetWidth
    else
      scroll_div.scrollLeft++
}
var MyMar=setInterval(Marquee,speed)
scroll_div.onmouseover=function() {clearInterval(MyMar)}
scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
}