var visibleLayer = null;

function Show(layer, x, y)
{	
	Hide();
	
	layer.style.left = x;
	layer.style.top = y;
	layer.style.display = "";
	
	visibleLayer = layer;
}

function Hide()
{
	if (visibleLayer != null)
	{
		visibleLayer.style.display = "none";	
		visibleLayer.style.left = 0;
		visibleLayer.style.top = 0;
		visibleLayer = null;
	}
} 

function LoadPrintTemplate()
{
	var html = new Array("");
	var nodes = window.opener.document.getElementsByTagName("DIV");
	for (var i = 0; i < nodes.length; i++)
	{
		var node = nodes[i];
		if (node.getAttribute("name") == "print")
		{
			html.push("<p style='padding: 5px 0px 0px 0px'>");
			html.push(node.innerHTML);
			html.push("</p>");
		}
	}
	
	var div = document.getElementById("printArea");
	div.innerHTML = html.join("");
	
	window.print();
	window.close();
}

function PrintMaps(windowTitle)
{
	try
	{
		var win = window.open('/html/printTemplate.html', 'Druckansicht', 'width=200,height=100,toolbar=no,location=yes,status=yes,resizable=yes,scrollbars=yes');
		win.document.title = windowTitle;
	}
	catch (ex)
	{
	}
}

function SearchTextBox_KeyDown(e)
{
	var e = (window.event) ? event : e;
	
	if (e.keyCode == 13) // enter key
	{
		if (e.stopPropagation) // it's Mozilla? - don't let browser submit form
		{
			e.stopPropagation();
			e.preventDefault(); 
		}

		e.cancelBubble = true;
		e.returnValue = false;
		
		StartSearch();
	}
}

function StartSearch()
{
	var tb = document.getElementById('searchTextBox');
	window.location.href = '/search.aspx?Search=' + encodeURIComponent(tb.value);
}