// JavaScript Document
function validar(nombre,campos)
{
	if ((!campos) || (!nombre))
		return false;
	
	formulario = document.getElementById(nombre);
	
	error = false;
	for (x = 0; x < campos.length; x++)
	{
		tmp = document.getElementById(campos[x]);
		tmp2 = document.getElementById(campos[x]+'2');
		
		if (!tmp)
			continue;

		if ((tmp.type == "text") || (tmp.type == "textarea") || (tmp.type == "password") || (tmp.type == "file"))
		{
			if (!tmp.value)
			{
				error = true;
				tmp.className = "input_error";
			}
			if (tmp2)
			{
				if (tmp2.value != tmp.value)
				{
					error = true;
					tmp.className = "input_error";
					tmp2.className = "input_error";
				}
			}
		}
		else if (tmp.type == "select-one")
		{
			if ((tmp.selectedIndex <= 0) || (tmp.selectedIndex == null))
			{
				error = true;
				tmp.className = "input_error";
			}					
		}
	}
	if (error == true)
		alert("Por favor complete todos los campos");
	else
		formulario.submit();
}

function catOver(img)
{
	img.src = "/resources/images/catalogo_no.jpg";
}

function catOut(img)
{
	img.src = "/resources/images/catalogo.jpg";
}

function redir(url)
{
	location.href = url;	
}