function trim(str)
{
	return str.replace (/^\s+/, '').replace (/\s+$/, '');
}

function zcsearch()
{
	var search;
	search = $("#qfv").val();

	if (search.length >= 3)
	{
		$.ajax( 
		{ 
			type: "POST", 
			url: "zielcodesuche.php", 
			data: "search=" + search, 
			success: function(message) 
			{
				if (trim(message).length == 0) return;
				
				$("#suggest").empty(); 
				if (message.length > 0) 
				{
					$("#suggest").append(message); 
				}
			} 
		});
	}
	else
	{
		$("#suggest").empty();
	}
}

function selectsuggestion(id)
{
	$("#destcode").val(id);
	$("#suggest").empty();
}

function inserttag(tag_before, tag_after){
  strSelection = document.selection.createRange().text;
  if (strSelection != "")
  document.selection.createRange().text = "[" + tag_before + "]" + strSelection + "[" + tag_after + "]";
}

function win_popup(theURL, winName, features) { //heißt beim Andreas MM_openBrWindow!
  window.open(theURL, winName, features);
}
