/******************************************************************************
 *
 *  Funciones de pequered.
 *  
 *
 *
 ******************************************************************************/  


function setRate(id,valoracion,tipo){
    var url = 'go.php?';
    var params = "action=1&modulo=valoraciones&submodulo=valorar&id="+id+"&valoracion="+valoracion+"&tipo="+tipo;
    x_doAjaxCall("POST", url, params, "doSetRate" ,"","", true,true );
}

function doSetRate(responseText){
    
    var responseObject = x_evalAjaxResponse(responseText);
    
    if (responseObject['false']!=""){
        var res = parseInt(responseObject['false']);
        if (res == -1){
            alert($F("msj_voto_realizado"));
        }else{
            alert($F("msj_voto_error"));
        }
                                
    }else if(responseObject['true']!=""){
        $("rankingBar").style.width = parseInt((responseObject['true']*20))+"px";
        $('promedio').value = responseObject['true'];
        alert($F("msj_voto_ok"));
        
    }else{
        alert($F("msj_voto_error"));  
    }          
}  


function descargarFondo(){
    
    if ($F("resolucion") != "" && $F("resolucion") != 0){
        $("f_descargar").submit();
    }

}


function busquedaGeneral(){
    if ($F("filtro") != ""){
        $("f_busqueda").submit();
    }
}


function doContactar(responseText){
    
    var responseObject = x_evalAjaxResponse(responseText);
    
    if (responseObject['true']!=""){        
        alert($F("msj_contacto_ok"));      
        $("f_contacto").reset();                          
    }else{
        alert($F("msj_contacto_error"));        
    } 

}

function agregarFavoritos(title){
   
    var ver = navigator.appName;
    var num = parseInt(navigator.appVersion);
    var url = "http://www.pequered.com";
    
    if ((ver == "Microsoft Internet Explorer")&&(num >= 4)) {
        window.external.AddFavorite(url, title);
    //alert(title);
    } else {
        
        window.sidebar.addPanel(title, url, url);
    }
}


