
$(function()
{
	$(document).keyup(function(evt)
	{
		// F9: Logon/Logoff
		if (evt.keyCode == 120)
		{
			// hidden input _hx_login value contains login / logoff url
			window.location = $('input#_hx_login').val();
		}
	});
	
	// Begin zoekopdracht d.m.v. klik op Zoeken of enter toets in zoekterm veld
	$('input#search-btn').click(startSearch);
	$('input#q').keydown(checkSearchEnter);
});


function startSearch(evt)
{
	evt.preventDefault();
	// searchoptionsToCookie();
	// use the tabid=xxx notation because otherwise the querystring is messed up by the dnn url rewriter
	var url = '/Default.aspx?tabid=79&';
	url += $('input#q').serialize();
	document.location = url;
}

function checkSearchEnter(evt)
{
	if (evt.keyCode == 13)
	{
		evt.stopPropagation();
		startSearch(evt);
	}
}


function printInhoud()
{
	// neem inhoud van tabelcel voor het contentpane
	var html = new String(document.getElementById("ContentPanesTable").innerHTML);

	// verwijder plaatjes
	var rgx = new RegExp('<td style="background.+?/td>', 'i');
	html = new String(html.replace(rgx, ""));

	// plaats inhoud in html context met stylesheet
	html = "<html><head><title>" + document.title + "</title>"
		+ "<LINK rel='stylesheet' type='text/css' href='/Portals/beeldschermtachograaf/Skins/BstDnn4skin/UI/BstDnn4skin.css'></LINK>"
		+ "</head><body>" + html + "</body></html>";
	
	// open popup window, schrijf print-inhoud erin en open print dialog
	var args = "height=480, width=600, resizable=yes, directories=no, scrollbars=no, location=no, menubar=no, toolbar=no";
	var oPrintWindow = window.open("", "printwindow", args);
	oPrintWindow.document.write(html);
	oPrintWindow.document.close(); // (flush buffer met in window geschreven html)
	oPrintWindow.print();
	oPrintWindow.close();
}
