/* alias para o document.getElementById */
function $(obj) {
	return document.getElementById(obj);	
}
	
function runningScroll() {
	try {
		$('newsScroller').scrollAmount = 3;
	}
	catch (error) {
		try {
			newsScroller.scrollAmount = 3;	
		}	
		catch (error) {
			alert ('não foi possivel realizar a operação!!!');	
		}
	}
}

function stopScrolling() {
	try {
		$('newsScroller').scrollAmount = 0;
	}
	catch (error) {
		try {
			newsScroller.scrollAmount = 0;	
		}	
		catch (error) {
			alert ('não foi possivel realizar a operação!!!');	
		}
	}	
}

/* função destinada a carregar as cidades de acordo com o estado */
function loadCities(url, state, objCity) {
	/* carrega o objeto httprequest */
	$ajax.connect();
	
	var cmbCity = $(objCity);
	/* limpa o combobox das cidades e pede para que o usuário aguarde */
	while (cmbCity.length > 0) cmbCity.options[0] = null;
	cmbCity.options[0] = new Option('Aguarde...', 'Aguarde...');
	
	/* executa a rotina de preenchimento do combobox */
	objHttp.onreadystatechange = function () {
		if (objHttp.readyState == 4) {
			while (cmbCity.length > 0) cmbCity.options[0] = null;
			/* transforma a resposta http em array */
			var response = objHttp.responseText.split("|");
			/* preenche o combobox com os valores obtidos */
			for(var i=0; i < response.length; i++) {
				cmbCity.options[cmbCity.options.length] = new Option(response[i], response[i]);
			}
		}
	}
	
	/* executa a chamada http */
	$ajax.get(url);
}
