﻿
$(document).ready(function() {

    heightArray = new Array();
    elArray = new Array();
    $(".lineUpTexto").each(function(i) {
        heightArray.push($(this).height());

        elArray.push($(this).attr('id'));

    });

    $('.videoComTexto p').click(function() {
        var el = -1;

        for (var i = 0; i < elArray.length; i++) {
            if (elArray[i] == $(this).next().next().attr('id')) {
                el = i;
                break;
            }
        }

        if (el > -1) {
            $(this).next().next().css({ height: heightArray[el] });
            $(this).next().next().slideToggle();

        }


        return false;
    }).next().next().hide();


    $('.lineUpMedia a').click(function() {
        var video = $(this).parent().find('.lineUpVideo')

        if (video.attr('class') != null) {

            if (video.find('iframe').attr('title') == 'YouTube video player') {
                var temp = video.find('iframe').attr('src') + '&autoplay=1';
                video.find('iframe').attr('src', temp);
            } else if (video.find('iframe').attr('title') == 'vimeo') {
                var temp = video.find('iframe').attr('src') + '&autoplay=1';
                video.find('iframe').attr('src', temp);
            }

            video.toggle();
            $(this).toggle();
            return false;
        }
    })

});

function v(pecaID) {
    $(".peca").hide();
    $(".p" + pecaID).show();
}
