﻿function submitSearchForm(){
	window.location.href = "/index.php?params=search_nl--"+escape($('input:text[name=searchString]').val());
}

function submitForm(){
	$("#searchForm").submit();
}

function setDocHeight(){
	var item = $(this);
	if($("#MENU2").length > 0){	
		var position = $("#MENU2").position();
		var h1 = position.top + $("#MENU2").outerHeight() + 200;
	}
	else{
		var h1 = 0;
	}
	var position2 = $("#content-height").position();
	var h2 = $(document).height() - 230;
	var h3 = position2.top + $("#content-height").outerHeight() + 20;
	item.height(Math.max(Math.max(h1,h2),h3));
}

$(document).ready(
	function(){		
		$("#main-content").each(setDocHeight);
		$("#searchForm").validate({
			submitHandler: function(form) {
				submitSearchForm();
			},
		});
		$("#searchInput").keypress(function(event) {
			if ( event.which == 13 ) {
				event.preventDefault();
				submitSearchForm();
			}
		});
	}
);
