
Shadowbox.init({ slideshowDelay: 3 });

$(document).ready(function(){
  // navigation submenu
  $("#navigation .navigation-submenu").each(function (i) {

    bw = $(this).parent().outerWidth();
    smw = $(this).outerWidth();

    smlo = $(this).offset().left;
    sml = $(this).position().left;
    nlo = $("#navigation").offset().left;
    nw = $("#navigation").outerWidth();

    l = -50;

    if (smlo + l < nlo) {
      l = nlo - smlo;
    }

    if (smlo + smw > nlo + nw) {
      l = ((nlo + nw) - (smlo + smw));
    }

    $(this).css('left', l + 'px');
  });

  $('#featured-slideshow').cycle({
    fx:         'fade',
    speed:      1500,
    timeout:    5000,
    delay:      2000,
    sync:       1,
    pause:      true,
    slideExpr:  'img',
    pager:      '#thumbs ul',
    pagerAnchorBuilder: function(idx, slide) {
      // return selector string for existing anchor
      return '#thumbs ul li:eq(' + idx + ') a';
    }
  });

});


