function textCounter(field, countfield, maxlimit) {
	if (field.value.length > maxlimit) 
		field.value = field.value.substring(0, maxlimit);
	else 
		countfield.value = maxlimit - field.value.length;
}

function new_captcha(){
	if(document.getElementById){
		// extract image name from image source (i.e. cut off ?randomness)
		thesrc = document.getElementById("captchaimg").src;
		// add ?(random) to prevent browser/isp caching
		document.getElementById("captchaimg").src = thesrc+"&"+Math.round(Math.random()*100000);
	}//fin if
}

function check_form(cual){
	if(document.getElementById('search').value.length < 3){
		alert("La longitud mínima para buscar es de 3 caracteres");
		return false;
	}else{
		action = document.frm_busqueda.action + 'b/' + document.frm_busqueda.search.value;
		document.frm_busqueda.action = action;
		document.frm_busqueda.search.value = '';
		return true;
	}
}

function liststates(){
	if(document.getElementById("record[id_country]")){
		id_country=document.getElementById("record[id_country]").value;
			$.post("/reg/?id_country="+id_country, function(data) {
				if( data != '' ) {
					document.getElementById("div_state").innerHTML = data;
				}
			});
	}
}