function displayAjax ( sUrl, targetDiv ) {
		var targetDiv = $(targetDiv) ;
		targetDiv.setStyles({display: 'block', visibility: 'visible', opacity: '1'});
		targetDiv.addClass('loading');
		var req = new Request.HTML(
			{
				url:
					sUrl,
				method: 
					'get',
	
				onSuccess: 
						function ( html ) {
							targetDiv.removeClass('loading');
							targetDiv.setStyle('opacity',0);
							targetDiv.set('text', '');
							targetDiv.adopt(html);
							targetDiv.fade('in');
						},
	
				onFailure: 
					function() {
						$('result').set('text', 'Echec');
					}
	
		}).send();
}



function sendForm ( form , targetDiv ) {
	$(form).set('send', {
   		method: 'post' ,
		evalScripts: true,
        data: $(form),
		onRequest: function ( ) {
		},
        onSuccess: function(responseText, responseXML) {
        	(function(){$(targetDiv).setStyle('display','block');$(targetDiv).set('html', responseText).fade('in')}).delay(50);
        }
	});
	$(targetDiv).fade('out') ;
	(function(){$(form).send()}).delay(500);
	return false;
}


function popup( href  , largeur , hauteur , paramOptions ) {
  var gauche = ( screen.width - largeur ) / 2;
  var haut = ( screen.height - hauteur ) / 2;
  var nomFenetre = "popup";
  var options = "left="+gauche+"px,top="+haut+"px,width="+largeur+",height="+hauteur;
  if ( paramOptions == '' ){    options += ",toolbar=0,resizable=0,scrollbars=1";  }else{    options += ","+paramOptions;  }  window.open( href, nomFenetre, options ) ;  return false ;
}

function toggleDiv( targetDiv ) {
	if($(targetDiv).getStyle('display') == 'none' ) {
		$(targetDiv).setStyles ( {'display': 'block', 'height':'auto','visibility':'visible'} ) ;
		return true ;
	}
	$(targetDiv).setStyle('display','none');
	return false ; 
}




if ( Browser.Engine.webkit ) {
	Request.HTML.implement({
	    processHTML: function(text){
	        var match = text.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
	        text = (match) ? match[1] : text;
	       
	        var container = new Element('div');
	       
	        return $try ( function ( ) {
	            var root = '<root>' + text + '</root>', doc;
	            if (Browser.Engine.trident){
	                doc = new ActiveXObject('Microsoft.XMLDOM');
	                doc.async = false;
	                doc.loadXML(root);
	            } else {
	                doc = new DOMParser().parseFromString(root, 'text/html');
	            }
	            root = doc.getElementsByTagName('root')[0];
	            for (var i = 0, k = root.childNodes.length; i < k; i++){
	                var child = Element.clone(root.childNodes[i], true, true);
	                if (child) container.grab(child);
	            }
	            return container;
	        } ) || container.set ( 'html' , text ) ;
	    }
	
	});
}
