function getProjects(id){
	var url = 'pages/projects/list.php';
	var pars = 'id=' + id;
	
	new Effect.Fade('projectimage',{ duration:0.3, afterFinish: function() {  
		Element.show('spinner');
		new Effect.Fade('flag', { duration:0.3, afterFinish: function(){
			new Ajax.Updater('flag', url, 
				{
					method: 'get', 
					evalScripts: true,
					parameters: pars,
					onComplete: function(r){
						new Effect.Appear('flag', {
								afterFinish: function(r){
									CSBfleXcroll('flagcont');
									Element.hide('spinner');
								}
						});
					}
					/*,
					onLoaded: showSpinner,
					onFailure: showErreur*/
				});
		}});
	}});
}

function testMail(a) {
	testm = false ;
 	for (var j=1 ; j<(a.length) ; j++) {
		if (a.charAt(j)=='@') {
			if (j<(a.length-4)){
    			for (var k=j ; k<(a.length-2) ; k++) {
     				if (a.charAt(k)=='.') testm = true;
    			}
   			}
  		}
 	}
	return testm ;
}

function getSendMail(form) {
	var url = 'pages/infosrequest/response.php';
	//alert(Form.serialize(form));
	
	var flag = 'yes';
	form.getInputs('text').each(function(input){
		if(input.value.length == '') { flag = 'no'; }
		if(input.name == 'email' && !testMail(input.value) ) { flag = 'no'; }
	});
	
	if(flag == 'no') { alert('Something went wrong !');  return false; }
	
	Element.show('spinnerinfos');
	new Ajax.Updater('inforequest', url, 
		{
			method: 'post', 
			asynchronous:true, 
			evalScripts:true, 
			onComplete: function(request) {
				Element.hide('spinnerinfos');
				Element.show('inforequest');
			}, 
			onLoading: function() {
				Element.show('spinnerinfos');
				Element.hide('inforequest');
			},
			onLoaded: function() { 
				Element.hide('inforequest');
				Element.show('spinnerinfos');
			},
			parameters:Form.serialize(form)
	}); 
}
