
function envoyer_invitation(sujet,body){
window.location = "mailto:members?subject = "+sujet+"&body = "+escape(body);
}

function envoyer_form(my_form, url){
	var ajax_loader = document.createElement('div');   
	var bodys = document.getElementsByTagName('body');
	body = bodys[0]	;
	
	document.body.appendChild(ajax_loader);
	
	$(ajax_loader).update('<IMG id="loading" alt="Veuillez ptienter SVP..." src = "../images/ajaxLoader.gif" />');	
					
	b_width = $(body).getWidth()-20;
	v_width = document.viewport.getWidth()-20;
	
	b_height = $(body).getHeight ()-20;
	v_height  = document.viewport.getHeight ()-20;
	width = (b_width>v_width?b_width:v_width);
	height =(b_height >v_height ?b_height :v_height );
	$(ajax_loader).setStyle({ opacity: 0.5,backgroundColor: '#000',position:'absolute',top:'0px',left:'0px',zIndex:'100',width:width+'px',height:height+'px'}).show();
	
	$('loading').setStyle({position:'absolute',top:v_height/2+'px',left:v_width/2+'px'});
	$(ajax_loader).scrollTo();
	$(ajax_loader).show();
	//alert($(my_form).serialize());
	new Ajax.Request(url,{
		method: 'post', 
		parameters: $(my_form).serialize(true) ,
		onFailure: function(transport) {
			alert("Une erreur s'est produite, Veuillez réessayer !");
			$(my_form).enable();
		}, 
		onSuccess: function(transport) {
			//var my_response = document.createElement('div'); 
			//$(my_response).hide(); 
			//document.body.appendChild(my_response);
			//alert(transport.responseText);
			//$(my_response).update(transport.responseText);
			document.body.removeChild(ajax_loader);
			eval(transport.responseText);
			$(my_form).enable();
		}
		});
	$(my_form).disable();
	return false;
}

function updateregions(multiple,size,title,element,selected,url){
new Ajax.Updater('regions',url,{method:'post',parameters:
{multiple:multiple,size:size,title:title,country_id:$(element).options[$(element).selectedIndex].value,selected:selected}});
}
function compte_saisie(champ,maximum,block){

if($(champ).value.length>maximum) {
alert('Vous avez atteint la limite de saisie');
$(champ).value = $(champ).value.substring(0,maximum);
}

if(! block )
$($(champ).id+'_compteur').update($(champ).value.length + "&nbsp;caractères sur un ");
else
$(block+'_compteur').update($(champ).value.length + "&nbsp;caractères sur un ");

}  
//function de cryptage de mailto
function Crypt(s) {
r = '';
for(i = 0;i<s.length;i++){
n = s.charCodeAt(i);
if (n >= 8364) {
n = 128;
} ;
r += String.fromCharCode( n - 3 );
}
return r;}
