// [- Scripts voor het zoekveld, voor de text "Zoeken". -]
function clearText(thefield){
	if (thefield.defaultValue==thefield.value)
	thefield.value = ""
} 
function setText(thefield){
	if (thefield.value == '') {
		thefield.value = "Zoeken"
	}
}
// [- END -]

// [- Ititializatie voor de livesearch. -]
$(document).ready(function() {
	$('#searchbox').autocomplete({ 
		serviceUrl:'/includes/autocomplete.php',
		minChars:1, 
		maxHeight:150,
		width:178,
		// callback function:
		onSelect: function(value, data){  
			window.location = "searchresults.php?query=" + escape(data);
		}
	});
	
	$("#zoekbutton").click(function () {
		if($('#searchbox').val() == "Zoeken" || $('#searchbox').val() == "") {
			return false;
		}
	});
	$('#searchbox input').bind('keypress', function(e) {
		if(code == 13) { //Enter keycode
   			if($('#searchbox').val() == "Zoeken" || $('#searchbox').val() == "") {
				return false;
			}
 		}
	});
	
	$("#headerLogo").css("cursor", "pointer");
	$("#headerLogo").click(function () {
		document.location = 'http://' + window.location.hostname;
	});
	
	
	/*if (! $("body").hasClass("gallery"))
	{
		$wrapperHeight = $("#wrapper").height();
		$windowHeight = $(window).height();
		
		if ($wrapperHeight < $windowHeight)
		{
			$("#wrapper").css("height", ($windowHeight - 12 ));
		}
	}*/
});
// [- END -]
