function _NouveauConducteur(info)
{
	$("#fenetre").load("/html/_formulaire-conducteur.php",{id:info},function() 
	{
		$('#conducteur_numero').attr('value',info);
		$('#formulaire-conducteur-new').submit( function()
		{
			var options = { 
				target:        '#ajax-liste',   
				beforeSubmit:  validation, 
				dataType:      'json',
				success:       validationOk
			}; 
			$(this).ajaxSubmit(options); 
			return false; 
		}); 
		
		
		$("#fenetre-formulaire-conducteur .fond").css({
			float:				'left',
			'background-image':	'url(/IMG/fenetre-conducteur/Fenetre-Mail.gif)',
			width:				600,
			height:				400
		});
		
		$("#fenetre-formulaire-conducteur .croix").css({
			float:				'right'
		});
		
		$("#fenetre-formulaire-conducteur .centre").css({
			float:				'left',
			padding:				'150px 0 0 160px',
			width:				400
		});
		
		$("#fenetre-formulaire-conducteur table").css({
			width:				'100%'
		});
		
		function validationOk(data)  
		{ 
			if (data.retour == 'oui')
			{
				
				$("#bloc-etape-conducteur").load("/html/_etape4.php",{etape:4},
					function(){ChargementLien();}
				);
				_finish();
				return false;
			}
			else if (data.retour == 'non')
			{
				alert(data.message);
				//ChargerFenetre('ErreurMsg', '#0066CC', '0.8', 600, 400, data.message);
				return false;
			}
		
		}
		
		function validation()
		{ 
		}
		
		
		$('.exit-popup').click(function() {_finish();});						
	});
}

function _AncienConducteur(info)
{
	$("#fenetre").load("/html/_liste-conducteur.php",{id:info},function() 
	{
		$('#id_conducteur_select').change( function()
		{
			var id_conducteur_select = $('#id_conducteur_select').val();
			UpdateConducteur(info,id_conducteur_select);
			return false;
		}); 
		
		
		$("#fenetre-formulaire-conducteur .fond").css({
			float:				'left',
			'background-image':	'url(/IMG/fenetre-conducteur/Fenetre-Mail.gif)',
			width:				600,
			height:				400
		});
		
		$("#fenetre-formulaire-conducteur .croix").css({
			float:				'right'
		});
		
		$("#fenetre-formulaire-conducteur .centre").css({
			float:				'left',
			padding:				'150px 0 0 160px',
			width:				400
		});
		
		$("#fenetre-formulaire-conducteur table").css({
			width:				'100%'
		});
		
		
		
		
		$('.exit-popup').click(function() {_finish();});						
	});
	
	/*$("#fenetre").load("html/_liste-conducteur.php",{id:info},function() 
	{
		$('#id_conducteur_select').click( function()
		{
			var id_conducteur_select = $('#id_conducteur_select').val();
			UpdateConducteur(info,id_conducteur_select);
			return false;
		});
		$('.exit-popup').click(function() {_finish();});						
	});*/
}

function _ListeCodePostal(info)
{
	$("#fenetre").load("AJAX/_fenetre-ville.php",{cp:info},function() 
	{
		$('.cp_radio').click(function() {
			$.getJSON("AJAX/_retour_ville_region.php",{id_cp:this.value},
			function(data){
				if (data.retour == '1')
				{
					$('#id_vcp').attr('value',data.valeur[0].id_vcp);
					$('#ville').attr('value',data.valeur[0].ville);
					$('#region').attr('value',data.valeur[0].region);
				}
				
			});
			_finish();									
		});
		
		$('.exit-popup').click(function() {_finish(); return false; });						
	});
}


function _ErreurAll(fenetre, info)
{
	$("#fenetre").load("/html/_fenetre.php",{fenetre:fenetre,erreur:info},function() 
	{
		$("#fenetre-erreur .haut").css({
			float:				'left',
			'background-image':	'url(/IMG/fenetre-erreur/haut.jpg)',
			width:				600,
			height:				102
		});
		$("#fenetre-erreur .titre").css({
			float:				'left',
			'background-image':	'url(/IMG/fenetre-erreur/titre.gif)',
			width:				600,
			height:				66
		});
		$("#fenetre-erreur .centre").css({
			float:				'left',
			'background-image':	'url(/IMG/fenetre-erreur/centre.jpg)',
			width:				600,
			height:				153
		});
		$("#fenetre-erreur .bas").css({
			float:				'left',
			'background-image':	'url(/IMG/fenetre-erreur/bas.jpg)',
			width:				600,
			height:				79
		});
		$("#fenetre-erreur .croix").css({
			float:				'right'
		});
		$("#fenetre-erreur .image").css({
			float:				'left'
		});
		$("#fenetre-erreur .texte").css({
			float:				'left',
			'text-align':		'left',
			color:				'#666666',
			'font-size':		'12px',
			'font-weight':		'bold',
			margin:				'20px 0 0 73px',
			width:				330,
			height:				100
		});
		$("#fenetre-erreur .ok").css({
			float:				'left',
			'text-align':		'center',
			'font-size':		'12px',
			margin:				'0 0 0 73px',
			width:				330,
			height:				20
		});
		$('.exit-popup').click(function() {_finish(); return false; });						
	});
}


function _ResultatRecherche(fenetre, info)
{
	var lg =info.length;
	if(lg == 3)
	{
		$("#fenetre").load("/html/_recherche-accueil.php",{fenetre:fenetre,departement:info[0],ville:info[1],point_location:info[2]},function() 
		{
			$("#fenetre-recherche .fond").css({
				float:				'left',
				'background-image':	'url(/IMG/fenetre-recherche/fond.jpg)',
				width:				600,
				height:				400
			});
			
			$("#fenetre-recherche .affichage").css({
				width:				385
			});
			$("#fenetre-recherche .c1").css({
				width:				335,
				'text-align':		'left',
				'border-bottom':  	'#CCCCCC solid 1px',
				'padding-bottom': 	'6px'
			});
			$("#fenetre-recherche .c2").css({
				width:				50,
				'text-align':		'right',
				'border-bottom':  	'#CCCCCC solid 1px',
				'padding-bottom': 	'6px'
			});
			
			$('.exit-popup').click(function() {_finish(); return false; });	
			
			
			$('a.submit').click(function() 
			{
				var options = { 
					target:        '#ajax-liste',   
					beforeSubmit:  validationFormulaire, 
					dataType:      'json',
					success:       validationFormulaireOk
				}; 
				$('form.form').ajaxSubmit(options);
				return false; 
			});
			
			function validationFormulaire()
			{
					
			}
			
			function validationFormulaireOk(data)
			{
				if (data.retour == 'oui')
				{
					$('form.form').fadeOut("slow",function()
					{
   						$('#message-erreur').css({
							'margin':  	'150px 0 0 170px',
							width:				370,
							height:				100,
							'font-weight':		'bold',
							'text-align':		'center'
						}).html(data.message).fadeIn();
						$('#message-erreur-exit').css({
							'margin':  	'0 0 0 170px',
							width:				370,
							height:				50,
							'text-align':		'center'
						}).fadeIn();
 					});
					return false;
				}
				else if (data.retour == 'non')
				{
					alert(data.message);
					return false;
				}
			}
			
		});
		
	}
}


function _Simulation()
{
	$("#fenetre").load("/html/_simulation.php",{fenetre:"affichage"},function() 
	{
		$("a.simulation-ok").click(function()
		{
			var options = { 
				target:        '#ajax-liste',   
				beforeSubmit:  validationSimulation, 
				dataType:      'json',
				success:       validationSimulationOk
			}; 
			$('#formulaire-simulation').ajaxSubmit(options); 
			return false; 
		});
		
		$("#fenetre-simulation .fond").css({
			float:				'left',
			'background-image':	'url(/IMG/fenetre-simulation/fenetre-tarifs-express.jpg)',
			width:				600,
			height:				400
		}).fadeIn();
		
		$("#fenetre-simulation .zone-affichage").css({
			margin:				'75px 25px 25px 195px'
		});
		
		$("#fenetre-simulation div.exit").css({
			position:				'absolute',
			top:					'0',
			right:					'0'
		});
		
		$("#fenetre-simulation a.exit").css({
			display:				'block',
			width:					'50px',
			height:					'50px'
		});
		
		$("a.exit").click(function()
		{
		
			_finish();
			return false; 
		});
		
		
	}).fadeIn();		
	return false;
}

function validationSimulation()
{
}

function validationSimulationOk(data)
{
	if (data.retour == 'oui')
	{
		$('#form-email').fadeOut();
		$('#message-erreur').hide().html(data.message).fadeIn();
		$('input.ville').attr("value","");
		$('input.code_postal').attr("value","");
		$('input.email').attr("value","");
		return false;
	}
	else if (data.retour == 'non')
	{
		$('#message-erreur').html(data.message).fadeIn();
		return false;
	}
}