(function($){

  $(document).ready(function(){

    // Big-afy clicked images
    $(".ui-zoom").fancybox({});

    // Animate scroll
    $("#menu").live('click',function(e){
      scrollTo(e,$($(e.target).attr('href')));
    });

    $(document).ready(function(e){
      scrollTo(e,$(document.location.hash));
    });

    function scrollTo(e,target) {
      var curY = $(window).scrollTop(), maxTime = 1200, newY, time, parent;
      if (target.length) {
        if (e.preventDefault) { e.preventDefault(); }
        parent = target.offsetParent();
        newY   = target.offset().top - parent.offset().top + 1; // 1px offset
        // If we're only scrolling a short distance we don't want it to take
        // forever
        time   = Math.min(Math.abs(newY - curY) / 2, maxTime);
        $('html, body').animate({scrollTop: newY}, time);
      }
    }

    $('.slideshow').cycle();
	
    // Fake display:table-cell
    if ($.browser.msie && $.browser.version == 7) {
      $("#solution-list h4").wrapInner("<table><tr><td></td></tr></table>");
    }
	
  });
})(jQuery);

