function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function Oroitu() {
	var Datuak="";
	if (document.Formularioa.Mail.value == ""){
		Datuak=window.prompt("Introduzca su correo electrónico y le enviaremos su contraseña:","");
	}
	else {
		Datuak = document.Formularioa.Mail.value
	}
	
	if ((Datuak!=null) && (Datuak.length>0)){
		document.Formularioa.accion.value="gogoratu";
		document.Formularioa.Mail.value=Datuak;
		document.Formularioa.submit();
	}
}


function OroituTerPedido() {
	var Datuak="";
	if (document.Sarrera.MailIdente.value == ""){
		Datuak=window.prompt("Introduzca su correo electrónico y le enviaremos su contraseña:","");
	}
	else {
		Datuak = document.Sarrera.MailIdente.value
	}
	
	if ((Datuak!=null) && (Datuak.length>0)){
		document.Sarrera.ZerEgina.value="Gogoratu";
		document.Sarrera.MailIdente.value=Datuak;
		document.Sarrera.submit();
	}
}

function OroituParticular() {
	var Datuak="";
	if (document.getElementById('MailParticular').value == ""){
		Datuak=window.prompt("Introduzca su correo electrónico y le enviaremos su contraseña:","");
	}
	else {
		Datuak = document.getElementById('MailParticular').value;
	}
	if ((Datuak!=null) && (Datuak.length>0)){
		document.getElementById('accionParticular').value="gogoratu";
		document.getElementById('MailParticular').value=Datuak;
		document.getElementById('Formularioa_Particulares').submit();
	}
}

function OroituParticularI() {
	var Datuak="";
	if (document.getElementById('MailParticular').value == ""){
		Datuak=window.prompt("Introduce your e-mail and we will send your password:","");
	}
	else {
		Datuak = document.getElementById('MailParticular').value;
	}
	if ((Datuak!=null) && (Datuak.length>0)){
		document.getElementById('accionParticular').value="gogoratu";
		document.getElementById('MailParticular').value=Datuak;
		document.getElementById('Formularioa_Particulares').submit();
	}
}

function abrirVentana(url, nombre, opciones)
{
	var w=window.open(url, nombre, opciones);
	if (!w)
	{
		alert("La ventana ha sido bloqueada\r\nPara utilizar la p\xE1gina adecuadamente desactive el bloqueador de ventanas.");
		return false;
	}
	try
	{
		var sTest = w.name ;
		w.focus();
	}
	catch(e)
	{
		alert("No ha sido posible activar la nueva ventana. Revise la configuraci\xF3n de su bloqueador de ventanas.");
		return false;
	}
	return true;
}

function abrirCentro(ref, w, h, opc, nombre) {
	var centro="";
	if (screen && screen.availWidth) {
		centro+=", left=" + ((screen.availWidth-w)/2);
		centro+=", top=" + ((screen.availHeight-h)/2);
	}
	w=MM_openBrWindow(ref, nombre, "width=" + w + ",height=" +h+centro + opc);
	return false;
}

function AbrirVistaAerea() { //v2.0
  abrirCentro("MapaLocalizacion.asp", 550, 413);
}

function MuestraMenu (cual, yo) {
	var submenus = document.getElementsByName("submenu");

	for (var i=0; i < submenus.length; i++) {
		submenus[i].style.display='none';
	}

	var obj=cual
	if (obj) document.getElementById(cual).style.display='';
	if (obj) yo.style.border='1px solid #B1CD56';
	if (obj) yo.style.backgroundColor='#B1CD56';


}

function OcultarMenu (cual, yo) {
	document.getElementById(cual).style.display='none';
	var obj=cual
		if (yo.className == 'seccion_on') {
			yo.style.border='1px solid #B1CD56';
			yo.style.backgroundColor='#B1CD56';
		}
		else {
			yo.style.border='1px solid #165E39';
			yo.style.backgroundColor='white';
		}

}


function VerGlobo (cual) {document.getElementById("globo"+cual).style.display='';}
function OcultarGlobo (cual) {document.getElementById("globo"+cual).style.display='none';}

function ValidarBaja() {
	limpio = limpia(document.DarBaja.Razones.value);
	if (limpio == "") {
		alert("Introduzca las razones para darse de baja.");
		document.DarBaja.Razones.focus();
		return (false);
	}
	return (true);
}

function Validar() {
	limpio = limpia(document.Formularioa.Nombre.value);
	if (limpio == "") {
		alert("Introduzca su nombre y apellidos");
		document.Formularioa.Nombre.focus();
		return (false);
	}
	limpio = limpia(document.Formularioa.Comentarios.value);
	if (limpio == "") {
		alert("Introduzca su mensaje.");
		document.Formularioa.Comentarios.focus();
		return (false);
	}

	if (!document.getElementById("CondiLeg").checked) {
		alert("Debe aceptar las condiciones legales de uso de la web");
		return false
	}

	return (true);
}

function limpia(entry) {
  out = " "; // reemplazar lel espacio en blanco
  add = ""; // por vacio
  temp = "" + entry;

  while (temp.indexOf(out)>-1) {
	pos= temp.indexOf(out);
	temp = "" + (temp.substring(0, pos) + add + 
	temp.substring((pos + out.length), temp.length));
  }
  return(temp);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  var w=window.open(theURL,winName,features);
  w.focus();
}

function ValorCombo(elmto) {
	if (-1==elmto.selectedIndex) return 0

	if (elmto.item(elmto.selectedIndex))
		return elmto.item(elmto.selectedIndex).value;

	return 0
}

function resizeImage(im,dim,posim) {
	// Ejemplo de HTML: <div id="dv1"><img src="exprimidito.jpg" id="img1"></div>
	// im: las imagenes tienen un id en el formato img1, img2, etc. im indica el numero ('img' + im)
	// dim: la dimension que debe tener la imagen en su dimension mas corta
	// posim [no | 0 | valor (px)] :
	//		no: no mueve la imagen
	//		0: centrado
	//		valor: mueve la imagen para centrarla en la dirección de su dimensión mas larga. En pixels

	x=document.getElementById("img" + im);
	y=document.getElementById("dv" + im);

	if (!x.complete)
	{
		temporizadorResize=setTimeout("resizeImage("+im+","+dim+","+posim+")", 100);
	}
	else {
		//Tamaño de la imagen
		if (x.width >= x.height) {
			x.height = dim;
		}
		else {
			//alert(x.width);
			x.width = dim;
		}
		//Tamaño del layer
		y.style.width=dim+"px";
		y.style.height=dim+"px";
		//Posicion
		//x.style.position="relative";
		y.style.overflow="hidden";
		
		if (posim == "no") return;
		if (posim == 0) {
		//Centrado por defecto
			if (x.width >= x.height) {
				x.style.left=-(((x.width*100/x.height) - 100)/2) + '%';
			}
			else {
				x.style.top=-(((x.height*100/x.width) - 100)/2) + '%';
			}
		}
		else {
			//Posición indicada
			if (x.width >= x.height) {
				x.style.left=-posim + 'px';
			}
			else {
				x.style.top=-posim + 'px';
			}
		}
	}
}


/*===Scroll de imagenes===*/
var numElem=0;
var timerID=0;

function it(nE) {
	numElem=nE;
	x=document.getElementById("scroll_dentro");
	x.style.width=((175*numElem)+2) + "px";
}
function st() {
	/*Parar el movimiento*/
	clearTimeout(timerID);
}
function dr() {
	/*Mover a la derecha*/
	clearTimeout(timerID);
	timerID=setTimeout("dcha()", 50);
}
function di() {
	/*Mover a la izquierda*/
	clearTimeout(timerID);
	timerID=setTimeout("izda()", 50);
}
function dcha() {
	x=document.getElementById("scroll_dentro");
	if ( (175*numElem+parseInt(x.style.left)) >= 590 ) {
		x.style.left=(parseInt(x.style.left)-10) + "px";
		timerID=setTimeout("dcha()", 50);
	}
}
function izda() {
	x=document.getElementById("scroll_dentro");
	if ( parseInt(x.style.left) <= 0 ) {
		x.style.left=(parseInt(x.style.left)+10) + "px";
		timerID=setTimeout("izda()", 50);
	}
}
/*===/Scroll de imagenes===*/

/*===Scroll de imagenes 2===*/
var numElem2=0;
var timerID2=0;

function it2(nE) {
	numElem2=nE;
	x=document.getElementById("scroll_dentro");
	document.getElementById("scroll_dentro").style.width=((117*numElem2)+2) + "px";

}
function st2() {
	/*Parar el movimiento*/
	clearTimeout(timerID2);
}
function dr2() {
	/*Mover a la derecha*/
	clearTimeout(timerID2);
	timerID2=setTimeout("dcha2()", 50);
}
function di2() {
	/*Mover a la izquierda*/
	clearTimeout(timerID2);
	timerID2=setTimeout("izda2()", 50);
}
function dcha2() {
	x=document.getElementById("scroll_dentro");
	if ( (117*numElem2+parseInt(x.style.left)) >= 570 ) {
		x.style.left=(parseInt(x.style.left)-10) + "px";
		timerID2=setTimeout("dcha2()", 50);
	}
}
function izda2() {
	x=document.getElementById("scroll_dentro");
	if ( parseInt(x.style.left) <= 0 ) {
		x.style.left=(parseInt(x.style.left)+10) + "px";
		timerID2=setTimeout("izda2()", 50);
	}
}
/*===/Scroll de imagenes 2===*/

/*===Resize imagen para el scroll===*/
/* Preparado para el scroll horizontal, esta reducida */
function resizeImage(im,dim,posim) {
	x=document.getElementById("img" + im);
	y=document.getElementById("dv" + im);
	
	if (!x.complete)
	{
		temporizadorResize=setTimeout("resizeImage("+im+","+dim+","+posim+")", 100);
		return -1;
	}

	//Tamaño de la imagen
	if (x.width >= x.height) {
		x.height = dim;
	}
	else {
		x.width = dim;
	}

	//Posicion
	y.style.overflow="hidden";
	
	if (posim == "no") return 1;
	if (posim == 0) {
	//Centrado por defecto
		if (x.width >= x.height) {
			x.style.left=-(((x.width*100/x.height) - 100)/2) + '%';
		}
		else {
			x.style.top=-(((x.height*100/x.width) - 100)/2) + '%';
		}
	}
	else {
		//Posición indicada
		if (x.width >= x.height) {
			x.style.left=-posim + 'px';
		}
		else {
			x.style.top=-posim + 'px';
		}
	}
	return 1;
}
/*===/Resize imagen para el scroll===*/

function MuestraCalendario (cual,tit) {
	OcultaCalendario ("calen1");
	OcultaCalendario ("calen2");
	OcultaCalendario ("calen3");
	document.getElementById("tit1").className='';
	document.getElementById("tit2").className='';
	document.getElementById("tit3").className='';

	var obj=cual
	if (obj) document.getElementById(cual).style.display='';
	var obj2=tit
	if (obj2) document.getElementById(tit).className='tipo_cal_selec';
}

function OcultaCalendario (Tipo) {
	document.getElementById(Tipo).style.display='none';
}

function SubirFoto (tipofoto, ImagenInputCerrar) { //v2.0
	var name = document.getElementById("Nombre").value + document.getElementById("Telefono").value + aleatorio(0,1000000);
	abrirCentro("fotos.asp?TipoFoto=" + tipofoto + "&ImagenInputCerrar=" + ImagenInputCerrar + "&NombreArchivo=" + name + "", 450, 180);
}

function Cambiar(ImagenTemp,ImagenInputCerrar){
	document.Formularioa.elements[ImagenInputCerrar].value = ImagenTemp;
}

function aleatorio(inferior,superior){
	numPosibilidades = superior - inferior
	aleat = Math.random() * numPosibilidades
	aleat = Math.round(aleat)
	return parseInt(inferior) + aleat
} 

function ValidarRegistroParticular() {
	
	limpio = limpia(document.Formularioa.Nombre.value);
	if (limpio == "") {
		alert("Introduzca su nombre.");
		document.Formularioa.Nombre.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Apellidos.value);
	if (limpio == "") {
		alert("Introduzca sus apellidos.");
		document.Formularioa.Apellidos.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Mail.value);
	if (limpio == "") {
		alert("Introduzca su dirección de correo electrónico");
		document.Formularioa.Mail.focus();
		return (false);
	}

	try {
		
		if (!validate_email(document.Formularioa.Mail,"Introduzca una dirección de correo electrónico válida")) {
			document.Formularioa.Mail.focus();
			return (false);
		}
	
	}
	catch (error) {
		console.log(error);
	}

	limpio = limpia(document.Formularioa.Mail2.value);
	if (limpio == "") {
		alert("Repita su dirección de correo electrónico");
		document.Formularioa.Mail2.focus();
		return (false);
	}

	try {
		
		if (!validate_email(document.Formularioa.Mail2,"Introduzca una dirección de correo electrónico válida")) {
			document.Formularioa.Mail2.focus();
			return (false);
		}
	
	}
	catch (error) {
		console.log(error);
	}

	if (document.Formularioa.Mail.value != document.Formularioa.Mail2.value) {
		alert("Los mails no coinciden.");
		document.Formularioa.Mail.focus();
		return (false);
	}
	
	
	limpio = limpia(document.Formularioa.Clave.value);
	if (limpio == "") {
		alert("Introduzca su contraseña para acceder a su área.");
		document.Formularioa.Clave.focus();
		return (false);
	}

	if (limpio.length < 6 || limpio.length > 12){
		alert("La contraseña debe tener entre 6 y 12 caracteres.");
		document.Formularioa.Clave.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Clave2.value);
	if (limpio == "") {
		alert("Repita su contraseña.");
		document.Formularioa.Clave2.focus();
		return (false);
	}

	if (document.Formularioa.Clave.value != document.Formularioa.Clave2.value) {
		alert("Las contraseñas no coinciden.");
		document.Formularioa.Clave.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Telefono.value);
	if (limpio == "") {
		alert("Introduzca un teléfono de contacto.");
		document.Formularioa.Telefono.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Pais.value);
	if (limpio == "") {
		alert("Introduzca el nombre de su país.");
		document.Formularioa.Pais.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Localidad.value);
	if (limpio == "") {
		alert("Introduzca el nombre de su localidad.");
		document.Formularioa.Localidad.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Provincia.value);
	if (limpio == "") {
		alert("Introduzca el nombre de su provincia.");
		document.Formularioa.Provincia.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.CodPostal.value);
	if (limpio == "") {
		alert("Introduzca su código postal.");
		document.Formularioa.CodPostal.focus();
		return (false);
	}



	if (!document.getElementById("CondiLeg").checked) {
		alert("Debe aceptar las condiciones legales de uso de la web");
		return false
	}

	return (true);
}

function ValidarRegistro() {
	limpio = limpia(document.Formularioa.Nombre.value);
	if (limpio == "") {
		alert("Introduzca su nombre.");
		document.Formularioa.Nombre.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Apellidos.value);
	if (limpio == "") {
		alert("Introduzca sus apellidos.");
		document.Formularioa.Apellidos.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Mail.value);
	if (limpio == "") {
		alert("Introduzca su dirección de correo electrónico");
		document.Formularioa.Mail.focus();
		return (false);
	}

	try {
		
		if (!validate_email(document.Formularioa.Mail,"Introduzca una dirección de correo electrónico válida")) {
			document.Formularioa.Mail.focus();
			return (false);
		}
	
	}
	catch (error) {
		console.log(error);
	}

	limpio = limpia(document.Formularioa.Mail2.value);
	if (limpio == "") {
		alert("Repita su dirección de correo electrónico");
		document.Formularioa.Mail2.focus();
		return (false);
	}

	try {
		
		if (!validate_email(document.Formularioa.Mail2,"Introduzca una dirección de correo electrónico válida")) {
			document.Formularioa.Mail2.focus();
			return (false);
		}
	
	}
	catch (error) {
		console.log(error);
	}

	if (document.Formularioa.Mail.value != document.Formularioa.Mail2.value) {
		alert("Los mails no coinciden.");
		document.Formularioa.Mail.focus();
		return (false);
	}
	
	
	limpio = limpia(document.Formularioa.Clave.value);
	if (limpio == "") {
		alert("Introduzca su contraseña para acceder a su área.");
		document.Formularioa.Clave.focus();
		return (false);
	}

	if (limpio.length < 6 || limpio.length > 12){
		alert("La contraseña debe tener entre 6 y 12 caracteres.");
		document.Formularioa.Clave.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Clave2.value);
	if (limpio == "") {
		alert("Repita su contraseña.");
		document.Formularioa.Clave2.focus();
		return (false);
	}

	if (document.Formularioa.Clave.value != document.Formularioa.Clave2.value) {
		alert("Las contraseñas no coinciden.");
		document.Formularioa.Clave.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Telefono.value);
	if (limpio == "") {
		alert("Introduzca un teléfono de contacto.");
		document.Formularioa.Telefono.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Pais.value);
	if (limpio == "") {
		alert("Introduzca el nombre de su país.");
		document.Formularioa.Pais.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Localidad.value);
	if (limpio == "") {
		alert("Introduzca el nombre de su localidad.");
		document.Formularioa.Localidad.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Provincia.value);
	if (limpio == "") {
		alert("Introduzca el nombre de su provincia.");
		document.Formularioa.Provincia.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.CodPostal.value);
	if (limpio == "") {
		alert("Introduzca su código postal.");
		document.Formularioa.CodPostal.focus();
		return (false);
	}

	if (document.getElementById("Factura").checked) {
		limpio = limpia(document.Formularioa.NIF.value);
		if (limpio == "") {
			alert("Si desea factura introduzca su CIF/NIF, en caso contrario desactive la casilla Factura");
			document.Formularioa.NIF.focus();
			return false;
		}
		
	}

	if (!document.getElementById("CondiLeg").checked) {
		alert("Debe aceptar las condiciones legales de uso de la web");
		return false
	}

	return (true);
}


function ValidarRegistroI() {
	limpio = limpia(document.Formularioa.Nombre.value);
	if (limpio == "") {
		alert("Your name.");
		document.Formularioa.Nombre.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Apellidos.value);
	if (limpio == "") {
		alert("Your surnames.");
		document.Formularioa.Apellidos.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Mail.value);
	if (limpio == "") {
		alert("Your email");
		document.Formularioa.Mail.focus();
		return (false);
	}

	try {
		
		if (!validate_email(document.Formularioa.Mail,"Enter a valid email address")) {
			document.Formularioa.Mail.focus();
			return (false);
		}
	
	}
	catch (error) {
		console.log(error);
	}

	limpio = limpia(document.Formularioa.Mail2.value);
	if (limpio == "") {
		alert("Repeat your email address");
		document.Formularioa.Mail2.focus();
		return (false);
	}

	try {
		
		if (!validate_email(document.Formularioa.Mail2,"Enter a valid email address")) {
			document.Formularioa.Mail2.focus();
			return (false);
		}
	
	}
	catch (error) {
		console.log(error);
	}

	if (document.Formularioa.Mail.value != document.Formularioa.Mail2.value) {
		alert("The mails are not equal.");
		document.Formularioa.Mail.focus();
		return (false);
	}
	
	
	limpio = limpia(document.Formularioa.Clave.value);
	if (limpio == "") {
		alert("Enter your password to access your area.");
		document.Formularioa.Clave.focus();
		return (false);
	}

	if (limpio.length < 6 || limpio.length > 12){
		alert("The password must be between 6 and 12 characters.");
		document.Formularioa.Clave.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Clave2.value);
	if (limpio == "") {
		alert("Repeat your password.");
		document.Formularioa.Clave2.focus();
		return (false);
	}

	if (document.Formularioa.Clave.value != document.Formularioa.Clave2.value) {
		alert("The passwords are not equal.");
		document.Formularioa.Clave.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Telefono.value);
	if (limpio == "") {
		alert("Enter a contact phone.");
		document.Formularioa.Telefono.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Pais.value);
	if (limpio == "") {
		alert("Enter the name of your country.");
		document.Formularioa.Pais.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Localidad.value);
	if (limpio == "") {
		alert("Enter the name of your town.");
		document.Formularioa.Localidad.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.CodPostal.value);
	if (limpio == "") {
		alert("Enter your ZIP code.");
		document.Formularioa.CodPostal.focus();
		return (false);
	}

	if (!document.getElementById("CondiLeg").checked) {
		alert("You must accept the legal terms for use of the Web");
		return false
	}

	return (true);
}

function ValidarRegistroProfesionalI() {
	limpio = limpia(document.Formularioa.Descripcion.value);
	if (limpio == "") {
		alert("Enter your Enterprise.");
		document.Formularioa.Descripcion.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.CIF.value);
	if (limpio == "") {
		alert("Enter your ID.");
		document.Formularioa.CIF.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Dir.value);
	if (limpio == "") {
		alert("Enter your Adress.");
		document.Formularioa.Dir.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Cod_Postal.value);
	if (limpio == "") {
		alert("Enter your ZIP Code.");
		document.Formularioa.Cod_Postal.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Poblacion.value);
	if (limpio == "") {
		alert("Enter your Town.");
		document.Formularioa.Poblacion.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.ID_Pais.value);
	if (limpio == "") {
		alert("Enter your country.");
		document.Formularioa.Pais.ID_Pais();
		return (false);
	}

	limpio = limpia(document.Formularioa.Telefono.value);
	if (limpio == "") {
		alert("Enter your phone.");
		document.Formularioa.Telefono.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.eMail.value);
	if (limpio == "") {
		alert("Enter your email address");
		document.Formularioa.eMail.focus();
		return (false);
	}

	try {
		
		if (!validate_email(document.Formularioa.eMail,"Enter a valid email address")) {
			document.Formularioa.eMail.focus();
			return (false);
		}
	
	}
	catch (error) {
		console.log(error);
	}

	if (!document.getElementById("CondiLeg").checked) {
		alert("You must accept the legal terms for use of the Web");
		return false
	}

	return (true);
}

function ValidarRegistroProfesional() {
	limpio = limpia(document.Formularioa.Descripcion.value);
	if (limpio == "") {
		alert("Introduzca el nombre de la empresa.");
		document.Formularioa.Descripcion.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.CIF.value);
	if (limpio == "") {
		alert("Introduzca el NIF/CIF.");
		document.Formularioa.CIF.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Dir.value);
	if (limpio == "") {
		alert("Introduzca la dirección.");
		document.Formularioa.Dir.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Cod_Postal.value);
	if (limpio == "") {
		alert("Introduzca el código postal.");
		document.Formularioa.Cod_Postal.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.Poblacion.value);
	if (limpio == "") {
		alert("Introduzca el nombre de su localidad.");
		document.Formularioa.Poblacion.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.ID_Prov.value);
	if (limpio == "0") {
		alert("Seleccione la provincia.");
		document.Formularioa.ID_Prov.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.ID_Pais.value);
	if (limpio == "") {
		alert("Seleccione el país.");
		document.Formularioa.Pais.ID_Pais();
		return (false);
	}

	limpio = limpia(document.Formularioa.Telefono.value);
	if (limpio == "") {
		alert("Introduzca un teléfono de contacto.");
		document.Formularioa.Telefono.focus();
		return (false);
	}

	limpio = limpia(document.Formularioa.eMail.value);
	if (limpio == "") {
		alert("Introduzca su dirección de correo electrónico");
		document.Formularioa.eMail.focus();
		return (false);
	}

	try {
		
		if (!validate_email(document.Formularioa.eMail,"Introduzca una dirección de correo electrónico válida")) {
			document.Formularioa.eMail.focus();
			return (false);
		}
	
	}
	catch (error) {
		console.log(error);
	}

	if (!document.getElementById("CondiLeg").checked) {
		alert("Debe aceptar las condiciones legales de uso de la web");
		return false
	}

	return (true);
}


function ValidarRegistroTerPed() {
	limpio = limpia(document.FormularioaTerPed.Nombre.value);
	if (limpio == "") {
		alert("Introduzca su nombre.");
		document.FormularioaTerPed.Nombre.focus();
		return (false);
	}

	limpio = limpia(document.FormularioaTerPed.Apellidos.value);
	if (limpio == "") {
		alert("Introduzca sus apellidos.");
		document.FormularioaTerPed.Apellidos.focus();
		return (false);
	}

	limpio = limpia(document.FormularioaTerPed.Mail.value);
	if (limpio == "") {
		alert("Introduzca su dirección de correo electrónico");
		document.FormularioaTerPed.Mail.focus();
		return (false);
	}

	try {
		
		if (!validate_email(document.FormularioaTerPed.Mail,"Introduzca una dirección de correo electrónico válida")) {
			document.FormularioaTerPed.Mail.focus();
			return (false);
		}
	
	}
	catch (error) {
		console.log(error);
	}

	limpio = limpia(document.FormularioaTerPed.Mail2.value);
	if (limpio == "") {
		alert("Repita su dirección de correo electrónico");
		document.FormularioaTerPed.Mail2.focus();
		return (false);
	}

	try {
		
		if (!validate_email(document.FormularioaTerPed.Mail2,"Introduzca una dirección de correo electrónico válida")) {
			document.FormularioaTerPed.Mail2.focus();
			return (false);
		}
	
	}
	catch (error) {
		console.log(error);
	}

	if (document.FormularioaTerPed.Mail.value != document.FormularioaTerPed.Mail2.value) {
		alert("Los mails no coinciden.");
		document.FormularioaTerPed.Mail.focus();
		return (false);
	}
	
	
	limpio = limpia(document.FormularioaTerPed.Clave.value);
	if (limpio == "") {
		alert("Introduzca su contraseña para acceder a su área.");
		document.FormularioaTerPed.Clave.focus();
		return (false);
	}

	if (limpio.length < 6 || limpio.length > 12){
		alert("La contraseña debe tener entre 6 y 12 caracteres.");
		document.FormularioaTerPed.Clave.focus();
		return (false);
	}

	limpio = limpia(document.FormularioaTerPed.Clave2.value);
	if (limpio == "") {
		alert("Repita su contraseña.");
		document.FormularioaTerPed.Clave2.focus();
		return (false);
	}

	if (document.FormularioaTerPed.Clave.value != document.FormularioaTerPed.Clave2.value) {
		alert("Las contraseñas no coinciden.");
		document.FormularioaTerPed.Clave.focus();
		return (false);
	}

	limpio = limpia(document.FormularioaTerPed.Telefono.value);
	if (limpio == "") {
		alert("Introduzca un teléfono de contacto.");
		document.FormularioaTerPed.Telefono.focus();
		return (false);
	}

	limpio = limpia(document.FormularioaTerPed.Pais.value);
	if (limpio == "") {
		alert("Introduzca el nombre de su país.");
		document.FormularioaTerPed.Pais.focus();
		return (false);
	}

	limpio = limpia(document.FormularioaTerPed.Localidad.value);
	if (limpio == "") {
		alert("Introduzca el nombre de su localidad.");
		document.FormularioaTerPed.Localidad.focus();
		return (false);
	}

	limpio = limpia(document.FormularioaTerPed.Provincia.value);
	if (limpio == "") {
		alert("Introduzca el nombre de su provincia.");
		document.FormularioaTerPed.Provincia.focus();
		return (false);
	}

	limpio = limpia(document.FormularioaTerPed.CodPostal.value);
	if (limpio == "") {
		alert("Introduzca su código postal.");
		document.FormularioaTerPed.CodPostal.focus();
		return (false);
	}

	if (document.getElementById("Factura").checked) {
		limpio = limpia(document.FormularioaTerPed.NIF.value);
		if (limpio == "") {
			alert("Si desea factura introduzca su CIF/NIF, en caso contrario desactive la casilla Factura");
			document.FormularioaTerPed.NIF.focus();
			return false;
		}
	}

	if (!document.getElementById("CondiLeg").checked) {
		alert("Debe aceptar las condiciones legales de uso de la web");
		return false
	}

	return (true);
}

function ValidarRegistroTerPedI() {
	limpio = limpia(document.FormularioaTerPed.Nombre.value);
	if (limpio == "") {
		alert("Enter your name.");
		document.FormularioaTerPed.Nombre.focus();
		return (false);
	}

	limpio = limpia(document.FormularioaTerPed.Apellidos.value);
	if (limpio == "") {
		alert("Enter your surnames.");
		document.FormularioaTerPed.Apellidos.focus();
		return (false);
	}

	limpio = limpia(document.FormularioaTerPed.Mail.value);
	if (limpio == "") {
		alert("Enter your email address");
		document.FormularioaTerPed.Mail.focus();
		return (false);
	}

	try {
		
		if (!validate_email(document.FormularioaTerPed.Mail,"Enter a valid email address")) {
			document.FormularioaTerPed.Mail.focus();
			return (false);
		}
	
	}
	catch (error) {
		console.log(error);
	}

	limpio = limpia(document.FormularioaTerPed.Mail2.value);
	if (limpio == "") {
		alert("Repeat your email address");
		document.FormularioaTerPed.Mail2.focus();
		return (false);
	}

	try {
		
		if (!validate_email(document.FormularioaTerPed.Mail2,"Enter a valid email address")) {
			document.FormularioaTerPed.Mail2.focus();
			return (false);
		}
	
	}
	catch (error) {
		console.log(error);
	}

	if (document.FormularioaTerPed.Mail.value != document.FormularioaTerPed.Mail2.value) {
		alert("The mails do not match.");
		document.FormularioaTerPed.Mail.focus();
		return (false);
	}
	
	
	limpio = limpia(document.FormularioaTerPed.Clave.value);
	if (limpio == "") {
		alert("Enter your password to access your area.");
		document.FormularioaTerPed.Clave.focus();
		return (false);
	}

	if (limpio.length < 6 || limpio.length > 12){
		alert("The password must be between 6 and 12 characters.");
		document.FormularioaTerPed.Clave.focus();
		return (false);
	}

	limpio = limpia(document.FormularioaTerPed.Clave2.value);
	if (limpio == "") {
		alert("Repeat your password.");
		document.FormularioaTerPed.Clave2.focus();
		return (false);
	}

	if (document.FormularioaTerPed.Clave.value != document.FormularioaTerPed.Clave2.value) {
		alert("Passwords do not match.");
		document.FormularioaTerPed.Clave.focus();
		return (false);
	}

	limpio = limpia(document.FormularioaTerPed.Telefono.value);
	if (limpio == "") {
		alert("Enter a contact phone.");
		document.FormularioaTerPed.Telefono.focus();
		return (false);
	}

	limpio = limpia(document.FormularioaTerPed.Pais.value);
	if (limpio == "") {
		alert("Enter the name of their country.");
		document.FormularioaTerPed.Pais.focus();
		return (false);
	}

	limpio = limpia(document.FormularioaTerPed.Localidad.value);
	if (limpio == "") {
		alert("Enter the name of your town.");
		document.FormularioaTerPed.Localidad.focus();
		return (false);
	}

	limpio = limpia(document.FormularioaTerPed.CodPostal.value);
	if (limpio == "") {
		alert("Enter your ZIP code.");
		document.FormularioaTerPed.CodPostal.focus();
		return (false);
	}

	if (!document.getElementById("CondiLeg").checked) {
		alert("You must accept the legal terms for use of the Web");
		return false
	}

	return (true);
}

function validate_email(tm,alerttxt) {
	apos=tm.value.indexOf("@");
	dotpos=tm.value.lastIndexOf(".");
	len=tm.value.length;
	if (apos<1||dotpos-apos<2||len-dotpos<3) {
		alert(alerttxt);
		return false;
	}
	else {
		return true;
	}
}

function validate_email2(tm) {
	apos=tm.value.indexOf("@");
	dotpos=tm.value.lastIndexOf(".");
	len=tm.value.length;
	if (apos<1||dotpos-apos<2||len-dotpos<3) {
		return false;
	}
	else {
		return true;
	}
}


function IsDigit(e) {
    var code;
    if (e.preventDefault) {
        if (e.keyCode==0) {
            code=e.charCode;
        }
        else {
            return true
        }
    }
    else {
        code=e.keyCode;
    }
  return (((code >= 48) && (code <= 57)) || ((code >= 44) && (code <= 46)));
}

function IsDigitPart(e) {
    var code;
    if (e.preventDefault) {
        if (e.keyCode==0) {
            code=e.charCode;
        }
        else {
            return true
        }
    }
    else {
        code=e.keyCode;
    }
  return ((code >= 48) && (code <= 57));
}

function IsDigitProf(e) {
    var code;
    if (e.preventDefault) {
        if (e.keyCode==0) {
            code=e.charCode;
        }
        else {
            return true
        }
    }
    else {
        code=e.keyCode;
    }
  return (((code >= 48) && (code <= 57)) || ((code >= 44) && (code <= 44)));
}

function Actualizar() {
	document.Productos.ZerEgin.value="actualizar";
	document.Productos.submit();
}

function IrCaja() {
	document.Productos.ZerEgin.value="Caja";
	document.Productos.submit();
}

function DatosEnvio(x) {
	if (x.checked) {
		document.getElementById("datos_envio").style.display='';
	}
	else {
		document.getElementById("datos_envio").style.display='none';
	}
}

function GuardaDatosPedido(formulario,direccion){
	var x = document.getElementById(formulario);
	x.action=direccion
	if (ValidaDatosPedido()){
		x.submit();
	}
}

/* WAREKENA */

function wk_MuestraMenu (cual) {
	var submenus = document.getElementsByName("submenu");

	for (var i=0; i < submenus.length; i++) {
		submenus[i].style.display='none';
	}

	var obj=cual
	if (obj) document.getElementById("dv"+cual).style.display='';
	if (obj) {
		if (document.getElementById("img"+cual).className != 'btn_act') {
			document.getElementById("img"+cual).src='images/wk_sec'+cual+'_ON-trans.png';
		}
	}

}

function wk_OcultarMenu (cual) {
	document.getElementById("dv"+cual).style.display='none';
	var obj=cual
	if (obj) {
		if (document.getElementById("img"+cual).className != 'btn_act') {
			document.getElementById("img"+cual).src='images/wk_sec'+cual+'_OFF-trans.png';
		}
	}
}

function cambioSubmenu(x,img) {
	x.src=img; 
	//x.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader (src='" + img + "',sizingMethod='scale')";
}

function VERCAPA (cual) {
	var obj=cual
	if (obj) document.getElementById(cual).style.display='';
}

function CERRARCAPA (cual) {
	OcultarZona (cual);
}

function ValidarComentarioInf() {
	limpio = limpia(document.ValoracionComent.Comentarios.value);
	if (limpio == "") {
		alert("Introduzca sus comentarios.");
		document.Formularioa.ValoracionComent.focus();
		return (false);
	}
	return (true);
}

function OcultarZona (Tipo) {
	document.getElementById(Tipo).style.display='none';
}

function ValidarStock(Id) {
	var stock=document.getElementById('STOCK'+Id).value;
	var cantidad=document.getElementById('Cantidad'+Id).value;
	if (cantidad == 0)
	{
		alert('La cantidad debe ser mayor a 0');
		document.getElementById('Cantidad'+Id).focus();
		return false;
	}
	if (stock-cantidad<0)
	{
		//No se puede comprar, no hay tanto stock
		alert('Actualmente no disponemos de tanto stock, el máximo es '+stock+' uds.');
		document.getElementById('Cantidad'+Id).value=stock;
		return false;
	}
	return true;
}

function ValidarUnidadesMinimas(Id,Abreviatura) {
	var stock=document.getElementById('UnidadesMinimas'+Id).value;
	var stock44 = stock
	stock=parseFloat(stock.replace(",","."));
	var cantidad=document.getElementById('Cantidad'+Id).value;
	cantidad=parseFloat(cantidad.replace(",","."));
	if (cantidad == 0)
	{
		alert('La cantidad debe ser mayor a 0');
		document.getElementById('Cantidad'+Id).focus();
		return false;
	}
	if (stock-cantidad>0)
	{
		//No se puede comprar, no hay tanto stock
		alert('La mínima cantidad para realizar una compra es de '+stock44+' '+Abreviatura+'.');
		document.getElementById('Cantidad'+Id).value=stock44;
		return false;
	}
	return true;
}

function ValidarStockI(Id) {
	var stock=document.getElementById('STOCK'+Id).value;
	var cantidad=document.getElementById('Cantidad'+Id).value;
	if (cantidad == 0)
	{
		alert('The amount must be greater than 0');
		document.getElementById('Cantidad'+Id).focus();
		return false;
	}
	if (stock-cantidad<0)
	{
		//No se puede comprar, no hay tanto stock
		alert('Currently we do not have much stock, the maximum is '+stock+' units.');
		document.getElementById('Cantidad'+Id).value=stock;
		return false;
	}
	return true;
}

function ValidarUnidadesMinimasI(Id,Abreviatura) {
	var stock=document.getElementById('UnidadesMinimas'+Id).value;
	var stock44 = stock
	stock=parseFloat(stock.replace(",","."));
	var cantidad=document.getElementById('Cantidad'+Id).value;
	cantidad=parseFloat(cantidad.replace(",","."));
	if (cantidad == 0)
	{
		alert('The amount must be greater than 0');
		document.getElementById('Cantidad'+Id).focus();
		return false;
	}
	if (stock-cantidad>0)
	{
		//No se puede comprar, no hay tanto stock
		alert('The minimum quantity for purchase is for '+stock44+' '+Abreviatura+'.');
		document.getElementById('Cantidad'+Id).value=stock44;
		return false;
	}
	return true;
}

function ValidarStockF(Id) {
	var stock=document.getElementById('STOCK'+Id).value;
	var cantidad=document.getElementById('Cantidad'+Id).value;
	if (cantidad == 0)
	{
		alert('Le montant doit être supérieur à 0');
		document.getElementById('Cantidad'+Id).focus();
		return false;
	}
	if (stock-cantidad<0)
	{
		//No se puede comprar, no hay tanto stock
		alert('Actuellement, nous navons pas beaucoup de stock, le maximum est '+stock+' unités.');
		document.getElementById('Cantidad'+Id).value=stock;
		return false;
	}
	return true;
}

function ValidarUnidadesMinimasF(Id,Abreviatura) {
	var stock=document.getElementById('UnidadesMinimas'+Id).value;
	var stock44 = stock
	stock=parseFloat(stock.replace(",","."));
	var cantidad=document.getElementById('Cantidad'+Id).value;
	cantidad=parseFloat(cantidad.replace(",","."));
	if (cantidad == 0)
	{
		alert('Le montant doit être supérieur à 0');
		document.getElementById('Cantidad'+Id).focus();
		return false;
	}
	if (stock-cantidad>0)
	{
		//No se puede comprar, no hay tanto stock
		alert('La quantité minimale pour l`achat est pour '+stock44+' '+Abreviatura+'.');
		document.getElementById('Cantidad'+Id).value=stock44;
		return false;
	}
	return true;
}

function cambiapestana(x) {
	document.getElementById('enlace1').style.color='#BAD351';
	document.getElementById('enlace2').style.color='#BAD351';
	document.getElementById('enlace3').style.color='#BAD351';
	document.getElementById('enlace4').style.color='#BAD351';
	document.getElementById('enlace'+x).style.color='#165D3B';
	document.getElementById('Pestana1').style.display='none';
	document.getElementById('Pestana2').style.display='none';
	document.getElementById('Pestana3').style.display='none';
	document.getElementById('Pestana4').style.display='none';
	document.getElementById('Pestana'+x).style.display='block';
}