// raschke.de specific JavaScript

function fade_to_next(current, max, timeout) {
  var next = (current % max) + 1;

  $('fade_' + current).fade();
  $('fade_' + next).appear();
  
  window.setTimeout("fade_to_next(" + next + ", " + max + ", " + timeout +")", timeout);
}

function rotate_images(max, timeout) {
  window.setTimeout("fade_to_next(1, " + max + ", " + timeout + ")", timeout / 2);
}

function slide_to(next, num) {
  var last = (next + num - 2) % num + 1;

  $('slide_' + last).blindUp({ duration: 0.33 });
  $('slide_' + next).blindDown({ duration: 0.33, queue: 'end' });
}

function show_jewellery(index, description) {
  $('desc').innerHTML = description;
  $('desc').highlight({ startcolor: '#f0f0f0', endcolor: '#ffffff', duration: 0.3 });
  var imagesToHide = $$('img.zoom_img');
  for (var i = 0; i < imagesToHide.length; ++i)
    imagesToHide[i].style.display = 'none';
  $('zoom_img_' + index).style.display = 'inline';
  $('zoom_div').appear({ duration: 0.3 });
}

function hide_jewellery() {
  $('zoom_div').fade({ duration: 0.3 });
  $('desc').highlight({ startcolor: '#f0f0f0', endcolor: '#ffffff', duration: 0.3 });
  $('desc').innerHTML = 'Ein kleiner Auszug aus der Kollektion.'
}
