function reinitialiser()
{
 var formulaire = $('download');
 formulaire[0].value='';
 formulaire[1].value='';
 formulaire[2].value='';
 formulaire[3].value='';
}

function downloadfile(file)
	{
      //$('main').style.filter='alpha(opacity=50)'; // IE
      //$('main').style.opacity='0.50'; // FF
	  $('chargementxml').style.visibility='visible';
	  //escape('fichier=+file')
	  new Ajax.Request('loader.php?content=download', 
					   {
						 method:'post', 
						 postBody:'file='+file, 
						 onSuccess: function(transport)
						                              {
  														var bodyhtml=transport.responseXML.getElementsByTagName("body_html")[0].childNodes[0].nodeValue;
  														$('main').update(bodyhtml);
														$('chargementxml').style.visibility='hidden';
  														//$('main').style.filter='alpha(opacity=100)'; // IE
  														//$('main').style.opacity='1.00'; // FF
 													  }
                       }
					  );	
	}


function final_load()
 {
   if($('file_download')[0].value!='')
    {
	 $('file_download').submit();	
	};	 
 }

function envoyer_download()
  {
	var formulaire = $('download');
	if((formulaire[0].value=='') || (formulaire[1].value=='') || (formulaire[2].value=='') || (formulaire[3].value==''))
	 {
		alert('Veuillez remplir tout les champs du formulaire');
		return;
	 }
	
	if(!isValidEmail(formulaire[2].value))
    {
     alert('Veuillez saisir une adresse e-mail valide');
     return;
    } 
   display_download();                                      
  }

function display_download()
 {
  $('chargementxml').style.visibility='visible';
  //$('main').style.filter='alpha(opacity=50)'; // IE
  //$('main').style.opacity='0.50'; // FF
  $('download').request({
						  onSuccess: function(transport)
						                              {
  														var bodyhtml=transport.responseXML.getElementsByTagName("body_html")[0].childNodes[0].nodeValue;
  														$('main').update(bodyhtml);
														$('chargementxml').style.visibility='hidden';
  														//$('main').style.filter='alpha(opacity=100)'; // IE
  														//$('main').style.opacity='1.00'; // FF
														setTimeout('final_load()',3000);
 													  }
						  }
					  );	
  
 } 