function printPage(id) 
{
	var da = (document.all) ? 1 : 0;
	var pr = (window.print) ? 1 : 0;

	if(!pr)
		return;

	var printArea = document.getElementById(id);
	
	if(printArea) 
	{
		var sStart = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"><html><head><title></title><link rel=\"stylesheet\" type=\"text/css\" href=\"/styles/styles_print.css\" /></head><body onload=\"javascript:print();window.close();\"><div id=\"mainBody\">";
		sStop = "</div></body></html>";

		var w = window.open('about:blank','printWin','toolbar=no, directories=no, status=no, menubar=no, resizable=no,width=600,height=600,scrollbars=yes');
		wdoc = w.document;
		wdoc.open();
		wdoc.write( sStart + printArea.innerHTML + sStop);
		wdoc.close();
	}
}

function search(url, box)
{
	
	var form = document.forms[0];
	var field = document.getElementById(box);
	if (field != null)
	{
		text = getSearchEncoded(field.value);
	}
	else
	{
		text = getSearchEncoded(form.TopSearch.value);
	}
	if(url.indexOf("?") > 0)
		result = "&s=" + text;
	else
		result = "?s=" + text;
		
	location.href = url + result;	
}

function tsearch(evt, url, box)
{	
	if (evt && (evt.keyCode == 13 || evt.which == 13))
	{
		search(url, box);
		return false;
	}
	else
	{
		return true;
	}
}

function jump(url, jump)
{
	var form = document.forms[0];
	text = getSearchEncoded(form.Search.value);
	offset = parseInt(parseFloat(form.Offset.value)) + jump;
	
	if(url.indexOf("?") > 0)
		result = "&s=" + text;
	else
		result = "?s=" + text;
	
	if (offset > 0)
	{
		result += "&o=" + offset;
	}
	
	location.href = url + result;
}

function getSearchEncoded(search)
{
	return encodeURI(search);
}

function Export()
{
	window.open(location.href + '&export=true')
}

function EditOpen(url)
{
	window.open(url)
}