/////////////////////////////
////  月影社区 WF66.COM  ////
////  JS  调用 VER 5.0   ////
/////////////////////////////

//背景图片
//if (screen.width==1024){;document.write("<body background=images/bg.gif>");}else{;document.write("<body background=images/bg2.gif>");}

//确认框
function checkclick(msg){if(confirm(msg)){event.returnValue=true;}else{event.returnValue=false;}}

//边框
function bian_a(content){ 
document.write("<table cellSpacing=0 cellPadding=0 border=0 align="+content+"><tr><td height=8 width=8><img src=images/bian/bg_0ltop.gif></td><td background=images/bian/bg_01.gif></td><td><img src=images/bian/bg_0rtop.gif></td></tr><tr><td background=images/bian/bg_03.gif></td><td vAlign=center align=middle bgColor=#ffffff>")
}

function bian_b(){
document.write("</td><td background=images/bian/bg_04.gif></td></tr><tr><td><img src=images/bian/bg_0lbottom.gif></td><td background=images/bian/bg_02.gif></td><td height=8 width=8><img src=images/bian/bg_0rbottom.gif></td></tr></table>")
}

//显示问候
function wenhou(){
hour=(new Date()).getHours();
if(hour < 6){document.write(" 凌晨好! ");}
else if (hour < 9){document.write(" 早上好! ");}
else if (hour < 12){document.write(" 上午好! ");}
else if (hour < 14){document.write(" 中午好! ");}
else if (hour < 17){document.write(" 下午好! ");}
else if (hour < 19){document.write(" 傍晚好! ");}
else if (hour < 22){document.write(" 晚上好! ");}
else {document.write(" 夜里好! ");}
}

//2008.1.23  新增标题字数限制
function div_title(num,lei){ 
document.write("<style type='text/css'><!--")
document.write(".div_title"+lei+" {width:"+num+"px;white-space:nowrap;text-overflow:ellipsis;-o-text-overflow:ellipsis; overflow: hidden;}")
document.write(".div_title"+lei+":not(p) {clear: both;}")
document.write(".div_title"+lei+":not(p) a {max-width: "+num+"px;float: left;}")
document.write(".div_title"+lei+":not(p):after {content: \"...\";float: left;width: 25px;padding-left: 5px;color: #df3a0e;}")
document.write("--></style>")
}

function SDMenu(id) {
	if (!document.getElementById || !document.getElementsByTagName)
		return false;
	this.menu = document.getElementById(id);
	this.submenus = this.menu.getElementsByTagName("div");
	this.remember = true;
	this.speed = 5;
	this.markCurrent = true;
	this.oneSmOnly = true;
}
SDMenu.prototype.init = function() {
	var mainInstance = this;
	for (var i = 0; i < this.submenus.length; i++)
		this.submenus[i].getElementsByTagName("span")[0].onclick = function() {
			mainInstance.toggleMenu(this.parentNode);
		};
	if (this.markCurrent) {
		var links = this.menu.getElementsByTagName("a");
		for (var i = 0; i < links.length; i++)
			if (links[i].href == document.location.href) {
				links[i].className = "current";
				break;
			}
	}
	if (this.remember) {
		var regex = new RegExp("sdmenu_" + encodeURIComponent(this.menu.id) + "=([01]+)");
		var match = regex.exec(document.cookie);
		if (match) {
			var states = match[1].split("");
			for (var i = 0; i < states.length; i++)
				this.submenus[i].className = (states[i] == 0 ? "collapsed" : "");
		}
	}
};
SDMenu.prototype.toggleMenu = function(submenu) {
	if (submenu.className == "collapsed")
		this.expandMenu(submenu);
	else
		this.collapseMenu(submenu);
};
SDMenu.prototype.expandMenu = function(submenu) {
	var fullHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
	var links = submenu.getElementsByTagName("a");
	for (var i = 0; i < links.length; i++)
		fullHeight += links[i].offsetHeight;
	var moveBy = Math.round(this.speed * links.length);
	
	var mainInstance = this;
	var intId = setInterval(function() {
		var curHeight = submenu.offsetHeight;
		var newHeight = curHeight + moveBy;
		if (newHeight < fullHeight)
			submenu.style.height = newHeight + "px";
		else {
			clearInterval(intId);
			submenu.style.height = "";
			submenu.className = "";
			mainInstance.memorize();
		}
	}, 30);
	this.collapseOthers(submenu);
};
SDMenu.prototype.collapseMenu = function(submenu) {
	var minHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
	var moveBy = Math.round(this.speed * submenu.getElementsByTagName("a").length);
	var mainInstance = this;
	var intId = setInterval(function() {
		var curHeight = submenu.offsetHeight;
		var newHeight = curHeight - moveBy;
		if (newHeight > minHeight)
			submenu.style.height = newHeight + "px";
		else {
			clearInterval(intId);
			submenu.style.height = "";
			submenu.className = "collapsed";
			mainInstance.memorize();
		}
	}, 30);
};
SDMenu.prototype.collapseOthers = function(submenu) {
	if (this.oneSmOnly) {
		for (var i = 0; i < this.submenus.length; i++)
			if (this.submenus[i] != submenu && this.submenus[i].className != "collapsed")
				this.collapseMenu(this.submenus[i]);
	}
};
SDMenu.prototype.expandAll = function() {
	var oldOneSmOnly = this.oneSmOnly;
	this.oneSmOnly = false;
	for (var i = 0; i < this.submenus.length; i++)
		if (this.submenus[i].className == "collapsed")
			this.expandMenu(this.submenus[i]);
	this.oneSmOnly = oldOneSmOnly;
};
SDMenu.prototype.collapseAll = function() {
	for (var i = 0; i < this.submenus.length; i++)
		if (this.submenus[i].className != "collapsed")
			this.collapseMenu(this.submenus[i]);
};
SDMenu.prototype.memorize = function() {
	if (this.remember) {
		var states = new Array();
		for (var i = 0; i < this.submenus.length; i++)
			states.push(this.submenus[i].className == "collapsed" ? 0 : 1);
		var d = new Date();
		d.setTime(d.getTime() + (30 * 24 * 60 * 60 * 1000));
		document.cookie = "sdmenu_" + encodeURIComponent(this.menu.id) + "=" + states.join("") + "; expires=" + d.toGMTString() + "; path=/";
	}
};




SetInfo=function(id,DefaultID)
{
if (!document.getElementById || !document.getElementsByTagName)
return false;
this.menu = document.getElementById(id);
var submenus = this.menu.getElementsByTagName("span");
function memorize(){
document.cookie = "SiteUrlhu=T;path =/";
}
memorize();
init();   
function init() {
var mainInstance = this;
var mycookie=document.cookie;
var start1 = mycookie.indexOf("SiteUrlhu=");
var Str="";
if (start1!= -1)
{
var start=mycookie.indexOf("=",start1)+1; 
var end = mycookie.indexOf(";",start);
if (end==-1)
{
end=mycookie.length;
}
Str=unescape(mycookie.substring(start,end));
}
if(Str!="T"){
document.getElementById(DefaultID).className="clicked";
}
else
{
for (var i = 0; i < submenus.length; i++)
{
if(submenus[i].childNodes[0].href==unescape(window.location.href))
{
submenus[i].className="clicked";
//alert(i)
}
else
{
submenus[i].className="click";
}
}
}
}
};

window.onload = function() {if(document.getElementById('Link')) {var moonMenu;moonMenu = new SetInfo('Link','s1');} if(document.getElementById('my_menu')) {var myMenu;myMenu = new SDMenu('my_menu');myMenu.init();}};
function killErrors() {;return true;};window.onerror = killErrors;