	function modifierinfos()
		{
			alert("test");
		}
	
	$(function() {
		
		$("#inscription").hide();
		$("#dialog").hide();
		
			var password = $("#password"),
			name=$("#name"),
			nom=$("#nom"),
			passwordi=$("#passwordi"),
			passwordic=$("#passwordic"),
			nom_soc=$("#nom_soc"),
			adresse=$("#adresse"),
			ville=$("#ville"),
			cp=$("#cp"),
			tel_resp=$("#tel_resp"),
			email=$("#email"),
						
			allFields = $([]).add(name).add(password).add(passwordi).add(passwordic).add(nom_soc).add(adresse).add(ville).add(cp).add(tel_resp).add(email),
			tips = $("[id*='validateTips']");

		function updateTips(t) {
			tips.text(t).effect("highlight",{},1500);
		}

		function checkLength(o,n,min,max) {

			if ( o.val().length > max || o.val().length < min ) {
				o.addClass('ui-state-error');
				updateTips("La longueur de " + n + " doit etre comprise entre "+min+" et "+max+".");
				return false;
			} else {
				return true;
			}

		}

		function checkpass(o,n) {

			if ( o.val()!=n.val() ) {
				o.addClass('ui-state-error');
				updateTips("Les mots de passe ne correspondent pas !");
				return false;
			} else {
				return true;
			}

		}

		function inscription()
		{
			var bValid = true;
			allFields.removeClass('ui-state-error');
			bValid = bValid && checkLength(nom_soc,"nom societe",3,40);
			bValid = bValid && checkLength(passwordi,"mot de passe",3,16);
			bValid = bValid && checkpass(passwordi,passwordic);
			bValid = bValid && checkLength(tel_resp,"téléphone",5,15);
			bValid = bValid && checkLength(email,"email",4,50);
			
			bValid = bValid && checkRegexp(passwordi,/^([0-9a-zA-Z])+$/,"Le mot de passe doit seulement contenir des lettres et des chiffres");
					
					
				
					if (bValid) {
						$("#inscription").dialog('destroy');
							$("#dialog").dialog({
							bgiframe: true,
							modal: true,
							buttons: {
								Ok: function() {
									$(this).dialog('close');
				}
			}
		});
						$.post("enregistre.php",$("#inscform").serialize());
				}
				
				
			
		}
		
		
		function checkRegexp(o,regexp,n) {

			if ( !( regexp.test( o.val() ) ) ) {
				o.addClass('ui-state-error');
				updateTips(n);
				return false;
			} else {
				return true;
			}

		}
		

		function log(){
		$("#login").dialog({
			bgiframe: true,
			autoOpen: true,
			height:'auto',
			width:400,
			modal: true,
			buttons: {
				'vous inscrire': function(){
					
					$("#inscription").dialog({
						bgiframe: true,
						autoOpen: true,
						height:'auto',
						width:400,
						modal: true,
						buttons: {
							'Envoyer':function(){
								inscription();
							}
							}});
				},
				'Connexion': function() {
					var bValid = true;
					allFields.removeClass('ui-state-error');

					bValid = bValid && checkLength(name,"username",3,40);
					bValid = bValid && checkLength(password,"password",0,16);

					bValid = bValid && checkRegexp(name,/^[a-z]([0-9a-z_])+$/i,"Le nom d'utilisateur doit contenir uniquement des lettres, des chiffres, et commencer par une lettre.");
					// From jquery.validate.js (by joern), contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/
				
					bValid = bValid && checkRegexp(password,/^([0-9a-zA-Z])+$/,"Le mot de passe doit seulement contenir des lettres et des chiffres");
					
					
				
					if (bValid) {
						$.post("login.php",$("#loginform").serialize(),function(data){
						if (data=="KO")
						{
							updateTips("Utilisateur ou mot de passe incorrect");
						}
						else
						{	
							$("#login").dialog('destroy');
							$("#tabs-1").load('stage.php');
							
						}
					});
						
					}
				}
				
			},
			close: function() {
				$(this).dialog('destroy');
				log();
			}
		});	
}

	log();
	
	
	
	}); 