DY = window.DY || {};
DY.recalculatePositionScritte = function () {
    $('a[href="#photogallery_3"] canvas,#photogallery_3 canvas').css('top', '4px');
    $('a[href="#photogallery_7"] canvas,#photogallery_7 canvas').css('top', '2px');
    $('a[href="#photogallery_9"] canvas,#photogallery_9 canvas').css('top', '0px');
    $('a[href="#photogallery_4"] canvas,#photogallery_4 canvas').css('top', '-12px');
    $('a[href="#photogallery_5"] canvas,#photogallery_5 canvas').css('top', '-4px');
    $('a.videoLink canvas').css('top', '1px');
};
$(document).ready(function () {
    if ($.fancybox) {
        $("a[rel='lightbox']").fancybox();
    }

    if ($('#cycle').length > 0) {
        $('#cycle').cycle({
            timeout:2000
        });
    }

    //aggiungo il menu delle categorie photografiche
    if ($('a.linkToPhotogallery[href^="photogallery.php"]').length > 0) {
        //creo la lista

        var html = '<ul>';
        $('a.linkToPhotogallery[href^="photogallery.php"]').each(function () {
            html += '<li><a class="linkvirtualiGallery" href="' + $(this).attr('href') + '">' + $(this).children('span').html() + '</a></li>';
        });
        html += '</ul>';
        $('a[href="#elencoGalleries"]').append(html);
//        $('.linkvirtualiGallery').click(function () {
//            $('a[href="' + $(this).attr('alt') + '"]').click();
//        });
    }

    //correzioni menu
    $('#fissi a').first().css('border', 'none');

    $('.cssMenu').addClass('sf-menu');
    $('.cssMenu *').attr('style', '');
    $('.cssMenu *').attr('class', '');

    //linea sx
    $('.blkElencoSottoPagine_pagine a').each(function () {
        this.innerHTML = '-' + this.innerHTML;
    });


    $("ul.sf-menu").supersubs({
        minWidth:9.5, // minimum width of sub-menus in em units
        maxWidth:27, // maximum width of sub-menus in em units
        extraWidth:1     // extra width can ensure lines don't sometimes turn over
        // due to slight rounding differences and font-family
    }).superfish();

    //per i font dei bottoni delle gallerie
    if (Cufon) {
        //industriale
        Cufon.replace('a[href="#photogallery_3"],#photogallery_3', {
            fontFamily:'Walkway UltraExpand Bold',
            fontSize:18
        });
        //stil life
        Cufon.replace('a[href="#photogallery_7"],#photogallery_7', {
            fontFamily:'Tahoma'
        });

        //architettura
        Cufon.replace('a[href="#photogallery_9"],#photogallery_9', {
            fontFamily:'RM Typerighter',
            fontSize:41
        });


        //wedding
        Cufon.replace('a[href="#photogallery_4"],#photogallery_4', {
            fontFamily:'Zapfino',
            fontSize:16
        });


        //ritratti
        Cufon.replace('a[href="#photogallery_5"],#photogallery_5', {
            fontFamily:'Architects Daughter',
            fontSize:18
        });

        //video
        Cufon.replace('a.videoLink', {
            fontFamily:'DS-Digital',
            fontSize:23
        });

        //correzione posizione
        setTimeout(function () {
            DY.recalculatePositionScritte();
        }, 500);
        setTimeout(function () {
            DY.recalculatePositionScritte();
        }, 1500);
        setTimeout(function () {
            DY.recalculatePositionScritte();
        }, 5000);
    }


//  $('.blkLinkCatPhoto').hover(function(){
//      $(this).find('.blkBorderBottomGalls').addClass('blkBorderBottomGallsHeighter');
//  },function(){
//      $(this).find('.blkBorderBottomGalls').removeClass('blkBorderBottomGallsHeighter');
//  });  

//apertura dei bottone gallery con fancybox


//    $('.linkToPhotogallery').click(function(e){
//        e.preventDefault();
//        link=this.href.replace('#photogallery_','');
//        DY.attivaGalleryFancy(link);
//    });

//    $('.linkToPhotogallery').fancybox({
//        'autoDimensions'	: false,
//        'width'         		: 720,
//        'height'        		: 580,
//        'autoScale'		: false,
//        onStart:function(){
//            link=this.href.replace('#photogallery_','');
//        },
//        onComplete:function(){
//            link=this.href.replace('#photogallery_','');
//            DY.activateGallerifyc(link);
//        }
//    });

});

//per nascondere quello che non ancora rielaborato dal js
document.write('<style>.noscript { display: none; }</style>');


