/*
	Copyright (c) JB Interactive Pty. Ltd.
	All Rights Reserved
	http://www.jbinteractive.com.au/
*/

/* This function grabs any textboxes on the page that have a title attribute
 * and sets it as their default value. 
 */

(function ($) {
	$(document).ready (function () {
		var textboxes = $('input[type=text]');

		textboxes.each (function ()
		{
			var textbox = $(this);

			if (textbox.attr ('title')) {
				textbox.css ('color', '#aaaaaa');
				textbox.attr ('value', textbox.attr ('title'));
			}
		
			textbox.focus (function () {
				if (textbox.attr ('value') == textbox.attr ('title')) {
					textbox.attr ('value', '');
					textbox.css ('color', 'black');
				}
			});
		
			textbox.blur (function () {
				if (!textbox.attr ('value')) {
					textbox.css ('color', '#aaaaaa');
					textbox.attr ('value', textbox.attr ('title'));
				}
			})
		});
	});
})(jQuery);