$(document).ready(function() {
  $(".sidebar_panel h3.expandable").click(function(e) {
    $(this).next("ul.sidebar_expanding_list").toggle('medium');
  });

  $("img#cocreation_process").click(function(e) {
    e.preventDefault();

    $(this).parent().find('.image_modal').modal({
      onOpen: function(dialog) {
        // Workaround to center lightbox
				this.dialog.overlay.show();
				this.dialog.data.show();
				this.dialog.container.show();
        this.setPosition();
      },
      opacity: 50
    });
  });

  $(".entry img.size-thumbnail, .entry img.size-medium, .entry img.size-large, .entry img.size-full").click(function(e) {
    e.preventDefault();

    $(this).parent('a').click(function(e) {
      e.preventDefault();

      var strModal = '<div class="image_modal"><img src="/wp-content/themes/default/images/ajax-loader.gif"/></div>';
      var strImgUrl = $(this).attr('href');
        $(strModal).modal({
          onShow: function(dialog) {
            var that = this;

            var img = new Image();
            $(img).load(function() {
              // Hide the image while it's loading
              $(this).hide();

              // hide ajax loader image
              $('img', that.dialog.data).hide();

              // append the image to the modal div
              dialog.data.append(this);

              // fade image in after load
              $(this).fadeIn();

              // Workaround to center lightbox
              that.dialog.overlay.show();
              that.dialog.data.show();
              that.dialog.container.show();
              that.setPosition();
            }).attr('src', strImgUrl);
          },
          opacity: 50,
          persist: true
        });

    });
  });
});


// Our Work Page 
// Display description on hover

$(function () {
  $('.our_work_item').hover(
    function (){
      $(this).children('.overlay_cover').show();
    },
    function (){
      $('.overlay_cover').hide();
    }
  );
});




