amilis = function() {

	// a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
		$( "#dialog:ui-dialog" ).dialog( "destroy" );
		
			name = $( "#name" )
			email = $( "#email" )
			anneediplome = $( "#anneediplome" )
			password = $( "#password" )
			allFields = $( [] ).add( name ).add( email ).add( password ),
			tips = $( ".validateTips" );

		function updateTips( t ) {
			tips
				.text( t )
				.addClass( "ui-state-highlight" );
			setTimeout(function() {
				tips.removeClass( "ui-state-highlight", 1500 );
			}, 500 );
		}

		function checkLength( o, n, min, max ) {
			if ( o.val().length > max || o.val().length < min ) {
				o.addClass( "ui-state-error" );
				updateTips( "Length of " + n + " must be between " +
					min + " and " + max + "." );
				return false;
			} else {
				return true;
			}
		}

		function checkRegexp( o, regexp, n ) {
			if ( !( regexp.test( o.val() ) ) ) {
				o.addClass( "ui-state-error" );
				updateTips( n );
				return false;
			} else {
				return true;
			}
		}
		
		$( "#dialog-form" ).dialog({
			autoOpen: false,
			height: 400,
			width: 450,
			modal: true,
			buttons: {
				Envoyer: function() {
                if(email.val() == '' || name.val()=='' || anneediplome.val()==''){
					alert('Tous les champs sont obligatoires')
					}else {
						
					document.forms["inscAmilis"].submit();
					
					alert('Merci pour votre inscription')
                    $( this ).dialog( "close" );
					}
				},
                Annuler: function() {
					$( this ).dialog( "close" );
				}
			},
			close: function() {
				allFields.val( "" ).removeClass( "ui-state-error" );
			}
		});

		
				$( "#dialog-form" ).dialog( "open" );
		

	}
