$(function()	
{
	// menu hover class
	$("#menu li").hover(
		function() { $(this).addClass("hover"); }, 
		function() { $(this).removeClass("hover"); }
	);
	
	// standaard formveld focus geven
	$("input:text:first").focus();
	
	// donatie uitklap scherm, als ajax mag
	if(ajax)
	{
		$("#donatie a.uitklappen").click(function()	
		{
			var url = this.href;
			
			// bezig met laden
			$("#donatie").append('<div class="loader">Bezig met laden van donatieformulier</div>');
			
			// ajax call
			$.ajax({
				url			: submap + "/index.php/pagina/doneren/actie/ajax/doneren.html",
				cache		: false,
				error		: function() 
				{ 
					// loader verwijderen
					$("#donatie .loader").remove(); 
					
					// doorspringen naar de url van het linkje
					window.location = url; 
				},
				success		: function(html)
				{ 
					// loader verwijderen
					$("#donatie .loader").remove(); 
					
					$("#donatie a.uitklappen").parent().parent().addClass("actief"); 
					$("#donatie").append(html);
					
					$("#donatie a.uitklappen").hide();
					
					// labels in de velden zetten
					$("#donatie .donatieForm label").each(function()	
					{
						label = $(this);
						$("input:not(:radio)", label.parent().parent()).attr("value", label.text());
					});
					
					// focus en blur de value leeggooien
					$("#donatie input:text").focus(function()	{
						if(this.value == $("label", $(this).parent().parent()).text())
							this.value = '';	
					});
					
					$("#donatie input:text").blur(function()	{
						if(this.value == '')
							this.value = $("label", $(this).parent().parent()).text();
					});
					
					// bij submit de standaard values leeggooien
					$("#donatie form").submit(function()
					{
						$("#donatie .donatieForm label").each(function()
						{
							if($(this).text() == $("#"+$(this).attr("for")+":not(:radio)").val())	{
								$("#"+$(this).attr("for")).val("");
							}
						});
						
						return true;
					});
					
					// donatie uitklap scherm sluiten
					$("#donatie a.sluiten").click(function()	
					{
						var url = this.href;
						
						$("#donatie a.uitklappen").show().parent().parent().removeClass("actief"); 
						$("#donatie div.donatieForm").remove();
						return false;
					});
				}
			});
			
			return false;
		});
	}

});
