
function montre(id) {
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {
		//alert('smenu'+i);
			if (document.getElementById('smenu'+i).style.display=='none')
				document.getElementById('smenu'+i).style.display='block';
			else
				document.getElementById('smenu'+i).style.display='none';
		}
	}
	
	if (d) {
		d.style.display='block';
	}
}


function show(id) {
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {
			document.getElementById('smenu'+i).style.display='block';
		}
	}
	
	if (d) {
		d.style.display='block';
	}
}

function hide(id) {
	var d = document.getElementById(id);
	for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {
			document.getElementById('smenu'+i).style.display='none';
		}
	}
	
	if (d) {
		d.style.display='none';
	}
}

function Remplace(expr,a,b) {
      var i=0
      while (i!=-1) {
         i=expr.indexOf(a,i);
         if (i>=0) {
            expr=expr.substring(0,i)+b+expr.substring(i+a.length);
            i+=b.length;
         }
      }
      return expr
   }
   
function validation_formulaire(){
	var email = document.frm_rappel_rapide.frm_email.value; 
	var tel = document.frm_rappel_rapide.frm_phone.value; 
	var nom = document.frm_rappel_rapide.frm_name.value; 

	var regExpTelephoneInternational=/^(\(\+[0-9]{2}\))[ \.\-]?[0-9][ \.\-]?[0-9]{2}[ \.\-]?[0-9]{2}[ \.\-]?[0-9]{2}[ \.\-]?[0-9]{2}$/g; // Accepte un numero de téléphone de type 'international'. Ex : (+33) 1 34 12 52 30
	var regExpNumeric=/[0-9]+/g;				// Accepte une chaine 
	
var resultat = tel.match(regExpTelephoneInternational);
var resultat1 = tel.match(regExpNumeric);
var resultat_tel = resultat+resultat1;
var resultat_nom = nom.length;
var nom_sans_espace = Remplace(nom," ","");
var resultat_nom_sans_espace = nom_sans_espace.length;
	
	if (resultat_nom_sans_espace == 0)
        { 
            alert ('Introduzca los apellidos y el nombre válidos'); 
            document.frm_rappel_rapide.frm_name.focus(); 
            return false; 
        }
	if (resultat_nom < 3 || resultat_nom_sans_espace <3)
        { 
            alert ('Por favor, introduzca un apellido más largo'); 
            document.frm_rappel_rapide.frm_name.focus(); 
            return false; 
        }
	if (nom_sans_espace == "Nom&prénom")
        { 
            alert ('Por favor, introduzca los apellidos y el nombre'); 
            document.frm_rappel_rapide.frm_name.focus(); 
            return false; 
        }
	if (email.search(/^[a-z0-9\-_\.]+@[a-z0-9]+\.[a-z]{2,5}$/i) == -1)
        { 
            alert ('Introduzca una dirección de correo electrónico válida'); 
            document.frm_rappel_rapide.frm_email.focus(); 
            return false; 
        }
	if (resultat_tel == 0)
        { 
            alert ('Introduzca un número de teléfono válido'); 
            document.frm_rappel_rapide.frm_phone.focus(); 
            return false; 
        }
		alert('Se han enviado sus datos.\nNuestros equipos se pondrán en contacto con usted a la mayor brevedad posible.\nGracias');
		return true;
	//document.frm_rappel_rapide.action = 'insert_base.php';
	//document.frm_rappel_rapide.submit();
}


function open_popup(ip){
	var h=490;
	var l=490;
	var hauteur=Math.round((screen.availHeight-h)/2); 
	var largeur=Math.round((screen.availWidth-l)/2); 
	window.open("http://webcallback.axialys.net/popup.php?ip="+ip, null, "width="+h+", height="+l+", top="+hauteur+", left="+largeur+", status=no, resizable=no, toolbar=no, menubar=no, scrollbars=no")
}


function ouvrir(l,h,url) {
    hauteur=Math.round((screen.availHeight-h)/2);
    largeur=Math.round((screen.availWidth-l)/2);
    window.open(url, "site", "toolbar=0,location=0,directories=0,status=0, scrollbars=1,resizable=0,menubar=0,top="+hauteur+",left="+largeur+",width="+l+",height="+h);
}
