
// --------------------------------------------------- 	
// Funzione di servizio x visualizzare l'errore   	
// --------------------------------------------------- 	

	function Display_error( Form_name, input_element, message ) {	
		
		var closebut_html = ' <div style="position: absolute; right: 4px; top: 2px;"><a href="#">x</a></div>';
		
		$( "div#formSearchCeck" ).fadeIn( 100, 
			function(){
				$( "div#formSearchCeck" ).empty().append( message + closebut_html ).fadeIn( 100, 
					function(){
						Form_name.elements[ input_element ].focus();
						$( "div#formSearchCeck a" ).click(
							function(){
								$( "div#formSearchCeck" ).empty().fadeOut( 100 );
							});
						// End {"click close"}
					});
				// End {"fadeIn MSG"}
			});
		// End {"fadeIn Slert box"}({
	}
	
// --------------------------------------------------- 	



// --------------------------------------------------- 	
// CHECK CONTACTS FORM  	
// (utilizza 'Display_error')
// --------------------------------------------------- 	
	
	function Form_Validator( theForm ) {	

		// Nome
		if ( theForm.elements[ 'item_field[firstname]' ].value == "" ) {
			Display_error( theForm, 'item_field[firstname]', "<b>Attenzione!</b> Nome non valido o mancante." );
			return (false);
		}
		// Nome //
		
		// Cognome
		if ( theForm.elements[ 'item_field[lastname]' ].value == "" ) {
			Display_error( theForm, 'item_field[lastname]', "<b>Attenzione!</b> Cognome non valido o mancante." );
			return (false);
		}
		// Cognome //
		
		// E-mail
		if ( ( !( theForm.elements[ 'item_field[email]' ].value.search(/^\w+((\+\w+)|(-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.([A-Za-z0-9])([A-Za-z0-9]?)([A-Za-z0-9]?)$/)!= -1)) || ( theForm.elements[ 'item_field[email]' ].value == "" ) ) {  
			Display_error( theForm, 'item_field[email]', "<b>Attenzione!</b> E-mail non valida o mancante." );
			return (false);
		}
		// E-mail //		
		
		// Messaggio
		if ( theForm.elements[ 'description' ].value == "" ) {
			Display_error( theForm, 'description', "<b>Attenzione!</b> Messaggio mancante." );
			return (false);
		}
		// Messaggio //	
		
		theForm.okForm.value = true;
		return (true);
	}
// --------------------------------------------------- 	
// --------------------------------------------------- 



