
var docids = "";
var channelid = "0001";
var domain = "http://news.163.com/multidigg/";
function focusDiv(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 = "on";
			}
			catch (e) {
			}
		} else {
			try {
				document.getElementById(ss).style.display = "none";
			}
			catch (e) {
			}
			try {
				document.getElementById(snav).className = "";
			}
			catch (e) {
			}
		}
	}
}
function getColor(color) {
	var colorName = new Array("\ufffd\ufffd6\u026b", "\u01f36\u026b", "\ufffd\ufffd\u026b");
	var colorValue = new Array("dblue", "blue", "dred");
	for (var i = 0; i < colorName.length; i++) {
		if (colorName[i] == color) {
			return "http://cimg2.163.com/cnews/img/" + colorValue[i] + ".css";
		}
	}
	return "http://cimg2.163.com/cnews/img/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 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 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();
	}
};
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("\ufffd\ufffd", "\u04bb", "\ufffd\ufffd", "\ufffd\ufffd", "\ufffd\ufffd", "\ufffd\ufffd", "\ufffd\ufffd");
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, 1, 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("\ufffd\ufffd\u02b1\xfb\ufffd\ufffd\ufffd\ufffd\ufffd\u0763\ufffd\ufffd\ufffd\u0461\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\ufffd\u06a3\ufffd");
	}
}

