var learn_left_offset = 10;
function setupLearn() {
    var resources = $('#learn_resources a.resource');
    $('#learn_resources h3').css('left', learn_left_offset);
    $(resources).each(function() {
        var index = $(resources).index(this);
        $(this).css('left', learn_left_offset + index * 160);
        $(this).css('top', 20);
        $(this).css('font-size', '0.7em');
        $(this).css('padding-left', 5);
        $(this).css('width', 150);
    });
            
    //$('#learn_videos').css('height', 174);
    $('#learn_galleries').css('height', 184);    

    $('#learn_media h2').css('top', 0).css('left', 0);

    $('.pp_pic_holder').remove();
    $('.pp_overlay').remove();
    $('.ppt').remove();

    if($(".clearfix > a[rel^='prettyPhoto']").length > 0)
    {
        $(".clearfix > a[rel^='prettyPhoto']").prettyPhoto();
    }
        
    var learn_labels = $('#learn_galleries h4');
    $(learn_labels).each(function() {
        $(this).css('position', 'absolute').css('top', 55);
        var ind = $(learn_labels).index(this);
        $(this).css('left', 15 + 5 * (ind + 1) + ind * 160);
    });
    var learn_media  = $('#learn_galleries img');
    $(learn_media).each(function() {
        $(this).css('position', 'absolute').css('top', 45);
        var ind = $(learn_media).index(this);
        $(this).css('left', 15 + 5 * (ind + 1) + ind * 160);
    });    
}

function showLearn()
{
    setCookie('current_control', 'learn', 1);
    $('#content').show('slow');
    $('#learn').show('slow');
    $('#learn_info').accordion({header: 'a', active: 0 });
    var spans = $('#learn_info a span');
    $(spans.get(0)).text('');
    $('#learn_info a').click(function(e) {
        $('#learn_info a span').text('LEARN MORE');
        $('span', this).text('');
    });
    $('#learn_media_content').accordion({fillSpace: true, collapsible: false});
//    $('#learn_videos > a').css('display', 'block');
//    $('#learn_videos > h4').css('display', 'inline-block').css('height', 15);
//    $('#learn_galleries > a').css('display', 'block');
//    $('#learn_galleries > h4').css('display', 'inline-block').css('height', 15);
}

function hideLearn(callback)
{
    $('#learn_media_content').accordion('destroy');
    $('#learn_info').accordion("destroy");
    $('#learn').stop(true, true).hide('slow', callback);
}
