
var ua = navigator.userAgent.toLowerCase();
var isIE = ( (ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1) );

var prevSect = false;

var tm = 0;

function expand_content(obj, submenu) {

	resetTimer();

	var apm = document.getElementById("menubar");

	if(apm) {
		subs=apm.getElementsByTagName("DIV");
		for(var i = 0; i < subs.length; i++) {
			var pass = null;
			if(isIE) {
				pass = "";
			}
			else {
				for(var j = 0; j < subs[i].attributes.length; j++) {
					if(subs[i].attributes[j].name == 'sid') {
						pass = j;
						break;
					}
				}
			}
			if(pass != null) {
				if(
					((subs[i].attributes[pass]) && (subs[i].attributes[pass].value == submenu))
					|| (isIE && subs[i].sid == submenu)
				) {
					if(prevSect) prevSect.style.display = 'none';
					var sect = subs[i];
					var parent = document.getElementById(submenu);
					sect.style.display = 'block';

					sect.style.top = getTop(parent) + parent.offsetHeight;
					sect.style.left = getLeft(parent);
					prevSect = sect;	// saving as previous to close it next time
					break;
				}
			}
		}
	}

}

function collapse() {
	if(prevSect) prevSect.style.display = 'none';
	resetTimer();
}

function preCollapse() {
	tm = setTimeout("collapse()", 1000);
}

function resetTimer() {
	clearTimeout(tm);
	tm = 0;
}

function do_onload() {

	// просто клёвый код. пригодится.
	/*var tabobj=document.getElementById("tablist");
	if(tabobj) {
		tabobjlinks=tabobj.getElementsByTagName("A");
	}*/

}

// add onLoad function

if (window.addEventListener)
	window.addEventListener("load", do_onload, false);
else if (window.attachEvent)
	window.attachEvent("onload", do_onload);
else if (document.getElementById)
	window.onload=do_onload;

