jQuery(document).ready(function(){

    if(jQuery(".subnav-princ").length && jQuery("body").hasClass('front-interior')) { 
        jQuery("body").addClass('not-front-submenu');
    }

    // Estilos para ie
    if(jQuery.browser.msie){

        // acciones para IE
        DD_roundies.addRule('ul.nav-princ li a', '5px');
        DD_roundies.addRule('ul.nav-princ li.active a', '5px 5px 0px 0px');
        DD_roundies.addRule('a.buy', '5px');

        jQuery('#wrapper').addClass('ddr-done'); //DDRoundies done

        jQuery('.bloque-catalogo div:nth-child(3n)').addClass('last-element-column');

        if(jQuery.browser.version == '6.0'){

            // acciones para IE 6 :S
            DD_belatedPNG.fix( 'h1.fir a' );
            DD_belatedPNG.fix( '.search-form' );
            DD_belatedPNG.fix( '#search-send' );
            DD_belatedPNG.fix( '.image-explanation' );
            DD_belatedPNG.fix( '.pages a' );

            DD_belatedPNG.fix( '.tweets blockquote' );
            DD_belatedPNG.fix( '.tweets blockquote p' );
            DD_belatedPNG.fix( '.bloques-front li' );
            DD_belatedPNG.fix( '.content-2-columns' );

        }

        jQuery('.listado-galerias li:nth-child(3n+1)').addClass('col1');
        jQuery('.listado-galerias li:nth-child(3n+2)').addClass('col2');
        jQuery('.listado-galerias li:nth-child(3n)').addClass('col3');

    }

    // Bloques de la portada
    if( jQuery('.bloques-front li').length){
        jQuery('.bloques-front li:last-child').addClass('last');
    }

    //Estilos para los checkbox en formularios
    if (jQuery('.ctrl-holder input[type=checkbox]').length){
        jQuery('.ctrl-holder input[type=checkbox]').parent('label').parent('.ctrl-holder').addClass('ctrl-holder-checkbox');
    }


    //
    if(jQuery('.js .interactive-mode').length) {
        css = {
          'z-index': '10000',
          'right': '28%',
          'top': '32px'
        };
        jQuery('.js .interactive-mode').css(css);
    }

    // Paginador portada
    if (jQuery('.pager').length) { jQuery('.pager').pager('div.content', { navClass: 'pages', linkText: ['1', '2', '3', '4', '5', '6', '7'] }); }
    //if (jQuery(".tabs-container ul").length) {jQuery(".tabs-container ul").idTabs(); }

    // Fancybox de catálogo
    if (jQuery("a.lightbox").length) {
        jQuery("a.lightbox").fancybox({
            'titleShow': false,
            'scrolling': 'no',
            'overlayOpacity': 0
        });
    }

    //Carrusel
    if(jQuery('#mycarousel').length) {
        jQuery('#mycarousel').jcarousel({
            'scroll': 3
        });
    }


    if(jQuery('#thumbs').length) {

        var gallery = jQuery('#thumbs').galleriffic({
            delay:                     2500,
            numThumbs:                 3,
            preloadAhead:              3,
            enableTopPager:            false,
            enableBottomPager:         false,
            maxPagesToShow:            7,
            imageContainerSel:         '#slideshow',
            controlsContainerSel:      '#controls',
            captionContainerSel:       '#caption',
            loadingContainerSel:       '#loading',
            renderSSControls:          false,
            renderNavControls:         true,
            playLinkText:              'Play',
            pauseLinkText:             'Pause',
            prevLinkText:              'Anterior',
            nextLinkText:              'Siguiente',
            nextPageLinkText:          'Next &rsaquo;',
            prevPageLinkText:          '&lsaquo; Prev',
            enableHistory:             false,
            autoStart:                 false,
            syncTransitsions:           false,
            defaultTransitionDuration: 900
        });

        gallery.find('a.prev').click(function(e) {
            gallery.previousPage();
            e.preventDefault();
        });

        gallery.find('a.next').click(function(e) {
            gallery.nextPage();
            e.preventDefault();
        });

    }

    if (jQuery("#tweets-container-cycle").length) {
        jQuery('#tweets-container-cycle').cycle({
            fx: 'fade',
            speed:    1000,
            timeout:  8000 
        });
    }

    if( jQuery('#treeData').length ){

        jQuery('#treeData li ul').each(function() {
            jQuery(this).addClass('hide').parent().addClass('toogle').prepend('<span class="spnToog">+</span>')
        });

        jQuery('.spnToog').click(function() {
            var itm = jQuery(this);
            var cont = itm.html();
            if( cont == "+" ) itm.html('-'); else itm.html('+');
            itm.parent().children('ul').toggleClass('hide');
        });

    }

    if(jQuery('.tweets').length){
        jQuery('.bottom-content').css("background", "transparent");
    }
});

jQuery(function(){ 
    if (jQuery.browser.version != '6.0') {
        jQuery(".portlet-form-search-product select").uniform();
    }
});
