function info(ruta,tipoinfo){
    var fich='<img style=\"margin-top:100px\" src=\"'+ruta+'images/ajax-loader.gif\"/>';
    $('#centro').html(fich);

    $.get(ruta+"index.php/inicio/info/"+tipoinfo,null,respuestainfo)
}


function respuestainfo(response){
    $("#centro").html(response);
}

function enviarpedidorapido(ruta){
    $("#Procesando").html('Enviando Pedido Por Favor Espere...');
    $("#Procesando2").html('Enviando Pedido Por Favor Espere...');
    $.get(ruta+"index.php/index/enviarPedidoRapido/",null,respuestaped);

}


function respuestaped(response){
    $("#centro").html(response);
     $("#Procesando").html('');
    $("#Procesando2").html('');
    $("#cesta").html('');

}


function seleccionar(ruta,id){
    var lis = document.getElementsByTagName("li");
//
    for (var i=0;i<lis.length;i++) {
        lis[i].style.backgroundImage = '';
        lis[i].style.border = '';
    }

    document.getElementById(id).style.backgroundImage = 'url('+ruta+'images/fondoficha2.png)';
}

function verproducto(ruta,id){
      
    var fich='Cargando Producto... <img style=\"margin-top:100px\" src=\"'+ruta+'images/ajax-loader2.gif\"/>';
    $("#cuerpoproducto").html(fich);
//    
    var lis = document.getElementsByTagName("li");
//
    for (var i=0;i<lis.length;i++) {
        lis[i].style.backgroundImage = '';
        lis[i].style.border = '';
    }
    
    document.getElementById(id).style.backgroundImage = 'url('+ruta+'images/fondoficha2.png)';
//    document.getElementById(id).style.border="1px solid #00620C" ;
    $.get(ruta+"index.php/index/verproducto/"+id,null,respuesta);
}

function respuesta(response){
 
    $("#cuerpoproducto").html(response);
    
}

function textocontenidocesta(){
    $("#textocontenidocesta").show();    
}

function vervideo(ruta,url){
    var fich='Cargando Video <img src=\"'+ruta+'images/ajax-loader.gif\"/>';
    $("#video2").html(fich);
    $.post(ruta+"index.php/index/leervideos/"+url,null,respuestavervideo);

}

function respuestavervideo(response){
    $("#video2").html(response);
}

function cerrar(){
    $("#cuerpoproducto").html('<div style=\"width: 100%;\" id=\"cuerpoproducto\"><div style=\"text-align: center\"> LE OFRECEMOS SOPORTE DE INSTALACI&Oacute;N EN TODA ESPA&Ntilde;A DE TODOS NUESTROS PRODUCTOS.</div></div>');
}


function carrito2(ruta,id,incremento,sustituye){
    $("#Procesando").html('Recalculando Cesta Por favor Espere...');
    $("#Procesando2").html('Recalculando Cesta Por favor Espere...');
    $.post(ruta+"index.php/index/add2/"+id+'/'+incremento+'/'+sustituye,null,respuestaCarrito2);
}


function respuestaCarrito2(response){
   
    $("#cesta2").html(response);

}

function carrito(ruta,id,incremento,sustituye){
    $("#Procesando").html('Recalculando Cesta Por favor Espere...');
    $("#Procesando2").html('Recalculando Cesta Por favor Espere...');
    $("#Procesando3").html('Recalculando Cesta Por favor Espere...');
    $("#Procesando4").html('Recalculando Cesta Por favor Espere...');
    $.post(ruta+"index.php/index/add/"+id+'/'+incremento+'/'+sustituye,null,respuestaCarrito);
}

function respuestaCarrito(response){
   
    $("#cesta").html(response);
    $("#cesta3").html(response);
    $("#Procesando3").html('');
    $("#Procesando4").html('');

}

function iSubmitEnterPedidos(ruta,cont,id,oEvento){
    var iAscii;

    if (oEvento.keyCode)
        iAscii = oEvento.keyCode;
    else if (oEvento.which)
        iAscii = oEvento.which;
    else
        return false;

    if (iAscii == 13) {

        carrito(ruta,id,cont,'1');
    }
    return true;
}




function iSubmitEnterPedidos2(ruta,cont,id,oEvento){
    var iAscii;

    if (oEvento.keyCode)
        iAscii = oEvento.keyCode;
    else if (oEvento.which)
        iAscii = oEvento.which;
    else
        return false;

    if (iAscii == 13) {

        carrito2(ruta,id,cont,'1');
    }
    return true;
}


function respuestaCarrito2(response){

    $("#cesta2").html(response);

}
