$(document).ready(function() {
      $('.help').colorbox({
         width: 500,
         height: "75%",
         opacity: 0.1,
         scrolling: false,
         onComplete: function() {
            $(".tab_content").hide(); 
            $("ul.tabs li:first").addClass("active").show(); 
            $(".tab_content:first").show(); 

            $("ul.tabs li").click(function() {
               var pat = /(tab\d)/;

               var oldTab = $("ul.tabs li.active").find("a").attr("href");
               var result = pat.exec(oldTab);
               var tab1 = result[1];

               $("ul.tabs li").removeClass("active"); 
               $(this).addClass("active"); 
               $(".tab_content").hide(); 

               var activeTab = $(this).find("a").attr("href"); 
               result = pat.exec(activeTab);
               var tab2 = result[1];

               $('#' + tab2).css('color', 'white');

               $('#' + tab2).fadeIn(function() {
                  $.fn.colorbox.resize();
                  $.doTimeout(500, function() {
                     $('#' + tab2).css('color', 'black');
                  });
               }); 

               return false;
            });

            $.fn.colorbox.resize();
            $('#colorbox').easydrag();
         }
      });

      $('a.groep').each(function() {
         var index = /\d/.exec(this.id);

         $("a[rel='groep" +  index + "']").colorbox({
            innerWidth:831, 
            innerHeight:529,
            current: "{current}/{total}",
            onComplete: function() {
               $("area").click(function() {
                  return false;
               });

               var classes = $(this).attr('class').split(' ');
               var digit = /\d/.exec(classes[0]);

               $('.cboxPhoto').attr('usemap', '#coords' + digit);
            }
         });

         $('#l_groep' + index).bind('click', function() {
              $("a[rel='groep" + index + "']").eq(0).trigger('click');
              return false;
         });
      });
});

