function EnviarF()
{	
	if (document.getElementById("contacto").value=="")
	{	alert("Informe su Nombre");
		document.getElementById("contacto").focus();
		return false;
	}
	if (document.getElementById("apellidos").value=="")
	{	alert("Informe sus Apellidos");
		document.getElementById("apellidos").focus();
		return false;
	}	
	if (document.getElementById("email").value=="")
	{	alert("Informe su email");
		document.getElementById("email").focus();
		return false;
	}
	else (document.getElementById("email").value!="")
	{	arroba=document.getElementById("email").value.indexOf("@");
		punto=document.getElementById("email").value.indexOf(".",arroba);
		if (arroba<1 || (punto-arroba)<2 || punto==(document.getElementById("email").value.length-1))
		{	alert("Introducir una dirección de correo electrónico correcta.")
			document.getElementById("email").focus();
			return (false);
		}
	}
	if (document.getElementById("observaciones").value=="")
	{	alert("Informe sus Observaciones");
		document.getElementById("observaciones").focus();
		return false;
	}
	
	document.Formulario.submit();
}

function EnviarPedido1()
{	if ((document.getElementById('Formulario').FormaEnvio[0].checked==false) && (document.getElementById('Formulario').FormaEnvio[1].checked==false))
	{	alert("Debe informar el modo de envio.");
		document.getElementById('Formulario').FormaEnvio[0].focus();
		return false;
	}
	document.Formulario.submit();
}

function EnviarF2()
{	
	if ((document.getElementById('Formulario').FormaPago[0].checked==false) && (document.getElementById('Formulario').FormaPago[1].checked==false) && (document.getElementById('Formulario').FormaPago[2].checked==false))
	{	alert("Debe informar la forma de pago.");
		document.getElementById('Formulario').FormaPago[0].focus();
		return false;
	}
	if (document.getElementById("contacto").value=="")
	{	alert("Informe su Nombre");
		document.getElementById("contacto").focus();
		return false;
	}
	if (document.getElementById("apellidos").value=="")
	{	alert("Informe sus Apellidos");
		document.getElementById("apellidos").focus();
		return false;
	}
	if (document.getElementById("direccion").value=="")
	{	alert("Informe su Dirección completa");
		document.getElementById("direccion").focus();
		return false;
	}
	if (document.getElementById("codigopostal").value=="")
	{	alert("Informe su Código postal");
		document.getElementById("codigopostal").focus();
		return false;
	}
	if (document.getElementById("poblacion").value=="")
	{	alert("Informe su Población");
		document.getElementById("poblacion").focus();
		return false;
	}
	if (document.getElementById("provincia").value=="")
	{	alert("Informe su Provincia");
		document.getElementById("provincia").focus();
		return false;
	}
	if (document.getElementById("pais").value=="")
	{	alert("Informe su País");
		document.getElementById("pais").focus();
		return false;
	}
	
	
	if (document.getElementById("email").value=="")
	{	alert("Informe su Email");
		document.getElementById("email").focus();
		return false;
	}
	else
	{	arroba=document.getElementById("email").value.indexOf("@");
		punto=document.getElementById("email").value.indexOf(".",arroba);
		if (arroba<1 || (punto-arroba)<2 || punto==(document.getElementById("email").value.length-1))
		{	alert("Introducir una dirección de correo electrónico correcta.")
			document.getElementById("email").focus();
			return (false);
		}
	}
	
	document.Formulario.submit();
}

function EnviarB()
{	document.Formulario.action='resultados.asp';
	document.Formulario.submit();
}

function WindowOpenCentrado(url, name, param,w, h, perc) 
{ 	var winX = (screen.availWidth - w)*perc*.01;
	var winY = (screen.availHeight - h)*perc*.01;
	popupWin = window.open(url, name, 'width=' + w + ',height=' + h +',left=' + winX + ',top=' + winY + ','+param);
}
 
var opActiva="";

function EsconderTabla(Num)
{	//alert(opActiva);
	//alert(Num);
	
	if (document.getElementById(Num).style.display=='block') 
	{ 	document.getElementById(Num).style.display='none';
		document.getElementById(opActiva).style.display='block';
	}
	else
	{	document.getElementById(Num).style.display='block';	
		if (opActiva!="")
			document.getElementById(opActiva).style.display='none';			
	}
	
	opActiva=Num;
}

function GrabarModelo(cont,IdProducto)
{	if (document.getElementById('modelo'+cont).value=="")
	{	alert("Informe el modelo");
		document.getElementById('modelo'+cont).focus();
		return false;
	}
	else
	{	self.document.getElementById('froculta').src='AddCesta.asp?IdLibro='+IdProducto+'&Modelo='+document.getElementById('modelo'+cont).value;	}	
}