function ImagenClick(Boton,Imagen)
{
Boton.src = Imagen ;
}

function mouseOut(Boton)
{
	Boton.style.color="#000000";
}

function mouseOver(Boton)
{
	Boton.style.color="#283967";
}
function MenuMouseOut(Boton)
{
  Boton.style.color="#283967";
}
function MenuMouseOver(Boton)
{
	Boton.style.color="#F00";
}

function MenuMouseOut1(Boton)
{
	Boton.style.color="#000000";
	Boton.style.backgroundColor="#ffffff";
}
function MenuMouseOver1(Boton)
{
  Boton.style.color="#ffffff";
	Boton.style.backgroundColor="#283967";
}

function BusquedaAvanzada()
{	if (document.getElementById("PalabraClave").value=="")
	{	alert("Introduzca el valor a buscar.");
		document.getElementById("PalabraClave").focus();
		return false;
	}
	document.FormularioBuscar.action="Articulos.asp?PalabraClave=" + document.getElementById("PalabraClave").value;
	document.FormularioBuscar.submit();
}

function LanzarMnt()
{
  document.FormularioMnt.action="Mantenimientos.asp?IdOpcion=" + document.getElementById("ComboBox1").value;
  document.FormularioMnt.submit();
}

function BuscarArticuloMenu()
{
  document.FormularioMenu.action="Articulos.asp?IdN1=" + document.getElementById("ComboBox1").value + "&IdN2=" + document.getElementById("ComboBox2").value + "&IdN3=" + document.getElementById("ComboBox3").value + "&IdN4=" + document.getElementById("ComboBox4").value;
  document.FormularioMenu.submit();
}

function EnviarContacto()
{	

	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 EnviarPedido()
{	
	
	if (document.getElementById("nombre").value=="")
	{	alert("Informe su Nombre");
		document.getElementById("nombre").focus();
		return false;
	}
	if (document.getElementById("direccion").value=="")
	{	alert("Informe su direccion");
		document.getElementById("direccion").focus();
		return false;
	}
	if (document.getElementById("codigopostal").value=="")
	{	alert("Informe su codigo 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("telefono").value=="")
	{	alert("Informe su teléfono");
		document.getElementById("telefono").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);
		}
	}

	document.Formulario.submit();
}



function ImprimirDocumento()
{
document.printer.Print
}

function EnviarPedido1()
{	if (document.getElementById('Formulario').FormaEnvio[0].checked==false)
	{	alert("Debe informar el modo de envio.");
		document.getElementById('Formulario').FormaEnvio[0].focus();
		return false;
	}
	document.Formulario.submit();
}

function ValidarPedido()
{	
	
	if (document.getElementById("Nombre").value=="")
	{	alert("Informe su nombre");
		document.getElementById("Nombre").focus();
		return false;
	}
	if (document.getElementById("cif").value=="")
	{	alert("Informe sus C.i.f.");
		document.getElementById("cif").focus();
		return false;
	}
	if (document.getElementById("Direccion").value=="")
	{	alert("Informe su dirección");
		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 pais");
		document.getElementById("Pais").focus();
		return false;
	}
	if (document.getElementById("Telefono").value=="")
	{	alert("Informe su telefono");
		document.getElementById("Telefono").focus();
		return false;
	}
	if (document.getElementById("Email").value=="")
	{	alert("Informe su E-Mail");
		document.getElementById("email").focus();
		return false;
	}
	document.Formulario.action='TiendaOnLine.asp?Paso=3';
	document.Formulario.submit();
}

function ImprimirPedido()
{	
	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;	}	
}

function goToURL(nHoja)

 { window.location = nHoja; }
 
 
 function ValidarUsuario()
{	
	document.FormularioUsuarios.submit();
}
 function RegistrarUsuario()
{	
	if (document.getElementById("usuario").value=="")
	{	alert("Informe su usuario");
		document.getElementById("usuario").focus();
		return false;
	}
	if (document.getElementById("ClaveUsuario").value=="")
	{	alert("Informe su clave de acceso");
		usuariosdocument.getElementById("ClaveUsuario").focus();
		return false;
	}	
	if (document.getElementById("NombreUsuario").value=="")
	{	alert("Informe su nombre de usuario");
		document.getElementById("NombreUsuario").focus();
		return false;
	}	
	if (document.getElementById("EMailUsuario").value=="")
	{	alert("Informe su dirección de correo");
		document.getElementById("EMailUsuario").focus();
		return false;
	}	
	
	document.FormularioRegistrarUsuarios.submit();
}

function RegistrarUsuarios()
{ 	
	var url = "Pcontrol_Registrar.asp?Opcion=0";
	var name = "ventana1";
	var param = "scrollbars=no, resizable=no";
	var perc = 1;
        var w = 350;
	var h = 160;
	var winX = ((screen.availWidth/2) - w);
	var winY = ((screen.availHeight/2) - h);
	popupWin = window.open(url, name, 'Width=' + w + ',Height=' + h +',left=' + winX + ',top=' + winY + ','+param);
}

