﻿$().ready(function () {
    $('#coda-slider-1').codaSlider({
        dynamicArrows: false,
        dynamicTabs: false
    });
    $('#coda-slider-2').codaSlider({
        dynamicArrows: false,
        dynamicTabs: false
    });
    $('a#latestnews').click(function () {
        $('.more_articles').hide(500);
        $('#extendedarticlesbutton').show();
    });
    $('a#dinghynews').click(function () {
        $('.more_articles').hide(500);
        $('#extendedarticlesbutton').show();
    });
    $('a#keelboatnews').click(function () {
        $('.more_articles').hide(500);
        $('#extendedarticlesbutton').show();
    });
    $('a#industrynews').click(function () {
        $('.more_articles').hide(500);
        $('#extendedarticlesbutton').show();
    });
    $('a#mostread').click(function () {
        $('.more_articles').hide(500);
        $('#extendedarticlesbutton').hide();
    });
    $('a#recentphotos').click(function () {
        $('.more_articles').hide(500);
        $('#extendedarticlesbutton').show();
    });
    $('a#forumposts').click(function () {
        $('.more_articles').hide(500);
        $('#extendedarticlesbutton').hide();
    });
    $("a.photo_lightbox").each(function () {
        var element = this;
        $(this).fancybox({
            'transitionIn': 'elastic',
            'transitionOut': 'elastic',
            'titlePosition': 'inside',
            'overlayColor': '#01325d',
            'overlayOpacity': 0.7,
            'titleFormat': function () {
                var astring = '<span><a href="/photo/' + element.id + '">' + element.title + '</a><br /><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.yachtsandyachting.com%2Fphoto%2F' + element.id + '&amp;send=false&amp;layout=button_count&amp;width=90&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=lucida+grande&amp;height=21&amp;appId=215421185135795" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:21px;" allowTransparency="true"></iframe></span>';
                return astring;
            }
        });
    });

    $('iframe').each(function () {
        var url = $(this).attr("src")
        $(this).attr("src", url + "?wmode=transparent")
    });

});
