function scrollArriba(capa, valor) {

    document.getElementById(capa).style.top=parseInt(document.getElementById(capa).style.top)-valor+'px';

}

function scrollAbajo(capa, valor) {

    obj = parseInt(document.getElementById("cuentaControlScroll").value);

    if (obj!=0){
      document.getElementById(capa).style.top=parseInt(document.getElementById(capa).style.top)+valor+'px';
    }

}

function incrementarControlScroll(tipo) {

    obj = parseInt(document.getElementById(tipo).value);
    //window.alert("incrementar antes"+obj);
    document.getElementById(tipo).value = parseInt(obj) + 1;
    //window.alert("incrementar despues"+obj);

}

function decrementarControlScroll(tipo) {

    obj = parseInt(document.getElementById(tipo).value);
    //window.alert("decrementar antes"+obj);
    if (obj!=0){
      document.getElementById(tipo).value = parseInt(obj) - 1;
      //window.alert("decrementar despues"+obj);
    }

}



//function scrollArriba(capa, valor) {
//    document.getElementById(capa).style.top=parseInt(document.getElementById(capa).style.top)-valor+'px';
//}
//
//function scrollAbajo(capa, valor) {
//    obj = parseInt(document.getElementById("controlScroll").value);
//
//    if (obj!=0){
//      document.getElementById(capa).style.top=parseInt(document.getElementById(capa).style.top)+valor+'px';
//    }
//}
//
//function incrementarControlScroll(tipo) {
//
//    obj = parseInt(document.getElementById(tipo).value);
//    //window.alert("incrementar antes"+obj);
//    document.getElementById(tipo).value = parseInt(obj) + 1;
//    //window.alert("incrementar despues"+obj);
//
//}
//
//function decrementarControlScroll(tipo) {
//
//    obj = parseInt(document.getElementById(tipo).value);
//    //window.alert("decrementar antes"+obj);
//    if (obj!=0){
//      document.getElementById(tipo).value = parseInt(obj) - 1;
//      //window.alert("decrementar despues"+obj);
//    }
//
//}



function mostrar_capa(id) {

    capa = document.getElementById(id);
    capa.style.display = "block";

    return true;
}


function ocultar_capa(id) {

    capa = document.getElementById(id);
    capa.style.display = "none";

    return true;
}

//Funcion para mostrar una capa en lugar de otra; oculta todas las capas y muestra la que recibe
function muestra_capa_sel2(item, nombre)
{

    obj=document.getElementById(item);
    divs=document.getElementsByTagName("div");
    for (i=0;i<divs.length;i++)
        {
            if (divs[i].id.substring(0,nombre.length)==nombre)
                {
                    divs[i].style.display="none";
                }
            }
            obj.style.display="block";
        }


        ///////////////// FUNCIONES PARA EL APARTADO DE VENTAS  ////////////////////////


        //Funcion para mostrar una capa en lugar de otra; oculta todas las capas y muestra la que recibe
        function muestra_una_capa_oculta_el_resto(capaParaMostrar, caparParaOcultar, capasQueSeDebenVer, capasQueNoSeDebenVer){
            mostrar=document.getElementById(capaParaMostrar);
            ocultar=document.getElementById(caparParaOcultar);
            divs=document.getElementsByTagName("div");
            for (i=0;i<divs.length;i++){
                if (divs[i].id.substring(0,capasQueNoSeDebenVer.length)==capasQueNoSeDebenVer){
                    divs[i].style.display="none";
                }
            }
            for (i=0;i<divs.length;i++){
                if (divs[i].id.substring(0,capasQueSeDebenVer.length)==capasQueSeDebenVer){
                    divs[i].style.display="block";
                }
            }
            mostrar.style.display="block";
            ocultar.style.display="none";
        }


        function controlarCapaClientes(item, capa) {

            var indice = item.selectedIndex

            if (item.options[indice].value == 6) { //es usuario externo
                mostrar_capa(capa);
            } else {
            ocultar_capa(capa);
        }



    }



    function limpiarForm(){
        var f1 = document.getElementById("fechaInicio");
        f1.value = "";

        var f2 = document.getElementById("fechaFinal");
        f2.value = "";

        var txt = document.getElementById("textoBuscar");
        txt.value = "";
    }