window.onload = inAll;

function inAll() {
	inputBoxBG();
	pulldownMenu("top-nav");
}
//输入框悬停
function inputBoxBG() {
	if (document.forms.length == 0) return false;
	for (var i=0; i<document.forms.length; i++) {
		var thisform = document.forms[i];
		for (var j=0; j<thisform.elements.length; j++) {
			var element = thisform.elements[j];
			if (element.type == "text" || element.name == "comment" || element.type == "password") {
				element.onmouseover = function() {
					this.style.background = "#e3f4fd";
				}
				element.onmouseout = function() {
					this.style.background = "#fefeff";
				}
			}
		}
	}
}
//下拉菜单
function pulldownMenu(MenuID) {
	if (!document.getElementById(MenuID)) return false;
	var nav = document.getElementById(MenuID);
	if (!nav.getElementsByTagName("ul")) return false;
	var childs = nav.getElementsByTagName("ul");
	for (var i=0; i<childs.length; i++) {
		var child = childs[i];
		if (child.className == "children") {
			child.parentNode.onmouseover = function() {
				var this_child = this.getElementsByTagName("ul");
				this_child[0].style.display = "block";
			}
			child.parentNode.onmouseout = function() {
				var this_child = this.getElementsByTagName("ul");
				this_child[0].style.display = "none";
			}
		}
	}
}
