function inicioBuscas(form)
{
	form.f_marca.disabled        = true;
	form.f_modelo.disabled       = true;
	form.f_opcao.style.display   = 'none';
	form.f_especie.style.display = 'none';
	document.getElementById('txt_marca').style.display = '';
    document.getElementById('txt_modelo').style.display = '';
    document.getElementById('txt_opcao').style.display = 'none';
    document.getElementById('txt_imovel').style.display = 'none';
}

function imoveis(form)
{
    with(form)
    {
        if ( f_tipo.value == 5 )
        {
            f_marca.style.display = 'none';
            f_modelo.style.display = 'none';
            f_opcao.style.display = '';
            f_especie.style.display = '';
            f_especie.disabled = true;
            document.getElementById('txt_marca').style.display = 'none';
            document.getElementById('txt_modelo').style.display = 'none';
            document.getElementById('txt_opcao').style.display = '';
            document.getElementById('txt_imovel').style.display = '';                   
        }
        else
        {
            f_marca.style.display = '';
            f_modelo.style.display = '';
            f_opcao.style.display = 'none';
            f_especie.style.display = 'none';
            f_opcao.selectedIndex = 'Selecione';
            document.getElementById('txt_marca').style.display = '';
            document.getElementById('txt_modelo').style.display = '';
            document.getElementById('txt_opcao').style.display = 'none';
            document.getElementById('txt_imovel').style.display = 'none';
        }
    }
}

function especies(form)
{
    with(form)
    {
        if ( f_opcao.value == 'Selecione' )
        {
            f_especie.selectedIndex = 'Selecione';
            f_especie.disabled = true;
        }
        else
            f_especie.disabled = false;
    }
}

function validaBuscas(form)
{
	with(form)
	{
		trim(f_nome);
		if ( f_tipo.value == 'Selecione' && f_nome.value == '' )
		{
			alert('Escolha um tipo de pesquisa ou busca rápida!');
			f_tipo.focus();
			return false;
		}
		
		if ( f_tipo.value != 3 )
		{
			if ( f_marca.value == 'Selecione' && f_opcao.value == 'Selecione' && f_nome.value == '' )
			{
				if ( f_opcao.style.display == 'none' )
					alert('Escolha uma marca!');
				else
					alert('Escolha uma opcao!');
				
				return false;
			}
			
			/*if ( f_modelo.value == 'Selecione' && f_especie.value == 'Selecione' && f_nome.value == '' )
			{
				if ( f_especie.style.display == 'none' )
					alert('Escolha um modelo!');
				else
					alert('Escolha um imovel!');
				
				return false;
			}*/
		}
	}
}