function fillBox(id, defaultText) {
	var el = document.getElementById(id);

	if (el.value == "") {
		el.value = defaultText;
		el.className = "";
	} else if (el.value == defaultText) {
		el.value = "";
		el.className = "on";
	}
}

$(function(){
	if ($.fn.menu) {
		$('#elenco').menu({
			content: $('#elenco-menu').html(),
			linkHover: null,
			linkHoverSecondary: null,
			flyOut: true,
			showSpeed: 200,
			width: 250
		});
		$('#rubrica').menu({
			content: $('#rubrica-menu').html(),
			linkHover: null,
			linkHoverSecondary: null,
			flyOut: true,
			showSpeed: 200
		});
		$('#servizi').menu({
			content: $('#servizi-menu').html(),
			linkHover: null,
			linkHoverSecondary: null,
			flyOut: true,
			showSpeed: 200,
			width: 230
		});
		$('#dwl').menu({
			content: $('#dwl-menu').html(),
			linkHover: null,
			linkHoverSecondary: null,
			flyOut: true,
			showSpeed: 200
		});
	}
});


// Field With Message jQuery Plugin
(function ($, window, document, undefined) {
	$.fn.fieldWithMessage = function () {
		return this.each(function () {
			var field = $(this);

			if (!field.data('fieldWithMessage.message')) {
				var message = field.attr('title');

				field
					.data('fieldWithMessage.message', message)
					.click(function _fieldWithMessageClick() {
						if (field.val() === message) {
							field
								.removeClass('field-with-message')
								.val('');
						}
					})
					.blur(function _fieldWithMessageBlur() {
						if (!field.val().length || field.val() === message) {
							field
								.addClass('field-with-message')
								.val(message);
						}
					})
					.blur();
			}
		});
	};
})(jQuery, window, document);

