﻿$(document).ready(function() {
  $('.menulearn').addClass('current');
  $('.menulearn img').removeAttr('src').attr({ src: "res/images/learn-.png" });
  $('.header .menucenter').addClass('woody');

  $('.excel .group').jCarouselLite({ btnNext: '.next', btnPrev: '.prev' });

  $('.excel_').click(function() {
    $(this).removeClass('excelheader').addClass('excelactive');
    $('.share_').removeClass('sharepointactive').addClass('sharepointheader');
    $('.excel').show();
    $('.share').hide();
  });
  $('.share_').click(function() {
    $(this).removeClass('sharepointheader').addClass('sharepointactive');
    $('.excel_').removeClass('excelactive').addClass('excelheader');
    $('.excel').hide();
    $('.share').show();
  });

  $('.group ul li img').click(function() {
    var rel = $(this).attr('rel')
      desc = $(this).siblings().html();
    $('#screenshotdialog .image').css({ 'background': 'url(res/images/' + rel + '.png)' });
    $('#screenshotdialog .desc').html(desc);
    $('#greyout').show();
    $('#screenshotdialog').show();
    $('.close').show();

    var windowWidth = document.documentElement.clientWidth,
      popupWidth = $("#screenshotdialog").width(),
      scrolledY = document.documentElement.scrollTop,
      left = (windowWidth - popupWidth) / 2;

    $("#screenshotdialog").css({ 'top': scrolledY, 'left': left, 'margin-top': '30px' });
  });
  $('.close').click(function() {
    $('#greyout').hide();
    $('#screenshotdialog').hide();
    $('.close').hide();
  });
});