function register()
	{
	ajax_page(18,1,'right_header');
ajax_page(18,2,'display');
ajax_page(18,3,'right_footer');
	return false;
	}

function register1()
	{
	var type=document.getElementById("type_of_person").value;
	if(type==1)
		{
		ajax_page(19,1,'right_header');
ajax_page(19,2,'display');
ajax_page(19,3,'right_footer');
		}
	else if(type==2)
		{
		ajax_page(20,1,'right_header');
ajax_page(20,2,'display');
ajax_page(20,3,'right_footer');
		}
	return false;
	}
	
function register3()
	{
	var cname=document.getElementById("register_company_name").value;
	var number=document.getElementById("register_company_number").value;
	var email=document.getElementById("register_company_email").value;
	var address=document.getElementById("register_company_address").value;
	var telephone=document.getElementById("register_company_telephone").value;
	var fax=document.getElementById("register_company_fax").value;
	var name=document.getElementById("register_company_contact").value;
	var city=document.getElementById("register_company_city").value;
	var zip=document.getElementById("register_company_zip").value;
	var activity=document.getElementById("register_company_activity").value;
	
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	var filter2 = /^([0-9])+$/;
	if (!filter2.test(number)) {
	alert('<font color=\"#FF0000\">Numéro SIREN incorrect</font>');
	return false;
	}
	if (!filter.test(email)) {
	alert('<font color=\"#FF0000\">Email incorrect</font>');
	return false;
	}
	if(cname.length==0){
	alert('<font color=\"#FF0000\">Nom d\'entreprise incorrect</font>');
	return false;
	}
	if(email.length==0){
	alert('<font color=\"#FF0000\">Email incorrect</font>');
	return false;
	}
	if(address.length==0){
	alert('<font color=\"#FF0000\">Adresse incorrecte</font>');
	return false;
	}
	if(telephone.length==0){
	alert('<font color=\"#FF0000\">Numero de telephone incorrect</font>');
	return false;
	}
	if(fax.length==0){
	alert('<font color=\"#FF0000\">Fax Incorrect</font>');
	return false;
	}
	if(number.length!=9){
	alert('<font color=\"#FF0000\">Numéro SIREN incorrect</font>');
	return false;
	}
	if(activity.length==0){
	alert('<font color=\"#FF0000\">Activité incorrecte</font>');
	return false;
	}
	if(zip.length==0){
	alert('<font color=\"#FF0000\">Code ZIP incorrect</font>');
	return false;
	}
	if(city.length==0){
	alert('<font color=\"#FF0000\">Ville incorrect</font>');
	return false;
	}
	if(name.length==0){
	alert('<font color=\"#FF0000\">Nom incorrect</font>');
	return false;
	}
	
		
	url='register.php?type=2&name='+name+'&number='+number+'&email='+email+'&address='+address+'&telephone='+telephone+'&fax='+fax+'&cname='+cname+'&city='+city+'&zip='+zip+'&activity='+activity;
	ajaxpage(url,'display');


	return false;
	}

function register2()
	{
	var name=document.getElementById("register_name").value;
	var email=document.getElementById("register_email").value;
	var address=document.getElementById("register_address").value;
	var telephone=document.getElementById("register_telephone").value;
	var city=document.getElementById("register_city").value;
	var zip=document.getElementById("register_zip").value;

	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(email)) {
	alert('<font color=\"#FF0000\">Veuillez taper un email valide !</font>');
	return false;
	}
	if(name.length==0){
	alert('<font color=\"#FF0000\">Nom incorrect</font>');
	return false;
	}
	if(email.length==0){
	alert('<font color=\"#FF0000\">Email incorrect</font>');
	return false;
	}
	if(address.length==0){
	alert('<font color=\"#FF0000\">Adresse incorrecte</font>');
	return false;
	}
	if(zip.length==0){
	alert('Code postal incorrect');
	return false;
	}
	if(city.length==0){
	alert('<font color=\"#FF0000\">Localité incorrecte</font>');
	return false;
	}	
	if(telephone.length==0){
	alert('<font color=\"#FF0000\">Numéro de téléphone incorrect</font>');
	return false;
	}

	url='register.php?type=1&name='+name+'&email='+email+'&address='+address+'&telephone='+telephone+'&city='+city+'&zip='+zip;
	ajaxpage(url,'display');


	return false;
	}

function register4()
	{
	var email=document.getElementById("newsletter_email").value;
	var type=document.getElementById("newsletter_su").value;

	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(email)) {
	alert('<font color=\"#FF0000\">Veuillez taper un email valide !</font>');
	return false;
	}


	url='registernews.php?type='+type+'&email='+email;
	ajaxpage(url,'display');


	return false;
	}

function alphanumeric(alphane)
{
var numaric = alphane;
	if(numaric.length==0)
		return false;

	for(var j=0; j<numaric.length; j++)
		{
		  var alphaa = numaric.charAt(j);
		  var hh = alphaa.charCodeAt(0);
		  if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123))
		  {
		  }
		else	{
			 return false;
		  }
 		}
 return true;
}



function alphanumeric(alphane)
{	var numaric = alphane;
	if(numaric.length==0)
		return false;

	for(var j=0; j<numaric.length; j++)
		{
		  var alphaa = numaric.charAt(j);
		  var hh = alphaa.charCodeAt(0);
		  if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123))
		  {
		  }
		else	{
			 return false;
		  }
 		}
 return true;
}

function login()
	{
	var email=document.getElementById('login_email').value;
	var password=document.getElementById('login_password').value;

	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(email)) {
	alert('<font color=\"#FF0000\">Veuillez taper un email valide !</font>');
	return false;
	}

	if(password.length==0)
		return false;

	var go=ajaxpage2('login.php?email='+email+'&password='+password,'display');
	if(go=='logged in')
		window.location='index.php';
	else
		alert('<font color=\"#FF0000\">Email ou mot de passe incorrect</font>');
	return false;
	}

function logout()
	{
	window.location='logout.php';


	return false;
	}

function recoverpass()
	{
	url="recover.php";
	ajaxpage(url,'display');
	return false;
	}


function changepass()
	{
	var oldpass=document.getElementById("oldpass").value;
	var pass1=document.getElementById("newpass1").value;
	var pass2=document.getElementById("newpass2").value;

	if(oldpass.length==0){
	alert('<font color=\"#FF0000\">Mot de passe actuel incorrect.</font>');
	return false;
	}

	if(pass1!=pass2){
	alert('<font color=\"#FF0000\">Les 2 mots des passe ne correspondent pas !</font>');
	return false;
	}

	if(pass1==oldpass){
	alert('<font color=\"#FF0000\">Le nouveau mot de passe et l\'ancien sont identiques.</font>');
	return false;
	}

	if(pass1.length==0){
	alert('<font color=\"#FF0000\">Mot de passe incorrect</font>');
	return false;
	}
	
	if(pass2.length==0){
	alert('<font color=\"#FF0000\">Mot de passe incorrect</font>');
	return false;
	}
	

	url="changepass.php?old="+oldpass+"&new="+pass1;
	ajaxpage(url,'display');
	
	return false;
	}
	
	
	function updateind()
	{
	var name=document.getElementById("register_name").value;
	var address=document.getElementById("register_address").value;
	var telephone=document.getElementById("register_telephone").value;
	var city=document.getElementById("register_city").value;
	var zip=document.getElementById("register_zip").value;


	if(name.length==0){
	alert('<font color=\"#FF0000\">Nom incorrect</font>');
	return false;
	}
	if(address.length==0){
	alert('<font color=\"#FF0000\">Adresse incorrecte</font>');
	return false;
	}
	if(telephone.length==0){
	alert('<font color=\"#FF0000\">Numéro de telephone incorrect</font>');
	return false;
	}
		if(city.length==0){
	alert('<font color=\"#FF0000\">Localité incorrecte</font>');
	return false;
	}
		if(zip.length==0){
	alert('<font color=\"#FF0000\">Code postal incorrect</font>');
	return false;
	}

	url='updateprofile.php?type=1&name='+name+'&address='+address+'&telephone='+telephone+'&city='+city+'&zip='+zip;
	ajaxpage(url,'display');


	return false;
	}

	function updatecom()
	{

	var cname=document.getElementById("register_company_name").value;
	var number=document.getElementById("register_company_number").value;
	var address=document.getElementById("register_company_address").value;
	var telephone=document.getElementById("register_company_telephone").value;
	var fax=document.getElementById("register_company_fax").value;
	var name=document.getElementById("register_company_contact").value;
	var city=document.getElementById("register_company_city").value;
	var zip=document.getElementById("register_company_zip").value;
	var activity=document.getElementById("register_company_activity").value;

	var filter2 = /^([0-9])+$/;
	if (!filter2.test(number)) {
	alert('<font color=\"#FF0000\">Numéro SIREN incorrect</font>');
	return false;
	}

	if(cname.length==0){
	alert('<font color=\"#FF0000\">Nom d\'entreprise incorrect</font>');
	return false;
	}
	if(number.length!=9){
	alert('<font color=\"#FF0000\">Numéro SIREN incorrect</font>');
	return false;
	}
	if(address.length==0){
	alert('<font color=\"#FF0000\">Adresse incorrecte</font>');
	return false;
	}
	if(zip.length==0){
	alert('<font color=\"#FF0000\">Code postal incorrect</font>');
	return false;
	}
	if(city.length==0){
	alert('<font color=\"#FF0000\">Localité incorrecte</font>');
	return false;
	}
	if(name.length==0){
	alert('<font color=\"#FF0000\">Nom incorrect</font>');
	return false;
	}	
	if(telephone.length==0){
	alert('<font color=\"#FF0000\">Numéro de téléphone incorrect</font>');
	return false;
	}
	if(fax.length==0){
	alert('<font color=\"#FF0000\">Numéro de fax incorrect</font>');
	return false;
	}
	if(activity.length==0){
	alert('<font color=\"#FF0000\">Activité incorrecte</font>');
	return false;
	}


	url='updateprofile.php?type=2&name='+name+'&number='+number+'&address='+address+'&telephone='+telephone+'&fax='+fax+'&cname='+cname+'&city='+city+'&zip='+zip+'&activity='+activity;
	ajaxpage(url,'display');


	return false;



	}



function messadmin()
	{
	var mess=document.getElementById("messtoadmin").value;
	if(mess.length==0){
	alert('<font color=\"#FF0000\">Message non valide</font>');
	return false;
	}
	url="sendmess.php?mess="+mess;
	ajaxpage(url,'display');
	return false;
	}


function showsave()
	{
	sav=document.getElementById('saveskin');
	sav.style.visibility='visible';
	}









