$(document).ready(
  function() {
    $('.desplegable, .desplegable li').hover(
      function() {
        $(this).children('ul, li').fadeIn('slow');
        $(this).children('ul ul').css('display', 'block');

        $(this).children('div').fadeIn('slow');
        $(this).children('div').css('display', 'block');
      },
      function() {
        $(this).children('ul, li').css('display', 'none');
        $(this).children('div').css('display', 'none');
      }
    );

    $('.limpia-checks').click(
      function() {
        $('input[type="checkbox"], input[type="radio"]').each(
          function() {
            $(this).filter('[readonly!="readonly"]').attr('checked', false);
          }
        )
      }
    );

    $('a[rel*=lightbox]').lightBox();

    $('.galeria-usado img').click(
      function() {
        $('.foto-usado img').attr('src', $(this).attr('src'));
      }
    );

    $('input[name="prestamo"]').change(
      function() {
        $('#prestamo').toggle();
      }
    );

    $('input[name="seguro"]').change(
      function() {
        $('#seguro').toggle();
      }
    );


    $('.marquesina').cycle({fx: 'fade', timeout: '8000', speed: '3000'});
  }
);

function expande(nodo) {
  var padre = nodo.parentNode;
  var hijo;

  for (var i = 0; padre.childNodes[i]; i++) {
    hijo = padre.childNodes[i];

    if (hijo.nodeName == 'DIV') {
      hijo.style.display = 'block';
    }
  }

  nodo.style.display = 'none';

  return false;
}

function cerrar(o) {
  document.getElementById(o).style.display = 'none';
}

function scroll() {
  setInterval('animacion()', 30);
}

function mostrar(id) {
  document.getElementById(id).style.display = 'block';
}

function ocultar(id) {
  document.getElementById(id).style.display = 'none';
}
