function alert_test(){
	alert('test');
}
function form_disabled(){
	$('mysubmit').disabled=true ;
}
function form_enable(){
	$('mysubmit').disabled=false ;
}
function inscription_test(){
	var reason ='';
	reason+=formcheck('text','nom');
	reason+=formcheck('text','prenom');
	reason+=formcheck('text','adresse');
	reason+=formcheck('text','nr');
	reason+=formcheck('text','codepostal');
	reason+=formcheck('text','ville');
	reason+=formcheck('text','telpro');
	reason+=formcheck('email','email');
	reason+=formcheck('text','adresse');
	reason+=formcheck('text','passe');
	
	
	if(reason!=''){
		$("mysubmit").disabled=true ;
	} else {
		$("mysubmit").disabled=false ;
	}
	
}
function formcheck(type,eleme){
	elem = $(eleme) ;
	//alert(eleme);
	var error = '' ;
	var test ='' ;
	switch(type){
		case 'email':
			var emailExp =/^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/ ;
			if(elem.value.match(emailExp))
				test ='OK' ;
		break ;
		case 'text' :
			var emailExp ="[a-z0-9]" ;
			if(elem.value.match(emailExp))
				test = 'OK' ;
		break ;
		case 'date':
			var emailExp ="(0?[1-9]|[12][0-9]|3[01])-(0?[1-9]|1[012])-((19|20)\\d\\d)";
			if(elem.value.match(emailExp))
				test = 'OK';
			break ;
	}
	if(test=='OK'){
		$('form_pic_'+eleme).innerHTML = "<img src='pic/accept.png'></img>"
			//alert($('form_pic_'+eleme).html);
	} else {
		//img.src ='../pic/cancel.png';
		$('form_pic_'+eleme).innerHTML = "<img src='pic/cancel.png'></img>"
			
		//elem.focus();
		error = 'error' ;
		
	}
	return error ;
}
function add_cart_formation(id,user,url){	
	if(!user){
		alert('Vous devez \352tre enregistr\351 sur notre site pour vous inscrire \340 une formation')
		window.location=url+'inscription';
	} else {
		window.location=url+'formations/add/'+id;
	}
	
}

function add_cart_publication(id,user,url){	
	if(!user){
		alert('Vous devez \352tre enregistr\351 sur notre site pour vous commander une publication')
		window.location=url+'inscription';
	} else {
		window.location=url+'publications/add/'+id;
	}
	
}
function redirect(url){
	window.location = url ;
}
function deja_inscrit(url){
	alert('Vous \352tes d\351j\340 inscrit et connect\351 au site');
	window.location=url;
}

