if (document.location.hostname == "localhost") {
	var basepath = "http://localhost/emdianews/";
} else {
	var basepath = "http://www.emdianews.com.br/";	
}

// Checa se um campo está vazio
function emBranco(str) {
	tamanho = str.length;
    contador = 0;
    for (x=0; x<tamanho; x++) {
    	if (str.substring(x,x+1) == " ") { ++contador;}
    }
  return ((contador == tamanho) || (str == ""));
}

function checaForm(frm,campo) {
	
	if (document.getElementById(campo).value.length<1) {
		
		alert("Preencha o campo Busca!");
		document.getElementById(campo).focus();
		return false;

	} else {

		document.forms[frm].action = basepath+"busca.asp";
		document.forms[frm].submit();

	}

}
	
// Muda Tipo de Busca
function changeSearchMode(tip,obj) {
	
	myul 	= obj.parentNode.parentNode;
	els 	= myul.getElementsByTagName("a");

	for(i=0;i<els.length;i++) {
		
		if(parseInt(tip)==2) {
			els.item(i).className = "noselectednews";
		} else {
			els.item(i).className = "noselected";
		}
	}
		
		$("tipo").value = tip;
	
		obj.className = "";
	
	}
	
/* Cidades */
function getCidades(obj) {
	
	codestado = obj.options[obj.selectedIndex].value;
	
	document.getElementById("cidade").disabled = true;
	document.getElementById("cidade").options[0].text = "carregando...";
	
	ajax.Request(basepath+"cidades.asp?ufcod="+codestado,"container_cidades",habilita);

	ajax.Request({
				 url:basepath+"cidades.asp",
				 parameters:"ufcod="+codestado,
				 div:"container_cidades"
				 //cache:true			 
				 });	
	}

function habilita() {
	document.getElementById("cidade").disabled = false;	
}