$(document).ready(function() {
  $("a.popup").fancybox({
    'type'          : 'iframe',
    'padding'       : 0,
    'margin'        : 0,
    'width'         : 400,
    'height'        : 375
  });
 $("a.fancybox").fancybox({autoScale: false});

});



$(function(){ $("label").inFieldLabels({fadeOpacity: 0.2}); });

$(".b-main-nav a").click(function(){
  $(".b-main-nav li.active").removeClass("active");
  $(this).parent().addClass("active");
});

$(".b-portfolio-item").hover(
  function(){$(this).find("cite").animate({bottom: "0"},{ duration: 250, queue: false });},
  function(){$(this).find("cite").animate({bottom: "-4.125em"},{ duration: 250, queue: false });}
);

$('dl.tabs dt').click(function(){
    $(this)
      .siblings().removeClass('active').end()
      .next('dd').andSelf().addClass('active');
    return false;
});

$('.roll span').click(function(){
  var shade =  $(this).parent().next('div');
    if (shade.hasClass('hidden')== true ) {
      shade.slideDown('fast', function(){$(this).removeClass('hidden');});
    }
    else {
      shade.slideUp('fast', function(){$(this).addClass('hidden');});
    }
});

$('.office .toggle-map').click(function(){
    var address = $(this).parentsUntil('.office').next("p:first").html();
    var geopoint = $(this).attr("rel");
    officeMap.initYandexMaps(geopoint,address);
});

