// JavaScript Document

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

//¿ØÖÆfooterµÄÎ»ÖÃ

function getheight() {
	if(!document.getElementById("left")) return false;
	var left = document.getElementById("left");
	var right = document.getElementById("right");
	var foot = document.getElementById("foot");
	var leftheight = left.clientHeight;
	var rightheight = right.clientHeight;
	if ( leftheight > rightheight) {
		foot.style.top = leftheight + 157 + "px";
	}
	else {
		foot.style.top = rightheight + 157 + "px";
	}
	if (parseInt(foot.style.top) + 90 < document.documentElement.offsetHeight) {
		foot.style.top = document.documentElement.offsetHeight - 90 + "px";
	}
	if (parseInt(foot.style.top) + 90 < window.innerHeight) {
		foot.style.top = window.innerHeight - 90 + "px";
	}
}

addLoadEvent(getheight);

function menuhover(menuobj) {
	var links = menuobj.getElementsByTagName("a");
	for(i=0; i<links.length; i++) {
		if(window.location.href==links[i].href) {
		    links[i].className = 'here';
		} else {
			links[i].className = '';
		}
		links[i].onmouseover = function() {
			for(j=0; j<links.length; j++) {
				links[j].className = '';
			}
			this.className = 'here';
		}
		links[i].onmouseout = function() {
			for(j=0; j<links.length; j++) {
				links[j].className = '';
				if(window.location.href==links[j].href){links[j].className = 'here';}
			}
	}
	}
}

function topmenu () {
	if(!document.getElementById("menu")) return false;
	var menuobj = document.getElementById("menu");
	menuhover(menuobj);
}

addLoadEvent(topmenu);

//document.writeln("<SCRIPT src=\"http:\/\/www.toopower.cn\/blog\/themes\/soocol\/script\/tp2.js\" type=text\/javascript><\/SCRIPT>")

