﻿//Bron: http://www.dotnetcurry.com/ShowArticle.aspx?ID=427

$.noConflict();

jQuery(document).ready(function ($)
{
	$(function ()
	{
		$(".water").focus(function ()
		{
			$tb = $(this);
			if ($tb.val() == this.title)
			{
				$tb.val("");
				$tb.removeClass("water");
			}
		});

		$(".water").blur(function ()
		{
			$tb = $(this);
			if ($.trim($tb.val()) == "")
			{
				$tb.val(this.title);
				$tb.addClass("water");
			}
		});

		//De each functie moet als laatste (na de focus en blur functies) in het script staan om er voor te zorgen 
		//dat de watermark functionaliteit ook werkt na een postback voor textboxen waar vóór de postback een waarde
		//is ingevoerd die na de postback (eventueel) wordt verwijderd.
		$(".water").each(function ()
		{
			$tb = $(this);

			if ($.trim($tb.val()) == "")
			{
				$tb.val(this.title);
				$tb.addClass("water");
			}

			if ($tb.val() != this.title)
			{
				$tb.removeClass("water");
			}
		});

	});

});  
