function fancyBoxFormatTitle( title, currentArray, currentIndex, currentOpts ) {
     var html;
     var desc, album, fotoid, link;
     
     desc = "Motion training fotoalbum - " + title;
     album = currentArray[currentIndex].rel;
     fotoid = currentArray[currentIndex].id
     link = window.location.protocol + "//" + window.location.host + "/fotoalbum/" + album + "/?extlinkid=" + fotoid;
     
     html = "<div class='fancybox-custom-title'>";
             
     html += "<div class='social-buttons'>";
     
     // facebook 
     html += "<script type=\"text/javascript\" src=\"/js/facebooklike.js\"></script>";
     html += "<span id=\"facebooklike\"></span>";
     html += "<script type=\"text/javascript\">";
     html += "$('#facebooklike').oneFBLike({url: '" + link + "'}); ";
     html += "</script>";

     // twitter  
     html += "<script type=\"text/javascript\" src=\"http://platform.twitter.com/widgets.js\"></script>";        
     html += "<span class='twitter'><a href=\"http://twitter.com/share\" class=\"twitter-share-button\" data-count=\"none\" data-url=\"" 
            + link + "\" data-text=\""+ desc +"\">Tweet</a></span>";             
     
     
     html += "</div>"; // social buttons
     
     
     html += "<span class='title'>"+title+"</span>";     
     
     html += "&nbsp;</div>"; // fancybos-custom-title
     
     return html;
}


$(function() {
    
 
   
    //fancybox op foto's
    $(".fancybox").fancybox({padding:0});
    
    
    
    //bladeren door foto's dmv cycle
    if ($(".prev").length > 0) {           
            $('#carousel').cycle({
                    prev: '.prev',
                    next: '.next',
                    easing: 'linear',
                    rev: true,
                    timeout: 0,
                    pause: 1,
                    fx:'scrollVert'
            });
            
    }  
    
    $(".fancybox_fotoalbum").fancybox({
        'padding' : 5,
        'titlePosition' : 'inside',
        'titleFormat' : fancyBoxFormatTitle
    });
     
   
   
});
