$(function(){
	var sDefaultNewletterValue = 'E-mailadres';
	$('#newsletterEmail').bind('focus', function(){
		var sValue = $(this).val();
		if(sValue == sDefaultNewletterValue)
		{
			$(this).val('');
			$(this).css('font-style', 'normal');
		}
	}).bind('blur', function(){
		var sValue = $(this).val();
		if('' == sValue)
		{
			$(this).val(sDefaultNewletterValue);
			$(this).css('font-style', 'italic');
		}
	});
	
	var sDefaultSearchValue = 'Zoeken';
	$('.search_input').bind('focus', function(){
		var sValue = $(this).val();
		if(sValue == sDefaultSearchValue)
		{
			$(this).val('');
			$(this).css('font-style', 'normal');
		}
	}).bind('blur', function(){
		var sValue = $(this).val();
		if('' == sValue)
		{
			$(this).val(sDefaultSearchValue);
			$(this).css('font-style', 'italic');
		}
	});
	
	$('div#wrapper-mainmenu ul li').bind('mouseenter', function(){
		$(this).find('div.submenu').show();
	}).bind('mouseleave', function(){
		$(this).find('div.submenu').hide();
	});
	
	$("input.search_input").bind("keyup", function(){
		var sSearchTerm = $(this).val();
		if($("div#header_search_results").css("display") == "none")
		{
			$("div#header_search_results").show();
			$("div#header_search_results").append("<p class=\"defaulttext\">Loading data...</p>");
		}																							
		
		$.ajax({
				url: "/search/searches/livesearchResults/"+sSearchTerm				
			,	cache: false
			,	async: true
			,	success: function(data){
					$("div#header_search_results").html(data);
				}
		});
	});
	
});
