/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var contador=-1;
var cadenal=0;

function revelar(){

    var texto=document.getElementById('texto').value;
    if((texto.length>4) && (texto.length!=cadenal)){
    saltando=0;
    cadenal=texto.length;
    document.getElementById('verSugerencia').innerHTML="";
    //cargaPaginaPost('index.php','crit='+texto,'verSugerencia',0);
    cargaPaginaPost('index.php?controlador=cliente&accion=cargaBusquedaClienteControlador','crit='+texto,'verSugerencia',0);
//alert(texto);
    document.getElementById('sugerencia').style.visibility="visible";
    contador=-1;
    }
}

function ocultar(){
    contador=-1;
    document.getElementById('sugerencia').style.visibility="hidden";
    return true;
}

function tempo(){
    
    if(contador>0){
        contador=contador-1;
    }
    window.setTimeout("tempo();",90);
    if(contador==0) revelar();
}

function volcado(v){
    alert("volcado");
    var donde=document.getElementById('texto');
    alert(donde.value);
    donde.value=v;
    donde.focus();
    //
    //envioCliente(1);
}

function moneda(id)
{
    alert(id);
}

// =====================================================

function buscaCategoria()
{
    var params ="busca="+document.getElementById('busqueda');
    rgaPaginaPost('index.php?controlador=categoria&accion=cargarBusquedaCategoriasControlador',params,'carga');
}

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}

function popUp(theURL,winName,features) { 
  window.open(theURL,winName,features);
	return false;  
}

