function contractcontent ( capa )
{
	document.getElementById ( capa ).style.display = "none";
}

function expandcontent ( capa )
{
	document.getElementById ( capa ).style.display = "block";
}

function busqueda_avanzada ()
{
	expandcontent ( 'td1ambito' );
	expandcontent ( 'td2ambito' );
	expandcontent ( 'tdsep1' );
	expandcontent ( 'td1precio' );
	expandcontent ( 'td2precio' );
	expandcontent ( 'tdsep2' );
	contractcontent ( 'td1avan' );
	contractcontent ( 'td2avan' );

	document.busqueda.bavanzada.value = "1";
}

function comprueba_busqueda ()
{
	var avanzada = document.busqueda.bavanzada.value;

	if ( avanzada == "1" )
	{
		var selectedamb = document.busqueda.ambito.selectedIndex;
		var ambito = document.busqueda.ambito.options[selectedamb].value;

		//var selectedpre = document.busqueda.precio.selectedIndex;
		//var precio = document.busqueda.precio.options[selectedpre].value;

		var precio = 1000;

		if ( ambito < 1 )
		{
			alert ( "Seleccione una área de búsqueda, por favor." );
			document.busqueda.ambito.focus ();
			return;
		}

		if ( precio < 1 )
		{
			alert ( "Seleccione un rango de precios, por favor." );
			document.busqueda.precio.focus ();
			return;
		}
	}

	var palabras = document.busqueda.palabras.value;
	var hay_car = 0;

/*
	if ( palabras == "" )
	{
		alert ( "Escriba la/s palabra/s a buscar, por favor." );
		document.busqueda.palabras.focus ();
		return;
	}
*/

	if ( palabras != "" )
	{
		var i;
		for ( i = 0; i < palabras.length; i++ )
		{
			if ( palabras.charAt ( i ) != " " )
			{
				hay_car = 1;
				break;
			}
		}

		if ( hay_car == 0 )
		{
			alert ( "Escriba la/s palabra/s a buscar, por favor." );
			document.busqueda.palabras.focus ();
			return;
		}
	}

	var palabrassep = palabras.split ( " " );
	if ( palabrassep [0] != "vv" )
	{
		/*
		for ( var i = 0; i < palabrassep.length; i++ )
		{
			if ( palabrassep [i].length == 1 )
			{
				alert ( "Escriba la/s palabra/s a buscar, por favor." );
				document.busqueda.palabras.focus ();
				return;
			}
		}
		*/
	}

	document.busqueda.submit ();
}

/*
function comprueba_identificacion ()
{
	if ( document.identificacion.apodo.value == "" )
	{
		alert ( "Escriba su apodo, por favor." );
		return;
	}

	if ( document.identificacion.clave.value == "" )
	{
		alert ( "Escriba su contraseña, por favor." );
		return;
	}

	len = document.identificacion.clave.value.length;
	if ( len < 6 || len > 15 )
	{
		alert ( "La contraseña no es correcta." );
		document.identificacion.clave.focus ();
		return;
	}

	document.identificacion.submit ();
}
*/