function controleer_zoekwoorden()
{
	if (document.getElementById('trefwoorden').value == "")
	{
		alert("U dient een of meerdere trefwoorden in te voeren om te zoeken!");
		document.getElementById('trefwoorden').focus();
		return (false);
	}
	else
	{
		document.location.href = submap + "/index.php/pagina/zoeken/keywords/" + document.getElementById('trefwoorden').value;
		return false;
	}
}

function easyflex_zoeken(formulier)
{
	window.frames['easyflex'].location = document.forms['frm_zoeken'].action + '&query=' + document.getElementById('query').value	+'&postcode=' + document.getElementById('postcode').value;
}

/**
 * jquery.defaultvalue
 * @param	string	defaultvalue
 * @return	jQuery
 */
$.fn.defaultvalue = function( defVal )
{
	return this.each(function()
	{
		var $input = $(this);
		if($input.val() == "" || $input.val() == defVal)
		{
			$input.addClass("defaultvalue").val(defVal);
		}

		$input
			.focus(function() {
				if($input.val() == defVal)
					$input.val("").removeClass("defaultvalue");
			})
			.blur(function(){
				if($input.val() == "")
					$input.addClass("defaultvalue").val(defVal);
			});
	});
};

$(function()
{	
	// default value bij formulieren
	$("input:text[title], textarea[title]").each(function() {
		$(this).defaultvalue( $(this).attr("title") );
	});

	$("#eaysflex-zoeken").submit(
		function()
		{
			if($("#query").val().length <= 0 || $("#query").val() == $("#query").attr("title") )
			{
				alert('Vul svp een zoekterm in en evt. een postcode.')
				return false
			}
		}
	)
});
