var sbmtd=false;

function sort_r(sort_r) {
	document.location.href=sURL+'sort_r/'+sort_r;
}

function estado_r(estado_r) {
	document.location.href=eURL+'estado_r/'+estado_r;
}

function ciudad_r(ciudad_r) {
	document.location.href=cURL+'ciudad_r/'+ciudad_r;
}

function preguntar(){
	window.open(pURL,'preguntar','menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes,width=600,height=470');
}

function publicar(frm,txt){
	theForm=document.forms[frm];
	theText=document.getElementById(txt);
	if(sbmtd==true){
		return;
	}
	if(theText.value==''){
		alert('El campo de texto está vacío. Por favor llene el campo de texto e intente nuevamente.');
	}else{
		theForm.submit();
		sbmtd=true;
	}
}

function countchars(el,MAX,txt){
	var str = new String(el.value);
	count = MAX - str.length;
	if(count>0){
		document.getElementById(txt).innerHTML=count;
	}else{
		alert('Has alcanzado el límite de caracteres para este campo');
		el.value=el.value.substr(0,MAX);
		document.getElementById(txt).innerHTML=0;
		el.blur();
	}
}

function numberFormat(n){
	n=n.toString();
	l=n.length;
	f=3;
	if(l<=f){
		return n;
	}else{
		r=new String;
		m=Math.ceil(l/f);
		for(i=1;i<=m;i++){
			x=(l-f<0)?0:l-f;
			s=n.substring(x,l);
			if(i>1){
				r=s+','+r;
			}else{
				r=s+r;
			}
			l=x;
		}
		return r;
	}
}

var nd_msg = 'Lo sentimos. Esta opción sólo está disponible para la Membresía Corporativa';