function openWin (fileName, windowName, width, height) { 
	window.open(fileName,windowName,'width=' + width + ',height=' + height + ',directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=no');
}

function getElementByName (root, target) {
	if (!root) return null;
	var newRoot = root.childNodes[0];
	if (newRoot.nodeName.toLowerCase() == target) return newRoot;
	else return getElementByName (newRoot, target);
}

function menuBorder() {
	var menu_ul = document.getElementById('window');
	var li = null;
	for (var i=0;i<menu_ul.childNodes.length;i++) {
		if (menu_ul.childNodes[i].nodeName.toLowerCase() == 'li') {
			li = menu_ul.childNodes[i];
			break;
		}
	}
	if (li) li.className += ' last';
}

function menuItemRollOver() {
	var targetElement = (this.nodeName)?this:window.event.srcElement;
	targetElement.className += " over";
}

function isParent (p, c) {
	while (c != p && c.nodeName != 'HTML') c = c.parentNode;
	if (c == p) return true;
	else return false;
}

function menuItemRollOut() {
	var targetElement = (this.nodeName)?this:window.event.srcElement;
	if (targetElement.nodeName != 'LI')return;
	var relTrg = (this.nodeName)?null:window.event.toElement;
	var result = relTrg?isParent(targetElement, relTrg):false;
	if (!result) {
		if (targetElement.className.indexOf('last')) targetElement.className = 'last';
		else targetElement.className = '';
	}
}

function menuRollOver () {
	var menu_ul = document.getElementById('window');
	var li = null;
	for (var i=0;i<menu_ul.childNodes.length;i++) {
		if (menu_ul.childNodes[i].nodeName.toLowerCase() == 'li') {
			li = menu_ul.childNodes[i];
			if (li.addEventListener){
				li.addEventListener('mouseover', menuItemRollOver, true);
				li.addEventListener('mouseout', menuItemRollOut, true);
			} else if (li.attachEvent){
				li.attachEvent("onmouseover", menuItemRollOver);
				li.attachEvent("onmouseout", menuItemRollOut);
			}
		}
	}
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		do {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		} while (obj = obj.offsetParent);
	}
	return [curleft,curtop];
}

//if (window.addEventListener){
//} else if (window.attachEvent){
//}