submitFormRichiestaInformazioni = function ()
{
	var msg = $(this).find("div.message"); 
	if ($(this).validateForm() == true)
	{
		var value = $(":input[name='rdgContact']:checked").val();
		if (value == undefined)
		{
			$(msg).html("E' obbligatorio selezionare una tipologia di contatto").fadeIn();
			$(this).find(":input[type='submit']").show();
			return false;
		}
		else
		{
			if (value == 2)
			{
				if ($.trim($("#txtPhoneNumber").val()).length <= 0)
				{
					$(msg).html('Il campo telefono è obbligatorio').fadeIn();
					$(this).find(":input[type='submit']").show();
					return false;
				}
			}
		}
		
		$("form#formRichiestaInformazioni :input#task").val("S");
		return true;
	}
}

$(document).ready(
	function ()
	{
		$("li.menuItem").mouseover(
			function ()
			{
				$($(this).find("img.normal")[0]).css("display", "none");					
				$($(this).find("img.over")[0]).css("display", "inline");
			}
		);
		$("li.menuItem").mouseout(
			function ()
			{
				$($(this).find("img.over")[0]).css("display", "none");
				$($(this).find("img.normal")[0]).css("display", "inline");					
			}
		);
		
		var childrenWidth = 0;
		$("div#menuWrapper").children("a.menuItem").each(
			function ()
			{
				childrenWidth += $(this).outerWidth(true);
			}
		);
		
		if (childrenWidth > 0)
		{
			var menuWrapperMargin = ($("div#wrapper").width() - childrenWidth) / 2;
			$("div#menuWrapper").css("padding-left", menuWrapperMargin + "px");
			//$("div#menuWrapper").css("padding-right", menuWrapperMargin + "px");
		}
		
		$("form#formRichiestaInformazioni").each(
			function ()
			{
				$(this).initForm({bind:false});
				$(this).submit(submitFormRichiestaInformazioni)
			}
		);
	}
);
