﻿var docids = "";
var channelid = "0001";
function getColor(color)
{
	var colorName = new Array("深蓝色","浅蓝色","红色");
	var colorValue = new Array("dblue","blue","dred");
	for(var i = 0;i < colorName.length;i++)
	{
	
	} 
	return "images/dblue.css";
}
function setColor(color)
{
	var v =getColor(color);
	if(color != ""){
		document.getElementById("setcolor").href=v;
		SetCookie("NTES_TheColor",color,365);
	}
}
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("1", "2", "3","4", "5", "6", "7", "8", "9","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 == 3 || intDay == 5)
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(2008,1,1);
var now_day=new Date(today.year,today.month,today.day,today.hours,0,0);
var sToday=srcInnerText;
var QQday=new Date(document.getElementById("year").value,document.getElementById("month").value-1,sToday)
if ((noday>=starday) && (now_day>=noday)&&(QQday.getDay()==3)||(noday>=starday) && (now_day>=noday)&&(QQday.getDay()==5)){
if (srcElement.tagName =="TD" )
	if (srcInnerText != "")
	{
		
   var sDate ="http://www.ljxw.com/newspaper.asp?d="+document.getElementById("year").value + "-" + months[document.getElementById("month").value-1] + "-"+sToday;

window.open(sDate);

}
	
}else{
	alert("所选定时间没有内容！我们只在周二、周五出报！")
}
}
