var hideDelay = 300;
var parentElemHeight;
var parentElemWidth;
var displayBlock = 'block';

function show(what) {
	var elem = document.getElementById(what);
	elem.style.display = displayBlock;
}

function whide(what) {
	var elem = document.getElementById(what);
	if (elem.style.display == displayBlock) {
		setTimeout("hide('" + what + "')", hideDelay);
	}
}

function hide(what) {
	var elem = document.getElementById(what);
	if (elem.style.display == displayBlock) {
		elem.style.display = 'none';
	}
}

function menuItemShow(prnt, what, vh) {
	var elem = document.getElementById(what);
	if (vh == 'V') {
		elem.style.marginTop = getElementHeight(prnt) + "px";
		elem.style.display = displayBlock;
		parentElemWidth = getElementWidth(elem);
		//elem.style.marginTop = getElementHeight(prnt);
	} else if (vh == 'H') {
		elem.style.display = displayBlock;
		elem.style.marginLeft = (parentElemWidth-8) + "px";
		//elem.style.width = parentElemWidth + "px";
		parentElemHeight = getElementHeight(elem);
		//alert(getElementWidth(elem));
	}
}

function menuItemHide(what) {
	setTimeout("conditItemHide('" + what + "')", hideDelay);
}

function conditItemHide(what) {
	var elem = document.getElementById(what);
	elem.style.display = 'none';
}

function getElementHeight(Elem) {
	if (Elem.clip && (Elem.clip != undefined)) {
		return Elem.clip.height;
	} else if (Elem.style.pixelHeight && (Elem.style.pixelHeight != undefined)) {
		return Elem.style.pixelHeight;
	} else if (Elem.offsetHeight && (Elem.offsetHeight != undefined)) {
		return Elem.offsetHeight;
	} else {
		return '';
	}
}

function getElementWidth(Elem) {
	if (Elem.style.pixelWidth && (Elem.style.pixelWidth > 0)) {
		return Elem.style.pixelWidth;
	} else {
		return Elem.offsetWidth;
	}
}

function getStyle(x, styleProp) {
	if (x.currentStyle)
		var y = x.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	return y;
}

function showhide(elem_id) {
	type = "block";
	var elm = document.getElementById(elem_id);
	if (elm.style.display != type) {
		elm.style.display = type;
	} else {
		elm.style.display = "none";
	}
}
