$(function() {
  
  $('#container').dpg_resize_object({
    inherit_width_from: $(window),
    inherit_height_from: $(window),
    aspect_ratio: '3:2'
  });
  
  $('#container').dpg_centre({
    container: $(window)
  });
  
  $("#images").dpg_protect_images({
    disable_right_click: true,
    image_overlay: true
  });
  
  $("#homepage #images").dpg_scale_images({
    scale_percentage: 100,
    scale_axis: 'x',
    min_width: 2000,
    min_height: 200,
    max_width: 9999,
    max_height: 9999,
    width_deduction: 0,
    height_deduction: 100,
    fill_container: true,
    container: $("#container"),
    set_visibility: true
  });
  
  $("#gallery #images .image_list.second").dpg_scale_images({
    scale_percentage: 100,
    scale_axis: 'both',
    min_width: 2000,
    min_height: 200,
    max_width: 9999,
    max_height: 9999,
    width_deduction: 0,
    height_deduction: 110,
    fill_container: false,
    container: $("#container"),
    set_visibility: true
  });
  
  $("#gallery #images").dpg_fade_gallery({
    fade_speed: 'fast',
    images: 'second',
    thumbnails: 'first',
    navigation_previous_value: 'Prev',
    navigation_next_value: 'Next',
    navigation_separator_value: '',
    cursor: 'pointer',
    click_to_advance: true
  });
  
  $('#gallery #images .image_list.first').dpg_clone_attributes({
    source: $('.image_list.second'),
    clone_width: false,
    clone_height: true
  });
  
  $('#gallery #images .image_list.first').dpg_gallery_thumbnails({axis : 'vertical', toggle_visibility : true},
                                                                 function() {
                                                                   $('#gallery #images .image_list.first').dpg_clone_attributes({
                                                                     source: $('.image_list.second'),
                                                                     clone_width: false,
                                                                     clone_height: true
                                                                   });
                                                                 });
  
  $('#gallery #images').append('<div id="info"><a href="#">Info</a></div>');
  
  image_information = false;
  
  $('#info').click(function() {
    if (image_information) {
       $('.image_list.second .information').css('display','none');
      image_information = false;
    } else {
      $('.image_list.second .information').css('display','block');
      image_information = true;
    }
  });
  
});

