
function isNumberKey(evt){
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

         return true;
}

function getInternetExplorerVersion() {

    var rv = -1; // Return value assumes failure.

    if (navigator.appName == 'Microsoft Internet Explorer') {

        var ua = navigator.userAgent;

        var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");

        if (re.exec(ua) != null)

            rv = parseFloat(RegExp.$1);

    }

    return rv;

}

function muestra(id, idBoton){
	
	var $obj = document.getElementById(id);
	var $bot = document.getElementById(idBoton);
	var ver = getInternetExplorerVersion();

	if(document.all ){
			$atr = "className";
	}else{
			$atr = "class";
	}
	
	if(ver >= 8.0){
			$atr = "class";
	}
	$clase   = $bot.getAttribute($atr);
		
	if($obj.style.display == 'block') {
        $obj.style.display = 'none';
		$bot.setAttribute($atr,"mas");
		$bot.innerHTML = "Ver categorias";
        
    }else{
        
        $obj.style.display = 'block';
		$bot.setAttribute($atr,"reducir");	
		$bot.innerHTML = "Ocultar categorias";
		
    }
    
    return false;
}

function muestraPrensa(id, idBoton){
	
	var $obj = document.getElementById(id);
	var $bot = document.getElementById(idBoton);
	var ver = getInternetExplorerVersion();
	
	if(document.all){
			$atr = "className";
	}else{
			$atr = "class";
	}
	
	if(ver >= 8.0){
			$atr = "class";
	}
	
	$clase   = $bot.getAttribute($atr);
		
	if($obj.style.display == 'block') {
        $obj.style.display = 'none';
		$bot.setAttribute($atr,"ampliar");
		$bot.innerHTML = "Ampliar";
        
    }else{
        
        $obj.style.display = 'block';
		$bot.setAttribute($atr,"reducir");	
		$bot.innerHTML = "Reducir";
		
    }
    
    return false;
}

function muestraConsejos(id, idBoton){
	
	var $obj = document.getElementById(id);
	var $bot = document.getElementById(idBoton);
	var ver = getInternetExplorerVersion();

	if(document.all){
			$atr = "className";
	}else{
			$atr = "class";
	}
	
	if(ver >= 8.0){
			$atr = "class";
	}
	
	$clase   = $bot.getAttribute($atr);
		
	if($obj.style.display == 'block') {
        $obj.style.display = 'none';
		$bot.setAttribute($atr,"mas");
		$bot.innerHTML = "Mostrar consejos";
        
    }else{
        
        $obj.style.display = 'block';
		$bot.setAttribute($atr,"reducir");	
		$bot.innerHTML = "Ocultar consejos";
		
    }
    
    return false;
}

function buscador(){
	
	var $frm 		  	 = document.getElementById("frmBuscar");
	var $err 		  	 = "";

	if( !$frm.search_qry.value || $frm.search_qry.value == "BUSCAR"  ){
		alert("Completar palabra a buscar\n\n");
		return false;
	}

	$frm.submit();
	
	return true;
	
}	



function limitText(limitField, limitNum) {
    if (limitField.value.length > limitNum) {
        limitField.value = limitField.value.substring(0, limitNum);
    } 
}



