var helpBoxHeight = -1;
var helpVisible = false;
function findHelpBox() {
	var box = document.getElementById("helpBox");
	if (helpBoxHeight == -1)
		helpBoxHeight = box.offsetHeight;
	return box;
}

function hideHelpBox()
{
	var box = findHelpBox();
	
	var steps = 12;
	var stepSize = Math.ceil(helpBoxHeight / steps);
	var timerId = window.setInterval(
		function() {
			var h = box.offsetHeight - stepSize;
			if (h <= 0) {
				window.clearInterval(timerId);
				box.style.display = "none";
			} else	
				box.style.height = h + "px";
		}
		, 10);
	helpVisible = false;
	return false;
} 
function showHelpBox()
{
	var pos = document.getElementById("helpboxPlacement");
	var box = findHelpBox();
	box.style.display = "none";
	box.style.top = pos.offsetTop + "px";
	box.style.height = "0px";
	box.style.display = "block";
	
	var steps = 12;
	var stepSize = Math.ceil(helpBoxHeight / steps);
	var timerId = window.setInterval(
		function() {
			var h = box.offsetHeight + stepSize;
			if (h >= helpBoxHeight) {
				window.clearInterval(timerId);
				box.style.height = helpBoxHeight + "px";
			} else	
				box.style.height = h + "px";
		}
		, 10);
	helpVisible = true;
	return false;
} 
function toogleHelp() {
	if (helpVisible) 
		hideHelpBox(); 
	else 
		showHelpBox();
	return false;
}
function helpSetQuery(text) {
	var i = document.getElementsByName("IW_FIELD_WEB_STYLE");
	if (i.length == 0)
		i = document.getElementsByName("IW_FIELD_TEXT");
	if (i.length > 0)
		i[0].value = text;
}