
function limpaComboCidadeDL() {
	var combo = document.getElementById("cidadeDL");
	cleanOptsSelect("cidadeDL");
	combo.add(new Option(txtTodosDLTS, ""));
	
	desabilitaCombosDL();
}

function limpaComboBairroDL() {
	var combo = document.getElementById("bairroDL");
	if(combo != null) {
		cleanOptsSelect("bairroDL");
		combo.add(new Option(txtTodosDLTS, ""));
	}	
	desabilitaCombosDL();
}

function limpaCombosDL() {
	var combo;

	// Pais
	combo = document.getElementById("cidadeDL");
	if(combo != null) {
		combo.value = "";
		cleanOptsSelect("estadoDL");
		document.getElementById("estadoDL").add(new Option(txtTodosDLTS, ""));
	}
	
	// Estado
	combo = document.getElementById("estadoDL");
	combo.value = "";
	
	// Cidade
	combo = document.getElementById("cidadeDL");
	cleanOptsSelect("cidadeDL");
	combo.add(new Option(txtTodosDLTS, ""));
	
	// Bairro
	combo = document.getElementById("bairroDL");
	if(combo != null) {
		cleanOptsSelect("bairroDL");
		combo.add(new Option(txtTodosDLTS, ""));
	}
}

function limpaNomeDL() {
	document.getElementById("nomeDL").value = "";
}

function desabilitaCombosDL() {
	limpaNomeDL();
	var combo;
	
	combo = document.getElementById("paisDL");
	if(combo != null)
		combo.disabled = true;
	
	document.getElementById("estadoDL").disabled = true;
	document.getElementById("cidadeDL").disabled = true;
	
	combo = document.getElementById("bairroDL");
	if(combo != null)
		combo.disabled = true;
}

function habilitaCombosDL() {
	combo = document.getElementById("paisDL");
	if(combo != null)
		combo.disabled = false;
	
	document.getElementById("estadoDL").disabled = false;
	document.getElementById("cidadeDL").disabled = false;
	
	combo = document.getElementById("bairroDL");
	if(combo != null)
		combo.disabled = false;
}

function limpaCombosModeloVersaoTS() {
	// Modelo
	var combo = document.getElementById("modeloVeiculoTS");
	cleanOptsSelect("modeloVeiculoTS");
	combo.add(new Option(txtSelecioneDLTS, ""));

	limpaComboVersaoTS();
}

function limpaComboVersaoTS() {
	// Versao
	var combo = document.getElementById("versaoVeiculoTS");
	cleanOptsSelect("versaoVeiculoTS");
	combo.add(new Option(txtSelecioneDLTS, ""));
	
	desabilitaCombosTS();
}

function limpaComboIndiceVelocidadeTS() {
	// Versao
	var combo = document.getElementById("indiceVelocidadeTS");
	cleanOptsSelect("indiceVelocidadeTS");
	combo.add(new Option(txtTodosDLTS, ""));
	
	desabilitaCombosTS();
}

function desabilitaCombosTS() {
	// Marca / Modelo
	document.getElementById("marcaVeiculoTS").disabled = true;
	document.getElementById("anoVeiculoTS").disabled = true;
	document.getElementById("modeloVeiculoTS").disabled = true;
	document.getElementById("versaoVeiculoTS").disabled = true;
	
	// Aro / Dimensão
	document.getElementById("aroPneuTS").disabled = true;
	document.getElementById("dimensaoTS").disabled = true;
	document.getElementById("indiceVelocidadeTS").disabled = true;
}

function habilitaCombosTS() {
	// Marca / Modelo
	document.getElementById("marcaVeiculoTS").disabled = false;
	document.getElementById("anoVeiculoTS").disabled = false;
	document.getElementById("modeloVeiculoTS").disabled = false;
	document.getElementById("versaoVeiculoTS").disabled = false;
	
	// Aro / Dimensão
	document.getElementById("aroPneuTS").disabled = false;
	document.getElementById("dimensaoTS").disabled = false;
	document.getElementById("indiceVelocidadeTS").disabled = false;
}

function validaFrmMarcaTS() {
	var objMarca = document.getElementById("marcaVeiculoTS");
	var objAno = document.getElementById("anoVeiculoTS");
	var objModelo = document.getElementById("modeloVeiculoTS");
	var objVersao = document.getElementById("versaoVeiculoTS");
	
	if(objMarca.value == "") {
		alert(msgMarcaNaoPreenchidoDLTS);
		objMarca.focus();
		return false;
	}
	if(objAno.value == "") {
		alert(msgAnoNaoPreenchidoDLTS);
		objAno.focus();
		return false;
	}
	if(objModelo.value == "") {
		alert(msgModeloNaoPreenchidoDLTS);
		objModelo.focus();
		return false;
	}
	if(objVersao.value == "") {
		alert(msgVersaoNaoPreenchidoDLTS);
		objVersao.focus();
		return false;
	}
}

function validaFrmAroDimensaoTS() {
	var objAro = document.getElementById("aroPneuTS");
	var objDimensao = document.getElementById("dimensaoTS");
	var objIndVelocidade = document.getElementById("indiceVelocidadeTS");

	if(objAro.value == "") {
		alert(msgAroNaoPreenchidoDLTS);
		objAro.focus();
		return false;
	}
	if(objDimensao.value == "") {
		alert(msgDimensaoNaoPreenchidoDLTS);
		objDimensao.focus();
		return false;
	}
}

function validaFrmGamaTS() {
	var objGama = document.getElementById("gamaTS");

	if(objGama.value == "") {
		alert(msgNomePneuNaoPreenchidoDLTS);
		objGama.focus();
		return false;
	}
}

function validaFrmRevendaDL() {
	var objPais = document.getElementById("paisDL");
	var objEstado = document.getElementById("estadoDL");
	var objNomeRevenda = document.getElementById("nomeDL");

	if(objPais == null) {
		if((objNomeRevenda.value == "") && (objEstado.value == "")) {
			alert(msgEstadoNaoPreenchidoDLTS);
			objEstado.focus();
			return false;
		}
	} else {
		if((objNomeRevenda.value == "") && (objPais.value == "")) {
			alert(msgPaisNaoPreenchidoDLTS);
			objPais.focus();
			return false;
		}
	}
}
