$(function() {
  
  if ($.support.opacity) {
    $('#project_images li .project-overlay').css({ opacity: 0, display: 'block'});
    $('#project_images li').hover(function() {
      $(this).find('.project-overlay').stop().animate({ opacity: 1 });
    }, function() {
      $(this).find('.project-overlay').stop().animate({ opacity: 0 });
    });
  } else {
    $('#project_images li').hover(function() {
      $(this).find('.project-overlay').show();
    }, function() {
      $(this).find('.project-overlay').hide();
    });
  }
  
  $('#project_info_thumbnails li img:gt(0)').css('opacity', '0.4');
  
  $('#project_info_thumbnails li').click(function() {
    $(this).parent().find('li img').css('opacity', '0.4');
    $(this).find('img').css('opacity', '1.0');
    $('#project_info_img_big').css('background', 'transparent url("' + $(this).attr('data-img-big') + '") no-repeat scroll 0 0');
  });
  
  $('#gmap_address').icastGMap({
    zoom: 16,
    center: new google.maps.LatLng(50.162143904072146, 8.656392395496368),
    directions: {
      enabled: true,
      destination: 'Alt Eschersheim 60, Frankfurt am Main',
      panelId: 'gmap_directions'
    },
    marker: {
      enabled: true,
      lat: 50.1612778885697,
      lng: 8.656392395496368,
      has_info_window: true,
      content: '<img src="' + $('#logo a img').attr('src') + '" width="230" height="40" />',
      icon: {
        image: $('#house_icon').attr('src'),
        width: 32,
        height: 32,
        anchor: {
          x: 16,
          y: 30
        }
      }
    }
  });
  
  $('#home_slider').icastSlider({
    effect: 'fade',
    directionNav: false,
    startSlide: 0
  });
  
  $('a.projects_link').live('click', function(event) {
    location.href = $(this).attr('href');
  });
  
  $('.impressum').jScrollPane();
  $('.publication').jScrollPane();
  
});

