// JavaScript Document

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function menudesplegable_all(){
	document.getElementById('compania').style.display='none';
	document.getElementById('productos').style.display='none';
	document.getElementById('life_style').style.display='none';

}

function menudesplegable(capa){
	document.getElementById('compania').style.display='none';
	document.getElementById('productos').style.display='none';
	document.getElementById('life_style').style.display='none';
	document.getElementById(capa).style.display='block';
}


function popUp(pagina){ 

			var opciones="toolbar=no,scrollbars=yes, resizable=yes, width=600, height=550"; 

			window.open(pagina,"",opciones); 

}


function validarFormulario(){
	
	
	
	
	var ok=1;

	

	if(document.forms.formulario_contacto.nombre.value==""){

		

		document.getElementById("id_nombre").className="texto_error";

		

		ok = 0;		

		

	} else { document.getElementById("id_nombre").className="texto_borbon_12"; 

	}
	
	if(document.forms.formulario_contacto.pais.value==""){

		

		document.getElementById("id_pais").className="texto_error";

		

		ok = 0;		

		

	} else { document.getElementById("id_pais").className="texto_borbon_12"; 

	}
	
	if(isEmail(document.forms.formulario_contacto.mail.value)){
		

		document.getElementById("id_mail").className="texto_error";

		if(document.forms.formulario_contacto.idioma.value=="ES"){
		alert("Por favor, introduzca bien el E-mail");
		}
		if(document.forms.formulario_contacto.idioma.value=="FR"){
		alert("S’il vous plaît entrer le bon E-mail ");
		}
		if(document.forms.formulario_contacto.idioma.value=="IT"){
		alert("Inserisci la corretta mail");
		}
		if(document.forms.formulario_contacto.idioma.value=="DE"){
		alert("Bitte geben Sie die korrekte Mail");
		}
		if(document.forms.formulario_contacto.idioma.value=="EN"){
		alert("Please enter the correct mail");
		}
		if(document.forms.formulario_contacto.idioma.value=="SV"){
		alert("Please enter the correct mail");
		}
		
		ok = 0;	
		
		return false;
		

	} else { document.getElementById("id_mail").className="texto_borbon_12"; 

	}	

	
	if(ok==1){document.forms.formulario_contacto.submit();

	}else{ 

		if(document.forms.formulario_contacto.idioma.value=="ES"){
			
		alert ('Los campos en rojos son obligatorios.')
		
		}
		if(document.forms.formulario_contacto.idioma.value=="FR"){
			
		alert ('Les champs en rouge sont obligatoires.')
		
		}
		if(document.forms.formulario_contacto.idioma.value=="EN"){
			
		alert ('Fields in red are required.')
		
		}
		if(document.forms.formulario_contacto.idioma.value=="DE"){
			
		alert ('Felder in rot müssen ausgefüllt werden')
		
		}
		if(document.forms.formulario_contacto.idioma.value=="IT"){
			
		alert ('Campi in rosso sono obbligatori.')
		
		}
		if(document.forms.formulario_contacto.idioma.value=="SV"){
			
		alert ('Fields in red are required.')
		
		}
		
		return false;

	}

	

}


function isEmail(smail) {

	

	var re=/^[a-z0-9\-\.]+@[a-z0-9\-\.]+\.[a-z]{2,}$/i;

	

	if(smail.match(re))	{

		

		return false;

		

	} else {

				

		return true;

		

	}

}


function mostrarIdiomas(estado){
	
		document.getElementById('change_idiomas').style.display=estado;
	
}

// ocultar y visualizar capas

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

// fin ocultar y visualizar capas
