var online_help_todo = 0;
var online_help_status = 0;
var online_help_text;

function remove_childs(node,orig)
{
	if(node)
	{
		while(node.firstChild)
		{
			remove_childs(node.firstChild,0);
		}
		
		if(! orig)
		{
			node.parentNode.removeChild(node);
		}
	}
}

function show_help(text)
{
	var x = 315;
	var y = 200;
	var max_length = 25;
	
	if(Browser == "IE")
	{
		x = window.event.clientX;
		y = window.event.clientY;
		max_length = 50;
	}
	
	y += document.body.scrollTop;
	var text_length = text.length;
	var el = document.getElementById("overDiv");
	el.style.height = 15+((text_length / max_length) * 20);
	online_help_text = text;
	
	if(online_help_status == 0)
	{
		online_help_todo = 1;
		window.setTimeout("show_help_do('"+text+"',"+x+","+y+");",500);
	}
	else
	{
		online_help_todo = 0;
		hide_help_do();
		window.setTimeout("show_help_do('"+text+"',"+x+","+y+");",500);
		window.setTimeout("online_help_todo = 1;",300);
	}
}

function show_help_do(text,x,y)
{
	if((online_help_todo == 1) && (online_help_text == text))
	{
		var el = document.getElementById("overDiv");
		remove_childs(el,1);
		el.appendChild(document.createTextNode(text));
		el.style.left = (x - 310);
		el.style.top = (y + 10);
		el.style.display = "block";
		online_help_status = 1;
	}
}

function hide_help()
{
	online_help_todo = 0;
	hide_help_do();
}

function hide_help_do()
{
	if((online_help_status == 1) && (online_help_todo == 0))
	{
		var el = document.getElementById("overDiv");
		el.style.display = "none";
		online_help_status = 0;
	}
}

function order(code)
{
	if(Browser != "NS")
	{
		document.iframe_hidden.location.href = '/scripts/add_to_basket.php?code='+code;
	}
	else
	{
		document.getElementById("iframe_hidden").src = '/scripts/add_to_basket.php?code='+code;
	}
}


