function modifCoord()
{
	MBox.afficher('modifClient.php', false);
}

function confirmModif(modif)
{	
	MBox.afficher('modifClient.php?confirm&modif='+modif);
}

var MBox = {
	
	div : 0,
	divc : 0,
	
	afficherCalque : function()
	{
		this.divc = document.createElement('div');
	    var attribut = document.createAttribute('id');
	    attribut.nodeValue = 'calque';
	    this.divc.setAttributeNode(attribut);	   	
		
	    var opacite = 50;	    
	    
	    if (navigator.appName.indexOf('Microsoft') >= 0) 
		{ // IE
	        this.divc.style.filter = 'alpha(opacity=' + opacite + ')';
	    } 
	    else 
		{ // Firefox
	        this.divc.style.opacity = opacite / 100;		
	    }
		
		var body = document.getElementsByTagName('body')[0];   	
		body.appendChild(this.divc);	
	},
	
	afficher : function(lien, func, calque, dBox) 
	{
		if (calque != false)		
			this.afficherCalque();		
		
		this.div           = document.createElement('div');
		var attribut      = document.createAttribute('id');
	
		dBox == true ? attribut.nodeValue = 'mbox' : attribut.nodeValue = 'messagebox';
	
		this.div.setAttributeNode(attribut);
		
		var body = document.getElementsByTagName('body')[0];
		body.appendChild(this.div);		
		
		Ajaxx.appel(lien, this.div, func);		
	},
	
	close : function()
	{  
		var body = document.getElementsByTagName('body')[0];		
		body.removeChild(this.div);
		
		if (document.getElementById('calque'))
			body.removeChild(this.divc);
	}
};

var IENav = navigator.appName.match('Microsoft Internet Explorer');
function valide_form()
{		
	var date = document.getElementById('ddn').value;	
	var div = document.getElementById('divwmess');
	
	if (date == '' || document.getElementById('codeclient').value == '')
	{
		div.innerHTML = '';		
		//document.getElementById('identification').style.height = '96px';
		
		
		return false;
	}
	if (date.match(/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/))
	{
		return true;		
	}
	else
	{
		/*
		if (!IENav)
			height = '224px';
		else
			height = '180px';
		*/
			
		//document.getElementById('identification').style.height = height; 
		
		var msg; 
		msg = 'Le format de saisie n\'est pas correct, merci de bien vouloir saisir votre date de naissance au format JJ/MM/AAAA (ex : 02/03/1984).'
		
		if (!IENav)
			msg = '<br /><br />' + msg;
			 
		div.innerHTML = msg;
	}	
	return false;
	
}

var Ajaxx =
{	
	appel : function(url, id, func, post, data)
	{    
	    // on ouvre une instance de l'objet XmlHttpRequest
	    var xhr = this.getXhr();    
	  
	    xhr.onreadystatechange = function() 
		{        
	        // On ne fait quelque chose que si on a tout reçu et que le serveur est ok
	        if (xhr.readyState == 4 && xhr.status == 200) 
			{            
	            // On place la réponse du serveur dans l'element à modifier  
				if (typeof(id) != 'undefined')
				{
					if (typeof(id) == 'function')
					{
						id(xhr.responseText);						
					}
					else
						id.innerHTML =  xhr.responseText;						
				}
				if (typeof(func) == 'function')
				{
					func();
				}
	        }
	    }
	    
	    // et on envoie
		post == true ? xhr.open("POST", url, true) : xhr.open("GET", url, true);	
		if (post == true)
			 xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		post == true ? xhr.send(data) : xhr.send(null);
	},

	getXhr : function() 
	{    
	    var xhr = null; 
	    
	    if(window.XMLHttpRequest) 
		{ // Firefox et autres
	        xhr = new XMLHttpRequest();
	    } 
		
	    else if (window.ActiveXObject) { // Internet Explorer 
	        try 
			{
	            xhr = new ActiveXObject("Msxml2.XMLHTTP");
	        } 
	        catch (e) 
			{
	            xhr = new ActiveXObject("Microsoft.XMLHTTP");
	        }
	    }
		
	    else 
		{ 
	        alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
	        xhr = false; 
	    } 
	    return xhr;
	}	
};
